(file) Return to CIMUserCommand.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Clients / cimuser

Diff for /pegasus/src/Clients/cimuser/CIMUserCommand.cpp between version 1.37 and 1.38

version 1.37, 2005/03/11 12:48:41 version 1.38, 2005/04/22 15:51:38
Line 140 
Line 140 
 static const char NOT_PRIVILEGED_USER []         = static const char NOT_PRIVILEGED_USER []         =
              "You must have superuser privilege to run this command.";              "You must have superuser privilege to run this command.";
  
 static const char NOT_PRIVILEGED_USER_KEY []         = "Clients.cimuser.CIMUserCommand.NOT_PRIVILEGED_USER";  static const char NOT_PRIVILEGED_USER_KEY [] =
       "Clients.cimuser.CIMUserCommand.NOT_PRIVILEGED_USER";
  
 static const char CIMOM_NOT_RUNNING []         = static const char CIMOM_NOT_RUNNING []         =
                         "CIM Server may not be running.";                         "CIM Server may not be running.";
  
 static const char CIMOM_NOT_RUNNING_KEY []         = "Clients.cimuser.CIMUserCommand.CIMOM_NOT_RUNNING";  static const char CIMOM_NOT_RUNNING_KEY [] =
       "Clients.cimuser.CIMUserCommand.CIMOM_NOT_RUNNING";
  
 static const char ADD_USER_FAILURE []    = static const char ADD_USER_FAILURE []    =
                         "Failed to add user.";                         "Failed to add user.";
  
 static const char ADD_USER_FAILURE_KEY []    = "Clients.cimuser.CIMUserCommand.ADD_USER_FAILURE";  static const char ADD_USER_FAILURE_KEY [] =
       "Clients.cimuser.CIMUserCommand.ADD_USER_FAILURE";
  
 static const char REMOVE_USER_FAILURE []    = static const char REMOVE_USER_FAILURE []    =
                         "Failed to remove user.";                         "Failed to remove user.";
  
 static const char REMOVE_USER_FAILURE_KEY []    = "Clients.cimuser.CIMUserCommand.REMOVE_USER_FAILURE";  static const char REMOVE_USER_FAILURE_KEY [] =
       "Clients.cimuser.CIMUserCommand.REMOVE_USER_FAILURE";
  
 static const char CHANGE_PASSWORD_FAILURE []  = static const char CHANGE_PASSWORD_FAILURE []  =
                         "Failed to change password.";                         "Failed to change password.";
  
 static const char CHANGE_PASSWORD_FAILURE_KEY []  = "Clients.cimuser.CIMUserCommand.CHANGE_PASSWORD_FAILURE";  static const char CHANGE_PASSWORD_FAILURE_KEY [] =
       "Clients.cimuser.CIMUserCommand.CHANGE_PASSWORD_FAILURE";
  
 static const char LIST_USERS_FAILURE [] = static const char LIST_USERS_FAILURE [] =
                         "Failed to list the users. ";                         "Failed to list the users. ";
  
 static const char LIST_USERS_FAILURE_KEY [] = "Clients.cimuser.CIMUserCommand.LIST_USERS_FAILURE";  static const char LIST_USERS_FAILURE_KEY [] =
       "Clients.cimuser.CIMUserCommand.LIST_USERS_FAILURE";
  
 static const char ADD_USER_SUCCESS []    = static const char ADD_USER_SUCCESS []    =
                         "User added successfully.";                         "User added successfully.";
  
 static const char ADD_USER_SUCCESS_KEY []    = "Clients.cimuser.CIMUserCommand.ADD_USER_SUCCESS";  static const char ADD_USER_SUCCESS_KEY [] =
       "Clients.cimuser.CIMUserCommand.ADD_USER_SUCCESS";
  
 static const char REMOVE_USER_SUCCESS[]  = static const char REMOVE_USER_SUCCESS[]  =
                         "User removed successfully.";                         "User removed successfully.";
  
 static const char REMOVE_USER_SUCCESS_KEY[]  = "Clients.cimuser.CIMUserCommand.REMOVE_USER_SUCCESS";  static const char REMOVE_USER_SUCCESS_KEY[] =
       "Clients.cimuser.CIMUserCommand.REMOVE_USER_SUCCESS";
  
 static const char CHANGE_PASSWORD_SUCCESS []  = static const char CHANGE_PASSWORD_SUCCESS []  =
                         "Password changed successfully.";                         "Password changed successfully.";
  
 static const char CHANGE_PASSWORD_SUCCESS_KEY []  = "Clients.cimuser.CIMUserCommand.CHANGE_PASSWORD_SUCCESS";  static const char CHANGE_PASSWORD_SUCCESS_KEY [] =
       "Clients.cimuser.CIMUserCommand.CHANGE_PASSWORD_SUCCESS";
  
 static const char PASSWORD_BLANK []  = static const char PASSWORD_BLANK []  =
                      "Password cannot be blank. Please re-enter your password.";                      "Password cannot be blank. Please re-enter your password.";
  
 static const char PASSWORD_BLANK_KEY []  = "Clients.cimuser.CIMUserCommand.PASSWORD_BLANK";  static const char PASSWORD_BLANK_KEY [] =
       "Clients.cimuser.CIMUserCommand.PASSWORD_BLANK";
  
 static const char NO_USERS_FOUND[] = static const char NO_USERS_FOUND[] =
                         "No users found for listing.";                         "No users found for listing.";
  
 static const char NO_USERS_FOUND_KEY[] = "Clients.cimuser.CIMUserCommand.NO_USERS_FOUND";  static const char NO_USERS_FOUND_KEY[] =
       "Clients.cimuser.CIMUserCommand.NO_USERS_FOUND";
  
 static const char AUTH_SCHEMA_NOT_LOADED []  = static const char AUTH_SCHEMA_NOT_LOADED []  =
     "Please restore the internal repository on the CIM Server.";     "Please restore the internal repository on the CIM Server.";
  
 static const char AUTH_SCHEMA_NOT_LOADED_KEY []  = "Clients.cimuser.CIMUserCommand.AUTH_SCHEMA_NOT_LOADED";  static const char AUTH_SCHEMA_NOT_LOADED_KEY [] =
       "Clients.cimuser.CIMUserCommand.AUTH_SCHEMA_NOT_LOADED";
  
 static const char REQUIRED_ARGS_MISSING []        = static const char REQUIRED_ARGS_MISSING []        =
                         "Required arguments missing.";                         "Required arguments missing.";
  
 static const char REQUIRED_ARGS_MISSING_KEY []        = "Clients.cimuser.CIMUserCommand.REQUIRED_ARGS_MISSING";  static const char REQUIRED_ARGS_MISSING_KEY [] =
       "Clients.cimuser.CIMUserCommand.REQUIRED_ARGS_MISSING";
  
 static const char INVALID_ARGS []        = static const char INVALID_ARGS []        =
                         "Invalid arguments.";                         "Invalid arguments.";
  
 static const char INVALID_ARGS_KEY []        = "Clients.cimuser.CIMUserCommand.INVALID_ARGS";  static const char INVALID_ARGS_KEY [] =
       "Clients.cimuser.CIMUserCommand.INVALID_ARGS";
  
 static const char USER_ALREADY_EXISTS []        = static const char USER_ALREADY_EXISTS []        =
                         "Specified user name already exist.";                         "Specified user name already exist.";
  
 static const char USER_ALREADY_EXISTS_KEY []        = "Clients.cimuser.CIMUserCommand.USER_ALREADY_EXISTS";  static const char USER_ALREADY_EXISTS_KEY [] =
       "Clients.cimuser.CIMUserCommand.USER_ALREADY_EXISTS";
  
 static const char USER_NOT_FOUND []        = static const char USER_NOT_FOUND []        =
                         "Specified user name was not found.";                         "Specified user name was not found.";
  
 static const char USER_NOT_FOUND_KEY []        = "Clients.cimuser.CIMUserCommand.USER_NOT_FOUND";  static const char USER_NOT_FOUND_KEY [] =
       "Clients.cimuser.CIMUserCommand.USER_NOT_FOUND";
  
 static const char USERNAME_REQUIRED []        = static const char USERNAME_REQUIRED []        =
                         "User name is required.";                         "User name is required.";
  
 static const char USERNAME_REQUIRED_KEY []        = "Clients.cimuser.CIMUserCommand.USERNAME_REQUIRED";  static const char USERNAME_REQUIRED_KEY [] =
       "Clients.cimuser.CIMUserCommand.USERNAME_REQUIRED";
  
 /** /**
     The option character used to specify add user.     The option character used to specify add user.
Line 594 
Line 611 
     options.parse (argc, argv);     options.parse (argc, argv);
     if (options.hasErrors ())     if (options.hasErrors ())
     {     {
         CommandFormatException e (options.getErrorStrings () [0]);          throw CommandFormatException(options.getErrorStrings()[0]);
         throw e;  
     }     }
     _operationType = OPERATION_TYPE_UNINITIALIZED;     _operationType = OPERATION_TYPE_UNINITIALIZED;
  
Line 614 
Line 630 
                     //                     //
                     // More than one operation option was found                     // More than one operation option was found
                     //                     //
                     UnexpectedOptionException e (param);                      throw UnexpectedOptionException(param);
                     throw e;  
                 }                 }
  
                _operationType = OPERATION_TYPE_HELP;                _operationType = OPERATION_TYPE_HELP;
Line 628 
Line 643 
                     //                     //
                     // More than one operation option was found                     // More than one operation option was found
                     //                     //
                     UnexpectedOptionException e (param);                      throw UnexpectedOptionException(param);
                     throw e;  
                 }                 }
  
                _operationType = OPERATION_TYPE_VERSION;                _operationType = OPERATION_TYPE_VERSION;
Line 640 
Line 654 
             //             //
             //  The cimuser command has no non-option argument options             //  The cimuser command has no non-option argument options
             //             //
             UnexpectedArgumentException e (options [i].Value ());              throw UnexpectedArgumentException(options[i].Value());
             throw e;  
         }         }
         else /* if (options [i].getType () == Optarg::FLAG) */         else /* if (options [i].getType () == Optarg::FLAG) */
         {         {
Line 657 
Line 670 
                         //                         //
                         // More than one operation option was found                         // More than one operation option was found
                         //                         //
                         UnexpectedOptionException e (OPTION_ADD);                          throw UnexpectedOptionException(OPTION_ADD);
                         throw e;  
                     }                     }
  
                     if (options.isSet (OPTION_ADD) > 1)                     if (options.isSet (OPTION_ADD) > 1)
