(file) Return to cimserver.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Server

Diff for /pegasus/src/Server/cimserver.cpp between version 1.34.2.3 and 1.34.2.4

version 1.34.2.3, 2001/08/02 19:15:25 version 1.34.2.4, 2001/08/15 23:43:47
Line 93 
Line 93 
 PEGASUS_USING_PEGASUS; PEGASUS_USING_PEGASUS;
 PEGASUS_USING_STD; PEGASUS_USING_STD;
  
 /**  //
     The command name.  //  The command name.
 */  //
 static const char COMMAND_NAME []    = "cimserver"; static const char COMMAND_NAME []    = "cimserver";
  
   //
   //  The constant defining usage string.
   //
   static const char USAGE []           = "Usage: ";
   
 /** /**
     The constant defining usage string.  Constants representing the command line options.
 */ */
 static const char USAGE []           = "Usage: ";  static const char OPTION_VERSION     = 'v';
   
   static const char OPTION_HELP        = 'h';
   
   static const char OPTION_HOME        = 'D';
   
  
  
 void GetEnvironmentVariables( void GetEnvironmentVariables(
Line 156 
Line 166 
     {     {
         throw cfse;         throw cfse;
     }     }
       catch(UnrecognizedConfigProperty ucp)
       {
           throw ucp;
       }
       catch(InvalidPropertyValue ipv)
       {
           throw ipv;
       }
 } }
  
 /* PrintHelp - This is temporary until we expand the options manager to allow /* PrintHelp - This is temporary until we expand the options manager to allow
Line 172 
Line 189 
     usage.append (COMMAND_NAME);     usage.append (COMMAND_NAME);
     usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");     usage.append (" [ [ options ] | [ configProperty=value, ... ] ]\n");
     usage.append ("  options\n");     usage.append ("  options\n");
     usage.append ("    -v    - prints out the version number\n");      usage.append ("    -v          - displays pegasus version number\n");
     usage.append ("    -h    - prints this help message\n");     usage.append ("    -h    - prints this help message\n");
     usage.append ("    -t    - turns tracing on\n");     usage.append ("    -t    - turns tracing on\n");
     usage.append ("    -l    - turns logging on\n");      usage.append ("    -t          - turns on trace of client IO to console\n");
     usage.append ("  configProperty\n");      usage.append ("    -l          - turns on trace of client IO to trace file\n");
     usage.append ("    port=nnnn  - specifies port number to listen on\n");      usage.append ("    -d          - runs pegasus as a daemon\n");
       usage.append ("    -cleanlogs  - clears the log files at startup\n");
       usage.append ("    -install    - installs pegasus as a Windows NT Service\n");
       usage.append ("    -remove     - removes pegasus as a Windows NT Service\n");
       usage.append ("    -slp        - registers pegasus as a service with SLP\n\n");
   
       usage.append ("  configProperty=value\n");
       usage.append ("    port=nnnn            - sets port number to listen on\n");
       usage.append ("    home=/pegasus/bin    - sets pegasus home directory\n");
       usage.append ("    logdir=/pegasus/logs - directory for log files\n");
  
     cout << endl;     cout << endl;
     cout << PEGASUS_NAME << PEGASUS_VERSION << endl;     cout << PEGASUS_NAME << PEGASUS_VERSION << endl;
Line 190 
Line 216 
 ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
 int main(int argc, char** argv) int main(int argc, char** argv)
 { {
   
     String pegasusHome  = String::EMPTY;     String pegasusHome  = String::EMPTY;
     Boolean pegasusIOTrace = false;     Boolean pegasusIOTrace = false;
     Boolean pegasusIOLog = false;     Boolean pegasusIOLog = false;
Line 204 
Line 229 
     if (argc == 1 )     if (argc == 1 )
       cim_server_service(argc, argv) ;       cim_server_service(argc, argv) ;
  
     // Get environment variables      // Get help, version and home options
  
     if (pegasusHome.size() == 0)      for (int i = 0; i < argc; )
     for (int i=0; i < argc; i++) {      {
         if (!strcmp(argv[i],"-D")) {          const char* arg = argv[i];
             i++;  
             if (i < argc) pegasusHome = argv[i];          // Check for -option
             break;          if (*arg == '-')
           {
               // Get the option
               const char* option = arg + 1;
   
               //
               // Check to see if user asked for the version (-v option):
               //
               if (*option == OPTION_VERSION)
               {
                   cout << PEGASUS_VERSION << endl;
                   exit(0);
         }         }
               //
               // Check to see if user asked for help (-h option):
               //
               else if (*option == OPTION_HELP)
               {
                   PrintHelp(argv[0]);
                   exit(0);
               }
               else if (*option == OPTION_HOME)
               {
                   if (i + 1 < argc)
                   {
                       pegasusHome = argv[i + 1];
     }     }
                   else
                   {
                       cout << "Missing argument for option -" << option << endl;
                       exit(0);
                   }
   
                   memmove(&argv[i], &argv[i + 2], (argc-i-1) * sizeof(char*));
                   argc -= 2;
               }
           }
           i++;
       }
   
     if (pegasusHome.size() == 0)     if (pegasusHome.size() == 0)
         GetEnvironmentVariables(argv[0], pegasusHome);         GetEnvironmentVariables(argv[0], pegasusHome);
  
     // Get options (from command line and from configuration file); this  
     // removes corresponding options and their arguments from the command  
     // line.  
   
     //     //
     // Get an instance of the Config Manager.     // Get an instance of the Config Manager.
     //     //
Line 241 
Line 299 
         exit(1);         exit(1);
     }     }
  
     // At this point, all options should have been extracted; print an  
     // error if there are any remaining:  
   
     if (argc != 1)  
     {  
         cerr << argv[0] << ": unrecognized options: ";  
   
         for (int i = 1; i < argc; i++)  
             cerr << argv[i] << ' ';  
         cout << endl;  
         exit(1);  
     }  
  
     try     try
     {     {
         //         //
         // Check to see if user asked for the version (-v option):  
         //  
   
         if (configManager->isVersionFlagSet())  
         {  
             cout << PEGASUS_VERSION << endl;  
             exit(0);  
         }  
   
         //  
         // Check to see if user asked for help (-h option):  
         //  
   
         if (configManager->isHelpFlagSet())  
         {  
             PrintHelp(argv[0]);  
             exit(0);  
         }  
   
         //  
         // Check to see if we should (can) install as a NT service         // Check to see if we should (can) install as a NT service
         //         //
  
         if (configManager->isInstallFlagSet())          if (String::equal(configManager->getCurrentValue("install"), "true"))
         {         {
             if( 0 != cimserver_install_nt_service( pegasusHome ))             if( 0 != cimserver_install_nt_service( pegasusHome ))
             {             {
Line 293 
Line 319 
         // Check to see if we should (can) remove Pegasus as an NT service         // Check to see if we should (can) remove Pegasus as an NT service
         //         //
  
         if (configManager->isRemoveFlagSet())          if (String::equal(configManager->getCurrentValue("remove"), "true"))
         {         {
             if( 0 != cimserver_remove_nt_service() )             if( 0 != cimserver_remove_nt_service() )
             {             {
Line 306 
Line 332 
         // Check to see if we should Pegasus as a daemon         // Check to see if we should Pegasus as a daemon
         //         //
  
         if (configManager->isDaemonFlagSet())          if (String::equal(configManager->getCurrentValue("daemon"), "true"))
         {         {
             daemonOption = true;             daemonOption = true;
         }         }
Line 321 
Line 347 
         // Check the trace options and set global variable         // Check the trace options and set global variable
         //         //
  
         if (configManager->isTraceFlagSet())          if (String::equal(configManager->getCurrentValue("trace"), "true"))
         {         {
             Handler::setMessageTrace(true);             Handler::setMessageTrace(true);
             pegasusIOTrace = true;             pegasusIOTrace = true;
Line 331 
Line 357 
         // Check the log trace options and set global variable         // Check the log trace options and set global variable
         //         //
  
         if (configManager->isLogTraceFlagSet())          if (String::equal(configManager->getCurrentValue("logtrace"), "true"))
         {         {
             Handler::setMessageLogTrace(true);             Handler::setMessageLogTrace(true);
             pegasusIOLog = true;             pegasusIOLog = true;
Line 347 
Line 373 
         // Set up the Logger. This does not open the logs         // Set up the Logger. This does not open the logs
         // Might be more logical to clean before set.         // Might be more logical to clean before set.
         // ATTN: Need tool to completely disable logging.         // ATTN: Need tool to completely disable logging.
   
         Logger::setHomeDirectory(logsDirectory);         Logger::setHomeDirectory(logsDirectory);
  
         if (configManager->isCleanLogsFlagSet())          if (String::equal(configManager->getCurrentValue("cleanlogs"), "true"))
         {         {
             Logger::clean(logsDirectory);;             Logger::clean(logsDirectory);;
         }         }
Line 357 
Line 384 
         // Leave this in until people get familiar with the logs.         // Leave this in until people get familiar with the logs.
         cout << "Logs Directory = " << logsDirectory << endl;         cout << "Logs Directory = " << logsDirectory << endl;
  
         if (configManager->isSlpFlagSet())          if (String::equal(configManager->getCurrentValue("slp"), "true"))
         {         {
             useSLP =  true;             useSLP =  true;
         }         }
Line 425 
Line 452 
             {             {
               if( discovery != NULL && url != NULL )               if( discovery != NULL && url != NULL )
                 discovery->srv_reg_all(url,                 discovery->srv_reg_all(url,
                                        "(namespace=root/cimv20)",                                         "(namespace=root/cimv2)",
                                        "service:cim.pegasus",                                        "service:cim.pegasus",
                                        "DEFAULT",                                        "DEFAULT",
                                        70) ;                                        70) ;


Legend:
Removed from v.1.34.2.3  
changed lines
  Added in v.1.34.2.4

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2