Source: xql/xqlstore.h


Annotated List
Files
Globals
Hierarchy
Index
/***************************************************************************
                          xqlstore.h  -  description
                             -------------------
    begin                : Tue Mar 12 2002
    copyright            : (C) 2002 by Raoul Markus
    email                : raoul.markus@gmx.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef XQLSTORE_H
#define XQLSTORE_H
#include 

class xqlFtp;


/**provides a electronic vault for files.
 basic data are stored in 2 tables:
 xqlstore and xqlfile.
 This class accesses the local filesystem to get put the files into the
 user space. It also accesses the distinct fileserver by ftp to store  fetch
 the files in a safe way.
 * @author Raoul Markus
 */

class xqlStore : public xqlObject  {
public: 
	xqlStore(xqlSession * pThisSession);
	~xqlStore();
  /**
     sets the username
    */
  void setUser(const std::string pUser);
  /** trys to open an ftp-connection to the server, and trys to create the initial directories
to store the files. */
  void initStoreOnServer();
  /**
     gets a file, given by pFileId out of the store and stores it under the given filename
  */
  void getFile(xqlid pFileId, std::string pFileName);
  /**
     creates a new fileId for the given file and stores it into the store. returns the new fileid
     for this file.
   */
  int putFile(const std::string pFileName);
  /** sets the password for this function
 */
  void setPasswd(const std::string  pPasswd);
  /** returns the classname of this type */
  virtual char * className();
  /** 
creates a new instance of the object. an id is given, space is allocated in the database.
 */
  bool createInstance();
  /** loads the instance given by pInstId from the database.

 */
  bool loadInstance(int pInstId);
  /** sets the server address (IP- or full qualified domain) for this store
 */
  void setServer(const std :: string  pServer);
  /** sets the server path for this store. Under this path, all files are stored on the ftp-server
Do not change the server path if files are already in this store. they would be lost
if you do not copy the files by hand.
 */
  void setPath(const std :: string pDir);
  /**
      returns the filename for a given file id.
    */
  static std::string getFilename(xqlOdbc * pConn, xqlid pFileId);
  /** returns the store for a given file id */
  static int getStoreOfFile(xqlOdbc * pConn, int pFileId);
  /** returns just the filename of a given path */
  std::string filename(std::string pPathname);
private: // Private attributes
  /** pointer to this ftp-object. */
  xqlFtp * mFtp;
  std::string mFtpUserName;
  std::string mFtpUserPasswd;
  std::string mFtpServer;
  std::string mFtpDirectory;
private: // Private methods
  /**
     connects the xqlftp and brings it into state to perform actions
    */
  void connect();
  /**
     gets a unique fileid (for this store)
   */
  int getNewFileId();
  /** creates a new, unique file name for the given file id.  */
  std::string getNewFileName(xqlid pFileId);
  /** returns the filename like stored in the ftp directory */
  std::string getStoredFilename(xqlid pFileId);
};

#endif

Generated by: markus on hobbes on Fri Mar 29 16:15:24 2002, using kdoc 2.0a53.