scpm.h

Go to the documentation of this file.
00001 /*
00002  * $Id: scpm.hh,v 1.3 2005/07/22 15:12:37 gleissner Exp $
00003  *
00004  *
00005  * Project               :      SCPM (System Configuration Profile Management)
00006  * Module                        :      SCPM main engine
00007  * File                          :      scpm.hh
00008  * Description :        defines the SCPM interface
00009  * Author                        :      Joachim Gleissner <jg@suse.de>
00010  *
00011  * Copyright 2001 SuSE GmbH
00012  *                                       2002-2004 SuSE Linux AG
00013  *
00014  * Released under the terms of the GNU General Public License
00015  * (see file COPYRIGHT in project root directory).
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                 // update and backup functions
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

SCPM interface description - 2002,2003 SuSE Linux AG