(file) Return to ConfigFile.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Config

  1 karl  1.9 //%2005////////////////////////////////////////////////////////////////////////
  2 mike  1.2 //
  3 karl  1.8 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4           // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5           // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.6 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.8 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8           // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10           // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 mike  1.2 //
 12           // Permission is hereby granted, free of charge, to any person obtaining a copy
 13           // of this software and associated documentation files (the "Software"), to
 14           // deal in the Software without restriction, including without limitation the
 15           // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16           // sell copies of the Software, and to permit persons to whom the Software is
 17           // furnished to do so, subject to the following conditions:
 18 david.dillard 1.11 //
 19 mike          1.2  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20                    // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21                    // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22                    // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23                    // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24                    // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25                    // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26                    // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27                    //
 28                    //==============================================================================
 29                    //
 30                    // Author: Nag Boranna (nagaraja_boranna@hp.com)
 31                    //
 32 vijay.eli     1.10 // Modified By: Vijay Eli, IBM (vijayeli@in.ibm.com), bug#3608.
 33 david.dillard 1.11 //              David Dillard, VERITAS Software Corp.
 34                    //                  (david.dillard@veritas.com)
 35 mike          1.2  //
 36                    //%/////////////////////////////////////////////////////////////////////////////
 37                    
 38                    #ifndef Pegasus_ConfigFile_h
 39                    #define Pegasus_ConfigFile_h
 40                    
 41                    #include <Pegasus/Common/Config.h>
 42                    #include <Pegasus/Config/Linkage.h>
 43                    #include <Pegasus/Common/String.h>
 44 kumpf         1.5  #include <Pegasus/Common/ArrayInternal.h>
 45 kumpf         1.4  #include <Pegasus/Common/InternalException.h>
 46 mike          1.2  #include <Pegasus/Config/ConfigExceptions.h>
 47                    
 48                    PEGASUS_NAMESPACE_BEGIN
 49                    
 50                    ////////////////////////////////////////////////////////////////////////////////
 51                    //  ConfigFile Class
 52                    ////////////////////////////////////////////////////////////////////////////////
 53                    
 54                    struct ConfigTable;
 55                    
 56                    /**
 57 david.dillard 1.11   This class provides methods to read/write configuration properties from the
 58 mike          1.2    config file.
 59                    */
 60                    class PEGASUS_CONFIG_LINKAGE ConfigFile
 61                    {
 62                    public:
 63                    
 64 david.dillard 1.11     /**
 65                        Constructor.
 66 mike          1.2  
 67                        @exception  FileNotReadable  if the specified file is not readable.
 68                        */
 69                        ConfigFile(const String& fileName);
 70                    
 71                    
 72                        /** Destructor. */
 73 david.dillard 1.11     ~ConfigFile();
 74 mike          1.2  
 75                    
 76 david.dillard 1.11     /**
 77 mike          1.2      Get the name of the configuration file.
 78                    
 79                        @return String    name of the config file.
 80                        */
 81 vijay.eli     1.10     String getFileName() const;
 82 mike          1.2  
 83                    
 84 david.dillard 1.11     /**
 85 mike          1.2      Load the properties from the config file.
 86                    
 87                        @param     confTable   hash table containing the config properties.
 88                        @exception ConfigFileSyntaxError  if config file contains a syntax error.
 89                    
 90 david.dillard 1.11     Note: Original code was taken from OptionManager::mergeFile()
 91 mike          1.2      */
 92                        void load(ConfigTable* confTable);
 93                    
 94                    
 95 david.dillard 1.11     /**
 96 mike          1.2      Save the properties to the config file.
 97                    
 98                        @param  confTable    hash table containing the config properties.
 99 david.dillard 1.11     @exception  CannotRenameFile  if failed to create the backup file.
100                        @exception  CannotOpenFile  if failed to set permissions on the config file.
101 mike          1.2      */
102                        void save(ConfigTable* confTable);
103                    
104                    
105 david.dillard 1.11     /**
106 mike          1.2      Replace the properties in the config file with the properties from
107                        the given file
108                    
109                        @param      fileName     the config file name to be copied.
110                        @exception  NoSuchFile   if the specified file cannot be opened.
111                        @exception  FileNotReadable  if the specified file is not readable.
112                        @exception  CannotRenameFile if failed to create the backup file.
113 david.dillard 1.11     @exception  CannotOpenFile  if failed to set permissions on the config file.
114 mike          1.2      */
115                        void replace(const String& fileName);
116                    
117                    
118                    private:
119                        String    _configFile;
120                        String    _configBackupFile;
121                    };
122                    
123                    
124                    PEGASUS_NAMESPACE_END
125                    
126                    #endif /* Pegasus_ConfigFile_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2