00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef OSDL_EMBEDDED_FILE_SYSTEM_MANAGER_H_
00028 #define OSDL_EMBEDDED_FILE_SYSTEM_MANAGER_H_
00029
00030
00031
00032 #include "Ceylan.h"
00033
00034
00035 #include <string>
00036
00037
00038
00039 namespace OSDL
00040 {
00041
00042
00043
00044 class OSDL_DLL EmbeddedFileSystemManagerException:
00045 public Ceylan::System::FileSystemManagerException
00046 {
00047
00048 public:
00049
00050 explicit EmbeddedFileSystemManagerException(
00051 const std::string & reason ) :
00052 Ceylan::System::FileSystemManagerException( reason )
00053 {
00054
00055 }
00056
00057 } ;
00058
00059
00060
00061
00083 class OSDL_DLL EmbeddedFileSystemManager:
00084 public Ceylan::System::FileSystemManager, public Ceylan::Object
00085 {
00086
00087
00088
00089 public:
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00158 virtual void chooseBasicSettings(
00159 const std::string & organizationName,
00160 const std::string & applicationName,
00161 const std::string & archiveExtension = "oar",
00162 bool archiveFirst = true,
00163 bool includeInsertedMedia = false ) ;
00164
00165
00166
00172 virtual bool hasWriteDirectory() const ;
00173
00174
00175
00184 virtual std::string getWriteDirectory() const ;
00185
00186
00187
00206 virtual void setWriteDirectory(
00207 const std::string & newWriteDirectory ) ;
00208
00209
00210
00252 virtual void mount(
00253 const std::string & newActualFilesystemElement,
00254 const std::string & mountPointInVirtualTree = "",
00255 bool append = true ) ;
00256
00257
00258
00278 virtual void umount( const std::string & actualFilesystemElement ) ;
00279
00280
00281
00290 virtual std::string getMountPointFor(
00291 const std::string & actualFilesystemElement ) const ;
00292
00293
00294
00305 virtual std::list<std::string> getSearchPath() const ;
00306
00307
00308
00309
00310
00311
00312
00313
00314
00334 virtual bool existsAsEntry( const std::string & entryPath ) const ;
00335
00336
00337
00344 virtual void createSymbolicLink( const std::string & linkTarget,
00345 const std::string & linkName ) ;
00346
00347
00348
00359 virtual time_t getEntryChangeTime( const std::string & entryPath ) ;
00360
00361
00362
00363
00364
00365
00366
00367
00374 virtual const std::string & getRootDirectoryPrefix() const ;
00375
00376
00377
00385 virtual Ceylan::Latin1Char getSeparator() const ;
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00431 virtual Ceylan::System::File & createFile(
00432 const std::string & filename,
00433 Ceylan::System::OpeningFlag createFlag =
00434 Ceylan::System::File::CreateToWriteBinary,
00435 Ceylan::System::PermissionFlag permissionFlag =
00436 Ceylan::System::File::OwnerReadWrite ) ;
00437
00438
00439
00459 virtual Ceylan::System::File & openFile(
00460 const std::string & filename,
00461 Ceylan::System::OpeningFlag openFlag
00462 = Ceylan::System::File::OpenToReadBinary ) ;
00463
00464
00465
00504 virtual std::string getActualLocationFor(
00505 const std::string & filename ) const ;
00506
00507
00508
00546 virtual bool existsAsFileOrSymbolicLink(
00547 const std::string & filename ) const ;
00548
00549
00550
00564 virtual bool existsAsSymbolicLink(
00565 const std::string & linkName ) const ;
00566
00567
00568
00595 virtual void removeFile( const std::string & filename ) ;
00596
00597
00598
00613 virtual void moveFile( const std::string & sourceFilename,
00614 const std::string & targetFilename ) ;
00615
00616
00617
00629 virtual void copyFile( const std::string & sourceFilename,
00630 const std::string & targetFilename ) ;
00631
00632
00633
00651 virtual Ceylan::System::Size
00652 getSize( const std::string & filename ) ;
00653
00654
00655
00673 virtual time_t getLastChangeTimeFile(
00674 const std::string & filename ) ;
00675
00676
00677
00678
00679
00680
00681
00702 virtual void touch( const std::string & filename ) ;
00703
00704
00705
00706
00707
00708
00709
00747 virtual void allowSymbolicFiles( bool newStatus ) ;
00748
00749
00750
00751
00752
00753
00754
00755
00756
00757
00758
00759
00775 virtual Ceylan::System::Directory & createDirectory(
00776 const std::string & newDirectoryName ) ;
00777
00778
00779
00797 virtual Ceylan::System::Directory & openDirectory(
00798 const std::string & directoryName = "" ) ;
00799
00800
00801
00814 virtual bool existsAsDirectory(
00815 const std::string & directoryPath ) const ;
00816
00817
00818
00836 virtual void removeDirectory( const std::string & directoryPath,
00837 bool recursive = false ) ;
00838
00839
00840
00855 virtual void moveDirectory(
00856 const std::string & sourceDirectoryPath,
00857 const std::string & targetDirectoryPath ) ;
00858
00859
00860
00873 virtual void copyDirectory(
00874 const std::string & sourceDirectoryPath,
00875 const std::string & targetDirectoryPath ) ;
00876
00877
00878
00889 virtual time_t getLastChangeTimeDirectory(
00890 const std::string & directoryPath ) ;
00891
00892
00893
00905 virtual bool isAValidDirectoryPath(
00906 const std::string & directoryString ) ;
00907
00908
00909
00910
00911
00912
00913
00920 virtual bool isAbsolutePath( const std::string & path ) ;
00921
00922
00923
00934 virtual std::string getCurrentWorkingDirectoryPath() ;
00935
00936
00937
00948 virtual void changeWorkingDirectory(
00949 const std::string & newWorkingDirectory ) ;
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00972 static std::string GetBackendLastError() ;
00973
00974
00975
00981 static Ceylan::Byte GetXORByte() ;
00982
00983
00984
00996 virtual const std::string toString(
00997 Ceylan::VerbosityLevels level = Ceylan::high ) const ;
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01025 static EmbeddedFileSystemManager &
01026 GetEmbeddedFileSystemManager( bool cypher = true ) ;
01027
01028
01029
01048 static bool SecureEmbeddedFileSystemManager() ;
01049
01050
01051
01061 static void RemoveEmbeddedFileSystemManager() ;
01062
01063
01064
01086 explicit EmbeddedFileSystemManager( bool cypher = true ) ;
01087
01088
01089
01097 virtual ~EmbeddedFileSystemManager() throw() ;
01098
01099
01100
01101
01102
01103
01104
01105
01112 static std::string ArchivePathEnvironmentVariable ;
01113
01114
01115
01125 static Ceylan::System::FileLocator ArchiveFileLocator ;
01126
01127
01128
01143 static std::string FindArchivePath(
01144 const std::string & archiveFilename ) ;
01145
01146
01147
01148
01149 private:
01150
01151
01152
01157 bool _cypher ;
01158
01159
01160
01166 static const Ceylan::Byte XORByte ;
01167
01168
01169
01170
01171
01172
01173
01174
01180 static const std::string RootDirectoryPrefix ;
01181
01182
01189 static const Ceylan::Latin1Char Separator ;
01190
01191
01192
01201 EmbeddedFileSystemManager(
01202 const EmbeddedFileSystemManager & source ) ;
01203
01204
01213 EmbeddedFileSystemManager & operator = (
01214 const EmbeddedFileSystemManager & source ) ;
01215
01216
01217
01218
01220 static EmbeddedFileSystemManager * _EmbeddedFileSystemManager ;
01221
01222
01223
01224 } ;
01225
01226
01227 }
01228
01229
01230
01231 #endif // OSDL_EMBEDDED_FILE_SYSTEM_MANAGER_H_
01232