00001
00002 #ifndef ANAPHE_TREE
00003 #define ANAPHE_TREE 1
00004
00005 #include <vector>
00006 #include <string>
00007 #include <map>
00008 #include <set>
00009 #include "AIDA_Dev/IDevTree.h"
00010
00011
00012 namespace AIDA {
00013 class IManagedObject;
00014
00015 namespace Dev {
00016 class IStore;
00017 }
00018 }
00019
00020
00021 namespace Anaphe {
00022 namespace AIDA_Tree_native {
00023 class SubTree;
00024 class MountInfo;
00025
00027
00028 class AIDA_Tree : virtual public AIDA::Dev::IDevTree
00029 {
00030 public:
00032 AIDA_Tree( AIDA::Dev::IStore* store );
00034 ~AIDA_Tree();
00035
00037 bool add( AIDA::IManagedObject * object,
00038 const std::string& directory = "." );
00039 bool copyAndAdd( AIDA::IManagedObject * object,
00040 const std::string& newPath );
00041 AIDA::Dev::IStore* store( const std::string& path = "." );
00042 AIDA::Dev::IStore* nativeStore();
00043 std::string pathInStore( const AIDA::IManagedObject& object ) const;
00044 bool existsDirectory( const std::string& directory ) const;
00045 bool isMounted() const;
00046 bool setParentTree( AIDA::Dev::IDevTree * parentTree );
00047 bool unmountTree( AIDA::Dev::IDevTree * daughterTree );
00048
00050 const std::string & storeName() const;
00051 AIDA::IManagedObject * find( const std::string & path );
00052 bool cd( const std::string & path );
00053 const std::string & pwd() const;
00054 bool ls( const std::string & path = ".",
00055 bool recursive = false,
00056 std::ostream & os = std::cout ) const;
00057 std::vector< std::string > listObjectNames( const std::string & path = ".",
00058 bool recursive = false ) const;
00059 std::vector< std::string > listObjectTypes( const std::string & path = ".",
00060 bool recursive = false ) const;
00061 bool mkdir( const std::string & path );
00062 bool mkdirs( const std::string & path );
00063 bool rmdir( const std::string & path );
00064 bool rm( const std::string & path );
00065 std::string findPath( const AIDA::IManagedObject & object ) const;
00066 bool mv( const std::string & oldPath,
00067 const std::string & newPath );
00068 bool commit();
00069 void setOverwrite( bool overwrite = true );
00070 bool cp( const std::string & oldPath,
00071 const std::string & newPath,
00072 bool recursive = false );
00073 bool symlink( const std::string & path,
00074 const std::string & alias );
00075 bool mount( const std::string & path,
00076 AIDA::ITree & tree,
00077 const std::string & treePath );
00078 bool unmount( const std::string & path );
00079 bool close();
00080
00081 private:
00082 AIDA::Dev::IStore* m_store;
00083 AIDA::Dev::IDevTree* m_parentTree;
00084 bool m_overWrite;
00085 std::string m_cwd;
00086 std::map< AIDA::Dev::IDevTree*, Anaphe::AIDA_Tree_native::MountInfo* > m_mountPoints;
00087 std::map< const AIDA::IManagedObject*, std::string > m_objectPaths;
00088 Anaphe::AIDA_Tree_native::SubTree* m_rootDir;
00089
00090
00091 std::string absolutePath( const std::string& path ) const;
00092 };
00093
00094 }
00095 }
00096
00097 #endif