Line 666 
Line 678 
                         //                         //
                         // More than one add user option was found                         // More than one add user option was found
                         //                         //
                         DuplicateOptionException e (OPTION_ADD);                          throw DuplicateOptionException(OPTION_ADD);
                         throw e;  
                     }                     }
  
                     _operationType = OPERATION_TYPE_ADD;                     _operationType = OPERATION_TYPE_ADD;
Line 681 
Line 692 
                         //                         //
                         // More than one operation option was found                         // More than one operation option was found
                         //                         //
                         UnexpectedOptionException e (OPTION_MODIFY);                          throw UnexpectedOptionException(OPTION_MODIFY);
                         throw e;  
                     }                     }
  
                     if (options.isSet (OPTION_MODIFY) > 1)                     if (options.isSet (OPTION_MODIFY) > 1)
Line 690 
Line 700 
                         //                         //
                         // More than one modify user option was found                         // More than one modify user option was found
                         //                         //
                         DuplicateOptionException e (OPTION_MODIFY);                          throw DuplicateOptionException(OPTION_MODIFY);
                         throw e;  
                     }                     }
  
                     _operationType = OPERATION_TYPE_MODIFY;                     _operationType = OPERATION_TYPE_MODIFY;
Line 705 
Line 714 
                         //                         //
                         // More than one username option was found                         // More than one username option was found
                         //                         //
                         DuplicateOptionException e (OPTION_USER_NAME);                          throw DuplicateOptionException(OPTION_USER_NAME);
                         throw e;  
                     }                     }
  
                     _userName = options [i].Value ();                     _userName = options [i].Value ();
Line 722 
Line 730 
                         //                         //
                         // More than one password option was found                         // More than one password option was found
                         //                         //
                         DuplicateOptionException e (OPTION_PASSWORD);                          throw DuplicateOptionException(OPTION_PASSWORD);
                         throw e;  
                     }                     }
  
                     String password = options [i].Value ();                     String password = options [i].Value ();
Line 740 
Line 747 
                         //                         //
                         // More than one new password option was found                         // More than one new password option was found
                         //                         //
                         DuplicateOptionException e (OPTION_NEW_PASSWORD);                          throw DuplicateOptionException(OPTION_NEW_PASSWORD);
                         throw e;  
                     }                     }
  
                     String newpassword = options [i].Value ();                     String newpassword = options [i].Value ();
Line 758 
Line 764 
                         //                         //
                         // More than one operation option was found                         // More than one operation option was found
                         //                         //
                         UnexpectedOptionException e (OPTION_REMOVE);                          throw UnexpectedOptionException(OPTION_REMOVE);
                         throw e;  
                     }                     }
  
                     if (options.isSet (OPTION_REMOVE) > 1)                     if (options.isSet (OPTION_REMOVE) > 1)
Line 767 
Line 772 
                         //                         //
                         // More than one remove user option was found                         // More than one remove user option was found
                         //                         //
                         DuplicateOptionException e (OPTION_REMOVE);                          throw DuplicateOptionException(OPTION_REMOVE);
                         throw e;  
                     }                     }
  
                     _operationType = OPERATION_TYPE_REMOVE;                     _operationType = OPERATION_TYPE_REMOVE;
Line 783 
Line 787 
                         //                         //
                         // More than one operation option was found                         // More than one operation option was found
                         //                         //
                         UnexpectedOptionException e (OPTION_LIST);                          throw UnexpectedOptionException(OPTION_LIST);
                         throw e;  
                     }                     }
  
                     if (options.isSet (OPTION_LIST) > 1)                     if (options.isSet (OPTION_LIST) > 1)
Line 792 
Line 795 
                         //                         //
                         // More than one list option was found                         // More than one list option was found
                         //                         //
                         DuplicateOptionException e (OPTION_LIST);                          throw DuplicateOptionException(OPTION_LIST);
                         throw e;  
                     }                     }
                     _operationType = OPERATION_TYPE_LIST;                     _operationType = OPERATION_TYPE_LIST;
                     break;                     break;
Line 806 
Line 808 
                         //                         //
                         // More than one operation option was found                         // More than one operation option was found
                         //                         //
                         UnexpectedOptionException e (OPTION_HELP);                          throw UnexpectedOptionException(OPTION_HELP);
                         throw e;  
                     }                     }
  
                     if (options.isSet (OPTION_HELP) > 1)                     if (options.isSet (OPTION_HELP) > 1)
Line 815 
Line 816 
                         //                         //
                         // More than one list option was found                         // More than one list option was found
                         //                         //
                         DuplicateOptionException e (OPTION_HELP);                          throw DuplicateOptionException(OPTION_HELP);
                         throw e;  
                     }                     }
                     _operationType = OPERATION_TYPE_HELP;                     _operationType = OPERATION_TYPE_HELP;
                     break;                     break;
Line 828 
Line 828 
                         //                         //
                         // More than one operation option was found                         // More than one operation option was found
                         //                         //
                         UnexpectedOptionException e (OPTION_VERSION);                          throw UnexpectedOptionException(OPTION_VERSION);
                         throw e;  
                     }                     }
  
                     if (options.isSet (OPTION_VERSION) > 1)                     if (options.isSet (OPTION_VERSION) > 1)
Line 837 
Line 836 
                         //                         //
                         // More than one list option was found                         // More than one list option was found
                         //                         //
                         DuplicateOptionException e (OPTION_VERSION);                          throw DuplicateOptionException(OPTION_VERSION);
                         throw e;  
                     }                     }
                     _operationType = OPERATION_TYPE_VERSION;                     _operationType = OPERATION_TYPE_VERSION;
                     break;                     break;
Line 866 
Line 864 
         //         //
                   //l10n                   //l10n
                   //CommandFormatException e (REQUIRED_ARGS_MISSING);                   //CommandFormatException e (REQUIRED_ARGS_MISSING);
         CommandFormatException e (localizeMessage(MSG_PATH,REQUIRED_ARGS_MISSING_KEY, REQUIRED_ARGS_MISSING));          throw CommandFormatException(localizeMessage(
         throw e;              MSG_PATH, REQUIRED_ARGS_MISSING_KEY, REQUIRED_ARGS_MISSING));
     }     }
  
     if ( _operationType == OPERATION_TYPE_LIST  &&     if ( _operationType == OPERATION_TYPE_LIST  &&
Line 876 
Line 874 
         //l10n         //l10n
         MessageLoaderParms parms("Clients.cimuser.CIMUserCommand.UNEXPECTED_OPTION",         MessageLoaderParms parms("Clients.cimuser.CIMUserCommand.UNEXPECTED_OPTION",
                                                          "Unexpected Option.");                                                          "Unexpected Option.");
         CommandFormatException e(parms);  
         //CommandFormatException e("Unexpected Option.");         //CommandFormatException e("Unexpected Option.");
         throw e;          throw CommandFormatException(parms);
     }     }
  
     if (_operationType == OPERATION_TYPE_ADD)     if (_operationType == OPERATION_TYPE_ADD)
Line 888 
Line 885 
             //             //
             // An invalid option was encountered             // An invalid option was encountered
             //             //
             UnexpectedOptionException e( OPTION_NEW_PASSWORD );              throw UnexpectedOptionException(OPTION_NEW_PASSWORD);
             throw e;  
         }         }
         if ( !_userNameSet )         if ( !_userNameSet )
         {         {
             //             //
             // An invalid option was encountered             // An invalid option was encountered
             //             //
             MissingOptionException e (OPTION_USER_NAME);              throw MissingOptionException(OPTION_USER_NAME);
             throw e;  
         }         }
         if ( !_passwordSet )         if ( !_passwordSet )
         {         {
Line 938 
Line 933 
             //             //
             // An invalid option was encountered             // An invalid option was encountered
             //             //
             MissingOptionException e (OPTION_USER_NAME);              throw MissingOptionException(OPTION_USER_NAME);
             throw e;  
         }         }
         if ( _passwordSet && _newpasswordSet )         if ( _passwordSet && _newpasswordSet )
         {         {
Line 1017 
Line 1011 
             //             //
             // An invalid option was encountered             // An invalid option was encountered
             //             //
             MissingOptionException e (OPTION_USER_NAME);              throw MissingOptionException(OPTION_USER_NAME);
             throw e;  
         }         }
         if ( _passwordSet )         if ( _passwordSet )
         {         {
             //             //
             // An invalid option was encountered             // An invalid option was encountered
             //             //
             UnexpectedOptionException e ( OPTION_PASSWORD );              throw UnexpectedOptionException(OPTION_PASSWORD);
             throw e;  
         }         }
         if ( _newpasswordSet )         if ( _newpasswordSet )
         {         {
             //             //
             // An invalid option was encountered             // An invalid option was encountered
             //             //
             UnexpectedOptionException e ( OPTION_NEW_PASSWORD );              throw UnexpectedOptionException(OPTION_NEW_PASSWORD);
             throw e;  
         }         }
     }     }
 } }
Line 1348 
Line 1339 
 { {
     CIMProperty prop;     CIMProperty prop;
  
     try  
     {  
         CIMInstance newInstance( PEGASUS_CLASSNAME_USER );         CIMInstance newInstance( PEGASUS_CLASSNAME_USER );
         newInstance.addProperty (         newInstance.addProperty (
                           CIMProperty( PROPERTY_NAME_USER_NAME, _userName ) );                           CIMProperty( PROPERTY_NAME_USER_NAME, _userName ) );
Line 1359 
Line 1348 
         _client->createInstance( PEGASUS_NAMESPACENAME_USER, newInstance );         _client->createInstance( PEGASUS_NAMESPACENAME_USER, newInstance );
         //l10n         //l10n
         //outPrintWriter << ADD_USER_SUCCESS << endl;         //outPrintWriter << ADD_USER_SUCCESS << endl;
         outPrintWriter << localizeMessage(MSG_PATH,ADD_USER_SUCCESS_KEY,ADD_USER_SUCCESS) << endl;      outPrintWriter <<
           localizeMessage(MSG_PATH,ADD_USER_SUCCESS_KEY,ADD_USER_SUCCESS) << endl;
     }  
     catch (Exception& e)  
     {  
         throw e;  
     }  
 } }
  
 // //
Line 1377 
Line 1361 
     ostream&    errPrintWriter     ostream&    errPrintWriter
     )     )
 { {
     try  
     {  
         Array<CIMKeyBinding>      kbArray;         Array<CIMKeyBinding>      kbArray;
         CIMKeyBinding             kb;         CIMKeyBinding             kb;
         Array<CIMParamValue>   inParams;         Array<CIMParamValue>   inParams;
Line 1421 
Line 1403 
         //outPrintWriter << CHANGE_PASSWORD_SUCCESS << endl;         //outPrintWriter << CHANGE_PASSWORD_SUCCESS << endl;
                   outPrintWriter << localizeMessage(MSG_PATH,CHANGE_PASSWORD_SUCCESS_KEY,CHANGE_PASSWORD_SUCCESS) << endl;                   outPrintWriter << localizeMessage(MSG_PATH,CHANGE_PASSWORD_SUCCESS_KEY,CHANGE_PASSWORD_SUCCESS) << endl;
     }     }
     catch (Exception& e)  
     {  
         throw e;  
     }  
 }  
  
 // //
 // Remove a user // Remove a user
Line 1436 
Line 1413 
     ostream&    errPrintWriter     ostream&    errPrintWriter
     )     )
 { {
     try  
     {  
         Array<CIMKeyBinding> kbArray;         Array<CIMKeyBinding> kbArray;
         CIMKeyBinding        kb;         CIMKeyBinding        kb;
  
Line 1456 
Line 1431 
         //outPrintWriter << REMOVE_USER_SUCCESS << endl;         //outPrintWriter << REMOVE_USER_SUCCESS << endl;
                         outPrintWriter << localizeMessage(MSG_PATH,REMOVE_USER_SUCCESS_KEY,REMOVE_USER_SUCCESS) << endl;                         outPrintWriter << localizeMessage(MSG_PATH,REMOVE_USER_SUCCESS_KEY,REMOVE_USER_SUCCESS) << endl;
     }     }
     catch (Exception& e)  
     {  
         throw e;  
     }  
 }  
  
  
 /** /**
Line 1472 
Line 1442 
     ostream&    errPrintWriter     ostream&    errPrintWriter
     )     )
 { {
     try  
     {  
         //         //
         // get all the instances of class PG_User         // get all the instances of class PG_User
         //         //
Line 1486 
Line 1454 
         {         {
                         //l10n                         //l10n
              //outPrintWriter << NO_USERS_FOUND << endl;              //outPrintWriter << NO_USERS_FOUND << endl;
                                  outPrintWriter << localizeMessage(MSG_PATH,NO_USERS_FOUND_KEY,NO_USERS_FOUND) << endl;           outPrintWriter <<
                localizeMessage(MSG_PATH,NO_USERS_FOUND_KEY,NO_USERS_FOUND) <<
                endl;
         }         }
         else         else
         {         {
Line 1504 
Line 1474 
             }             }
         }         }
     }     }
     catch (Exception& e)  
     {  
         throw e;  
     }  
 }  
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  


Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2