📄 cimconfigcommand.cpp
字号:
//%2006//////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.// Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation, The Open Group.// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; VERITAS Software Corporation; The Open Group.// Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;// EMC Corporation; Symantec Corporation; The Open Group.//// Permission is hereby granted, free of charge, to any person obtaining a copy// of this software and associated documentation files (the "Software"), to// deal in the Software without restriction, including without limitation the// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or// sell copies of the Software, and to permit persons to whom the Software is// furnished to do so, subject to the following conditions:// // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN// ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED// "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT// LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.////==============================================================================//// Author: Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)//// Modified By: Yi Zhou, Hewlett-Packard Company (yi_zhou@hp.com)// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)// Carol Ann Krug Graves, Hewlett-Packard Company// (carolann_graves@hp.com)// Terry Martin, Hewlett-Packard Company (terry.martin@hp.com)// Alagaraja Ramasubramanian, IBM (alags_raj@in.ibm.com) - PEP-167// Amit K Arora, IBM (amitarora@in.ibm.com) - Bug#2333,#2351// Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - Bug#1794// Josephine Eskaline Joyce, IBM (jojustin@in.ibm.com) - PEP#101, Bug#2756, Bug#3032////%/////////////////////////////////////////////////////////////////////////////#include <Pegasus/Common/Config.h>#include <Pegasus/Common/Constants.h>#include <Pegasus/Common/System.h>#include <Pegasus/Common/FileSystem.h>#include <Pegasus/Common/CIMProperty.h>#include <Pegasus/Common/CIMObjectPath.h>#include <Pegasus/Common/CIMStatusCode.h>#include <Pegasus/Common/Exception.h>#include <Pegasus/Common/PegasusVersion.h>#include <Pegasus/Common/XmlWriter.h>#include <Pegasus/getoopt/getoopt.h>#include <Pegasus/Client/CIMClient.h>#include <Pegasus/Config/ConfigFileHandler.h>#include "CIMConfigCommand.h"#ifdef PEGASUS_OS_OS400#include "qycmutiltyUtility.H"#include "qycmutilu2.H"#include "OS400ConvertChar.h"#include "vfyptrs.cinc"#include <stdio.h>#endifPEGASUS_NAMESPACE_BEGIN//l10n/** * The CLI message resource name */static const char MSG_PATH [] = "pegasus/pegasusCLI";//l10n end/** The command name.*/static const char COMMAND_NAME [] = "cimconfig";/** The usage string for this command. This string is displayed when an error occurs in parsing or validating the command line.*/static const char USAGE [] = "Usage: ";/** This constant represents the getoopt argument designator*/static const char GETOPT_ARGUMENT_DESIGNATOR = ':';/* These constants represent the operation modes supported by the CLI. Any new operation should be added here.*//** This constant signifies that an operation option has not been recorded*/static const Uint32 OPERATION_TYPE_UNINITIALIZED = 0;/** This constant represents a property get operation*/static const Uint32 OPERATION_TYPE_GET = 1;/** This constant represents a property set operation*/static const Uint32 OPERATION_TYPE_SET = 2;/** This constant represents a property unset operation*/static const Uint32 OPERATION_TYPE_UNSET = 3;/** This constant represents a property list operation*/static const Uint32 OPERATION_TYPE_LIST = 4;/** This constant represents a help operation*/static const Uint32 OPERATION_TYPE_HELP = 5;/** This constant represents a version display operation*/static const Uint32 OPERATION_TYPE_VERSION = 6;/** The constants representing the string literals.*/static const CIMName PROPERTY_NAME = CIMName ("PropertyName");static const CIMName DEFAULT_VALUE = CIMName ("DefaultValue");static const CIMName CURRENT_VALUE = CIMName ("CurrentValue");static const CIMName PLANNED_VALUE = CIMName ("PlannedValue");static const CIMName DYNAMIC_PROPERTY = CIMName ("DynamicProperty");/** The constants representing the messages.*/static const char CIMOM_NOT_RUNNING [] = "CIM server may not be running.";static const char FILE_NOT_EXIST [] = "Configuration files does not exist.";static const char FILE_NOT_READABLE [] = "Configuration file not readable.";static const char FAILED_TO_GET_PROPERTY [] = "Failed to get the config property.";static const char FAILED_TO_SET_PROPERTY [] = "Failed to set the config property.";static const char FAILED_TO_UNSET_PROPERTY [] = "Failed to unset the config property.";static const char FAILED_TO_LIST_PROPERTIES [] = "Failed to list the config properties. ";// no longer used// static const char CURRENT_VALUE_OF_PROPERTY [] = // "Current value for the property '";// static const char PLANNED_VALUE_OF_PROPERTY [] = // "Planned value for the property '";// static const char DEFAULT_VALUE_OF_PROPERTY [] = // "Default value for the property '";static const char IS_SET_TO [] = "' is set to ";static const char IS_NOT_SET [] = "' is not set." ;static const char IN_CIMSERVER [] = " in CIMServer.";static const char IN_CONFIG_FILE [] = " in configuration file.";static const char IS_UNSET_IN_FILE [] = "' is unset in the configuration file.";static const char UPDATED_IN_FILE [] = "' updated in configuration file.";static const char CONFIG_SCHEMA_NOT_LOADED [] = "Please restore the internal repository on the CIM Server.";static const char PROPERTY_NOT_FOUND [] = "Specified property name was not found.";static const char INVALID_PROPERTY_VALUE [] = "Specified property value is not valid.";static const char PROPERTY_NOT_MODIFIED [] = "Specified property can not be modified.";//l10n default messages and resource keysstatic const char OPTION_INVALID_CIM_RUNNING [] = "Option -$0 is not valid for this command when CIM server is not running.";static const char OPTION_INVALID_CIM_RUNNING_KEY [] = "Clients.CIMConfig.CIMConfigCommand.OPTION_INVALID_CIM_RUNNING";static const char CIMOM_NOT_RUNNING_KEY [] = "Clients.CIMConfig.CIMConfigCommand.CIMOM_NOT_RUNNING";static const char FILE_NOT_EXIST_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FILE_NOT_EXIST";static const char FILE_NOT_READABLE_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FILE_NOT_READABLE";static const char FAILED_TO_GET_PROPERTY_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FAILED_TO_GET_PROPERTY";static const char FAILED_TO_SET_PROPERTY_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FAILED_TO_SET_PROPERTY";static const char FAILED_TO_UNSET_PROPERTY_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FAILED_TO_UNSET_PROPERTY";static const char FAILED_TO_LIST_PROPERTIES_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FAILED_TO_LIST_PROPERTIES";static const char CONFIG_SCHEMA_NOT_LOADED_KEY [] = "Clients.CIMConfig.CIMConfigCommand.CONFIG_SCHEMA_NOT_LOADED";static const char PROPERTY_NOT_FOUND_KEY [] = "Clients.CIMConfig.CIMConfigCommand.PROPERTY_NOT_FOUND";static const char INVALID_PROPERTY_VALUE_KEY [] = "Clients.CIMConfig.CIMConfigCommand.INVALID_PROPERTY_VALUE";static const char PROPERTY_NOT_MODIFIED_KEY [] = "Clients.CIMConfig.CIMConfigCommand.PROPERTY_NOT_MODIFIED"; //static const char VALUE_OF_PROPERTY_IS [] = //"$0 value for the property $1 is set to \"$2\" in CIMServer.";//static const char VALUE_OF_PROPERTY_IS_KEY [] = //"Clients.CIMConfig.CIMConfigCommand.VALUE_OF_PROPERTY_IS";static const char PLANNED_VALUE_OF_PROPERTY_IS [] = "Planned value for the property $0 is set to \"$1\" in CIMServer.";static const char PLANNED_VALUE_OF_PROPERTY_IS_KEY [] = "Clients.CIMConfig.CIMConfigCommand.PLANNED_VALUE_OF_PROPERTY_IS";static const char CURRENT_VALUE_OF_PROPERTY_IS [] = "Current value for the property $0 is set to \"$1\" in CIMServer.";static const char CURRENT_VALUE_OF_PROPERTY_IS_KEY [] = "Clients.CIMConfig.CIMConfigCommand.CURRENT_VALUE_OF_PROPERTY_IS";static const char DEFAULT_VALUE_OF_PROPERTY_IS [] = "Default value for the property $0 is set to \"$1\" in CIMServer.";static const char DEFAULT_VALUE_OF_PROPERTY_IS_KEY [] = "Clients.CIMConfig.CIMConfigCommand.DEFAULT_VALUE_OF_PROPERTY_IS";//static const char VALUE_OF_PROPERTY_CANNOT_BE_SET [] = //"$0 value for the property '$1' can not be set because the CIM server is not running.";//static const char VALUE_OF_PROPERTY_CANNOT_BE_SET_KEY [] = //"Clients.CIMConfig.CIMConfigCommand.VALUE_OF_PROPERTY_CANNOT_BE_SET";static const char PLANNED_VALUE_OF_PROPERTY_CANNOT_BE_SET [] = "Planned value for the property '$0' can not be set because the CIM server is not running.";static const char PLANNED_VALUE_OF_PROPERTY_CANNOT_BE_SET_KEY [] = "Clients.CIMConfig.CIMConfigCommand.PLANNED_VALUE_OF_PROPERTY_CANNOT_BE_SET";static const char CURRENT_VALUE_OF_PROPERTY_CANNOT_BE_SET [] = "Current value for the property '$0' can not be set because the CIM server is not running.";static const char CURRENT_VALUE_OF_PROPERTY_CANNOT_BE_SET_KEY [] = "Clients.CIMConfig.CIMConfigCommand.CURRENT_VALUE_OF_PROPERTY_CANNOT_BE_SET";static const char DEFAULT_VALUE_OF_PROPERTY_CANNOT_BE_SET [] = "Default value for the property '$0' can not be set because the CIM server is not running.";static const char DEFAULT_VALUE_OF_PROPERTY_CANNOT_BE_SET_KEY [] = "Clients.CIMConfig.CIMConfigCommand.DEFAULT_VALUE_OF_PROPERTY_CANNOT_BE_SET";//static const char FAILED_UPDATE_OF_VALUE_IN_FILE [] = //"Failed to update the $0 value of the Property '$1' in configuration file.";//static const char FAILED_UPDATE_OF_VALUE_IN_FILE_KEY [] = //"Clients.CIMConfig.CIMConfigCommand.FAILED_UPDATE_OF_VALUE_IN_FILE"; static const char FAILED_UPDATE_OF_PLANNED_VALUE_IN_FILE [] = "Failed to update the planned value of the Property '$0' in configuration file.";static const char FAILED_UPDATE_OF_PLANNED_VALUE_IN_FILE_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FAILED_UPDATE_OF_PLANNED_VALUE_IN_FILE";static const char FAILED_UPDATE_OF_CURRENT_VALUE_IN_FILE [] = "Failed to update the current value of the Property '$0' in configuration file.";static const char FAILED_UPDATE_OF_CURRENT_VALUE_IN_FILE_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FAILED_UPDATE_OF_CURRENT_VALUE_IN_FILE";static const char FAILED_UPDATE_OF_DEFAULT_VALUE_IN_FILE [] = "Failed to update the default value of the Property '$0' in configuration file.";static const char FAILED_UPDATE_OF_DEFAULT_VALUE_IN_FILE_KEY [] = "Clients.CIMConfig.CIMConfigCommand.FAILED_UPDATE_OF_DEFAULT_VALUE_IN_FILE";// 485static const char PROPERTY_UPDATED_IN_FILE [] = "Property '$0' updated in configuration file.";static const char PROPERTY_UPDATED_IN_FILE_KEY [] = "Clients.CIMConfig.CIMConfigCommand.PROPERTY_UPDATED_IN_FILE";//static const char VALUE_IS [] = //"$0 value: $1"; static const char PLANNED_VALUE_IS [] = "Planned value: $0";static const char PLANNED_VALUE_IS_KEY [] = "Clients.CIMConfig.CIMConfigCommand.PLANNED_VALUE_IS";static const char CURRENT_VALUE_IS [] = "Current value: $0";static const char CURRENT_VALUE_IS_KEY [] = "Clients.CIMConfig.CIMConfigCommand.CURRENT_VALUE_IS";static const char DEFAULT_VALUE_IS [] = "Default value: $0";static const char DEFAULT_VALUE_IS_KEY [] = "Clients.CIMConfig.CIMConfigCommand.DEFAULT_VALUE_IS";//static const char VALUE_IS_KEY [] = //"Clients.CIMConfig.CIMConfigCommand.VALUE_IS";//static const char CANNOT_DETERMINE_VALUE_CIM_RUNNING [] = //"$0 value can not be determined because the CIM server is not running.";//static const char CANNOT_DETERMINE_VALUE_CIM_RUNNING_KEY [] = //"Clients.CIMConfig.CIMConfigCommand.CANNOT_DETERMINE_VALUE_CIM_RUNNING"; static const char CANNOT_DETERMINE_PLANNED_VALUE_CIM_RUNNING [] = "Planned value can not be determined because the CIM server is not running.";static const char CANNOT_DETERMINE_PLANNED_VALUE_CIM_RUNNING_KEY [] = "Clients.CIMConfig.CIMConfigCommand.CANNOT_DETERMINE_PLANNED_VALUE_CIM_RUNNING"; static const char CANNOT_DETERMINE_CURRENT_VALUE_CIM_RUNNING [] = "Current value can not be determined because the CIM server is not running.";static const char CANNOT_DETERMINE_CURRENT_VALUE_CIM_RUNNING_KEY [] = "Clients.CIMConfig.CIMConfigCommand.CANNOT_DETERMINE_CURRENT_VALUE_CIM_RUNNING";static const char CANNOT_DETERMINE_DEFAULT_VALUE_CIM_RUNNING [] = "Default value can not be determined because the CIM server is not running.";static const char CANNOT_DETERMINE_DEFAULT_VALUE_CIM_RUNNING_KEY [] = "Clients.CIMConfig.CIMConfigCommand.CANNOT_DETERMINE_DEFAULT_VALUE_CIM_RUNNING"; static const char PROPERTY_VALUE_ALREADY_SET_TO [] = "The property '$0' value is already set to '$1'.";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -