📄 cimsubcommand.h
字号:
//%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.////==============================================================================////%/////////////////////////////////////////////////////////////////////////////#ifndef Pegasus_CIMSubCommand_h#define Pegasus_CIMSubCommand_h#include <iostream>#include <Pegasus/Common/String.h>#include <Pegasus/Client/CIMClient.h>#include <Clients/cliutils/Command.h>#include <Clients/cliutils/CommandException.h>PEGASUS_NAMESPACE_BEGIN/**This is a CLI used to manage indication subscriptions. This command supportsoperations to list, enable, disable, and remove subscriptions. *///// String entries for each column in the output//typedef Array <String> ListColumnEntry;class CIMSubCommand : public Command{public: /** Constructs a CIMSubCommand and initializes instance variables. */ CIMSubCommand (); // // Overrides the virtual function setCommand from Command class // This is defined as an empty function. // void setCommand ( Uint32 argc, char* argv []) { // Empty function }; /** Parses the command line, validates the options, and sets instance variables based on the option arguments. This implementation of setCommand includes the parameters for output and error stream. @param outPrintWriter The stream to which command output is written. @param errPrintWriter The stream to which command errors are written. @param argc The int containing the arguments count @param argv The string array containing the command line arguments @throws CommandFormatException if an error is encountered in parsing the command line */ void setCommand ( PEGASUS_STD(ostream)& outPrintWriter, PEGASUS_STD(ostream)& errPrintWriter, Uint32 argc, char* argv []); /** Executes the command and writes the results to the output streams. @param outPrintWriter The stream to which command output is written. @param errPrintWriter The stream to which command errors are written. @return 0 if the command is successful 1 if an error occurs in executing the command */ Uint32 execute ( PEGASUS_STD(ostream)& outPrintWriter, PEGASUS_STD(ostream)& errPrintWriter);private: /** list all matching subscriptions in the specified namespace(s) @param namespaceNames The namespaces to search @param filterName The name of the filter to list @param filterNamespace The namespace of the filter to list @param handlerName The handler name to find @param handlerNamespace The handler namespace to find @param handlerCreationClass The handler creation class to find @param verbose A true value denotes a verbose listing A false value denotes a columnar list @param outPrintWriter The stream to which command output is written. @param errPrintWriter The stream to which command errors are written. */ void _listSubscriptions( const Array<CIMNamespaceName>& namespaceNames, const String& filterName, const CIMNamespaceName& filterNamespace, const String& handlerName, const CIMNamespaceName& handlerNamespace, const String& handlerCreationClass, const Boolean verbose, PEGASUS_STD(ostream)& outPrintWriter, PEGASUS_STD(ostream)& errPrintWriter); /** remove matching subscription instance @param subscriptionNamespace The subscription namespace to search @param filterName The name of the filter to find @param filterNamespace The namespace of the filter to find @param handlerName The handler name to find @param handlerNamespace The handler namespace to find @param handlerCreationClass The handler creation class to find @param removeAll If true remove subscription,filter,handler If false remove only subscription @param outPrintWriter The stream to which command output is written. @param errPrintWriter The stream to which command errors are written. @return true if the subscription instance was found false if the subscription instance was not found */ Uint32 _removeSubscription ( const CIMNamespaceName& subscriptionNamespace, const String& filterName, const CIMNamespaceName& filterNamespace, const String& handlerName, const CIMNamespaceName& handlerNamespace, const String& handlerCreationClass, const Boolean removeAll, PEGASUS_STD(ostream)& outPrintWriter, PEGASUS_STD(ostream)& errPrintWriter); /** remove matching filter instance @param filterName The name of the filter to find @param filterNamespace The namespace of the filter to find @param outPrintWriter The stream to which command output is written. @param errPrintWriter The stream to which command errors are written. @return true if the filter instance was found false if the filter instance was not found */ Uint32 _removeFilter ( const String& filterName, const CIMNamespaceName& filterNamespace, PEGASUS_STD(ostream)& outPrintWriter, PEGASUS_STD(ostream)& errPrintWriter); /** remove matching handler instance @param handlerName The handler name to find @param handlerNamespace The handler namespace to find @param handlerCreationClass The handler creation class to find @param outPrintWriter The stream to which command output is written. @param errPrintWriter The stream to which command errors are written. @return true if the handler instance was found false if the handler instance was not found */ Uint32 _removeHandler ( const String& handlerName, const CIMNamespaceName& handlerNamespace, const String& handlerCreationClass, PEGASUS_STD(ostream)& outPrintWriter, PEGASUS_STD(ostream)& errPrintWriter); /** Get a list of subscriptions in the specifed namespace @param subscriptionNSin The namespace to search @param filterName The name of the filter to list @param filterNSIn The namespace of the filter to list @param handlerName The handler name to match @param handlerNSIn The handler namespace to match @param handlerCreationClass The handler creation class to match @param verbose A true value denotes a verbose listing A false value denotes a columnar list @param handlerInstancesFound The corresponding handler for this subscription @param handlerTypesFound The type of handler found. This is an enumerated type of the handler creation class. @param querysFound The subscription's filter's query string @param maxColumnWidth The array of column widths. This is the fixed width for each column. This is used to lineup all the data in each column. @param listOutputTable The array of output strings to print. It is an array of columns. The first element in each column is the column title. */ void _getSubscriptionList ( const CIMNamespaceName& subscriptionNSIn, const String& filterName, const CIMNamespaceName& filterNSIn, const String& handlerName, const CIMNamespaceName& handlerNSIn, const String& handlerCreationClass, const Boolean verbose, Array<CIMInstance>& handlerInstancesFound, Array<Uint32>& handlerTypesFound, Array<String>& querysFound, Array <Uint32>& maxColumnWidth, Array <ListColumnEntry>& listOutputTable); /** List matching filters in the specified namespace(s) @param filterName The name of the filter to list @param verbose A true value denotes a verbose listing A false value denotes a columnar list @param namespaceNames The namespaces to search @param outPrintWriter The stream to which command output is written. @param errPrintWriter The stream to which command errors are written. */ void _listFilters ( const String& filterName, const Boolean verbose, const Array<CIMNamespaceName>& namespaceNames, PEGASUS_STD(ostream)& outPrintWriter, PEGASUS_STD(ostream)& errPrintWriter); /** Get matching filters in the specified namespace @param filterName The name of the filter to list @param filterNamespace The namespace of the filter to list @param verbose A true value denotes a verbose listing A false value denotes a columnar list
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -