00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef SCPM_H
00019 #define SCPM_H
00020
00021 #include <string>
00022 #include <vector>
00023 #include <scpm_types.h>
00024 #include <scdb.h>
00025
00026 class SCPM
00027 {
00028 public:
00029
00030 SCPM( int options=0, std::ostream &info_out=cout, std::ostream &hash_out=cout, std::string root="" );
00031 ~SCPM();
00032
00033 bool Enable( bool force=false );
00034 bool Disable( );
00035
00036 bool Active( std::string &profile );
00037 bool List( std::vector<std::string> &profiles );
00038
00039 bool Add( std::string profile, bool auto_switch=true );
00040 bool Copy( std::string source_profile, std::string profile );
00041 bool Create( std::string profile, std::string source_profile );
00042 bool Delete( std::string profile );
00043 bool Rename( std::string profile, std::string newprofile );
00044 bool Reload( );
00045 bool PrepareSwitch( std::string profile, switch_info_t &switch_info );
00046 bool Switch( switch_info_t &switch_info );
00047 bool Save( switch_info_t &switch_info );
00048 bool Modify( std::string profile, std::string action );
00049 bool Set( std::string command, std::string argument, std::string profile="" );
00050 bool Get( std::string command, std::string &result, std::string profile="" );
00051 bool Status( scpm_status_t &status );
00052
00053 bool ShowChanges( std::ostream &output, std::string resource_type,
00054 std::string resource_name, bool backup=false );
00055
00056 bool SetResourceSet( std::string set );
00057 bool GetResourceSet( std::string &set );
00058 bool ListResourceSets( std::vector<std::string> &predefined, std::vector<std::string> &individual );
00059 bool CopyResourceSet( std::string set, std::string newset );
00060 bool DeleteResourceSet( std::string set );
00061
00062 bool ListResourceGroups( std::vector<resource_group_t> &groups );
00063 bool GetResourceGroup( const std::string &name, std::vector<resource_entry_t> &group,
00064 bool nouser=false );
00065 bool GetResourceGroup( const std::string &name, std::vector<resource_entry_t> &group,
00066 std::string &description, bool nouser=false );
00067 bool SetResourceGroup( const std::string &name, const std::vector<resource_entry_t> &group,
00068 const std::string &description );
00069 bool DeleteResourceGroup( const std::string &group );
00070 bool RenameResourceGroup( const std::string &group, const std::string &newgroup );
00071 bool SetActiveResourceGroups( const std::vector<std::string> &groups );
00072 bool GetActiveResourceGroups( std::vector<std::string> &groups );
00073 bool ActivateResourceGroup( const std::string &group, bool auto_add=false );
00074 bool DeactivateResourceGroup( const std::string &group, bool auto_remove=false );
00075 bool ResetResourceGroup( const std::string &group );
00076 bool ResetAllGroups( );
00077
00078 bool RebuildDB( rebuild_mode_t mode=REBUILD_MODE_QUICK );
00079
00080 bool SetConfigOption( const std::string &option, const std::string &value );
00081 bool GetConfigOption( const std::string &option, std::string &value );
00082
00083
00084 bool Update( const std::string &scriptname, std::vector<pair<std::string, std::string> > resources );
00085 bool UpdateResources( );
00086 bool Backup( const std::string &command, const std::vector<pair<std::string,std::string> > &resources,
00087 const std::string &profile, std::vector<backup_info_t> *reslist=NULL );
00088 bool Recover( bool rollback=false );
00089
00090 bool Commit( );
00091
00092 };
00093
00094
00095 #endif