BUG#: 8633
authorkarl <karl>
Wed, 16 Dec 2009 18:50:50 +0000 (18:50 +0000)
committerkarl <karl>
Wed, 16 Dec 2009 18:50:50 +0000 (18:50 +0000)
TITLE: Modifications to cimcli per PEP 283

DESCRIPTION: Update cimcli files and add new files per PEP 283

23 files changed:
src/Clients/cimcli/CIMCLIClient.cpp
src/Clients/cimcli/CIMCLIClient.h
src/Clients/cimcli/CIMCLICommand.cpp
src/Clients/cimcli/CIMCLICommon.cpp [new file with mode: 0644]
src/Clients/cimcli/CIMCLICommon.h [new file with mode: 0644]
src/Clients/cimcli/CIMCLIHelp.cpp [new file with mode: 0644]
src/Clients/cimcli/CIMCLIHelp.h [new file with mode: 0644]
src/Clients/cimcli/CIMCLIOperations.cpp [new file with mode: 0644]
src/Clients/cimcli/CIMCLIOperations.h [new file with mode: 0644]
src/Clients/cimcli/CIMCLIOptionStruct.cpp [new file with mode: 0644]
src/Clients/cimcli/CIMCLIOptionStruct.h [new file with mode: 0644]
src/Clients/cimcli/CIMCLIOptions.cpp [new file with mode: 0644]
src/Clients/cimcli/CIMCLIOptions.h [new file with mode: 0644]
src/Clients/cimcli/CIMCLIOutput.cpp [new file with mode: 0644]
src/Clients/cimcli/CIMCLIOutput.h [new file with mode: 0644]
src/Clients/cimcli/Makefile
src/Clients/cimcli/ObjectBuilder.cpp [new file with mode: 0644]
src/Clients/cimcli/ObjectBuilder.h [new file with mode: 0644]
src/Clients/cimcli/doc/CLI.nroff
src/Clients/cimcli/doc/Makefile
src/Clients/cimcli/doc/cimcli.html [new file with mode: 0644]
src/Clients/cimcli/doc/cimcli.nroff [new file with mode: 0644]
src/Clients/cimcli/doc/cimcli.txt [new file with mode: 0644]

index 2d6d97a4aee5ba925177a638aca2358250abd4b6..48feb0a541876d541b12fb58e21c195fd2dfcd77 100644 (file)
 //
 //%/////////////////////////////////////////////////////////////////////////////
 
+/*
+    This file defines the cicml operations(action functions).
+    Each function is called from a specific cimcli input parameter opcode.
+    The parameters for each operation are defined in the.
+    options structure.
+*/
 #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/Constants.h>
 #include <Pegasus/Common/PegasusAssert.h>
 #include <Pegasus/Common/FileSystem.h>
 #include <Pegasus/Common/XmlWriter.h>
 #include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/StringConversion.h>
 #include <Pegasus/Common/ArrayInternal.h>
+
 #include <Pegasus/Common/PegasusVersion.h>
 
 #include <Pegasus/General/MofWriter.h>
 
 #include "CIMCLIClient.h"
 
+#include "ObjectBuilder.h"
+#include "CIMCLIOutput.h"
+#include "CIMCLIHelp.h"
+#include "CIMCLIOptions.h"
+#include "CIMCLICommon.h"
+#include "CIMCLIOperations.h"
+
 PEGASUS_USING_STD;
 PEGASUS_NAMESPACE_BEGIN
 
 const String DEFAULT_NAMESPACE = "root/cimv2";
 
-String _toString(Boolean x)
+
+/************************************************************************
+*
+*   Start and Stop timer to provide execution times for
+*   operation action functions.
+*
+*************************************************************************/
+
+/* Common function for all command action functions to start the
+   elapsed timer that will time command execution
+*/
+void _startCommandTimer(Options& opts)
+{
+    if (opts.time)
+    {
+        opts.elapsedTime.reset();
+        opts.elapsedTime.start();
+    }
+}
+
+/* Common function for all command action functions to
+   Stop and save the command timer if it was started
+*/
+void _stopCommandTimer(Options& opts)
+{
+    if (opts.time)
+    {
+        opts.elapsedTime.stop();
+        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
+    }
+}
+
+/************************************************************************
+*
+*   Display functions to support the verbose display of input parameters
+*
+*************************************************************************/
+
+void _showValueParameters(const Options& opts)
 {
-    return(x ? "true" : "false");
+    for (Uint32 i = 0; i < opts.valueParams.size(); i++)
+    {
+        cout << opts.valueParams[i] << " ";
+    }
+    cout << endl;
 }
+
+/*************************************************************
+*
+*  Functions for interactive selection from the console
+*
+*************************************************************/
 /** Select one item from an array of items presented to
     the user. This prints the list and requests user input for
     the response.
@@ -60,7 +123,6 @@ String _toString(Boolean x)
     of items the select is based on (ex: "Instance Names");
     @return Uint32 representing the item to be selected.
     TODO: Find a way to do a reject.
-
 */
 Uint32 _selectStringItem(const Array<String>& selectList, const String& what)
 {
@@ -68,7 +130,9 @@ Uint32 _selectStringItem(const Array<String>& selectList, const String& what)
     Uint32 listSize = selectList.size();
 
     for (Uint32 i = 0 ; i < listSize; i++)
+    {
         cout << i + 1 << ": " << selectList[i] << endl;
+    }
 
     while (rtn < 1 || rtn > listSize)
     {
@@ -89,30 +153,41 @@ Uint32 _selectStringItem(const Array<String>& selectList, const String& what)
     return (rtn - 1);
 }
 
-/** Allow user to select one instance name. Enumerates names given className and
-    requests input of one index
-    @param
-    @param
+/** Allow user to select one instance name. Do server
+    EnumerateNames for input className and ask user to select a
+    singe result from the enumerates returned.
     @param className CIMName for the class to enumerate.
-    @param instancePath CIMObjectPath of instance found
-    @return True if instance provided and the path is in instancePath.
+    @param instancePath CIMObjectPath of instance selected
+    @return True if at least one instance returned by server.
     Else False and there is nothing in the instancePath
+
+    NOTE: There is no clean way for the user to respond "none of
+    the above" to the request to select a single item from the
+    list.  They must select one or execute a program kill (ex.
+    Ctrl C)
 */
-Boolean _selectInstance(CIMClient& client, Options& opts,
-                        const CIMName& className,
+Boolean _selectInstance(Options& opts,
+    const CIMName& className,
     CIMObjectPath & instancePath)
 {
+    // Enumerate instance Names based on input class to get list
     Array<CIMObjectPath> instanceNames =
-        client.enumerateInstanceNames(opts.nameSpace,
+        opts.client.enumerateInstanceNames(opts.nameSpace,
                                       className);
+    // create a corresponding String list
     Array<String> list;
     for (Uint32 i = 0 ; i < instanceNames.size() ; i++)
+    {
         list.append(instanceNames[i].toString());
+    }
 
+    // return false if nothing in list
     if (list.size() == 0)
     {
         return(false);
     }
+
+    // ask user to select a single entry
     Uint32 rtn = _selectStringItem(list, "an Instance");
 
     instancePath = instanceNames[rtn];
@@ -120,678 +195,372 @@ Boolean _selectInstance(CIMClient& client, Options& opts,
     return(true);
 }
 
-
 /** Use the interactive selection mechanism to get the instance if
-    the input object is a class AND if the opts.interactive flag is
-    set.  This function is used by the association functions because
-    just the existence of the object as class is insufficient since
-    these functions accept both class and instance input for processing.
-    If the tests are passed this function calls the server to enumerate
-    the instance names possible and displays them for the user to
-    select one.
-    @param client CIMClient context for the operation required
+    the input object is a class AND if opts.interactive flag is
+    set.  This function is used by the associator/reference
+    functions because just the existence of the object as class
+    is insufficient since these functions accept both class and
+    instance input for processing. If the tests are passed this
+    function calls the server to enumerate the instance names
+    possible and displays them for the user to select one.
     @param opts the context structure for this operaiton
-    @param name String of the object that is the target of the request.
     @param instancePath CIMObjectPath of instance selected if return
     is true.  Else, unchanged.
     @return Boolean True if an instance path is to be returned. If nothing
     is selected, returns False.
 */
-Boolean _conditionalSelectInstance(CIMClient& client, Options& opts,
+Boolean _conditionalSelectInstance(Options& opts,
     CIMObjectPath & instancePath)
 {
     // if class level and interactive set.
     if ((instancePath.getKeyBindings().size() == 0) && opts.interactive)
     {
-        // Ask the user to select an instance
+        // Ask the user to select an instance. returns instancePath
+        // with selected path
 
-        return(_selectInstance(client, opts, CIMName(opts.objectName),
+        return(_selectInstance(opts, opts.getTargetObjectNameClassName(),
                     instancePath));
     }
 
     return(true);
 }
 
-
-// Character sequences used in help/usage output.
-String buildPropertyListString(CIMPropertyList& pl)
+/*
+    Compare two instances for equality in terms of number and names of
+    properties and property values
+*/
+Boolean _compareInstances(CIMInstance& inst1,
+                          CIMInstance& inst2,
+                          Boolean verbose,
+                          Options& opts)
 {
-    String rtn;
-    Array<CIMName> pls = pl.getPropertyNameArray();
-    if (pl.isNull())
-        return("NULL");
+    Boolean returnValue = true;
 
-    if (pl.size() == 0)
-        return("EMPTY");
+    //CIMCLIOutput::displayInstance(opts, inst1);
+    //CIMCLIOutput::displayInstance(opts, inst2);
 
-    for (Uint32 i = 0 ; i < pls.size() ; i++)
+    for (Uint32 i = 0 ; i < inst1.getPropertyCount(); i++)
     {
-        if (i != 0)
-            rtn.append(", ");
-        rtn.append(pls[i].getString());
-    }
-    return(rtn);
-}
+        CIMProperty inst1Property = inst1.getProperty(i);
+        CIMName testName = inst1Property.getName();
+        //cout << "test property " << testName.getString() << endl;
+        Uint32 pos;
+        if ((pos = inst2.findProperty(testName)) != PEG_NOT_FOUND)
+        {
+            CIMProperty inst2Property = inst2.getProperty(pos);
 
-void printPropertyList(CIMPropertyList& pl)
-{
-    cout << buildPropertyListString(pl);
-}
-static const char * usage = "This command executes single CIM Operations.\n";
+            if (!inst1Property.identical(inst2Property))
+            {
+                returnValue = false;
+                if (verbose)
+                {
+                    cout << "Error in Property. "<< testName.getString()
+                         << "Test Instance Property ";
+                    CIMCLIOutput::displayProperty(opts,inst1Property);
 
-static const char* optionText = "Valid options for this command are : ";
-static const char* commonOptions = "    -count, -d, -delay, -p, -l, -u, -o, -x,\
- -v, --sum, --timeout, -r, --t ";
+                    cout << endl <<"Returned instance Property";
 
-struct CommandExampleWithOptionStruct
-{
-    const char* msgKey;  //Message key for globalization of example string
-    const char* Example; //Example String
-    const char* optionsKey; //Message key for option string
-    const char* Options; //Option supported
-};
-
-CommandExampleWithOptionStruct examples[] = {
-    {"Clients.cimcli.CIMCLIClient.NI_COMMAND_EXAMPLE",
-    "cimcli ni -n test/TestProvider TEST_Person\n"
-        "    -- Enumerate Instance Names of class\n",
-    "Clients.cimcli.CIMCLIClient.NI_COMMAND_OPTIONS",
-    "    -n, classname\n"},
-
-    {"Clients.cimcli.CIMCLIClient.NIALL_COMMAND_EXAMPLE",
-    "cimcli niall -n root/cimv2\n"
-        "    -- Enumerate Instance Names of  all classes under\n"
-        "       the namespace root/cimv2\n",
-    "Clients.cimcli.CIMCLIClient.NIALL_COMMAND_OPTIONS",
-    "    -n, -di, classname\n"},
-
-    {"Clients.cimcli.CIMCLIClient.EI_COMMAND_EXAMPLE",
-    "cimcli ei PG_ComputerSystem   -- Enumerate Instances of class\n",
-    "Clients.cimcli.CIMCLIClient.EI_COMMAND_OPTIONS",
-    "    -n, -di, -lo, -iq, -pl, classname, includeClassOrigin\n"},
-
-    {"Clients.cimcli.CIMCLIClient.NC_COMMAND_EXAMPLE",
-    "cimcli nc -- Enumerate class names from root/cimv2.\n",
-    "Clients.cimcli.CIMCLIClient.NC_COMMAND_OPTIONS",
-    "    -n, -di, classname\n"},
-
-    {"Clients.cimcli.CIMCLIClient.EC_COMMAND_EXAMPLE",
-    "cimcli ec -n root/cimv2\n"
-        "    -- Enumerate classes from namespace root/cimv2.\n",
-    "Clients.cimcli.CIMCLIClient.EC_COMMAND_OPTIONS",
-    "    -n, -di, -lo, -iq, includeClassOrigin\n"},
-
-    {"Clients.cimcli.CIMCLIClient.GC_COMMAND_EXAMPLE",
-    "cimcli gc CIM_door -u guest -p guest\n"
-        "    -- Get class user = guest and password = guest.\n",
-    "Clients.cimcli.CIMCLIClient.GC_COMMAND_OPTIONS",
-    "    -n, -lo, -iq, -pl, className, includeClassOrigin\n"},
-
-    {"Clients.cimcli.CIMCLIClient.GI_COMMAND_EXAMPLE",
-    "cimcli gi -n test/TestProvider TEST_Person\n"
-        "    -- Get Instance of class\n",
-    "Clients.cimcli.CIMCLIClient.GI_COMMAND_OPTIONS",
-    "    -n, -lo, -iq, -pl, includeClassOrigin\n"},
-
-    {"Clients.cimcli.CIMCLIClient.CI_COMMAND_EXAMPLE",
-    "cimcli ci -n test/TestProvider TEST_Person Name=Michael\n"
-        "    -- Create Instance of  class \n",
-    "Clients.cimcli.CIMCLIClient.CI_COMMAND_OPTIONS",
-    "    -n\n"},
-
-    {"Clients.cimcli.CIMCLIClient.DI_COMMAND_EXAMPLE",
-    "cimcli di -n test/TestProvider TEST_Person\n"
-        "    -- Delete Instance of class interactively\n",
-    "Clients.cimcli.CIMCLIClient.DI_COMMAND_OPTIONS",
-    "    -n\n"},
-
-    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "Operation Not supported..\n",
-    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "\n"},
-
-    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "Operation Not supported..\n",
-    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "\n"},
-
-    {"Clients.cimcli.CIMCLIClient.DC_COMMAND_EXAMPLE",
-    "cimcli dc -n test/TestProvider TEST_Person\n"
-        "    -- Deletes the Class when there are no instance and\n"
-        "        sub-class for this class\n",
-    "Clients.cimcli.CIMCLIClient.DC_COMMAND_OPTIONS",
-    "    -n\n"},
-
-    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "Operation Not supported..\n",
-    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "\n"},
-
-    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "Operation Not supported..\n",
-    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "\n"},
-
-    {"Clients.cimcli.CIMCLIClient.GQ_COMMAND_EXAMPLE",
-    "cimcli gq Association\n"
-        "    -- Get the qualifiers in mof output format\n",
-    "Clients.cimcli.CIMCLIClient.GQ_COMMAND_OPTIONS",
-    "    -n, qualifierName\n"},
-
-    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "Operation Not supported..\n",
-    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
-    "\n"},
-
-    {"Clients.cimcli.CIMCLIClient.EQ_COMMAND_EXAMPLE",
-    "cimcli eq -n test/TestProvider\n"
-        "    -- Enumerate Qualifiers of namespace test/TestProvider\n",
-    "Clients.cimcli.CIMCLIClient.EQ_COMMAND_OPTIONS",
-    "    -n\n"},
-
-    {"Clients.cimcli.CIMCLIClient.DQ_COMMAND_EXAMPLE",
-    "cimcli dq -n test/TestProvider ASSOCIATION\n"
-        "    -- Delete Qualifier Association in namespace\n"
-        "        test/TestProvider\n",
-    "Clients.cimcli.CIMCLIClient.DQ_COMMAND_OPTIONS",
-    "    -n, qualifierName\n"},
-
-    {"Clients.cimcli.CIMCLIClient.A_COMMAND_EXAMPLE",
-    "cimcli a TST_Person.name=\\\"Mike\\\" -n test/TestProvider\n"
-        "    -ac TST_Lineager"
-        "\n or\n"
-        "cimcli a TST_Person -n test/TestProvider -ac TST_Lineage\n",
-    "Clients.cimcli.CIMCLIClient.A_COMMAND_OPTIONS",
-    "    -n, -ac, -rc, -r, -rr, -iq, -pl, includeClassOrigin, -i\n"},
-
-    {"Clients.cimcli.CIMCLIClient.AN_COMMAND_EXAMPLE",
-    "cimcli an TST_Person.name=\\\"Mike\\\" -n test/TestProvider\n"
-        "    -ac TST_Lineage"
-        "\n or\n"
-        "cimcli an TST_Person -n test/TestProvider -ac TST_Lineage\n",
-    "Clients.cimcli.CIMCLIClient.AN_COMMAND_OPTIONS",
-    "    -n, -ac, -rc, -r, -rr, -i\n"},
-
-    {"Clients.cimcli.CIMCLIClient.R_COMMAND_EXAMPLE",
-    "cimcli r TST_Person.name=\\\"Mike\\\" -n test/TestProvider\n"
-        "    -rc TST_Lineage"
-        "\n or\n"
-        "cimcli r TST_Person -n test/TestProvider -rc TST_Lineage\n",
-    "Clients.cimcli.CIMCLIClient.R_COMMAND_OPTIONS",
-    "    -n, -rc, -r, -iq, -pl, includeClassOrigin, -i\n"},
-
-    {"Clients.cimcli.CIMCLIClient.RN_COMMAND_EXAMPLE",
-    "cimcli rn TST_Person.name=\\\"Mike\\\" -n test/TestProvider\n"
-        "    -rc TST_Lineage"
-        "\n or\n"
-        "cimcli rn TST_Person -n test/TestProvider -rc TST_Lineage\n",
-    "Clients.cimcli.CIMCLIClient.RN_COMMAND_OPTIONS",
-    "    -n, -rc, -r, -i\n"},
-
-    {"Clients.cimcli.CIMCLIClient.IM_COMMAND_EXAMPLE",
-    "cimcli im Sample_MethodProviderClass.Name=\\\"mooo\\\" SayHello\n"
-        "    -n root/SampleProvider -ip p1=fred\n",
-    "Clients.cimcli.CIMCLIClient.IM_COMMAND_OPTIONS",
-        "    -n, -ip\n"},
-
-    {"Clients.cimcli.CIMCLIClient.XQ_COMMAND_EXAMPLE",
-    "cimcli xq \"select * from CIM_ComputerSystem\"\n"
-        "    -- This command will work when the code is compiled with\n"
-        "        ExecQuery enabled\n",
-    "Clients.cimcli.CIMCLIClient.XQ_COMMAND_OPTIONS",
-    "    -n, queryLanguage, query\n"},
-
-    {"Clients.cimcli.CIMCLIClient.NS_COMMAND_EXAMPLE",
-    "cimcli ns  -- Enumerate all Namespaces in repository\n",
-    "Clients.cimcli.CIMCLIClient.NO_OPTIONS_REQUIRED",
-    " No options Required\n"},
-
-    {"Clients.cimcli.CIMCLIClient.SON_COMMAND_EXAMPLE",
-    "cimcli son  -- Switch On's the statistical information on CIMServer\n",
-    "Clients.cimcli.CIMCLIClient.NO_OPTIONS_REQUIRED",
-    " No options Required\n"},
-
-    {"Clients.cimcli.CIMCLIClient.SOFF_COMMAND_EXAMPLE",
-    "cimcli soff  -- Switch OFF's the statistical information on CIMServer\n",
-    "Clients.cimcli.CIMCLIClient.NO_OPTIONS_REQUIRED",
-    " No options Required\n"},
-
-    {"Clients.cimcli.CIMCLIClient.?_COMMAND_EXAMPLE",
-    "cimcli ?  -- Displays help command\n",
-    "Clients.cimcli.CIMCLIClient.NO_OPTIONS_REQUIRED",
-    "    No options Required"}
-};
-
-void showExamples()
-{
-    Uint32 numExamples = sizeof(examples) / sizeof(examples[0]);
-    cout <<
-        loadMessage(
-            "Clients.cimcli.CIMCLIClient.EXAMPLES_STRING",
-            "Examples : ")
-         << endl;
-
-    for (Uint32 i=0; i < numExamples; i++)
-    {
-        cout << loadMessage(examples[i].msgKey, examples[i].Example) << endl;
-    }
-}
+                    CIMCLIOutput::displayProperty(opts,inst2Property);
+                    cout << endl;
+                }
 
-void _displaySummary(Uint32 count, String& description, String item,
-                     Options& opts)
-{
-        cout << count << " " << description
-            << " " << item << " returned. ";
-        if (opts.repeat > 0)
-            cout << opts.repeat;
-        if(opts.time && opts.repeat)
-            cout << " " << opts.saveElapsedTime;
-        cout << endl;
-        if ((opts.count) != 29346 && (opts.count != count))
-        {
-            cout << "Failed count test. Expected= " << opts.count
-                 << " Actual rcvd= " << count << endl;
-            opts.termCondition = 1;
+            }
         }
-}
-
-/**** NOT TESTED
-String _nextToken(String& input, Uint32 start, Char16 separator)
-{
-    String rtn;
-    Uint32 end;
-    end = input.find(input.find(start, separator));
-    if (end == PEG_NOT_FOUND)
-    {
-        start = PEG_NOT_FOUND
-        rtn = input.subString(start,(input.size() - start);
-    }
-    else
-    {
-        rtn = input.subString(start,end);
-        start = end + 1;
-    }
-    return(rtn);
-}
-*/
-/** tokenize an input string into an array of Strings,
- * separating the tokens at the separator character
- * provided
- * @param input String
- * @param separator character
- * @returns Array of separated strings
- * */
-Array<String> _tokenize(const String& input, const Char16 separator)
-{
-    Array<String> tokens;
-    if (input.size() != 0)
-    {
-        Uint32 start = 0;
-        Uint32 length = 0;
-        Uint32 end = 0;
-        while ((end = input.find(start, separator)) != PEG_NOT_FOUND)
+        else   // Property not found in second instance
         {
-            length = end - start;
-            tokens.append(input.subString(start, length));
-            start += (length + 1);
+            returnValue = false;
+            if (verbose)
+            {
+                cout << "Error: Property " << testName.getString()
+                    << "not found in second instance" << endl;
+            }
         }
-        //Replaced < with <= to consider input param like A="" as valid param.
-        //key in this param is 'A'and value is NULL.
-        //It also takes care of A= param.
-        if(start <= input.size())
+
+        // If the number of properties not the same in the two instances
+        // inst2 must have more than inst1.
+        if (inst1.getPropertyCount() != inst2.getPropertyCount())
         {
-            tokens.append(input.subString(start));
+            returnValue = false;
+            if(verbose)
+            {
+                for (Uint32 i = 0 ; i < inst2.getPropertyCount() ; i++)
+                {
+                    CIMProperty inst2Property = inst2.getProperty(i);
+                    CIMName testName = inst2Property.getName();
+                    if (inst1.findProperty(testName) == PEG_NOT_FOUND)
+                    {
+                        cout << "Error: property " << testName.getString()
+                            << " not found in first instance" << endl;
+                    }
+                }
+            }
         }
     }
-    return tokens;
+    return returnValue;
 }
-
-Boolean _tokenPair(const String& input, String& key, String& value)
+/******************************************************************************
+//
+//  Functions to get the interop namespace and the namespaces in the
+//  target cimserver.
+//
+******************************************************************************/
+/*
+    Find the most likely candidate for the interop namespace using the class
+    CIM_Namespace which should exist in the Interop namespace.  This function
+    tests the standard expected inputs and appends namespaces input in the
+    nsList input. It returns the namespace found and the instances of the
+    CIM_Namespace class in that namespace.
+    If the interop namespace found, the instances of CIM_Namespace are
+    returned in the instances parameter.
+    TODO: Determine a more complete algorithm for determining the
+    interop namespace.  Simply the existence of this class may not always
+    be sufficient.
+*/
+Boolean _findInteropNamespace(Options& opts,
+                              const Array<CIMNamespaceName> & nsList,
+                              Array<CIMInstance>& instances,
+                              CIMNamespaceName& nsSelected)
 {
+    CIMName className = PEGASUS_CLASSNAME_CIMNAMESPACE;
+    Array<CIMNamespaceName> interopNs;
 
-    Array<String> pair = _tokenize(input, '=');
-    if (pair.size() < 2)
-    {
-        cout << "Input Parameter error. Expected name=value. Received  "
-             << input << endl;
-        return(false);
-    }
-    // If there is more than 1 "=" it is part of the reference and we
-    // rebuild the reference.
-    if (pair.size() > 2)
+    interopNs.appendArray(nsList);
+    interopNs.append(PEGASUS_NAMESPACENAME_INTEROP);
+    interopNs.append("interop");
+    interopNs.append("root/interop");
+    Boolean nsFound = false;
+
+    for (Uint32 i = 0 ; i < interopNs.size() ; i++)
     {
-        for (Uint32 i = 2 ; i < pair.size() ; i++)
+        try
         {
-            pair[1].append("=");
-            pair[1].append(pair[i]);
-        }
-    }
-    key = pair[0];
-    value = pair[1];
-    return(true);
-}
+            instances = opts.client.enumerateInstances(interopNs[i],
+                                                       className);
 
+            nsFound = true;
 
-void _nextParamToken(String& input, String& token)
-{
-    unsigned int end;
-    // Check for Character Literal
-    if (input.find('\'') == 0)
-    {
-        input.remove(0,1);  // remove quote
-        if ((end = input.find("\'")) != PEG_NOT_FOUND)
-        {
-            token = input.subString(0, end);
-            input.remove(0, end + 1);   // +1 to delete final quote char
-        }
-        else
-        {
-            printf(" ERROR -- no matching quote!");
-        }
-        return;
-    }
-    // Check for String Literal
-    if (input.find('\"') == 0)
-    {
-        input.remove(0,1);  // remove quote
-        if ((end = input.find("\"")) != PEG_NOT_FOUND)
-        {
-            token = input.subString(0, end);
-            input.remove(0, end + 1);   // +1 to delete final quote char
+            if (opts.verboseTest)
+            {
+                cout << "Found CIM_NamespaceName in namespace "
+                    << interopNs[i].getString()
+                    << " with " << instances.size() << " instances "
+                    << endl;
+            }
+            nsSelected = interopNs[i];
+            break;
         }
-        else
+        catch(CIMException & e)
         {
-            printf("ERROR -- no matching quote!");
+            /* If exceptions caught here for all namespaces tested assume that
+               target CIMOM does not support CIM_Namespace class.
+               Therefore we have to revert to the __namespaces class to
+               get namespace information. (Which may only retrun a subset of
+               namspaces.
+               NOTE: Possible exceptions include namespace does not exist
+                     and class does not exist.
+            */
+            cout << "Info: CIMException return to CIM_NamespaceName enumerate"
+                " request. "
+                << e.getMessage() << endl;
         }
-        return;
-    }
-    // Take line up to separator (, or }) as token
-    if ((end = input.find(',')) != PEG_NOT_FOUND)
-    {
-        token = input.subString(0, end);
-        input.remove(0, end+1); // +1 to capture the comma
-        return;
     }
-    if ((end = input.find('}')) != PEG_NOT_FOUND)
-    {
-        token = input.subString(0, end);
-        input.remove(0, end+1); // +1 to capture the brace
-        return;
-    }
-
-    if((end = input.find(']')) != PEG_NOT_FOUND)
-    {
-        token = input.subString(0, end);
-        input.remove(0, end+1); // +1 to capture the bracket
-        return;
-    }
-    // Fall through.. take entire input as token
-    token = input;
-    input = "";
-    return;
+    return nsFound;
 }
-
-CIMParamValue _createMethodParamValue(const String& input, const Options& opts)
+/*
+    Use the __namespace class to attempt to get namespace names.  Returns
+    an array containing namespaces found. Used by _getNameSpaceNames(...)
+*/
+Array<CIMNamespaceName> _getNameSpacesWith__namespace(Options& opts)
 {
-    String key;
-    String value;
-    if (!_tokenPair(input, key, value))
-    {
-        cout <<"Error in param parsing with input " << input << endl;
-        exit(1);
-    }
+    Array<CIMNamespaceName> namespaceNames;
+    CIMName nsClassName = CIMName("__namespace");
 
-    if (opts.verboseTest)
-    {
-        cout << "Name = " << key << ", Value= " << value << endl;
-    }
-    // ATTN: KS 20030423 P2 This is incomplete since it only allows us
-    // to do string input.
-    // We don't include the typing information.
-    //Array<String> valuePair = _tokenize(pair[1], ':');
-    //if (validType(valuePair[0] >= 0)
-    //{
-    //
-    //}
-
-    String tmp = value;
-    if (value.find('{') == 0)
-    {
-        // assume brace at first character position indictates an
-        // array value
-        tmp.remove(0,1);  // remove open brace
-        Array<String> arr;
-        while (tmp.size() != 0)
-        {
-            String token;
-            _nextParamToken(tmp, token);
-            arr.append(token);
-            // Now remove token separators (comma, brace or whitespace)
-            while ((tmp.size() > 0) &&
-                   ((tmp.find(",") == 0) || (tmp.find("}") == 0) ||
-                    (tmp.find(" ") == 0)))
-                tmp.remove(0,1);
-        }
-        CIMValue v(arr);
-        CIMParamValue pv(key, v);
-        return pv;
-    }
+    // TODO Determine if we really need this statement
+    opts.nameSpace = PEGASUS_NAMESPACENAME_INTEROP.getString();
+
+    // Build the namespaces incrementally starting at the root
+    // ATTN: 20030319 KS today we start with the "root" directory but
+    // this is wrong. We should be
+    // starting with null (no directory) but today we get an xml error
+    // return in Pegasus
+    // returned for this call. Note that the specification requires
+    // that the root namespace be used
+    // when __namespace is defined but does not require that it be
+    // the root for all namespaces. That  is a hole is the spec,
+    // not in our code.
+
+    // TODO: Determine why we need the following statement
+    namespaceNames.append(opts.nameSpace);
+
+    Uint32 start = 0;
+    Uint32 end = namespaceNames.size();
 
-    // Check for References starting with '[' and ending with ']'
-    if(tmp.find('[') == 0)
+    do
     {
-        if(tmp.find(']') == tmp.size()-1)
+        // for all new elements in the output array
+        for (Uint32 range = start; range < end; range ++)
         {
-            Array<CIMKeyBinding> keys;
-            Array<String> arr;
-            String className;
-            tmp.remove(0,1);  // remove open bracket
-
-            // Iterate over the input param to extract class name,
-            // key names and values.
-            while(tmp.size() != 0)
+            // Get the next increment in naming for all a name element
+            // in the array
+            Array<CIMInstance> instances = opts.client.enumerateInstances(
+                namespaceNames[range],nsClassName);
+            for (Uint32 i = 0 ; i < instances.size(); i++)
             {
-                String token, identifier, refKey;
-                _nextParamToken(tmp, token);
-                Uint32 dotIndex = 0, equalIndex = 0;
-
-                // Get the class name and key1/value1 from class.key = value
-                if (((dotIndex = token.find('.')) != PEG_NOT_FOUND)  &&
-                     (((equalIndex = token.find('=')) != PEG_NOT_FOUND) &&
-                       dotIndex < equalIndex-1))
+                Uint32 pos;
+                // if we find the property and it is a string, use it.
+                if ((pos = instances[i].findProperty("name"))
+                        != PEG_NOT_FOUND)
                 {
-                    //extract class name, key1 and value1
-                    className = token.subString(0, dotIndex);
-                    identifier = token.subString(dotIndex+1,
-                                                 equalIndex-1-dotIndex);
-                    refKey = token.subString(equalIndex+1, token.size());
-                    keys.append(CIMKeyBinding(identifier, refKey,
-                                              CIMKeyBinding::STRING));
-                }
+                    CIMValue value;
+                    String namespaceComponent;
+                    value = instances[i].getProperty(pos).getValue();
+                    if (value.getType() == CIMTYPE_STRING)
+                    {
+                        value.get(namespaceComponent);
 
-                // Get the simple keyX = valueX (where X>1)
-                else if((equalIndex = token.find('=')) != PEG_NOT_FOUND)
-                {
-                    identifier = token.subString(0, equalIndex);
-                    refKey = token.subString(equalIndex+1, token.size());
-                    keys.append(CIMKeyBinding(identifier, refKey,
-                                              CIMKeyBinding::STRING));
-                }
-                else
-                {
-                    cout << " Error in the reference param this could be"
-                                " a string param" << endl;
-                    exit(1);
-                }
-                // Now remove token separators (comma, bracket or whitespace)
-                while((tmp.size() > 0) &&
-                      ((tmp.find(",") == 0) ||
-                       (tmp.find("]") == 0) ||
-                       (tmp.find(" ") == 0)))
-                {
-                    tmp.remove(0,1);
+                        String ns = namespaceNames[range].getString();
+                        ns.append("/");
+                        ns.append(namespaceComponent);
+                        namespaceNames.append(ns);
+                    }
                 }
             }
-            // Reference param specified is valid.
-            // Make CIM Object Path from the token.
-            CIMName cimclassName(className);
-            CIMObjectPath cop(String::EMPTY,CIMNamespaceName(opts.nameSpace),
-                              cimclassName,keys);
-            CIMValue v(cop);
-            CIMParamValue pv(key, v, false);
-            return pv;
-        }
-        else
-        {
-            cout <<"Treat this as String param " << input << endl;
+            start = end;
+            end = namespaceNames.size();
         }
     }
+    while (start != end);
 
-    // Fallthrough...
-    CIMValue v(value);
-    CIMParamValue pv(key, v, false);
-    return pv;
+    return namespaceNames;
 }
 
-void outputFormatInstance(const OutputType format, CIMInstance& instance)
-{
-    cout << "path= " << instance.getPath().toString() << endl;
-    if (format == OUTPUT_XML)
-        XmlWriter::printInstanceElement(instance, cout);
-    else if (format == OUTPUT_MOF)
-    {
-        // Reset the propagated flag to assure that these entities
-        // are all shown in the MOF output.
-        for (Uint32 i = 0 ; i < instance.getPropertyCount() ; i++)
-        {
-            CIMProperty p = instance.getProperty(i);
-            p.setPropagated(false);
-        }
+/*
+    List the namespaces in the target host CIMObjectManager.
+    This function tries several options to generate a list of the
+    namespaces in the target CIMOM including:
+    1. Try to list a target Class in the interop namespace.  Note that
+    it tries several different guesses to get the target namespace
+    2. If a class name is provided as opts.Classname (i.e typically as
+    argv2 in the direct call operation, that class is substituted for
+    the CIM Namespace class.
+    3. If a namespace is provided in opts.namespace (typically through
+    the -n input option) that namespace is used as the target namespace
+    4. If an asterick "*" is found in opts.namespace, a selection of
+    possible namespaces is used including the pegasus default, interop,
+    and root/interop.
+    5. Finally, if no namespace can be found with the namespace class
+    an attempt is made to get the namespace with the __namespace class
+    and its incremental descent algorithm.
+*/
 
-        Buffer x;
-        MofWriter::appendInstanceElement(x, instance);
-        mofFormat(cout, x.getData(), 4);
-    }
-}
-void outputFormatParamValue(const OutputType format, const CIMParamValue& pv)
+Array<CIMNamespaceName> _getNameSpaceNames(Options& opts)
 {
-    if (format == OUTPUT_XML)
-        XmlWriter::printParamValueElement(pv, cout);
+    //CIMName className = PEGASUS_CLASSNAME_CIMNAMESPACE;
+
+    Array<CIMNamespaceName> namespaceNames;
+    Array<CIMInstance> instances;
+    Array<CIMNamespaceName> interopNs;
 
-    else if (format == OUTPUT_MOF)
+    // if there is a name in the input namespace, use it.
+    if (opts.nameSpace != "*" && opts.nameSpace.size() != 0)
     {
-        if (!pv.isUninitialized())
-        {
-           CIMValue v =  pv.getValue();
-           CIMType type = v.getType();
-           if (pv.isTyped())
-               cout << cimTypeToString (type) << " ";
-           else
-               cout << "UnTyped ";
-
-           cout << pv.getParameterName() << "="
-                << v.toString() << endl;
-        }
-        else
-            cout << "ParamValue not initialized" << endl;
+        interopNs.append(opts.nameSpace);
     }
-    else
-        cout << "Error, Format Definition Error" << endl;
-}
 
-void outputFormatClass(const OutputType format, CIMClass& myClass)
-{
-    if (format == OUTPUT_XML)
-        XmlWriter::printClassElement(myClass, cout);
-    else if (format == OUTPUT_MOF)
+    // if a namespace with the CIM_Namespace class is found and instances are
+    // returned, we can simply list information from the instances.
+    // Assumption: all namespaces containing this class will return the
+    // same information.
+
+    CIMNamespaceName interopNamespaceFnd;
+    if (_findInteropNamespace(opts, interopNs, instances, interopNamespaceFnd))
     {
-        // Reset the propagated flag to assure that these entities
-        // are all shown in the MOF output.
-        for (Uint32 i = 0 ; i < myClass.getPropertyCount() ; i++)
+        for (Uint32 i = 0 ; i < instances.size(); i++)
         {
-            CIMProperty p = myClass.getProperty(i);
-            p.setPropagated(false);
+            Uint32 pos;
+            // If we find the property and it is a string, use it.
+            if ((pos = instances[i].findProperty("name")) != PEG_NOT_FOUND)
+            {
+                CIMValue value;
+                String namespaceComponent;
+                value = instances[i].getProperty(pos).getValue();
+                if (value.getType() == CIMTYPE_STRING)
+                {
+                    value.get(namespaceComponent);
+                    namespaceNames.append(CIMNamespaceName(
+                        namespaceComponent));
+                }
+            }
         }
-        for (Uint32 i = 0 ; i < myClass.getMethodCount() ; i++)
+    }
+    else  // No  namespace with CIM_Namespace class found.
+    {
+        if (opts.verboseTest)
         {
-            CIMMethod m = myClass.getMethod(i);
-            m.setPropagated(false);
+            cout << "Using __namespace class to find namespaces"
+                << endl;
         }
-        Buffer x;
-        MofWriter::appendClassElement(x, myClass);
-        mofFormat(cout, x.getData(), 4);
+        namespaceNames = _getNameSpacesWith__namespace(opts);
     }
-    else
-        cout << "Error, Format Definition Error" << endl;
-}
 
-void outputFormatObject(const OutputType format, const CIMObject& myObject)
-{
+    // Validate that all of the returned entities are really namespaces.
+    // It is legal for us to have a name component that is really not a
+    // namespace (ex. root/fred/john is a namespace  but root/fred is not.
+    // There is no clearly defined test for this so we will simply try to
+    // get something, in this case a well known assoication
 
-    if (myObject.isClass())
-    {
-        CIMClass c(myObject);
-        outputFormatClass(format, c);
-    }
-    else if (myObject.isInstance())
-    {
-        CIMInstance i(myObject);
-        outputFormatInstance(format, i);
-    }
-    else
-        cout << "Error, Object is neither class or instance" << endl;
-}
+    Array<CIMNamespaceName> rtns;
 
-void outputFormatQualifierDecl(const OutputType format,
-                               const CIMQualifierDecl& myQualifierDecl)
-{
-    if (format == OUTPUT_XML)
-        XmlWriter::printQualifierDeclElement(myQualifierDecl, cout);
-    else if (format == OUTPUT_MOF)
-    {
-        Buffer x;
-        MofWriter::appendQualifierDeclElement(x, myQualifierDecl);
-        mofFormat(cout, x.getData(), 4);
-    }
-    else
+    for (Uint32 i = 0 ; i < namespaceNames.size() ; i++)
     {
-        cout << "Format type error" << endl;
-    }
-}
+        try
+        {
+            CIMQualifierDecl cimQualifierDecl;
+            cimQualifierDecl = opts.client.getQualifier(namespaceNames[i],
+                                           "Association");
 
-void outputFormatCIMValue(const OutputType format, const CIMValue& myValue)
-{
-    if (format == OUTPUT_XML)
-    {
-        XmlWriter::printValueElement(myValue, cout);
-    }
-    else if (format == OUTPUT_MOF)
-    {
-        Buffer x;
-        MofWriter::appendValueElement(x, myValue);
-        mofFormat(cout, x.getData(), 4);
-    }
-    else
-    {
-        cout << " Format type error" << endl;
+            rtns.append(namespaceNames[i]);
+        }
+        catch(CIMException& e)
+        {
+            if (e.getCode() != CIM_ERR_INVALID_NAMESPACE)
+            {
+                rtns.append(namespaceNames[i]);
+            }
+            else
+            {
+                cerr << "Warning: " << namespaceNames[i].getString()
+                     << " Apparently not a real namespace. Ignored"
+                     << endl;
+            }
+        }
     }
+    return rtns;
 }
 
-///////////////////////////////////////////////////////////////////
-//                                                               //
-//     The following section  defines each action function       //
-//     ex. getInstance. Parameters are defined in the            //
-//     opts structure.  There are not exception catches.         //
-//     exception handling is in the main path                    //
-///////////////////////////////////////////////////////////////////
-
-/* This command searches the entire namespace and displays names of
+/////////////////////////////////////////////////////////////////////////////
+//                                                                         //
+//     The following code section defines the action functions             //
+//     These functions are a combination of                                //
+//     a. the CIM Operations as defined by the DMTF specification          //
+//       ex. getInstance implemented for cimcli.                           //
+//     b. Other operations such as ns for get namespaces that              //
+//        might be useful to CIMOM testers                                 //
+//     Input parameters are defined in the                                 //
+//     opts structure.  There are no exception catches.                    //
+//     exception handling is in the main path.                             //
+/////////////////////////////////////////////////////////////////////////////
+
+/*********************** enumerateAllInstanceNames ***************************/
+
+/* This command searches an entire namespace and displays names of
    all instances.
    It is in effect enumerate classes followed by enumerate instances.
    The user may either provide a starting class or not, in which case
    it searches the complete namespace, not simply the defined class.
 */
-int enumerateAllInstanceNames(CIMClient& client, Options& opts)
+
+int enumerateAllInstanceNames(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -801,60 +570,97 @@ int enumerateAllInstanceNames(CIMClient& client, Options& opts)
             << ", deepInheritance = " << _toString(opts.deepInheritance)
             << endl;
     }
-    // Added to allow "" string input to represent NULL CIMName.
-    CIMName myClassName = CIMName();
-    /****if (opts.className != "")
-    {
-        myClassName = opts.className;
-    }*/
 
-    Array<CIMName> classNames;
+    CIMName myClassName = CIMName();
 
-    if (opts.time)
+    Array<CIMNamespaceName> nsList;
+    if (opts.nameSpace != "*")
     {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
+        nsList.append(opts.nameSpace);
+    }
+    else
+    {
+        nsList = _getNameSpaceNames(opts);
+    }
+    if (opts.verboseTest)
+    {
+        cout << "Namespaces List for getNamespaces "
+             << _toString(nsList)
+             << endl;
     }
 
-    classNames = client.enumerateClassNames(opts.nameSpace,
-                                        opts.className,
-                                        opts.deepInheritance);
-
-    for (Uint32 iClass = 0; iClass < classNames.size(); iClass++)
+    CIMName saveClassName = opts.className;
+    for (Uint32 i = 0 ; i < nsList.size() ; i++)
     {
+        opts.nameSpace = nsList[i].getString();
+        Array<CIMName> classNames;
+
+        // The timer really has no meaning for this operation since
+        // we merge output and acquisition over multiple operations
+        _startCommandTimer(opts);
+
+        // Get all class names in namespace
+        opts.className = saveClassName;
         if (opts.verboseTest)
         {
-            cout << "EnumerateInstanceNames "
-                << "Namespace = " << opts.nameSpace
-                << ", Class = " << classNames[iClass].getString()
-                << endl;
-        }
-        Array<CIMObjectPath> instanceNames =
-        client.enumerateInstanceNames(opts.nameSpace, classNames[iClass]);
-        if (opts.summary)
-        {
-      String s = "instance names of class";
-      _displaySummary(instanceNames.size(), s, opts.className.getString(),opts);
+            cout << "EnumerateClassNames for namespace "
+                << opts.nameSpace << endl;
         }
-        else
+        classNames = opts.client.enumerateClassNames(opts.nameSpace,
+                                            opts.className,
+                                            opts.deepInheritance);
+
+        _stopCommandTimer(opts);
+
+        // Enumerate instance names for all classes returned
+        Uint32 totalInstances = 0;
+        for (Uint32 iClass = 0; iClass < classNames.size(); iClass++)
         {
-            //simply output the list one per line for the moment.
-            for (Uint32 i = 0; i < instanceNames.size(); i++)
-                        cout << instanceNames[i].toString() << endl;
-        }
-    }
+            if (opts.verboseTest)
+            {
+                cout << "EnumerateInstanceNames "
+                    << "Namespace = " << opts.nameSpace
+                    << ", Class = " << classNames[iClass].getString()
+                    << endl;
+            }
+            Array<CIMObjectPath> instanceNames;
+            try
+            {
+                instanceNames =
+                    opts.client.enumerateInstanceNames(opts.nameSpace,
+                                                       classNames[iClass]);
+            }
+            catch(CIMException& e )
+            {
+                cerr << "Warning: Error in niall for enumerateInstanceNames "
+                    << " Namespace = " << opts.nameSpace
+                    << " Class = " << classNames[iClass].getString()
+                     << e.getMessage() << ". Continuing." << endl;
+                continue;
+            }
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+            totalInstances += instanceNames.size();
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+            String s = "instances of class";
+            opts.className = classNames[iClass];
+            CIMCLIOutput::displayPaths(opts, instanceNames, s);
+        }
 
-    return(0);
+        cout << "total Instances in " << opts.nameSpace
+             << " = " << totalInstances
+             << " which contains " << classNames.size() << " classes"
+             << endl;
+    }
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int enumerateInstanceNames(CIMClient& client, Options& opts)
+
+/*********************** enumerateInstanceNames  ***************************/
+/*
+    This action function executes the client enumerateInstanceNames
+    client operation.  Inputs are the namespace and classname
+*/
+int enumerateInstanceNames(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -864,39 +670,26 @@ int enumerateInstanceNames(CIMClient& client, Options& opts)
             << endl;
     }
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
     Array<CIMObjectPath> instanceNames =
-        client.enumerateInstanceNames(opts.nameSpace,
+        opts.client.enumerateInstanceNames(opts.nameSpace,
                                       opts.className);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    if (opts.summary)
-    {
-      String s = "instances names of class";
-      _displaySummary(instanceNames.size(), s, opts.className.getString(),opts);
-    }
-    else
-    {
-        //Output the list one per line for the moment.
-        for (Uint32 i = 0; i < instanceNames.size(); i++)
-                    cout << instanceNames[i].toString() << endl;
-    }
+    CIMCLIOutput::displayPaths(opts,instanceNames);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int enumerateInstances(CIMClient& client, Options& opts)
+
+/************************** enumerateInstances  ***************************/
+/*
+    This action function executes the enumerateInstances
+    client operation. Inputs are the parameters for the CIMCLient call
+*/
+int enumerateInstances(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -907,19 +700,15 @@ int enumerateInstances(CIMClient& client, Options& opts)
             << ", localOnly = " << _toString(opts.localOnly)
             << ", includeQualifiers = " << _toString(opts.includeQualifiers)
             << ", includeClassOrigin = " << _toString(opts.includeClassOrigin)
-            << ", PropertyList = " << buildPropertyListString(opts.propertyList)
+            << ", PropertyList = " << _toString(opts.propertyList)
             << endl;
     }
 
     Array<CIMInstance> instances;
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
-    instances = client.enumerateInstances( opts.nameSpace,
+    instances = opts.client.enumerateInstances( opts.nameSpace,
                                            opts.className,
                                            opts.deepInheritance,
                                            opts.localOnly,
@@ -927,39 +716,20 @@ int enumerateInstances(CIMClient& client, Options& opts)
                                            opts.includeClassOrigin,
                                            opts.propertyList );
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
-
-    if (opts.summary)
-    {
-      String s = "instances of class";
-        _displaySummary(instances.size(), s, opts.className.getString(),opts);
-    }
-    else
-    {
-        if (instances.size() > 0 && opts.outputType == OUTPUT_TABLE)
-        {
-            tableFormat(cout, instances);
-            return(0);
-        }
+    _stopCommandTimer(opts);
 
-        // Output the returned instances
-        for (Uint32 i = 0; i < instances.size(); i++)
-        {
-            CIMInstance instance = instances[i];
-            // Check Output Format to print results
-            outputFormatInstance(opts.outputType, instance);
-        }
-    }
+    CIMCLIOutput::displayInstances(opts, instances);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int executeQuery(CIMClient& client, Options& opts)
+
+/************************** executeQuery  ***************************/
+/*
+    Execute the client ExecQuery function. The parameters are:
+    namespace, queryLanguage, and the query string
+*/
+int executeQuery(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -972,319 +742,456 @@ int executeQuery(CIMClient& client, Options& opts)
 
     Array<CIMObject> objects;
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
-    objects = client.execQuery( opts.nameSpace,
+    objects = opts.client.execQuery(opts.nameSpace,
                                 opts.queryLanguage,
                                 opts.query );
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    _stopCommandTimer(opts);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    String s = "instances of class";
+    CIMCLIOutput::displayObjects(opts, objects, s);
 
-    if (opts.summary)
-    {
-      String s = "instances of class";
-        _displaySummary(objects.size(), s, opts.className.getString(),opts);
-    }
-    else
-    {
-        // Output the returned instances
-        for (Uint32 i = 0; i < objects.size(); i++)
-            outputFormatObject(opts.outputType, objects[i]);
+    return(CIMCLI_RTN_CODE_OK);
+}
 
-    }
+/* local function to get the object path for the target defined by input.
+    The path is built or acquired from information provided by input as
+    follows:
+    The InstanceName/Class parameter is special in that it has several options:
+       - objectPath(Class plus keys) - Use the object path directly
+       - Class only (No keys) -  cimcli uses interactive mode to list instances
+         of class for selection
+       - Class only in objectName plus entries in extra parameters - cimcli
+         builds instance from extra parameters and then builds path from
+         instance to retrieve.
+    This function is used by all of the action functions that require
+    cimObjectPath input BUT do not utilize the -i (interactive option) to
+    make the decision.
+    @return Returns a CIMObjectPath which either contains the path to be used
+    or an empty path if there is no path for the operation.
+*/
 
-    return(0);
+CIMObjectPath _getObjectPath(Options& opts)
+{
+    // try to build path from input objectName property
+    // Uses try block because this input generates an exception based on
+    // input syntax and we can use this to more clearly tell the user
+    // what the issue is than the text of the standard malformed object
+    // exception
+
+    CIMObjectPath thisPath = opts.getTargetObjectName();
+
+    // If there are no keybindings and there are extra input parameters,
+    // build path from input arguments. If there are no keybindings
+    // and no extra parameters do the select instance.
+    if (opts.targetObjectName.getKeyBindings().size() == 0)
+    {
+        if (opts.valueParams.size() > 1)
+        {
+            ObjectBuilder ob(
+                opts.valueParams,
+                opts.client,
+                opts.nameSpace,
+                opts.targetObjectName.getClassName(),
+                CIMPropertyList(),
+                opts.verboseTest);
+
+           thisPath = ob.buildCIMObjectPath();
+        }
+        else  // no extra parameters.
+        {
+            // get the instance from a console request
+            if(!_selectInstance(opts, opts.getTargetObjectNameClassName(),
+                                thisPath))
+            {
+                return(CIMObjectPath());
+            }
+        }
+    }
+    return(thisPath);
 }
 
-int deleteInstance(CIMClient& client, Options& opts)
+
+/************************** deleteInstance  ***************************/
+/*
+    Execute the client operation deleteInstance with the parameters
+    namespace and object or classname.  If only the classname is provided
+    an interactive operation is executed and the user is presented with
+    a list of instances in the namespace/class from which they can select
+    an instance to delete.
+*/
+int deleteInstance(Options& opts)
 {
     if (opts.verboseTest)
     {
         cout << "deleteInstance "
             << "Namespace = " << opts.nameSpace
-            << ", Object = " << opts.objectName
+            << ", ObjectName/ClassName = " << opts.getTargetObjectNameStr()
             << endl;
-    }
-    // if request is class only, do this interactively
-    // Need to get this into objectpath format before doing the call.
-    CIMObjectPath thisObject(opts.objectName);
-    if ((thisObject.getKeyBindings().size() == 0) ? true : false)
-    {
-        // get the instance to delete
-        if(!_selectInstance(client, opts, CIMName(opts.objectName), thisObject))
-            return(0);
+        _showValueParameters(opts);
     }
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    // build or get path based in info in opts.  This function returns NULL
+    // cimobject path if there is an error.
+    CIMObjectPath thisPath = _getObjectPath(opts);
 
-    client.deleteInstance(opts.nameSpace,
-                          thisObject);
+    _startCommandTimer(opts);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    opts.client.deleteInstance(opts.nameSpace, thisPath);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
-/*
-NAMESPACE = 1
-Class = 2
-OBJECT = Object*2
-OBJECTNAME = OBJECT*2
-INSTANCENAME = OBJECTNAME * 2
-METHODNAME = INSTANCENAME * 2
-PROPERTYNAME = 2
-PROPERTYVALUE=2
-INPARAMS = 2
-DEEPINHERITANCE = 2
-LOCALONLY = 2
-ASSOCCLASS = 4
-RESULTCLASS = 8
-ROLE = 16
-RESULTROLE = 32
-InCLUDEQUALIFIERS = 64
-INCLUDECLASSORIGIN = 128
-PROPDERTYLIST = 256
-*/
 
-int getInstance(CIMClient& client, Options& opts)
+
+/***************************** getInstance  ******************************/
+/*  Execute the CIMCLient getInstance function with the parameters provided.
+    The majority of the parameters are a direct interpretation of the
+    client getInstance input parameters
+    The InstanceName/Class parameter is special in that it has several options:
+       - objectPath form - Use the object path directly
+       - Class only -  cimcli uses interactive mode to list instances of class
+         for selection
+       - Class only in objectName plus entries in extra parameters - cimcli
+         builds instance from extra parameters and then builds path from
+         instance to retrieve.
+         TODO: Test if properties suppled include all key properties.
+*/
+int getInstance(Options& opts)
 {
     if (opts.verboseTest)
     {
         cout << "getInstance "
             << "Namespace = " << opts.nameSpace
-            << ", Instance = " << opts.objectName
+            << ", InstanceName/class = " << opts.getTargetObjectNameStr()
             << ", localOnly = " << _toString(opts.localOnly)
             << ", includeQualifiers = " << _toString(opts.includeQualifiers)
             << ", includeClassOrigin = " << _toString(opts.includeClassOrigin)
-            << ", PropertyList = " << buildPropertyListString(opts.propertyList)
+            << ", PropertyList = " << _toString(opts.propertyList)
             << endl;
+        _showValueParameters(opts);
     }
 
-    CIMObjectPath thisObject(opts.objectName);
-
-    if ((thisObject.getKeyBindings().size() == 0) ? true : false)
-    {
-        // get the instance to delete
-        if(!_selectInstance(client, opts, CIMName(opts.objectName),thisObject))
-            return(0);
-    }
+    // build or get path based in info in opts.  This function returns NULL
+    // cimobject path if there is an error.
+    CIMObjectPath thisPath = _getObjectPath(opts);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
-    CIMInstance cimInstance = client.getInstance(opts.nameSpace,
-                                                 thisObject,
+    CIMInstance cimInstance = opts.client.getInstance(opts.nameSpace,
+                                                 thisPath,
                                                  opts.localOnly,
                                                  opts.includeQualifiers,
                                                  opts.includeClassOrigin,
                                                  opts.propertyList);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    _stopCommandTimer(opts);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    CIMCLIOutput::displayInstance(opts, cimInstance);
 
-    // Check Output Format to print results
-    if (opts.summary)
+    return(CIMCLI_RTN_CODE_OK);
+}
+
+/***************************** createInstance  ******************************/
+/****
+    This action function executes a create instance.
+
+    The CIM Client operation is:
+        CIMObjectPath createInstance(
+            const CIMNamespaceName& nameSpace,
+            const CIMInstance& newInstance
+        );
+
+    The input parameters are the classname and the name/value pairs
+    that are used to build properties of the instance.
+***/
+int createInstance(Options& opts)
+{
+    if (opts.verboseTest)
     {
-        if (opts.time)
-        {
-            cout << opts.saveElapsedTime << endl;
-        }
+        cout << "createInstance "
+            << "Namespace = " << opts.nameSpace
+            << ", ClassName = " << opts.className.getString()
+            << endl;
+        _showValueParameters(opts);
     }
-    else
+
+    ObjectBuilder ob(opts.valueParams,
+            opts.client,
+            opts.nameSpace,
+            opts.className,
+            CIMPropertyList(),
+            opts.verboseTest);
+
+    // create the instance with the defined properties
+    CIMInstance newInstance = ob.buildInstance(true, true,
+                                  CIMPropertyList());
+    if (opts.verboseTest)
     {
-        if (opts.outputType == OUTPUT_TABLE)
-        {
-            Array<CIMInstance> instances;
-            instances.append(cimInstance);
-            tableFormat(cout, instances);
-        }
-        else
-        {
-            outputFormatInstance(opts.outputType, cimInstance);
-        }
+        CIMCLIOutput::displayInstance(opts, newInstance);
     }
 
-    return(0);
+    _startCommandTimer(opts);
+
+    CIMObjectPath rtnPath = opts.client.createInstance(opts.nameSpace,
+                                                 newInstance);
+
+    _stopCommandTimer(opts);
+
+    // Check Output Format to print results
+    String description = "Returned Path ";
+    CIMCLIOutput::displayPath(opts, rtnPath, description);
+
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-/****
-    CIMObjectPath createInstance(
-    const CIMNamespaceName& nameSpace,
-    const CIMInstance& newInstance
-    );
- ***/
-int createInstance(CIMClient& client, Options& opts)
+
+/***************************** testInstance  ******************************/
+/*  Test the instance defined by the input parameters
+    against the same instance in the target system.
+    1. Get class from classname input
+    2. Build the test instance from input parameters
+    3. Build path from input and class
+    4. getInstance from system using property list from test instance unless
+       there is a list provided with the input.
+    5. Compare properties in testInstance against the
+       same named properties in returned instance
+    6 If there is an error, display differences (if verbose set)
+    returns 0 if all properties are the same. Else returns
+    CIMCLI_RTN_CODE_ERR_COMPARE_FAILED as an error
+    NOTE: Only does exact property compare. Today this function DOES NOT
+    have ability to do logical compares such as < >, etc.  Also cannot
+    test parameters against an input object name.  MUST BE class name
+    on input.
+*/
+int testInstance(Options& opts)
 {
     if (opts.verboseTest)
     {
-        cout << "createInstance "
+        cout << "testInstance "
             << "Namespace = " << opts.nameSpace
-            << ", ClassName = " << opts.className.getString()
+            << ", InstanceName/ClassName = " << opts.getTargetObjectNameStr()
+            << ", includeQualifiers = " << _toString(opts.includeQualifiers)
+            << ", includeClassOrigin = " << _toString(opts.includeClassOrigin)
+            << ", PropertyList = " << _toString(opts.propertyList)
             << endl;
+        _showValueParameters(opts);
     }
-    // get the class. Exceptions including class_not_found are automatic
-    CIMClass thisClass =
-        client.getClass(opts.nameSpace, opts.className,
-                        false,true,true,CIMPropertyList());
 
-    // Tokenize the parameter pairs
-    //Array<keyValuePair> inputs;
+    // build the instance from all input properties. It is allowable
+    // to build an instance with no properties.
+    ObjectBuilder ob(
+        opts.valueParams,
+        opts.client,
+        opts.nameSpace,
+        opts.getTargetObjectNameClassName(),
+        CIMPropertyList(),
+        opts.verboseTest);
 
-    Array<CIMName> propertyNameList;
-    Array<String> propertyValueList;
+    CIMInstance testInstance = ob.buildInstance(true, true,
+                                  CIMPropertyList());
 
-    // ATTN: Need to account for returning key without value here.
-    if (opts.extraParams != 0)
+    // If the objectName keybindings are zero create the path from the
+    // built instance unless the interactive bit is set. Then ask the
+    // select from existing instances.
+    // Else use the path built above from the objectName
+
+    if (opts.targetObjectNameClassOnly())
     {
-        /* Here loop starts from 1, since the Class Name is coming as
-         * first parameter and we want only the property name and value here
-        */
-        for (Uint32 i = 1 ; i < opts.extraParams.size() ; i++)
+        if (!_conditionalSelectInstance(opts, opts.targetObjectName) ||
+            !opts.interactive)
         {
-            String key;
-            String value;
-            _tokenPair(opts.extraParams[i], key, value);
-            propertyNameList.append(CIMName(key));
-            propertyValueList.append(value);
-            if (thisClass.findProperty(CIMName(key)) == PEG_NOT_FOUND)
-                cout << "Warning property Name not in class: "
-                     << opts.extraParams[i] << endl;
+            CIMClass thisClass =
+            opts.client.getClass(opts.nameSpace,
+                                 opts.getTargetObjectNameClassName(),
+                                 false,true,true,CIMPropertyList());
+            opts.targetObjectName = testInstance.buildPath(
+                thisClass);
         }
+    }
 
+    // If there is no input property list substitute a list created from
+    // the test instance. This means we acquire only the properties that were
+    // defined on input as part of the test instance.
+    if (opts.propertyList.size() == 0)
+    {
+        opts.propertyList = _buildPropertyList(testInstance);
+    }
+
+    _startCommandTimer(opts);
+
+    CIMInstance rtndInstance = opts.client.getInstance(opts.nameSpace,
+                                        opts.targetObjectName,
+                                        opts.localOnly,
+                                        opts.includeQualifiers,
+                                        opts.includeClassOrigin,
+                                        opts.propertyList);
+
+    // Compare created and returned instances
+    if(!_compareInstances(testInstance, rtndInstance, true, opts))
+    {
+        cout << "Error:Test Instance differs from Server returned Instance."
+            << "Rtn Code " << CIMCLI_RTN_CODE_ERR_COMPARE_FAILED << endl;
+
+        //FUTURE: Create a cleaner display that simply shows the
+        //differences not all of the two instances
         if (opts.verboseTest)
         {
-            // This loop gives all the property names and property values
-            // of the instance
-            for (Uint32 i=0; i < propertyNameList.size(); i++)
-            {
-                cout << "Property: " << propertyNameList[i].getString()
-                     << " value: " << propertyValueList[i]
-                     << endl;
-            }
+            cout << "Test Instance =" << endl;
+            CIMCLIOutput::displayInstance(opts, testInstance);
+            cout << "Returned Instance =" << endl;
+            CIMCLIOutput::displayInstance(opts, rtndInstance);
         }
+        return(CIMCLI_RTN_CODE_ERR_COMPARE_FAILED);
     }
+    else
+        cout << "test instance " << opts.targetObjectName.toString()
+             << " OK" << endl;
 
-    CIMPropertyList myPropertyList(propertyNameList);
-    // create the instance with the defined properties
-    CIMInstance newInstance = thisClass.buildInstance(true, true,
-                                                      myPropertyList);
+    _stopCommandTimer(opts);
 
-    // Set all the property Values to the instance
-    for (Uint32 i=0; i < propertyValueList.size(); i++)
-    {
-        newInstance.getProperty(i).setValue(CIMValue( propertyValueList[i]));
-    }
-    // Now add the parameters from the input. Array.
-    //Note that we do NO checking.  Each input parameter is a simple
-    //name=value.
-    // At this point we also treat them all as strings since we have not
-    // defined a means to handle typing.
+    return(CIMCLI_RTN_CODE_OK);
+}
 
-    if (opts.time)
+
+/***************************** modifyInstance  ******************************/
+/****
+    The function executes the CIM Operation modify instance.
+    CIMObjectPath modifyInstance(
+        const CIMNamespaceName& nameSpace,
+        const CIMInstance& modifiedInstance,
+        Boolean includeQualifiers = true,
+        const CIMPropertyList& propertyList = CIMPropertyList());
+
+    NOTE: We do not support the includequalifiers option so this
+    is always set to false.
+    This command is similar to create instance but more complex in that
+    it is based on an existing instance name and the creation of a
+    possibly incomplete instance.
+
+    Therefore, it takes as input an object name which may be just a
+    class name and the extra parameters to build an instance.
+
+    This operation differes from the create instance in that the CIM Operation
+    input requires a namedInstance rather than simply an instance.  It is the
+    name that is used to identify the instance to be modified.  Therefore
+    the operation must allow for the name component of the instance to
+    be created independently from the input instance
+
+    If the input object name is just a class name, the parameters are used to
+    build an instance which MUST include all of the key properties.  Then the
+    instance is used to build a path which becomes the path in the
+    input instance.
+
+    If the input includes the keys component of a
+    cim object path, the logic uses that as the instance name and the
+    extra parameters to build the instance.
+
+    Note that there is NO mode in this function to interactively input the
+    object path except use of the interactive flag similar to the reference
+    and association functions because the extra parameters are used to
+    actually build an instance rather than building a path as in the
+    getInstance, etc. commands.
+***/
+int modifyInstance(Options& opts)
+{
+    // FUTURE - TODO add flag for interactive operation.
+    if (opts.verboseTest)
     {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
+        cout << "modifyInstance "
+            << "Namespace = " << opts.nameSpace
+            << ", InstanceName/ClassName = " << opts.getTargetObjectNameStr()
+            << ", Property List = " <<
+                _toString(opts.propertyList)
+            << endl;
+        _showValueParameters(opts);
     }
 
-    CIMObjectPath rtndPath = client.createInstance(opts.nameSpace,
-                                                 newInstance);
+    // build the instance from all input properties. It is allowable
+    // to build an instance with no properties.
+    ObjectBuilder ob(
+        opts.valueParams,
+        opts.client,
+        opts.nameSpace,
+        opts.getTargetObjectNameClassName(),
+        CIMPropertyList(),
+        opts.verboseTest);
 
-    // Need to put values into the parameters.
+    CIMInstance modifiedInstance = ob.buildInstance(true, true,
+                                  CIMPropertyList());
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    const CIMClass thisClass = ob.getTargetClass();
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    // If the objectName keybindings are zero create the path from the
+    // built instance unless the interactive bit is set. Then ask the
+    // user to select from existing instances.
+    // Else use the path built above from the objectName
 
-    // Check Output Format to print results
-    if (opts.summary)
+    if (opts.targetObjectNameClassOnly())
     {
-        if (opts.time)
+        if (!_conditionalSelectInstance(opts, opts.targetObjectName))
         {
-            cout << opts.saveElapsedTime << endl;
+            opts.targetObjectName = modifiedInstance.buildPath(thisClass);
         }
     }
-    else
-    {
-        cout << rtndPath.toString() << endl;;
-    }
+    // put the path into the modifiedInstance
+    modifiedInstance.setPath(opts.targetObjectName);
+
+    _startCommandTimer(opts);
+
+    opts.client.modifyInstance(opts.nameSpace,
+                         modifiedInstance,
+                         false,
+                         opts.propertyList);
+
+    // Need to put values into the parameters.
+    _stopCommandTimer(opts);
+
+    CIMCLIOutput::display(opts, "modified");
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int enumerateClassNames(CIMClient& client, Options& opts)
+/***************************** enumerateClassNames  **************************/
+/*
+    Execute the client operation enumerateClassNames with the input parameters
+    Namespace, ClassName, and the DeepInheritance option.
+*/
+int enumerateClassNames(Options& opts)
 {
-
     if (opts.verboseTest)
     {
         cout << "EnumerateClasseNames "
             << "Namespace= " << opts.nameSpace
             << ", Class= " << opts.className.getString()
-            << ", deepInheritance= " << (opts.deepInheritance? "true" : "false")
+            << ", deepInheritance= " << _toString(opts.deepInheritance)
             << endl;
     }
     Array<CIMName> classNames;
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
-    classNames = client.enumerateClassNames(opts.nameSpace,
+    classNames = opts.client.enumerateClassNames(opts.nameSpace,
                                         opts.className,
                                         opts.deepInheritance);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    if (opts.summary)
-    {
-      String s = "class names";
-        _displaySummary(classNames.size(), s,
-             opts.className.getString(),opts);
-    }
-    else
-    {
-        //simply output the list one per line for the moment.
-        for (Uint32 i = 0; i < classNames.size(); i++)
-                cout << classNames[i].getString() << endl;
-    }
+    CIMCLIOutput::displayClassNames(opts, classNames);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int enumerateClasses(CIMClient& client, Options& opts)
+/***************************** enumerateClasses  ******************************/
+/*
+    Execute the client operation enumerateClasses with the input parameters
+    Namespace, ClassName, and the DeepInheritance localOnly,
+    includeQualifiers, and includeClassOrigin option.
+*/
+int enumerateClasses(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -1297,55 +1204,29 @@ int enumerateClasses(CIMClient& client, Options& opts)
             << ", includeClassOrigin= " << _toString(opts.includeClassOrigin)
             << endl;
     }
-    // Added to allow "" string input to represent NULL CIMName.
-    /*
-    CIMName myClassName = CIMName();
-    if (opts.className != "")
-    {
-        myClassName = opts.className;
-    }
-    */
-    Array<CIMClass> classes;
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
-    classes = client.enumerateClasses(opts.nameSpace,
+    Array<CIMClass> classes = opts.client.enumerateClasses(opts.nameSpace,
                                         opts.className,
                                         opts.deepInheritance,
                                         opts.localOnly,
                                         opts.includeQualifiers,
                                         opts.includeClassOrigin);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    if (opts.summary)
-    {
-        String s = "classes";
-        _displaySummary(classes.size(), s, opts.className.getString(),opts);
-    }
-    else
-    {
-        // Output the returned instances
-        for (Uint32 i = 0; i < classes.size(); i++)
-        {
-            CIMClass myClass = classes[i];
-            outputFormatClass(opts.outputType, myClass);
-        }
-    }
+    CIMCLIOutput::displayClasses(opts, classes);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int deleteClass(CIMClient& client, Options& opts)
+/***************************** deleteClass  ******************************/
+/*
+    Execute the client operation deleteClass with the input parameters
+    Namespace and ClassName.
+*/
+int deleteClass(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -1355,25 +1236,22 @@ int deleteClass(CIMClient& client, Options& opts)
             << endl;
     }
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
-
-    client.deleteClass(opts.nameSpace, opts.className);
+    _startCommandTimer(opts);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    opts.client.deleteClass(opts.nameSpace, opts.className);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int getClass(CIMClient& client, Options& opts)
+/***************************** getClass  ******************************/
+/*
+    Execute the client operation getClass with the input parameters
+    Namespace and ClassName and the options deepInheritance, localOnly,
+    includeQualifiers, includeClassOrigin, and a possible propertyList
+*/
+int getClass(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -1384,72 +1262,55 @@ int getClass(CIMClient& client, Options& opts)
             << ", localOnly= " << _toString(opts.localOnly)
             << ", includeQualifiers= " << _toString(opts.includeQualifiers)
             << ", includeClassOrigin= " << _toString(opts.includeClassOrigin)
-            << ", PropertyList= " << buildPropertyListString(opts.propertyList)
+            << ", PropertyList= " << _toString(opts.propertyList)
             << endl;
     }
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
-    CIMClass cimClass = client.getClass(opts.nameSpace,
+    CIMClass cimClass = opts.client.getClass(opts.nameSpace,
                                         opts.className,
                                         opts.localOnly,
                                         opts.includeQualifiers,
                                         opts.includeClassOrigin,
                                         opts.propertyList);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    _stopCommandTimer(opts);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    CIMCLIOutput::displayClass(opts, cimClass);
 
-    if (opts.summary)
-    {
-        if (opts.time)
-        {
-            cout << opts.saveElapsedTime << endl;
-        }
-    }
-    else
-    {
-        outputFormatClass(opts.outputType, cimClass);
-    }
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int getProperty(CIMClient& client, Options& opts)
+/***************************** getProperty  ******************************/
+/*
+    Execute the client operation getProperty with the input parameters
+    Namespace, InstanceName, and propertyName
+*/
+int getProperty(Options& opts)
 {
     if (opts.verboseTest)
     {
         cout << "getProperty "
             << "Namespace= " << opts.nameSpace
-            << ", Instance= " << opts.instanceName.toString()
+            << ", InstanceName= " << opts.getTargetObjectNameStr()
             << ", propertyName= " << opts.propertyName
             << endl;
+        _showValueParameters(opts);
     }
 
+    // build or get path based in info in opts.  This function returns NULL
+    // cimobject path if there is an error.
+    CIMObjectPath thisPath = _getObjectPath(opts);
+
     CIMValue cimValue;
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
-    cimValue = client.getProperty( opts.nameSpace,
-                                   opts.instanceName,
+    cimValue = opts.client.getProperty( opts.nameSpace,
+                                   thisPath,
                                    opts.propertyName);
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
     if (opts.summary)
     {
@@ -1463,46 +1324,51 @@ int getProperty(CIMClient& client, Options& opts)
         cout << opts.propertyName << " = " << cimValue.toString() << endl;
     }
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int setProperty(CIMClient& client, Options& opts)
+/***************************** setProperty  ******************************/
+/*
+    Execute the client operation setProperty with the input parameters
+    Namespace, InstanceName, propertyName and new property value
+*/
+int setProperty(Options& opts)
 {
     if (opts.verboseTest)
     {
         cout << "setProperty "
             << "Namespace= " << opts.nameSpace
-            << ", Instance= " << opts.instanceName.toString()
+            << ", InstanceName= " << opts.getTargetObjectNameStr()
             << ", propertyName= " << opts.propertyName
             << ", newValue= " << opts.newValue.toString()
             << endl;
+        _showValueParameters(opts);
     }
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    // build or get path based in info in opts.  This function returns NULL
+    // cimobject path if there is an error.
+    CIMObjectPath thisPath = _getObjectPath(opts);
+
+    _startCommandTimer(opts);
 
-    client.setProperty( opts.nameSpace,
-                                   opts.instanceName,
+    opts.client.setProperty( opts.nameSpace,
+                                   thisPath,
                                    opts.propertyName,
                                    opts.newValue);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int getQualifier(CIMClient& client, Options& opts)
+/***************************** getQualifier  ******************************/
+/*
+    Execute the client operation getQualifier with the input parameters
+    Namespace and qualifierName.
+*/
+int getQualifier(Options& opts)
 {
-    cout << "entering getQualifier " << endl;
-    //if (opts.verboseTest)
+    if (opts.verboseTest)
     {
         cout << "getQualifier "
             << "Namespace= " << opts.nameSpace
@@ -1512,30 +1378,21 @@ int getQualifier(CIMClient& client, Options& opts)
 
     CIMQualifierDecl cimQualifierDecl;
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
+    _startCommandTimer(opts);
 
-    cimQualifierDecl = client.getQualifier( opts.nameSpace,
+    cimQualifierDecl = opts.client.getQualifier( opts.nameSpace,
                                    opts.qualifierName);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    // display new qualifier
+    // display received qualifier
 
-    outputFormatQualifierDecl(opts.outputType, cimQualifierDecl);
+    CIMCLIOutput::displayQualDecl(opts, cimQualifierDecl);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int setQualifier(CIMClient& client, Options& opts)
+int setQualifier(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -1545,54 +1402,45 @@ int setQualifier(CIMClient& client, Options& opts)
             << endl;
     }
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
-
-    client.setQualifier( opts.nameSpace,
-                         opts.qualifierDeclaration);
+    _startCommandTimer(opts);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    opts.client.setQualifier(opts.nameSpace, opts.qualifierDeclaration);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-int deleteQualifier(CIMClient& client, Options& opts)
+/***************************** deleteQualifier  ******************************/
+/*
+    Execute the client operation deleteQualifier with the input parameters
+    Namespace and qualifierName.
+*/
+int deleteQualifier(Options& opts)
 {
     if (opts.verboseTest)
     {
         cout << "deleteQualifiers "
             << "Namespace= " << opts.nameSpace
-            << " Qualifier= " << opts.qualifierName
+            << " QualifierName= " << opts.qualifierName
             << endl;
     }
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
-
-    client.deleteQualifier( opts.nameSpace,
-                            opts.qualifierName);
+    _startCommandTimer(opts);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    opts.client.deleteQualifier(opts.nameSpace, opts.qualifierName);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
-int enumerateQualifiers(CIMClient& client, Options& opts)
+
+/***************************** enumerateQualifiers  **************************/
+/*
+    Execute the client operation enumerateQualifiers with the input parameters
+    Namespace.
+*/
+int enumerateQualifiers(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -1603,101 +1451,77 @@ int enumerateQualifiers(CIMClient& client, Options& opts)
 
     Array<CIMQualifierDecl> qualifierDecls;
 
-    if (opts.time)
-    {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
-    }
-
-    qualifierDecls = client.enumerateQualifiers( opts.nameSpace);
+    _startCommandTimer(opts);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    qualifierDecls = opts.client.enumerateQualifiers(opts.nameSpace);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    if (opts.summary)
-        cout << qualifierDecls.size() << " returned." << endl;
-    else
-    {
-        // Output the returned instances
-        for (Uint32 i = 0; i < qualifierDecls.size(); i++)
-        {
-            CIMQualifierDecl myQualifierDecl = qualifierDecls[i];
-            outputFormatQualifierDecl(opts.outputType, myQualifierDecl);
-        }
-    }
+    CIMCLIOutput::displayQualDecls(opts, qualifierDecls);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-/*Array<CIMObjectPath> referenceNames(
+
+/***************************** referenceNames  ******************************/
+/*
+    Execute CIM Operation referencenames.  The signature of the
+    client CIM Operation is:
+
+    Array<CIMObjectPath> referenceNames(
         const CIMNamespaceName& nameSpace,
         const CIMObjectPath& objectName,
         const CIMName& resultClass = CIMName(),
         const String& role = String::EMPTY
 */
-int referenceNames(CIMClient& client, Options& opts)
+int referenceNames(Options& opts)
 {
     if (opts.verboseTest)
     {
         cout << "ReferenceNames "
             << "Namespace= " << opts.nameSpace
-            << ", ObjectPath= " << opts.objectName
+            << ", ObjectPath= " << opts.getTargetObjectNameStr()
             << ", resultClass= " << opts.resultClass.getString()
             << ", role= " << opts.role
             << endl;
     }
     // do conditional select of instance if params properly set.
-    CIMObjectPath thisObjectPath(opts.objectName);
-    if (!_conditionalSelectInstance(client, opts, thisObjectPath))
-        return(0);
 
-    if (opts.time)
+    CIMObjectPath thisObjectPath(opts.getTargetObjectName());
+
+    if (!_conditionalSelectInstance(opts, thisObjectPath))
     {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
+        return(CIMCLI_RTN_CODE_OK);
     }
 
+    _startCommandTimer(opts);
+
     Array<CIMObjectPath> referenceNames =
-        client.referenceNames( opts.nameSpace,
+        opts.client.referenceNames( opts.nameSpace,
                                thisObjectPath,
                                opts.resultClass,
                                opts.role);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
-
-    /*
-    const CIMNamespaceName& nameSpace,
-    const CIMObjectPath& objectName,
-    const CIMName& resultClass = CIMName(),
-    const String& role = String::EMPTY */
+    _stopCommandTimer(opts);
 
-    if (opts.summary)
-    {
-      String s = "referenceNames";
-        _displaySummary(referenceNames.size(),s,
-             opts.objectName,opts);
-    }
-    else
-    {
-        //simply output the list one per line for the moment.
-        for (Uint32 i = 0; i < referenceNames.size(); i++)
-                    cout << referenceNames[i].toString() << endl;
-    }
+    String s = "referenceNames";
+    opts.className = thisObjectPath.getClassName();
+    CIMCLIOutput::displayPaths(opts, referenceNames, s);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
 
+/***************************** references  ******************************/
 /****
+  get references for the target input object using the client references
+  operation. This operation uses the interactive option to determine if
+  the input target is to be selected interactively.  This is required
+  because the reference operation can have either a class or path as
+  input (returns either classes or instances depending on this input).
+  The interactive option requests that the instance interactive selector
+  be used to allow the user to select instances for a particular class
+  input.
      Array<CIMObject> references(
         const CIMNamespaceName& nameSpace,
         const CIMObjectPath& objectName,
@@ -1707,36 +1531,34 @@ int referenceNames(CIMClient& client, Options& opts)
         Boolean includeClassOrigin = false,
         const CIMPropertyList& propertyList = CIMPropertyList()
     );
-    */
-int references(CIMClient& client, Options& opts)
+*/
+int references(Options& opts)
 {
     if (opts.verboseTest)
     {
         cout << "References "
             << "Namespace= " << opts.nameSpace
-            << ", Object= " << opts.objectName
+            << ", ObjectName = " << opts.getTargetObjectNameStr()
             << ", resultClass= " << opts.resultClass.getString()
             << ", role= " << opts.role
             << ", includeQualifiers= " << _toString(opts.includeQualifiers)
             << ", includeClassOrigin= " << _toString(opts.includeClassOrigin)
-            << ", CIMPropertyList= "
-            << buildPropertyListString(opts.propertyList)
+            << ", CIMPropertyList= " << _toString(opts.propertyList)
             << endl;
     }
 
     // do conditional select of instance if params properly set.
-    CIMObjectPath thisObjectPath(opts.objectName);
-    if (!_conditionalSelectInstance(client, opts, thisObjectPath))
-        return(0);
+    CIMObjectPath thisObjectPath(opts.getTargetObjectName());
 
-    if (opts.time)
+    if (!_conditionalSelectInstance(opts, thisObjectPath))
     {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
+        return(CIMCLI_RTN_CODE_OK);
     }
 
+    _startCommandTimer(opts);
+
     Array<CIMObject> objects =
-        client.references(  opts.nameSpace,
+        opts.client.references(  opts.nameSpace,
                             thisObjectPath,
                             opts.resultClass,
                             opts.role,
@@ -1744,47 +1566,38 @@ int references(CIMClient& client, Options& opts)
                             opts.includeClassOrigin,
                             opts.propertyList);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
-
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    if (opts.summary)
-    {
-      String s = "references";
-        _displaySummary(objects.size(), s, opts.objectName,opts);
-    }
-    else
-    {
-        // Output the returned instances
-        for (Uint32 i = 0; i < objects.size(); i++)
-            outputFormatObject(opts.outputType, objects[i]);
-    }
+    String s = "references";
+    CIMCLIOutput::displayObjects(opts,objects,s);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
+
+/***************************** associatorNames  ******************************/
 /*
+    Uaw the client associatorNames operation to return associated classes
+    or instances for the target inputs. Note that this operation uses the
+    interactive option.
+
     Array<CIMObjectPath> associatorNames(
-    const CIMNamespaceName& nameSpace,
-    const CIMObjectPath& objectName,
-    const CIMName& assocClass = CIMName(),
-    const CIMName& resultClass = CIMName(),
-    const String& role = String::EMPTY,
-    const String& resultRole = String::EMPTY
+        const CIMNamespaceName& nameSpace,
+        const CIMObjectPath& objectName,
+        const CIMName& assocClass = CIMName(),
+        const CIMName& resultClass = CIMName(),
+        const String& role = String::EMPTY,
+        const String& resultRole = String::EMPTY
     );
 
 */
-int associatorNames(CIMClient& client, Options& opts)
+int associatorNames(Options& opts)
 {
-
     if (opts.verboseTest)
     {
         cout << "associatorNames "
             << "Namespace= " << opts.nameSpace
-            << ", Object= " << opts.objectName
+            << ", ObjectName= " << opts.getTargetObjectNameStr()
             << ", assocClass= " << opts.assocClass.getString()
             << ", resultClass= " << opts.resultClass.getString()
             << ", role= " << opts.role
@@ -1793,55 +1606,40 @@ int associatorNames(CIMClient& client, Options& opts)
     }
 
     // do conditional select of instance if params properly set.
-    CIMObjectPath thisObjectPath(opts.objectName);
-    if(!_conditionalSelectInstance(client, opts, thisObjectPath))
-        return(0);
+    CIMObjectPath thisObjectPath(opts.getTargetObjectName());
 
-    if (opts.time)
+    if(!_conditionalSelectInstance(opts, thisObjectPath))
     {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
+        return(CIMCLI_RTN_CODE_OK);
     }
 
-    Array<CIMObjectPath> associatorNames =
-    client.associatorNames( opts.nameSpace,
-                            thisObjectPath,
-                            opts.assocClass,
-                            opts.resultClass,
-                            opts.role,
-                            opts.resultRole);
-
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    _startCommandTimer(opts);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    Array<CIMObjectPath> associatorNames =
+        opts.client.associatorNames( opts.nameSpace,
+                                    thisObjectPath,
+                                    opts.assocClass,
+                                    opts.resultClass,
+                                    opts.role,
+                                    opts.resultRole);
 
-    /*
-    const CIMNamespaceName& nameSpace,
-    const CIMObjectPath& objectName,
-    const CIMName& resultClass = CIMName(),
-    const String& role = String::EMPTY */
+    _stopCommandTimer(opts);
 
-    if (opts.summary)
-    {
-      String s = "associator names";
-        _displaySummary(associatorNames.size(), s,
-             opts.objectName,opts);
-    }
-    else
-    {
-        // Output the list one per line for the moment.
-        for (Uint32 i = 0; i < associatorNames.size(); i++)
-                    cout << associatorNames[i].toString() << endl;
-    }
+    String s = "associator names";
+    opts.className = thisObjectPath.getClassName();
+    CIMCLIOutput::displayPaths(opts, associatorNames, s);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
 
-/****
+/***************************** associators  ******************************/
+/*
+    Execute the CIM Client Operation associators. Note that this function
+    uses the interactive operation to allow the user to select the
+    object to be the target objecName. The signature of
+    the function is:
+
     Array<CIMObject> associators(
         const CIMNamespaceName& nameSpace,
         const CIMObjectPath& objectName,
@@ -1854,67 +1652,54 @@ int associatorNames(CIMClient& client, Options& opts)
         const CIMPropertyList& propertyList = CIMPropertyList()
     );
  */
-int associators(CIMClient& client, Options& opts)
+int associators(Options& opts)
 {
     if (opts.verboseTest)
     {
         cout << "Associators "
             << "Namespace= " << opts.nameSpace
-            << ", Object= " << opts.objectName
+            << ", Object= " << opts.getTargetObjectNameStr()
             << ", assocClass= " << opts.assocClass.getString()
             << ", resultClass= " << opts.resultClass.getString()
             << ", role= " << opts.role
             << ", resultRole= " << opts.resultRole
             << ", includeQualifiers= " << _toString(opts.includeQualifiers)
             << ", includeClassOrigin= " << _toString(opts.includeClassOrigin)
-            << ", propertyList= " << buildPropertyListString(opts.propertyList)
+            << ", propertyList= " << _toString(opts.propertyList)
             << endl;
     }
 
     // do conditional select of instance if params properly set.
-    CIMObjectPath thisObjectPath(opts.objectName);
-    if(!_conditionalSelectInstance(client, opts, thisObjectPath))
-        return(0);
+    CIMObjectPath thisObjectPath(opts.getTargetObjectName());
 
-    if (opts.time)
+    if(!_conditionalSelectInstance(opts, thisObjectPath))
     {
-        opts.elapsedTime.reset();
-        opts.elapsedTime.start();
+        return(CIMCLI_RTN_CODE_OK);
     }
 
-    Array<CIMObject> objects =
-    client.associators( opts.nameSpace,
-                        thisObjectPath,
-                        opts.assocClass,
-                        opts.resultClass,
-                        opts.role,
-                        opts.resultRole,
-                        opts.includeQualifiers,
-                        opts.includeClassOrigin,
-                        opts.propertyList);
+    _startCommandTimer(opts);
 
-    if (opts.time)
-    {
-        opts.elapsedTime.stop();
+    Array<CIMObject> objects =
+        opts.client.associators( opts.nameSpace,
+                            thisObjectPath,
+                            opts.assocClass,
+                            opts.resultClass,
+                            opts.role,
+                            opts.resultRole,
+                            opts.includeQualifiers,
+                            opts.includeClassOrigin,
+                            opts.propertyList);
 
-        opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-    }
+    _stopCommandTimer(opts);
 
-    if (opts.summary)
-    {
-      String s = "associators";
-        _displaySummary(objects.size(), s, opts.objectName,opts);
-    }
-    else
-    {
-        // Output the returned instances
-        for (Uint32 i = 0; i < objects.size(); i++)
-            outputFormatObject(opts.outputType, objects[i]);
-    }
+    String s = "associators";
+    CIMCLIOutput::displayObjects(opts,objects,s);
 
-    return(0);
+    return(CIMCLI_RTN_CODE_OK);
 }
 
+
+/***************************** invokeMethod  ******************************/
 /*
     CIMValue invokeMethod(
         const CIMNamespaceName& nameSpace,
@@ -1924,65 +1709,80 @@ int associators(CIMClient& client, Options& opts)
         Array<CIMParamValue>& outParameters
 */
 
- int invokeMethod(CIMClient& client, Options& opts)
+
+/***************************** invokeMethod  ******************************/
+ int invokeMethod(Options& opts)
  {
      {
-         // Display the parameter set if verbose requested.
          if (opts.verboseTest)
          {
              cout << "invokeMethod"
                  << " Namespace= " << opts.nameSpace
-                 << ", ObjectName= " << opts.objectName
+                 << ", ObjectName= " << opts.getTargetObjectNameStr()
                  << ", methodName= " << opts.methodName.getString()
                  << ", inParams Count= " << opts.inParams.size()
                  << endl;
-             for (Uint32 i=0; i< opts.inParams.size(); i++)
-                 outputFormatParamValue(opts.outputType, opts.inParams[i]);
+
+             CIMCLIOutput::displayParamValues(opts, opts.inParams);
+
+             _showValueParameters(opts);
         }
 
+        ObjectBuilder ob(
+            opts.valueParams,
+            opts.client,
+            opts.nameSpace,
+            opts.getTargetObjectNameClassName(),
+            CIMPropertyList(),
+            opts.verboseTest);
+
+        ob.setMethod(opts.methodName);
+
+        Array<CIMParamValue> params = ob.buildMethodParameters();
+
          // Create array for output parameters
         CIMValue retValue;
         Array<CIMParamValue> outParams;
 
-        if (opts.time)
-        {
-            opts.elapsedTime.reset();
-            opts.elapsedTime.start();
-        }
+        _startCommandTimer(opts);
 
         // Call invoke method with the parameters
-        retValue = client.invokeMethod(opts.nameSpace, opts.objectName,
-            opts.methodName, opts.inParams, outParams);
-
-        if (opts.time)
-        {
-            opts.elapsedTime.stop();
+        retValue = opts.client.invokeMethod(opts.nameSpace,
+                                            opts.getTargetObjectName(),
+                                            opts.methodName,
+                                            params,
+                                            outParams);
 
-            opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-        }
+        _stopCommandTimer(opts);
 
         // Display the return value CIMValue
         cout << "Return Value= ";
         if (opts.outputType == OUTPUT_XML)
+        {
             XmlWriter::printValueElement(retValue, cout);
+        }
         else
+        {
             cout << retValue.toString() << endl;
+        }
 
         // Display any outparms
-        for (Uint32 i = 0; i < outParams.size() ; i++)
-            outputFormatParamValue(opts.outputType, outParams[i]);
 
+        CIMCLIOutput::displayParamValues(opts, outParams);
      }
 
-     return(0);
+    return(CIMCLI_RTN_CODE_OK);
  }
 
- /* Enumerate the Namespaces.  This function is based on using the
+/************************ enumerateNamespace names **********************/
+/* Enumerate the Namespace names.  This function is based on using either
+    the CIM_Namespace class or if this does not exist the
     __Namespace class and either returns all namespaces or simply the ones
     starting at the namespace input as the namespace variable.
     It assumes that the input classname is __Namespace.
- */
-int enumerateNamespaces_Namespace(CIMClient& client, Options& opts)
+*/
+
+int enumerateNamespaceNames(Options& opts)
 {
     if (opts.verboseTest)
     {
@@ -1992,1205 +1792,102 @@ int enumerateNamespaces_Namespace(CIMClient& client, Options& opts)
             << endl;
     }
 
-    Boolean usingPegasus = true;
-    Array<CIMInstance> instances;
+    _startCommandTimer(opts);
 
-    try
-    {
-        instances = client.enumerateInstances(
-            (CIMNamespaceName)(opts.nameSpace),opts.className);
-    }
-    catch(CIMException &)
+    Array<CIMNamespaceName> ns = _getNameSpaceNames(opts);
+
+    _stopCommandTimer(opts);
+
+    if (opts.summary)
     {
-        /*if an exception was caught here then we assume we are not useing
-        the open pegasus CIMOM. There for we should only check the
-        __namespaces class. (Which may only retrun a subset of all namspaces
-        */
-        usingPegasus = false;
-        opts.className = CIMName("__namespace");
-        opts.nameSpace = PEGASUS_NAMESPACENAME_INTEROP.getString();
+        cout << ns.size() << " namespaces " << " returned."
+            << endl;
     }
-
-    if (usingPegasus)
+    else
     {
-        for (Uint32 i = 0 ; i < instances.size(); i++)
+        for( Uint32 cnt = 0 ; cnt < ns.size(); cnt++ )
         {
-            Uint32 pos;
-            // if we find the property and it is a string, use it.
-            if ((pos = instances[i].findProperty("name")) != PEG_NOT_FOUND)
-            {
-                CIMValue value;
-                String namespaceComponent;
-                value = instances[i].getProperty(pos).getValue();
-                if (value.getType() == CIMTYPE_STRING)
-                {
-                    value.get(namespaceComponent);
-                    cout << namespaceComponent << endl;
-                }
-            }
+            cout << ns[cnt].getString() << endl;;
         }
-
     }
-    else
-    {
-        Array<CIMNamespaceName> namespaceNames;
-
-        // Build the namespaces incrementally starting at the root
-        // ATTN: 20030319 KS today we start with the "root" directory but
-        // this is wrong. We should be
-        // starting with null (no directory) but today we get an xml error
-        // return in Pegasus
-        // returned for this call. Note that the specification requires
-        // that the root namespace be used
-        // when __namespace is defined but does not require that it be
-        // the root for allnamespaces. That
-        // is a hole is the spec, not in our code.
-        namespaceNames.append(opts.nameSpace);
-        Uint32 start = 0;
-        Uint32 end = namespaceNames.size();
 
+    return(CIMCLI_RTN_CODE_OK);
+}
 
-        if (opts.time)
-        {
-            opts.elapsedTime.reset();
-            opts.elapsedTime.start();
-        }
 
-        do
-        {
-            // for all new elements in the output array
-            for (Uint32 range = start; range < end; range ++)
-            {
-                // Get the next increment in naming for all a name element
-                // in the array
-                instances = client.enumerateInstances(
-                    namespaceNames[range],opts.className);
-                for (Uint32 i = 0 ; i < instances.size(); i++)
-                {
-                    Uint32 pos;
-                    // if we find the property and it is a string, use it.
-                    if ((pos = instances[i].findProperty("name"))
-                            != PEG_NOT_FOUND)
-                    {
-                        CIMValue value;
-                        String namespaceComponent;
-                        value = instances[i].getProperty(pos).getValue();
-                        if (value.getType() == CIMTYPE_STRING)
-                        {
-                            value.get(namespaceComponent);
-
-                                String ns = namespaceNames[range].getString();
-                                ns.append("/");
-                                ns.append(namespaceComponent);
-                                namespaceNames.append(ns);
-                        }
-                    }
-                }
-                start = end;
-                end = namespaceNames.size();
-            }
-        }
-        while (start != end);
+/************************ setObjectManagerStatistics **********************/
+/*
+    Set the statistics on/off flag in the objectmanager Class.  This should
+    be considered temporary code pending a more general solution for
+    setting many of these attributes. Do not count on this being in
+    future versions of cimcli.
+    DEPRECATED - This should be replaced with a special function but since
+    the whole use of the statistics setting functions is in question in
+    the DMTF we left it for now.
+*/
+int setObjectManagerStatistics(Options& opts, Boolean newState,
+                                   Boolean& stateAfterMod)
+{
+    CIMName gathStatName ("GatherStatisticalData");
 
+    Array<CIMInstance> instancesObjectManager;
+    CIMInstance instObjectManager;
+    Uint32 prop_num;
+    Array<CIMName> plA;
+    plA.append(gathStatName);
+    CIMPropertyList statPropertyList(plA);
 
-        // Validate that all of the returned entities are really namespaces.
-        // It is legal for us to have an name component that is really not a
-        // namespace (ex. root/fred/john is a namespace  but root/fred is not.
-        // There is no clearly defined test for this so we will simply try to
-        // get something, in this
-        // case a wellknown assoication
-          Array<CIMNamespaceName> returnNamespaces;
+    // Create property list that represents correct request
+    // get instance.  Get only the gatherstatitistics property
+    instancesObjectManager  =
+        opts.client.enumerateInstances(PEGASUS_NAMESPACENAME_INTEROP,
+            "CIM_ObjectManager",
+            true, false, false, false, statPropertyList);
+    PEGASUS_TEST_ASSERT(instancesObjectManager.size() == 1);
+    instObjectManager = instancesObjectManager[0];
 
-        for (Uint32 i = 0 ; i < namespaceNames.size() ; i++)
-        {
-            try
-            {
-                CIMQualifierDecl cimQualifierDecl;
-                cimQualifierDecl = client.getQualifier(namespaceNames[i],
-                                               "Association");
-
-                returnNamespaces.append(namespaceNames[i]);
-            }
-            catch(CIMException& e)
-            {
-                if (e.getCode() != CIM_ERR_INVALID_NAMESPACE)
-                    returnNamespaces.append(namespaceNames[i]);
-            }
-        }
-
-        if (opts.time)
-        {
-            opts.elapsedTime.stop();
-
-            opts.saveElapsedTime = opts.elapsedTime.getElapsed();
-        }
-
-        if (opts.summary)
-        {
-            cout << returnNamespaces.size() << " namespaces " << " returned."
-                << endl;
-        }
-        else
-        {
-            for( Uint32 cnt = 0 ; cnt < returnNamespaces.size(); cnt++ )
-            {
-                cout << returnNamespaces[cnt].getString() << endl;;
-            }
-        }
-    }
-
-    return(0);
-}
-
-/*
-    This function loads the message from resourcebundle using the key passed
-*/
-String loadMessage(const char* key, const char* defMessage)
-{
-    MessageLoaderParms parms(key, defMessage);
-    parms.msg_src_path = MSG_PATH;
-    return MessageLoader::getMessage(parms);
-}
-
-/////////////////////////////////////////////////////////////////////
-// The following section manages the input options.  It includes   //
-// both the options processor (based on common/options             //
-// and the options table.                                          //
-/////////////////////////////////////////////////////////////////////
-
-void GetOptions(
-    OptionManager& om,
-    int& argc,
-    char** argv,
-    const String& testHome)
-{
-    static const char* outputFormats[] = { "xml", "mof", "txt", "table"};
-    static const Uint32 NUM_OUTPUTFORMATS = sizeof(outputFormats) /
-                                            sizeof(outputFormats[0]);
-    static OptionRowWithMsg optionsTable[] =
-        //optionname defaultvalue rqd  type domain domainsize clname msgkey
-        // hlpmsg
-    {
-        {"count", "29346", false, Option::WHOLE_NUMBER, 0, 0, "count",
-        "Clients.cimcli.CIMCLIClient.COUNT_OPTION_HELP",
-        "Expected count of objects returned if summary set.\n"
-            "    Test count and display difference.\n"
-            "    Return nonzero if test fails"},
-
-        {"debug", "false", false, Option::BOOLEAN, 0, 0, "d",
-        "Clients.cimcli.CIMCLIClient.DEBUG_OPTION_HELP",
-        "More detailed debug messages"},
-
-        {"delay", "0", false, Option::WHOLE_NUMBER, 0, 0, "delay",
-        "Clients.cimcli.CIMCLIClient.DELAY_OPTION_HELP",
-        "Delay between connection and request"},
-
-        {"Password", "", false, Option::STRING, 0, 0, "p",
-        "Clients.cimcli.CIMCLIClient.PASSWORD_OPTION_HELP",
-        "Defines password for authentication" },
-
-        {"location", "", false, Option::STRING, 0, 0, "l",
-        "Clients.cimcli.CIMCLIClient.LOCATION_OPTION_HELP",
-        "Specifies system and port (HostName:port).\n"
-            "    Port is optional" },
-
-#ifdef PEGASUS_HAS_SSL
-        {"ssl", "false", false, Option::BOOLEAN, 0, 0, "s",
-        "Clients.cimcli.CIMCLIClient.SSL_OPTION_HELP",
-        "Specifies to connect over HTTPS" },
-
-        {"clientCert", "", false, Option::STRING, 0, 0, "-cert",
-        "Clients.cimcli.CIMCLIClient.CLIENTCERT_OPTION_HELP",
-        "Specifies a client certificate to present to the server.\n"
-            "    This is optional and only has an effect on connections\n"
-            "    made over HTTPS using -s" },
-
-        {"clientKey", "", false, Option::STRING, 0, 0, "-key",
-        "Clients.cimcli.CIMCLIClient.CLIENTKEY_OPTION_HELP",
-        "Specifies a client private key.\n"
-            "    This is optional and only has an effect on connections\n"
-            "    made over HTTPS using -s" },
-#endif
-        {"User", "", false, Option::STRING, 0, 0, "u",
-        "Clients.cimcli.CIMCLIClient.USER_OPTION_HELP",
-        "Defines User Name for authentication" },
-
-        {"namespace", "root/cimv2", false, Option::STRING, 0, 0, "n",
-        "Clients.cimcli.CIMCLIClient.NAMESPACE_OPTION_HELP",
-        "Specifies namespace to use for operation" },
-
-        {"deepInheritance", "false", false, Option::BOOLEAN, 0, 0, "di",
-        "Clients.cimcli.CIMCLIClient.DEEPINHERITANCE_OPTION_HELP",
-        "If set deepInheritance parameter\n"
-            "    set true"},
-
-        {"localOnly", "true", false, Option::BOOLEAN, 0, 0, "lo",
-        "Clients.cimcli.CIMCLIClient.LOCALONLY_OPTION_HELP",
-        "DEPRECATED. This was used to set LocalOnly.\n"
-            "    However, default should be true and we cannot use True\n"
-            "    as default. See -nlo"},
-
-        {"notLocalOnly", "false", false, Option::BOOLEAN, 0, 0, "nlo",
-        "Clients.cimcli.CIMCLIClient.NOTLOCALONLY_OPTION_HELP",
-        "When set, sets LocalOnly = false on\n"
-            "    operations"},
-
-        {"includeQualifiers", "true", false, Option::BOOLEAN, 0, 0, "iq",
-        "Clients.cimcli.CIMCLIClient.INCLUDEQUALIFIERS_OPTION_HELP",
-        "Deprecated. Sets includeQualifiers = True.\n"
-            "    However, default=true"},
-
-        {"notIncludeQualifiers", "false", false, Option::BOOLEAN, 0, 0, "niq",
-        "Clients.cimcli.CIMCLIClient.NOTINCLUDEQUALIFIERS_OPTION_HELP",
-        "Sets includeQualifiers = false\n"
-            "    on operations"},
-
-        // Uses a magic string as shown below to indicate never used.
-        {"propertyList", "###!###", false, Option::STRING, 0, 0, "pl",
-        "Clients.cimcli.CIMCLIClient.PROPERTYLIST_OPTION_HELP",
-        "Defines a propertyNameList. Format is p1,p2,p3\n"
-            "    (without spaces). Use \"\" for empty"},
-
-        {"assocClass", "", false, Option::STRING, 0, 0, "ac",
-        "Clients.cimcli.CIMCLIClient.ASSOCCLASS_OPTION_HELP",
-        "Defines a assocClass string for Associator calls"},
-
-        {"assocRole", "", false, Option::STRING, 0, 0, "ar",
-        "Clients.cimcli.CIMCLIClient.ASSOCROLE_OPTION_HELP",
-        "Defines a role string for Associatiors AssocRole\n"
-            "    parameter"},
-
-        {"role", "", false, Option::STRING, 0, 0, "r",
-        "Clients.cimcli.CIMCLIClient.ROLE_OPTION_HELP",
-        "Defines a role string for reference role parameter"},
-
-        {"resultClass", "", false, Option::STRING, 0, 0, "rc",
-        "Clients.cimcli.CIMCLIClient.RESULTCLASS_OPTION_HELP",
-        "Defines a resultClass string for References and\n"
-            "    Associatiors"},
-
-        {"resultRole", "", false, Option::STRING, 0, 0, "rr",
-        "Clients.cimcli.CIMCLIClient.RESULTROLE_OPTION_HELP",
-        "Defines a role string for associators operation resultRole\n"
-            "    parameter"},
-
-        {"inputParameters", "", false, Option::STRING, 0, 0, "ip",
-        "Clients.cimcli.CIMCLIClient.INPUTPARAMETERS_OPTION_HELP",
-        "Defines an invokeMethod input parameter list.\n"
-            "    Format is p1=v1 p2=v2 .. pn=vn\n"
-            "    (parameters are seperated by spaces)"},
-
-        {"filter", "", false, Option::STRING, 0, 0, "f",
-        "Clients.cimcli.CIMCLIClient.FILTER_OPTION_HELP",
-        "Defines a filter to use for query. Single String input"},
-
-        // This was never used.  Delete. KS
-        //{"substitute", "", false, Option::STRING, 0, 0, "-s",
-        //  "Defines a conditional substition of input parameters. ) "},
-
-        // KS change the output formats to use the enum options function
-        // Deprecate this function.
-        {"outputformats", "mof", false, Option::STRING, 0,NUM_OUTPUTFORMATS,
-        "o",
-        "Clients.cimcli.CIMCLIClient.OUTPUTFORMATS_OPTION_HELP",
-        "Output in xml, mof, txt, table"},
-
-        {"xmlOutput", "false", false, Option::BOOLEAN, 0,0, "x",
-        "Clients.cimcli.CIMCLIClient.XMLOUTPUT_OPTION_HELP",
-        "Output objects in xml instead of mof format"},
-
-        {"version", "false", false, Option::BOOLEAN, 0, 0, "-version",
-        "Clients.cimcli.CIMCLIClient.VERSION_OPTION_HELP",
-        "Displays software Version"},
-
-        {"verbose", "false", false, Option::BOOLEAN, 0, 0, "v",
-        "Clients.cimcli.CIMCLIClient.VERBOSE_OPTION_HELP",
-        "Verbose Display. Includes Detailed Param Input\n"
-            "    display"},
-
-        {"summary", "false", false, Option::BOOLEAN, 0, 0, "-sum",
-        "Clients.cimcli.CIMCLIClient.SUMMARY_OPTION_HELP",
-        "Displays only summary count for enumerations,\n"
-            "    associators, etc."},
-
-        {"help", "false", false, Option::BOOLEAN, 0, 0, "h",
-        "Clients.cimcli.CIMCLIClient.HELP_OPTION_HELP",
-        "Prints help usage message"},
-
-        {"full help", "false", false, Option::BOOLEAN, 0, 0, "-help",
-        "Clients.cimcli.CIMCLIClient.FULLHELP_OPTION_HELP",
-        "Prints full help message with commands, options,\n"
-            "    examples"},
-
-        {"help options", "false", false, Option::BOOLEAN, 0, 0, "ho",
-        "Clients.cimcli.CIMCLIClient.HELPOPTIONS_OPTION_HELP",
-        "Prints list of options"},
-
-        {"help commands", "false", false, Option::BOOLEAN, 0, 0, "hc",
-        "Clients.cimcli.CIMCLIClient.HELPCOMMANDS_OPTION_HELP",
-        "Prints CIM Operation command list"},
-
-        {"connecttimeout", "0", false, Option::WHOLE_NUMBER, 0, 0, "-timeout",
-        "Clients.cimcli.CIMCLIClient.CONNECTIONTIMEOUT_OPTION_HELP",
-        "Set the connection timeout in seconds."},
-
-        {"interactive", "false", false, Option::BOOLEAN, 0, 0, "i",
-        "Clients.cimcli.CIMCLIClient.INTERACTIVE_OPTION_HELP",
-        "Interactively ask user to select instances.\n"
-            "    Used with associator and reference operations"},
-
-        {"trace", "0", false, Option::WHOLE_NUMBER, 0, 0, "trace",
-        "Clients.cimcli.CIMCLIClient.TRACE_OPTION_HELP",
-        "Set Pegasus Common Components Trace. Sets the Trace level.\n"
-            "    0 is off"},
-
-        {"repeat", "0", false, Option::WHOLE_NUMBER, 0, 0, "-r",
-        "Clients.cimcli.CIMCLIClient.REPEAT_OPTION_HELP",
-        "Number of times to repeat the function.\n"
-            "    Zero means one time"},
-
-        {"time", "false", false, Option::BOOLEAN, 0, 0, "-t",
-        "Clients.cimcli.CIMCLIClient.TIME_OPTION_HELP",
-        "Measure time for the operation and present results"}
-
-    };
-    const Uint32 NUM_OPTIONS = sizeof(optionsTable) / sizeof(optionsTable[0]);
-
-    om.registerOptions(optionsTable, NUM_OPTIONS);
-
-    String configFile = "cimcli.conf";
-
-    //cout << "Config file from " << configFile << endl;
-
-    if (FileSystem::exists(configFile))
-    {
-        om.mergeFile(configFile);
-    }
-    om.mergeCommandLine(argc, argv);
-
-    om.checkRequiredOptions();
-
-}
-
-/* Remap a long string into a string that can be positioned on a line
-   starting at pos and with length but broken into multiple lines.
-   The input string is recreated and filled from the left so that the
-   returned string can be output as a multiline string starting at pos.
-*/
-String formatLongString (const char * input, Uint32 pos, Uint32 length)
-{
-    String output;
-    String work = input;
-    Array<String> list;
-
-    // create the fill string starting with the newline character
-    String fill;
-    fill.append("\n");
-    for (Uint32 i = 0; i < pos; i++)
-        fill.append (" ");
-
-    list = _tokenize(work, ' ');
-
-    for (Uint32 i = 0 ; i < list.size() ; i++)
-    {
-        // move a single word and either a space or create new line
-        if (((output.size() % length) + list[i].size()) >= (length))
-            output.append(fill);
-        else
-            output.append(" ");
-
-        output.append(list[i]);
-    }
-    return(output);
-}
-
-void showUsage()
-{
-    String usage;
-    usage =
-        "Usage: cimcli <command> <CIMObject> <Options> *<extra parameters>\n"
-        "    -hc    for <command> set and <CimObject> for each command\n"
-        "    -ho    for <Options> set\n"
-        "    -h xx  for <command> and <Example> for <xx> operation \n"
-        "    -h     for this summary\n"
-        "    --help for full help\n";
-    CString str = usage.getCString();
-    cout << loadMessage("Clients.cimcli.CIMCLIClient.MENU.STANDARD",
-        (const char*)str);
-}
-/* showCommands - Display the list of operation commands.
-*/
-const char * helpSummary =
-    " -h for all help, -hc for commands, -ho for options";
-void showCommands(const char* pgmName)
-{
-    for( Uint32 i = 0; i < NUM_COMMANDS; i++ )
-    {
-        char * cmdStr= new char[500];
-        String txtFormat = formatLongString(
-            CommandTable[i].UsageText,
-            28,
-            75 - 28 );
-        CString ctxtFormat=txtFormat.getCString();
-        sprintf(
-            cmdStr,
-            "\n%-5s %-21s",
-            CommandTable[i].ShortCut,
-            CommandTable[i].CommandName);
-        cmdStr = strcat(cmdStr, (const char*)ctxtFormat);
-        cout << loadMessage(
-            CommandTable[i].msgKey,
-            const_cast<const char*>(cmdStr))
-            << endl;
-
-        delete[] cmdStr;
-    }
-    cout << loadMessage(
-        "Clients.cimcli.CIMCLIClient.HELP_SUMMARY",
-        helpSummary)
-        << endl;
-
-}
-
-void showVersion(const char* pgmName, OptionManager& om)
-{
-    String str = "";
-    str.append("Version ");
-    str.append(PEGASUS_PRODUCT_VERSION);
-
-    CString cstr = str.getCString();
-    MessageLoaderParms parms(
-        "Clients.cimcli.CIMCLIClient.VERSION",
-        (const char*)cstr,
-        PEGASUS_PRODUCT_VERSION);
-    parms.msg_src_path = MSG_PATH;
-    cout << MessageLoader::getMessage(parms) << endl;
-}
-
-void showOptions(const char* pgmName, OptionManager& om)
-{
-
-    String optionsTrailer = loadMessage(
-        "Clients.cimcli.CIMCLIClient.OPTIONS_TRAILER",
-        "Options vary by command consistent with CIM Operations");
-    cout << loadMessage(
-        "Clients.cimcli.CIMCLIClient.OPTIONS_HEADER",
-        "The options for this command are:\n");
-    String usageStr;
-    usageStr = loadMessage(
-        "Clients.cimcli.CIMCLIClient.OPTIONS_USAGE",
-        usage);
-    om.printOptionsHelpTxt(usageStr, optionsTrailer);
-}
-
-/* PrintHelpMsg - This is temporary until we expand the options manager to allow
-   options help to be defined with the OptionRow entries and presented from
-   those entries.
-*/
-void printHelpMsg(
-    const char* pgmName,
-    const char* usage_,
-    OptionManager& om)
-{
-    showUsage();
-
-    showVersion(pgmName, om);
-
-    showOptions(pgmName, om);
-
-    showCommands(pgmName);
-
-    cout << endl;
-
-    showExamples();
-}
-
-void printUsageMsg(const char* pgmName,OptionManager& om)
-{
-    printHelpMsg(pgmName, usage, om);
-}
-
-int CheckCommonOptionValues(OptionManager& om, char** argv, Options& opts)
-{
-    // Catch the verbose and debug options first so they can control other
-    // processing
-    Boolean verboseTest = (om.valueEquals("verbose", "true")) ? true :false;
-    Boolean debug = (om.valueEquals("debug", "true")) ? true :false;
-
-    if (verboseTest)
-        opts.verboseTest = verboseTest;
-
-    if (debug)
-    {
-        opts.debug= debug;
-    }
-
-    // Base code for parameter substition.  Dispabled until complete
-    /*{
-        String target;
-        if (om.lookupValue("substitution", target))
-        {
-            // Get directory for file
-            Array<String> fileList;
-            String fileName = "/conditions.txt";
-            String temp = ".";
-            temp.append(fileName);
-            fileList.append(temp);
-            const char* tmpDir = getenv ("PEGASUS_HOME");
-            if (tmpDir != NULL)
-            {
-                temp = tmpDir;
-                temp.append(fileName);
-                fileList.append(temp);
-            }
-    }*/
-
-
-    if (om.isTrue("full help"))
-    {
-        printHelpMsg(argv[0], usage, om);
-        exit(0);
-    }
-
-    if (om.isTrue("help"))
-    {
-        if (argv[1])
-        {
-            for (Uint32 i=0; i<NUM_COMMANDS;i++)
-            {
-                if (strcmp(argv[1], CommandTable[i].ShortCut) == 0)
-                {
-                    char * cmdStr= new char[500];
-                    String txtFormat = formatLongString(
-                        CommandTable[i].UsageText,28 ,75 - 28 );
-                    CString ctxtFormat=txtFormat.getCString();
-                    sprintf(
-                        cmdStr,
-                        "\n%-5s %-21s",
-                        CommandTable[i].ShortCut,
-                        CommandTable[i].CommandName);
-                    cmdStr = strcat(cmdStr, (const char*)ctxtFormat);
-                    cout << loadMessage(
-                        CommandTable[i].msgKey,
-                        const_cast<const char*>(cmdStr))
-                        << endl;
-
-                    delete[] cmdStr;
-
-                    cout << loadMessage(
-                        "Clients.cimcli.CIMCLIClient.EXAMPLE_STRING",
-                        "Example : ")
-                        << endl;
-                    cout << loadMessage(
-                        examples[i].msgKey,
-                        examples[i].Example)
-                        << endl;
-                    cout << loadMessage(
-                        "Clients.cimcli.CIMCLIClient.OPTIONS_STRING",
-                        optionText)
-                        << endl;
-                    cout << loadMessage(
-                        examples[i].optionsKey,
-                        examples[i].Options)
-                        << endl;
-
-                    char * commonOptStr = new char[100];
-                    sprintf(commonOptStr, "%s", "Common Options are : \n");
-                    commonOptStr = strcat(commonOptStr, commonOptions);
-                    cout << loadMessage(
-                        "Clients.cimcli.CIMCLIClient."
-                            "COMMON_OPTIONS_STRING",
-                        commonOptStr)
-                        << endl;
-                    delete[] commonOptStr;
-                    exit(0);
-                }
-            }
-            cout << "Command not found. Type cimcli -hc to list valid commands."
-                 << endl;
-            exit(1);
-        }
-
-        showUsage();
-        exit(0);
-    }
-
-    if (om.isTrue("version"))
-    {
-        showVersion(argv[0], om);
-        exit(0);
-    }
-
-    if (om.isTrue("help options"))
-    {
-        showOptions(argv[0], om);
-        exit(0);
-    }
-
-    if (om.isTrue("help commands"))
-    {
-        showCommands(argv[0]);
-        exit(0);
-    }
-
-    // Establish the namespace from the input parameters
-    //String nameSpace;
-    if(om.lookupValue("namespace", opts.nameSpace))
-    {
-        if (verboseTest && debug)
-            cout << "Namespace = " << opts.nameSpace << endl;
-    }
-
-    String temprole;
-    if(om.lookupValue("role", temprole))
-    {
-        // we need to deliver String::EMPTY when no param.
-        if (temprole != "")
-            opts.role = temprole;
-        if (verboseTest && debug && temprole != "")
-           cout << "role = " << opts.role << endl;
-    }
-
-    String tempResultRole;
-    if(om.lookupValue("resultRole", tempResultRole))
-    {
-        // we need to deliver String::EMPTY when no param.
-        if (tempResultRole != "")
-            opts.resultRole = tempResultRole;
-        if (verboseTest && debug && tempResultRole != "")
-           cout << "resultRole= " << opts.resultRole << endl;
-    }
-
-    // Get value for location, i.e. host, etc.
-    om.lookupValue("location", opts.location);
-
-#ifdef PEGASUS_HAS_SSL
-    // Determine whether to connect over HTTPS
-    opts.ssl = om.isTrue("ssl");
-
-    // Get value for client certificate
-    om.lookupValue("clientCert", opts.clientCert);
-
-    // Get value for client key
-    om.lookupValue("clientKey", opts.clientKey);
-
-    if (verboseTest && debug && opts.ssl)
-    {
-        cout << "ssl = true" << endl;
-        if (opts.clientCert != "" && opts.clientKey != "")
-        {
-            cout << "clientCert = " << opts.clientCert << endl;
-            cout << "clientKey = " << opts.clientKey << endl;
-        }
-    }
-#endif
-
-    // Assign the result class
-    if(om.lookupValue("resultClass", opts.resultClassName))
-    {
-
-       if (opts.resultClassName != "")
-       {
-           //Covers fact that assigning to CIMName can cause exception.
-           try
-           {
-               opts.resultClass = opts.resultClassName;
-           }
-           catch(Exception& e)
-           {
-               cout << "Error in Result Class. Exception " << e.getMessage()
-                   << endl;
-               exit(1);
-           }
-       }
-       if (verboseTest && debug && opts.resultClassName != "")
-           cout << "resultClassName = " << opts.resultClassName << endl;
-    }
-
-    if(om.lookupValue("assocClass", opts.assocClassName))
-    {
-       if (verboseTest && debug && opts.assocClassName != "")
-           cout << "assocClassName = " << opts.assocClassName << endl;
-       if (opts.assocClassName != "")
-       {
-           try
-           {
-               opts.assocClass = opts.assocClassName;
-           }
-           catch(Exception& e)
-           {
-               cout << "Error in assoc Class. Exception " << e.getMessage()
-                   << endl;
-               exit(1);
-           }
-       }
-    }
-
-    // Evaluate connectiontimeout option.
-    opts.connectionTimeout = 0;
-    if (!om.lookupIntegerValue("connecttimeout", opts.connectionTimeout))
-    {
-        opts.connectionTimeout = 0;
-    }
-
-    if (verboseTest && debug && opts.connectionTimeout != 0)
-    {
-        cout << "Connection Timeout= " << opts.connectionTimeout << " Seconds"
-            << endl;
-    }
-
-    if (!om.lookupIntegerValue("delay", opts.delay))
-    {
-        opts.delay = 0;
-    }
-
-    if (verboseTest && debug && opts.delay != 0)
-    {
-        cout << "delay= " << opts.delay << " Seconds" << endl;
-    }
-
-    // Set the interactive request flag based on input
-    opts.interactive = om.isTrue("interactive");
-    if (om.isTrue("interactive")  && verboseTest && debug)
-        cout << "interactive request" << endl;
-
-    // set the deepInheritance flag based on input
-    opts.deepInheritance = om.isTrue("deepInheritance");
-    if (om.isTrue("deepInheritance")  && verboseTest && debug)
-        cout << "deepInteritance set" << endl;
-
-    // process localOnly and notlocalOnly parameters
-    opts.localOnly = om.isTrue("localOnly");
-    if (om.isTrue("notLocalOnly"))
-    {
-        opts.localOnly = false;
-    }
-
-    // Used the not version because the DMTF and pegasus default is true
-    if (verboseTest && debug && om.isTrue("notLocalOnly"))
-    {
-        cout << "localOnly= " << _toString(opts.localOnly) << endl;;
-    }
-
-    // Process includeQualifiers and notincludeQualifiers
-    opts.includeQualifiers = om.isTrue("includeQualifiers");
-
-    if (om.isTrue("notIncludeQualifiers"))
-    {
-        opts.includeQualifiers = false;
-    }
-
-    if (verboseTest && debug && om.isTrue("notIncludeQualifiers"))
-    {
-        cout << "includeQualifiers = " << _toString(opts.includeQualifiers)
-            << endl;
-    }
-
-    opts.includeClassOrigin = om.isTrue("includeClassOrigin");
-    if (om.isTrue("includeClassOrigin")  && verboseTest && debug)
-        cout << "includeClassOrigin set" << endl;
+    // set correct path into instance
+    instObjectManager.setPath(instancesObjectManager[0].getPath());
 
-    opts.time = om.isTrue("time");
-    if (om.isTrue("time")  && verboseTest && debug)
-        cout << "time set" << endl;
+    prop_num = instObjectManager.findProperty(gathStatName);
+    PEGASUS_TEST_ASSERT(prop_num != PEG_NOT_FOUND);
 
-    if(!om.lookupIntegerValue("trace", opts.trace))
-    {
-            opts.trace = 0;
-    }
-    else
-    {
-        Uint32 traceLevel = 0;
-        switch (opts.trace)
-        {
-            case 0:             // This covers the default.
-                break;
-            case 1 :
-                traceLevel = Tracer::LEVEL1;
-                break;
-            case 2 :
-                traceLevel = Tracer::LEVEL2;
-                break;
-            case 3 :
-                traceLevel = Tracer::LEVEL3;
-                break;
-            case 4 :
-                traceLevel = Tracer::LEVEL4;
-                break;
-            default:
-                cout << "Illegal value for Trace. Max = 4" << endl;
-        }
-        opts.trace = traceLevel;
-    }
-    if (verboseTest && debug && opts.trace != 0)
-    {
-        cout << "Pegasus Trace set to  Level  " << opts.trace << endl;
-    }
+    instObjectManager.getProperty(prop_num).setValue(CIMValue(newState));
 
-    opts.summary = om.isTrue("summary");
+    opts.client.modifyInstance(PEGASUS_NAMESPACENAME_INTEROP, instObjectManager,
+         false, statPropertyList);
 
-    // get User name and password if set.
-     if(om.lookupValue("User", opts.user))
-     {
-         if (opts.user.size() == 0)
-             opts.user = String::EMPTY;
-         if (debug && verboseTest)
-             cout << "User= " << opts.user << endl;
-     }
-
-     if(om.lookupValue("Password", opts.password))
-     {
-         if (opts.password.size() == 0)
-             opts.password = String::EMPTY;
-         if (debug && verboseTest)
-             cout << "Password= " << opts.password << endl;
-     }
-
-    // Create a variable with the format output and a correponding type.
-    // Suggest we might change this whole thing to the option type that
-    // mike used in the example of colors so that  you could do -red -blue
-    // or in our case -mof -xml, etc.
-
-     opts.isXmlOutput = om.isTrue("xmlOutput");
-     if (opts.isXmlOutput  && debug && verboseTest)
-         cout << "xmlOutput set" << endl;
-
-    if(om.lookupValue("outputformats", opts.outputFormat))
-     {
-        if (debug && verboseTest)
-            cout << "Output Format = " << opts.outputFormat << endl;
-     }
-
-    // Get the output format parameter and save it
-    Uint32 cnt = 0;
-    opts.outputFormat.toLower();
-
-    for( ; cnt < NUM_OUTPUTS; cnt++ )
-    {
-        if (opts.outputFormat == OutputTable[cnt].OutputName)
-                break;
-    }
-    // Note that this makes no notice of a not found
-    if (cnt != NUM_OUTPUTS)
-    {
-        opts.outputFormatType = cnt;
-        opts.outputType = OutputTable[cnt].OutputType;
-    }
-
-    if(!om.lookupIntegerValue("repeat", opts.repeat))
-    {
-            opts.repeat = 0;
-
-    }
-    if (debug && verboseTest)
-    {
-        cout << "Repeat Count= " << opts.repeat << endl;
-    }
-
-    if(!om.lookupIntegerValue("count", opts.count))
-    {
-            opts.count = 29346;
-    }
-    if (debug && verboseTest)
-    {
-        if (opts.count != 29346)
-        {
-        cout << "Comparison Count= " << opts.count << endl;
-        }
-    }
-
-    /*  Property List parameter.
-        Separate an input stream into an array of Strings
-        Two special situations, empty list and NULL list
-        Use NULL when there is no list.
-        Use empty if
-    */
-    {
-        String properties;
-        if(om.lookupValue("propertyList", properties))
-        {
-            if (properties == "###!###")
-            {
-                opts.propertyList.clear();
-            }
-            else
-            {
-                Array<CIMName> pList;
-                Array<String> pListString =  _tokenize(properties, ',');
-
-                for (Uint32 i = 0 ; i < pListString.size(); i++)
-                {
-                    pList.append(CIMName(pListString[i]));
-                }
-                opts.propertyList.set(pList);
-            }
-            if (debug && verboseTest && properties != "###!###")
-            {
-                cout << "PropertyList= ";
-                printPropertyList(opts.propertyList);
-                cout << endl;
-            }
-        }
-    }
-
-    /* Method input parameters processing.  Process as one
-       string containing multiple parameters in the form
-       name=value
-       ATTN: KS 20030426 Note that we have not accounted for
-       the typing on parameters.
-    */
-    String inputParameters;
-    if(om.lookupValue("inputParameters", inputParameters))
-    {
-        // first tokenization is the ' '
-        Array<String> pList =  _tokenize(inputParameters, ' ');
-        for (Uint32 i = 0 ; i< pList.size() ; i++)
-        {
-            CIMParamValue pv;
-            pv = _createMethodParamValue(pList[i], opts);
-            opts.inParams.append(pv);
-        }
-    }
-    return 0;
-}
+    // get updated instance to confirm change made
+    CIMInstance updatedInstance =
+        opts.client.getInstance(PEGASUS_NAMESPACENAME_INTEROP,
+        instObjectManager.getPath(),
+        false, false, false, statPropertyList);
 
+    prop_num = updatedInstance.findProperty(gathStatName);
+    PEGASUS_TEST_ASSERT(prop_num != PEG_NOT_FOUND);
+    CIMProperty p = updatedInstance.getProperty(prop_num);
+    CIMValue v = p.getValue();
+    v.get(stateAfterMod);
 
-//------------------------------------------------------------------------------
-//
-// mofFormat
-//
-//------------------------------------------------------------------------------
+    cout << "Updated Status= " << ((stateAfterMod)? "true" : "false") << endl;
 
-static void _indent(PEGASUS_STD(ostream)& os, Uint32 level, Uint32 indentSize)
-{
-    Uint32 n = level * indentSize;
-    if (n > 50)
+    if (stateAfterMod != newState)
     {
-    cout << "Jumped Ship " << level << " size " << indentSize << endl;
-    exit(1);
+        cerr << "Error: State change error. Expected: "
+            << ((newState)? "true" : "false")
+            << " Rcvd: " << ((stateAfterMod)? "true" : "false") << endl;
     }
 
-    for (Uint32 i = 0; i < n; i++)
-        os << ' ';
-}
-
-/* Format the output stream for indented MOF format
-*/
-void mofFormat(
-    PEGASUS_STD(ostream)& os,
-    const char* text,
-    Uint32 indentSize)
-{
-    char* var = new char[strlen(text)+1];
-    char* tmp = strcpy(var, text);
-    Uint32 count = 0;
-    Uint32 indent = 0;
-    Boolean quoteState = false;
-    Boolean qualifierState = false;
-    char c;
-    char prevchar = 0;
-    while ((c = *tmp++))
-    {
-        count++;
-        // This is too simplistic and must move to a token based mini parser
-        // but will do for now. One problem is tokens longer than 12
-        // characters that overrun the max line length.
-        switch (c)
-        {
-            case '\n':
-                os << c;
-                prevchar = c;
-                count = 0 + (indent * indentSize);
-                _indent(os, indent, indentSize);
-                break;
-
-            case '\"':   // quote
-                os << c;
-                prevchar = c;
-                quoteState = !quoteState;
-                break;
-
-            case ' ':
-                os << c;
-                prevchar = c;
-                if (count > 66)
-                {
-                    if (quoteState)
-                    {
-                        os << "\"\n";
-                        _indent(os, indent + 1, indentSize);
-                        os <<"\"";
-                    }
-                    else
-                    {
-                        os <<"\n";
-                        _indent(os, indent + 1,  indentSize);
-                    }
-                    count = 0 + ((indent + 1) * indentSize);
-                }
-                break;
-            case '[':
-                if (prevchar == '\n')
-                {
-                    indent++;
-                    _indent(os, indent,  indentSize);
-                    qualifierState = true;
-                }
-                os << c;
-                prevchar = c;
-                break;
-
-            case ']':
-                if (qualifierState)
-                {
-                    if (indent > 0)
-                        indent--;
-                    qualifierState = false;
-                }
-                os << c;
-                prevchar = c;
-                break;
-
-            default:
-                os << c;
-                prevchar = c;
-        }
-
-    }
-    delete [] var;
+    return(CIMCLI_RTN_CODE_OK);
 }
 
-/*****************************************************************************
-*
-*       Formatting and print functions for table output of instances
-*
-******************************************************************************/
-//
-//  Definition for String entries for each column in the output
+// FUTURE
+//int showProfiles(Options& opts, const String& name)
+//{
+//    cout << "Not Supported" << endl;
 //
-typedef Array <String> ColumnEntry;
-
-/* Output a single table String entry filling to ColSize or adding an
-   eol if last specified
-*/
-void _printTableEntry(
-    const String& entryStr,
-    const Uint32 colSize,
-    Boolean last,
-    PEGASUS_STD(ostream)& outPrintWriter)
-{
-    Uint32 fillerLen = colSize - entryStr.size() + 2;
-
-    outPrintWriter << entryStr;
-    if (last)
-    {
-        outPrintWriter << endl;
-    }
-    else
-    {
-        for (Uint32 j = 0; j < fillerLen; j++)
-        {
-             outPrintWriter << ' ';
-        }
-    }
-}
-
-/* Print the formatted table form of the instances as defined by
-   the parameters for the column width for each column and the array
-   of column entries (outputTable).
-*/
-void _printTables(
-    const Array<Uint32>& maxColumnWidth,
-    const Array<ColumnEntry>& outputTable,
-    PEGASUS_STD(ostream)& outPrintWriter)
-{
-    for (Uint32 i = 0; i < outputTable[0].size(); i++)
-    {
-        for (Uint32 column = 0; column < maxColumnWidth.size(); column++)
-        {
-            Boolean last = (column == maxColumnWidth.size() - 1);
-            _printTableEntry(outputTable[column][i],
-                maxColumnWidth[column],
-                last,
-                outPrintWriter);
-        }
-    }
-}
-
-/* Format the output stream to be a table with column for each property
-   and row for the properties in each instance.
-*/
-void tableFormat(
-    PEGASUS_STD(ostream)& outPrintWriter,
-    const Array<CIMInstance>& instances)
-{
-    Array<ColumnEntry> outputTable;
-    Array<Uint32> maxColumnWidth;
-    Array<String> propertyNameArray;
-
-    // find set of all properties returned for all instances
-    for (Uint32 i = 0; i < instances.size(); i++)
-    {
-        for (Uint32 j = 0; j < instances[i].getPropertyCount(); j++)
-        {    
-            String propertyNameStr =
-                instances[i].getProperty(j).getName().getString();
-
-            // Add to outputTable if not already there
-            if (!(Contains(propertyNameArray, propertyNameStr)))
-            {
-                //outputTable.append(propertyNameStr);
-                maxColumnWidth.append(propertyNameStr.size());
-                propertyNameArray.append(propertyNameStr);
-            }
-        }
-    }
-
-    // Build the complete table output in ascii.  We must build the 
-    // complete table to determine column widths.
-    // NOTE: This code creates tables with column width to match the 
-    // maximum width of the string representation of the property name or
-    // string representation of the value.  This can create REALLY
-    // REALLY wide columns for Strings and for Array properties.
-    // 
-    // TODO: Add code to create multiline colums for things like array
-    // entries or possibly long strings.
-
-    for (Uint32 i = 0; i < propertyNameArray.size(); i++)
-    {
-        // array for a single column of property values
-        Array<String> propertyValueArray;
-
-        String propertyNameStr = propertyNameArray[i];
-
-        // First entry in propertyValueArray array is the propery name
-        propertyValueArray.append(propertyNameStr);
-
-        // for all instances get value for the property in
-        // propertyNameArray
-        for (Uint32 j = 0; j < instances.size(); j++)
-        {
-            Uint32 pos = instances[j].findProperty(propertyNameStr);
-
-            // Get the value or empty string if there is no property
-            // with this name
-            String propertyValueStr = (pos != PEG_NOT_FOUND) ?
-                    instances[j].getProperty(pos).getValue().toString()
-                :
-                    String::EMPTY;
-
-            propertyValueArray.append(propertyValueStr);
-
-            if (propertyValueStr.size() > maxColumnWidth[i])
-            {
-                maxColumnWidth[i] = propertyValueStr.size();
-            }
-        }
-        // Append the value array for this property to the outputTable
-        outputTable.append(propertyValueArray);
-    }
-    _printTables(maxColumnWidth, outputTable, outPrintWriter);
-}
+//    return(CIMCLI_RTN_CODE_OK);
+//}
 
 PEGASUS_NAMESPACE_END
 // END_OF_FILE
index 5ff195c9b9d2a3ad8a7347139d552bdf923146ad..f48846d13f33314526b40ddd850a6c34d0190c19 100644 (file)
 #include <Pegasus/Common/Config.h>
 #include <Clients/cimcli/Linkage.h>
 #include <Pegasus/Common/PegasusAssert.h>
-#include <Pegasus/Common/MessageLoader.h>
-
-#include <Pegasus/General/OptionManager.h>
 #include <Pegasus/General/Stopwatch.h>
-
-#include <Pegasus/Client/CIMClient.h>
-
-
-
+#include "CIMCLIOptionStruct.h"
 
 
 PEGASUS_NAMESPACE_BEGIN
@@ -54,347 +47,92 @@ PEGASUS_NAMESPACE_BEGIN
 #define LOCAL_MAX(a, b) ((a > b) ? a : b)
 #define LOCAL_MIN(a, b) ((a < b) ? a : b)
 
-
 static const char MSG_PATH [] = "pegasus/pegasusCLI";
 
-typedef int     CommandID;
-typedef int     OutputType;
-const OutputType    OUTPUT_XML                  = 1;
-const OutputType    OUTPUT_MOF                  = 2;
-const OutputType    OUTPUT_TEXT                 = 3;
-const OutputType    OUTPUT_FILE                 = 4;
-const OutputType    OUTPUT_TABLE                = 5;
-
-const CommandID ID_EnumerateInstanceNames       = 1;
-const CommandID ID_EnumerateInstances           = 2;
-const CommandID ID_GetClass                     = 3;
-const CommandID ID_GetInstance                  = 4;
-const CommandID ID_CreateInstance               = 5;
-const CommandID ID_DeleteInstance               = 6;
-const CommandID ID_CreateClass                  = 7;
-const CommandID ID_DeleteClass                  = 8;
-const CommandID ID_EnumerateClasses             = 9;
-const CommandID ID_EnumerateClassNames          = 10;
-const CommandID ID_GetProperty                  = 11;
-const CommandID ID_SetProperty                  = 12;
-const CommandID ID_GetQualifier                 = 13;
-const CommandID ID_SetQualifier                 = 14;
-const CommandID ID_EnumerateQualifiers          = 15;
-const CommandID ID_DeleteQualifier              = 16;
-const CommandID ID_Associators                  = 17;
-const CommandID ID_AssociatorNames              = 18;
-const CommandID ID_References                   = 19;
-const CommandID ID_ReferenceNames               = 20;
-const CommandID ID_InvokeMethod                 = 21;
-const CommandID ID_ExecQuery                    = 22;
-
-const CommandID ID_ModifyClass                  = 23;
-const CommandID ID_ModifyInstance               = 24;
-const CommandID ID_EnumerateAllInstanceNames    = 25;
-const CommandID ID_EnumerateNamespaces          = 26;
-const CommandID ID_ShowOptions                  = 27;
-const CommandID ID_StatisticsOn                 = 28;
-const CommandID ID_StatisticsOff                = 29;
-const CommandID ID_Unknown                      = 30;
-
-struct  OUTPUT_STRUCT
-{
-    int OutputType;
-    const char* OutputName;
-};
-
-static OUTPUT_STRUCT OutputTable[] =
-{
-    // Output Type      OutputName
-    {   OUTPUT_XML,     "xml"   },
-    {   OUTPUT_MOF,     "mof"   },
-    {   OUTPUT_TEXT,    "txt"   },
-    {   OUTPUT_TABLE,   "table" }
-};
-static const Uint32 NUM_OUTPUTS = sizeof(OutputTable) / sizeof(OutputTable[0]);
-
-struct  CMD_STRUCT
-{
-    CommandID ID_Command;
-    const char* CommandName;
-    int minNumArgs;
-    const char* ShortCut;
-    const char* msgKey; //Message key for globalization
-    const char* UsageText;
-};
-
-// ******** CIM Client Commands
-static CMD_STRUCT CommandTable[] =
-{
-    {ID_EnumerateInstanceNames,  "enumerateInstanceNames", 2 ,"ni",
-    "Clients.cimcli.CIMCLIClient.NI_COMMAND_HELP",
-    "Enumerate instancenames of <instancename>"},
-
-    {ID_EnumerateAllInstanceNames,"enumallInstanceNames", 2 , "niall",
-    "Clients.cimcli.CIMCLIClient.NIALL_COMMAND_HELP" ,
-    "Enumerate all instancenames in namespace."},
-
-    {ID_EnumerateInstances,      "enumerateInstances",2 ,   "ei",
-    "Clients.cimcli.CIMCLIClient.EI_COMMAND_HELP" ,
-    "Enumerate instances of <classname>"},
-
-    {ID_EnumerateClassNames,     "enumerateClassNames",2 ,  "nc",
-    "Clients.cimcli.CIMCLIClient.NC_COMMAND_HELP",
-    "Enumerate Class Names of [ <classname> ]"},
-
-    {ID_EnumerateClasses,        "enumerateClasses",2 ,     "ec",
-    "Clients.cimcli.CIMCLIClient.EC_COMMAND_HELP",
-    "Enumerate classes of [ <classname> ]"},
-
-    {ID_GetClass,                "getClass",2 ,             "gc",
-    "Clients.cimcli.CIMCLIClient.GC_COMMAND_HELP",
-    "Get class of <classname>"},
-
-    {ID_GetInstance,             "getInstance",   2 ,       "gi",
-    "Clients.cimcli.CIMCLIClient.GI_COMMAND_HELP",
-    "Get instance of <objectname> | <classname>"},
-
-    {ID_CreateInstance,          "createInstance",2 ,       "ci",
-    "Clients.cimcli.CIMCLIClient.CI_COMMAND_HELP",
-    "Create one Instance of <Class> *<name=param>"},
-
-    {ID_DeleteInstance,          "deleteInstance",2 ,       "di",
-    "Clients.cimcli.CIMCLIClient.DI_COMMAND_HELP",
-    "Delete Instance of <objectname> or\n"
-    "                            interactive of <className>"},
-
-    {ID_CreateClass   ,          "createClass",   2 ,       "cc",
-    "Clients.cimcli.CIMCLIClient.CC_COMMAND_HELP",
-    "Not supported"},
-
-    {ID_ModifyInstance,          "modifyInstance",2 ,       "mi",
-    "Clients.cimcli.CIMCLIClient.MI_COMMAND_HELP",
-    "Not supported"},
-
-    {ID_DeleteClass,             "deleteClass",   2 ,       "dc",
-    "Clients.cimcli.CIMCLIClient.DC_COMMAND_HELP",
-    "Delete Class of <classname>"},
-
-    {ID_GetProperty,             "getProperty",   2 ,       "gp",
-    "Clients.cimcli.CIMCLIClient.GP_COMMAND_HELP",
-    "TBD"},
-
-    {ID_SetProperty,             "setProperty",   2 ,       "sp",
-    "Clients.cimcli.CIMCLIClient.SP_COMMAND_HELP",
-    "TBD"},
-
-    {ID_GetQualifier,            "getQualifier",  2 ,       "gq",
-    "Clients.cimcli.CIMCLIClient.GQ_COMMAND_HELP",
-    "Get Qualifier of <qualifiername>"},
-
-    {ID_SetQualifier,            "setQualifier",  2 ,       "sq",
-    "Clients.cimcli.CIMCLIClient.SQ_COMMAND_HELP",
-    "Not suported"},
-
-    {ID_EnumerateQualifiers,     "enumerateQualifiers",2 ,  "eq",
-    "Clients.cimcli.CIMCLIClient.EQ_COMMAND_HELP",
-    "Enumerate all Qualifiers"},
-
-    {ID_DeleteQualifier,         "deleteQualifier",  2 ,    "dq",
-    "Clients.cimcli.CIMCLIClient.DQ_COMMAND_HELP",
-    "Delete qualifer of <qualifiername>"},
-
-    {ID_Associators,             "associators",   2 ,       "a" ,
-    "Clients.cimcli.CIMCLIClient.A_COMMAND_HELP",
-    "Enumerate Associators of <classname>|<instancename>."},
-
-    {ID_AssociatorNames,         "associatorNames", 2 ,     "an",
-    "Clients.cimcli.CIMCLIClient.AN_COMMAND_HELP",
-    "Enumerate Associator Names of <classname>|<instancename>"},
-
-    {ID_References,              "references",      2,      "r",
-    "Clients.cimcli.CIMCLIClient.R_COMMAND_HELP",
-    "Enumerate References of <classname>|<instancename>"},
-
-    {ID_ReferenceNames,          "referenceNames",2 ,       "rn",
-    "Clients.cimcli.CIMCLIClient.RN_COMMAND_HELP",
-    "Enumerate Reference Names <classname>|<instancename>"},
-
-    {ID_InvokeMethod,            "invokeMethod",  2 ,       "im",
-    "Clients.cimcli.CIMCLIClient.IM_COMMAND_HELP",
-    "Invoke Method for <object> <method> {<inputParams>}"},
-
-    {ID_ExecQuery,               "execQuery",     2 ,       "xq",
-    "Clients.cimcli.CIMCLIClient.XQ_COMMAND_HELP",
-    " Execute Query <query-expresssion> [<query-language>]"},
-
-    {ID_EnumerateNamespaces,     "enumerateNamespaces",2 ,  "ns",
-    "Clients.cimcli.CIMCLIClient.NS_COMMAND_HELP",
-    "Enumerate all namespaces on the server."},
-
-    {ID_StatisticsOn,            "Turn On Statistics",2 ,   "son",
-    "Clients.cimcli.CIMCLIClient.SON_COMMAND_HELP",
-    "Turn on CIM Server Statistics Gathering"},
-
-    {ID_StatisticsOff,           "Turn Off Statistics",2 ,  "soff",
-    "Clients.cimcli.CIMCLIClient.SOFF_COMMAND_HELP",
-    "Turn off CIM Server Statistics Gathering"},
-
-    {ID_ShowOptions,             "show command options",2 ,  "?",
-    "Clients.cimcli.CIMCLIClient.?_COMMAND_HELP",
-    "Show List of Commands"}
-};
-
-static const Uint32 NUM_COMMANDS =
-    sizeof(CommandTable) / sizeof(CommandTable[0]);
-
-// ************* Options Functions
-// The input options used by the individual commands. Note that
-// Use of these varies by command.
-
-struct  OPTION_STRUCT
-{
-    String location;
-#ifdef PEGASUS_HAS_SSL
-    Boolean ssl;
-    String clientCert;
-    String clientKey;
-#endif
-    String nameSpace;
-    CIMName className;
-    String objectName;
-    String inputObjectName;       // Name to report as input object on error
-    String cimCmd;                // Command name
-    String outputFormat;
-    Boolean isXmlOutput;
-    int outputFormatType;
-    OutputType outputType;
-    Boolean deepInheritance;
-    Boolean localOnly;
-    Boolean includeQualifiers;
-    Boolean includeClassOrigin;
-    CIMObjectPath instanceName;
-    CIMValue newValue;
-    //String cimObjectPath;
-    String qualifierName;
-    CIMQualifierDecl qualifierDeclaration;
-    String user;
-    String password;
-    String propertyName;
-    CIMPropertyList propertyList;
-    String propertyListText;
-
-    // The references and associatior parameters.
-    // We setup both internal and external forms
-    String assocClassName;
-    CIMName assocClass;
-    String resultClassName;
-    CIMName resultClass;
-    String role;
-    String resultRole;
-
-    CIMName methodName;
-    Array<CIMParamValue> inParams;
-
-    Boolean verboseTest;
-    Boolean summary;
-    Uint32 delay;
-    Uint32 trace;
-    Boolean debug;
-
-    Uint32 count;
-    Uint32 repeat;
-    Boolean time;
-    Stopwatch elapsedTime;
-    double saveElapsedTime;
-    Uint32 termCondition;
-    String queryLanguage;
-    String query;
-    Uint32 connectionTimeout;    // Connection timeout in seconds
-    Array<String> extraParams;   // additional param list. depends on command.
-    Boolean interactive;
-};
 
-typedef struct OPTION_STRUCT Options;
-
-Array<String> PEGASUS_CLI_LINKAGE _tokenize(const String& input,
-                                            const Char16 separator);
-
-CIMParamValue PEGASUS_CLI_LINKAGE _createMethodParamValue(const String& input,
-                                                          const Options& opts);
-
-void PEGASUS_CLI_LINKAGE showCommands(const char* pgmName);
-
-void PEGASUS_CLI_LINKAGE showUsage();
-
-void PEGASUS_CLI_LINKAGE printHelpMsg(const char* pgmName, const char* usage,
-     const char* extraHelp,
-     OptionManager& om);
-
-void PEGASUS_CLI_LINKAGE printHelp(char* name, OptionManager& om);
-
-void PEGASUS_CLI_LINKAGE printUsageMsg(const char* pgmName,OptionManager& om);
+////////////////////////////////////////////////////////////////////////////
+//
+// Return codes used for cimcli exit values
 
-void  PEGASUS_CLI_LINKAGE GetOptions(OptionManager& om, int& argc, char** argv,
-      const String& testHome);
+#define CIMCLI_RTN_CODE_OK 0   // successful completion of the command
 
-int PEGASUS_CLI_LINKAGE CheckCommonOptionValues(OptionManager& om, char** argv,
-     Options& opts);
+// All of the codes up to 50 are reserved.  This is the set of error codes
+// returned by CIM Exception and cimcli passes any such received exception
+// codes back through cimcli completion. Therefore we start the internal
+// error codes outside of this range
+//
+#define CIMCLI_RTN_CODE_PEGASUS_EXCEPTION 50
+#define GENERAL_CLI_ERROR_CODE 51
+#define CIMCLI_RTN_CODE_UNKNOWN_EXCEPTION 52
+#define CIMCLI_INPUT_ERR 53
+#define CIMCLI_CONNECTION_FAILED 54
+
+#define CIMCLI_RTN_CODE_ERR_COMPARE_FAILED 60
+
+/////////////////////////////////////////////////////////////////////////////
+// ************* cimcli operations ******************************************
+// These are the operation functions executed by cimcli.  Each takes input
+// from the opts structure and generates output from a single or set of cim
+// operations executed against the server defined in the opts structure.
+// These functions correspond directly to the cimcli operation definitions
+// (also called commands) that are the first parameter of each cimcli
+// command line definition.
+//
+int PEGASUS_CLI_LINKAGE enumerateClassNames(Options& opts);
 
-void PEGASUS_CLI_LINKAGE mofFormat(PEGASUS_STD(ostream)& os, const char* text,
-     Uint32 indentSize);
+int PEGASUS_CLI_LINKAGE enumerateClasses(Options& opts);
 
-void PEGASUS_CLI_LINKAGE tableFormat(PEGASUS_STD(ostream)& outPrintWriter,
-    const Array<CIMInstance>& instances);
+int PEGASUS_CLI_LINKAGE deleteClass(Options& opts);
 
-String PEGASUS_CLI_LINKAGE loadMessage(
-     const char* key,
-     const char* defMessage);
+int PEGASUS_CLI_LINKAGE getClass(Options& opts);
 
-// ************* CIMClient Functions
-int PEGASUS_CLI_LINKAGE enumerateClassNames(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE deleteInstance(Options& opts);
 
-int PEGASUS_CLI_LINKAGE enumerateClasses(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE enumerateInstanceNames(Options& opts);
 
-int PEGASUS_CLI_LINKAGE deleteClass(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE enumerateAllInstanceNames(Options& opts);
 
-int PEGASUS_CLI_LINKAGE getClass(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE enumerateInstances(Options& opts);
 
-int PEGASUS_CLI_LINKAGE deleteInstance(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE createInstance(Options& opts);
 
-int PEGASUS_CLI_LINKAGE enumerateInstanceNames(CIMClient& client,
-                                               Options& opts);
+int PEGASUS_CLI_LINKAGE testInstance(Options& opts);
 
-int PEGASUS_CLI_LINKAGE enumerateAllInstanceNames(CIMClient& client,
-                                                  Options& opts);
+int PEGASUS_CLI_LINKAGE modifyInstance(Options& opts);
 
-int PEGASUS_CLI_LINKAGE enumerateInstances(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE getInstance(Options& opts);
 
-int PEGASUS_CLI_LINKAGE createInstance(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE getProperty(Options& opts);
 
-int PEGASUS_CLI_LINKAGE getInstance(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE setProperty(Options& opts);
 
-int PEGASUS_CLI_LINKAGE getProperty(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE setQualifier(Options& opts);
 
-int PEGASUS_CLI_LINKAGE setProperty(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE getQualifier(Options& opts);
 
-int PEGASUS_CLI_LINKAGE setQualifier(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE deleteQualifier(Options& opts);
 
-int PEGASUS_CLI_LINKAGE getQualifier(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE enumerateQualifiers(Options& opts);
 
-int PEGASUS_CLI_LINKAGE deleteQualifier(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE referenceNames(Options& opts);
 
-int PEGASUS_CLI_LINKAGE enumerateQualifiers(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE references(Options& opts);
 
-int PEGASUS_CLI_LINKAGE referenceNames(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE associators(Options& opts);
 
-int PEGASUS_CLI_LINKAGE references(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE associatorNames(Options& opts);
 
-int PEGASUS_CLI_LINKAGE associators(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE invokeMethod(Options& opts);
 
-int PEGASUS_CLI_LINKAGE associatorNames(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE executeQuery(Options& opts);
 
-int PEGASUS_CLI_LINKAGE invokeMethod(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE enumerateNamespaceNames(Options& opts);
 
-int PEGASUS_CLI_LINKAGE executeQuery(CIMClient& client, Options& opts);
+int PEGASUS_CLI_LINKAGE showProfiles(Options& opts);
 
-int PEGASUS_CLI_LINKAGE enumerateNamespaces_Namespace(CIMClient& client,
-                                                      Options& opts);
+int PEGASUS_CLI_LINKAGE setObjectManagerStatistics(Options& opts,
+                                   Boolean newState,
+                                   Boolean& stateAfterMod);
 
 PEGASUS_NAMESPACE_END
 
index c056d3fb01b966bfe3c072d53abab0eda863baf6..2d6258e1a1188cedfe93698dc01f8cb84c634901 100644 (file)
 //
 //%/////////////////////////////////////////////////////////////////////////////
 
+/*
+    This module contains main() for cimcli.
+    It executes the setup,
+                input parameter analysis
+                    directly for the object definition (second parameter)
+                    other parameters through CIMCLIOptions
+                 connect
+                calling the proper action function per the input operation
+                    parameter
+                operation repeats
+                close of the connect
+                output of summary information
+                output of timing information
+    Legal operation are defined in CIMCLIOperations.  Legal input parameters
+    are defined in CIMCLIOptions.
+*/
 #include <Pegasus/Common/Config.h>
 #include <Pegasus/Common/PegasusAssert.h>
 #include <Pegasus/Common/Constants.h>
 #include <Pegasus/Common/HostLocator.h>
 
 #include <Pegasus/Client/CIMClient.h>
-#include <Clients/cimcli/CIMCLIClient.h>
-
 #include <Pegasus/General/Stopwatch.h>
 
+#include <Clients/cimcli/CIMCLIClient.h>
+#include <Clients/cimcli/CIMCLIHelp.h>
+#include <Clients/cimcli/CIMCLIOptions.h>
+#include <Clients/cimcli/CIMCLIOperations.h>
+
 #ifdef PEGASUS_OS_ZOS
 #include <Pegasus/General/SetFileDescriptorToEBCDICEncoding.h>
 #endif
@@ -49,41 +68,75 @@ PEGASUS_USING_PEGASUS;
 PEGASUS_USING_STD;
 
 /////////////////////////////////////////////////////////////////////////
-/** getClassName - gets the classname object
+//
+// The following functions process the target object parameter for
+// particular action functions.
+//
+//////////////////////////////////////////////////////////////////////////
+
+/** getClassNameInput - gets the classname object
  * and puts in into the opts.className holder
- * If rqd, parameter must exist. Otherwise
- * it subsitutes NULL for the string.
- * Also puts the arguement in inputObjectName
+ * If rqd, parameter must exist and error generated if it does
+ * not exist. Otherwise it subsitutes NULL for the string. Also
+ * puts the arguement in inputObjectName for possible error
+ * display
+ * @param argc number of input arguments. Used to determine if
+ *             required argument exits
+ * @param argv List of input arguments. Argument for conversion
+ *             to classname is in this list.
+ * @param opts Options Structure reference. Puts results into
+ *             this structure
  * @param- rqd - true if parameter required
- * @return True if parameter found.
+ * @return True if parameter found. False if parameter not
+ *         required and required.
 */
 Boolean _getClassNameInput(int argc, char** argv, Options& opts, Boolean rqd)
 {
     if (argc > 2)
     {
-        opts.className = CIMName(argv[2]);
         opts.inputObjectName = argv[2];
+        try
+        {
+            opts.className = CIMName(argv[2]);
+        }
+
+        catch(Exception& e)
+        {
+            cerr << "Error: Input class name invalid."
+                 << endl << e.getMessage() << endl
+                 << "Must be the class Name as defined by DMTF Spec."
+                 << " Input Probably contains invalid character. "
+                 << endl;
+            exit(CIMCLI_RTN_CODE_PEGASUS_EXCEPTION);
+        }
     }
-    else
+    else // Parameter does not exist
     {
+        opts.inputObjectName = "";
         if (rqd)
         {
-                cerr << "Class Name Required. ex. gc CIM_Door" << endl;
+                cerr << "Error: Class Name Required. ex. gc CIM_Door" << endl;
                 return(false);
         }
-        else
+        else   // set the opts properties to indicate no classname input
         {
                 opts.className = CIMName();
-                opts.inputObjectName = "";
         }
     }
     return(true);
 }
-/** getObjectName - gets the classname object
+/** getObjectName - gets the objectname object
  * and puts in into the opts.className holder
  * If rqd, parameter must exist. Otherwise
  * it subsitutes NULL for the string.
- * Also puts the arguement in inputObjectName
+ * Also puts the argument in inputObjectName for possible error
+ * display
+ * @param argc number of input arguments. Used to determine if
+ *             required argument exits
+ * @param argv List of input arguments. Argument for conversion
+ *             to classname is in this list.
+ * @param opts Options Structure reference. Puts results into
+ *             this structure
  * @param- rqd - true if parameter required
  * @return True if parameter found.
 */
@@ -91,27 +144,39 @@ Boolean _getObjectNameInput(int argc, char** argv, Options& opts, Boolean rqd)
 {
     if (argc > 2)
     {
-        opts.objectName = argv[2];
-        opts.inputObjectName = argv[2];
+        opts.inputObjectName = argv[2];  // save for possible eror report
+        try
+        {
+            opts.targetObjectName = argv[2];
+        }
+        catch(Exception& e)
+        {
+            cerr << "Error: Input ObjectPath formatted incorrectly."
+                 << endl << e.getMessage() << endl
+                 << "Must be model path defined by DMTF Spec."
+                 << endl;
+            exit(CIMCLI_RTN_CODE_PEGASUS_EXCEPTION);
+        }
     }
     else
     {
+        opts.inputObjectName = "";
         if (rqd)
         {
-                cerr << "Object Name Required" << endl;
+                cerr << "Error: Object Name Required" << endl;
                 return(false);
         }
         else
         {
-                opts.objectName = "";
-                opts.inputObjectName = "";
+                opts.targetObjectName = CIMObjectPath();
         }
     }
     return(true);
 }
 
 /** _getQualifierNameInput - Gets a single parameter for
- * qualifier
+ * qualifier. Puts input into inputObjectName for possible error
+ * display
  * @return true if parameter found
 */
 Boolean _getQualifierNameInput(int argc, char** argv, Options& opts)
@@ -129,48 +194,15 @@ Boolean _getQualifierNameInput(int argc, char** argv, Options& opts)
     return(true);
 }
 
-Boolean setObjectManagerStatistics(CIMClient & client, Boolean newState)
-{
-
-    CIMName gathStatName ("GatherStatisticalData");
-    Array<CIMInstance> instancesObjectManager;
-    CIMInstance instObjectManager;
-    Uint32 prop_num;
-    Array<CIMName> plA;
-    plA.append(gathStatName);
-    CIMPropertyList statPropertyList(plA);
-    // Create property list that represents correct request
-    // get instance.  Get only the gatherstatitistics property
-    instancesObjectManager  =
-        client.enumerateInstances(PEGASUS_NAMESPACENAME_INTEROP,
-            "CIM_ObjectManager",
-            true, false, false, false, statPropertyList);
-    PEGASUS_TEST_ASSERT(instancesObjectManager.size() == 1);
-    instObjectManager = instancesObjectManager[0];
-    // set correct path into instance
-    instObjectManager.setPath(instancesObjectManager[0].getPath());
-
-    prop_num = instObjectManager.findProperty(gathStatName);
-    PEGASUS_TEST_ASSERT(prop_num != PEG_NOT_FOUND);
-
-    instObjectManager.getProperty(prop_num).setValue(CIMValue(newState));
-
-    client.modifyInstance(PEGASUS_NAMESPACENAME_INTEROP, instObjectManager,
-         false, statPropertyList);
-    CIMInstance updatedInstance =
-        client.getInstance(PEGASUS_NAMESPACENAME_INTEROP,
-        instObjectManager.getPath(),
-        false, false, false, statPropertyList);
-    prop_num = updatedInstance.findProperty(gathStatName);
-    PEGASUS_TEST_ASSERT(prop_num != PEG_NOT_FOUND);
-    CIMProperty p = updatedInstance.getProperty(prop_num);
-    CIMValue v = p.getValue();
-    Boolean rtn;
-    v.get(rtn);
-    //// Need to get it again
-    cout << "Updated Status= " << ((rtn)? "true" : "false") << endl;
-    return(rtn);
-}
+/*
+    Function to handle Client Operation Performance data if the
+    server returns this data.
+    FUTURE - This code still caries some of the tests that were
+    initally implemented when the callback was first created.  We should
+    explore removing or modifying these tests. At least partly fixed by
+    making the displays conditional on verboseTest
+*/
+bool _localVerboseTest;
 ClientOpPerformanceData returnedPerformanceData;
 class ClientStatistics : public ClientOpPerformanceDataHandler
 {
@@ -179,31 +211,38 @@ public:
     virtual void handleClientOpPerformanceData (
             const ClientOpPerformanceData & item)
     {
-        if (!(0 <= item.operationType) || !(39 >= item.operationType))
+        // NOTE: We do not use this value so testing it is only a
+        // diagnostic function.
+        // FUTURE - Should test against operation we are expecting
+        if (!(0 <= item.operationType) || !(39 >= item.operationType) &&
+            _localVerboseTest)
         {
-           cerr << "Operation type out of expected range in"
+           cerr << "Error:Operation type out of expected range in"
                         " ClientOpPerformanceData "
                << endl;
-           exit(1);
+
         }
         returnedPerformanceData.operationType =  item.operationType;
-        if (item.roundTripTime == 0)
+        if ((item.roundTripTime == 0) && _localVerboseTest)
         {
-           cerr << "roundTripTime is incorrect in ClientOpPerformanceData "
+           cerr << "Error: roundTripTime incorrect (0) in"
+                   " ClientOpPerformanceData. "
                << endl;
         }
         returnedPerformanceData.roundTripTime =  item.roundTripTime;
 
-        if (item.requestSize == 0)
+        if ((item.requestSize == 0) && _localVerboseTest)
         {
-            cerr << "requestSize is incorrect in ClientOpPerformanceData "
+            cerr << "Error:requestSize incorrect (0) in"
+                    " ClientOpPerformanceData "
                 << endl;
         }
         returnedPerformanceData.requestSize =  item.requestSize;
 
-        if (item.responseSize == 0)
+        if ((item.responseSize == 0) && _localVerboseTest)
         {
-            cerr << "responseSize is incorrect in ClientOpPerformanceData "
+            cerr << "Error:responseSize incorrect (0)"
+                    " in ClientOpPerformanceData "
                 << endl;
         }
         returnedPerformanceData.responseSize =  item.responseSize;
@@ -222,16 +261,29 @@ public:
             returnedPerformanceData.roundTripTime =  item.roundTripTime;
         }
    }
-   //returnedPerformanceData = item;   // Copy the data to public place
 };
 
 ///////////////////////////////////////////////////////////////////////
+//
 //            Main
-
+//
 ///////////////////////////////////////////////////////////////////////
 
 int main(int argc, char** argv)
 {
+    //****** Show the args diagnostic display *******
+    // This is developer tool to sort out issues of incoming parameters
+    // Activated by making the last argument the keyword "displaycliargs".
+    // It displays all args and then eliminates argv[argc] so the proces
+    // can continue
+    if (strcmp(argv[argc - 1],"displaycliargs") == 0)
+    {
+        cout << "argc = " << --argc << endl;
+        for (int i = 0; i < argc; i++)
+        {
+            cout << "argv[" << i << "] = " << argv[i] << endl;
+        }
+    }
 
 #ifdef PEGASUS_OS_ZOS
     // for z/OS set stdout and stderr to EBCDIC
@@ -243,6 +295,7 @@ int main(int argc, char** argv)
     // Allow user group name larger than 8 chars in PASE environemnt
     setenv("PASE_USRGRP_LIMITED","N",1);
 #endif
+
     // If no arguments, simply print usage message and terminate.
     MessageLoader::_useProcessLocale = true;
 
@@ -252,116 +305,85 @@ int main(int argc, char** argv)
         exit(0);
     }
 
-    //****** Show the args diagnostic display
-    if (strcmp(argv[1],"displayargs") == 0)
-    {
-        cout << "argc = " << argc << endl;
-        for (int i = 0; i < argc; i++)
-            cout << "argv[" << i << "] = " << argv[i] << endl;
-    }
-
     // Get options (from command line and from configuration file); this
     // removes corresponding options and their arguments from the command
     // line.
+
     OptionManager om;
+
+    // Define the options structure. Common structure used for all action
+    // functions.
     Options opts;
+
+    // Execute the following in a try block since there are several
+    // possibilities of exception and we want to separate these very basic
+    // exceptions from the action function exceptions. Exceptions in this
+    // block are probably due to programming errors or very strange things
+    // in input.
     try
     {
-        // assume that the config file is local to directory where called.
+        // Set the path for the config file.
+        //assume that the config file is local to directory where called.
+
         String testHome = ".";
         om.setMessagePath("pegasus/pegasusCLI");
-        GetOptions(om, argc, argv, testHome);
+        BuildOptionsTable(om, argc, argv, testHome);
 
-        // Initialize all of the function input parameters.
-        opts.location =  String::EMPTY;
-#ifdef PEGASUS_HAS_SSL
-        opts.ssl = false;
-        opts.clientCert = String::EMPTY;
-        opts.clientKey = String::EMPTY;
-#endif
-        opts.nameSpace = "root/cimv2";
-        opts.cimCmd = "unknown";
-        opts.className = CIMName();
-        opts.objectName = "unknown";
-
-        opts.isXmlOutput = false;
-        opts.outputFormatType = OUTPUT_MOF;
-        opts.user = String::EMPTY;
-        opts.password = String::EMPTY;
-        opts.verboseTest = false;
-
-        opts.localOnly = true;
-        opts.deepInheritance = false;
-        opts.includeQualifiers = true;
-        opts.includeClassOrigin = false;
-        opts.assocClassName = String::EMPTY;
-        opts.assocClass = CIMName();
-        opts.resultClassName = String::EMPTY;
-        opts.resultClass = CIMName();
-        opts.role = String::EMPTY;
-        opts.resultRole = String::EMPTY;
-        opts.propertyListText = String::EMPTY;
-        opts.propertyList.clear();
-        opts.propertyName = String::EMPTY;
-        opts.methodName = CIMName("unknown");
-        opts.delay = 0;
-        opts.trace = 0;
-        opts.count= 97832;
-        opts.repeat = 0;
-        opts.time = false;
-        opts.termCondition = 0;
-        opts.debug = false;
-        opts.queryLanguage = "WQL";
-
-        // move any other input parameters left to the extraParams List
+        // Parse and validate input Options based on the options table
         CheckCommonOptionValues(om, argv, opts);
 
-        /* note that this is in error since it assumes a fixed
+        // move any other input parameters left to the valueParams List
+        //
+        /* FUTURE: note that this is in too limited since it assumes a fixed
            number of parameters will be used for all of the commands
-           It needs to be expanded to allow for a variable minimum
-           number of commands before it picks up any extras
+           It should be expanded to allow for a variable minimum
+           number of commands before it picks up any extras.
         */
         if (argc > 2)
         {
             for (int i = 2 ; i < argc ; i++ )
-                opts.extraParams.append(argv[i]);
+            {
+                    opts.valueParams.append(argv[i]);
+            }
         }
     }
-
     catch(CIMException& e)
     {
         cerr << argv[0] << " Caught CIMException during init: "
              << "\n" << e.getMessage()
              << endl;
-        exit(1);
+        exit(e.getCode());
     }
 
     catch (Exception& e)
     {
-        cerr << argv[0] << ": " << e.getMessage() << endl;
-        exit(1);
+        cerr << argv[0] << ": Caught Exception during init. "
+             << e.getMessage() << endl;
+        exit(CIMCLI_RTN_CODE_PEGASUS_EXCEPTION);
     }
     catch(...)
     {
         cerr << argv[0] << " Caught General Exception During Init:" << endl;
-        exit(1);
+        exit(GENERAL_CLI_ERROR_CODE);
     }
 
-    // if there is still an arg1, assume it is the command name.
+    // if there is an arg1, assume it is the command name.
+
     if (argc > 1)
     {
         opts.cimCmd = argv[1];
     }
     else
     {
-        cout << " Command name must be first parameter or --c parameter."
+        cerr << "Error: P[eration name must be first or --c parameter."
             << " \n  ex. cli enumerateclasses\n"
             << "Enter " << argv[0] << " -h for help."
             << endl;
-        exit(1);
+        exit(CIMCLI_INPUT_ERR);
     }
 
     // if the trace option was set initialize the trace function.
+    // fir cimcli
     if (opts.trace != 0)
     {
         const char* tmpDir = getenv ("PEGASUS_TMP");
@@ -376,35 +398,41 @@ int main(int argc, char** argv)
             Tracer::setTraceLevel(opts.trace);
     }
 
-    // Find the command and save index in cmdIndex
-    Uint32 cmdIndex = 0;
-
     if (opts.verboseTest && opts.debug)
-        cout << "TEST Command = " << opts.cimCmd << endl;
+    {
+        cout << "Command = " << opts.cimCmd << endl;
+    }
+
+    // Find the command or the shortcut name input.
 
-    // Find the command or the short cut name
-    for( ; cmdIndex < NUM_COMMANDS; cmdIndex++ )
+    Operations thisOperation;
+
+    if (!thisOperation.find(opts.cimCmd))
     {
-        if ((String::equalNoCase(opts.cimCmd,
-                CommandTable[cmdIndex].CommandName))
-                ||
-                (opts.cimCmd == CommandTable[cmdIndex].ShortCut))
-            // Break if found
-                    break;
+        cerr << "Error: Invalid cimcli operation name. "
+                "Operation name must be first parmeter"
+                " or --c parameter."
+            << " \n  ex. cli enumerateclasses\n"
+            << "Enter " << argv[0] << " -h for help."
+            << endl;
+        exit(GENERAL_CLI_ERROR_CODE);
     }
 
+    // Start the time for total elapsed time for the command
     Stopwatch totalElapsedExecutionTime;
-
     totalElapsedExecutionTime.start();
 
-    // Now try to open the connection to the cim server
-    CIMClient client;
+    //
+    // Try to open the connection to the cim server
+    //
+
     try
     {
-        if (CommandTable[cmdIndex].ID_Command != ID_ShowOptions)
+        if (thisOperation.get().ID_Operation != ID_ShowOptions)
         {
             String host;
             HostLocator addr;
+
             if (opts.location != String::EMPTY)
             {
                 addr.setHostLocator(opts.location);
@@ -444,8 +472,7 @@ int main(int argc, char** argv)
                 {
                     cout << "Connect with connectLocal" << endl;
                 }
-                client.connectLocal();
-
+                opts.client.connectLocal();
             }
             else
             {
@@ -457,7 +484,10 @@ int main(int argc, char** argv)
                          << " for User=" << opts.user
                          << endl;
                 }
+
+                // Connect with SSL api only if SSL compile enabled
 #ifdef PEGASUS_HAS_SSL
+                String sslRndFilePath = "sss.rnd";
                 if (opts.ssl) //connect over HTTPS
                 {
                     if (!String::equal(opts.clientCert, String::EMPTY)
@@ -466,61 +496,70 @@ int main(int argc, char** argv)
                         if (opts.verboseTest)
                         {
                             cout << "SSL options "
-                                << "Cert = " << opts.clientCert
-                                << "clientKey = "  << opts.clientKey << endl;
+                                << "CertPath = " << opts.clientCert
+                                << "clientKeyPath = "
+                                << opts.clientKey << endl;
                         }
-                        client.connect(host,
+                        opts.client.connect(host,
                                        portNumber,
                                        SSLContext("",
                                            opts.clientCert,
                                            opts.clientKey,
-                                           NULL, "ssl.rnd"),
+                                           NULL, sslRndFilePath),
                                        opts.user,
                                        opts.password);
                     } else
                     {
-                        client.connect(host,
+                        opts.client.connect(host,
                                        portNumber,
-                                       SSLContext("", NULL, "ssl.rnd"),
+                                       SSLContext("", NULL, sslRndFilePath),
                                        opts.user,
                                        opts.password);
                     }
                 } else //connect over HTTP
                 {
-                    client.connect(host, portNumber, opts.user, opts.password);
+                    opts.client.connect(host, portNumber, opts.user,
+                                        opts.password);
                 }
-#else
-                client.connect(host, portNumber, opts.user, opts.password);
+#else   // Not SSL
+                opts.client.connect(host, portNumber, opts.user,
+                                    opts.password);
 #endif
             }
-        }
+        }  // end if if not show options.
     }
     catch(Exception &e)
     {
         cerr << "Pegasus Exception: " << e.getMessage() <<
               " Trying to connect to " << opts.location << endl;
-        exit(1);
+        exit(CIMCLI_CONNECTION_FAILED);
     }
 
-    // Register for Client statistics.
+    // Register for Client statistics which might be returned with
+    // the response
     ClientStatistics statistics = ClientStatistics();
-    client.registerClientOpPerformanceDataHandler(statistics);
+    _localVerboseTest = opts.verboseTest;
+    opts.client.registerClientOpPerformanceDataHandler(statistics);
 
+    // if delay option set, execute this delay between the connect and the
+    // execution of the command.
+    // NOTE: This was a test option for some specific tests
+    // FUTURE: Consider removing this option.
     if (opts.delay != 0)
     {
-        // This was a test because of some delay caused problems.
         Threads::sleep(opts.delay * 1000);
     }
 
     // If the timeout is not zero, set the timeout for this connection.
     if (opts.connectionTimeout != 0)
     {
-        client.setTimeout(opts.connectionTimeout * 1000);
+        opts.client.setTimeout(opts.connectionTimeout * 1000);
     }
 
     // Save the total connect time.
     double totalConnectTime = opts.elapsedTime.getElapsed();
 
+    // Setup the other timers.
     double totalTime = 0;
     Uint32 repeatCount = opts.repeat;
     double maxTime = 0;
@@ -534,186 +573,234 @@ int main(int argc, char** argv)
     Uint64 maxRtTime = 0;
     Uint64 minRtTime = 10000000;
 
-    // Process the input command within a try block.
+    //
+    //  Process the requestd operation action function
+    //  Process the function within a try block to catch all operation
+    //  command exceptions
+    //
     try
     {
         // Loop to repeat the command a number of times.
+        // while opts.repeat > 0
         do
         {
             // or exit with error through default of case logic
-            switch(CommandTable[cmdIndex].ID_Command)
-                {
+            switch(thisOperation.get().ID_Operation)
+            {
                 case ID_EnumerateInstanceNames :
                     if (!_getClassNameInput(argc, argv, opts, true))
-                        exit(1);
-                    enumerateInstanceNames(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = enumerateInstanceNames(opts);
                     break;
 
                 case ID_EnumerateAllInstanceNames :
                     if (!_getClassNameInput(argc, argv, opts, false))
-                        exit(1);
-                    enumerateAllInstanceNames(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = enumerateAllInstanceNames(opts);
                     break;
 
                 case ID_EnumerateInstances :
                     if (!_getClassNameInput(argc, argv, opts, true))
-                        exit(1);
-                    enumerateInstances(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = enumerateInstances(opts);
                     break;
                 case ID_GetInstance :
                     if (!_getObjectNameInput(argc, argv, opts, true))
-                        exit(1);
-                    getInstance(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = getInstance(opts);
                     break;
 
                 case ID_EnumerateClassNames :
                     if (!_getClassNameInput(argc, argv, opts, false))
-                        exit(1);
-                    enumerateClassNames(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = enumerateClassNames(opts);
                     break;
 
                 case ID_EnumerateClasses :
                     if (!_getClassNameInput(argc, argv, opts, false))
-                        exit(1);
-                    enumerateClasses(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = enumerateClasses(opts);
                     break;
 
                 case ID_GetClass :
                     if (!_getClassNameInput(argc, argv, opts, true))
-                        exit(1);
-                    getClass(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = getClass(opts);
                     break;
 
                 case ID_CreateInstance :
                     if (!_getClassNameInput(argc, argv, opts, true))
-                        exit(1);
-                    createInstance(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = createInstance(opts);
+                    break;
+
+                case ID_TestInstance :
+                    if (!_getObjectNameInput(argc, argv, opts, true))
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = testInstance(opts);
+                    break;
+
+                case ID_ModifyInstance :
+                    if (!_getObjectNameInput(argc, argv, opts, true))
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = modifyInstance(opts);
                     break;
 
                 case ID_DeleteInstance :
                     if (!_getObjectNameInput(argc, argv, opts, true))
-                        exit(1);
-                    deleteInstance(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = deleteInstance(opts);
                     break;
 
                 case ID_CreateClass :
                     cerr << "CreateClass not implemented" << endl;
+                    exit(CIMCLI_INPUT_ERR);
                     break;
 
                 case ID_DeleteClass :
                     if (!_getClassNameInput(argc, argv, opts, true))
-                        exit(1);
-                    deleteClass(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = deleteClass(opts);
                     break;
 
                 case ID_GetProperty :
-                    if (argc != 4)
+                    if (argc < 4)
                     {
                         cout << "Usage: cli getproperty <instancename>"
-                            "<propertyname>" << endl;
-                        exit(1);
+                            "<propertyname> or"
+                            " cli getproperty <classname>"
+                            " <propertyname> <keypropert=value>*" << endl;
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+
+                    if (!_getObjectNameInput(argc, argv, opts, true))
+                    {
+                        exit(CIMCLI_INPUT_ERR);
                     }
 
-                    opts.instanceName = argv[2];
-                    opts.inputObjectName = argv[2];
                     opts.propertyName = argv[3];
+                    opts.valueParams.remove(0);
 
-                    getProperty(client, opts);
+                    opts.termCondition = getProperty(opts);
                     break;
 
                 case ID_SetProperty :
-                    if (argc != 5)
+                    if (argc < 5)
+                    {
                         cout <<
                            "Usage: cli setproperty instancename propertyname"
                                 " value "
                            << endl;
-                    setProperty(client, opts);
+                    }
+                    setProperty(opts);
                     break;
 
                 case ID_EnumerateQualifiers :
-                    enumerateQualifiers(client, opts);
+                    opts.termCondition = enumerateQualifiers(opts);
                     break;
 
                 case ID_SetQualifier :
                     cerr << "SetQualifer not implemented" << endl;
-                        exit(1);
+                    exit(CIMCLI_INPUT_ERR);
                     break;
 
                 case ID_GetQualifier :
                     if (!_getQualifierNameInput(argc, argv, opts))
-                        exit(1);
-                    getQualifier(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = getQualifier(opts);
                     break;
 
                 case ID_DeleteQualifier :
                     if (!_getQualifierNameInput(argc, argv, opts))
-                        exit(1);
-                    deleteQualifier(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = deleteQualifier(opts);
                     break;
 
-                /* Reference params are
-                    [IN] <objectName> ObjectName,
-                    [IN,OPTIONAL,NULL] <className> ResultClass = NULL,
-                    [IN,OPTIONAL,NULL] string Role = NULL,
-                    [IN,OPTIONAL] boolean IncludeQualifiers = false,
-                    [IN,OPTIONAL] boolean IncludeClassOrigin = false,
-                    [IN,OPTIONAL,NULL] string PropertyList [] = NULL
-                */
                 case ID_References  :
                     if (!_getObjectNameInput(argc, argv, opts, true))
-                        exit(1);
-                    references(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = references(opts);
                     break;
 
                 case ID_ReferenceNames :
                     if (!_getObjectNameInput(argc, argv, opts, true))
-                        exit(1);
-                    referenceNames(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = referenceNames(opts);
                     break;
 
                 case ID_Associators :
                     if (!_getObjectNameInput(argc, argv, opts, true))
-                        exit(1);
-                    associators(client, opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = associators(opts);
                     break;
 
                 case ID_AssociatorNames :
                     if (!_getObjectNameInput(argc, argv, opts, true))
-                        exit(1);
-                    associatorNames(client,opts);
+                    {
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    opts.termCondition = associatorNames(opts);
                     break;
 
                 case ID_EnumerateNamespaces :
                     // Note that the following constants are fixed here.  We
                     // should be getting them from the environment to assure
                     // that others know that we are using them.
-                    opts.className = CIMName("CIM_Namespace");
+                    //opts.className = PEGASUS_CLASSNAME_CIMNAMESPACE;
+
                     if (argc > 2)
                     {
                         opts.nameSpace = argv[2];
                         opts.inputObjectName = argv[2];
                     }
                     else
+                    {
                         // set nameSpace to interop namespace name
                         opts.nameSpace =
                             PEGASUS_NAMESPACENAME_INTEROP.getString();
+                    }
 
-                    enumerateNamespaces_Namespace(client,opts);
+                    opts.termCondition = enumerateNamespaceNames(opts);
                     break;
 
-                    /*
-                        CIMValue invokeMethod(
-                            const CIMNamespaceName& nameSpace,
-                            const CIMObjectPath& instanceName,
-                            const CIMName& methodName,
-                            const Array<CIMParamValue>& inParameters,
-
-                    Array<CIMParamValue>& outParameters
-                    */
                 case ID_InvokeMethod :
                     if (argc < 4)
                     {
-                        cout << "Usage: InvokeMethod requires that object and"
+                        cerr << "Usage: InvokeMethod requires that object and"
                             " method names be specified.\n"
                             "Input parameters are optional and can be"
                             " specified with the -ip option or as"
@@ -721,28 +808,27 @@ int main(int argc, char** argv)
                             "Enter each input parameter as name=value"
                             " (no spaces around equal sign)."
                             << endl;
-                        exit(1);
+                        exit(CIMCLI_INPUT_ERR);
+                    }
+                    //cout << "Input args 2 " << argv[2]
+                    //      << " 3 " << argv[3] << endl;
+
+                    if (!_getObjectNameInput(argc, argv, opts, true))
+                    {
+                        exit(CIMCLI_INPUT_ERR);
                     }
-                    opts.objectName = argv[2];
-                    opts.inputObjectName = argv[2];
+                    //opts.objectName = argv[2];
+                    //opts.inputObjectName = argv[2];
                     opts.methodName = CIMName(argv[3]);
+                    // remove the method name argument
+                    opts.valueParams.remove(0);
 
                     // If there are any extra arguments they must be parameters
                     // These parameters  can be used in addtion to parameters
                     // ifrom the -ip option setting. Parameters found here must
                     // be key=value pairs or they will generate an exception.
-                    if (argc > 4)
-                    {
-                        // get input params from command line
-                        for (Sint32 i = 4 ; i < argc; i++)
-                        {
-                            CIMParamValue pv;
-                            String s = argv[i];
-                            pv = _createMethodParamValue(s, opts);
-                            opts.inParams.append(pv);
-                        }
-                    }
-                    invokeMethod(client, opts);
+
+                    opts.termCondition = invokeMethod(opts);
                     break;
 
                 case ID_ShowOptions :
@@ -752,28 +838,35 @@ int main(int argc, char** argv)
                 case ID_ExecQuery:
                     opts.query = argv[2];
                     if (argc==4)
+                    {
                         opts.queryLanguage = argv[3];
-                    executeQuery(client, opts);
+                    }
+                    opts.termCondition = executeQuery(opts);
                     break;
 
                 case ID_StatisticsOn:
-                    setObjectManagerStatistics(client, true);
+                    Boolean rtndState;
+                    setObjectManagerStatistics(opts, true, rtndState);
                     break;
 
                 case ID_StatisticsOff:
-                    setObjectManagerStatistics(client, false);
+                    opts.termCondition = setObjectManagerStatistics(
+                        opts, false, rtndState);
                     break;
 
-                //case ID_Unknown :
                 default:
-                    cout << "Invalid Command. Command name must be first parm"
+                    cout << "Invalid cimcli operation name. "
+                            "Operation name must be first parmeter"
                             " or --c parameter."
                         << " \n  ex. cli enumerateclasses\n"
                         << "Enter " << argv[0] << " -h for help."
                         << endl;
-                    exit(1);
+                    exit(CIMCLI_INPUT_ERR);
                     break;
-            }
+            } // switch statement
+
+            // If the repeat option set, do any interim time calculation
+            // and output and decrement the repeat count
             if (opts.repeat > 0)
             {
                 if (opts.verboseTest)
@@ -781,6 +874,7 @@ int main(int argc, char** argv)
                     cout << "Repetitition " << opts.repeat << endl;
                 }
                 opts.repeat--;
+
                 if (opts.time)
                 {
                     totalTime += opts.saveElapsedTime;
@@ -804,14 +898,17 @@ int main(int argc, char** argv)
             }
         } while (opts.repeat > 0  );
 
+        // Command processing complete.  If the time parameter is set,
+        // output any total time information
+
         if (opts.time)
         {
+            cout << thisOperation.get().OperationName << " "
+                 << opts.inputObjectName;
+
             if (repeatCount == 0)
             {
-                cout << CommandTable[cmdIndex].CommandName
-                    << " "
-                    << opts.inputObjectName
-                    << " Time= "
+                cout << " Time= "
                     << opts.saveElapsedTime
                     << " Sec "
                     << " SvrTime= "
@@ -830,10 +927,7 @@ int main(int argc, char** argv)
             }
             else
             {
-                cout << CommandTable[cmdIndex].CommandName
-                    << " "
-                    << opts.inputObjectName
-                    << " Total Time "
+                cout << " Total Time "
                     << totalTime
                     << " for "
                     << repeatCount
@@ -861,26 +955,31 @@ int main(int argc, char** argv)
             }
         }
     }
+
+    // Exceptions for action operations try block
+    // The following exceptions are all routed to cerr
     catch(CIMException& e)
     {
-        cerr << argv[0] << " CIMException: "<<" Cmd= " << opts.cimCmd
-            << " Object= " << opts.inputObjectName
+        cerr << argv[0] << " CIMException: "
+             <<" Cmd= " << opts.cimCmd
+             << " Object= " << opts.inputObjectName
+             << " Code= " << e.getCode()
              << "\n" << e.getMessage()
              << endl;
-        opts.termCondition = 1;
+        opts.termCondition = e.getCode();
     }
     catch(Exception& e)
     {
-        PEGASUS_STD(cerr) << argv[0] << " Pegasus Exception: " << e.getMessage()
+        cerr << argv[0] << " Pegasus Exception: " << e.getMessage()
                 <<  ". Cmd = " << opts.cimCmd
                 << " Object = " << opts.inputObjectName
-                << PEGASUS_STD(endl);
-            opts.termCondition = 1;
+                << endl;
+            opts.termCondition = CIMCLI_RTN_CODE_PEGASUS_EXCEPTION;
     }
     catch(...)
     {
         cerr << argv[0] << " Caught General Exception:" << endl;
-        opts.termCondition = 1;
+        opts.termCondition = CIMCLI_RTN_CODE_UNKNOWN_EXCEPTION;
     }
 
     totalElapsedExecutionTime.stop();
@@ -888,25 +987,33 @@ int main(int argc, char** argv)
     if (opts.time)
     {
         // if abnormal term, dump all times
-        if (opts.termCondition == 1)
+        if (opts.termCondition != 0)
         {
             cout << "Exception" << endl;
             cout << "Prev Time " << opts.saveElapsedTime << " Sec" << endl;
             opts.saveElapsedTime = opts.elapsedTime.getElapsed();
             cout << "Last Time " << opts.saveElapsedTime << " Sec" << endl;
             cout << "Total Time " << totalTime << " for "
-                << repeatCount << " operations. Avg.= " << totalTime/repeatCount
+                << repeatCount << " operations. Avg.= "
+                << totalTime/repeatCount
                 << " min= " << minTime << " max= " << maxTime << endl;
         }
 
-        cout << "Total Elapsed Time= " << totalElapsedExecutionTime.getElapsed()
-             << " Sec. Terminated at " << System::getCurrentASCIITime() << endl;
+        cout << "Total Elapsed Time= "
+             << totalElapsedExecutionTime.getElapsed()
+             << " Sec. Terminated at " << System::getCurrentASCIITime()
+             << endl;
     }
+
+    // if delay parameter set, sleep before terminating.
     if (opts.delay != 0)
     {
         Threads::sleep(opts.delay * 1000);
     }
-    return(opts.termCondition);
+
+    // Terminate with termination code
+
+    exit(opts.termCondition);
 }
 
 //PEGASUS_NAMESPACE_END
diff --git a/src/Clients/cimcli/CIMCLICommon.cpp b/src/Clients/cimcli/CIMCLICommon.cpp
new file mode 100644 (file)
index 0000000..87dc1ae
--- /dev/null
@@ -0,0 +1,190 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+//
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/Tracer.h>
+#include "CIMCLICommon.h"
+
+PEGASUS_USING_STD;
+PEGASUS_NAMESPACE_BEGIN
+
+/* Convert Boolean parameter to String "true" or "false"
+*/
+String _toString(Boolean x)
+{
+    return(x ? "true" : "false");
+}
+
+void _print(Boolean x)
+{
+    cout << _toString(x);
+}
+
+// Convert a CIMPropertyList parameter to CIM String
+String _toString(const CIMPropertyList& pl)
+{
+    String rtn;
+    Array<CIMName> pls = pl.getPropertyNameArray();
+    if (pl.isNull())
+        return("NULL");
+
+    if (pl.size() == 0)
+        return("EMPTY");
+
+    for (Uint32 i = 0 ; i < pls.size() ; i++)
+    {
+        if (i != 0)
+            rtn.append(", ");
+        rtn.append(pls[i].getString());
+    }
+    return(rtn);
+}
+
+// Output a CIMPropertyList to cout
+void _print(const CIMPropertyList& pl)
+{
+    cout << _toString(pl);
+}
+
+String _toString(const Array<CIMNamespaceName>& nsList)
+{
+    String rtn;
+    for (Uint32 i = 0 ; i < nsList.size() ; i++ )
+    {
+        if (i != 0)
+        {
+            rtn.append(", ");
+        }
+        rtn.append(nsList[i].getString());
+    }
+    return rtn;
+}
+
+void _print(const Array<CIMNamespaceName>& List)
+{
+    cout << _toString(List);
+}
+
+String _toString(const Array<String>& strList)
+{
+    String rtn;
+    for (Uint32 i = 0 ; i < strList.size() ; i++)
+    {
+        if (i > 0)
+        {
+            rtn.append(", ");
+        }
+        rtn.append(strList[i]);
+    }
+    return rtn;
+}
+void _print(const Array<String>& strList)
+{
+    cout << _toString(strList);
+}
+
+/** tokenize an input string into an array of Strings,
+ * separating the tokens at the separator character
+ * provided
+ * @param input String
+ * @param separator character
+ * @param all Boolean if true do multiple tokens.
+ * If false, stop after first.
+ * @returns Array of separated strings
+ * Terminates
+ *  after first if all = false.
+ * */
+Array<String> _tokenize(const String& input,
+                        const Char16 separator,
+                        bool allTokens)
+{
+    ///////cout << "Enter _Tokenize2" << endl;
+    Array<String> tokens;
+    if (input.size() != 0)
+    {
+        Uint32 start = 0;
+        Uint32 length = 0;
+        Uint32 end = 0;
+        if (allTokens)
+        {
+            while ((end = input.find(start, separator)) != PEG_NOT_FOUND)
+            {
+                length = end - start;
+
+                /////cout << "This2 Token = " << input.subString(start,
+                ///  length) << endl;
+                tokens.append(input.subString(start, length));
+                start += (length + 1);
+            }
+        }
+        else
+        {
+            if ((length = input.find(start, separator)) != PEG_NOT_FOUND)
+            {
+
+                /////cout << "This2 Token = " << input.subString(start,
+                ///length) << endl;
+                tokens.append(input.subString(start,length));
+                start+= (length + 1);
+            }
+        }
+        //Replaced < with <= to consider input param like A="" as valid param.
+        //key in this param is 'A'and value is NULL.
+        //It also takes care of A= param.
+        if(start <= input.size())
+        {
+            tokens.append(input.subString(start));
+        }
+    }
+    return tokens;
+}
+
+/* Build a property list from all of the property names in the input instance.
+*/
+CIMPropertyList _buildPropertyList(const CIMInstance& inst)
+{
+    Array<CIMName> tmp;
+    for (Uint32 i = 0 ; i < inst.getPropertyCount() ; i++)
+    {
+        CIMConstProperty instProperty = inst.getProperty(i);
+        tmp.append(instProperty.getName());
+    }
+    CIMPropertyList pl;
+    pl.set(tmp);
+
+    return(pl);
+}
+
+PEGASUS_NAMESPACE_END
+// END_OF_FILE
diff --git a/src/Clients/cimcli/CIMCLICommon.h b/src/Clients/cimcli/CIMCLICommon.h
new file mode 100644 (file)
index 0000000..e0d8810
--- /dev/null
@@ -0,0 +1,70 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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 _CLI_COMMON_H
+#define _CLI_COMMON_H
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Clients/cimcli/Linkage.h>
+#include <Pegasus/Common/CIMPropertyList.h>
+
+#include <Pegasus/Common/CIMInstance.h>
+PEGASUS_NAMESPACE_BEGIN
+
+String  PEGASUS_CLI_LINKAGE _toString(Boolean x);
+void  PEGASUS_CLI_LINKAGE _print(Boolean x);
+
+String  PEGASUS_CLI_LINKAGE _toString(const CIMPropertyList& pl);
+void  PEGASUS_CLI_LINKAGE _print(const CIMPropertyList& pl);
+
+String  PEGASUS_CLI_LINKAGE _toString(const Array<String>& strList);
+void  PEGASUS_CLI_LINKAGE _print(const Array<String>& strList);
+
+// Generate comma separated list of namespace names
+String PEGASUS_CLI_LINKAGE _toString(const Array<CIMNamespaceName>& List);
+void PEGASUS_CLI_LINKAGE _print(const Array<CIMNamespaceName>& List);
+
+Array<String>  PEGASUS_CLI_LINKAGE _tokenize(
+    const String& input,
+    const Char16 separator,
+    bool allTokens);
+
+
+/* Build a property list from all of the property names in the input instance
+   @param inst CIMInstance from which propertylist built
+   @return CIMPropertyList will all names from the instance
+*/
+CIMPropertyList PEGASUS_CLI_LINKAGE _buildPropertyList(const CIMInstance& inst);
+
+PEGASUS_NAMESPACE_END
+
+#endif  /* _CLI_COMMON_H */
diff --git a/src/Clients/cimcli/CIMCLIHelp.cpp b/src/Clients/cimcli/CIMCLIHelp.cpp
new file mode 100644 (file)
index 0000000..88794b6
--- /dev/null
@@ -0,0 +1,342 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/FileSystem.h>
+#include <Pegasus/Common/XmlWriter.h>
+#include <Pegasus/General/MofWriter.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/StringConversion.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include <Pegasus/Common/PegasusVersion.h>
+
+#include "CIMCLIClient.h"
+#include "ObjectBuilder.h"
+#include "CIMCLIOutput.h"
+#include "CIMCLICommon.h"
+#include "CIMCLIClient.h"
+#include "CIMCLIOperations.h"
+
+PEGASUS_USING_STD;
+PEGASUS_NAMESPACE_BEGIN
+/*****************************************************************************
+**
+**    Usage and Help Functions
+**
+******************************************************************************/
+// Character sequences used in help/usage output.
+
+static const char * usage = "This command executes single CIM Operations.\n";
+
+static const char* optionText = "Valid options for this command are : ";
+static const char* commonOptions = "    -count, -d, -delay, -p, -l, -u, -o, -x,\
+ -v, --sum, --timeout, -r, --t ";
+
+/*
+    This function loads the message from resourcebundle using the key passed
+*/
+String loadMessage(const char* key, const char* defMessage)
+{
+    MessageLoaderParms parms(key, defMessage);
+    parms.msg_src_path = MSG_PATH;
+    return MessageLoader::getMessage(parms);
+}
+
+void showExamples()
+{
+
+    Operations operations;
+    cout <<
+        loadMessage(
+            "Clients.cimcli.CIMCLIClient.EXAMPLES_STRING",
+            "Examples : ")
+         << endl;
+
+    while(operations.more())
+    {
+        OperationExampleEntry example = operations.getExampleEntry();
+        cout << loadMessage(example.msgKey, example.Example) << endl;
+
+
+        OperationTableEntry thisOperation = operations.next();
+    }
+}
+
+
+/* Remap a long string into a multi-line string that can be positioned on a
+   line starting at pos and with length defined for each line.
+   Each output line consists of fill parameter to pos and max line length
+   defined by length parameter.
+
+   The input string is recreated by tokenizing on the space character
+   and filled from the left so that the returned string can be output
+   as a multiline string starting at pos.
+*/
+
+String formatLongString (const char * input, Uint32 pos, Uint32 lineLength)
+{
+    String output;
+    String work = input;
+    Array<String> list;
+    Uint32 textLength = lineLength - pos;
+    // create the fill string starting with the newline character
+    String fill;
+    fill.append("\n");
+    for (Uint32 i = 0; i < pos; i++)
+        fill.append (" ");
+
+    list = _tokenize(work, ' ', true);
+
+    for (Uint32 i = 0 ; i < list.size() ; i++)
+    {
+        // move a single word and either a space or create new line
+        if (((output.size() % (textLength)) + list[i].size()) >= (textLength))
+        {
+            output.append(fill);
+        }
+        else
+        {
+            output.append(" ");
+        }
+
+        output.append(list[i]);
+    }
+    return(output);
+}
+
+/* showOperations - Display the list of operations possible based
+   on what is in the operations table.
+   FUTURE: This should probably be in the Operations.cpp file
+*/
+
+void showOperations(const char* pgmName, Uint32 lineLength)
+{
+    Uint32 indent = 28;
+    Operations operations;
+
+    while(operations.more())
+    {
+        OperationTableEntry thisOperation = operations.next();
+
+        char * opStr= new char[500];
+        String txtFormat = formatLongString(
+            thisOperation.UsageText,
+            indent,
+            lineLength);
+        CString ctxtFormat=txtFormat.getCString();
+
+        sprintf(
+            opStr,
+            "\n%-5s %-21s",
+            thisOperation.ShortCut,
+            thisOperation.OperationName);
+
+        opStr = strcat(opStr, (const char*)ctxtFormat);
+
+        cout << loadMessage(
+            thisOperation.msgKey,
+            const_cast<const char*>(opStr));
+
+        delete[] opStr;
+    }
+    cout << loadMessage(
+        "Clients.cimcli.CIMCLIClient.HELP_SUMMARY",
+        " -h for all help, -hc for commands, -ho for options")
+        << endl;
+}
+
+void showVersion(const char* pgmName, OptionManager& om)
+{
+    String str = "";
+    str.append("Version ");
+    str.append(PEGASUS_PRODUCT_VERSION);
+
+    CString cstr = str.getCString();
+    MessageLoaderParms parms(
+        "Clients.cimcli.CIMCLIClient.VERSION",
+        (const char*)cstr,
+        PEGASUS_PRODUCT_VERSION);
+    parms.msg_src_path = MSG_PATH;
+    cout << MessageLoader::getMessage(parms) << endl;
+}
+
+void showOptions(const char* pgmName, OptionManager& om)
+{
+
+    String optionsTrailer = loadMessage(
+        "Clients.cimcli.CIMCLIClient.OPTIONS_TRAILER",
+        "Options vary by command consistent with CIM Operations");
+    cout << loadMessage(
+        "Clients.cimcli.CIMCLIClient.OPTIONS_HEADER",
+        "The options for this command are:\n");
+
+    String usageStr;
+    usageStr = loadMessage(
+        "Clients.cimcli.CIMCLIClient.OPTIONS_USAGE",
+        usage);
+    om.printOptionsHelpTxt(usageStr, optionsTrailer);
+}
+
+void showUsage()
+{
+    String usageText;
+    usageText =
+        "Usage: cimcli <command> <CIMObject> <Options> *<extra parameters>\n"
+        "    -hc    for <command> set and <CimObject> for each command\n"
+        "    -ho    for <Options> set\n"
+        "    -h xx  for <command> and <Example> for <xx> operation \n"
+        "    -h     for this summary\n"
+        "    --help for full help\n";
+    CString str = usageText.getCString();
+    cout << loadMessage("Clients.cimcli.CIMCLIClient.MENU.STANDARD",
+        (const char*)str);
+}
+
+
+/* showFullHelpMsg - Show all of the various help groups including
+   usage, version, options, commands, and examples.
+*/
+void showFullHelpMsg(
+    const char* pgmName,
+    OptionManager& om,
+    Uint32 lineLength)
+{
+    showUsage();
+
+    showVersion(pgmName, om);
+
+    showOptions(pgmName, om);
+
+    showOperations(pgmName, lineLength);
+
+    cout << endl;
+
+    showExamples();
+}
+
+/*
+    Show the usage of a single command
+    cmd param is shortcut or operation name for the target command.
+*/
+Boolean showOperationUsage(const char* cmd, OptionManager& om,
+                           Uint32 lineLength)
+{
+    // indent for subsequent lines for help output
+    // This value is an arbitary decision.
+    Uint32 indent = 28;
+
+    if (cmd)
+    {
+        // Find the command or the short cut name
+        Operations operations;
+        if (operations.find(cmd))
+        {
+            OperationTableEntry thisOperation = operations.get();
+            Uint32 index = operations.getIndex();
+
+            OperationExampleEntry example = operations.getExampleEntry();
+
+            // format the shortcut and
+            // command string into a single output string.
+            char * opStr= new char[1000];
+            sprintf(
+                opStr,
+                "\n%-5s %-21s",
+                thisOperation.ShortCut,
+                thisOperation.OperationName);
+            // Append formatted usage text to the command information
+            String txtFormat = formatLongString(
+                thisOperation.UsageText, indent ,lineLength);
+
+            CString ctxtFormat=txtFormat.getCString();
+            opStr = strcat(opStr, (const char*)ctxtFormat);
+
+            // output the command and usage information
+            cout << loadMessage(
+                thisOperation.msgKey,
+                const_cast<const char*>(opStr))
+                << endl;
+
+            delete[] opStr;
+
+            // Output the corresponding Example and Options information
+            cout << loadMessage("Clients.cimcli.CIMCLIClient.EXAMPLE_STRING",
+                        "Example : ")
+                << endl;
+            cout << loadMessage(example.msgKey, example.Example)
+                << endl;
+            cout << loadMessage("Clients.cimcli.CIMCLIClient.OPTIONS_STRING",
+                        optionText)
+                << endl;
+            cout << loadMessage( example.optionsKey, example.Options)
+                << endl;
+
+            // Output the common Options information
+            char * commonOptStr = new char[800];
+            sprintf(commonOptStr, "%s", "Common Options are : \n");
+            commonOptStr = strcat(commonOptStr, commonOptions);
+            cout << loadMessage("Clients.cimcli.CIMCLIClient."
+                        "COMMON_OPTIONS_STRING",
+                        commonOptStr)
+                << endl;
+            delete[] commonOptStr;
+            return true;
+        }
+        else
+        {
+            cerr << "Command \"" << cmd
+                    << "\" not legal cimcli operation name.\n"
+                    " Type cimcli -hc to list valid commands."
+                 << endl;
+            cout << loadMessage(
+                "Clients.cimcli.CIMCLIClient.HELP_SUMMARY",
+                " -h for all help, -hc for commands, -ho for options")
+                << endl;
+            return false;
+        }
+    }
+    else
+    {
+        cerr << "Error: Input Parameter with Operation Name required.\n"
+             << "     ex. cimcli -h di. or \n"
+             << "         cimcli -h deleteinstance"
+             << endl;
+        cout << loadMessage(
+            "Clients.cimcli.CIMCLIClient.HELP_SUMMARY",
+            " -h for all help, -hc for commands, -ho for options")
+            << endl;
+            return false;
+    }
+}
+
+PEGASUS_NAMESPACE_END
+// END_OF_FILE
diff --git a/src/Clients/cimcli/CIMCLIHelp.h b/src/Clients/cimcli/CIMCLIHelp.h
new file mode 100644 (file)
index 0000000..1be88f1
--- /dev/null
@@ -0,0 +1,59 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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 _CLI_HELP_H
+#define _CLI_HELP_H
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/General/OptionManager.h>
+#include <Clients/cimcli/Linkage.h>
+
+
+PEGASUS_NAMESPACE_BEGIN
+void PEGASUS_CLI_LINKAGE showOperations(const char* pgmName,
+                                        Uint32 lineLength);
+
+void PEGASUS_CLI_LINKAGE showUsage();
+
+void PEGASUS_CLI_LINKAGE showFullHelpMsg(const char* pgmName,
+     OptionManager& om, Uint32 lineLength);
+
+Boolean PEGASUS_CLI_LINKAGE showOperationUsage(const char* cmd,
+     OptionManager& om, Uint32 lineLength);
+
+void showVersion(const char* pgmName, OptionManager& om);
+
+void showOptions(const char* pgmName, OptionManager& om);
+
+PEGASUS_NAMESPACE_END
+
+#endif
diff --git a/src/Clients/cimcli/CIMCLIOperations.cpp b/src/Clients/cimcli/CIMCLIOperations.cpp
new file mode 100644 (file)
index 0000000..e910817
--- /dev/null
@@ -0,0 +1,488 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include "CIMCLIOperations.h"
+
+PEGASUS_USING_STD;
+PEGASUS_NAMESPACE_BEGIN
+
+/******************************************************************************
+**
+**             Operation Table.  Defines all of the
+**             Operations available to cimcli including:
+**             Type Enum, String definition, Min number of arguments on
+**             Input, shortcut name, Help Command internationalization text
+**             and Short Usage statement
+**
+******************************************************************************/
+OPERATION_TABLE_ENTRY OperationTable[] =
+{
+    {ID_EnumerateInstanceNames,  "enumerateInstanceNames", 2 ,"ni",
+    "Clients.cimcli.CIMCLIClient.NI_COMMAND_HELP",
+    "Enumerate instancenames of <classname>"},
+
+    {ID_EnumerateAllInstanceNames,"enumallInstanceNames", 2 , "niall",
+    "Clients.cimcli.CIMCLIClient.NIALL_COMMAND_HELP" ,
+    "Enumerate all instance names in <namespace>."},
+
+    {ID_EnumerateInstances,      "enumerateInstances",2 ,   "ei",
+    "Clients.cimcli.CIMCLIClient.EI_COMMAND_HELP" ,
+    "Enumerate instances of <classname>"},
+
+    {ID_EnumerateClassNames,     "enumerateClassNames",2 ,  "nc",
+    "Clients.cimcli.CIMCLIClient.NC_COMMAND_HELP",
+    "Enumerate Class Names of [ <classname> ]. Classname optional"},
+
+    {ID_EnumerateClasses,        "enumerateClasses",2 ,     "ec",
+    "Clients.cimcli.CIMCLIClient.EC_COMMAND_HELP",
+    "Enumerate classes of [ <classname> ]. Classname optional"},
+
+    {ID_GetClass,                "getClass",2 ,             "gc",
+    "Clients.cimcli.CIMCLIClient.GC_COMMAND_HELP",
+    "Get class of <classname>"},
+
+    {ID_GetInstance,             "getInstance",   2 ,       "gi",
+    "Clients.cimcli.CIMCLIClient.GI_COMMAND_HELP",
+    "Get instance of <objectname> | <classname> (interactive) |"
+    " <classname>  *<PropertyName=value> for equal property values."},
+
+    {ID_CreateInstance,          "createInstance",2 ,       "ci",
+    "Clients.cimcli.CIMCLIClient.CI_COMMAND_HELP",
+    "Create Instance of <Class> *<name=param> with defined properties"},
+
+    {ID_TestInstance,             "testInstance",   2 ,      "ti",
+    "Clients.cimcli.CIMCLIClient.TI_COMMAND_HELP",
+    "Test instance  of <objectname>  *<name=value> |"
+    " <classname>  *<PropertyName=value> for equal property values." },
+
+    {ID_DeleteInstance,          "deleteInstance",2 ,       "di",
+    "Clients.cimcli.CIMCLIClient.DI_COMMAND_HELP",
+    "Delete Instance of <objectname> | "
+    "<classname> *<keyPropertyName=value> | "
+    "interactive of <className>"},
+
+    {ID_CreateClass   ,          "createClass",   2 ,       "cc",
+    "Clients.cimcli.CIMCLIClient.CC_COMMAND_HELP",
+    "Not supported"},
+
+    {ID_ModifyInstance,          "modifyInstance",2 ,       "mi",
+    "Clients.cimcli.CIMCLIClient.MI_COMMAND_HELP",
+    "Modify Instance of <objectname> *<name=value> "
+    "| <classname> *<name=value>"},
+
+    {ID_DeleteClass,             "deleteClass",   2 ,       "dc",
+    "Clients.cimcli.CIMCLIClient.DC_COMMAND_HELP",
+    "Delete Class of <classname>"},
+
+    {ID_GetProperty,             "getProperty",   2 ,       "gp",
+    "Clients.cimcli.CIMCLIClient.GP_COMMAND_HELP",
+    "get single property of <object name>"},
+
+    {ID_SetProperty,             "setProperty",   2 ,       "sp",
+    "Clients.cimcli.CIMCLIClient.SP_COMMAND_HELP",
+    "set a single property of <object-name>"},
+
+    {ID_GetQualifier,            "getQualifier",  2 ,       "gq",
+    "Clients.cimcli.CIMCLIClient.GQ_COMMAND_HELP",
+    "Get Qualifier of <qualifiername>"},
+
+    {ID_SetQualifier,            "setQualifier",  2 ,       "sq",
+    "Clients.cimcli.CIMCLIClient.SQ_COMMAND_HELP",
+    "Not suported"},
+
+    {ID_EnumerateQualifiers,     "enumerateQualifiers",2 ,  "eq",
+    "Clients.cimcli.CIMCLIClient.EQ_COMMAND_HELP",
+    "Enumerate all Qualifiers"},
+
+    {ID_DeleteQualifier,         "deleteQualifier",  2 ,    "dq",
+    "Clients.cimcli.CIMCLIClient.DQ_COMMAND_HELP",
+    "Delete qualifer of <qualifiername>"},
+
+    {ID_Associators,             "associators",   2 ,       "a" ,
+    "Clients.cimcli.CIMCLIClient.A_COMMAND_HELP",
+    "Enumerate Associators of <classname> | <instancename>."},
+
+    {ID_AssociatorNames,         "associatorNames", 2 ,     "an",
+    "Clients.cimcli.CIMCLIClient.AN_COMMAND_HELP",
+    "Enumerate Associator Names of <classname> | <instancename>"},
+
+    {ID_References,              "references",      2,      "r",
+    "Clients.cimcli.CIMCLIClient.R_COMMAND_HELP",
+    "Enumerate References of <classname> | <instancename>"},
+
+    {ID_ReferenceNames,          "referenceNames",2 ,       "rn",
+    "Clients.cimcli.CIMCLIClient.RN_COMMAND_HELP",
+    "Enumerate Reference Names <classname> | <instancename>"},
+
+    {ID_InvokeMethod,            "invokeMethod",  2 ,       "im",
+    "Clients.cimcli.CIMCLIClient.IM_COMMAND_HELP",
+    "Invoke Method for <object> <method> {<inputParams>}"},
+
+    {ID_ExecQuery,               "execQuery",     2 ,       "xq",
+    "Clients.cimcli.CIMCLIClient.XQ_COMMAND_HELP",
+    " Execute Query <query-expresssion> [<query-language>]"},
+
+    {ID_EnumerateNamespaces,     "enumerateNamespaces",2 ,  "ns",
+    "Clients.cimcli.CIMCLIClient.NS_COMMAND_HELP",
+    "Enumerate all namespaces on the server."},
+
+    {ID_StatisticsOn,            "Turn On Statistics",2 ,   "son",
+    "Clients.cimcli.CIMCLIClient.SON_COMMAND_HELP",
+    "Turn on CIM Server Statistics Gathering"},
+
+    {ID_StatisticsOff,           "Turn Off Statistics",2 ,  "soff",
+    "Clients.cimcli.CIMCLIClient.SOFF_COMMAND_HELP",
+    "Turn off CIM Server Statistics Gathering"},
+
+    {ID_ShowOptions,             "show command options",2 ,  "?",
+    "Clients.cimcli.CIMCLIClient.?_COMMAND_HELP",
+    "Show List of Commands"}
+// FUTURE
+//  ,
+//  {ID_Profile,             "show profiles",2 ,  "?",
+//  "Clients.cimcli.CIMCLIClient.?_PROFILE_HELP",
+//  "Show List of Commands"}
+};
+
+const Uint32 NUM_OPERATIONS =
+    sizeof(OperationTable) / sizeof(OperationTable[0]);
+
+/*
+    The following table defines the Example strings and supported options
+    strings for all cimcli commands defined in the operations table
+    along with the strings that define the corresponding text bundle strings.
+    NOTE: This table MUST BE ordered the same as the CommandTable since the
+    primary user assume that the index to a command is the same as the
+    index into this table.
+*/
+
+OperationExampleEntry OperationExamples[] = {
+    {"Clients.cimcli.CIMCLIClient.NI_COMMAND_EXAMPLE",
+    "cimcli ni -n test/TestProvider TST_Person\n"
+        "    -- Enumerate Instance Names of class TST_Person\n",
+    "Clients.cimcli.CIMCLIClient.NI_COMMAND_OPTIONS",
+    "    -n\n"},
+
+    {"Clients.cimcli.CIMCLIClient.NIALL_COMMAND_EXAMPLE",
+    "cimcli niall -n root/cimv2\n"
+        "    -- Enumerate Instance Names of  all classes under\n"
+        "       the namespace root/cimv2\n",
+    "Clients.cimcli.CIMCLIClient.NIALL_COMMAND_OPTIONS",
+    "    -n, -di\n"},
+
+    {"Clients.cimcli.CIMCLIClient.EI_COMMAND_EXAMPLE",
+    "cimcli ei PG_ComputerSystem   -- Enumerate Instances of class\n",
+    "Clients.cimcli.CIMCLIClient.EI_COMMAND_OPTIONS",
+    "    -n, -di, -lo, -iq, -pl\n"},
+
+    {"Clients.cimcli.CIMCLIClient.NC_COMMAND_EXAMPLE",
+    "cimcli nc -- Enumerate class names from root/cimv2.\n",
+    "Clients.cimcli.CIMCLIClient.NC_COMMAND_OPTIONS",
+    "    -n, -di\n"},
+
+    {"Clients.cimcli.CIMCLIClient.EC_COMMAND_EXAMPLE",
+    "cimcli ec -n root/cimv2\n"
+        "    -- Enumerate classes from namespace root/cimv2.\n",
+    "Clients.cimcli.CIMCLIClient.EC_COMMAND_OPTIONS",
+    "    -n, -di, -lo, -iq\n"},
+
+    {"Clients.cimcli.CIMCLIClient.GC_COMMAND_EXAMPLE",
+    "cimcli gc CIM_door -u guest -p guest\n"
+        "    -- Get class user = guest and password = guest.\n",
+    "Clients.cimcli.CIMCLIClient.GC_COMMAND_OPTIONS",
+    "    -n, -lo, -iq, -pl\n"},
+
+    {"Clients.cimcli.CIMCLIClient.GI_COMMAND_EXAMPLE",
+    "cimcli gi -n test/TestProvider TST_Person\n"
+        "    -- Get Instance of class\n",
+    "Clients.cimcli.CIMCLIClient.GI_COMMAND_OPTIONS",
+    "    -n, -lo, -iq, -pl\n"},
+
+    {"Clients.cimcli.CIMCLIClient.CI_COMMAND_EXAMPLE",
+    "cimcli ci -n test/TestProvider TST_Person Name=Mike SSN=333\n"
+        "    -- Create Instance of  class TST_Person with properties\n"
+        "       Name= Mike and SSN= 333\n",
+    "Clients.cimcli.CIMCLIClient.CI_COMMAND_OPTIONS",
+    "    -n\n"},
+
+    {"Clients.cimcli.CIMCLIClient.TI_COMMAND_EXAMPLE",
+    "cimcli ti -n test/TestProvider TST_Person Name=Mike SSN=333\n"
+        "    -- Test Instance of  class for equality of Name and SSN\n"
+        "       properties. Returns error code if instance in server\n"
+        "       does not have same properties and values as the\n"
+        "       instance built from input\n",
+    "Clients.cimcli.CIMCLIClient.TI_COMMAND_OPTIONS",
+    "    -n -pl\n"},
+
+    {"Clients.cimcli.CIMCLIClient.DI_COMMAND_EXAMPLE",
+    "cimcli di -n test/TestProvider TST_Person\n"
+        "    -- Delete Instance of class TST_Person interactively\n"
+        "or\n"
+    " cimcli di -n test/TestProvider TST_Person name=Mike\n"
+        "    -- Delete Instance of class TEST_Persion with key property\n"
+        "       name equal Mike using instance builder format to\n"
+        "       define object path\n"
+        "or\n"
+    " cimcli di -n test/TestProvider TST_Person.name=\\\\\"Mike\\\\\"\n"
+        "    -- Delete Instance of class TST_Persion with object path\n"
+        "       TST_Person.name=\"Mike\" using object path input format\n",
+    "Clients.cimcli.CIMCLIClient.DI_COMMAND_OPTIONS",
+    "    -n\n"},
+
+    // Create Class Not Supported
+    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
+    "Operation Not supported..\n",
+    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
+    "\n"},
+
+    // Modify Instance
+    {"Clients.cimcli.CIMCLIClient.MI_COMMAND_EXAMPLE",
+    "cimcli mi -n test/TestProvider TST_Person.Id=\\\\\"Mike\\\\\" SSN=444\n"
+    "    -- Modifies the Instance if it exists using rules of DMTF \n"
+    "       modifyInstance operation.\n",
+    "Clients.cimcli.CIMCLIClient.MI_COMMAND_OPTIONS",
+    "-n -pl (define properties to be modified)\n "},
+
+    {"Clients.cimcli.CIMCLIClient.DC_COMMAND_EXAMPLE",
+    "cimcli dc -n test/TestProvider TST_Person\n"
+        "    -- Deletes the Class when there are no instances and\n"
+        "       sub-classes for this class\n",
+    "Clients.cimcli.CIMCLIClient.DC_COMMAND_OPTIONS",
+    "    -n\n"},
+
+    // getProperty
+    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
+        "cimcli gp -n test/TestProvider TST_Person.Id=\\\\\"Mike\\\\\" SSN \n"
+            "    -- Get the property named SSN from the instance\n"
+            "       defined by TST_Person.Id=\"Mike\"",
+    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
+    "\n"},
+
+    // setProperty
+    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
+        "cimcli sp -n test/TestProvider TST_Person.Id=\\\\\"Mike\\\\\""
+        " SSN=333 \n"
+            "    -- Set the property named SSS in the instance\n"
+            "       defined by TST_Person.Id=\"Mike\")",
+    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
+    "\n"},
+
+    {"Clients.cimcli.CIMCLIClient.GQ_COMMAND_EXAMPLE",
+    "cimcli gq Association\n"
+        "    -- Get the qualifier named Association in mof output\n"
+        "       in the default namespace (normally root/cimv2)",
+    "Clients.cimcli.CIMCLIClient.GQ_COMMAND_OPTIONS",
+    "    -n\n"},
+
+    // setQualifier
+    {"Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
+    "Operation Not supported..\n",
+    "Clients.cimcli.CIMCLIClient.OPERATION_NOT_SUPPORTED",
+    "\n"},
+
+    {"Clients.cimcli.CIMCLIClient.EQ_COMMAND_EXAMPLE",
+    "cimcli eq -n test/TestProvider\n"
+        "    -- Enumerate Qualifiers of namespace test/TestProvider\n",
+    "Clients.cimcli.CIMCLIClient.EQ_COMMAND_OPTIONS",
+    "    -n\n"},
+
+    {"Clients.cimcli.CIMCLIClient.DQ_COMMAND_EXAMPLE",
+    "cimcli dq -n test/TestProvider ASSOCIATION\n"
+        "    -- Delete Qualifier named ASSOCIATION in namespace\n"
+        "       test/TestProvider\n",
+    "Clients.cimcli.CIMCLIClient.DQ_COMMAND_OPTIONS",
+    "    -n, qualifierName\n"},
+
+    {"Clients.cimcli.CIMCLIClient.A_COMMAND_EXAMPLE",
+    "cimcli a TST_Person.name=\\\\\"Mike\\\\\" -n test/TestProvider"
+        "  -ac TST_Lineage\n -rc TST_Person\n"
+        "    -- get associations for instances of association class\n"
+        "       TST_Lineage and result class TST_Person\n"
+        "       associated with instance of TST_person with key\n"
+        "       \"Mike\" in namespace test/TestProvider\n"
+        "or\n"
+        " cimcli a TST_Person -n test/TestProvider -ac TST_Lineage\n"
+        "    -- get associated classes for all instances of classes\n"
+        "       associated with class TST_person and with\n"
+        "       association class TST_Lineage\n"
+        "or\n"
+        " cimcli a TST_Person -n test/TestProvider -ac TST_Lineage -i\n"
+        "    -- get associated instances by selecting interactively for\n"
+        "       classes  associated with class TST_person and with\n"
+        "       association class TST_Lineage\n",
+    "Clients.cimcli.CIMCLIClient.A_COMMAND_OPTIONS",
+    "    -n, -ac, -rc, -r, -rr, -iq, -pl, includeClassOrigin, -i\n"},
+
+    {"Clients.cimcli.CIMCLIClient.AN_COMMAND_EXAMPLE",
+    "cimcli an TST_Person.name=\\\\\"Mike\\\\\" -n test/TestProvider "
+        "-ac TST_Lineage\n"
+        "or\n"
+        " cimcli an TST_Person -n test/TestProvider -ac TST_Lineage\n",
+    "Clients.cimcli.CIMCLIClient.AN_COMMAND_OPTIONS",
+    "    -n, -ac, -rc, -r, -rr, -i\n"},
+
+    {"Clients.cimcli.CIMCLIClient.R_COMMAND_EXAMPLE",
+    "cimcli r TST_Person.name=\\\\\"Mike\\\\\" -n test/TestProvider"
+        " -rc TST_Lineage\n"
+        "    -- get references for instances association class TST_Lineage\n"
+        "       associated with instance of TST_person with key\n"
+        "       \"Mike\" in namespace test/TestProvider\n"
+        "or\n"
+    " cimcli r TST_Person.name=\\\\\"Mike\\\\\" -n test/TestProvider\n"
+        "    -- get references for all instances of classes\n"
+        "       associated with instance of TST_person with key\n"
+        "       \"Mike\" in namespace test/TestProvider\n"
+        "or\n"
+        " cimcli r TST_Person -n test/TestProvider -rc TST_Lineage\n"
+        "    -- get reference classes for TST_Lineage association class and\n"
+        "       subclasses in namespace test/TestProvider\n",
+    "Clients.cimcli.CIMCLIClient.R_COMMAND_OPTIONS",
+    "    -n, -rc, -r, -iq, -pl, -i\n"},
+
+    {"Clients.cimcli.CIMCLIClient.RN_COMMAND_EXAMPLE",
+    "cimcli rn TST_Person.name=\\\\\"Mike\\\\\" -n test/TestProvider "
+        "-rc TST_Lineage\n"
+        "    -- get referenceNames for instances association class\n"
+        "       TST_Lineage associated with instance of TST_person with key\n"
+        "       \"Mike\" in namespace test/TestProvider\n"
+        "or\n"
+    " cimcli rn TST_Person.name=\\\\\"Mike\\\\\" -n test/TestProvider\n"
+        "    -- get referenceNames for all instances of classes\n"
+        "       associated with instance of TST_person with key\n"
+        "       \"Mike\" in namespace test/TestProvider\n"
+        "or\n"
+        " cimcli rn TST_Person -n test/TestProvider -rc TST_Lineage\n"
+        "    -- get referenceNames for Class TST_Lineage in namespace\n"
+        "       test/TestProvider\n",
+    "Clients.cimcli.CIMCLIClient.RN_COMMAND_OPTIONS",
+    "    -n, -rc, -r, -i\n"},
+
+    {"Clients.cimcli.CIMCLIClient.IM_COMMAND_EXAMPLE",
+    "cimcli im Sample_MethodProviderClass.Name=\\\\\"mooo\\\\\" SayHello\n"
+        "    -n root/SampleProvider -ip p1=fred\n",
+    "Clients.cimcli.CIMCLIClient.IM_COMMAND_OPTIONS",
+        "    -n, -ip\n"},
+
+    {"Clients.cimcli.CIMCLIClient.XQ_COMMAND_EXAMPLE",
+    "cimcli xq \"select * from CIM_ComputerSystem\"\n"
+        "    -- This command will work when the code is compiled with\n"
+        "       ExecQuery enabled\n",
+    "Clients.cimcli.CIMCLIClient.XQ_COMMAND_OPTIONS",
+    "    -n, queryLanguage, query\n"},
+
+    {"Clients.cimcli.CIMCLIClient.NS_COMMAND_EXAMPLE",
+    "cimcli ns  -- Enumerate all Namespaces in repository\n",
+    "Clients.cimcli.CIMCLIClient.NO_OPTIONS_REQUIRED",
+    " No options Required\n"},
+
+    {"Clients.cimcli.CIMCLIClient.SON_COMMAND_EXAMPLE",
+    "cimcli son  -- Switch On's the statistical information on CIMServer\n",
+    "Clients.cimcli.CIMCLIClient.NO_OPTIONS_REQUIRED",
+    " No options Required\n"},
+
+    {"Clients.cimcli.CIMCLIClient.SOFF_COMMAND_EXAMPLE",
+    "cimcli soff  -- Switch OFF's the statistical information on CIMServer\n",
+    "Clients.cimcli.CIMCLIClient.NO_OPTIONS_REQUIRED",
+    " No options Required\n"},
+
+    {"Clients.cimcli.CIMCLIClient.?_COMMAND_EXAMPLE",
+    "cimcli ?  -- Displays help command\n",
+    "Clients.cimcli.CIMCLIClient.NO_OPTIONS_REQUIRED",
+    "    No options Required"}
+//  ,
+//
+//  {"Clients.cimcli.CIMCLIClient.?_PROFILE_EXAMPLE",
+//  "cimcli profiles  -- Displays registered profiles\n",
+//  "Clients.cimcli.CIMCLIClient.PROFILE_COMMAND_OPTIONS",
+//  "     -n"}
+};
+
+const Uint32 NUM_EXAMPLES = sizeof(OperationExamples) /
+                            sizeof(OperationExamples[0]);
+
+
+/*
+   Operations Class implements the operations on the OperationTable and
+   Examples table above.
+*/
+Operations::Operations()
+{
+    _index = 0;
+}
+
+Boolean Operations::find(const String& opString)
+{
+    for( _index = 0 ; _index < NUM_OPERATIONS; _index++ )
+    {
+        if ((String::equalNoCase(opString,
+                OperationTable[_index].OperationName))
+                ||
+                (opString == OperationTable[_index].ShortCut))
+        {
+            return true;
+        }
+    }
+    return false;
+}
+
+OperationTableEntry Operations::get()
+{
+    return OperationTable[_index];
+}
+
+Uint32 Operations::getIndex()
+{
+    return _index;
+}
+
+Boolean Operations::more()
+{
+    return (_index < NUM_OPERATIONS)? true : false;
+}
+
+// Note that this method has NO range check so MUST BE used
+// with more()
+OperationTableEntry Operations::next()
+{
+    return OperationTable[_index++];
+}
+
+OperationExampleEntry Operations::getExampleEntry()
+{
+    return OperationExamples[_index];
+}
+
+
+PEGASUS_NAMESPACE_END
+// END_OF_FILE
diff --git a/src/Clients/cimcli/CIMCLIOperations.h b/src/Clients/cimcli/CIMCLIOperations.h
new file mode 100644 (file)
index 0000000..36f46c4
--- /dev/null
@@ -0,0 +1,174 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+/*
+    Definition of the operations possible with cimcli. An operation is
+    defined by a cimcli operation name (the first parameter on the command
+    line input) and an operation function in CIMCLIClient.
+    The structures below and their corresponding tables in CIMCLIOperations.cpp
+    define the names, characteristics, usage, etc. for all operations
+    in cimcli.
+*/
+#ifndef _CLI_OPERATIONS_H
+#define _CLI_OPERATIONS_H
+
+#include <Pegasus/Common/Config.h>
+#include <Clients/cimcli/Linkage.h>
+#include <Pegasus/Common/PegasusAssert.h>
+
+#include <Pegasus/General/Stopwatch.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+/*
+    Definition of the cimcli Operations (Second Parameter on input).
+*/
+
+// Enumeration of all possible operations
+enum OperationID {
+  ID_EnumerateInstanceNames = 1,
+  ID_EnumerateInstances        ,
+  ID_GetClass                  ,
+  ID_GetInstance               ,
+  ID_CreateInstance            ,
+  ID_DeleteInstance            ,
+  ID_CreateClass               ,
+  ID_DeleteClass               ,
+  ID_EnumerateClasses          ,
+  ID_EnumerateClassNames       ,
+  ID_GetProperty               ,
+  ID_SetProperty               ,
+  ID_GetQualifier              ,
+  ID_SetQualifier              ,
+  ID_EnumerateQualifiers       ,
+  ID_DeleteQualifier           ,
+  ID_Associators               ,
+  ID_AssociatorNames           ,
+  ID_References                ,
+  ID_ReferenceNames            ,
+  ID_InvokeMethod              ,
+  ID_ExecQuery                 ,
+  ID_ModifyClass               ,
+  ID_ModifyInstance            ,
+  ID_EnumerateAllInstanceNames ,
+  ID_EnumerateNamespaces       ,
+  ID_ShowOptions               ,
+  ID_StatisticsOn              ,
+  ID_StatisticsOff             ,
+  ID_TestInstance              ,
+//ID_Profile                   ,
+};
+/*
+    Structure for the Operation Table.  This table is used to define the
+    allowed input operations (The initial parameter on the command line)
+    The table of commands is defined in CIMCLIOperations.cpp.
+*/
+struct  OPERATION_TABLE_ENTRY
+{
+    OperationID ID_Operation;
+    const char* OperationName;  // Name for the operation. Used as operation
+                                // name (long name) and link to OptionManager
+    int minNumArgs;             // minimum number of input args to accept cmd
+    const char* ShortCut;       // shortcut operation name (nc for classNames)
+    const char* msgKey;         //Message key for globalization
+    const char* UsageText;      // Simple usage text
+};
+
+/*
+    today there is a second table with a single entry corresponding to each
+    entry in the OperationTable.  This contains additional text and message
+    keys for the operation
+    NOTE: This should really be a single table but since this secondary table
+    was built instead of expanding the operation table it is left that way.
+    Also this makes the operation table a bit easier to understand since the
+    table is smaller.
+*/
+typedef struct OPERATION_TABLE_ENTRY OperationTableEntry;
+
+struct OPERATION_EXAMPLE_ENTRY
+{
+    const char* msgKey;   //Message key for globalization of example string
+    const char* Example;  //Example String
+    const char* optionsKey; //Message key for options supported string
+    const char* Options;  //Options supported
+};
+
+typedef struct OPERATION_EXAMPLE_ENTRY OperationExampleEntry;
+
+/////////////////////////////////////////////////////////////////////////////
+/***************** Command / Operation table processing ********************
+    Class to process the CommandTable which defines all of the
+    cimcli operations.
+    This class provides for two types of operations (find followed by
+    get) to get a particular command and more() next() to iterate the
+    complete table.
+    This allows cimcli to process the operations and examples table without
+    knowledge other than  the two structs above and the methods in this
+    class
+*/
+
+class PEGASUS_CLI_LINKAGE Operations
+{
+public:
+    Operations();
+
+    // find the operation defined by  opString.  Return true if found
+    // or false if not found.
+    Boolean find(const String& opString);
+
+    // return the current position in the table. Normally follows
+    // the find command to get the entry found.
+    OperationTableEntry get();
+
+    // get the Index for the current entry.  This is required only because
+    // there are two tables today that use the index (the command table
+    // and the examples table.
+    Uint32 getIndex();
+
+    // Determine if there are more entries in the table. Returns true
+    // if there are more entries in the table
+    Boolean more();
+
+    // get the current entry in the table and increment the internal
+    // pointer to the next entry.
+    OperationTableEntry next();
+
+    // get the current example table entry
+    OperationExampleEntry getExampleEntry();
+private:
+    Uint32 _index;
+};
+
+
+PEGASUS_NAMESPACE_END
+
+#endif
+
diff --git a/src/Clients/cimcli/CIMCLIOptionStruct.cpp b/src/Clients/cimcli/CIMCLIOptionStruct.cpp
new file mode 100644 (file)
index 0000000..e07ca00
--- /dev/null
@@ -0,0 +1,151 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+/*
+    This file defines the a structure and functions to manage the command
+    line input parameters and options and communicate this information
+    between the parsing mechanisms and the operation action functions.
+    One
+*/
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/FileSystem.h>
+#include <Pegasus/Common/XmlWriter.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/StringConversion.h>
+#include <Pegasus/Common/ArrayInternal.h>
+
+#include <Pegasus/Common/PegasusVersion.h>
+
+#include <Pegasus/General/MofWriter.h>
+
+#include "CIMCLIClient.h"
+
+#include "ObjectBuilder.h"
+#include "CIMCLIOutput.h"
+#include "CIMCLIHelp.h"
+#include "CIMCLIOptions.h"
+#include "CIMCLICommon.h"
+
+PEGASUS_USING_STD;
+PEGASUS_NAMESPACE_BEGIN
+
+/******************************************************************************
+**
+**             Option Structure object. Initialization and any other
+**             used Function Definitions
+**
+******************************************************************************/
+
+// Constructor - Instantiate the variables of the structure
+OptionStruct::OptionStruct():
+    isXmlOutput(false),
+
+    deepInheritance(false),
+    localOnly(true),
+    includeQualifiers(true),
+    includeClassOrigin(false),
+
+    verboseTest(false),
+    summary(false),
+    delay(0),
+    trace(0),
+    debug(false),
+
+    count(29436),
+    executeCountTest(false),
+    repeat(0),
+    time(false),
+    termCondition(0)
+{
+        // Initialize the option structure values
+        location =  String();
+#ifdef PEGASUS_HAS_SSL
+        ssl = false;
+        clientCert = String();
+        clientKey = String();
+#endif
+        nameSpace = String();
+        cimCmd = "unknown";
+        targetObjectName = CIMObjectPath();
+
+        outputFormatType = OUTPUT_MOF;
+
+        user = String();
+        password = String();
+
+        assocClass = CIMName();
+        resultClass = CIMName();
+        role = String::EMPTY;
+        resultRole = String();
+        propertyList.clear();
+        propertyName = String();
+        methodName = CIMName("unknown");
+        queryLanguage = "WQL";
+}
+
+/*
+    Get the String for the current targetObject
+*/
+String OptionStruct::getTargetObjectNameStr()
+{
+    return(targetObjectName.toString());
+}
+
+/*
+    get the class name for the targetObject for this operation
+*/
+CIMName OptionStruct::getTargetObjectNameClassName()
+{
+    return(targetObjectName.getClassName());
+}
+
+/*
+    get the targetObjectName
+*/
+CIMObjectPath OptionStruct::getTargetObjectName()
+{
+    return(targetObjectName);
+}
+
+/*
+    Return true of the target object is a class with no keys.
+    Since there is no such thing as a no key class, this means that
+    the user input only the classname.
+*/
+Boolean OptionStruct::targetObjectNameClassOnly()
+{
+    return(targetObjectName.getKeyBindings().size() == 0);
+}
+
+PEGASUS_NAMESPACE_END
+// END_OF_FILE
diff --git a/src/Clients/cimcli/CIMCLIOptionStruct.h b/src/Clients/cimcli/CIMCLIOptionStruct.h
new file mode 100644 (file)
index 0000000..1597518
--- /dev/null
@@ -0,0 +1,196 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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 _CLI_CLIOPTIONSSTRUCT_H
+#define _CLI_CLIOPTIONSSTRUCT_H
+
+#include <Pegasus/Common/Config.h>
+#include <Clients/cimcli/Linkage.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Client/CIMClient.h>
+#include <Clients/cimcli/CIMCLIClient.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+/******************************************************************************
+**
+**          Data structure definitions for the Output Type
+**          Defines a data type, enums for the various output types
+**          and a table to map
+**
+******************************************************************************/
+
+typedef int     OutputType;
+const OutputType    OUTPUT_XML                  = 1;
+const OutputType    OUTPUT_MOF                  = 2;
+const OutputType    OUTPUT_TEXT                 = 3;
+const OutputType    OUTPUT_FILE                 = 4;
+const OutputType    OUTPUT_TABLE                = 5;
+
+struct  OUTPUT_STRUCT
+{
+    int OutputType;
+    const char* OutputName;
+};
+
+static OUTPUT_STRUCT OutputTable[] =
+{
+    // Output Type      OutputName
+    {   OUTPUT_XML,     "xml"   },
+    {   OUTPUT_MOF,     "mof"   },
+    {   OUTPUT_TEXT,    "txt"   },
+    {   OUTPUT_TABLE,   "table" }
+};
+static const Uint32 NUM_OUTPUTS = sizeof(OutputTable) / sizeof(OutputTable[0]);
+
+
+/******************************************************************************
+**
+**          Data structure definitions for the input Options
+**          Defines a data struct, and a typedef for the collection of
+**          parameters that represent the result of cimcli input processing
+**          The OptionStruct structure and functions manage the command
+**          line input parameters and options and communicate this information
+**          between the parsing mechanisms and the operation action functions.
+**          One instance of this object is created and maintained for each
+**          operation processed
+**
+******************************************************************************/
+
+// The input options used by the individual commands. Note that
+// Use of these varies by command.
+
+struct  OptionStruct
+{
+    // Structure Methods - constructor
+    // Sets up defaults for all variables in the structure
+    OptionStruct();
+
+    // TargetObject Processing Methods
+    String getTargetObjectNameStr();
+    CIMName getTargetObjectNameClassName();
+    CIMObjectPath getTargetObjectName();
+
+    // true if is class only (no keyBindings)
+    Boolean targetObjectNameClassOnly();
+    //
+    // Variables used by cimcli operations
+    //
+    CIMClient client;           // CIMClient object for communciation
+    String location;            // Host parameter
+    String user;                // User name input parameter
+    String password;            // password input parameter
+#ifdef PEGASUS_HAS_SSL          // SSL input parameters
+    Boolean ssl;
+    String clientCert;          // client Certificate path
+    String clientKey;           // client Key path
+#endif
+
+    // The following variables represent the input Object Name parameter,
+    // normally the second argument to the input command.
+    String nameSpace;             // Input namespace
+                                  //
+    CIMName className;            // inputObjectName mapped to class name
+    CIMObjectPath targetObjectName; // target Name for this request with
+                                  // format validated by conversion
+    String inputObjectName;       // Name to display as input target object on
+                                  // error. Allows display whether class or
+                                  // object input or error.
+
+    String qualifierName;         // used if qualifier action function.
+
+    String cimCmd;                // Command name
+
+    // output format pamameter information
+    String outputFormat;
+    Boolean isXmlOutput;
+    int outputFormatType;
+    OutputType outputType;
+
+    // CIM operation parameter input parameters
+    Boolean deepInheritance;
+    Boolean localOnly;
+    Boolean includeQualifiers;
+    Boolean includeClassOrigin;
+    CIMValue newValue;
+
+    CIMQualifierDecl qualifierDeclaration;
+
+    String propertyName;
+    CIMPropertyList propertyList;
+
+    // Associaton/reference specific input parameters
+    CIMName assocClass;
+    CIMName resultClass;
+    String role;
+    String resultRole;
+
+    String queryLanguage;
+    String query;
+
+    // InvokeMethod specific input parameters
+    CIMName methodName;
+    Array<CIMParamValue> inParams;
+
+    // General parameters that modify results
+    Boolean verboseTest;        // Verbose output during processing
+    Boolean summary;            // Do summary information
+    Uint32 delay;               // Delay between connect and command
+    Uint32 trace;               // Trace cimcli
+    Boolean debug;              // Execute cimcli in debug mode
+
+    Uint32 count;               // Number of expected items if
+                                // count test is to be executed.
+    Boolean executeCountTest;   // Execute the count test if true
+                                // Separate because ANY value can exist
+                                // for the count itself.
+    Uint32 repeat;              // execute the operation repeat times
+    Boolean time;               // report time for operation
+
+    Uint32 termCondition;       // Termination code put here by action function
+
+    Uint32 connectionTimeout;    // Connection timeout in seconds
+    Array<String> valueParams;   // additional param list. depends on command.
+    Boolean interactive;
+
+    // Internal work variables
+    Stopwatch elapsedTime;
+    double saveElapsedTime;
+};
+
+typedef struct OptionStruct Options;
+
+
+
+PEGASUS_NAMESPACE_END
+
+#endif
+
diff --git a/src/Clients/cimcli/CIMCLIOptions.cpp b/src/Clients/cimcli/CIMCLIOptions.cpp
new file mode 100644 (file)
index 0000000..4e43753
--- /dev/null
@@ -0,0 +1,667 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+/*******************************************************************************
+*
+* Command line options processing.  All option processing is based on the
+* Pegasus OptionManager and the definition of options contained in this
+* file. This file also contains the funtions to process input options.
+*
+* Once processed, the input options are placed into the options structure
+* to be passed to the operation processors.
+*
+*******************************************************************************/
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/FileSystem.h>
+#include <Pegasus/Common/XmlWriter.h>
+#include <Pegasus/General/MofWriter.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/StringConversion.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include <Pegasus/Common/PegasusVersion.h>
+
+#include "CIMCLIOptions.h"
+#include "CIMCLIClient.h"
+#include "CIMCLIHelp.h"
+#include "CIMCLICommon.h"
+#include "CIMCLIClient.h"
+
+PEGASUS_USING_STD;
+PEGASUS_NAMESPACE_BEGIN
+
+/*******************************************************************************
+**
+**  BuildOptionsTable
+**
+*******************************************************************************/
+/*
+    This function builds the complete options table from the entries defined
+    below.  It then merges in the options from any config file and from any
+    command line parameters. Thus, the command line parameters will override
+    any config file parameters.
+*/
+void BuildOptionsTable(
+    OptionManager& om,
+    int& argc,
+    char** argv,
+    const String& testHome)
+{
+    // Table of available options to be used by cimcli.  Each of the possible
+    // options is defined in one entry in the table below.
+
+    static const char* outputFormats[] = { "xml", "mof", "txt", "table"};
+    static const Uint32 NUM_OUTPUTFORMATS = sizeof(outputFormats) /
+                                            sizeof(outputFormats[0]);
+    static OptionRowWithMsg optionsTable[] =
+        //optionname defaultvalue rqd  type domain domainsize clname msgkey
+        // hlpmsg
+    {
+        // FUTURE TODO.  This strange number was a way to tell option parser
+        // that the option was not found on the command line.  That concept
+        //  does not exist today in the OptionManager. The error mechanism
+        // tells you whether the option name is defined not whether there was
+        // an option supplied.  Need to fix OptionManager
+        {"count", "29346", false, Option::WHOLE_NUMBER, 0, 0, "count",
+        "Clients.cimcli.CIMCLIClient.COUNT_OPTION_HELP",
+        "Expected count of objects returned if summary set.\n"
+            "    Tests this count and display difference.\n"
+            "    Return nonzero if test fails"},
+
+        {"debug", "false", false, Option::BOOLEAN, 0, 0, "d",
+        "Clients.cimcli.CIMCLIClient.DEBUG_OPTION_HELP",
+        "More detailed debug messages"},
+
+        {"delay", "0", false, Option::WHOLE_NUMBER, 0, 0, "delay",
+        "Clients.cimcli.CIMCLIClient.DELAY_OPTION_HELP",
+        "Delay between connection and request"},
+
+        {"Password", "", false, Option::STRING, 0, 0, "p",
+        "Clients.cimcli.CIMCLIClient.PASSWORD_OPTION_HELP",
+        "Defines password for authentication" },
+
+        {"location", "", false, Option::STRING, 0, 0, "l",
+        "Clients.cimcli.CIMCLIClient.LOCATION_OPTION_HELP",
+        "Specifies system and port (HostName:port).\n"
+            "    Port is optional" },
+
+#ifdef PEGASUS_HAS_SSL
+        {"ssl", "false", false, Option::BOOLEAN, 0, 0, "s",
+        "Clients.cimcli.CIMCLIClient.SSL_OPTION_HELP",
+        "Specifies to connect over HTTPS" },
+
+        {"clientCert", "", false, Option::STRING, 0, 0, "-cert",
+        "Clients.cimcli.CIMCLIClient.CLIENTCERT_OPTION_HELP",
+        "Specifies a client certificate file path to present to the server.\n"
+            "    This is optional and only has an effect on connections\n"
+            "    made over HTTPS using -s" },
+
+        {"clientKey", "", false, Option::STRING, 0, 0, "-key",
+        "Clients.cimcli.CIMCLIClient.CLIENTKEY_OPTION_HELP",
+        "Specifies a client private key file path.\n"
+            "    This is optional and only has an effect on connections\n"
+            "    made over HTTPS using -s" },
+#endif
+        {"User", "", false, Option::STRING, 0, 0, "u",
+        "Clients.cimcli.CIMCLIClient.USER_OPTION_HELP",
+        "Defines User Name for authentication" },
+
+        {"namespace", "root/cimv2", false, Option::STRING, 0, 0, "n",
+        "Clients.cimcli.CIMCLIClient.NAMESPACE_OPTION_HELP",
+        "Specifies namespace to use for operation" },
+
+        {"deepInheritance", "false", false, Option::BOOLEAN, 0, 0, "di",
+        "Clients.cimcli.CIMCLIClient.DEEPINHERITANCE_OPTION_HELP",
+        "If set deepInheritance parameter\n"
+            "    set true"},
+
+        // TODO - Drop this option completely
+        {"localOnly", "true", false, Option::BOOLEAN, 0, 0, "lo",
+        "Clients.cimcli.CIMCLIClient.LOCALONLY_OPTION_HELP",
+        "DEPRECATED. This was used to set LocalOnly.\n"
+            "    However, default should be true and we cannot use True\n"
+            "    as default. See -nlo"},
+
+        {"notLocalOnly", "false", false, Option::BOOLEAN, 0, 0, "nlo",
+        "Clients.cimcli.CIMCLIClient.NOTLOCALONLY_OPTION_HELP",
+        "When set, sets LocalOnly = false on\n"
+            "    operations"},
+
+        // TODO - Deprecated so we should drop this one completely
+        {"includeQualifiers", "true", false, Option::BOOLEAN, 0, 0, "iq",
+        "Clients.cimcli.CIMCLIClient.INCLUDEQUALIFIERS_OPTION_HELP",
+        "DEPRECATED. Sets includeQualifiers = True.\n"
+            "    However, default=true"},
+
+        {"notIncludeQualifiers", "false", false, Option::BOOLEAN, 0, 0, "niq",
+        "Clients.cimcli.CIMCLIClient.NOTINCLUDEQUALIFIERS_OPTION_HELP",
+        "Sets includeQualifiers = false\n"
+            "    on operations"},
+
+        // Uses a magic string as shown below to indicate never used.
+        {"propertyList", "###!###", false, Option::STRING, 0, 0, "pl",
+        "Clients.cimcli.CIMCLIClient.PROPERTYLIST_OPTION_HELP",
+        "Defines a propertyNameList. Format is p1,p2,p3\n"
+            "    (without spaces). Use \"\" for empty"},
+
+        {"assocClass", "", false, Option::STRING, 0, 0, "ac",
+        "Clients.cimcli.CIMCLIClient.ASSOCCLASS_OPTION_HELP",
+        "Defines a assocation Class string for Associator calls"},
+
+        {"assocRole", "", false, Option::STRING, 0, 0, "ar",
+        "Clients.cimcli.CIMCLIClient.ASSOCROLE_OPTION_HELP",
+        "Defines a role string for Associators. AssocRole\n"
+            "    parameter"},
+
+        {"role", "", false, Option::STRING, 0, 0, "r",
+        "Clients.cimcli.CIMCLIClient.ROLE_OPTION_HELP",
+        "Defines a role string for reference role parameter"},
+
+        {"resultClass", "", false, Option::STRING, 0, 0, "rc",
+        "Clients.cimcli.CIMCLIClient.RESULTCLASS_OPTION_HELP",
+        "Defines a resultClass string for References and\n"
+            "    Associatiors"},
+
+        {"resultRole", "", false, Option::STRING, 0, 0, "rr",
+        "Clients.cimcli.CIMCLIClient.RESULTROLE_OPTION_HELP",
+        "Defines a role string for associators operation resultRole\n"
+            "    parameter"},
+
+        {"inputParameters", "", false, Option::STRING, 0, 0, "ip",
+        "Clients.cimcli.CIMCLIClient.INPUTPARAMETERS_OPTION_HELP",
+        "Defines an invokeMethod input parameter list.\n"
+            "    Format is p1=v1 p2=v2 .. pn=vn\n"
+            "    (parameters are seperated by spaces)"},
+
+        {"filter", "", false, Option::STRING, 0, 0, "f",
+        "Clients.cimcli.CIMCLIClient.FILTER_OPTION_HELP",
+        "Defines a filter to use for query. Single String input"},
+
+        // KS change the output formats to use the enum options function
+        // Deprecate this function.
+        {"outputformats", "mof", false, Option::STRING, 0,NUM_OUTPUTFORMATS,
+        "o",
+        "Clients.cimcli.CIMCLIClient.OUTPUTFORMATS_OPTION_HELP",
+        "Output in xml, mof, txt, table"},
+
+        {"xmlOutput", "false", false, Option::BOOLEAN, 0,0, "x",
+        "Clients.cimcli.CIMCLIClient.XMLOUTPUT_OPTION_HELP",
+        "Output objects in xml format"},
+
+        {"version", "false", false, Option::BOOLEAN, 0, 0, "-version",
+        "Clients.cimcli.CIMCLIClient.VERSION_OPTION_HELP",
+        "Displays software Version"},
+
+        {"verbose", "false", false, Option::BOOLEAN, 0, 0, "v",
+        "Clients.cimcli.CIMCLIClient.VERBOSE_OPTION_HELP",
+        "Verbose Display. Outputs etailed parameter input\n"
+            "    display and other request processing information"},
+
+        {"summary", "false", false, Option::BOOLEAN, 0, 0, "-sum",
+        "Clients.cimcli.CIMCLIClient.SUMMARY_OPTION_HELP",
+        "Displays only summary count for enumerations,\n"
+            "    associators, etc."},
+
+        {"help", "false", false, Option::BOOLEAN, 0, 0, "h",
+        "Clients.cimcli.CIMCLIClient.HELP_OPTION_HELP",
+        "Prints help usage message"},
+
+        {"full help", "false", false, Option::BOOLEAN, 0, 0, "-help",
+        "Clients.cimcli.CIMCLIClient.FULLHELP_OPTION_HELP",
+        "Prints full help message with commands, options,\n"
+            "    examples"},
+
+        {"help options", "false", false, Option::BOOLEAN, 0, 0, "ho",
+        "Clients.cimcli.CIMCLIClient.HELPOPTIONS_OPTION_HELP",
+        "Prints list of options"},
+
+        {"help commands", "false", false, Option::BOOLEAN, 0, 0, "hc",
+        "Clients.cimcli.CIMCLIClient.HELPCOMMANDS_OPTION_HELP",
+        "Prints CIM Operation command list"},
+
+        {"connecttimeout", "0", false, Option::WHOLE_NUMBER, 0, 0, "-timeout",
+        "Clients.cimcli.CIMCLIClient.CONNECTIONTIMEOUT_OPTION_HELP",
+        "Set the connection timeout in seconds."},
+
+        {"interactive", "false", false, Option::BOOLEAN, 0, 0, "i",
+        "Clients.cimcli.CIMCLIClient.INTERACTIVE_OPTION_HELP",
+        "Interactively ask user to select instances.\n"
+            "    Used with associator and reference operations"},
+
+        {"trace", "0", false, Option::WHOLE_NUMBER, 0, 0, "trace",
+        "Clients.cimcli.CIMCLIClient.TRACE_OPTION_HELP",
+        "Set Pegasus Common Components Trace. Sets the Trace level.\n"
+            "    0 is off"},
+
+        {"repeat", "0", false, Option::WHOLE_NUMBER, 0, 0, "-r",
+        "Clients.cimcli.CIMCLIClient.REPEAT_OPTION_HELP",
+        "Number of times to repeat the operation.\n"
+            "    Zero means one time"},
+
+        {"time", "false", false, Option::BOOLEAN, 0, 0, "-t",
+        "Clients.cimcli.CIMCLIClient.TIME_OPTION_HELP",
+        "Measure time for the operation and present results"}
+
+    };
+    const Uint32 NUM_OPTIONS = sizeof(optionsTable) / sizeof(optionsTable[0]);
+
+    om.registerOptions(optionsTable, NUM_OPTIONS);
+
+    String configFile = "cimcli.conf";
+
+    if (FileSystem::exists(configFile))
+    {
+        om.mergeFile(configFile);
+    }
+
+    om.mergeCommandLine(argc, argv);
+
+    om.checkRequiredOptions();
+
+}
+
+void lookupStringOption(Options& opts,
+                  OptionManager& om,
+                  const char* optionName,
+                  String& optsTarget,
+                  const String& defaultValue)
+{
+    optsTarget = defaultValue;
+    if(om.lookupValue(optionName, optsTarget))
+    {
+        if (opts.verboseTest && opts.debug)
+            cout << optionName << " = " << optsTarget << endl;
+    }
+}
+
+// Set the correct empty string into the variable.
+void lookupStringOptionEMPTY(Options& opts,
+                  OptionManager& om,
+                  const char* optionName,
+                  String& optsTarget)
+{
+    String temp;
+    if(om.lookupValue(optionName, temp))
+    {
+        optsTarget = (temp.size() == 0)? String::EMPTY : temp;
+
+        if (opts.verboseTest && opts.debug)
+            cout << optionName << " = " << optsTarget << endl;
+    }
+}
+
+void lookupCIMNameOption(Options& opts,
+                   OptionManager& om,
+                   const char* optionName,
+                   CIMName& optsTarget,
+                   const CIMName& defaultValue)
+{
+    String temp;
+    if(om.lookupValue(optionName, temp))
+    {
+       if (temp != "")
+       {
+           //Assigning to CIMName can cause exception.
+           try
+           {
+               optsTarget = temp;
+           }
+           catch(Exception& e)
+           {
+               cerr << "Parse Error in " << optionName << " Class. Exception "
+                    << e.getMessage()
+                    << endl;
+               exit(CIMCLI_INPUT_ERR);
+           }
+       }
+       else
+           optsTarget = defaultValue;
+
+       if (opts.verboseTest && opts.debug && temp != "")
+           cout << optionName << " = " << optsTarget.getString() << endl;
+    }
+}
+
+// Lookup a single Uin32 option.  NOTE: The issue here is with detecting
+// whether the option exists or we should use the internal default.
+// Return from the option manager is the defined default which is itself
+// an integer.
+void lookupUint32Option(Options& opts,
+                   OptionManager& om,
+                   const char* optionName,
+                   Uint32& optsTarget,
+                   Uint32 defaultValue,
+                   const char* units = "")
+{
+    optsTarget = 0;
+    if (!om.lookupIntegerValue(optionName, optsTarget))
+    {
+        optsTarget = 0;
+    }
+
+    if (opts.verboseTest && opts.debug && optsTarget != 0)
+    {
+        cout << optionName << " = " << optsTarget << units
+            << endl;
+    }
+}
+
+void lookupBooleanOption(Options& opts,
+                   OptionManager& om,
+                   const char* optionName,
+                   Boolean& optsTarget)
+{
+    optsTarget = om.isTrue(optionName);
+    if (optsTarget  && opts.verboseTest && opts.debug)
+        cout << optionName << " = " << _toString(optsTarget) << endl;
+}
+
+void lookupBooleanOptionNegate(Options& opts,
+                   OptionManager& om,
+                   const char* optionName,
+                   Boolean& optsTarget)
+{
+    optsTarget = !om.isTrue(optionName);
+    if (optsTarget  && opts.verboseTest && opts.debug)
+        cout << optionName << " = " << _toString(optsTarget) << endl;
+    cout << optionName << " temp = " << _toString(optsTarget) << endl;
+}
+
+int CheckCommonOptionValues(OptionManager& om, char** argv, Options& opts)
+{
+    Uint32 lineLength = 75;
+    // Catch the verbose and debug options first so they can control other
+    // processing
+    Boolean verboseTest = (om.valueEquals("verbose", "true")) ? true :false;
+    Boolean debug = (om.valueEquals("debug", "true")) ? true :false;
+
+    if (verboseTest)
+        opts.verboseTest = verboseTest;
+
+    if (debug)
+    {
+        opts.debug= debug;
+    }
+
+    if (om.isTrue("full help"))
+    {
+        showFullHelpMsg(argv[0], om, lineLength);
+        exit(0);
+    }
+
+    // show usage for a single operation and exit
+    if (om.isTrue("help"))
+    {
+        if (!showOperationUsage(argv[1], om, lineLength))
+            exit(1);
+
+        showUsage();
+        exit(CIMCLI_RTN_CODE_OK);
+    }
+
+    // show version number
+    if (om.isTrue("version"))
+    {
+        showVersion(argv[0], om);
+        exit(CIMCLI_RTN_CODE_OK);
+    }
+
+    // show all help options
+    if (om.isTrue("help options"))
+    {
+        showOptions(argv[0], om);
+        exit(CIMCLI_RTN_CODE_OK);
+    }
+
+    // show help Operation list
+    if (om.isTrue("help commands"))
+    {
+        showOperations(argv[0], lineLength);
+        exit(CIMCLI_RTN_CODE_OK);
+    }
+
+    lookupStringOption(opts, om, "namespace", opts.nameSpace, "root/cimv2");
+
+    lookupStringOptionEMPTY(opts, om, "role", opts.role);
+
+    lookupStringOptionEMPTY(opts, om, "resultRole", opts.resultRole);
+
+    lookupStringOption(opts, om, "location", opts.location, String::EMPTY);
+
+#ifdef PEGASUS_HAS_SSL
+    // Determine whether to connect over HTTPS
+    opts.ssl = om.isTrue("ssl");
+
+    // Get value for client certificate
+    om.lookupValue("clientCert", opts.clientCert);
+
+    // Get value for client key
+    om.lookupValue("clientKey", opts.clientKey);
+
+    if (verboseTest && debug && opts.ssl)
+    {
+        cout << "ssl = true" << endl;
+        if (opts.clientCert != "" && opts.clientKey != "")
+        {
+            cout << "clientCert = " << opts.clientCert << endl;
+            cout << "clientKey = " << opts.clientKey << endl;
+        }
+    }
+#endif
+
+    // Assign the result class
+    lookupCIMNameOption(opts, om, "resultClass", opts.resultClass, CIMName());
+
+    lookupCIMNameOption(opts, om, "assocClass", opts.assocClass, CIMName());
+
+    // Evaluate connectiontimeout option.
+    lookupUint32Option(opts, om, "connecttimeout", opts.connectionTimeout, 0,
+        "seconds");
+
+    lookupUint32Option(opts, om, "delay", opts.delay, 0, "seconds");
+
+
+    // Set the interactive request flag based on input
+
+    lookupBooleanOption(opts, om,"interactive", opts.interactive);
+
+    // set the deepInheritance flag based on input
+    lookupBooleanOption(opts, om,"deepInheritance", opts.deepInheritance);
+
+    // process localOnly and notlocalOnly parameters
+    opts.localOnly = om.isTrue("localOnly");
+    if (om.isTrue("notLocalOnly"))
+    {
+        opts.localOnly = false;
+    }
+
+    // Used the not version because the DMTF and pegasus default is true
+    if (verboseTest && debug && om.isTrue("notLocalOnly"))
+    {
+        cout << "localOnly= " << _toString(opts.localOnly) << endl;;
+    }
+
+    // Process notincludeQualifiers
+
+    lookupBooleanOption(opts, om,"notIncludeQualifiers",
+                        opts.includeQualifiers );
+
+    opts.includeQualifiers = om.isTrue("includeQualifiers");
+
+    if (om.isTrue("notIncludeQualifiers"))
+    {
+        opts.includeQualifiers = false;
+    }
+
+    if (verboseTest && debug && om.isTrue("notIncludeQualifiers"))
+    {
+        cout << "includeQualifiers = " << _toString(opts.includeQualifiers)
+            << endl;
+    }
+
+
+    lookupBooleanOption(opts, om,"includeClassOrigin",
+                        opts.includeClassOrigin );
+
+    lookupBooleanOption(opts, om,"time", opts.time);
+
+    if(!om.lookupIntegerValue("trace", opts.trace))
+    {
+            opts.trace = 0;
+    }
+    else
+    {
+        Uint32 traceLevel = 0;
+        switch (opts.trace)
+        {
+            case 0:             // This covers the default.
+                break;
+            case 1 :
+                traceLevel = Tracer::LEVEL1;
+                break;
+            case 2 :
+                traceLevel = Tracer::LEVEL2;
+                break;
+            case 3 :
+                traceLevel = Tracer::LEVEL3;
+                break;
+            case 4 :
+                traceLevel = Tracer::LEVEL4;
+                break;
+            default:
+                cout << "Illegal value for Trace. Max = 4" << endl;
+        }
+        opts.trace = traceLevel;
+    }
+    if (verboseTest && debug && opts.trace != 0)
+    {
+        cout << "Pegasus Trace set to  Level  " << opts.trace << endl;
+    }
+
+    lookupBooleanOption(opts, om,"summary", opts.summary);
+
+    // get User name and password if set.
+    lookupStringOptionEMPTY(opts, om, "User", opts.user);
+
+    lookupStringOptionEMPTY(opts, om, "Password", opts.password);
+
+    // Create a variable with the format output and a correponding type.
+    // Suggest we might change this whole thing to the option type that
+    // mike used in the example of colors so that  you could do -red -blue
+    // or in our case -mof -xml, etc.
+
+     opts.isXmlOutput = om.isTrue("xmlOutput");
+     if (opts.isXmlOutput  && debug && verboseTest)
+         cout << "xmlOutput set" << endl;
+
+    if(om.lookupValue("outputformats", opts.outputFormat))
+     {
+        if (debug && verboseTest)
+            cout << "Output Format = " << opts.outputFormat << endl;
+     }
+
+    // Get the output format parameter and save it
+    Uint32 cnt = 0;
+    opts.outputFormat.toLower();
+
+    for( ; cnt < NUM_OUTPUTS; cnt++ )
+    {
+        if (opts.outputFormat == OutputTable[cnt].OutputName)
+                break;
+    }
+    // Note that this makes no notice if a not found
+    if (cnt != NUM_OUTPUTS)
+    {
+        opts.outputFormatType = cnt;
+        opts.outputType = OutputTable[cnt].OutputType;
+    }
+
+
+    lookupUint32Option(opts, om, "repeat", opts.repeat, 0, "times");
+
+    lookupUint32Option(opts, om, "count", opts.count, 0, "Comparison Count");
+
+    if (opts.count != 29436)
+    {
+        opts.executeCountTest = true;
+    }
+
+    /*  Property List parameter.
+        Separate an input stream into an array of Strings
+        Two special situations, empty list and NULL list
+        Use NULL when there is no list. This means return all
+        Use empty if if you want no properties in the response
+        NOTE: We use the ###!### to represent no input of parameter
+    */
+    {
+        String properties;
+        if(om.lookupValue("propertyList", properties))
+        {
+            // om default.  No property list input
+            if (properties == "###!###")
+            {
+                opts.propertyList.clear();
+            }
+            // propertylist input empty.
+            // Account for inputter error where they try to input string
+            // representing two quotes
+            else if(properties.size() == 0 || properties == "\"\"")
+            {
+                Array<CIMName> pList;
+                opts.propertyList = pList;
+            }
+            else
+            {
+                Array<CIMName> pList;
+                // tokenize everything separated by commas
+                Array<String> pListString =  _tokenize(properties, ',', true);
+
+                for (Uint32 i = 0 ; i < pListString.size(); i++)
+                {
+                    pList.append(CIMName(pListString[i]));
+                }
+                opts.propertyList.set(pList);
+            }
+            if (debug && verboseTest && properties != "###!###")
+            {
+                cout << "PropertyList= "
+                    << _toString(opts.propertyList)
+                    << endl;
+            }
+        }
+    }
+
+    return 0;
+}
+
+PEGASUS_NAMESPACE_END
+// END_OF_FILE
diff --git a/src/Clients/cimcli/CIMCLIOptions.h b/src/Clients/cimcli/CIMCLIOptions.h
new file mode 100644 (file)
index 0000000..fd1aeb5
--- /dev/null
@@ -0,0 +1,60 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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 _CLI_OPTIONS_H
+#define _CLI_OPTIONS_H
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Client/CIMClient.h>
+#include <Pegasus/General/OptionManager.h>
+#include <Clients/cimcli/Linkage.h>
+#include <Pegasus/General/Stopwatch.h>
+#include <Pegasus/Common/MessageLoader.h>
+
+#include "CIMCLIClient.h"
+
+PEGASUS_NAMESPACE_BEGIN
+
+void  PEGASUS_CLI_LINKAGE BuildOptionsTable(
+    OptionManager& om,
+    int& argc,
+    char** argv,
+    const String& testHome);
+
+int PEGASUS_CLI_LINKAGE CheckCommonOptionValues(
+    OptionManager& om,
+    char** argv,
+    Options& opts);
+
+PEGASUS_NAMESPACE_END
+
+#endif  /* _CLI_OPTIONS_H */
diff --git a/src/Clients/cimcli/CIMCLIOutput.cpp b/src/Clients/cimcli/CIMCLIOutput.cpp
new file mode 100644 (file)
index 0000000..5b8e088
--- /dev/null
@@ -0,0 +1,772 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/FileSystem.h>
+#include <Pegasus/Common/XmlWriter.h>
+#include <Pegasus/General/MofWriter.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/StringConversion.h>
+#include <Pegasus/Common/ArrayInternal.h>
+#include "CIMCLIClient.h"
+#include "CIMCLIOutput.h"
+#include "CIMCLICommon.h"
+
+
+PEGASUS_USING_STD;
+PEGASUS_NAMESPACE_BEGIN
+
+//------------------------------------------------------------------------------
+//
+// mofFormat
+//
+//------------------------------------------------------------------------------
+
+static void _indent(PEGASUS_STD(ostream)& os,
+                    Uint32 level,
+                    Uint32 indentSize)
+{
+    Uint32 n = level * indentSize;
+    if (n > 50)
+    {
+        cout << "Jumped Ship " << level << " size " << indentSize << endl;
+        exit(1);
+    }
+
+    for (Uint32 i = 0; i < n; i++)
+    {
+        os << ' ';
+    }
+}
+
+/* Format the output stream for indented MOF format
+*/
+void mofFormat(PEGASUS_STD(ostream)& os,
+    const char* text,
+    Uint32 indentSize)
+{
+    char* var = new char[strlen(text)+1];
+    char* tmp = strcpy(var, text);
+    Uint32 count = 0;
+    Uint32 indent = 0;
+    Boolean quoteState = false;
+    Boolean qualifierState = false;
+    char c;
+    char prevchar = 0;
+    while ((c = *tmp++))
+    {
+        count++;
+        // This is too simplistic and must move to a token based mini parser
+        // but will do for now. One problem is tokens longer than 12
+        // characters that overrun the max line length.
+        switch (c)
+        {
+            case '\n':
+                os << c;
+                prevchar = c;
+                count = 0 + (indent * indentSize);
+                _indent(os, indent, indentSize);
+                break;
+
+            case '\"':   // quote
+                os << c;
+                prevchar = c;
+                quoteState = !quoteState;
+                break;
+
+            case ' ':
+                os << c;
+                prevchar = c;
+                if (count > 66)
+                {
+                    if (quoteState)
+                    {
+                        os << "\"\n";
+                        _indent(os, indent + 1, indentSize);
+                        os <<"\"";
+                    }
+                    else
+                    {
+                        os <<"\n";
+                        _indent(os, indent + 1,  indentSize);
+                    }
+                    count = 0 + ((indent + 1) * indentSize);
+                }
+                break;
+            case '[':
+                if (prevchar == '\n')
+                {
+                    indent++;
+                    _indent(os, indent,  indentSize);
+                    qualifierState = true;
+                }
+                os << c;
+                prevchar = c;
+                break;
+
+            case ']':
+                if (qualifierState)
+                {
+                    if (indent > 0)
+                        indent--;
+                    qualifierState = false;
+                }
+                os << c;
+                prevchar = c;
+                break;
+
+            default:
+                os << c;
+                prevchar = c;
+        }
+
+    }
+    delete [] var;
+}
+
+/*************************************************************
+*
+*       Common print functions for all CIM Objects Used
+*
+***************************************************************/
+
+// output CIMProperty
+void _print(const CIMProperty& property,
+    const OutputType format)
+{
+    if (format == OUTPUT_XML)
+    {
+        XmlWriter::printPropertyElement(property,cout);
+    }
+    else if (format == OUTPUT_MOF)
+    {
+        CIMProperty pt = property.clone();
+        pt.setPropagated(false);
+        Buffer x;
+        MofWriter::appendPropertyElement(false, x, pt);
+        mofFormat(cout, x.getData(), 4);
+    }
+}
+
+// output CIMValue in accord with output format definition
+//NOTE: DUPLICATES OUTPUT FORMATT FUNCTION
+void _print(const CIMValue& v,
+    const OutputType format)
+{
+    if (format == OUTPUT_XML)
+    {
+        XmlWriter::printValueElement(v,cout);
+    }
+    else if (format == OUTPUT_MOF)
+    {
+        Buffer x;
+        MofWriter::appendValueElement(x, v);
+        mofFormat(cout, x.getData(), 4);
+    }
+    else
+    {
+        cout << " Format type error" << endl;
+    }
+}
+
+/*****************************************************************************
+*
+*       Formatting and print functions for table output of instances
+*
+******************************************************************************/
+//
+//  Definition for String entries for each column in the output
+//
+typedef Array <String> ColumnEntry;
+
+/* Output a single table String entry filling to ColSize or adding an
+   eol if last specified
+*/
+void _printTableEntry(const String& entryStr,
+    const Uint32 colSize,
+    Boolean last,
+    PEGASUS_STD(ostream)& outPrintWriter)
+{
+    Uint32 fillerLen = colSize - entryStr.size() + 2;
+
+    outPrintWriter << entryStr;
+    if (last)
+    {
+        outPrintWriter << endl;
+    }
+    else
+    {
+        for (Uint32 j = 0; j < fillerLen; j++)
+        {
+             outPrintWriter << ' ';
+        }
+    }
+}
+
+/* Print the formatted table form of the instances as defined by
+   the parameters for the column width for each column and the array
+   of column entries (outputTable).
+*/
+void _printTables(const Array<Uint32>& maxColumnWidth,
+    const Array<ColumnEntry>& outputTable,
+    PEGASUS_STD(ostream)& outPrintWriter)
+{
+    for (Uint32 i = 0; i < outputTable[0].size(); i++)
+    {
+        for (Uint32 column = 0; column < maxColumnWidth.size(); column++)
+        {
+            Boolean last = (column == maxColumnWidth.size() - 1);
+            _printTableEntry(outputTable[column][i],
+                maxColumnWidth[column],
+                last,
+                outPrintWriter);
+        }
+    }
+}
+
+/* Format the output stream to be a table with column for each property
+   and row for the properties in each instance.
+*/
+void tableDisplay(PEGASUS_STD(ostream)& outPrintWriter,
+    const Array<CIMInstance>& instances)
+{
+    Array<ColumnEntry> outputTable;
+    Array<Uint32> maxColumnWidth;
+    Array<String> propertyNameArray;
+
+    // find set of all properties returned for all instances
+    for (Uint32 i = 0; i < instances.size(); i++)
+    {
+        for (Uint32 j = 0; j < instances[i].getPropertyCount(); j++)
+        {
+            String propertyNameStr =
+                instances[i].getProperty(j).getName().getString();
+
+            // Add to outputTable if not already there
+            if (!(Contains(propertyNameArray, propertyNameStr)))
+            {
+                //outputTable.append(propertyNameStr);
+                maxColumnWidth.append(propertyNameStr.size());
+                propertyNameArray.append(propertyNameStr);
+            }
+        }
+    }
+
+    // Build the complete table output in ascii.  We must build the
+    // complete table to determine column widths.
+    // NOTE: This code creates tables with column width to match the
+    // maximum width of the string representation of the property name or
+    // string representation of the value.  This can create REALLY
+    // REALLY wide columns for Strings and for Array properties.
+    //
+    // TODO: Add code to create multiline colums for things like array
+    // entries or possibly long strings.
+
+    for (Uint32 i = 0; i < propertyNameArray.size(); i++)
+    {
+        // array for a single column of property values
+        Array<String> propertyValueArray;
+
+        String propertyNameStr = propertyNameArray[i];
+
+        // First entry in propertyValueArray array is the propery name
+        propertyValueArray.append(propertyNameStr);
+
+        // for all instances get value for the property in
+        // propertyNameArray
+        for (Uint32 j = 0; j < instances.size(); j++)
+        {
+            Uint32 pos = instances[j].findProperty(propertyNameStr);
+
+            // Get the value or empty string if there is no property
+            // with this name
+            String propertyValueStr = (pos != PEG_NOT_FOUND) ?
+                    instances[j].getProperty(pos).getValue().toString()
+                :
+                    String::EMPTY;
+
+            propertyValueArray.append(propertyValueStr);
+
+            if (propertyValueStr.size() > maxColumnWidth[i])
+            {
+                maxColumnWidth[i] = propertyValueStr.size();
+            }
+        }
+
+        // Append the value array for this property to the outputTable
+        outputTable.append(propertyValueArray);
+    }
+    _printTables(maxColumnWidth, outputTable, outPrintWriter);
+}
+
+void _outputFormatInstance(const OutputType format,
+    const CIMInstance& instance)
+{
+    // display the path element
+    cout << "path= " << instance.getPath().toString() << endl;
+
+    // Display the instance based on the format type.
+    if (format == OUTPUT_XML)
+    {
+        XmlWriter::printInstanceElement(instance, cout);
+    }
+    else if (format == OUTPUT_MOF)
+    {
+        CIMInstance temp = instance.clone();
+        // Reset the propagated flag to assure that these entities
+        // are all shown in the MOF output.
+        for (Uint32 i = 0 ; i < temp.getPropertyCount() ; i++)
+        {
+            CIMProperty p = temp.getProperty(i);
+            p.setPropagated(false);
+        }
+
+        Buffer x;
+        MofWriter::appendInstanceElement(x, temp);
+        mofFormat(cout, x.getData(), 4);
+    }
+}
+void _outputFormatParamValue(const OutputType format,
+    const CIMParamValue& pv)
+{
+    if (format == OUTPUT_XML)
+    {
+        XmlWriter::printParamValueElement(pv, cout);
+    }
+    else if (format == OUTPUT_MOF)
+    {
+        if (!pv.isUninitialized())
+        {
+           CIMValue v =  pv.getValue();
+           CIMType type = v.getType();
+           if (pv.isTyped())
+               cerr << cimTypeToString (type) << " ";
+           else
+               cerr << "UnTyped ";
+
+           cerr << pv.getParameterName() << "="
+                << v.toString() << endl;
+        }
+        else
+            cerr << "ParamValue not initialized" << endl;
+    }
+    else
+        cerr << "Error, Format Definition Error" << endl;
+}
+
+void _outputFormatClass(const OutputType format,
+    const CIMClass& myClass)
+{
+    if (format == OUTPUT_XML)
+        XmlWriter::printClassElement(myClass, cout);
+    else if (format == OUTPUT_MOF)
+    {
+        // Reset the propagated flag to assure that these entities
+        // are all shown in the MOF output.
+
+        CIMClass temp = myClass.clone();
+        for (Uint32 i = 0 ; i < temp.getPropertyCount() ; i++)
+        {
+            CIMProperty p = temp.getProperty(i);
+            p.setPropagated(false);
+        }
+        for (Uint32 i = 0 ; i < temp.getMethodCount() ; i++)
+        {
+            CIMMethod m = temp.getMethod(i);
+            m.setPropagated(false);
+        }
+        Buffer x;
+        MofWriter::appendClassElement(x, temp);
+        mofFormat(cout, x.getData(), 4);
+    }
+    else
+        cerr << "Error, Format Definition Error" << endl;
+}
+
+void _outputFormatObject(const OutputType format,
+    const CIMObject& myObject)
+{
+
+    if (myObject.isClass())
+    {
+        CIMClass c(myObject);
+        _outputFormatClass(format, c);
+    }
+    else if (myObject.isInstance())
+    {
+        CIMInstance i(myObject);
+        _outputFormatInstance(format, i);
+    }
+    else
+    {
+        cerr << "Error: Object is neither class or instance" << endl;
+    }
+}
+
+void _outputFormatQualifierDecl(const OutputType format,
+    const CIMQualifierDecl& myQualifierDecl)
+{
+    if (format == OUTPUT_XML)
+        XmlWriter::printQualifierDeclElement(myQualifierDecl, cout);
+    else if (format == OUTPUT_MOF)
+    {
+        Buffer x;
+        MofWriter::appendQualifierDeclElement(x, myQualifierDecl);
+        mofFormat(cout, x.getData(), 4);
+    }
+    else
+    {
+        cerr << "Error: Format type error" << endl;
+    }
+}
+
+void _outputFormatCIMValue(const OutputType format,
+    const CIMValue& myValue)
+{
+    if (format == OUTPUT_XML)
+    {
+        XmlWriter::printValueElement(myValue, cout);
+    }
+    else if (format == OUTPUT_MOF)
+    {
+        Buffer x;
+        MofWriter::appendValueElement(x, myValue);
+        mofFormat(cout, x.getData(), 4);
+    }
+    else
+    {
+        cerr << "Error: Format type error" << endl;
+    }
+}
+
+
+// displaySummary for results of an operation. Display only if count
+// ne zero.
+// TODO: Separate the test from the count mechanism so that we can
+// get a test and full display at the same time.
+void _displayOperationSummary(Uint32 count,
+    const String& description,
+    const String item,
+    Options& opts)
+{
+    if (count != 0)
+    {
+        cout << count << " " << description
+            << " " << item << " returned.";
+
+        if (opts.repeat > 0)
+        {
+            cout << " " << opts.repeat;
+        }
+        if(opts.time && opts.repeat > 0)
+        {
+            cout << " " << opts.saveElapsedTime;
+        }
+        cout << endl;
+    }
+}
+
+void _testReturnCount(Options& opts,
+    Uint32 count,
+    const String& description,
+    const String& item)
+{
+
+    if ((opts.count) != 29346 && (opts.count != count))
+    {
+        cerr << "Failed count test. Expected= " << opts.count
+             << " Actual rcvd= " << count << endl;
+        opts.termCondition = 1;
+    }
+}
+/*
+    The following are the public interfaces for the displays
+*/
+
+void CIMCLIOutput::displayOperationSummary(Options& opts,
+    Uint32 count,
+    const String& description,
+    const String& item)
+{
+    _displayOperationSummary(count, description, item, opts);
+    _testReturnCount(opts,
+                     count,
+                     description,
+                     item);
+}
+
+void CIMCLIOutput::displayInstances(Options& opts,
+const Array<CIMInstance>& instances)
+{
+    if (opts.summary)
+    {
+        String s = "instances of class";
+        _displayOperationSummary(instances.size(), s,
+                                 opts.className.getString(),opts);
+    }
+    else
+    {
+        if (instances.size() > 0 && opts.outputType == OUTPUT_TABLE)
+        {
+            tableDisplay(cout, instances);
+            return;
+        }
+
+        // Output the returned instances
+        for (Uint32 i = 0; i < instances.size(); i++)
+        {
+            CIMInstance instance = instances[i];
+            // Check Output Format to print results
+            _outputFormatInstance(opts.outputType, instance);
+        }
+    }
+}
+
+void CIMCLIOutput::displayInstance(Options& opts,
+    const CIMInstance& instance)
+{
+    if (opts.summary)
+    {
+        if (opts.time)
+        {
+            cout << opts.saveElapsedTime << endl;
+        }
+    }
+    else
+    {
+        if (opts.outputType == OUTPUT_TABLE)
+        {
+            Array<CIMInstance> instances;
+            instances.append(instance);
+            tableDisplay(cout, instances);
+        }
+        else
+        {
+            _outputFormatInstance(opts.outputType, instance);
+        }
+    }
+}
+
+void CIMCLIOutput::displayPath(Options& opts,
+    const CIMObjectPath& path,
+    const String& description)
+{
+    if (opts.summary)
+    {
+        if (opts.time)
+        {
+            cout << opts.saveElapsedTime << endl;
+        }
+    }
+    else
+    {
+        if (description.size() != 0)
+        {
+            cout << description << " ";
+        }
+        cout << path.toString() << endl;;
+    }
+}
+
+void CIMCLIOutput::displayPaths(Options& opts,
+    const Array<CIMObjectPath>& paths,
+    const String& description)
+{
+    // TODO: Don't show anything if size = 0 and have the caller
+    // setup the class somewhere external.
+    if (opts.summary)
+    {
+        _displayOperationSummary(paths.size(), description,
+                               opts.className.getString(), opts);
+    }
+    else
+    {
+        if (description.size() != 0 && paths.size() != 0)
+        {
+            cout << paths.size() << " " << description << endl;
+        }
+        //Output the list one per line for the moment.
+        for (Uint32 i = 0; i < paths.size(); i++)
+        {
+            cout << paths[i].toString() << endl;
+        }
+    }
+}
+
+void CIMCLIOutput::displayClass(Options& opts,
+    const CIMClass& cimClass)
+{
+    if (opts.summary)
+    {
+        if (opts.time)
+        {
+            cout << opts.saveElapsedTime << endl;
+        }
+    }
+    else
+    {
+        _outputFormatClass(opts.outputType, cimClass);
+    }
+}
+
+void CIMCLIOutput::displayClassNames(Options& opts,
+    const Array<CIMName>& classNames)
+{
+    if (opts.summary)
+    {
+      String s = "class names";
+        _displayOperationSummary(classNames.size(), s,
+             opts.className.getString(), opts);
+    }
+    else
+    {
+        //Output the list one per line for the moment.
+        for (Uint32 i = 0; i < classNames.size(); i++)
+        {
+            cout << classNames[i].getString() << endl;
+        }
+    }
+}
+
+void CIMCLIOutput::displayProperty(Options& opts,
+    const CIMProperty& property)
+{
+    _print(property, opts.outputType);
+}
+
+void CIMCLIOutput::displayValue(Options& opts,
+    const CIMValue& value)
+{
+    _print(value, opts.outputType);
+}
+
+void CIMCLIOutput::displayObjects(Options& opts,
+    const Array<CIMObject>& objects,
+    const String& description)
+{
+    if (opts.summary)
+    {
+      String s = "instances of class";
+        _displayOperationSummary(objects.size(), description,
+                                  opts.className.getString(),opts);
+    }
+    else
+    {
+        // Output the returned instances
+        for (Uint32 i = 0; i < objects.size(); i++)
+        {
+            _outputFormatObject(opts.outputType, objects[i]);
+        }
+
+    }
+}
+
+void CIMCLIOutput::display(Options& opts,
+    const String& desription)
+{
+    if (opts.summary)
+    {
+        if (opts.time)
+        {
+            cout << opts.saveElapsedTime << endl;
+        }
+    }
+    else
+    {
+        cout << desription << endl;
+    }
+}
+
+void CIMCLIOutput::display(Options& opts,
+    const char* desription)
+{
+    display(opts, String(desription));
+}
+
+void CIMCLIOutput::displayParamValues(Options& opts,
+    const Array<CIMParamValue>& params)
+{
+    for (Uint32 i = 0; i < params.size() ; i++)
+    {
+        _outputFormatParamValue(opts.outputType, params[i]);
+    }
+}
+
+void CIMCLIOutput::displayClasses(Options& opts,
+    const Array<CIMClass>& classes)
+{
+    if (opts.summary)
+    {
+        String s = "classes";
+        _displayOperationSummary(classes.size(), s,
+                                 opts.className.getString(), opts);
+    }
+    else
+    {
+        // Output the returned instances
+        for (Uint32 i = 0; i < classes.size(); i++)
+        {
+            CIMClass myClass = classes[i];
+            _outputFormatClass(opts.outputType, myClass);
+        }
+    }
+}
+
+
+void CIMCLIOutput::displayQualDecl(Options& opts,
+    const CIMQualifierDecl& qualifierDecl)
+{
+    _outputFormatQualifierDecl(opts.outputType, qualifierDecl);
+}
+
+
+void CIMCLIOutput::displayQualDecls(Options& opts,
+    const Array<CIMQualifierDecl> qualifierDecls)
+{
+    if (opts.summary)
+    {
+        cout << qualifierDecls.size() << " returned." << endl;
+    }
+    else
+    {
+        // Output the returned instances
+        for (Uint32 i = 0; i < qualifierDecls.size(); i++)
+        {
+            CIMQualifierDecl myQualifierDecl = qualifierDecls[i];
+            _outputFormatQualifierDecl(opts.outputType, myQualifierDecl);
+        }
+    }
+}
+
+
+PEGASUS_NAMESPACE_END
+// END_OF_FILE
diff --git a/src/Clients/cimcli/CIMCLIOutput.h b/src/Clients/cimcli/CIMCLIOutput.h
new file mode 100644 (file)
index 0000000..805fd56
--- /dev/null
@@ -0,0 +1,123 @@
+//%LICENSE////////////////////////////////////////////////////////////////
+//
+// Licensed to The Open Group (TOG) under one or more contributor license
+// agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
+// this work for additional information regarding copyright ownership.
+// Each contributor licenses this file to you under the OpenPegasus Open
+// Source License; you may not use this file except in compliance with the
+// License.
+//
+// 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.
+//
+//////////////////////////////////////////////////////////////////////////
+//
+//%/////////////////////////////////////////////////////////////////////////////
+
+/*******************************************************************************
+
+    Defines the display functions used by cimcli.  The are largely CIM entities
+    and arrays of CIMEntities.  The output formats are controlled by
+    data in the Options structure provider
+
+*******************************************************************************/
+#ifndef _CLI_OUTPUT_H
+#define _CLI_OUTPUT_H
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Client/CIMClient.h>
+#include <Pegasus/General/OptionManager.h>
+#include <Clients/cimcli/Linkage.h>
+#include <Pegasus/General/Stopwatch.h>
+#include <Pegasus/Common/MessageLoader.h>
+
+PEGASUS_NAMESPACE_BEGIN
+
+class CIMCLIOutput
+{
+public:
+
+    // Display an instance or an array of instances
+    static void PEGASUS_CLI_LINKAGE displayInstance(Options& opts,
+        const CIMInstance& instance);
+    static void PEGASUS_CLI_LINKAGE displayInstances(Options& opts,
+        const Array<CIMInstance>& instances);
+
+    // Display either a single Class or array of classes.
+    static void PEGASUS_CLI_LINKAGE displayClass(Options& opts,
+        const CIMClass& cimClass);
+    static void PEGASUS_CLI_LINKAGE displayClasses(Options& opts,
+        const Array<CIMClass>& classes);
+
+    // Display either an array of objects with optional description
+    // text
+    static void PEGASUS_CLI_LINKAGE displayObjects(Options& opts,
+        const Array<CIMObject>& objects,
+        const String& description);
+
+    // Display a single path or an array of paths. There is an optional
+    // parameter allowing adding a description that will be displayed
+    // if paths exist.
+    static void PEGASUS_CLI_LINKAGE displayPath(Options& opts,
+        const CIMObjectPath& path,
+        const String& description = String());
+    static void PEGASUS_CLI_LINKAGE displayPaths(Options& opts,
+        const Array<CIMObjectPath>& paths,
+        const String& description = String());
+
+    // display a single property
+    static void PEGASUS_CLI_LINKAGE displayProperty(Options& opts,
+        const CIMProperty& property);
+
+    // Display a classname or array of classnames
+    static void PEGASUS_CLI_LINKAGE displayClassName(Options& opts,
+        const CIMName& className);
+    static void PEGASUS_CLI_LINKAGE displayClassNames(Options& opts,
+        const Array<CIMName>& classNames);
+
+    static void PEGASUS_CLI_LINKAGE displayValue(Options& opts,
+        const CIMValue& value);
+
+    // display a single value
+    static void PEGASUS_CLI_LINKAGE displayParamValues(Options& opts,
+        const Array<CIMParamValue>& parms);
+
+    static void PEGASUS_CLI_LINKAGE displayOperationSummary(Options& opts,
+        Uint32 count,
+        const String& description,
+        const String& item);
+
+    static void PEGASUS_CLI_LINKAGE display(Options& opts, const String& s);
+
+    static void PEGASUS_CLI_LINKAGE display(Options& opts, const char* s);
+
+    // Display a Qualifier Declaration or Array of Qualifier Declarations
+    static void PEGASUS_CLI_LINKAGE displayQualDecl(Options& opts,
+        const CIMQualifierDecl& qualifierDecl);
+    static void PEGASUS_CLI_LINKAGE displayQualDecls(Options& opts,
+        const Array<CIMQualifierDecl>
+        qualifierDecls);
+
+private:
+
+};
+
+PEGASUS_NAMESPACE_END
+
+#endif
index 1e76ce8be4c9b80a05136890c488803c8986d1e1..985fa29e7c6e8b8c8f22d54abfb050be57608057 100644 (file)
@@ -36,13 +36,21 @@ LIBRARIES = \
     peggeneral \
     pegcommon
 
-LOCAL_DEFINES = -DPEGASUS_INTERNALONLY
+ LOCAL_DEFINES = -DPEGASUS_INTERNALONLY
 
 EXTRA_INCLUDES = $(SYS_INCLUDES)
 
 PROGRAM = cimcli
 
-SOURCES = CIMCLICommand.cpp CIMCLIClient.cpp
+SOURCES = CIMCLICommand.cpp \
+         CIMCLIClient.cpp  \
+         ObjectBuilder.cpp \
+         CIMCLIOutput.cpp \
+         CIMCLIHelp.cpp \
+         CIMCLIOptions.cpp \
+         CIMCLICommon.cpp \
+         CIMCLIOptionStruct.cpp \
+         CIMCLIOperations.cpp
 
 include $(ROOT)/mak/program.mak
 
diff --git a/src/Clients/cimcli/ObjectBuilder.cpp b/src/Clients/cimcli/ObjectBuilder.cpp
new file mode 100644 (file)
index 0000000..4910122
--- /dev/null
@@ -0,0 +1,828 @@
+//%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.
+//
+//==============================================================================
+//
+//%/////////////////////////////////////////////////////////////////////////////
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/Constants.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Pegasus/Common/StringConversion.h>
+#include <Pegasus/Common/Tracer.h>
+#include <Pegasus/Common/XmlWriter.h>
+
+#include "CIMCLIClient.h"
+#include "ObjectBuilder.h"
+#include "CIMCLICommon.h"
+
+PEGASUS_USING_STD;
+PEGASUS_NAMESPACE_BEGIN
+
+class csvStringParse;
+
+// Cleans an input array by removing the { } tokens that surround
+// the array.  Does nothing if they do not exist.  If there is 
+// an unmatched set, an error is generated.
+// Allows the user to input array definitions surrounded by { }
+// as an option.
+void _cleanArray(String& x)
+{
+    if (x[0] == '{' && x[x.size()] == '}')
+    {
+        x.remove(0,1);
+        x.remove(x.size(),1);
+    }
+    else if(x[0] == '{' || x[x.size()] == '}')
+    {
+        cerr << "Error: Parse Error: Array " << x << endl;
+        exit(CIMCLI_INPUT_ERR);
+    }
+}
+
+// FUTURE - Expand this for other date time literals suchs as TODAY
+//
+CIMDateTime _getDateTime(const String& str)
+{
+    if (String::equalNoCase(str,"NOW"))
+    {
+        return CIMDateTime::getCurrentDateTime();
+    }
+    return CIMDateTime(str);
+}
+
+Boolean _StringToBoolean(const String& x)
+{
+    if (String::equalNoCase(x,"true"))
+    {
+        return true;
+    }
+    else if (String::equalNoCase(x,"false"))
+    {
+        return false;
+    }
+    cerr << "Parse Error: Boolean Parmeter " << x << endl;
+    exit(CIMCLI_INPUT_ERR);
+    return false;
+}
+
+Uint32 _includesType(const String& name)
+{
+    // FUTURE  KS add code. For now this is null because we do not
+    // support the data type option on input.
+    return 0;
+}
+
+/* Parser for comma-separated-strings (csv). This parser takes into
+   account quoted strings the " character and returns everything
+   within a quoted block in the string in one batch.  It also
+   considers the backslash "\" escape character to escape single
+   double quotes.
+   Example:
+     csvStringParse x (inputstring, ",");
+     while (x.more())
+        rtnString = x.next();
+*/ 
+class csvStringParse
+{
+public:
+    /* Define a string to parse for comma separated values and the
+       separation character
+    */
+    csvStringParse(const String& csvString, const int separator)
+    {
+        _inputString = csvString;
+        _separator = separator;
+        _idx = 0;
+        _end = csvString.size();
+    }
+
+    /* determine if there is more to parse
+       @return true if there is more to parse
+    */
+    Boolean more()
+    {
+        return (_idx < _end)? true : false;
+    }
+
+    /* get next string from input. Note that this will continue to
+       return empty strings if you parse past the point where more()
+       returns false.
+       @return String
+    */ 
+    String next()
+    {
+        String rtnValue;
+        parsestate state = NOTINQUOTE;
+
+        while ((_idx <= _end) && (_inputString[_idx]))
+        {
+            char idxchar = _inputString[_idx];
+            switch (state)
+            {
+                case NOTINQUOTE:
+                    switch (idxchar)
+                    {
+                        case '\\':
+                            state = INSQUOTE;
+                            break;
+
+                        case '"':
+                            state = INDQUOTE;
+                            break;
+
+                        default:
+                            if (idxchar == _separator)
+                            {
+                                _idx++;
+                                return rtnValue;
+                            }
+                            else
+                                rtnValue.append(idxchar);
+                            break;
+                    }
+                    break;
+
+                // add next character and set NOTINQUOTE State
+                case INSQUOTE:
+                    rtnValue.append(idxchar);
+                    state = NOTINQUOTE;
+                    break;
+
+                // append all but quote character
+                case INDQUOTE:
+                    switch (idxchar)
+                    {
+                        case '"':
+                            state = NOTINQUOTE;
+                            break;
+                        default:
+                            rtnValue.append(idxchar);
+                            break;
+                    }
+            }
+            _idx++;
+        }   // end while
+        return (rtnValue);
+    }
+
+private:
+    enum parsestate {INDQUOTE, INSQUOTE, NOTINQUOTE};
+    Uint32 _idx;
+    int _separator;
+    Uint32 _end;
+    String _inputString;
+};
+
+Sint64 _strToSint(const char* str, CIMType type)
+{
+    Sint64 s64;
+    Boolean success =
+        (StringConversion::stringToSint64(
+             str, StringConversion::decimalStringToUint64, s64) ||
+         StringConversion::stringToSint64(
+             str, StringConversion::hexStringToUint64, s64) ||
+         StringConversion::stringToSint64(
+             str, StringConversion::octalStringToUint64, s64) ||
+         StringConversion::stringToSint64(
+             str, StringConversion::binaryStringToUint64, s64)) &&
+        StringConversion::checkSintBounds(s64, type);
+    if (!success)
+    {
+        printf("Parse Error: Value conversion error. %s. type %s\n",
+               str, cimTypeToString(type));
+    }
+
+    return s64;
+}
+
+Uint64 _strToUint(const char* str, CIMType type)
+{
+    Uint64 u64;
+    Boolean success =
+        (StringConversion::decimalStringToUint64(str, u64) ||
+         StringConversion::hexStringToUint64(str, u64) ||
+         StringConversion::octalStringToUint64(str, u64) ||
+         StringConversion::binaryStringToUint64(str, u64)) &&
+         StringConversion::checkUintBounds(u64, type);
+
+    if (!success)
+    {
+        fprintf(stderr,"Parse Error: Value conversion error. %s. type %s\n",
+               str, cimTypeToString(type));
+        exit(CIMCLI_INPUT_ERR);
+    }
+
+    return u64;
+}
+
+/* Convert a single string provided as input into a CIM variable
+   and place it in a CIMValue.
+   @param str char* representing string to be parsed.
+   @param type CIMType expected.
+   @return CIMValue with the new value.
+*/
+Real64 _strToReal(const char * str, CIMType type)
+{
+    Real64 r64;
+
+    if (!StringConversion::stringToReal64(str, r64))
+    {
+        fprintf(stderr, "Parse Error: Value conversion error. %s. type %s\n",
+               str, cimTypeToString(type));
+        exit(CIMCLI_INPUT_ERR);
+    }
+    return r64;
+}
+
+/* Convert a single string provided as input into a CIM variable
+   and place it in a CIMValue.
+   @param str char* representing string to be parsed.
+   @param type CIMType expected.
+   @return CIMValue with the new value. If the parse fails, this function
+   terminates with an exit CIMCLI_INPUT_ERR.
+*/
+static CIMValue _stringToScalarValue(const char* str, CIMType type)
+{
+    Uint64 u64;
+
+    switch (type)
+    {
+        case CIMTYPE_BOOLEAN:
+            return CIMValue(_StringToBoolean(str));
+
+        case CIMTYPE_UINT8:
+            return CIMValue(Uint8(_strToUint(str, type)));
+    
+        case CIMTYPE_SINT8:
+            return CIMValue(Sint8(_strToSint(str, type)));
+
+        case CIMTYPE_UINT16:
+            return CIMValue(Uint16(_strToUint(str, type)));
+
+        case CIMTYPE_SINT16:
+            return CIMValue(Sint16(_strToSint(str, type)));
+
+        case CIMTYPE_UINT32:
+            return CIMValue(Uint32(_strToUint(str, type)));
+
+        case CIMTYPE_SINT32:
+            return CIMValue(Sint32(_strToSint(str, type)));
+
+        case CIMTYPE_UINT64:
+            return CIMValue(Uint64(_strToUint(str, type)));
+
+        case CIMTYPE_SINT64:
+            return CIMValue(Sint64(_strToSint(str, type)));
+
+        case CIMTYPE_REAL32:
+            return CIMValue(Real32(_strToReal(str, type)));
+
+        case CIMTYPE_REAL64:
+            return CIMValue(Real64(_strToReal(str, type)));
+
+        case CIMTYPE_STRING:
+            return CIMValue(String(str));
+
+        case CIMTYPE_DATETIME:
+            return CIMValue(_getDateTime(str));
+
+        default:
+            cerr << "Error: Parser Error. Data type " << cimTypeToString(type) 
+                 << " not allowed" << endl;
+            exit(CIMCLI_INPUT_ERR);
+    }
+    return CIMValue();
+}
+/*
+    Parse out comma-separated values from input string and build the
+    CIMValue array representing the input for array type input entities.
+    @param str const char * containing the comma-separated values
+    to be parsed.  All value elements in the CSV string must be
+    parsable to the same type.
+    @param v CIMValue into which the resulting values are added to
+    any existing values
+    @return Returns complete CIMValue.
+*/
+Boolean _buildArrayValue(
+    const char * str,
+    CIMValue& val)
+{
+    CIMType type = val.getType();
+    Uint32 arrayDimension = val.getArraySize();
+
+    csvStringParse strl(String(str), ',');
+
+    switch (type)
+    {
+        case CIMTYPE_BOOLEAN:
+        {
+            Array<Boolean> a;
+            val.get(a);
+            while(strl.more())
+            {
+                 a.append(_StringToBoolean(strl.next()));
+            }
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_UINT8:
+        {   
+            Array<Uint8> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToUint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_SINT8:
+        {   
+            Array<Sint8> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToSint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_UINT16:
+        {   
+            Array<Uint16> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToUint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_SINT16:
+        {   
+            Array<Sint16> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToSint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_UINT32:
+        {   
+            Array<Uint32> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToUint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_SINT32:
+        {   
+            Array<Sint32> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToSint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_UINT64:
+        {   
+            Array<Uint64> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToUint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_SINT64:
+        {   
+            Array<Sint64> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToSint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_REAL32:
+        {   
+            Array<Real32> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToUint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_REAL64:
+        {   
+            Array<Real64> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_strToSint(strl.next().getCString(), type));
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_STRING:
+        {   
+            Array<String> a;
+            val.get(a);
+            while(strl.more())
+                a.append(strl.next());
+            val.set(a);
+            break;
+        }
+        case CIMTYPE_DATETIME:
+        {   
+            Array<CIMDateTime> a;
+            val.get(a);
+            while(strl.more())
+                a.append(_getDateTime(strl.next()));
+            val.set(a);
+            break;
+        }
+    default:
+        cout << "Error: Parse Error. Data type " << cimTypeToString(type) 
+        << " not allowed" << endl;
+        exit(CIMCLI_INPUT_ERR);
+    }
+    return true;
+}
+
+/*
+     Create a method parameter from the tokenized information for the
+     method name, value, type, etc.
+*/
+CIMParamValue _createMethodParamValue(  const CIMName& name,
+    const String& value,
+    const CIMParameter& thisParam,
+    Boolean verbose,
+    const CIMNamespaceName& nameSpace)
+{
+    CIMType type = thisParam.getType();
+    String paramName = thisParam.getName().getString();
+
+    CIMValue vp(type,thisParam.isArray());
+
+        if (vp.isArray())
+        {
+            _buildArrayValue(value.getCString(), vp );
+            // set the value array into the property value
+            return CIMParamValue(paramName,vp,true);
+        }
+        else
+        {   // scalar
+            CIMValue v;
+            v = _stringToScalarValue(value.getCString(), vp.getType());
+            return CIMParamValue(paramName,v,true);
+        }
+
+    // should never get here
+    return CIMParamValue();
+}
+
+/******************************************************************
+*
+*   ObjectBuilder Class. Creates instances and parameters from
+*     name/value pairs received and the corresponding class
+*     definitions.
+**
+*******************************************************************/
+/*
+    Constructor, sets up a single object with the input pairs
+    and the definition to get the class required for the
+    parsing and entity building.
+*/
+ObjectBuilder::ObjectBuilder(
+    const Array<String>& inputPairs,
+    CIMClient& client,
+    const CIMNamespaceName& nameSpace,
+    const CIMName& className,
+    const CIMPropertyList& cimPropertyList,
+    Boolean verbose)
+{
+    // get the class. Exceptions including class_not_found are automatic
+    // not localOnly (Need all properties), get qualifiers and classOrigin
+    // since we can filter them out later
+
+    _verbose = verbose;
+    _className = className;
+    
+    _thisClass = client.getClass(nameSpace, className,
+                        false,true,true,cimPropertyList);
+
+    _nameSpace = nameSpace;
+    if (inputPairs.size() != 0)
+    {
+        /* Here loop starts from 1, since the Class Name is  first parameter
+           and we want only the property name and value here
+        */
+        for (Uint32 i = 1 ; i < inputPairs.size() ; i++)
+        {
+            String name;
+            String value;
+            Uint32 sep;
+
+            // parse each pair and eliminate any illegal returns
+            if ((sep = _parseValuePair(inputPairs[i], name, value)) != ILLEGAL)
+            {
+                _featureNameList.append(CIMName(name));
+                _valueStringList.append(value);
+                _parseType.append(sep);
+            }
+            else
+            {
+                cerr << "Parse Failed " << inputPairs[i] << endl;
+            }
+        }
+
+        if (_verbose)
+        {
+            // This loop displays all the names and 
+            // property values of the instance
+            for (Uint32 i=0; i < _featureNameList.size(); i++)
+            {
+                cout << "Name= " << _featureNameList[i].getString()
+                     << ", valueString= " << _valueStringList[i] << endl;
+            }
+        }
+    }
+}
+
+ObjectBuilder::~ObjectBuilder()
+{
+}
+
+Array<CIMName> ObjectBuilder::getPropertyList()
+{
+    return  _featureNameList;
+}
+
+const CIMClass ObjectBuilder::getTargetClass()
+{
+    return _thisClass;
+}
+
+CIMObjectPath ObjectBuilder::buildCIMObjectPath()
+{
+    CIMInstance testInstance = buildInstance(
+        true, true,
+        CIMPropertyList());
+
+    CIMObjectPath thisPath = testInstance.buildPath(_thisClass);
+
+    return thisPath;
+}
+/*
+    Parse the input string to separate out the strings for name and
+    value components. The name component must be a CIM_Name and contain
+    only alphanumerics and _ characters. The value is optional.
+    The possible separators are today
+    "=" and "!". and no value component is allowed after the ! separator
+*/
+Uint32 ObjectBuilder::_parseValuePair(const String& input,
+                                         String& name,
+                                         String& value)
+{
+    _termType terminator;
+    value = String::EMPTY;
+
+    Boolean separatorFound = false;
+    for (Uint32 i = 0 ; i < input.size() ; i++)
+    {
+        if ((input[i] != '=') && (input[i] !=  '!'))
+        {
+            name.append(input[i]);
+        }
+        else  //separator character found
+        {
+            if (input[i] == '=')
+            {
+                terminator = VALUE;
+            }
+            if (input[i] == '!')
+            {
+                terminator = EXCLAM;
+            }
+            separatorFound = true;
+            break;
+        }
+    }
+
+    // separator must be found
+    if (!separatorFound)
+    {
+        cerr << "Parse error: No separator " << input << endl;
+        return ILLEGAL;
+    }
+    // There must be a name entity
+    if (name.size() == 0)
+    {
+        cerr << "Parse error: No name component " << input << endl;
+        return ILLEGAL;
+    }
+    // value component is optional but sets different _termType values
+    if (input.size() == name.size() + 1)
+    {
+        if (terminator == EXCLAM)
+        {
+            return EXCLAM;
+        }
+        else
+        {
+            return NO_VALUE;
+        }
+    }
+    value = input.subString(name.size() + 1, PEG_NOT_FOUND);
+    return VALUE;
+}
+/*
+    Build an instance from the information in the ObjectBuilder
+    object.
+*/
+CIMInstance ObjectBuilder::buildInstance(
+    Boolean includeQualifiers,
+    Boolean includeClassOrigin,
+    const CIMPropertyList& propertyList)
+{
+    // create the instance skeleton with the defined properties
+    CIMInstance newInstance = _thisClass.buildInstance(
+        includeQualifiers,
+        includeClassOrigin,
+        CIMPropertyList());
+
+    Array<CIMName> myPropertyList;
+    Uint32 propertyPos;
+
+    // Set all the input property values into the instance
+    for (Uint32 index = 0; index < _featureNameList.size(); index++)
+    {
+        if ((propertyPos = _thisClass.findProperty(
+            _featureNameList[index])) == PEG_NOT_FOUND)
+        {
+            cerr << "Warning property Name " 
+                 << _featureNameList[index].getString() 
+                 << " Input value " <<  _valueStringList[index]
+                 << " not in class: " << _thisClass.getClassName().getString()
+                 << " Skipping."
+                 << endl;
+            continue;
+        }
+        
+        // get value for this property from built instance
+
+        CIMProperty ip = newInstance.getProperty(propertyPos);
+        CIMValue iv = ip.getValue();
+
+        // If input not NULL type (ends with =) set the value component
+        // into property.  NULL input sets whatever is in the class into
+        // the instance (done by buildInstance);
+        if (_parseType[index] == EXCLAM)
+        {
+            if (iv.getType() == CIMTYPE_STRING)
+            {
+                iv.set(String::EMPTY);
+                ip.setValue(iv);
+            }
+            else
+            {
+                cerr << "Error: " << ip.getName().getString() 
+                    << "! parameter terminator allowed only on String types "
+                    << endl;
+                exit(CIMCLI_INPUT_ERR);
+            }
+        }
+        else if (_parseType[index] == VALUE)
+        {
+            if (iv.isArray())
+            {
+                _cleanArray(_valueStringList[index]);
+                if (!_buildArrayValue(
+                    _valueStringList[index].getCString(), iv))
+                {
+                    cerr << "Parse Error: parameter "
+                       << _featureNameList[index].getString() 
+                       << " "
+                       << _valueStringList[index] << endl;
+                    exit(CIMCLI_INPUT_ERR);
+                }
+            }
+            else  // scalar
+            {  
+                // Replace property value in new instance
+                iv = _stringToScalarValue(
+                    _valueStringList[index].getCString(), ip.getType());
+            }
+            ip.setValue(iv);
+        }
+
+        else if(_parseType[index] == NO_VALUE)
+        {
+            // do nothing
+        }
+        else if(_parseType[index] == ILLEGAL)
+        {
+            // do nothing
+        }
+
+        myPropertyList.append(CIMName(_featureNameList[index]));
+    }
+    // Delete any properties not on the property list
+    newInstance.filter(false,false, CIMPropertyList(myPropertyList));
+
+    // Display the Instance if verbose
+    if (_verbose)
+    {
+        cout << "Instance Built" << endl;
+        XmlWriter::printInstanceElement(newInstance, cout);
+    }
+
+    return newInstance;
+}
+
+Array<CIMParamValue> ObjectBuilder::buildMethodParameters()
+{
+    Array<CIMParamValue> params;
+
+    // Find Method
+    Uint32 methodPos;
+    CIMMethod thisClassMethod;
+
+    if ((methodPos = _thisClass.findMethod(_methodName)) == PEG_NOT_FOUND)
+    {
+        cerr << "Error: method " << _methodName.getString()
+            << " Not method in the class " << _className.getString()
+            <<  endl;
+        exit(CIMCLI_INPUT_ERR);
+    }
+    else
+    {
+        thisClassMethod = _thisClass.getMethod(methodPos);
+    }
+
+    // find parameter for each input.
+    for (Uint32 index = 0; index < _featureNameList.size(); index++)
+    {
+        Uint32 parameterPos;
+        if ((parameterPos = thisClassMethod.findParameter(
+            CIMName(_featureNameList[index]))) == PEG_NOT_FOUND)
+        {
+            cerr << "Error: parameter " << _featureNameList[index].getString() 
+                << " not valid method parameter in class "
+                << _className.getString()
+                << endl;
+            exit(CIMCLI_INPUT_ERR);
+        }
+
+        CIMParameter thisParameter = thisClassMethod.getParameter(parameterPos);
+
+        CIMParamValue localParamValue = _createMethodParamValue(
+            _featureNameList[index],
+            _valueStringList[index],
+             thisParameter,
+            _verbose,
+            CIMNamespaceName());
+
+        if (true)
+        {
+            // successful addition of parameter value
+            params.append(localParamValue);
+        }
+        else
+        {
+            // error adding parameter value
+            cerr << "Error: Parsing Error adding parameter"
+                << _featureNameList[index].getString() << " "
+                << _valueStringList[index] << endl;
+                exit(CIMCLI_INPUT_ERR);
+        }
+    }
+    return params;
+}
+
+void ObjectBuilder::setMethod(CIMName& name)
+{
+    _methodName = name;
+}
+
+PEGASUS_NAMESPACE_END
+
+// END_OF_FILE
diff --git a/src/Clients/cimcli/ObjectBuilder.h b/src/Clients/cimcli/ObjectBuilder.h
new file mode 100644 (file)
index 0000000..001e311
--- /dev/null
@@ -0,0 +1,124 @@
+//%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 _CLI_ObjectBuilder_h
+#define _CLI_ObjectBuilder_h
+
+#include <Pegasus/Common/Config.h>
+#include <Pegasus/Common/PegasusAssert.h>
+#include <Clients/cimcli/Linkage.h>
+#include <Pegasus/Client/CIMClient.h>
+
+/*
+    Class and functions to build instances and parameters from
+    token pairs (key=value) strings input.  
+    The constructor sets up the token pairs and separates out
+    keys and values (and optionally types defined by the keys.
+    It also gets any metadata (i.e. Classes)
+
+    The build methods use this to build the objects.
+
+*/
+
+PEGASUS_NAMESPACE_BEGIN
+
+class PEGASUS_CLI_LINKAGE ObjectBuilder
+{
+public:
+    // not used
+    ObjectBuilder();
+
+    /** create the arrays for the defined input
+    @param inputs Name/value pairs representing the input
+    properties
+    @param class the CIMClass for which we are creating something 
+    */
+    ObjectBuilder(const Array<String>& inputPairs,
+        CIMClient& client,
+        const CIMNamespaceName& nameSpace,
+        const CIMName& className,
+        const CIMPropertyList& cimPropertyList,
+        Boolean verbose);
+
+    ~ObjectBuilder();
+
+    // get next evaluated property
+    Array<CIMName> getPropertyList();
+
+    // Create an instance with the properties define
+    // in the create
+    CIMInstance buildInstance(Boolean includeQualifiers,
+                              Boolean includeClassOrigin,
+                              const CIMPropertyList& propertyList);
+
+    //Create a CIMParamValue for the defined parameter name
+    Array<CIMParamValue> buildMethodParameters();
+
+    void setMethod(CIMName& name);
+
+    // Returns the class definition that was acquired during the
+    // construction.  This is provided so that other functions do
+    // not have to repeat getting the class.
+    const CIMClass getTargetClass();
+
+    // Build the CIMObjectPath from the information provided with
+    // the constructor
+    CIMObjectPath buildCIMObjectPath();
+private:
+
+    // Enumeration of the valuePair parsing return types
+    enum _termType { ILLEGAL, VALUE, NO_VALUE, EXCLAM, NAME_ONLY };
+
+    Uint32 _parseValuePair(
+        const String& input,
+        String& name,
+        String& value);
+
+    // The following Arrays are a common
+    // structure representing the input key/value
+    // parameters with an entry in each for each
+    // input parameter
+    Array<CIMName> _featureNameList;
+    Array<String> _valueStringList;
+    Array<Uint32> _CIMTypeList;
+    Array<Uint32> _parseType;
+
+    CIMName _methodName;
+    CIMClass _thisClass;
+    CIMName _className;
+    Boolean _verbose;
+    CIMNamespaceName _nameSpace;
+};
+
+PEGASUS_NAMESPACE_END
+#endif 
index a1b5cac55f2001f58df88034173beaf8dabadab2..d0e594b1a428a238955914b441043104bffb29b3 100644 (file)
@@ -12,26 +12,35 @@ cimcli is available for all platforms that support the Pegasus CIM Server.
 
 .B cimcli
 is a command line test tool for executing CIM client operations. It implements
-all of the DMTF CIM operations except for the modify and create class/instance operations and includes several
-other operations that are useful in testing including getting all namespaces and enumerating all
-instances in a namespace.
+all of the DMTF CIM operations except for the modify and create class/instance
+operations and includes several other operations that are useful in testing
+including getting all namespaces and enumerating all instances in a namespace.
 
-Each execution of cimcli invokes a CIM Operation with the corresponding command parameters equivalent
-to the CIM Operations defined in the CIM Operations over HTTP specification.
+Each execution of cimcli invokes a CIM Operation with the corresponding command
+parameters equivalent to the CIM Operations defined in the CIM Operations over
+HTTP specification.
 
-In addition to the basic CIM Operations defined in the specification, this tool implements a number of
-other specific operations that support testing and querying CIM servers including  a command to query
+In addition to the basic CIM Operations defined in the specification,
+this tool implements a number of other specific operations that
+support testing and querying CIM servers including  a command to query
 for namespaces and to get all instances in a namespace.
 
 .TP
 .B 1.
-Enumerate namespaces (ns) - Returns a list of the namespaces available from the CIMOM.
+Enumerate namespaces (ns) - Returns a list of the namespaces available
+from the CIMOM.
 .TP
 .B 2.
-Enumerate all instance names (niall) - Returns a list of all instance names in the defined namespace.
+Enumerate all instance names (niall) - Returns a list of all instance
+names in the defined namespace.  
 .TP
-.B 2.
-Turn CIMServer statistics on and off (At least for the OpenPegasus server
+.B 3.
+Turn CIMServer statistics on and off ( TBD) - Turns the statistics flag
+in the Server CIMObjectManager Class on or off for the OpenPegasus server.
+This enables and disables execution of statistics gathering in the server.
+.TP
+.B 4.
+Test commands (TBD)
 
 The format of this command is generally:
 .TP
@@ -39,73 +48,90 @@ The format of this command is generally:
 
 .TP
 .B [Operation] 
-defines the  operation to be executed. cimcli executes all of the DMTF CIM Operations (ex. getclass)
-and a set of compound operation (enumeratenamespaces). There
-are two forms for each Operation definition, a short form typically two characters (i.e. gc)
-and the long form which is the full name of the operation (i.e. getclass).
+defines the  operation to be executed. cimcli executes all of the DMTF
+CIM Operations (ex. getclass) and a set of compound operation
+(enumeratenamespaces). There are two forms for each Operation
+definition, a short form typically two characters (i.e. gc) and the
+long form which is the full name of the operation (i.e. getclass).
 .TP
 .B [objectname]
-The name of the object input with the command. This parameter is operation dependent.
-For example, with the getClass operation the object is a class name.
-With the getinstance command the object is an object name. Note
-that some of the commands do not require an object.   Thus, for example, the [object] is optional with
-the enumerateClasses operation as it is with the equivalent  enumerateClassNames CIM operation. Normally
-this is either a classname or an instancename (classname plus keybindings). In some operations one or the 
-other is required.  In other operations, the behavior of the operation is dependent on whether classname
-or instancename is supplied.
+The name of the object input with the command. This parameter is
+operation dependent.  For example, with the getClass operation the
+object is a class name.  With the getinstance command the object is an
+object name. Note that some of the commands do not require an object.
+Thus, for example, the [object] is optional with the enumerateClasses
+operation as it is with the equivalent  enumerateClassNames CIM
+operation. Normally this is either a classname or an instancename
+(classname plus keybindings). In some operations one or the other is
+required.  In other operations, the behavior of the operation is
+dependent on whether classname or instancename is supplied.
 .TP
 .B [options...] 
-Options are identified on the command line with the - or -- notation.  There are three types of options:
+Options are identified on the command line with the - or -- notation.
+There are three types of options:
 
 .TP 8
 .B 1.
-A set of options that are universal and modify or define the execution of the command or the 
-form of the return.  This includes options like setting the output format for object responses or
-requesting only summary operation.
+A set of options that are universal and modify or define the execution
+of the command or the form of the return.  This includes options like
+setting the output format for object responses or requesting only
+summary operation.
 .TP 8
 .B 2.
-A set of options that represent the optional input parameters for selected operation. The
-command defines the CIM Operation that will be executed and the options define the optional characteristics.
-Typical context options might be -n namespace (used on most but not all operations)or -niq which
-sets includequalifiers to false for operations that use the includeQualifiers optional parameter.
+A set of options that represent the optional input parameters for
+selected operation. The command defines the CIM Operation that will be
+executed and the options define the optional characteristics.  Typical
+context options might be -n namespace (used on most but not all
+operations)or -niq which sets includequalifiers to false for
+operations that use the includeQualifiers optional parameter.
 .TP 8
 .B 3
-A set of options to display help (-h, --help, --ho to get a list of all options, and
--hc to get a list of all commands. When these options are requested, no operation is
-executed.
+A set of options to display help (-h, --help, --ho to get a list of
+all options, and -hc to get a list of all commands. When these options
+are requested, no operation is executed.
 .TP
 .B [extra-parameters]
-Some of the operations allow or require extra parameters. these are typically keywords or keyword/value pairs
-and are defined as part of the particular options that might use them.
-
-Any extra parameters entities on the command line that occur after the [Operation] and are not preceeded by
-"-" to indicate an option are considered extra paramters.  These are used in some of the operations to provide
-additional information required or optionally desired by the operation.  See each operation definition to determine
-if extra parameters are required or allowed.  These may be either keyname-value pairs in some cases or simply strings
-depending on the operation.
-
-
-NOTE: cimcli does not protect the user against inputting extra options or parameters.  Since the options are
-heavily dependent on the operation to be executed, it simply ignores those options that are not used with a particular
-operation.  Thus, entering the -r option (role) with a getClass operation is syntatically allowed but cimcli ignores
+Some of the operations allow or require extra parameters. these are
+typically keywords or keyword/value pairs and are defined as part of
+the particular options that might use them.
+
+Any extra parameters entities on the command line that occur after the
+[Operation] and are not preceeded by "-" to indicate an option are
+considered extra paramters.  These are used in some of the operations
+to provide additional information required or optionally desired by
+the operation.  See each operation definition to determine if extra
+parameters are required or allowed.  These may be either keyname-value
+pairs in some cases or simply strings depending on the operation.
+
+
+NOTE: cimcli does not protect the user against inputting extra options
+or parameters.  Since the options are heavily dependent on the
+operation to be executed, it simply ignores those options that are not
+used with a particular operation.  Thus, entering the -r option (role)
+with a getClass operation is syntatically allowed but cimcli ignores
 the parameter.
 
 .SH UNIVERSAL OPTIONS
 
-There is a set of options which are general to all of the CIM Operations and most of the 
-compound operations and which provide parameters for the initiation or execution of the command. 
+There is a set of options which are general to all of the CIM
+Operations and most of the compound operations and which provide
+parameters for the initiation or execution of the command. 
 These include:
 .TP
 .B \-n [namespace]
-Namespace name for this operation (ex. -n root). The default namespace is root/cimv2.
+Namespace name for this operation (ex. -n root). The default namespace
+is root/cimv2.
 .TP
 .B \-l [location]
-Host name or IP address and optionally port for this operation. The default for this command
-if the the -n option is not used is to use the Pegasus connectLocal() function to connect to the server.
-Note that this means that a command like cimcli gc CIM_Door may not work when trying to connect to a 
-server other than Pegasus on the same system. If cimcli is to be used to connect to a CIM Server other
-than Pegasus on the same system use -l localhost or -l 127.0.0.1 or the actual name or IP address.
-This will force cimcli to make the connection in the normal way, not using connectLocal()
+Host name or IP address and optionally port for this operation. The
+default for this command if the the -n option is not used is to use
+the Pegasus connectLocal() function to connect to the server.  Note
+that this means that a command like cimcli gc CIM_Door may not work
+when trying to connect to a server other than Pegasus on the same
+system. If cimcli is to be used to connect to a CIM Server other than
+Pegasus on the same system use -l localhost or -l 127.0.0.1 or the
+actual name or IP address.  This will force cimcli to make the
+connection in the normal way, not using connectLocal()
 .TP
 .B \-u [user-name]
 The user name to be used in in the connection to the CIM server for the command
@@ -113,44 +139,54 @@ The user name to be used in in the connection to the CIM server for the command
 .B \-p [password]
 The password to be used in the connection to the CIM server for the command
 
-In addition there is a set of options that modifies the manner in which the command is executed or
-the display of information on response including the following:
+.SH COMMAND MODIFICATION OPTIONS
+
+In addition there is a set of options that modifies the manner in
+which the command is executed or the display of information on
+response including the following:
 
 .TP
 .B \--t
-Measure time for the operation to be completed and report it upon command completion. If this option
-is set, the time for the operation is recorded upon completion of the operation.  In addition, the 
-client infrastructure is qeieried to determine if the operation execution times optionally measured
-in the infrastructure and at the server are available. If they are, they are displayed also.  This
-would allow the user to see a) time spent in the server, b) round trip time for the operation, c)
-application round trip time for the operation. Note that when combined with the repeat option,
-the output includes maximum, minimum, and average times for the operation.  There are a specific operations
-in cimcli to turn control statistics generation (See son and soff operations)
+Measure time for the operation to be completed and report it upon
+command completion. If this option is set, the time for the operation
+is recorded upon completion of the operation.  In addition, the client
+infrastructure is qeieried to determine if the operation execution
+times optionally measured in the infrastructure and at the server are
+available. If they are, they are displayed also.  This would allow the
+user to see a) time spent in the server, b) round trip time for the
+operation, c) application round trip time for the operation. Note that
+when combined with the repeat option, the output includes maximum,
+minimum, and average times for the operation.  There are a specific
+operations in cimcli to turn control statistics generation (See son
+and soff operations)
 .TP
 .B \--r [repeat_count]
-Repeat the operation repeat_count times. This repeats the operation without disconnecting. This option is
-useful for setting up tests that load the server with repeated calls and also for getting average times for
-an operation by taking the average of a number of calls ( when used with the summary information option and
-the measure time option). 
+Repeat the operation repeat_count times. This repeats the operation
+without disconnecting. This option is useful for setting up tests that
+load the server with repeated calls and also for getting average times
+for an operation by taking the average of a number of calls ( when
+used with the summary information option and the measure time option). 
 .TP
 .B \-delay [seconds]
 Delay count seconds between connect and operation.
 .TP
 .B \--sum
-Present only summary information, not full output.  Generally it presents counts of objects returned and 
-response times in place of the names or objects themselves.
+Present only summary information, not full output.  Generally it
+presents counts of objects returned and response times in place of the
+names or objects themselves.
 .TP
 .B \--count [object_count]
-Defines an expected count of objects expected on the response.  An error exit is generated if this
-number of objects is not received.  This test can be used in batch files to test for number of objects
+Defines an expected count of objects expected on the response.  An
+error exit is generated if this number of objects is not received.
+This test can be used in batch files to test for number of objects
 returned by an operation. 
 .TP
 .B \--timeout [seconds]
 Set the connect timeout to some time other than the default timeout.
 .TP
 .B \-o [ "xml" | "mof" ]
-Output type for commands that output objects. Used with commands that present CIM objects in
-their response.
+Output type for commands that output objects. Used with commands that
+present CIM objects in their response.
 .TP
 .B \-verbose
 Displays details on the options for the CIM Operation and execution.
@@ -163,42 +199,116 @@ be used in inputting an operation defintion and they they are case independent.
 
 .TP
 .B ci    CreateInstance
-NOTE: This command is not implemented in the current version and return a
-fixed "NOT IMPLEMENTED" response.
-This command issues the CIM operation create instance with the parameters provided.
-It requires the [object] parameter defining the class for which the instance is to
-be created and also allows for an optional set of parameters that defined properties
-to be provided in the following format
+This operation allows the creation of instances by building the
+properties from a combination of the Class and properties provided
+with the input. The command issues the CIM operation createInstance
+with an instance built from the parameters provided.  It requires the
+[object] parameter defining the class for which the instance is to be
+created and also allows for an optional set of parameters that define
+properties to be provided in the created instancein the following
+format:
 
   [propertyName]=value
+     where value may be either a scalar for scalar propertiese or an array
+     for array properties.
+
+  The detailed form for the input is defined in section TBD.   
+
+
+TBD If the propertyName parameter is provided with no value, the default
+is inserted.  
+
+The operation first accesses the cimserver for the class definiton and
+uses this information to build the proper values for instances.
+
+TBD Note that the CIM operation is issued even if the property name is
+illegal or the type field does not match the type in the Class since this is considered to be a test program.
+
+The command actually reads the CIM_Class, inserts the properties that
+have been defined on the command line using the value type from the
+class.
+
+The simplest form of this command is to input the class name and a set
+of name/value pairs representing the properties for which values are
+to be inserted. In this case, the instance is created with all
+propertese for which name/value pairs are supplied are found in the
+instance and the values substituted into the properties.
+
+To create an instance with less than the full set of properties,
+supply only those properties that you wish to be defined.
+
+[FUTURE]Finally, the capability exists to create "incorrect" properties as an
+additional test capability. Generally this means properties with an
+incorrect type or with names that are not part of the class for which
+the instance is being built.  
 
-If the propertyName parameter is provided with no value, the default is inserted.
-Note that the CIM operation is issued even if the property name is illegal since this 
-is considered to be a test program.
+if a property value definition is supplied with the form
 
-The command actually reads the CIM_Class, inserts the properties that have been defined
-on the command line using the value type from the class.
+ "("PropertyType")"[propertyName]=value
+
+where property type is one of the CIM property types (i.e. boolean,
+String, uint8, etc.) the property will be recreated or added to the
+instance with that type and name.  Thus, a property can be added with
+an incorrect name or with an incorrect type overriding the definition
+in the class.
 
 The command will be rejected if the class does not exist in the namespace.
 
 .B Example:
 
-       cimcli ci CIM_door name=abc size=zyx
+       cimcli ci CIM_xxxx name=abc size=zyx
+       cimcli ci CIM_xxxx name=abc (uint32)badpropertyname=32
+              create an instance of CIM_door with name property value = abc, 
+              a property added named badpropertyname with type uint32 and value
+              of 32. All other properties in the instance are the default from the
+              class definition.
+   cimcli ci CIM_xxxx name=abc arrayParam={abc,def,ghi,"jkl mno" \
+          numericArray=1,2,3,4
+
+
+TBD: Creating array properties.
+
+Returns the object path of the created instance if the call to the cim
+server was executed.  Otherwise it returns the exception received.
 
-Returns the object path of the created instance if the call to the cim server was executed.
-Otherwise it returns the exception received.
+
+.TP
+.B mi    ModifyInstance
+This operation allows the modification of existing instances in the
+target server by building the properties from a combination of the
+target Class and properties provided with the input. The command
+issues the CIM operation modifyInstance with an instance built from
+the parameters provided.  It requires the [object] parameter defining
+the class for which the instance is to be created and a set of
+parameters that define properties to be provided in the created
+instance in the following format:
+    
+    [propertyName]=<propertyValue>
+
+Note that the key properties must be included in the defined
+properties to identify the instance to be modified.
+
+In the same manner as the createInstance, this command first acquires
+the class definition for the server and uses the property type
+information from the class to properly crate the property value types
+from the input propertValues.
+
+In addition to the property defintions, this command allows the
+property list options (-pl) that defines a property list to be
+supplied to the target server with the modifyInstance CIM Operation.
 
 .TP
 .B ec    EnumerateClasses
-Issues the enumerateClasses CIM operation which enumerates the class hiearchy starting at the level
-defined by <classname>.
+Issues the enumerateClasses CIM operation which enumerates the class
+hiearchy starting at the level defined by <classname>.
 
 The format is:
 .B      cimcli ec [classname] [options]
 
-where classname is not required.  If it is omitted, cimcli inserts an empty classname into the CIM operation
-which tells the CIM Server to start at the top of the class inheritance tree. 
-The possible options that represent the parameters of the enumerateClasses operation are:
+where classname is not required.  If it is omitted, cimcli inserts an
+empty classname into the CIM operation which tells the CIM Server to
+start at the top of the class inheritance tree.  The possible options
+that represent the parameters of the enumerateClasses operation are:
 
 
 .B \-niq
@@ -209,8 +319,9 @@ Boolean that defines whether properties from superclasses
 are included in the response. the -nlo option turns this parameter off
 
 .B \-cl 
-Boolean parameter sets the operation parameter classOrigin in the operation request. the CIMServer
-is expected to return classOrigin information as part of the response.
+Boolean parameter sets the operation parameter classOrigin in the
+operation request. the CIMServer is expected to return classOrigin
+information as part of the response.
 
 .B \-pl [propertyList]
 Optional property list for the operation.
@@ -239,8 +350,8 @@ class origin
 .B \-pl [propertyList]
 optional property list for the operation.
 
-On this operation the classname parameter is optional similar to the way the CIM operation
-is defined.
+On this operation the classname parameter is optional similar to the
+way the CIM operation is defined.
 
 .B Examples
        TBD
@@ -256,17 +367,20 @@ to this command the following:
 
     object - classname for which instancenames are to be enumerated.
 
-It displays the instances names that were returned by the CIM server in response to
-the enumerateInstances CIM operation with the defined input parameters. if the -s option is set
-it returns only the count of names returned.
+It displays the instances names that were returned by the CIM server
+in response to the enumerateInstances CIM operation with the defined
+input parameters. if the -s option is set it returns only the count of
+names returned.
 
-In order to provide all of the options allowed for the CIM operation EnumerateInstances it uses the following
-options specific to the command:
+In order to provide all of the options allowed for the CIM operation
+EnumerateInstances it uses the following options specific to the
+command:
 
 -B \-nlo
-not local only operation parameter to false. Note that this negative form for the
-option is used becaused the default for local only parameter is true. Thus, not including this
-parameter means that the parameter is not set.
+not local only operation parameter to false. Note that this negative
+form for the option is used becaused the default for local only
+parameter is true. Thus, not including this parameter means that the
+parameter is not set.
 
 .B Example:
 
@@ -304,21 +418,25 @@ Set the output format for the instances to display the returns as mof
 .B \-pl [propertyList]
 optional property list for the operation
         
-It returns the instances found either as MOF or XML depending on the output options parameter.
+It returns the instances found either as MOF or XML depending on the
+output options parameter.
 
 .B Example
 
     cimcli ei CIM_ComputerSystem -niq -di
 
-    This example enumerates CIM_ComputerSystem in the namespace root/CIMV2 (default) requesting without
-qualifiers (-niq) with deepInheritance (-di).  
+    This example enumerates CIM_ComputerSystem in the namespace
+    root/CIMV2 (default) requesting without qualifiers (-niq) with
+    deepInheritance (-di).  
 
 .TP
 .B niall enumerateallinstanceNames
-Execute an enumerateinstancenames on all classes to get all instance names within the defined namespace.
-This function searches the complete namespace using the CIM getClass operation to get the classes and the
-enumerateInstanceNames command to enumerate all of the instances for each class. It returns
-the list of all of the instance names found in the namespace.
+Execute an enumerateinstancenames on all classes to get all instance
+names within the defined namespace.  This function searches the
+complete namespace using the CIM getClass operation to get the classes
+and the enumerateInstanceNames command to enumerate all of the
+instances for each class. It returns the list of all of the instance
+names found in the namespace.
 
 The format is:
 
@@ -330,15 +448,15 @@ where the options include any of the universal options (ex. namespace, location,
 
     cimcli niall -n test/testproviders
 
-    Returns all instancenames in the namespace test/testproviders by executing enumerateinstancenames
-    on each class in the namespace.
+    Returns all instancenames in the namespace test/testproviders by
+    executing enumerateinstancenames on each class in the namespace.
 
 .TP
 .B mi    modifyinstance
-NOTE: This command is not implemented in the current version and return a
-fixed "NOT IMPLEMENTED" response.
-This is the same format as the createinstance.  The difference is that the instance
-must already exist to be modified.
+NOTE: This command is not implemented in the current version and
+return a fixed "NOT IMPLEMENTED" response.  This is the same format as
+the createinstance.  The difference is that the instance must already
+exist to be modified.
 
 .TP
 .B gi    GetInstance
@@ -354,20 +472,22 @@ OR
 
 .B     cimcli gi [class-name] [options]
 
-which presents a list of possible instances to the user from which one can be selected
-for the getinstance.  In this case, the command actually executes an enumerateInstanceNames
-to get the list of instances that is presented to the user.  The getInstance is executed
+which presents a list of possible instances to the user from which one
+can be selected for the getinstance.  In this case, the command
+actually executes an enumerateInstanceNames to get the list of
+instances that is presented to the user.  The getInstance is executed
 after the user makes a selection.
 
-This command requieres the [objectname] parameter.  If the parameter is an instance with
-keys defined (a CIMObjectPath), the a getInstance CIM operation is executed and the
-return from the CIM Server presented (in either xml or mof depending on the ouput option).
-If the input is a class name, a enumerateinstanceNames CIM Operation is executed and if
-any instance names are returned the result is presented to the console for the user to
-select one of the instances to be deleted.
+This command requieres the [objectname] parameter.  If the parameter
+is an instance with keys defined (a CIMObjectPath), the a getInstance
+CIM operation is executed and the return from the CIM Server presented
+(in either xml or mof depending on the ouput option).  If the input is
+a class name, a enumerateinstanceNames CIM Operation is executed and
+if any instance names are returned the result is presented to the
+console for the user to select one of the instances to be deleted.
 
-If there are no instances, the return from this command is normally an exception as defined
-in the DMTF CIM Operations specification..
+If there are no instances, the return from this command is normally an
+exception as defined in the DMTF CIM Operations specification..
 
 
 The possible options specific to this command are:
@@ -385,23 +505,25 @@ optional property list for the operation
 
        cimcli gi cim_managedElement
 
-This is an interactive request that returns a list of instances from an
-enumerateinstance of CIM_ManagedElement from which the user can select one which cimcli
-will return as a complete instance.
+This is an interactive request that returns a list of instances from
+an enumerateinstance of CIM_ManagedElement from which the user can
+select one which cimcli will return as a complete instance.
 
 
 .TP
 .B di    deleteinstance
-Delete instance executed a single deleteInstance command to the CIM Server.  The syntax is
+Delete instance executed a single deleteInstance command to the CIM
+Server.  The syntax is:
 
 .B     cimcli di [objectname] [options]
 
-This command requires the [objectname] parameter.  If this parameter is a full instance
-name with className and key bindings, the deleteInstance CIM Operation is executed
-directly.  If it is a class name with no keybindings, the  enumerateInstances command
-is executed and the list of returned instances presented to the console for the user
-to select one to delete.  cimcli then executes deleteInstance with the selected instance
-name and returns the response,
+This command requires the [objectname] parameter.  If this parameter
+is a full instance name with className and key bindings, the
+deleteInstance CIM Operation is executed directly.  If it is a class
+name with no keybindings, the  enumerateInstances command is executed
+and the list of returned instances presented to the console for the
+user to select one to delete.  cimcli then executes deleteInstance
+with the selected instance name and returns the response,
 
 return - there is an empty response if the instance was successfully deleted or
 an exception return if there were any errors.
@@ -434,7 +556,8 @@ This command is not implemented.
 
 .TP
 .B eq    enumeratequalifiers
-Issues the CIM Operation to enumerate all of the qualifiers defined in the target namespace. The syntax is:
+Issues the CIM Operation to enumerate all of the qualifiers defined in
+the target namespace. The syntax is:
 
        cimcli eq [options]
 
@@ -442,7 +565,8 @@ There are no special options for this operation.
 
 .TP
 .B dq    deletequalifier
-Issues the CIM operation to delete the target qualifier defined by qualifier_name in the target namespace.
+Issues the CIM operation to delete the target qualifier defined by
+qualifier_name in the target namespace.
 The Syntax is:
 
 cimcli dq [qualifier_name] [options]
@@ -452,15 +576,17 @@ NOTE: This should be used with great caution.
 
 .TP
 .B a     associators
-Enumerate the associators CIM Operation for the target objectname.  The syntax for this operation
+Enumerate the associators CIM Operation for the target objectname.
+The syntax for this operation
 is:
  
 .B    cimcli a [objectname] [options]
 
-Note that the objectname may be either a classname or an instancename.  If classname
-is supplied, the return is a set of classes that match the objectname supplied
-unless the -i (interactive) parameter is used.  If objectname
-is used, the response is instances of the association that matches the classname.
+Note that the objectname may be either a classname or an instancename.
+If classname is supplied, the return is a set of classes that match
+the objectname supplied unless the -i (interactive) parameter is used.
+If objectname is used, the response is instances of the association
+that matches the classname.
 
 The options provide the various operation parameters including;
 
@@ -483,9 +609,10 @@ includeClassOrigin The -ic parameter
 Optional PropertyList
 
 .B \-i
-Interactive request - If this parameter is supplied and the objectname is a classname, the
-   environment performs an enumerateinstances on the objectname and presents the list of possible
-   instances for user selection
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
 .TP
 .B an    associatornames
 Enumerate teh associator names for the target object.  The syntax for this operation
@@ -510,9 +637,10 @@ String defining the role parameter for the CIM Operation
 resultrole parameter
 
 .B \-i
-Interactive request - If this parameter is supplied and the objectname is a classname, the
-   environment performs an enumerateinstances on the objectname and presents the list of possible
-   instances for user selection
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
 
 .TP
 .B r references
@@ -521,10 +649,11 @@ The format of the operation is:
 
        cimcli r [objectname] [options]
 
-Note that the objectname may be either a classname or aninstancename.  If classname
-is supplied, the return is a set of classes that match the objectname supplier
-unless the -i (interactive) parameter is used.  If objectname
-is used, the response is instances of the association that matches the classname
+Note that the objectname may be either a classname or aninstancename.
+If classname is supplied, the return is a set of classes that match
+the objectname supplier unless the -i (interactive) parameter is used.
+If objectname is used, the response is instances of the association
+that matches the classname
 
 Where the options specifically used by this operation are:
 
@@ -544,9 +673,10 @@ Boolean to set include class origin operation parameter to true.
 optional property list for the operation
 
 .B \-i
-Interactive request - If this parameter is supplied and the objectname is a classname, the
-   environment performs an enumerateinstances on the objectname and presents the list of possible
-   instances for user selection
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
 
 .B Examples
     TBD   
@@ -558,10 +688,11 @@ The format of the operation is:
 
 .B     cimcli rn [objectname] [options]
 
-Note that the objectname may be either a classname or a specific instancename.  If classname
-is supplied, the return is a set of classnames that match the objectname supplier
-unless the -i parameter is used.  If objectname
-is used, the response is instance namess of the associations that matches the classname
+Note that the objectname may be either a classname or a specific
+instancename.  If classname is supplied, the return is a set of
+classnames that match the objectname supplier unless the -i parameter
+is used.  If objectname is used, the response is instance namess of
+the associations that matches the classname
 
 Where the options specifically used by this operation are:
 
@@ -572,13 +703,16 @@ role parameter for the CIM Operation
 resultClass parameter for the CIM Operation
 
 .B \-i
-Interactive request - If this parameter is supplied and the objectname is a classname, the
-   environment performs an enumerateinstances on the objectname and presents the list of possible
-   instances for user selection
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
 
 .TP
 .B im    invokeMethod
-This operation executes an extrinsic operation to execute a method on a CIM class or instance.
+This operation executes an extrinsic operation to execute a method on
+a CIM class or instance.
+
 The form of the command is:
 
 .B     cimcli im [objectname] [methodname] *[parameters] [options]
@@ -588,15 +722,15 @@ the [methodname].
 
 Parametere are input in the form:
 
-The completed operations displays the return code from the command and any parameters that
-are qualified as OUT parameters.
+The completed operations displays the return code from the command and
+any parameters that are qualified as OUT parameters.
 
 .B Example:
 
        cimcli PG_WBEMSLPTemplate register -n root/PG_Interop
 
-The parameters are supplied as name=value pairs. In the current version, all parameters are
-treated as strings.  
+The parameters are supplied as name=value pairs. In the current
+version, all parameters are treated as strings.  
 
 .TP
 .B eq    executeQuery
@@ -604,13 +738,16 @@ treated as strings.
 
 .TP
 .B son
-Set the CIMServer statistics to enabled by doing a modify instance of the CIM_ObjectManager
-instance that defines the server. This depends on the server having implemented statistics and
-having also implemented the functionality of enabling and disabling statistics through setting
-this property in CIM_ObjectManager.  This should be considered a temporary operation in cimcli until
-a more permanent utility is provided with OpenPegasus to manage this type of functionality.  The
-corresponding operation soff will attempt to disable statistics on the server.  This works with
-OpenPegasus servers starting with version 2.5.1.
+Set the CIMServer statistics to enabled by doing a modify instance of
+the CIM_ObjectManager instance that defines the server. This depends
+on the server having implemented statistics and having also
+implemented the functionality of enabling and disabling statistics
+through setting this property in CIM_ObjectManager.  This should be
+considered a temporary operation in cimcli until a more permanent
+utility is provided with OpenPegasus to manage this type of
+functionality.  The corresponding operation soff will attempt to
+disable statistics on the server.  This works with OpenPegasus servers
+starting with version 2.5.1.
 
 The syntax of the operation is:
 
@@ -618,15 +755,17 @@ The syntax of the operation is:
 
 .TP
 .B soff
-See the operaiton son.  This is the corresponding operation to turn off statistics in the server.
+See the operaiton son.  This is the corresponding operation to turn
+off statistics in the server.
 The syntax of the operation is:
 
 .B     cimcli soff
 
 .TP
 .B ns    enumeratenamespaces
-Request an Enumeration of all the namespaces in the target CIM Server.  This command uses both
-the CIM_Namespace class and if that fails, the __Namespace class to determine the list of namespaces.
+Request an Enumeration of all the namespaces in the target CIM Server.
+This command uses both the CIM_Namespace class and if that fails, the
+__Namespace class to determine the list of namespaces.
 
 RETURN - It returns a list of the namespace names returned by the CIM Server.
 
@@ -643,68 +782,85 @@ Note that since this operation enumerates namespaces, the namespace option (-n)
 This operation simply shows the Command options
 
 .SH OPTIONS LIST
-There are a significant number of options to this utility, some if which provide specific information 
-for one or more commands and some of which are universal across all of the commands.   In general, the
-program does not check for spurious options so that if you input an option that is not used by a particular
-operation, it is simply ignored. Note that some of the options require parameters.
- The following is an alphabetic list of the options.
+There are a significant number of options to this utility, some if
+which provide specific information for one or more commands and some
+of which are universal across all of the commands.   In general, the
+program does not check for spurious options so that if you input an
+option that is not used by a particular operation, it is simply
+ignored. Note that some of the options require parameters.
+
+The following is an alphabetic list of the options:
 .TP 
 .B \-ac assocaton_class_name
-The Association Class parameter defines an assocClass string for Associator calls (associators and associatornames).
+The Association Class parameter defines an assocClass string for
+Associator calls (associators and associatornames).
 Default(). Example:
 -ac CIM_ManagedElement
 .TP 
 .B \-ar [association_role_name]
-Defines an association role for associator operations. Example: -ar dependent. This optional parameter is used only
-with the association CIM Operations.
+Defines an association role for associator operations. Example: -ar
+dependent. This optional parameter is used only with the association
+CIM Operations.
 .TP
 .B \-count [count]
-Expected count of objects returned if the summary set. Tests this count and display difference.
-Terminates the cimcli call nonzero if test fails  . Default(). This can be used in testing to confirm that a predefined
-number of objects is returned. Example: -count 100 will expect 100 objects or names to be returned
+Expected count of objects returned if the summary set. Tests this
+count and display difference.  Terminates the cimcli call nonzero if
+test fails  . Default(). This can be used in testing to confirm that a
+predefined number of objects is returned. Example: -count 100 will
+expect 100 objects or names to be returned
 .TP
 .B \-delay [time in seconds]
-Delay between connection and request . Default(0). example -delay 3 delays 3 seconds between the call and the
-transmisson of the actual CIM operation.  This is used only in some testing environments.
+Delay between connection and request . Default(0). example -delay 3
+delays 3 seconds between the call and the transmisson of the actual
+CIM operation.  This is used only in some testing environments.
 .TP
 .B \-di
-Specifies the boolean parameter deepInheritance parameter for selected commands. Setting this options 
-causes the deepinheritance=tru to be transmitted for the operation.
-Note that this means different things to different commands and is used only with the enumerate commands.
+Specifies the boolean parameter deepInheritance parameter for selected
+commands. Setting this options causes the deepinheritance=tru to be
+transmitted for the operation.  Note that this means different things
+to different commands and is used only with the enumerate commands.
 .TP
 .B \-ic
 Boolean to set include class origin operation parameter to true.
 .TP
 .B \-iq
-(DEPRECATED}Specifies the includeQualifiers operation input paramter for selected commands.Since the server default 
-for this parameter is normally true, This option
-is deprecated in favor of the -niq parameters  
+(DEPRECATED}Specifies the includeQualifiers operation input paramter
+for selected commands.Since the server default for this parameter is
+normally true, This option is deprecated in favor of the -niq
+parameters  
 .TP
 .B \-l [location]
-Define CIMServer host address for the operation.  This includes either name or IP address and optional
-port number(HostName:port).  The default is localhost:5988.  If name is used without port, port 5988 is assumed.
+Define CIMServer host address for the operation.  This includes either
+name or IP address and optional port number(HostName:port).  The
+default is localhost:5988.  If name is used without port, port 5988 is
+assumed.
 Examples include -l fred, -l fred:9999, -l 10.1.134.66 -l 10.1.134.123:5977
 
 .TP
 .B \-lo
-Specifies the localOnly operation parameter for selected commands if the option is set.
-See the commands for more information. This option is Deprecated in favor of the -nlo because the
-default for local only is on so that generally the -lo is simply the default.  We recommend using
+Specifies the localOnly operation parameter for selected commands if
+the option is set.  See the commands for more information. This option
+is Deprecated in favor of the -nlo because the default for local only
+is on so that generally the -lo is simply the default.  We recommend
+using
 -nlo to turn off local only.
 
 .TP
 .B \-n [Namespace]
-Defines the namespace for the operation.host name. The default is root/cimv2. exmple -n root/PG_Interop sets
-the root/PG_Interop namespace as the namespace for the current operation. 
+Defines the namespace for the operation.host name. The default is
+root/cimv2. exmple -n root/PG_Interop sets the root/PG_Interop
+namespace as the namespace for the current operation. 
 
 .TP 
 .B \-p [password]
-Allows input of a password for server authentication of the command. ( ex. -p 12345678). The default is
-that the command is submitted with no password.
+Allows input of a password for server authentication of the command. (
+ex. -p 12345678). The default is that the command is submitted with no
+password.
 
 .TP 
 .B \-u [User]
-Defines nser ame for CIM Server authentication. Default is no user name and no authentication.
+Defines nser ame for CIM Server authentication. Default is no user
+name and no authentication.
 ( ex -u john) Default is no user name and no authentication.
 
 .TP 
@@ -722,11 +878,15 @@ Sets includeQualifiers = false on operations. Default(false).
 
 .TP 
 .B \-pl [propertyList]
-Defines a propertyName List which is an optional parmeter for some CIM Operations. Format is p1,p2,p3 (without spaces).
-Default is that the property list is set to NULL indicating normally that the operation should return all properties.
-The property list typically has 3 possibilities 1) empty which means return no properties, 2) list of properties to
-be returned, 3) NULL which means return all properties.  Since the default is NULL, not applying the option means that
-all properties are being requested.  To set this parameter to empty use the form -pl "". 
+Defines a propertyName List which is an optional parmeter for some CIM
+Operations. Format is p1,p2,p3 (without spaces).  Default is that the
+property list is set to NULL indicating normally that the operation
+should return all properties.  The property list typically has 3
+possibilities 1) empty which means return no properties, 2) list of
+properties to be returned, 3) NULL which means return all properties.
+Since the default is NULL, not applying the option means that all
+properties are being requested.  To set this parameter to empty use
+the form -pl "". 
 
 
 .TP
@@ -739,11 +899,14 @@ Defines a resultClass string for References and Associatiors. Default()
 
 .TP
 .B \-rr [resultRole]
-Defines a role string for associators operation resultRole parameter. . Default()
+Defines a role string for associators operation resultRole parameter.
+. Default()
 
 .TP
 .B \-ip [inputParameterList]
-Defines an invokeMethod input parameter list. Format is p1=v1,p2=v2,..,pn=vn (without spaces) . Default()
+Defines an invokeMethod input parameter list. Format is:
+
+p1=v1,p2=v2,..,pn=vn (without spaces) . Default()
 
 .TP
 .B \-f [filter]
@@ -763,15 +926,19 @@ Displays cimcli and Pegasus software Version.
 
 .TP
 .B \-v
-Verbose Display. Includes Detailed Param Input display . Default(false). Outputs extra information about the
-parameters actually used in the request and the return from the operation.  This is primarily a debugging tool.
+Verbose Display. Includes Detailed Param Input display .
+Default(false). Outputs extra information about the parameters
+actually used in the request and the return from the operation.  This
+is primarily a debugging tool.
 
 .TP
 .B \--sum
-Displays only summary counts for enumerations, associators, etc.This option is used to with the
-repeat option to repeat an operation without getting the full return display.  It reduces the display to summary
-information.  It is often used with the time option --t to generate time for execution information on many repetitions
-of a command.
+Displays only summary counts for enumerations, associators, etc.This
+option is used to with the repeat option to repeat an operation
+without getting the full return display.  It reduces the display to
+summary information.  It is often used with the time option --t to
+generate time for execution information on many repetitions of a
+command.
 
 .TP
 . B \-h
@@ -787,20 +954,20 @@ Prints list of cimcli options.
 
 .TP
 .B \-hc
-Prints cimcli Operation command list.  This list includes the CIM Operatons defined by
-the CIM Operations specification and other operations that were felt to be useful in
-testing CIM environments.
+Prints cimcli Operation command list.  This list includes the CIM
+Operatons defined by the CIM Operations specification and other
+operations that were felt to be useful in testing CIM environments.
 
 .TP
 .B \--timeout [seconds]
-Set the connection timeout in seconds. If not set, the timeout
-is the default Pegasus client timeout which for Pegasus is normally to about 30 seconds. This option executes
-the client call to set timeout.
+Set the connection timeout in seconds. If not set, the timeout is the
+default Pegasus client timeout which for Pegasus is normally to about
+30 seconds. This option executes the client call to set timeout.
 
 .TP
 .B \-d
-More detailed debug messages from cimcli. This can be useful in the case where the user is debugging
-CIM funtionality.
+More detailed debug messages from cimcli. This can be useful in the
+case where the user is debugging CIM funtionality.
 
 .TP
 .B \-trace [trace_level]
@@ -809,42 +976,53 @@ set to 0 - 4.
 
 .TP
 .B \--r [repeat_count]
-Number of times to repeat the function. Zero means one time. The option ca be used to
-repeate an operation within a single call to cimcli.  It simply repeats the operation defined the
-number of times defined by the repeate_count within the same connection.  Thus, it establishes
-the connection executes the operation repeat_count times and then terminates.  It can be used with
-the --time option to measure execution times for many repetitions of an operation.
+Number of times to repeat the function. Zero means one time. The
+option ca be used to repeate an operation within a single call to
+cimcli.  It simply repeats the operation defined the number of times
+defined by the repeate_count within the same connection.  Thus, it
+establishes the connection executes the operation repeat_count times
+and then terminates.  It can be used with the --time option to measure
+execution times for many repetitions of an operation.
 
 .TP
 .B --t
-Measure time for the operation and present results. When set the response
-time for the operation is presented with the command output. If the --r (repeat) option is
-set, minimum, maximum, and average times are presented.  Note that the time for the operation itself
-is presented in addition to the overall time for connect, operation, and disconnect.  If statistics
-are being gathered by the server, setting this option also presents the server time, and the
-client round trip time which are calculated by the server and client infrastructure. 
+Measure time for the operation and present results. When set the
+response time for the operation is presented with the command output.
+If the --r (repeat) option is set, minimum, maximum, and average times
+are presented.  Note that the time for the operation itself is
+presented in addition to the overall time for connect, operation, and
+disconnect.  If statistics are being gathered by the server, setting
+this option also presents the server time, and the client round trip
+time which are calculated by the server and client infrastructure. 
 
 .TP
 .B -s
-Boolean option thatpecifies that the Client should attempt to connnect over the secure connection using SSL. This option
-causes cimcli to modify the client connect call to set the SSLContext option to the certificate defined 
-with the --cert and --key options.  If this option is set but neither the --cert or --key options are included,
-the SSLContext for the connect call is submitted with the Cert and key marked NULL.
+Boolean option thatpecifies that the Client should attempt to connnect
+over the secure connection using SSL. This option causes cimcli to
+modify the client connect call to set the SSLContext option to the
+certificate defined with the --cert and --key options.  If this option
+is set but neither the --cert or --key options are included, the
+SSLContext for the connect call is submitted with the Cert and key
+marked NULL.
 
 .TP
 .B --cert
-Defines a certificate to be used with the client connect if the -s option is set. This is optional and used
-only  with the -s and --key options.
+Defines a certificate to be used with the client connect if the -s
+option is set. This is optional and used only  with the -s and --key
+options.
 
 .TP
 .B --key
-Defines a Client private key. This is optional and only has an effect on connections made over HTTPS using -s
+Defines a Client private key. This is optional and only has an effect
+on connections made over HTTPS using -s
 
 .SH EXAMPLES
 
-Execute an enumerateinstancenames CIM operation for the pg_computersystem Class
+Execute an enumerateinstancenames CIM operation for the
+pg_computersystem Class
 .br
-cimcli enumerateinstancenames pg_computersystem  -- enumerateinstances of class
+cimcli enumerateinstancenames pg_computersystem  -- enumerateinstances
+of class
 .br
    or
 .br
@@ -871,11 +1049,11 @@ Enumerate class names from the namespace "root"
 
  cimcli getqualifiers -- Get the qualifiers in mof output format
 .SH BUGS
-Currently at least some platforms and shells have problems with the double-quote which
-is used extensively in object names within CIM. To get around this, the
-character '@' has been mapped to the double-quote so that inputting
-a command line with this character in place of quotes is acceptable.
-Thus, for example, 
+Currently at least some platforms and shells have problems with the
+double-quote which is used extensively in object names within CIM. To
+get around this, the character '@' has been mapped to the double-quote
+so that inputting a command line with this character in place of
+quotes is acceptable.  Thus, for example, 
 
 cimcli rn TST_Person.name=@MIKE@ ...
 
index 93090857352d3fb112b9719cd0e051ace7ed83b2..257c442da8a4fecce109d5aa76167d1b59b5316c 100644 (file)
@@ -42,7 +42,7 @@ include $(ROOT)/mak/config.mak
 
 GROFFOPTIONS=man
 # old was man
-DOCUMENT=CLI
+DOCUMENT=cimcli
 SOURCE=$(DOCUMENT).nroff
 
 html:
diff --git a/src/Clients/cimcli/doc/cimcli.html b/src/Clients/cimcli/doc/cimcli.html
new file mode 100644 (file)
index 0000000..a05c4cf
--- /dev/null
@@ -0,0 +1,1511 @@
+Content-type: text/html
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML><HEAD><TITLE>Man page of cimcli</TITLE>
+</HEAD><BODY>
+<H1>cimcli</H1>
+Section: User Commands  (1)<BR>Updated: LOCAL<BR><A HREF="#index">Index</A>
+<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
+
+<BR>&nbsp;
+<A NAME="lbAB">&nbsp;</A>
+<H2>NAME </H2>
+
+cimcli - command line WBEM Client 
+<A NAME="lbAC">&nbsp;</A>
+<H2>SYNOPSIS </H2>
+
+<B>cimcli [operation]  [operation target]  [options]  [value-parameters]</B>
+
+<P>
+cimcli is available for all platforms that support the Pegasus CIM Server.
+<P>
+<A NAME="lbAD">&nbsp;</A>
+<H2>DESCRIPTION </H2>
+
+<P>
+<B>cimcli</B>
+
+is a command line test tool for executing CIM client operations.  It 
+implements all of the DMTF CIM operations except for the modify and create 
+class/instance operations and includes several other operations that are 
+useful in testing CIM Servers including getting all namespaces and 
+enumerating all instances in a namespace.  
+<P>
+Each execution of cimcli invokes one or more CIM Operations with the command
+parameters equivalent to the CIM Operations defined in the CIM Operations over
+HTTP specification.
+<P>
+In addition to the basic CIM Operations defined in the DMTF specification 
+(DMTF DSP 0200), this tool implements a number of other specific operations that 
+support testing and querying CIM servers (ex. an operation to query for 
+namespaces and another to get all instances in a namespace) which require
+multiple CIM Operations. The additional operations include:
+<DL COMPACT>
+<DT><B>1.</B>
+
+<DD>
+Enumerate namespaces (ns) - Returns a list of the namespaces available
+from the CIMOM.
+<DT><B>2.</B>
+
+<DD>
+Enumerate all instance names (niall) - Returns a list of all instance
+names in the defined namespace.  
+<DT><B>3.</B>
+
+<DD>
+Turn CIM Server statistics on and off (DEPRECATED) - Turns the statistics flag
+in the Server CIMObjectManager Class on or off for the OpenPegasus server.
+This enables and disables execution of statistics gathering in the server.
+This command is retained for compatibility but is DEPRECATED and will be
+removed when a real alternative is included in the Pegasus release.
+<DT><B>4.</B>
+
+<DD>
+Test commands (ti) - A cimcli operation that executes tests of the characteristics
+of an instance in the CIM Server. This operation extend the capabilities of
+cimcli to actually compare information from the server with information in the
+command line input.
+<P>
+The format of the cimcli command is generally:
+<DT><B>cimcli [Operation] [Operation Target] [options] [value parameters]</B>
+
+<DD>
+<P>
+Note that options may be interspersed with the operation target parameter but
+that a) the ordering of [Operation] [Operation target is fixed and any  [value
+parameters] MUST occur after the [Operation Target]
+<P>
+<DT><B>[Operation] </B>
+
+<DD>
+Defines the  operation to be executed. cimcli executes all of the DMTF
+CIM Operations (ex. getclass) and a set of compound operation
+(enumeratenamespaces). There are two forms for each [Operation]
+definition, a short form typically two characters (i.e. gc) and the
+long form which is the full name of the operation (i.e. getclass). The complete
+set of operations can be viewed by calling cimcli with the option -hc.
+<DT><B>[Operation Target]</B>
+
+<DD>
+The Operation Target is the name of the object input with the operation.  
+This parameter is operation dependent. For example, with the getClass 
+operation the object is a CIM class name.  With the getinstance operation the 
+object is a CIM instance name.  Note that some of the commands do not require 
+an [Operation Target].  Thus, for example, the [Operation Target] is optional with the 
+enumerateClasses operation as it is with the equivalent 
+enumerateClassNames CIM operation.  Normally this is either a CIM class name or
+an instance name (classname plus keybindings).  In some operations one or
+the other is required.  In other operations, the behavior of the operation 
+is dependent on whether class name or instance name is supplied.
+<P>
+The format for instance name is defined as the model path in the CIM Specification
+and has the form:
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;classname&gt;.&lt;keyPropertyName1&gt;=
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;value1&gt;[,&lt;keypropertyNamex&gt;=&lt;valuex&gt;]*
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;valuex&gt;&nbsp;is&nbsp;either&nbsp;a&nbsp;numeric&nbsp;value&nbsp;or&nbsp;a&nbsp;string&nbsp;value
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;(enveloped&nbsp;in&nbsp;quotes).&nbsp;The&nbsp;quote&nbsp;marks&nbsp;surrounding
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;string&nbsp;values&nbsp;are&nbsp;required.
+<P>
+However, to make inputting command line object names, cimcli offers a second
+option for inputting the object name as [Operation Target].  In this second
+case, the Operation Target Target Object is simply the class name and value
+parameters are used to define the keypropertyName/value pairs.  In this case,
+the quotation marks around string property values are optional and are required
+only in the case where quotation marks would be required to define a value 
+such as a string that includes quotation marks.
+<P>
+Thus, as an example, the input for a getInstance might be:
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;gi&nbsp;TennisPlayer.first=&quot;Patrick&quot;,last=&quot;Rafter&quot;
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;or
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;gi&nbsp;TennisPlayer&nbsp;first=Patrick&nbsp;last=Rafter
+<P>
+In the second case, cimcli gets the class from the CIM Server and uses the
+parameters to form a correct CIMObjectPath. In the first case, generally cimcli
+uses the input path directly without getting the class from the server.
+<P>
+<DT><B>[options...] </B>
+
+<DD>
+Options are identified on the command line with the - or -- notation.
+There are several types of options:
+<P>
+<DT><B>1.</B>
+
+<DD>
+A set of options that are universal and modify or define the execution
+of the command or the form of the return.  This includes options like
+setting the output format for object responses or requesting only
+summary operation.
+<P>
+<DT><B>2.</B>
+
+<DD>
+Options that defined the connection for the operation.  This includes options
+for defining the CIMServer address, namespace, and security options such as
+user name, password and SSL settings.
+<DT><B>3.</B>
+
+<DD>
+A set of options that represent the optional input parameters for
+selected operations. The [operation] defines the CIM Operation that will be
+executed and the options define the optional request parameters.  Typical
+context options might be -n namespace (used on most but not all
+operations)or -niq which sets includequalifiers to false for
+operations that use the includeQualifiers optional parameter.
+<DT><B>4</B>
+
+<DD>
+A set of options to display help (-h, --help, --ho to get a list of
+all options, and -hc to get a list of all commands). When these options
+are requested, no operation is executed.
+<DT><B>[value-parameters]</B>
+
+<DD>
+Some of the operations allow or require extra parameters. these are
+typically keywords or keyword/value pairs and are defined as part of
+the particular operation that use them.
+<P>
+Any extra parameter entities on the command line that occur after the 
+[Operation] and [Operation Target] and are not proceeded by &quot;-&quot; to 
+indicate an option are considered value parameters.  These are used in some 
+of the operations to provide additional information required or optionally 
+desired by the operation.  See each operation definition to determine if 
+extra parameters are required or allowed.  These may be either 
+keyname-value pairs in some cases or simply strings depending on the 
+operation.  
+<P>
+NOTE: cimcli does not protect the user against inputting extra options
+or parameters.  Since the options are heavily dependent on the
+operation to be executed, it simply ignores those options that are not
+used with a particular operation.  Thus, entering the -r option (role)
+with a getClass operation is syntatically allowed but cimcli ignores
+the parameter.
+<P>
+</DL>
+<A NAME="lbAE">&nbsp;</A>
+<H2>OPTIONS</H2>
+
+<P>
+<A NAME="lbAF">&nbsp;</A>
+<H3>Connection Options</H3>
+
+<P>
+There is a set of options which are general to all of the CIM
+Operations and most of the compound operations and which provide
+parameters for the initiation or execution of the operations (ie. identify
+the target server and set connection security parameters.. 
+These include:
+<DL COMPACT>
+<DT><B>-n [namespace]</B>
+
+<DD>
+Namespace name for this operation (ex. -n root). The default namespace
+is root/cimv2 if this parameter is not entered
+<DT><B>-l [location]</B>
+
+<DD>
+Host name or IP address and optionally port for this operation. The
+default for this command if the -n option is not used is to use
+the OpenPegasus connectLocal() function to connect to the server.  Note
+that this means that a command like cimcli gc CIM_Door may not work
+when trying to connect to a server other than Pegasus on the same
+system. If cimcli is to be used to connect to a CIM Server other than
+Pegasus on the same system use -l localhost or -l 127.0.0.1 or the
+actual name or IP address.  This will force cimcli to make the
+connection in the normal way, not using connectLocal()
+<DT><B>-u [user-name]</B>
+
+<DD>
+The user name to be used in the connection to the CIM server for the 
+command 
+<DT><B>-p [password]</B>
+
+<DD>
+The password to be used in the connection to the CIM server for the 
+command 
+<P>
+<DT><B>-s</B>
+
+<DD>
+Connect with SSL - Boolean option that specifies that cimcli should 
+attempt to connect over a secure connection using SSL.  This option 
+causes cimcli to modify the client connect call to set the SSLContext 
+option to the certificate defined with the --cert and --key options.  If 
+this option is set but neither the --cert or --key options are included, 
+the SSLContext for the connect call is submitted with the Cert and key 
+marked NULL.  
+<P>
+NOTE: Since SSL is considerd a compilable option with cimcli, these
+options may not even exist in a Pegasus environment that was compiled
+with the SSL capabilities disabled.
+<P>
+<DT><B>--cert [certificate file path]</B>
+
+<DD>
+Defines the file name of a certificate to be used with the client connect 
+if the -s option is set.  This is optional and used only with the -s and 
+--key options.  
+<P>
+<DT><B>--key [client key file path]</B>
+
+<DD>
+Defines the file name of a Client private key.  This is optional and only 
+has an effect on connections made over HTTPS using -s 
+<P>
+</DL>
+<A NAME="lbAG">&nbsp;</A>
+<H3>CIMCLI OPERATION MODIFICATION OPTIONS</H3>
+
+<P>
+There is a set of options that modifies the manner in
+which the command is executed or the display of information on
+response including the following:
+<P>
+<DL COMPACT>
+<DT><B>--t</B>
+
+<DD>
+Measure time for the operation to be completed and report it upon
+command completion. If this option is set, the time for the operation
+is recorded upon completion of the operation.  In addition, the client
+infrastructure is queiried to determine if the operation execution
+times optionally measured in the infrastructure and at the server are
+available. If they are, they are displayed also.  This would allow the
+user to see a) time spent in the server, b) round trip time for the
+operation, c) application round trip time for the operation. Note that
+when combined with the repeat option, the output includes maximum,
+minimum, and average times for the operation.  There are a specific
+operations in cimcli to turn control statistics generation (See son
+and soff operations)
+<DT><B>--r [repeat_count]</B>
+
+<DD>
+Repeat the operation repeat_count times. This repeats the operation
+without disconnecting. This option is useful for setting up tests that
+load the server with repeated calls and also for getting average times
+for an operation by taking the average of a number of calls ( when
+used with the summary information option and the measure time option). 
+<DT><B>-delay [seconds]</B>
+
+<DD>
+Delay count seconds between connect and operation.
+<DT><B>--sum</B>
+
+<DD>
+Present only summary information, not full output.  Generally it
+presents counts of objects returned and response times in place of the
+names or objects themselves.
+<DT><B>--count [object_count]</B>
+
+<DD>
+Defines an expected count of objects expected on the response.  An
+error exit is generated if this number of objects is not received.
+This test can be used in batch files to test for number of objects
+returned by an operation.
+<DT><B>--timeout [seconds]</B>
+
+<DD>
+Set the connect timeout to some time other than the default timeout.
+<DT><B>-o [ xml | mof | table]</B>
+
+<DD>
+Output type for commands that output objects. Used with commands that
+present CIM objects in their response. Presents the output in the form of
+xml corresponding to cim/xml model, mof, or for instances a table of
+the data in each property.
+<DT><B>-verbose</B>
+
+<DD>
+Displays details on the options and execution for the Operation.
+<DT><DD>
+</DL>
+<A NAME="lbAH">&nbsp;</A>
+<H3>OPERATION PARAMETER OPTIONS</H3>
+
+<P>
+There is a set of options that define request parameters for 
+specific cimcli Operation requests.  These are typically optional parameters 
+on the CIM operation request that modify the behavior of the server to the 
+request.  This includes things like requesting localonly, deep 
+inheritance, etc.  Note that the actual behavior 
+may be dependent on the particular operation request type.  The full 
+definition of these options is below here and their use with each specific 
+cimcli operation is defined with the operations.  
+<P>
+<DL COMPACT>
+<DT><B>-pl [propertylist]</B>
+
+<DD>
+Set the propertylist parameter for those operations that allow this parameter.
+The propertylist value for this parameter is a comma-separated list of 
+class properties.  This sets the propertylist optional parameter on those CIM 
+operations that allow this parameter including: getClass, getInstance, 
+modifyInstance, enumerateInstances, associators, and references.  If this 
+option is not defined on the execution of one of these operations, cimcli 
+sets the propertylist parameter to NULL indicating that all properties 
+should be returned.  
+<BR>&nbsp;
+If a comma-separated list of one or more properties is defined as the value
+for this option, a propertylist with these values is set on the CIM request
+operation.
+<BR>&nbsp;
+Since this CIM request parameter specifically allows 3 options: 1) list of 
+properties, 2) NULL which is the indicator that all properties are to be 
+returned, and 3) Empty which is the indicator that no properties are to be 
+include in the response, the cimcli options specifically allows defining 
+the empty option by setting propertylist to either &quot;&quot; or accepts either an input that the command processor interprets as an empty 
+string or as a string consisting of two quotation marks.  
+<P>
+The syntax of propertylist is:
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&lt;propertyName&gt;[,&lt;propertyName&gt;]*&nbsp;|&nbsp;&quot;&quot;
+<P>
+<B>Examples</B>
+
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;gc&nbsp;CIM_ManagedElement&nbsp;-pl&nbsp;Caption
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;gc&nbsp;CIM_ManagedElement&nbsp;-pl&nbsp;Caption,Description
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;gc&nbsp;CIM_ManagedElement&nbsp;-pl&nbsp;&quot;&quot;
+<P>
+<DT><B>-niq</B>
+
+<DD>
+Boolean (not_include_Qualifiers) that sets the operation parameter for 
+include_qualifiers to false.  Note that this form is required because the 
+default for this option in the DMTF CIM Operations is true (include 
+qualifiers).  Not including this option set the request to include 
+qualifiers on those commands to which this option applies.
+<P>
+<DT><B>-nlo</B>
+
+<DD>
+Boolean that defines whether properties from superclasses are included in 
+the response.  the -nlo option turns this parameter off.  The default if 
+this parameter is not included is to request that the server return only 
+local properties and ignore those from superclasses.  
+<P>
+<DT><B>-di</B>
+
+<DD>
+Boolean to set the deep inheritance CIM operation parameter to true.
+<P>
+<DT><B>-ic</B>
+
+<DD>
+Boolean parameter sets the operation parameter classOrigin in the
+operation request to true. the CIMServer is expected to return classOrigin
+information as part of the response.
+<P>
+<DT><B>-ac [associationClass]</B>
+
+<DD>
+String defining the association Class parameter for the CIM Operation.
+Used with reference and association operations.
+<P>
+<DT><B>-rc [resultClass]</B>
+
+<DD>
+String defining the resultClass parameter for the CIM Operation
+<P>
+<DT><B>-r [role]</B>
+
+<DD>
+String defining the role parameter for the CIM Operation
+<P>
+<DT><B>-rr [resultrole]</B>
+
+<DD>
+String defining the resultrole parameter for the CIM Operation
+<P>
+</DL>
+<A NAME="lbAI">&nbsp;</A>
+<H2>OPERATIONS</H2>
+
+This section defines the individual operations supported by cimcli. 
+Note that the either the names (ex EnumerateInstances) or the shortcut (ei) may
+be used in inputting an [operation] on the command line 
+and they are case independent.
+<P>
+<DL COMPACT>
+<DT><B>ci    CreateInstance</B>
+
+<DD>
+This cimcli operation requests that the server create an instance
+by building the properties of an instance from a combination of the class name and value parameters provided
+with the input. The command issues the CIM operation createInstance
+with an instance built from the parameters provided.  It requires the
+[operation target] parameter defining the class for which the instance is to be 
+created and also allows for an optional set of value 
+parameters that define properties to be provided in the created instance 
+in the following format:
+<P>
+<BR>&nbsp;&nbsp;[propertyName]=value
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;where&nbsp;value&nbsp;may&nbsp;be&nbsp;either&nbsp;a&nbsp;scalar&nbsp;for&nbsp;scalar&nbsp;properties
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or&nbsp;an&nbsp;array&nbsp;for&nbsp;array&nbsp;properties.
+<P>
+<BR>&nbsp;&nbsp;The&nbsp;detailed&nbsp;form&nbsp;for&nbsp;the&nbsp;input&nbsp;is&nbsp;defined&nbsp;in&nbsp;section&nbsp;TBD.&nbsp;&nbsp;&nbsp;
+<P>
+If the propertyName parameter is provided with no value, the default value or
+NULL if there is no default value is inserted.
+<P>
+Note that string property values are a special case because there are actually
+two concepts that must be covered when there is no value, 1) Empty String or
+2. NULL/default value.
+<P>
+Thus when a property that requires an empty string is to be input, the user
+will specify it with no value after the = sign.  If, a NULL or default value
+is desired, the = sign terminator is replaced with the ! (exclamation mark).
+<P>
+The operation first accesses the cimserver for the class definition and
+uses this information to build the proper value types and values for the instance.
+<P>
+This command builds the instance with all of the properties for which
+name/value pairs representing the properties of the class are input.
+It does not include any properties that are not defined on the command line.
+<P>
+To create an instance with less than the full set of properties,
+supply only those properties that are to be submitted to the CIM Server.
+<P>
+Scalar property values - The String form of the property similar to MOF input
+of constant values is used to input scalar values.
+<P>
+Array property values - Array properties are defined by defining a value
+of the form:
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>{ scalarvalue1[,scalarvaluex]*}<BR>
+<P>
+Note that the array MUST NOT include any spaces between the scalarvalue
+entities.
+<P>
+[FUTURE]Finally, the capability exists to create &quot;incorrect&quot; properties as an
+additional test capability. Generally this means properties with an
+incorrect type or with names that are not part of the class for which
+the instance is being built.  
+<P>
+[FUTURE]If a property value definition is supplied with the form
+<P>
+<BR>&nbsp;&quot;(&quot;PropertyType&quot;)&quot;[propertyName]=value
+<P>
+where property type is one of the CIM property types (i.e. boolean,
+String, uint8, etc.) the property will be recreated or added to the
+instance with that type and name.  Thus, a property can be added with
+an incorrect name or with an incorrect type overriding the definition
+in the class.
+<P>
+The command will be rejected if the class does not exist in the namespace.
+<P>
+<B>Example:</B>
+
+<P>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli ci CIM_xxxx name=abc size=zyx<BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli ci CIM_xxxx name=abc anotherproperty=32<BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>       create an instance of CIM_xxxx with name property value = abc, <BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>       a property added named anotherproperty with type uint32 and value<BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>       of 32.<BR>
+<BR>&nbsp;&nbsp;&nbsp;cimcli&nbsp;ci&nbsp;CIM_xxxx&nbsp;name=abc&nbsp;arrayParam={abc,def,ghi,&quot;jkl&nbsp;mno&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;numericArray=1,2,3,4
+<P>
+Returns the object path of the created instance if the call to the CIM
+server was executed successfully.  Otherwise it returns the exception received.
+<P>
+<DT><B>mi    ModifyInstance</B>
+
+<DD>
+This operation allows the modification of existing instances in the
+target server by building the properties from a combination of the
+target Class and properties provided with the input. The command
+issues the CIM operation modifyInstance with an instance built from
+the parameters provided.  It requires the [operation target] parameter defining
+the class for which the instance is to be created and a set of
+value parameters that define properties to be provided in the created
+instance in the format defined for CreateInstance above.
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;
+In the same manner as the createInstance, this command first acquires
+the class definition for the server and uses the property type
+information from the class to properly crate the property value types
+from the input propertValues.
+<P>
+In addition to the property definitions, this command allows the
+property list options (-pl) that defines a property list to be
+supplied to the target server with the modifyInstance CIM Operation.
+<P>
+<P>
+<B>Example:</B>
+
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;mi&nbsp;CIM_xxxx&nbsp;name=abc&nbsp;size=zyx
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;mi&nbsp;CIM_xxxx&nbsp;name=abc&nbsp;arrayParam={abc,def,ghi,&quot;jkl&nbsp;mno&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;numericArray=1,2,3,4
+<DT><B>ec    EnumerateClasses</B>
+
+<DD>
+Issues the enumerateClasses CIM operation which enumerates the class
+hierarchy starting at the level defined by &lt;classname&gt;.
+<P>
+The format is:
+
+<P>
+where classname is not required.  If it is omitted, cimcli inserts an
+empty classname into the CIM operation which tells the CIM Server to
+start at the top of the class inheritance tree.  The possible options
+that represent the parameters of the enumerateClasses operation are:
+<P>
+<P>
+<B>-niq</B>
+
+Boolean (not_include_Qualifiers) that sets the operation parameter
+for include_qualifiers to false.
+<P>
+<B>-nlo </B>
+
+Boolean that defines whether properties from superclasses
+are included in the response. the -nlo option turns this parameter off
+<P>
+<B>-cl </B>
+
+Boolean parameter sets the operation parameter classOrigin in the
+operation request. the CIMServer is expected to return classOrigin
+information as part of the response.
+<P>
+<B>-pl [propertyList]</B>
+
+Optional property list for the operation.
+<P>
+<B>Example:</B>
+
+<BR>&nbsp;&nbsp;&nbsp;cimcli&nbsp;ec&nbsp;CIM_ManagedElement&nbsp;-di&nbsp;-nlo
+<P>
+<DT><B>nc    EnumerateClassNames</B>
+
+<DD>
+The EnumerateClassNames cimcli operation issues the enumerateClassNames
+CIM Operation.
+<P>
+The format is:
+<P>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli nc [ &lt;classname&gt; ] [options] where the used options are:<BR>
+<P>
+The classname parameter is not required and the default it is not
+provided is to return the classnames of the top level classes.
+<P>
+The options specific to this operation include;
+<P>
+<B>-niq</B>
+
+do not include qualifiers
+<P>
+<B>-nlo</B>
+
+not localOnly
+<P>
+<B>-cl</B>
+
+class origin
+<P>
+<B>Examples</B>
+
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli gc cim_door -niq -cl -v<BR>
+<P>
+<DT><B>ni     EnumerateInstanceNames</B>
+
+<DD>
+Execute the enumerateInstanceNames CIM Operation. The syntax for this operation is:
+<P>
+
+<P>
+This operation takes as input options specific
+to this command the following:
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;classname&nbsp;-&nbsp;classname&nbsp;for&nbsp;which&nbsp;instance&nbsp;names&nbsp;are&nbsp;to&nbsp;be&nbsp;enumerated.
+<P>
+It displays the instances names that were returned by the CIM server
+in response to the enumerateInstances CIM operation with the defined
+input parameters. if the -s option is set it returns only the count of
+names returned.
+<P>
+In order to provide all of the options allowed for the CIM operation
+enumerateInstances it uses the following options specific to the
+command:
+<P>
+-B -nlo
+not local only operation parameter to false. Note that this negative
+form for the option is used because the default for local only
+parameter is true. Thus, not including this parameter means that the
+parameter is not set.
+<P>
+<B>Example:</B>
+
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;ni&nbsp;CIM_ManagedElement&nbsp;-p&nbsp;password&nbsp;-n&nbsp;name&nbsp;-n&nbsp;root/PG_Interop
+<P>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>Execute the enumerateInstanceNames operation on CIM_ManagedElement<BR>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>class in the root/PG_Interop namespace.<BR>
+<P>
+<DT><B>ei    EnumerateInstances</B>
+
+<DD>
+Execute the CIM operation enumerateInstances. The format of this operation is:
+<P>
+
+<P>
+<B>-nlo</B>
+
+not local only operation parameter to false. Note that this negative form for the
+option is used because the default for local only parameter is true. Thus, not including this
+parameter means that the parameter is not set.
+<P>
+<B>-niq</B>
+
+Boolean (not_include_Qualifiers) that sets the operation parameter for include_qualifiers to false,
+Note that this negative form is used because the default for this parameter is true.
+<P>
+<B>-ic</B>
+
+Boolean to set include class origin operation parameter to true.
+<P>
+<B>-di</B>
+
+Set deep inheritance operation parameter to true.
+<BR>&nbsp;
+<B>-o [xml|mof|table]</B>
+
+Set the output format for the instances to display the returns as mof
+<P>
+<B>-pl [propertyList]</B>
+
+optional property list for the operation
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+It returns the instances found either as MOF,XML or a table of property
+values with each property a column in the table depending on the
+output options parameter.
+<P>
+<B>Example</B>
+
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;ei&nbsp;CIM_ComputerSystem&nbsp;-niq&nbsp;-di
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;This&nbsp;example&nbsp;enumerates&nbsp;CIM_ComputerSystem&nbsp;in&nbsp;the&nbsp;namespace
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;root/CIMV2&nbsp;(default)&nbsp;requesting&nbsp;without&nbsp;qualifiers&nbsp;(-niq)&nbsp;with
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;deepInheritance&nbsp;(-di).&nbsp;&nbsp;
+<P>
+<DT><B>niall enumerateallinstanceNames</B>
+
+<DD>
+Execute an enumerateinstancenames on all classes to get all instance
+names within the defined namespace.  This function searches the
+complete namespace using the CIM getClass operation to get the classes
+and the enumerateInstanceNames command to enumerate all of the
+instances for each class. It returns the list of all of the instance
+names found in the namespace.
+<P>
+The format is:
+<P>
+
+<P>
+where the options include any of the universal options (ex. namespace, location, etc.)
+<P>
+<B>Example</B>
+
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;niall&nbsp;-n&nbsp;test/testproviders
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;Returns&nbsp;all&nbsp;instancenames&nbsp;in&nbsp;the&nbsp;namespace&nbsp;test/testproviders&nbsp;by
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;executing&nbsp;enumerateinstancenames&nbsp;on&nbsp;each&nbsp;class&nbsp;in&nbsp;the&nbsp;namespace.
+<P>
+<DT><B>gi    GetInstance</B>
+
+<DD>
+Gets the instance defined by the instance name parameter and displays it
+in the format chosen for this operation (xml, mof, or table).
+<P>
+The syntax for this operation is:
+<P>
+<B>cimcli</B><I>gi</I><B>[objectname]</B><I>[options]</I>
+
+<P>
+which causes execution of the CIM getinstance operation.
+OR
+<P>
+
+<P>
+which presents a list of possible instances to the user from which one
+can be selected for the getinstance.  In this case, the command
+actually executes an enumerateInstanceNames to get the list of
+instances that is presented to the user for selection of a single instance.
+The getInstance is executed after the user makes a selection.
+<P>
+This command requires the [objectname] parameter.  If the parameter
+is an instance with keys defined (a CIMObjectPath), the a getInstance
+CIM operation is executed and the return from the CIM Server presented
+(in either xml or mof depending on the output option).  If the input is
+a class name, a enumerateinstanceNames CIM Operation is executed and
+if any instance names are returned the result is presented to the
+console for the user to select one of the instances to be deleted.
+<P>
+If there are no instances, the return from this command is normally an
+exception as defined in the DMTF CIM Operations specification..
+<P>
+The possible options specific to this command are:
+<P>
+<B>-iq</B>
+
+include qualifiers
+<P>
+<B>-nlo</B>
+
+localonly
+<P>
+<B>-pl [propertyList]</B>
+
+optional property list for the operation
+<P>
+<B>Example:</B>
+
+<P>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli gi cim_managedElement<BR>
+<P>
+This is an interactive request that returns a list of instances from
+an enumerateinstance of CIM_ManagedElement from which the user can
+select one which cimcli will return as a complete instance.
+<P>
+<P>
+<DT><B>di    deleteinstance</B>
+
+<DD>
+Delete instance executed a single deleteInstance command to the CIM
+Server.  The syntax is:
+<P>
+<B>cimcli di [objectname] [options]</B>
+
+<P>
+This command requires the [objectname] parameter.  If this parameter
+is a full instance name with className and key bindings, the
+deleteInstance CIM Operation is executed directly.  If it is a class
+name with no keybindings, the  enumerateInstances command is executed
+and the list of returned instances presented to the console for the
+user to select one to delete.  cimcli then executes deleteInstance
+with the selected instance name and returns the response,
+<P>
+return - there is an empty response if the instance was successfully deleted or
+an exception return if there were any errors.
+<P>
+cimcli di [object] [options]
+<P>
+<B>Examples:</B>
+
+<P>
+<DT><DD>
+cimcli di PG_test
+<DT><DD>
+Executes enumerateInstanceName on PG_test and allows the user to select the
+instance to be deleted.
+<DT><DD>
+cimcli di PG_test.name=&quot;abc&quot;
+<DT><DD>
+Attempts to delete that object in the default namespace.
+<P>
+<DT><B>gq    getQualifier</B>
+
+<DD>
+getQualifier displays the target qualifier. The syntax is
+<P>
+cimcli gq [qualifier name] [options]
+<P>
+<B>Example:</B>
+
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli gq abstract - returns the mof or xml for the abstract qualifier.<BR>
+<DT><B>sq    setQualifier</B>
+
+<DD>
+This command is not implemented.
+<P>
+<DT><B>eq    enumeratequalifiers</B>
+
+<DD>
+Issues the CIM Operation to enumerate all of the qualifiers defined in
+the target namespace. The syntax is:
+<P>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli eq [options]<BR>
+<P>
+There are no special options for this operation.
+<P>
+<DT><B>dq    deletequalifier</B>
+
+<DD>
+Issues the CIM operation to delete the target qualifier defined by
+qualifier_name in the target namespace.
+The Syntax is:
+<P>
+cimcli dq [qualifier_name] [options]
+<P>
+<P>
+NOTE: This should be used with great caution as it removes qualifier declarations
+that may be used by other components of the model.
+<P>
+<DT><B>a     associators</B>
+
+<DD>
+Enumerate the associators CIM Operation for the target objectname.
+The syntax for this operation
+is:
+<BR>&nbsp;
+<B>cimcli a [objectname] [options]</B>
+
+<P>
+Note that the objectname may be either a classname or an instancename.
+If classname is supplied, the return is a set of classes that match
+the objectname supplied unless the -i (interactive) parameter is used.
+If objectname is used, the response is instances of the association
+that matches the classname.
+<P>
+The options provide the various operation parameters including;
+<P>
+<B>-ac [associationClass]</B>
+
+association Class parameter
+<P>
+<B>-rc [resultClass]</B>
+
+resultClass parameter
+<P>
+<B>-r [role]</B>
+
+String defining the role parameter for the CIM Operation
+<P>
+<B>-rr [resultrole]</B>
+
+resultrole parameter
+<P>
+<B>-ic</B>
+
+includeClassOrigin The -ic parameter
+<P>
+<B>-pl [properytlist]</B>
+
+Optional PropertyList
+<P>
+<B>-i</B>
+
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
+<DT><B>an    associatornames</B>
+
+<DD>
+Enumerate teh associator names for the target object.  The syntax for this operation
+is:
+<P>
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;cimcli&nbsp;an&nbsp;[objectname]&nbsp;[options]
+<P>
+where objectname can be either a class name or an instance name. 
+<P>
+The options provide the various operation parameters including;
+<P>
+<B>-ac [associationClass]</B>
+
+association Class parameter
+<P>
+<B>-rc [resultClass]</B>
+
+resultClass parameter
+<P>
+<B>-r [role]</B>
+
+String defining the role parameter for the CIM Operation
+<P>
+<B>-rr [resultrole]</B>
+
+resultrole parameter
+<P>
+<B>-i</B>
+
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
+<P>
+<DT><B>r references</B>
+
+<DD>
+Executes the CIM Operation references. Which returns CIM Objects.
+The format of the operation is:
+<P>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli r [objectname] [options]<BR>
+<P>
+Note that the objectname may be either a classname or an instancename.
+If classname is supplied, the return is a set of classes that match
+the objectname supplier unless the -i (interactive) parameter is used.
+If objectname is used, the response is instances of the association
+that matches the classname
+<P>
+Where the options specifically used by this operation are:
+<P>
+<B>-r [role]</B>
+
+role parameter for the CIM Operation.
+<P>
+<B>-rc [resultClass]</B>
+
+resultClass parameter for the CIM Operation
+<P>
+<B>-iq</B>
+
+includQualifiers (The default is false)
+<P>
+<B>-ic</B>
+
+Boolean to set include class origin operation parameter to true.
+<P>
+<B>-pl [propertyList]</B>
+
+optional property list for the operation
+<P>
+<B>-i</B>
+
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
+<P>
+<B>Examples</B>
+
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;TBD&nbsp;&nbsp;&nbsp;
+<P>
+<DT><B>rn    referencenames</B>
+
+<DD>
+Executes the CIM Operation referencenames.
+The format of the operation is:
+<P>
+
+<P>
+Note that the objectname may be either a classname or a specific
+instancename.  If classname is supplied, the return is a set of
+classnames that match the objectname supplier unless the -i parameter
+is used.  If objectname is used, the response is instance names of
+the associations that matches the classname
+<P>
+Where the options specifically used by this operation are:
+<P>
+<B>-r</B>
+
+role parameter for the CIM Operation
+<P>
+<B>-rc</B>
+
+resultClass parameter for the CIM Operation
+<P>
+<B>-i</B>
+
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
+<P>
+<DT><B>im    invokeMethod</B>
+
+<DD>
+This operation executes an extrinsic operation to execute a method on
+a CIM class or instance.
+<P>
+The form of the command is:
+<P>
+
+<P>
+Note that there are two required parameters to this command, the objectname and 
+the [methodname].
+<P>
+Parametere are input in the form:
+<P>
+The completed operations displays the return code from the command and
+any parameters that are qualified as OUT parameters.
+<P>
+<B>Example:</B>
+
+<P>
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli PG_WBEMSLPTemplate register -n root/PG_Interop<BR>
+<P>
+The parameters are supplied as name=value pairs. In the current
+version, all parameters are treated as strings.  
+<P>
+<DT><B>eq    executeQuery</B>
+
+<DD>
+<BR>&nbsp;The&nbsp;executeQuery&nbsp;operation&nbsp;is&nbsp;not&nbsp;supported&nbsp;in&nbsp;the&nbsp;current&nbsp;version&nbsp;of&nbsp;cimcli.
+<P>
+<DT><B>son</B>
+
+<DD>
+Set the CIMServer statistics to enabled by doing a modify instance of
+the CIM_ObjectManager instance that defines the server. This depends
+on the server having implemented statistics and having also
+implemented the functionality of enabling and disabling statistics
+through setting this property in CIM_ObjectManager.  This should be
+considered a temporary operation in cimcli until a more permanent
+utility is provided with OpenPegasus to manage this type of
+functionality.  The corresponding operation soff will attempt to
+disable statistics on the server.  This works with OpenPegasus servers
+starting with version 2.5.1.
+<P>
+DEPRECATED to be replaced by at some time in the future
+<P>
+The syntax of the operation is:
+<P>
+
+<P>
+<DT><B>soff</B>
+
+<DD>
+See the operation son.  This is the corresponding operation to turn
+off statistics in the server.
+<P>
+DEPRECATED
+<P>
+The syntax of the operation is:
+<P>
+
+<P>
+<DT><B>ns    enumeratenamespaces</B>
+
+<DD>
+Request an Enumeration of all the namespaces in the target CIM Server.
+This command uses both the CIM_Namespace class and if that fails, the
+__Namespace class to determine the list of namespaces.
+<P>
+RETURN - It returns a list of the namespace names returned by the CIM Server.
+<P>
+The format of the operation is:
+<P>
+
+<P>
+Note that since this operation enumerates namespaces, the namespace option (-n) is not valid.
+<P>
+<B>Examples</B>
+
+<TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>cimcli ns<BR>
+<DT><B>-hc     Show Command Options</B>
+
+<DD>
+This operation simply shows the Command options
+<P>
+</DL>
+<A NAME="lbAJ">&nbsp;</A>
+<H2>OPTIONS LIST</H2>
+
+There are a significant number of options to this utility, some if
+which provide specific information for one or more commands and some
+of which are universal across all of the commands.   In general, the
+program does not check for spurious options so that if you input an
+option that is not used by a particular operation, it is simply
+ignored. Note that some of the options require parameters.
+<P>
+The following is an alphabetic list of the options:
+<DL COMPACT>
+<DT><B>-ac assocaton_class_name</B>
+
+<DD>
+The Association Class parameter defines an assocClass string for
+Associator calls (associators and associatornames).
+Default(). Example:
+-ac CIM_ManagedElement
+<DT><B>-ar [association_role_name]</B>
+
+<DD>
+Defines an association role for associator operations. Example: -ar
+dependent. This optional parameter is used only with the association
+CIM Operations.
+<DT><B>-count [count]</B>
+
+<DD>
+Expected count of objects returned if the summary set. Tests this
+count and display difference.  Terminates the cimcli call with return status nonzero if
+test fails  . Default(). This can be used in testing to confirm that a
+predefined number of objects is returned. Example: -count 100 will
+expect 100 objects or names to be returned
+<DT><B>-delay [time in seconds]</B>
+
+<DD>
+Delay between connection and request . Default(0). example -delay 3
+delays 3 seconds between the call and the transmission of the actual
+CIM operation.  This is used only in some testing environments.
+<DT><B>-di</B>
+
+<DD>
+Specifies the boolean parameter deepInheritance parameter for selected
+commands. Setting this options causes the deepinheritance=true to be
+transmitted for the operation.  Note that this means different things
+to different commands and is used only with the enumerate commands.
+<DT><B>-ic</B>
+
+<DD>
+Boolean to set include class origin operation parameter to true.
+<DT><B>-iq</B>
+
+<DD>
+(DEPRECATED}Specifies the includeQualifiers operation input parameter
+for selected commands.Since the server default for this parameter is
+normally true, This option is deprecated in favor of the -niq
+parameters  
+<DT><B>-l [location]</B>
+
+<DD>
+Define CIM Server host address for the operation.  This includes either
+name or IP address and optional port number(HostName:port).  The
+default is localhost:5988.  If name is used without port, port 5988 is
+assumed.
+Examples include -l fred, -l fred:9999, -l 10.1.134.66 -l 10.1.134.123:5977
+<P>
+<DT><B>-lo</B>
+
+<DD>
+Specifies the localOnly operation parameter for selected commands if
+the option is set.  See the commands for more information. This option
+is Deprecated in favor of the -nlo because the default for local only
+is on so that generally the -lo is simply the default.  We recommend
+using
+-nlo to turn off local only.
+<P>
+<DT><B>-n [Namespace]</B>
+
+<DD>
+Defines the namespace for the operation.host name. The default is
+root/cimv2. exmple -n root/PG_Interop sets the root/PG_Interop
+namespace as the namespace for the current operation. 
+<P>
+<DT><B>-p [password]</B>
+
+<DD>
+Allows input of a password for server authentication of the command. (
+ex. -p 12345678). The default is that the command is submitted with no
+password.
+<P>
+<DT><B>-u [User]</B>
+
+<DD>
+Defines user name for CIM Server authentication. Default is no user
+name and no authentication.
+( ex -u john) Default is no user name and no authentication.
+<P>
+<DT><B>-lo </B>
+
+<DD>
+DEPRECATED. This was used to set LocalOnly. However, default should be true and we cannot use True as default. 
+See -nlo. Default(true).
+<P>
+<DT><B>-nlo</B>
+
+<DD>
+When set, sets LocalOnly = false on the CIM operation . Default(false).
+<P>
+<DT><B>-niq</B>
+
+<DD>
+Sets includeQualifiers = false on operations. Default(false).
+<P>
+<DT><B>-pl [propertyList]</B>
+
+<DD>
+Defines a propertyName List which is an optional parameter for some CIM
+Operations. Format is p1,p2,p3 (without spaces).  Default is that the
+property list is set to NULL indicating normally that the operation
+should return all properties.  The property list typically has 3
+possibilities 1) empty which means return no properties, 2) list of
+properties to be returned, 3) NULL which means return all properties.
+Since the default is NULL, not applying the option means that all
+properties are being requested.  To set this parameter to empty use
+the form -pl &quot;&quot;. 
+<P>
+<P>
+<DT><B>-r [role]</B>
+
+<DD>
+Defines a role string for reference role parameter. Default()
+<P>
+<DT><B>-rc [resultClass]</B>
+
+<DD>
+Defines a resultClass string for References and Associators. Default()
+<P>
+<DT><B>-rr [resultRole]</B>
+
+<DD>
+Defines a role string for associators operation resultRole parameter.
+
+<P>
+<DT><B>-ip [inputParameterList]</B>
+
+<DD>
+Defines an invokeMethod input parameter list. Format is:
+<P>
+p1=v1,p2=v2,..,pn=vn (without spaces) . Default()
+<P>
+<DT><B>-f [filter]</B>
+
+<DD>
+Defines a filter to use for query. One String input . Default()
+<P>
+<DT><B>-o [ xml | mof  | table]</B>
+
+<DD>
+Output in xml, mof, or table format. Default(mof) if the -o options
+is not included.
+<P>
+<DT><B>-x</B>
+
+<DD>
+Output objects in xml instead of mof format. Default(false)
+<P>
+<DT>/B --v<DD>
+Displays cimcli and Pegasus software Version.
+<P>
+<DT><B>-v</B>
+
+<DD>
+Verbose Display. Includes Detailed parameter Input display .
+Default(false). Outputs extra information about the parameters
+actually used in the request and the return from the operation.  This
+is primarily a debugging tool.
+<P>
+<DT><B>--sum</B>
+
+<DD>
+Displays only summary counts for enumerations, associators, etc.This
+option is used to with the repeat option to repeat an operation
+without getting the full return display.  It reduces the display to
+summary information.  It is often used with the time option --t to
+generate time for execution information on many repetitions of a
+command.
+<P>
+</DL>
+<A NAME="lbAK">&nbsp;</A>
+<H3>HELP OPTIONS</H3>
+
+<DL COMPACT>
+<DT><B>-h</B>
+
+<DD>
+Prints help usage message.
+<P>
+<DT><B>--help</B>
+
+<DD>
+Prints full help message with commands, options, examples.
+<P>
+<DT><B>-ho</B>
+
+<DD>
+Prints list of cimcli options.
+<P>
+<DT><B>-hc</B>
+
+<DD>
+Prints cimcli Operation command list.  This list includes the CIM
+Operatons defined by the CIM Operations specification and other
+operations that were felt to be useful in testing CIM environments.
+<P>
+<DT><B>--timeout [seconds]</B>
+
+<DD>
+Set the connection timeout in seconds. If not set, the timeout is the
+default Pegasus client timeout which for Pegasus is normally to about
+30 seconds. This option executes the client call to set timeout.
+<P>
+<DT><B>-d</B>
+
+<DD>
+More detailed debug messages from cimcli. This can be useful in the
+case where the user is debugging CIM functionality.
+<P>
+<DT><B>-trace [trace_level]</B>
+
+<DD>
+Set Pegasus Common Components Trace. Sets the Trace level. 0 is off. Default(0). The trace level can be
+set to 0 - 4.
+<P>
+<DT><B>--r [repeat_count]</B>
+
+<DD>
+Number of times to repeat the function. Zero means one time. The
+option can be used to repeat an operation within a single call to
+cimcli.  It simply repeats the operation defined the number of times
+defined by the repeat_count within the same connection.  Thus, it
+establishes the connection executes the operation repeat_count times
+and then terminates.  It can be used with the --time option to measure
+execution times for many repetitions of an operation.
+<P>
+<DT><B>--t</B>
+
+<DD>
+Measure time for the operation and present results. When set the
+response time for the operation is presented with the command output.
+If the --r (repeat) option is set, minimum, maximum, and average times
+are presented.  Note that the time for the operation itself is
+presented in addition to the overall time for connect, operation, and
+disconnect.  If statistics are being gathered by the server, setting
+this option also presents the server time, and the client round trip
+time which are calculated by the server and client infrastructure. 
+<P>
+<DT><B>-s</B>
+
+<DD>
+Boolean option that specifies that the Client should attempt to connect
+over the secure connection using SSL. This option causes cimcli to
+modify the client connect call to set the SSLContext option to the
+certificate defined with the --cert and --key options.  If this option
+is set but neither the --cert or --key options are included, the
+SSLContext for the connect call is submitted with the Cert and key
+marked NULL.
+<P>
+NOTE: since SSL is considered a compilable options with cimcli, these
+options may not even exist in a Pegasus environment that was compiled
+with the SSL capabilities disabled.
+<P>
+<DT><B>--cert  [certificate file path]</B>
+
+<DD>
+Defines a certificate to be used with the client connect if the -s
+option is set. This is optional and used only  with the -s and --key
+options.
+<P>
+<DT><B>--key [client key file path]</B>
+
+<DD>
+Defines a Client private key. This is optional and only has an effect
+on connections made over HTTPS using -s
+<P>
+</DL>
+<A NAME="lbAL">&nbsp;</A>
+<H2>EXAMPLES</H2>
+
+<P>
+Execute an enumerateinstancenames CIM operation for the
+pg_computersystem Class
+<BR>
+
+cimcli enumerateinstancenames pg_computersystem  -- enumerateinstances
+of class
+<BR>
+
+<BR>&nbsp;&nbsp;&nbsp;or
+<BR>
+
+<BR>&nbsp;cimcli&nbsp;ei&nbsp;pg_computersystem&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Same&nbsp;as&nbsp;above
+<P>
+Enumerate the class names from the default namespace &quot;root/cimv2&quot;
+<BR>
+
+<BR>&nbsp;cimcli&nbsp;enumerateclassnames&nbsp;--&nbsp;Enumerate&nbsp;classnames&nbsp;from&nbsp;root/cimv2.
+<P>
+Enumerate class names from the namespace &quot;root&quot;
+<BR>
+
+<BR>&nbsp;cimcli&nbsp;ec&nbsp;/n&nbsp;root&nbsp;--&nbsp;Enumerate&nbsp;classnames&nbsp;from&nbsp;namespace&nbsp;root.
+<P>
+
+<BR>&nbsp;cimcli&nbsp;ec&nbsp;-o&nbsp;xml&nbsp;&nbsp;&nbsp;--&nbsp;Enumerate&nbsp;classes&nbsp;with&nbsp;XML&nbsp;output&nbsp;starting&nbsp;at&nbsp;root&nbsp;cimcli&nbsp;enumerateclasses&nbsp;CIM_Computersystem&nbsp;-o&nbsp;xml
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Enumerate&nbsp;classes&nbsp;in&nbsp;MOF&nbsp;starting&nbsp;with&nbsp;CIM_Computersystem
+<P>
+<BR>&nbsp;cimcli&nbsp;getclass&nbsp;CIM_door&nbsp;-a&nbsp;-u&nbsp;guest&nbsp;-p&nbsp;guest
+<BR>&nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;Get&nbsp;class&nbsp;with&nbsp;authentication&nbsp;set&nbsp;and&nbsp;user&nbsp;=&nbsp;guest,&nbsp;password&nbsp;=&nbsp;guest.
+<P>
+
+<BR>&nbsp;cimcli&nbsp;rn&nbsp;TST_Person.name=@MIKE@&nbsp;-n&nbsp;root/sampleprovider&nbsp;-rc&nbsp;TST_Lineage.
+<P>
+<BR>&nbsp;cimcli&nbsp;ec&nbsp;-o&nbsp;XML&nbsp;--&nbsp;enumerate&nbsp;classes&nbsp;and&nbsp;output&nbsp;XML&nbsp;rather&nbsp;than&nbsp;MOF.
+<P>
+<BR>&nbsp;cimcli&nbsp;getqualifiers&nbsp;--&nbsp;Get&nbsp;the&nbsp;qualifiers&nbsp;in&nbsp;mof&nbsp;output&nbsp;format
+<A NAME="lbAM">&nbsp;</A>
+<H2>BUGS</H2>
+
+Currently at least some platforms and shells have problems with the
+double-quote which is used extensively in object names within CIM. To
+get around this, the character '@' has been mapped to the double-quote
+so that inputting a command line with this character in place of
+quotes is acceptable.  Thus, for example, 
+<P>
+cimcli rn TST_Person.name=@MIKE@ ...
+<P>
+is equivalent to
+<P>
+cimcli rn TST_Person.name-&quot;MIKE&quot; ...
+<P>
+In this version there is no way to turn this character mapping off which
+means that the @ character is lost.
+<P>
+<A NAME="lbAN">&nbsp;</A>
+<H2>WARNINGS</H2>
+
+<P>
+<A NAME="lbAO">&nbsp;</A>
+<H2>RETURN VALUE</H2>
+
+<P>
+cimcli returns a significant number of error codes:
+<P>
+<B>0 - Successful execution of the operation.</B>
+
+<P>
+<B>1-30 - Operation returned a CIM Exception as defined in the CIM Operations</B>
+
+over HTTP specification.  The status code of the error is returned. cimcli will
+not return any error codes in this range that are not specifically defined by
+DMTF error status codes.
+<P>
+<B>50 - Pegasus Exception encountered during execution of Pegasus Functions</B>
+
+<P>
+<B>51 - CIMCLI general error not covered by other errors</B>
+
+<P>
+<B>52 - Unknown exception occurred during execution of the operation</B>
+
+<P>
+<B>53 - Input Parsing error</B>
+
+<P>
+<B>54 - Connection to server failed error</B>
+
+<P>
+<B>60 - cimcli failed a compare with one of the test operations such as</B>
+
+testInstance
+<P>
+<A NAME="lbAP">&nbsp;</A>
+<H2>AUTHOR </H2>
+
+<P>
+Karl Schopmeyer <A HREF="mailto:k.schopmeyer@opengroup.org">k.schopmeyer@opengroup.org</A>
+<P>
+
+<HR>
+<A NAME="index">&nbsp;</A><H2>Index</H2>
+<DL>
+<DT><A HREF="#lbAB">NAME </A><DD>
+<DT><A HREF="#lbAC">SYNOPSIS </A><DD>
+<DT><A HREF="#lbAD">DESCRIPTION </A><DD>
+<DT><A HREF="#lbAE">OPTIONS</A><DD>
+<DL>
+<DT><A HREF="#lbAF">Connection Options</A><DD>
+<DT><A HREF="#lbAG">CIMCLI OPERATION MODIFICATION OPTIONS</A><DD>
+<DT><A HREF="#lbAH">OPERATION PARAMETER OPTIONS</A><DD>
+</DL>
+<DT><A HREF="#lbAI">OPERATIONS</A><DD>
+<DT><A HREF="#lbAJ">OPTIONS LIST</A><DD>
+<DL>
+<DT><A HREF="#lbAK">HELP OPTIONS</A><DD>
+</DL>
+<DT><A HREF="#lbAL">EXAMPLES</A><DD>
+<DT><A HREF="#lbAM">BUGS</A><DD>
+<DT><A HREF="#lbAN">WARNINGS</A><DD>
+<DT><A HREF="#lbAO">RETURN VALUE</A><DD>
+<DT><A HREF="#lbAP">AUTHOR </A><DD>
+</DL>
+<HR>
+This document was created by
+<A HREF="/cgi-bin/man/man2html">man2html</A>,
+using the manual pages.<BR>
+Time: 03:08:48 GMT, December 11, 2009
+</BODY>
+</HTML>
diff --git a/src/Clients/cimcli/doc/cimcli.nroff b/src/Clients/cimcli/doc/cimcli.nroff
new file mode 100644 (file)
index 0000000..29df7e0
--- /dev/null
@@ -0,0 +1,1260 @@
+.TH cimcli 1 LOCAL
+.SH NAME 
+cimcli \- command line WBEM Client 
+.SH SYNOPSIS 
+.B cimcli [operation]  [operation target]  [options]  [value-parameters]
+
+cimcli is available for all platforms that support the Pegasus CIM Server.
+
+.SH DESCRIPTION 
+
+.B cimcli
+is a command line test tool for executing CIM client operations.  It 
+implements all of the DMTF CIM operations except for the modify and create 
+class/instance operations and includes several other operations that are 
+useful in testing CIM Servers including getting all namespaces and 
+enumerating all instances in a namespace.  
+
+Each execution of cimcli invokes one or more CIM Operations with the command
+parameters equivalent to the CIM Operations defined in the CIM Operations over
+HTTP specification.
+
+In addition to the basic CIM Operations defined in the DMTF specification 
+(DMTF DSP 0200), this tool implements a number of other specific operations that 
+support testing and querying CIM servers (ex. an operation to query for 
+namespaces and another to get all instances in a namespace) which require
+multiple CIM Operations. The additional operations include:
+.TP
+.B 1.
+Enumerate namespaces (ns) - Returns a list of the namespaces available
+from the CIMOM.
+.TP
+.B 2.
+Enumerate all instance names (niall) - Returns a list of all instance
+names in the defined namespace.  
+.TP
+.B 3.
+Turn CIM Server statistics on and off (DEPRECATED) - Turns the statistics flag
+in the Server CIMObjectManager Class on or off for the OpenPegasus server.
+This enables and disables execution of statistics gathering in the server.
+This command is retained for compatibility but is DEPRECATED and will be
+removed when a real alternative is included in the Pegasus release.
+.TP
+.B 4.
+Test commands (ti) - A cimcli operation that executes tests of the characteristics
+of an instance in the CIM Server. This operation extend the capabilities of
+cimcli to actually compare information from the server with information in the
+command line input.
+
+The format of the cimcli command is generally:
+.TP
+.B cimcli [Operation] [Operation Target] [options] [value parameters]
+
+Note that options may be interspersed with the operation target parameter but
+that a) the ordering of [Operation] [Operation target is fixed and any  [value
+parameters] MUST occur after the [Operation Target]
+
+.TP
+.B [Operation] 
+Defines the  operation to be executed. cimcli executes all of the DMTF
+CIM Operations (ex. getclass) and a set of compound operation
+(enumeratenamespaces). There are two forms for each [Operation]
+definition, a short form typically two characters (i.e. gc) and the
+long form which is the full name of the operation (i.e. getclass). The complete
+set of operations can be viewed by calling cimcli with the option -hc.
+.TP
+.B [Operation Target]
+The Operation Target is the name of the object input with the operation.  
+This parameter is operation dependent. For example, with the getClass 
+operation the object is a CIM class name.  With the getinstance operation the 
+object is a CIM instance name.  Note that some of the commands do not require 
+an [Operation Target].  Thus, for example, the [Operation Target] is optional with the 
+enumerateClasses operation as it is with the equivalent 
+enumerateClassNames CIM operation.  Normally this is either a CIM class name or
+an instance name (classname plus keybindings).  In some operations one or
+the other is required.  In other operations, the behavior of the operation 
+is dependent on whether class name or instance name is supplied.
+
+The format for instance name is defined as the model path in the CIM Specification
+and has the form:
+    <classname>.<keyPropertyName1>=
+        <value1>[,<keypropertyNamex>=<valuex>]*
+
+    <valuex> is either a numeric value or a string value
+    (enveloped in quotes). The quote marks surrounding
+    string values are required.
+
+However, to make inputting command line object names, cimcli offers a second
+option for inputting the object name as [Operation Target].  In this second
+case, the Operation Target Target Object is simply the class name and value
+parameters are used to define the keypropertyName/value pairs.  In this case,
+the quotation marks around string property values are optional and are required
+only in the case where quotation marks would be required to define a value 
+such as a string that includes quotation marks.
+
+Thus, as an example, the input for a getInstance might be:
+
+    cimcli gi TennisPlayer.first="Patrick",last="Rafter"
+    or
+    cimcli gi TennisPlayer first=Patrick last=Rafter
+
+In the second case, cimcli gets the class from the CIM Server and uses the
+parameters to form a correct CIMObjectPath. In the first case, generally cimcli
+uses the input path directly without getting the class from the server.
+
+.TP
+.B [options...] 
+Options are identified on the command line with the - or -- notation.
+There are several types of options:
+
+.TP 8
+.B 1.
+A set of options that are universal and modify or define the execution
+of the command or the form of the return.  This includes options like
+setting the output format for object responses or requesting only
+summary operation.
+
+.TP 8
+.B 2.
+Options that defined the connection for the operation.  This includes options
+for defining the CIMServer address, namespace, and security options such as
+user name, password and SSL settings.
+.TP 8
+.B 3.
+A set of options that represent the optional input parameters for
+selected operations. The [operation] defines the CIM Operation that will be
+executed and the options define the optional request parameters.  Typical
+context options might be -n namespace (used on most but not all
+operations)or -niq which sets includequalifiers to false for
+operations that use the includeQualifiers optional parameter.
+.TP 8
+.B 4
+A set of options to display help (-h, --help, --ho to get a list of
+all options, and -hc to get a list of all commands). When these options
+are requested, no operation is executed.
+.TP
+.B [value-parameters]
+Some of the operations allow or require extra parameters. these are
+typically keywords or keyword/value pairs and are defined as part of
+the particular operation that use them.
+
+Any extra parameter entities on the command line that occur after the 
+[Operation] and [Operation Target] and are not proceeded by "-" to 
+indicate an option are considered value parameters.  These are used in some 
+of the operations to provide additional information required or optionally 
+desired by the operation.  See each operation definition to determine if 
+extra parameters are required or allowed.  These may be either 
+keyname-value pairs in some cases or simply strings depending on the 
+operation.  
+
+NOTE: cimcli does not protect the user against inputting extra options
+or parameters.  Since the options are heavily dependent on the
+operation to be executed, it simply ignores those options that are not
+used with a particular operation.  Thus, entering the -r option (role)
+with a getClass operation is syntatically allowed but cimcli ignores
+the parameter.
+
+.SH OPTIONS
+
+.SS Connection Options
+
+There is a set of options which are general to all of the CIM
+Operations and most of the compound operations and which provide
+parameters for the initiation or execution of the operations (ie. identify
+the target server and set connection security parameters.. 
+These include:
+.TP
+.B \-n [namespace]
+Namespace name for this operation (ex. -n root). The default namespace
+is root/cimv2 if this parameter is not entered
+.TP
+.B \-l [location]
+Host name or IP address and optionally port for this operation. The
+default for this command if the -n option is not used is to use
+the OpenPegasus connectLocal() function to connect to the server.  Note
+that this means that a command like cimcli gc CIM_Door may not work
+when trying to connect to a server other than Pegasus on the same
+system. If cimcli is to be used to connect to a CIM Server other than
+Pegasus on the same system use -l localhost or -l 127.0.0.1 or the
+actual name or IP address.  This will force cimcli to make the
+connection in the normal way, not using connectLocal()
+.TP
+.B \-u [user-name]
+The user name to be used in the connection to the CIM server for the 
+command 
+.TP
+.B \-p [password]
+The password to be used in the connection to the CIM server for the 
+command 
+
+.TP
+.B \-s
+Connect with SSL - Boolean option that specifies that cimcli should 
+attempt to connect over a secure connection using SSL.  This option 
+causes cimcli to modify the client connect call to set the SSLContext 
+option to the certificate defined with the --cert and --key options.  If 
+this option is set but neither the --cert or --key options are included, 
+the SSLContext for the connect call is submitted with the Cert and key 
+marked NULL.  
+
+NOTE: Since SSL is considerd a compilable option with cimcli, these
+options may not even exist in a Pegasus environment that was compiled
+with the SSL capabilities disabled.
+
+.TP
+.B \--cert [certificate file path]
+Defines the file name of a certificate to be used with the client connect 
+if the -s option is set.  This is optional and used only with the -s and 
+--key options.  
+
+.TP
+.B \--key [client key file path]
+Defines the file name of a Client private key.  This is optional and only 
+has an effect on connections made over HTTPS using -s 
+
+.SS CIMCLI OPERATION MODIFICATION OPTIONS
+
+There is a set of options that modifies the manner in
+which the command is executed or the display of information on
+response including the following:
+
+.TP
+.B \--t
+Measure time for the operation to be completed and report it upon
+command completion. If this option is set, the time for the operation
+is recorded upon completion of the operation.  In addition, the client
+infrastructure is queiried to determine if the operation execution
+times optionally measured in the infrastructure and at the server are
+available. If they are, they are displayed also.  This would allow the
+user to see a) time spent in the server, b) round trip time for the
+operation, c) application round trip time for the operation. Note that
+when combined with the repeat option, the output includes maximum,
+minimum, and average times for the operation.  There are a specific
+operations in cimcli to turn control statistics generation (See son
+and soff operations)
+.TP
+.B \--r [repeat_count]
+Repeat the operation repeat_count times. This repeats the operation
+without disconnecting. This option is useful for setting up tests that
+load the server with repeated calls and also for getting average times
+for an operation by taking the average of a number of calls ( when
+used with the summary information option and the measure time option). 
+.TP
+.B \-delay [seconds]
+Delay count seconds between connect and operation.
+.TP
+.B \--sum
+Present only summary information, not full output.  Generally it
+presents counts of objects returned and response times in place of the
+names or objects themselves.
+.TP
+.B \--count [object_count]
+Defines an expected count of objects expected on the response.  An
+error exit is generated if this number of objects is not received.
+This test can be used in batch files to test for number of objects
+returned by an operation.
+.TP
+.B \--timeout [seconds]
+Set the connect timeout to some time other than the default timeout.
+.TP
+.B \-o [ "xml" | "mof" | "table"]
+Output type for commands that output objects. Used with commands that
+present CIM objects in their response. Presents the output in the form of
+xml corresponding to cim/xml model, mof, or for instances a table of
+the data in each property.
+.TP
+.B \-verbose
+Displays details on the options and execution for the Operation.
+.TP
+
+.SS OPERATION PARAMETER OPTIONS
+
+There is a set of options that define request parameters for 
+specific cimcli Operation requests.  These are typically optional parameters 
+on the CIM operation request that modify the behavior of the server to the 
+request.  This includes things like requesting localonly, deep 
+inheritance, etc.  Note that the actual behavior 
+may be dependent on the particular operation request type.  The full 
+definition of these options is below here and their use with each specific 
+cimcli operation is defined with the operations.  
+
+.TP
+.B \-pl [propertylist]
+Set the propertylist parameter for those operations that allow this parameter.
+The propertylist value for this parameter is a comma-separated list of 
+class properties.  This sets the propertylist optional parameter on those CIM 
+operations that allow this parameter including: getClass, getInstance, 
+modifyInstance, enumerateInstances, associators, and references.  If this 
+option is not defined on the execution of one of these operations, cimcli 
+sets the propertylist parameter to NULL indicating that all properties 
+should be returned.  
+If a comma-separated list of one or more properties is defined as the value
+for this option, a propertylist with these values is set on the CIM request
+operation.
+Since this CIM request parameter specifically allows 3 options: 1) list of 
+properties, 2) NULL which is the indicator that all properties are to be 
+returned, and 3) Empty which is the indicator that no properties are to be 
+include in the response, the cimcli options specifically allows defining 
+the empty option by setting propertylist to either "" or \"\".  cimcli 
+accepts either an input that the command processor interprets as an empty 
+string or as a string consisting of two quotation marks.  
+
+The syntax of propertylist is:
+
+    <propertyName>[,<propertyName>]* | ""
+
+.B Examples
+
+    cimcli gc CIM_ManagedElement -pl Caption
+    cimcli gc CIM_ManagedElement -pl Caption,Description
+    cimcli gc CIM_ManagedElement -pl ""
+
+.TP
+.B \-niq
+Boolean (not_include_Qualifiers) that sets the operation parameter for 
+include_qualifiers to false.  Note that this form is required because the 
+default for this option in the DMTF CIM Operations is true (include 
+qualifiers).  Not including this option set the request to include 
+qualifiers on those commands to which this option applies.
+
+.TP
+.B \-nlo
+Boolean that defines whether properties from superclasses are included in 
+the response.  the -nlo option turns this parameter off.  The default if 
+this parameter is not included is to request that the server return only 
+local properties and ignore those from superclasses.  
+
+.TP
+.B \-di
+Boolean to set the deep inheritance CIM operation parameter to true.
+
+.TP
+.B \-ic
+Boolean parameter sets the operation parameter classOrigin in the
+operation request to true. the CIMServer is expected to return classOrigin
+information as part of the response.
+
+.TP
+.B \-ac [associationClass]
+String defining the association Class parameter for the CIM Operation.
+Used with reference and association operations.
+
+.TP
+.B \-rc [resultClass]
+String defining the resultClass parameter for the CIM Operation
+
+.TP
+.B \-r [role]
+String defining the role parameter for the CIM Operation
+
+.TP
+.B \-rr [resultrole]
+String defining the resultrole parameter for the CIM Operation
+
+.SH OPERATIONS
+This section defines the individual operations supported by cimcli. 
+Note that the either the names (ex EnumerateInstances) or the shortcut (ei) may
+be used in inputting an [operation] on the command line 
+and they are case independent.
+
+.TP
+.B ci    CreateInstance
+This cimcli operation requests that the server create an instance
+by building the properties of an instance from a combination of the class name and value parameters provided
+with the input. The command issues the CIM operation createInstance
+with an instance built from the parameters provided.  It requires the
+[operation target] parameter defining the class for which the instance is to be 
+created and also allows for an optional set of value 
+parameters that define properties to be provided in the created instance 
+in the following format:
+
+  [propertyName]=value
+     where value may be either a scalar for scalar properties
+     or an array for array properties.
+
+  The detailed form for the input is defined in section TBD.   
+
+If the propertyName parameter is provided with no value, the default value or
+NULL if there is no default value is inserted.
+
+Note that string property values are a special case because there are actually
+two concepts that must be covered when there is no value, 1) Empty String or
+2. NULL/default value.
+
+Thus when a property that requires an empty string is to be input, the user
+will specify it with no value after the = sign.  If, a NULL or default value
+is desired, the = sign terminator is replaced with the ! (exclamation mark).
+
+The operation first accesses the cimserver for the class definition and
+uses this information to build the proper value types and values for the instance.
+
+This command builds the instance with all of the properties for which
+name/value pairs representing the properties of the class are input.
+It does not include any properties that are not defined on the command line.
+
+To create an instance with less than the full set of properties,
+supply only those properties that are to be submitted to the CIM Server.
+
+Scalar property values - The String form of the property similar to MOF input
+of constant values is used to input scalar values.
+
+Array property values - Array properties are defined by defining a value
+of the form:
+       { scalarvalue1[,scalarvaluex]*}
+
+Note that the array MUST NOT include any spaces between the scalarvalue
+entities.
+
+[FUTURE]Finally, the capability exists to create "incorrect" properties as an
+additional test capability. Generally this means properties with an
+incorrect type or with names that are not part of the class for which
+the instance is being built.  
+
+[FUTURE]If a property value definition is supplied with the form
+
+ "("PropertyType")"[propertyName]=value
+
+where property type is one of the CIM property types (i.e. boolean,
+String, uint8, etc.) the property will be recreated or added to the
+instance with that type and name.  Thus, a property can be added with
+an incorrect name or with an incorrect type overriding the definition
+in the class.
+
+The command will be rejected if the class does not exist in the namespace.
+
+.B Example:
+
+       cimcli ci CIM_xxxx name=abc size=zyx
+       cimcli ci CIM_xxxx name=abc anotherproperty=32
+              create an instance of CIM_xxxx with name property value = abc, 
+              a property added named anotherproperty with type uint32 and value
+              of 32.
+   cimcli ci CIM_xxxx name=abc arrayParam={abc,def,ghi,"jkl mno" \
+          numericArray=1,2,3,4
+
+Returns the object path of the created instance if the call to the CIM
+server was executed successfully.  Otherwise it returns the exception received.
+
+.TP
+.B mi    ModifyInstance
+This operation allows the modification of existing instances in the
+target server by building the properties from a combination of the
+target Class and properties provided with the input. The command
+issues the CIM operation modifyInstance with an instance built from
+the parameters provided.  It requires the [operation target] parameter defining
+the class for which the instance is to be created and a set of
+value parameters that define properties to be provided in the created
+instance in the format defined for CreateInstance above.
+    
+In the same manner as the createInstance, this command first acquires
+the class definition for the server and uses the property type
+information from the class to properly crate the property value types
+from the input propertValues.
+
+In addition to the property definitions, this command allows the
+property list options (-pl) that defines a property list to be
+supplied to the target server with the modifyInstance CIM Operation.
+
+
+.B Example:
+
+    cimcli mi CIM_xxxx name=abc size=zyx
+    cimcli mi CIM_xxxx name=abc arrayParam={abc,def,ghi,"jkl mno" \
+          numericArray=1,2,3,4
+.TP
+.B ec    EnumerateClasses
+Issues the enumerateClasses CIM operation which enumerates the class
+hierarchy starting at the level defined by <classname>.
+
+The format is:
+.B      cimcli ec [classname] [options]
+
+where classname is not required.  If it is omitted, cimcli inserts an
+empty classname into the CIM operation which tells the CIM Server to
+start at the top of the class inheritance tree.  The possible options
+that represent the parameters of the enumerateClasses operation are:
+
+
+.B \-niq
+Boolean (not_include_Qualifiers) that sets the operation parameter
+for include_qualifiers to false.
+
+.B \-nlo 
+Boolean that defines whether properties from superclasses
+are included in the response. the -nlo option turns this parameter off
+
+.B \-cl 
+Boolean parameter sets the operation parameter classOrigin in the
+operation request. the CIMServer is expected to return classOrigin
+information as part of the response.
+
+.B \-pl [propertyList]
+Optional property list for the operation.
+
+.B Example:
+   cimcli ec CIM_ManagedElement -di -nlo
+
+.TP
+.B nc    EnumerateClassNames
+The EnumerateClassNames cimcli operation issues the enumerateClassNames
+CIM Operation.
+
+The format is:
+
+       cimcli nc [ <classname> ] [options] where the used options are:
+
+The classname parameter is not required and the default it is not
+provided is to return the classnames of the top level classes.
+
+The options specific to this operation include;
+
+.B \-niq
+do not include qualifiers
+
+.B \-nlo
+not localOnly
+
+.B \-cl
+class origin
+
+.B Examples
+       cimcli gc cim_door -niq -cl -v
+
+.TP
+.B ni     EnumerateInstanceNames
+Execute the enumerateInstanceNames CIM Operation. The syntax for this operation is:
+
+.B     cimcli ni [classname] [options]
+
+This operation takes as input options specific
+to this command the following:
+
+    classname - classname for which instance names are to be enumerated.
+
+It displays the instances names that were returned by the CIM server
+in response to the enumerateInstances CIM operation with the defined
+input parameters. if the -s option is set it returns only the count of
+names returned.
+
+In order to provide all of the options allowed for the CIM operation
+enumerateInstances it uses the following options specific to the
+command:
+
+-B \-nlo
+not local only operation parameter to false. Note that this negative
+form for the option is used because the default for local only
+parameter is true. Thus, not including this parameter means that the
+parameter is not set.
+
+.B Example:
+
+        cimcli ni CIM_ManagedElement -p password -n name -n root/PG_Interop
+
+       Execute the enumerateInstanceNames operation on CIM_ManagedElement
+       class in the root/PG_Interop namespace.
+
+.TP
+.B ei    EnumerateInstances
+Execute the CIM operation enumerateInstances. The format of this operation is:
+
+.B     cimcli ei <className> [options]
+
+.B \-nlo
+not local only operation parameter to false. Note that this negative form for the
+option is used because the default for local only parameter is true. Thus, not including this
+parameter means that the parameter is not set.
+
+.B \-niq
+Boolean (not_include_Qualifiers) that sets the operation parameter for include_qualifiers to false,
+Note that this negative form is used because the default for this parameter is true.
+
+.B \-ic
+Boolean to set include class origin operation parameter to true.
+
+.B \-di
+Set deep inheritance operation parameter to true.
+.B \-o [xml|mof|table]
+Set the output format for the instances to display the returns as mof
+
+.B \-pl [propertyList]
+optional property list for the operation
+        
+It returns the instances found either as MOF,XML or a table of property
+values with each property a column in the table depending on the
+output options parameter.
+
+.B Example
+
+    cimcli ei CIM_ComputerSystem -niq -di
+
+    This example enumerates CIM_ComputerSystem in the namespace
+    root/CIMV2 (default) requesting without qualifiers (-niq) with
+    deepInheritance (-di).  
+
+.TP
+.B niall enumerateallinstanceNames
+Execute an enumerateinstancenames on all classes to get all instance
+names within the defined namespace.  This function searches the
+complete namespace using the CIM getClass operation to get the classes
+and the enumerateInstanceNames command to enumerate all of the
+instances for each class. It returns the list of all of the instance
+names found in the namespace.
+
+The format is:
+
+.B     cimcli niall [options]
+
+where the options include any of the universal options (ex. namespace, location, etc.)
+
+.B Example
+
+    cimcli niall -n test/testproviders
+
+    Returns all instancenames in the namespace test/testproviders by
+    executing enumerateinstancenames on each class in the namespace.
+
+.TP
+.B gi    GetInstance
+Gets the instance defined by the instance name parameter and displays it
+in the format chosen for this operation (xml, mof, or table).
+
+The syntax for this operation is:
+
+.BI    cimcli gi [objectname] [options]
+
+which causes execution of the CIM getinstance operation.
+OR
+
+.B     cimcli gi [class-name] [options]
+
+which presents a list of possible instances to the user from which one
+can be selected for the getinstance.  In this case, the command
+actually executes an enumerateInstanceNames to get the list of
+instances that is presented to the user for selection of a single instance.
+The getInstance is executed after the user makes a selection.
+
+This command requires the [objectname] parameter.  If the parameter
+is an instance with keys defined (a CIMObjectPath), the a getInstance
+CIM operation is executed and the return from the CIM Server presented
+(in either xml or mof depending on the output option).  If the input is
+a class name, a enumerateinstanceNames CIM Operation is executed and
+if any instance names are returned the result is presented to the
+console for the user to select one of the instances to be deleted.
+
+If there are no instances, the return from this command is normally an
+exception as defined in the DMTF CIM Operations specification..
+
+The possible options specific to this command are:
+
+.B \-iq
+include qualifiers
+
+.B \-nlo
+localonly
+
+.B \-pl [propertyList]
+optional property list for the operation
+
+.B Example:
+
+       cimcli gi cim_managedElement
+
+This is an interactive request that returns a list of instances from
+an enumerateinstance of CIM_ManagedElement from which the user can
+select one which cimcli will return as a complete instance.
+
+
+.TP
+.B di    deleteinstance
+Delete instance executed a single deleteInstance command to the CIM
+Server.  The syntax is:
+
+.B     cimcli di [objectname] [options]
+
+This command requires the [objectname] parameter.  If this parameter
+is a full instance name with className and key bindings, the
+deleteInstance CIM Operation is executed directly.  If it is a class
+name with no keybindings, the  enumerateInstances command is executed
+and the list of returned instances presented to the console for the
+user to select one to delete.  cimcli then executes deleteInstance
+with the selected instance name and returns the response,
+
+return - there is an empty response if the instance was successfully deleted or
+an exception return if there were any errors.
+
+cimcli di [object] [options]
+
+.B Examples:
+
+.IP
+cimcli di PG_test
+.IP
+Executes enumerateInstanceName on PG_test and allows the user to select the
+instance to be deleted.
+.IP
+cimcli di PG_test.name="abc"
+.IP
+Attempts to delete that object in the default namespace.
+
+.TP
+.B gq    getQualifier
+getQualifier displays the target qualifier. The syntax is
+
+cimcli gq [qualifier name] [options]
+
+.B Example:
+       cimcli gq abstract - returns the mof or xml for the abstract qualifier.
+.TP
+.B sq    setQualifier
+This command is not implemented.
+
+.TP
+.B eq    enumeratequalifiers
+Issues the CIM Operation to enumerate all of the qualifiers defined in
+the target namespace. The syntax is:
+
+       cimcli eq [options]
+
+There are no special options for this operation.
+
+.TP
+.B dq    deletequalifier
+Issues the CIM operation to delete the target qualifier defined by
+qualifier_name in the target namespace.
+The Syntax is:
+
+cimcli dq [qualifier_name] [options]
+
+
+NOTE: This should be used with great caution as it removes qualifier declarations
+that may be used by other components of the model.
+
+.TP
+.B a     associators
+Enumerate the associators CIM Operation for the target objectname.
+The syntax for this operation
+is:
+.B    cimcli a [objectname] [options]
+
+Note that the objectname may be either a classname or an instancename.
+If classname is supplied, the return is a set of classes that match
+the objectname supplied unless the -i (interactive) parameter is used.
+If objectname is used, the response is instances of the association
+that matches the classname.
+
+The options provide the various operation parameters including;
+
+.B \-ac [associationClass]
+association Class parameter
+
+.B \-rc [resultClass]
+resultClass parameter
+
+.B \-r [role]
+String defining the role parameter for the CIM Operation
+
+.B \-rr [resultrole]
+resultrole parameter
+
+.B \-ic
+includeClassOrigin The -ic parameter
+
+.B \-pl [properytlist]
+Optional PropertyList
+
+.B \-i
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
+.TP
+.B an    associatornames
+Enumerate teh associator names for the target object.  The syntax for this operation
+is:
+
+    cimcli an [objectname] [options]
+
+where objectname can be either a class name or an instance name. 
+
+The options provide the various operation parameters including;
+
+.B \-ac [associationClass]
+association Class parameter
+
+.B \-rc [resultClass]
+resultClass parameter
+
+.B \-r [role]
+String defining the role parameter for the CIM Operation
+
+.B \-rr [resultrole]
+resultrole parameter
+
+.B \-i
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
+
+.TP
+.B r references
+Executes the CIM Operation references. Which returns CIM Objects.
+The format of the operation is:
+
+       cimcli r [objectname] [options]
+
+Note that the objectname may be either a classname or an instancename.
+If classname is supplied, the return is a set of classes that match
+the objectname supplier unless the -i (interactive) parameter is used.
+If objectname is used, the response is instances of the association
+that matches the classname
+
+Where the options specifically used by this operation are:
+
+.B \-r [role]
+role parameter for the CIM Operation.
+
+.B \-rc [resultClass]
+resultClass parameter for the CIM Operation
+
+.B \-iq
+includQualifiers (The default is false)
+
+.B \-ic
+Boolean to set include class origin operation parameter to true.
+
+.B \-pl [propertyList]
+optional property list for the operation
+
+.B \-i
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
+
+.B Examples
+    TBD   
+
+.TP
+.B rn    referencenames
+Executes the CIM Operation referencenames.
+The format of the operation is:
+
+.B     cimcli rn [objectname] [options]
+
+Note that the objectname may be either a classname or a specific
+instancename.  If classname is supplied, the return is a set of
+classnames that match the objectname supplier unless the -i parameter
+is used.  If objectname is used, the response is instance names of
+the associations that matches the classname
+
+Where the options specifically used by this operation are:
+
+.B \-r
+role parameter for the CIM Operation
+
+.B \-rc
+resultClass parameter for the CIM Operation
+
+.B \-i
+Interactive request - If this parameter is supplied and the objectname
+is a classname, the environment performs an enumerateinstances on the
+objectname and presents the list of possible instances for user
+selection
+
+.TP
+.B im    invokeMethod
+This operation executes a CIM extrinsic operation to execute a method on
+a CIM class or instance.
+
+The form of the command is:
+
+.B     cimcli im [objectname] [methodname] *[parameters] [options]
+
+Note that there are two required parameters to this command, the objectname and 
+the [methodname].
+
+Parametere are input in the form:
+
+       parameterName=<value>
+
+       <value> defines may be any of the value forms defined for
+       CIM value including string, integer, etc.  NOTE: Earlier versions
+       of cimcli allowed only String values.
+
+
+The completed operations displays the return code from the command and
+any returned parameters that are qualified as OUT parameters.
+
+.B Example:
+
+       cimcli PG_WBEMSLPTemplate register -n root/PG_Interop
+
+       cimcli PG_XXX dosomething input1=true input2=1111
+       --- input1 is boolean parameter and input2 is Uint32 parameter
+.TP
+.B eq    executeQuery
+ The executeQuery operation is not supported in the current version of cimcli.
+
+.TP
+.B son
+Set the CIMServer statistics to enabled by doing a modify instance of
+the CIM_ObjectManager instance that defines the server. This depends
+on the server having implemented statistics and having also
+implemented the functionality of enabling and disabling statistics
+through setting this property in CIM_ObjectManager.  This should be
+considered a temporary operation in cimcli until a more permanent
+utility is provided with OpenPegasus to manage this type of
+functionality.  The corresponding operation soff will attempt to
+disable statistics on the server.  This works with OpenPegasus servers
+starting with version 2.5.1.
+
+DEPRECATED to be replaced by at some time in the future
+
+The syntax of the operation is:
+
+.B     cimcli son
+
+.TP
+.B soff
+See the operation son.  This is the corresponding operation to turn
+off statistics in the server.
+
+DEPRECATED
+
+The syntax of the operation is:
+
+.B     cimcli soff
+
+.TP
+.B ns    enumeratenamespaces
+Request an Enumeration of all the namespaces in the target CIM Server.
+This command uses both the CIM_Namespace class and if that fails, the
+__Namespace class to determine the list of namespaces.
+
+RETURN - It returns a list of the namespace names returned by the CIM Server.
+
+The format of the operation is:
+
+.B     cimcli ns [options]
+
+Note that since this operation enumerates namespaces, the namespace option 
+(-n) is not valid.  
+
+.B Examples
+       cimcli ns
+.TP
+.B -hc     Show Command Options
+This operation simply shows the Command options
+
+.SH OPTIONS LIST
+There are a significant number of options to this utility, some if
+which provide specific information for one or more commands and some
+of which are universal across all of the commands.   In general, the
+program does not check for spurious options so that if you input an
+option that is not used by a particular operation, it is simply
+ignored. Note that some of the options require parameters.
+
+The following is an alphabetic list of the options:
+.TP 
+.B \-ac assocaton_class_name
+The Association Class parameter defines an assocClass string for
+Associator calls (associators and associatornames).
+Default(). Example:
+-ac CIM_ManagedElement
+.TP 
+.B \-ar [association_role_name]
+Defines an association role for associator operations. Example: -ar
+dependent. This optional parameter is used only with the association
+CIM Operations.
+.TP
+.B \-count [count]
+Expected count of objects returned if the summary set.  Tests this count 
+and display difference.  Terminates the cimcli call with return status 
+nonzero if test fails .  Default().  This can be used in testing to 
+confirm that a predefined number of objects is returned.  Example: -count 
+100 will expect 100 objects or names to be returned 
+.TP
+.B \-delay [time in seconds]
+Delay between connection and request . Default(0). example -delay 3
+delays 3 seconds between the call and the transmission of the actual
+CIM operation.  This is used only in some testing environments.
+.TP
+.B \-di
+Specifies the boolean parameter deepInheritance parameter for selected
+commands. Setting this options causes the deepinheritance=true to be
+transmitted for the operation.  Note that this means different things
+to different commands and is used only with the enumerate commands.
+.TP
+.B \-ic
+Boolean to set include class origin operation parameter to true.
+.TP
+.B \-iq
+(DEPRECATED}Specifies the includeQualifiers operation input parameter
+for selected commands.Since the server default for this parameter is
+normally true, This option is deprecated in favor of the -niq
+parameters  
+.TP
+.B \-l [location]
+Define CIM Server host address for the operation.  This includes either
+name or IP address and optional port number(HostName:port).  The
+default is localhost:5988.  If name is used without port, port 5988 is
+assumed.
+Examples include -l fred, -l fred:9999, -l 10.1.134.66 -l 10.1.134.123:5977
+
+.TP
+.B \-lo
+Specifies the localOnly operation parameter for selected commands if
+the option is set.  See the commands for more information. This option
+is Deprecated in favor of the -nlo because the default for local only
+is on so that generally the -lo is simply the default.  We recommend
+using
+-nlo to turn off local only.
+
+.TP
+.B \-n [Namespace]
+Defines the namespace for the operation.host name. The default is
+root/cimv2. exmple -n root/PG_Interop sets the root/PG_Interop
+namespace as the namespace for the current operation. 
+
+.TP 
+.B \-p [password]
+Allows input of a password for server authentication of the command. (
+ex. -p 12345678). The default is that the command is submitted with no
+password.
+
+.TP 
+.B \-u [User]
+Defines user name for CIM Server authentication. Default is no user
+name and no authentication.
+( ex -u john) Default is no user name and no authentication.
+
+.TP 
+.B \-lo 
+DEPRECATED.  This was used to set LocalOnly.  However, default should be 
+true and we cannot use True as default.  
+See -nlo. Default(true).
+
+.TP 
+.B \-nlo
+When set, sets LocalOnly = false on the CIM operation . Default(false).
+
+.TP 
+.B \-niq
+Sets includeQualifiers = false on operations. Default(false).
+
+.TP 
+.B \-pl [propertyList]
+Defines a propertyName List which is an optional parameter for some CIM
+Operations. Format is p1,p2,p3 (without spaces).  Default is that the
+property list is set to NULL indicating normally that the operation
+should return all properties.  The property list typically has 3
+possibilities 1) empty which means return no properties, 2) list of
+properties to be returned, 3) NULL which means return all properties.
+Since the default is NULL, not applying the option means that all
+properties are being requested.  To set this parameter to empty use
+the form -pl "". 
+
+
+.TP
+.B \-r [role]
+Defines a role string for reference role parameter. Default()
+
+.TP
+.B \-rc [resultClass]
+Defines a resultClass string for References and Associators. Default()
+
+.TP
+.B \-rr [resultRole]
+Defines a role string for associators operation resultRole parameter.
+. Default()
+
+.TP
+.B \-ip [inputParameterList]
+Defines an invokeMethod input parameter list. Format is:
+
+p1=v1,p2=v2,..,pn=vn (without spaces) . Default()
+
+.TP
+.B \-f [filter]
+Defines a filter to use for query. One String input . Default()
+
+.TP 
+.B \-o [ "xml" | "mof"  | "table" ]
+Output in xml, mof, or table format. Default(mof) if the -o options
+is not included.
+
+.TP
+.B \-x
+Output objects in xml instead of mof format. Default(false)
+
+.TP
+/B \--v
+Displays cimcli and Pegasus software Version.
+
+.TP
+.B \-v
+Verbose Display. Includes Detailed parameter Input display .
+Default(false). Outputs extra information about the parameters
+actually used in the request and the return from the operation.  This
+is primarily a debugging tool.
+
+.TP
+.B \--sum
+Displays only summary counts for enumerations, associators, etc.This
+option is used to with the repeat option to repeat an operation
+without getting the full return display.  It reduces the display to
+summary information.  It is often used with the time option --t to
+generate time for execution information on many repetitions of a
+command.
+
+.SS HELP OPTIONS
+.TP
+. B \-h
+Prints help usage message.
+
+.TP
+.B \--help
+Prints full help message with commands, options, examples.
+
+.TP
+. B \-ho
+Prints list of cimcli options.
+
+.TP
+.B \-hc
+Prints cimcli Operation command list.  This list includes the CIM
+Operatons defined by the CIM Operations specification and other
+operations that were felt to be useful in testing CIM environments.
+
+.TP
+.B \--timeout [seconds]
+Set the connection timeout in seconds. If not set, the timeout is the
+default Pegasus client timeout which for Pegasus is normally to about
+30 seconds. This option executes the client call to set timeout.
+
+.TP
+.B \-d
+More detailed debug messages from cimcli. This can be useful in the
+case where the user is debugging CIM functionality.
+
+.TP
+.B \-trace [trace_level]
+Set Pegasus Common Components Trace.  Sets the Trace level.  0 is off.  
+Default(0).  The trace level can be set to 0 - 4.  
+
+.TP
+.B \--r [repeat_count]
+Number of times to repeat the function. Zero means one time. The
+option can be used to repeat an operation within a single call to
+cimcli.  It simply repeats the operation defined the number of times
+defined by the repeat_count within the same connection.  Thus, it
+establishes the connection executes the operation repeat_count times
+and then terminates.  It can be used with the --time option to measure
+execution times for many repetitions of an operation.
+
+.TP
+.B --t
+Measure time for the operation and present results. When set the
+response time for the operation is presented with the command output.
+If the --r (repeat) option is set, minimum, maximum, and average times
+are presented.  Note that the time for the operation itself is
+presented in addition to the overall time for connect, operation, and
+disconnect.  If statistics are being gathered by the server, setting
+this option also presents the server time, and the client round trip
+time which are calculated by the server and client infrastructure. 
+
+.TP
+.B -s
+Boolean option that specifies that the Client should attempt to connect
+over the secure connection using SSL. This option causes cimcli to
+modify the client connect call to set the SSLContext option to the
+certificate defined with the --cert and --key options.  If this option
+is set but neither the --cert or --key options are included, the
+SSLContext for the connect call is submitted with the Cert and key
+marked NULL.
+
+NOTE: since SSL is considered a compilable option with cimcli, these
+options may not even exist in a Pegasus environment that was compiled
+with the SSL capabilities disabled.
+
+.TP
+.B --cert  [certificate file path]
+Defines a certificate to be used with the client connect if the -s
+option is set. This is optional and used only  with the -s and --key
+options.
+
+.TP
+.B --key [client key file path]
+Defines a Client private key. This is optional and only has an effect
+on connections made over HTTPS using -s
+
+.SH EXAMPLES
+
+Execute an enumerateinstancenames CIM operation for the
+pg_computersystem Class
+.br
+cimcli enumerateinstancenames pg_computersystem  -- enumerateinstances
+of class
+.br
+   or
+.br
+ cimcli ei pg_computersystem    -- Same as above
+
+Enumerate the class names from the default namespace "root/cimv2"
+.br
+ cimcli enumerateclassnames -- Enumerate classnames from root/cimv2.
+
+Enumerate class names from the namespace "root"
+.br
+ cimcli ec /n root -- Enumerate classnames from namespace root.
+.P
+ cimcli ec -o xml   -- Enumerate classes with XML output starting at root cimcli
+    -- Enumerate classes in MOF starting with CIM_Computersystem
+.P
+ cimcli enumerateclasses CIM_ComputerSystem -di
+    -- Enumerate classes starting at CIM_ComputerSystem and the
+       remainder of the class hiearchy (-di) with mof output of the
+       classes.
+.P
+ cimcli getclass CIM_door -a -u guest -p guest
+    -- Get class with authentication set and user = guest, password = guest.
+.P
+ cimcli rn TST_Person.name=@MIKE@ -n root/sampleprovider -rc TST_Lineage.
+.P
+ cimcli ec -o XML -- enumerate classes and output XML rather than MOF.
+.P
+ cimcli getqualifiers -- Get the qualifiers in mof output format
+
+.SH "RETURN VALUE"
+
+cimcli returns a significant number of error codes:
+
+.B 0 - Successful execution of the operation.
+
+.B 1-30 - Operation returned a CIM Exception as defined in the CIM Operations
+over HTTP specification.  The status code of the error is returned. cimcli will
+not return any error codes in this range that are not specifically defined by
+DMTF error status codes.
+
+.B 50 - Pegasus Exception encountered during execution of Pegasus Functions
+
+.B 51 - CIMCLI general error not covered by other errors
+
+.B 52 - Unknown exception occurred during execution of the operation
+
+.B 53 - Input Parsing error
+
+.B 54 - Connection to server failed error
+
+.B 60 - cimcli failed a compare with one of the test operations such as
+testInstance
+
+.SH AUTHOR 
+
+Karl Schopmeyer k.schopmeyer@opengroup.org
diff --git a/src/Clients/cimcli/doc/cimcli.txt b/src/Clients/cimcli/doc/cimcli.txt
new file mode 100644 (file)
index 0000000..2141a53
--- /dev/null
@@ -0,0 +1,1265 @@
+cimcli(1)                                                           cimcli(1)
+
+
+
+NAME
+       cimcli - command line WBEM Client
+
+SYNOPSIS
+       cimcli [operation] [operation target] [options] [value-parameters]
+
+       cimcli  is  available  for  all platforms that support the Pegasus CIM
+       Server.
+
+
+DESCRIPTION
+       cimcli is a command line test tool for executing CIM client operations.
+       It  implements all of the DMTF CIM operations except for the modify and
+       create class/instance operations and includes several other  operations
+       that are useful in testing CIM Servers including getting all namespaces
+       and enumerating all instances in a namespace.
+
+       Each execution of cimcli invokes one or more CIM  Operations  with  the
+       command parameters equivalent to the CIM Operations defined in the CIM
+       Operations over HTTP specification.
+
+       In addition to the basic CIM Operations defined in the DMTF  specifica
+       tion  (DMTF  DSP 0200), this tool implements a number of other specific
+       operations that support testing and querying CIM servers (ex. an opera
+       tion  to  query for  namespaces  and another to get all instances in a
+       namespace) which require multiple CIM Operations. The additional opera
+       tions include:
+
+       1.     Enumerate  namespaces  (ns)  -  Returns a list of the namespaces
+             available from the CIMOM.
+
+       2.     Enumerate all instance names (niall) - Returns  a  list  of  all
+             instance names in the defined namespace.
+
+       3.     Turn  CIM  Server statistics on and off (DEPRECATED) - Turns the
+             statistics flag in the Server CIMObjectManager Class on  or  off
+             for the OpenPegasus server.  This enables and disables execution
+             of statistics gathering in the server.  This command is retained
+             for  compatibility  but is DEPRECATED and will be removed when a
+             real alternative is included in the Pegasus release.
+
+       4.     Test commands (ti) - A cimcli operation that executes  tests  of
+             the characteristics of an instance in the CIM Server. This oper
+             ation extend the capabilities  of  cimcli  to  actually  compare
+             information from the server with information in the command line
+             input.
+
+             The format of the cimcli command is generally:
+
+       cimcli [Operation] [Operation Target] [options] [value parameters]
+
+             Note that options may be interspersed with the operation  target
+             parameter  but  that  a)  the ordering of [Operation] [Operation
+             target is fixed and any  [value parameters] MUST occur after the
+             [Operation Target]
+
+
+       [Operation]
+             Defines  the   operation  to be executed. cimcli executes all of
+             the DMTF CIM Operations (ex. getclass) and  a  set  of  compound
+             operation  (enumeratenamespaces).  There  are two forms for each
+             [Operation] definition, a short form  typically  two  characters
+             (i.e. gc) and the long form which is the full name of the opera
+             tion (i.e. getclass). The complete  set  of  operations  can  be
+             viewed by calling cimcli with the option -hc.
+
+       [Operation Target]
+             The  Operation  Target  is the name of the object input with the
+             operation.  This parameter is operation dependent. For  example,
+             with  the  getClass  operation  the  object is a CIM class name.
+             With the getinstance operation the  object  is  a  CIM  instance
+             name.   Note that some of the commands do not require an [Opera
+             tion Target].  Thus, for  example,  the  [Operation  Target]  is
+             optional  with  the enumerateClasses operation as it is with the
+             equivalent enumerateClassNames CIM operation.  Normally this  is
+             either a CIM class name or an instance name (classname plus key
+             bindings).  In some operations one or the other is required.  In
+             other  operations, the behavior of the operation is dependent on
+             whether class name or instance name is supplied.
+
+             The format for instance name is defined as the model path in the
+             CIM Specification and has the form:
+                 <classname>.<keyPropertyName1>=
+                     <value1>[,<keypropertyNamex>=<valuex>]*
+
+                 <valuex> is either a numeric value or a string value
+                 (enveloped in quotes). The quote marks surrounding
+                 string values are required.
+
+             However,  to  make  inputting  command line object names, cimcli
+             offers a second option for inputting the object name as  [Opera
+             tion  Target].  In this second case, the Operation Target Target
+             Object is simply the class name and value parameters are used to
+             define  the keypropertyName/value pairs.  In this case, the quo
+             tation marks around string property values are optional and  are
+             required  only  in  the  case  where  quotation  marks  would be
+             required to define a value such as a string that includes quota
+             tion marks.
+
+             Thus, as an example, the input for a getInstance might be:
+
+                 cimcli gi TennisPlayer.first="Patrick",last="Rafter"
+                 or
+                 cimcli gi TennisPlayer first=Patrick last=Rafter
+
+             In  the  second  case, cimcli gets the class from the CIM Server
+             and uses the parameters to form a correct CIMObjectPath. In  the
+             first  case, generally cimcli uses the input path directly with
+             out getting the class from the server.
+
+
+       [options...]
+             Options are identified on the command line  with  the  -  or  --
+             notation.  There are several types of options:
+
+
+       1.      A  set  of  options that are universal and modify or define the
+              execution of the command or  the  form  of  the  return.   This
+              includes  options  like  setting  the  output format for object
+              responses or requesting only summary operation.
+
+
+       2.      Options that defined the connection for the  operation.   This
+              includes options for defining the CIMServer address, namespace,
+              and security options such as user name, password and  SSL  set
+              tings.
+
+       3.      A  set  of options that represent the optional input parameters
+              for  selected  operations.  The  [operation]  defines  the  CIM
+              Operation  that  will  be  executed  and the options define the
+              optional request parameters.  Typical context options might  be
+              -n namespace (used on most but not all operations)or -niq which
+              sets includequalifiers to false for  operations  that  use  the
+              includeQualifiers optional parameter.
+
+       4       A  set  of  options  to display help (-h, --help, --ho to get a
+              list of all options, and -hc to get a list  of  all  commands).
+              When these options are requested, no operation is executed.
+
+       [value-parameters]
+              Some of the operations allow or require extra parameters. these
+              are typically keywords or keyword/value pairs and  are  defined
+              as part of the particular operation that use them.
+
+              Any  extra  parameter  entities  on the command line that occur
+              after the [Operation] and [Operation Target] and are  not  pro
+              ceeded by "-" to indicate an option are considered value param
+              eters.  These are used in some of  the  operations  to  provide
+              additional  information  required  or optionally desired by the
+              operation.  See each operation definition to determine if extra
+              parameters  are  required or allowed.  These may be either key
+              name-value pairs in some cases or simply strings  depending  on
+              the operation.
+
+              NOTE:  cimcli does not protect the user against inputting extra
+              options or parameters.  Since the options are heavily dependent
+              on  the  operation  to  be  executed,  it  simply ignores those
+              options that are not used with a particular  operation.   Thus,
+              entering  the  -r  option  (role)  with a getClass operation is
+              syntatically allowed but cimcli ignores the parameter.
+
+
+OPTIONS
+   Connection Options
+       There is a set of options which are general to all of  the  CIM Opera
+       tions  and most of the compound operations and which provide parameters
+       for the initiation or execution of the  operations  (ie.  identify  the
+       target server and set connection security parameters..  These include:
+
+       -n [namespace]
+             Namespace  name  for  this  operation (ex. -n root). The default
+             namespace is root/cimv2 if this parameter is not entered
+
+       -l [location]
+             Host name or IP address and optionally port for this  operation.
+             The  default for this command if the -n option is not used is to
+             use the OpenPegasus connectLocal() function to  connect  to  the
+             server.   Note  that  this  means  that a command like cimcli gc
+             CIM_Door may not work when trying to connect to a  server  other
+             than Pegasus on the same system. If cimcli is to be used to con
+             nect to a CIM Server other than Pegasus on the same  system  use
+             -l  localhost  or -l 127.0.0.1 or the actual name or IP address.
+             This will force cimcli to make the connection in the normal way,
+             not using connectLocal()
+
+       -u [user-name]
+             The user name to be used in the connection to the CIM server for
+             the command
+
+       -p [password]
+             The password to be used in the connection to the CIM server  for
+             the command
+
+
+       -s     Connect  with  SSL  -  Boolean option that specifies that cimcli
+             should attempt to connect over a secure  connection  using  SSL.
+             This  option  causes cimcli to modify the client connect call to
+             set the SSLContext option to the certificate  defined  with  the
+             --cert and --key options.  If this option is set but neither the
+             --cert or --key options are included,  the  SSLContext  for  the
+             connect call is submitted with the Cert and key marked NULL.
+
+             NOTE:  Since  SSL  is considerd a compilable option with cimcli,
+             these options may not even exist in a Pegasus  environment  that
+             was compiled with the SSL capabilities disabled.
+
+
+       --cert [certificate file path]
+             Defines  the  file  name  of  a  certificate to be used with the
+             client connect if the -s option is set.  This  is  optional  and
+             used only with the -s and --key options.
+
+
+       --key [client key file path]
+             Defines the file name of a Client private key.  This is optional
+             and only has an effect on connections made over HTTPS using -s
+
+
+   CIMCLI OPERATION MODIFICATION OPTIONS
+       There is a set of options that modifies the manner in which the command
+       is  executed  or  the  display of information on response including the
+       following:
+
+
+       --t    Measure time for the operation to be  completed  and  report  it
+             upon command completion. If this option is set, the time for the
+             operation is recorded upon  completion  of  the  operation.   In
+             addition,  the client infrastructure is queiried to determine if
+             the operation execution times optionally measured in the infras
+             tructure  and at the server are available. If they are, they are
+             displayed also.  This would allow the user to see a) time  spent
+             in the server, b) round trip time for the operation, c) applica
+             tion round trip time for the operation. Note that when  combined
+             with  the  repeat  option, the output includes maximum, minimum,
+             and average times for the operation.  There are a specific oper
+             ations  in cimcli to turn control statistics generation (See son
+             and soff operations)
+
+       --r [repeat_count]
+             Repeat the operation repeat_count times. This repeats the opera
+             tion without disconnecting. This option is useful for setting up
+             tests that load the server with repeated calls and also for get
+             ting  average  times for an operation by taking the average of a
+             number of calls ( when used with the summary information  option
+             and the measure time option).
+
+       -delay [seconds]
+             Delay count seconds between connect and operation.
+
+       --sum  Present only summary information, not full output.  Generally it
+             presents counts of objects returned and response times in  place
+             of the names or objects themselves.
+
+       --count [object_count]
+             Defines  an  expected count of objects expected on the response.
+             An error exit is generated if this  number  of  objects  is  not
+             received.  This test can be used in batch files to test for num
+             ber of objects returned by an operation.
+
+       --timeout [seconds]
+             Set the connect timeout to some  time  other  than  the  default
+             timeout.
+
+       -o [ xml | mof | table ]
+             Output type for commands that output objects. Used with commands
+             that present CIM objects in their response. Presents the  output
+             in  the  form of xml corresponding to cim/xml model, mof, or for
+             instances a table of the data in each property.
+
+       -verbose
+             Displays details on the options and execution for the Operation.
+
+
+
+         OPERATION PARAMETER OPTIONS
+
+             There  is  a  set  of options that define request parameters for
+             specific  cimcli  Operation  requests.   These   are   typically
+             optional parameters on the CIM operation request that modify the
+             behavior of the server to the  request.   This  includes  things
+             like requesting localonly, deep inheritance, etc.  Note that the
+             actual behavior may be dependent  on  the  particular  operation
+             request  type.   The  full  definition of these options is below
+             here and their  use  with  each  specific  cimcli  operation  is
+             defined with the operations.
+
+
+       -pl [propertylist]
+             Set  the  propertylist parameter for those operations that allow
+             this parameter.  The propertylist value for this parameter is  a
+             comma-separated  list  of class properties.  This sets the prop
+             ertylist optional parameter on those CIM operations  that  allow
+             this parameter including: getClass, getInstance, modifyInstance,
+             enumerateInstances, associators, and references.  If this option
+             is not defined on the execution of one of these operations, cim
+             cli sets the propertylist parameter to NULL indicating that  all
+             properties should be returned.
+
+             If  a  comma-separated list of one or more properties is defined
+             as the value for this option, a propertylist with  these  values
+             is set on the CIM request operation.
+
+             Since  this CIM request parameter specifically allows 3 options:
+             1) list of properties, 2) NULL which is the indicator  that  all
+             properties are to be returned, and 3) Empty which is the indica
+             tor that no properties are to be include in  the  response,  the
+             cimcli  options specifically allows defining the empty option by
+             setting propertylist to either "" or  accepts  either  an  input
+             that the command processor interprets as an empty string or as a
+             string consisting of two quotation marks.
+
+             The syntax of propertylist is:
+
+                 <propertyName>[,<propertyName>]* | ""
+
+             Examples
+
+                 cimcli gc CIM_ManagedElement -pl Caption
+                 cimcli gc CIM_ManagedElement -pl Caption,Description
+                 cimcli gc CIM_ManagedElement -pl ""
+
+
+       -niq   Boolean (not_include_Qualifiers) that sets the operation parame
+             ter  for  include_qualifiers  to  false.  Note that this form is
+             required because the default for this option  in  the  DMTF  CIM
+             Operations  is  true  (include  qualifiers).  Not including this
+             option set the request to include qualifiers on  those  commands
+             to which this option applies.
+
+
+       -nlo   Boolean  that  defines  whether properties from superclasses are
+             included in the response.  the -nlo option turns this  parameter
+             off.   The  default  if  this  parameter  is  not included is to
+             request that the server return only local properties and  ignore
+             those from superclasses.
+
+
+       -di    Boolean  to  set the deep inheritance CIM operation parameter to
+             true.
+
+
+       -ic    Boolean parameter sets the operation  parameter  classOrigin  in
+             the  operation  request  to  true.  the CIMServer is expected to
+             return classOrigin information as part of the response.
+
+
+       -ac [associationClass]
+             String defining the association  Class  parameter  for  the  CIM
+             Operation.  Used with reference and association operations.
+
+
+       -rc [resultClass]
+             String defining the resultClass parameter for the CIM Operation
+
+
+       -r [role]
+             String defining the role parameter for the CIM Operation
+
+
+       -rr [resultrole]
+             String defining the resultrole parameter for the CIM Operation
+
+
+OPERATIONS
+       This  section  defines  the  individual operations supported by cimcli.
+       Note that the either the names (ex EnumerateInstances) or the  shortcut
+       (ei)  may  be  used in inputting an [operation] on the command line and
+       they are case independent.
+
+
+       ci CreateInstance
+             This  cimcli  operation  requests  that  the  server  create  an
+             instance by building the properties of an instance from a combi
+             nation of the class name and value parameters provided with  the
+             input.  The command issues the CIM operation createInstance with
+             an instance built from the parameters provided.  It requires the
+             [operation  target]  parameter  defining the class for which the
+             instance is to be created and also allows for an optional set of
+             value  parameters  that  define properties to be provided in the
+             created instance in the following format:
+
+               [propertyName]=value
+                  where value may be either a scalar for scalar properties
+                  or an array for array properties.
+
+               The detailed form for the input is defined in section TBD.
+
+             If the propertyName parameter is provided  with  no  value,  the
+             default  value or NULL if there is no default value is inserted.
+
+             Note that string property values  are  a  special  case  because
+             there  are actually two concepts that must be covered when there
+             is no value, 1) Empty String or 2. NULL/default value.
+
+             Thus when a property that requires an  empty  string  is  to  be
+             input,  the user will specify it with no value after the = sign.
+             If, a NULL or default value is desired, the = sign terminator is
+             replaced with the ! (exclamation mark).
+
+             The operation first accesses the cimserver for the class defini
+             tion and uses this information to build the proper  value  types
+             and values for the instance.
+
+             This  command builds the instance with all of the properties for
+             which name/value pairs representing the properties of the  class
+             are  input.   It  does  not  include any properties that are not
+             defined on the command line.
+
+             To create an instance with less than the full set of properties,
+             supply only those properties that are to be submitted to the CIM
+             Server.
+
+             Scalar property values - The String form of the property similar
+             to  MOF input of constant values is used to input scalar values.
+
+             Array property values - Array properties are defined by defining
+             a value of the form:      { scalarvalue1[,scalarvaluex]*}
+
+             Note  that  the  array  MUST  NOT include any spaces between the
+             scalarvalue entities.
+
+             [FUTURE]Finally, the capability  exists  to  create  "incorrect"
+             properties  as  an  additional  test  capability. Generally this
+             means properties with an incorrect type or with names  that  are
+             not part of the class for which the instance is being built.
+
+             [FUTURE]If a property value definition is supplied with the form
+
+              "("PropertyType")"[propertyName]=value
+
+             where property type is one  of  the  CIM  property  types  (i.e.
+             boolean,  String, uint8, etc.) the property will be recreated or
+             added to the instance with that type and name.  Thus, a property
+             can  be  added  with an incorrect name or with an incorrect type
+             overriding the definition in the class.
+
+             The command will be rejected if the class does not exist in  the
+             namespace.
+
+             Example:
+
+                  cimcli   ci   CIM_xxxx  name=abc  size=zyx       cimcli  ci
+             CIM_xxxx  name=abc  anotherproperty=32               create   an
+             instance  of  CIM_xxxx  with  name  property  value = abc,
+             a property added named  anotherproperty  with  type  uint32  and
+             value             of 32.
+                cimcli ci CIM_xxxx name=abc arrayParam={abc,def,ghi,"jkl mno"
+             numericArray=1,2,3,4
+
+             Returns the object path of the created instance if the  call  to
+             the  CIM server was executed successfully.  Otherwise it returns
+             the exception received.
+
+
+       mi ModifyInstance
+             This operation allows the modification of existing instances  in
+             the  target server by building the properties from a combination
+             of the target Class and properties provided with the input.  The
+             command issues the CIM operation modifyInstance with an instance
+             built from the parameters provided.  It requires the  [operation
+             target]  parameter  defining the class for which the instance is
+             to be created and a set of value parameters that define  proper
+             ties  to  be  provided  in  the  created  instance in the format
+             defined for CreateInstance above.
+
+             In the same manner as the  createInstance,  this  command  first
+             acquires  the class definition for the server and uses the prop
+             erty type information from the class to properly crate the prop
+             erty value types from the input propertValues.
+
+             In addition to the property definitions, this command allows the
+             property list options (-pl) that defines a property list  to  be
+             supplied to the target server with the modifyInstance CIM Opera
+             tion.
+
+
+             Example:
+
+                 cimcli mi CIM_xxxx name=abc size=zyx
+                 cimcli  mi  CIM_xxxx  name=abc  arrayParam={abc,def,ghi,"jkl
+             mno"           numericArray=1,2,3,4
+
+       ec EnumerateClasses
+             Issues  the  enumerateClasses CIM operation which enumerates the
+             class hierarchy starting at the level defined by <classname>.
+
+             The format is: cimcli ec [classname] [options]
+
+             where classname is not  required.   If  it  is  omitted,  cimcli
+             inserts  an  empty  classname into the CIM operation which tells
+             the CIM Server to start at the  top  of  the  class  inheritance
+             tree.  The possible options that represent the parameters of the
+             enumerateClasses operation are:
+
+
+             -niq Boolean (not_include_Qualifiers) that  sets  the  operation
+             parameter for include_qualifiers to false.
+
+             -nlo  Boolean  that defines whether properties from superclasses
+             are included in the response. the -nlo option turns this parame
+             ter off
+
+             -cl  Boolean  parameter sets the operation parameter classOrigin
+             in the operation request. the CIMServer is  expected  to  return
+             classOrigin information as part of the response.
+
+             -pl [propertyList] Optional property list for the operation.
+
+             Example:
+                cimcli ec CIM_ManagedElement -di -nlo
+
+
+       nc EnumerateClassNames
+             The  EnumerateClassNames  cimcli operation issues the enumerate
+             ClassNames CIM Operation.
+
+             The format is:
+
+                  cimcli nc [ <classname> ] [options] where the used  options
+             are:
+
+             The  classname  parameter  is not required and the default it is
+             not provided is to  return  the  classnames  of  the  top  level
+             classes.
+
+             The options specific to this operation include;
+
+             -niq do not include qualifiers
+
+             -nlo not localOnly
+
+             -cl class origin
+
+             Examples      cimcli gc cim_door -niq -cl -v
+
+
+       ni EnumerateInstanceNames
+             Execute the enumerateInstanceNames CIM Operation. The syntax for
+             this operation is:
+
+             cimcli ni [classname] [options]
+
+             This operation takes as input options specific to  this  command
+             the following:
+
+                 classname  -  classname  for  which instance names are to be
+             enumerated.
+
+             It displays the instances names that were returned  by  the  CIM
+             server  in response to the enumerateInstances CIM operation with
+             the defined input parameters. if the -s option is set it returns
+             only the count of names returned.
+
+             In order to provide all of the options allowed for the CIM oper
+             ation enumerateInstances it uses the following options  specific
+             to the command:
+
+             -B  -nlo  not local only operation parameter to false. Note that
+             this negative form for the option is used  because  the  default
+             for  local  only  parameter  is  true.  Thus, not including this
+             parameter means that the parameter is not set.
+
+             Example:
+
+                     cimcli ni CIM_ManagedElement  -p  password  -n  name  -n
+             root/PG_Interop
+
+                  Execute  the  enumerateInstanceNames  operation on CIM_Man
+             agedElement      class in the root/PG_Interop namespace.
+
+
+       ei EnumerateInstances
+             Execute the CIM operation enumerateInstances. The format of this
+             operation is:
+
+             cimcli ei <className> [options]
+
+             -nlo not local only operation parameter to false. Note that this
+             negative form for the option is used  because  the  default  for
+             local only parameter is true. Thus, not including this parameter
+             means that the parameter is not set.
+
+             -niq Boolean (not_include_Qualifiers) that  sets  the  operation
+             parameter  for include_qualifiers to false, Note that this nega
+             tive form is used because the  default  for  this  parameter  is
+             true.
+
+             -ic  Boolean  to set include class origin operation parameter to
+             true.
+
+             -di Set deep inheritance operation parameter to true.
+
+             -o [xml|mof|table] Set the output format for  the  instances  to
+             display the returns as mof
+
+             -pl [propertyList] optional property list for the operation
+
+             It  returns  the instances found either as MOF,XML or a table of
+             property values with each property a column in the table depend
+             ing on the output options parameter.
+
+             Example
+
+                 cimcli ei CIM_ComputerSystem -niq -di
+
+                 This example enumerates CIM_ComputerSystem in the namespace
+                 root/CIMV2  (default)  requesting  without qualifiers (-niq)
+             with
+                 deepInheritance (-di).
+
+
+       niall enumerateallinstanceNames
+             Execute an enumerateinstancenames on  all  classes  to  get  all
+             instance  names  within  the  defined  namespace.  This function
+             searches the complete namespace using the CIM getClass operation
+             to  get  the  classes  and the enumerateInstanceNames command to
+             enumerate all of the instances for each class.  It  returns  the
+             list of all of the instance names found in the namespace.
+
+             The format is:
+
+             cimcli niall [options]
+
+             where  the  options  include  any  of the universal options (ex.
+             namespace, location, etc.)
+
+             Example
+
+                 cimcli niall -n test/testproviders
+
+                 Returns  all  instancenames  in  the  namespace   test/test
+             providers by
+                 executing enumerateinstancenames on each class in the names
+             pace.
+
+
+       gi GetInstance
+             Gets the instance defined by the  instance  name  parameter  and
+             displays  it  in the format chosen for this operation (xml, mof,
+             or table).
+
+             The syntax for this operation is:
+
+             cimcligi[objectname][options]
+
+             which causes execution of the CIM getinstance operation.  OR
+
+             cimcli gi [class-name] [options]
+
+             which presents a list of possible instances  to  the  user  from
+             which  one  can  be selected for the getinstance.  In this case,
+             the command actually executes an enumerateInstanceNames  to  get
+             the  list  of instances that is presented to the user for selec
+             tion of a single instance.  The getInstance  is  executed  after
+             the user makes a selection.
+
+             This command requires the [objectname] parameter.  If the param
+             eter is an instance with keys defined (a CIMObjectPath),  the  a
+             getInstance  CIM  operation  is executed and the return from the
+             CIM Server presented (in either xml or mof depending on the out
+             put option).  If the input is a class name, a enumerateinstance
+             Names CIM Operation is executed and if any  instance  names  are
+             returned  the result is presented to the console for the user to
+             select one of the instances to be deleted.
+
+             If there are no instances, the return from this command is  nor
+             mally  an exception as defined in the DMTF CIM Operations speci
+             fication..
+
+             The possible options specific to this command are:
+
+             -iq include qualifiers
+
+             -nlo localonly
+
+             -pl [propertyList] optional property list for the operation
+
+             Example:
+
+                  cimcli gi cim_managedElement
+
+             This is an interactive request that returns a list of  instances
+             from  an  enumerateinstance of CIM_ManagedElement from which the
+             user can select one which  cimcli  will  return  as  a  complete
+             instance.
+
+
+
+       di deleteinstance
+             Delete  instance executed a single deleteInstance command to the
+             CIM Server.  The syntax is:
+
+                  cimcli di [objectname] [options]
+
+             This command  requires  the  [objectname]  parameter.   If  this
+             parameter  is  a full instance name with className and key bind
+             ings, the deleteInstance CIM Operation is executed directly.  If
+             it  is a class name with no keybindings, the  enumerateInstances
+             command is executed and the list of returned instances presented
+             to  the  console  for  the user to select one to delete.  cimcli
+             then executes deleteInstance with the selected instance name and
+             returns the response,
+
+             return - there is an empty response if the instance was success
+             fully deleted or an exception return if there were any errors.
+
+             cimcli di [object] [options]
+
+             Examples:
+
+
+             cimcli di PG_test
+
+             Executes enumerateInstanceName on PG_test and allows the user to
+             select the instance to be deleted.
+
+             cimcli di PG_test.name="abc"
+
+             Attempts to delete that object in the default namespace.
+
+
+       gq getQualifier
+             getQualifier displays the target qualifier. The syntax is
+
+             cimcli gq [qualifier name] [options]
+
+             Example:       cimcli  gq  abstract - returns the mof or xml for
+             the abstract qualifier.
+
+       sq setQualifier
+             This command is not implemented.
+
+
+       eq enumeratequalifiers
+             Issues the CIM Operation to  enumerate  all  of  the  qualifiers
+             defined in the target namespace. The syntax is:
+
+                  cimcli eq [options]
+
+             There are no special options for this operation.
+
+
+       dq deletequalifier
+             Issues  the CIM operation to delete the target qualifier defined
+             by qualifier_name in the target namespace.  The Syntax is:
+
+             cimcli dq [qualifier_name] [options]
+
+
+             NOTE: This should be used with great caution as it removes qual
+             ifier  declarations  that may be used by other components of the
+             model.
+
+
+       a associators
+             Enumerate the associators CIM Operation for the  target  object
+             name.  The syntax for this operation is:
+
+             cimcli a [objectname] [options]
+
+             Note that the objectname may be either a classname or an instan
+             cename.  If classname is  supplied,  the  return  is  a  set  of
+             classes that match the objectname supplied unless the -i (inter
+             active) parameter is used.  If objectname is used, the  response
+             is instances of the association that matches the classname.
+
+             The options provide the various operation parameters including;
+
+             -ac [associationClass] association Class parameter
+
+             -rc [resultClass] resultClass parameter
+
+             -r  [role] String defining the role parameter for the CIM Opera
+             tion
+
+             -rr [resultrole] resultrole parameter
+
+             -ic includeClassOrigin The -ic parameter
+
+             -pl [properytlist] Optional PropertyList
+
+             -i Interactive request - If this parameter is supplied  and  the
+             objectname  is  a classname, the environment performs an enumer
+             ateinstances on the objectname and presents the list of possible
+             instances for user selection
+
+       an associatornames
+             Enumerate  teh associator names for the target object.  The syn
+             tax for this operation is:
+
+                 cimcli an [objectname] [options]
+
+             where objectname can be either a class name or an instance name.
+
+             The options provide the various operation parameters including;
+
+             -ac [associationClass] association Class parameter
+
+             -rc [resultClass] resultClass parameter
+
+             -r  [role] String defining the role parameter for the CIM Opera
+             tion
+
+             -rr [resultrole] resultrole parameter
+
+             -i Interactive request - If this parameter is supplied  and  the
+             objectname  is  a classname, the environment performs an enumer
+             ateinstances on the objectname and presents the list of possible
+             instances for user selection
+
+
+       r references
+             Executes   the  CIM  Operation  references.  Which  returns  CIM
+             Objects.  The format of the operation is:
+
+                  cimcli r [objectname] [options]
+
+             Note that the objectname may be either a classname or an instan
+             cename.   If  classname  is  supplied,  the  return  is a set of
+             classes that match the objectname supplier unless the -i (inter
+             active)  parameter is used.  If objectname is used, the response
+             is instances of the association that matches the classname
+
+             Where the options specifically used by this operation are:
+
+             -r [role] role parameter for the CIM Operation.
+
+             -rc [resultClass] resultClass parameter for the CIM Operation
+
+             -iq includQualifiers (The default is false)
+
+             -ic Boolean to set include class origin operation  parameter  to
+             true.
+
+             -pl [propertyList] optional property list for the operation
+
+             -i  Interactive  request - If this parameter is supplied and the
+             objectname is a classname, the environment performs  an  enumer
+             ateinstances on the objectname and presents the list of possible
+             instances for user selection
+
+             Examples
+                 TBD
+
+
+       rn referencenames
+             Executes the CIM Operation referencenames.  The  format  of  the
+             operation is:
+
+             cimcli rn [objectname] [options]
+
+             Note that the objectname may be either a classname or a specific
+             instancename.  If classname is supplied, the return is a set  of
+             classnames  that  match  the  objectname  supplier unless the -i
+             parameter is used.  If  objectname  is  used,  the  response  is
+             instance names of the associations that matches the classname
+
+             Where the options specifically used by this operation are:
+
+             -r role parameter for the CIM Operation
+
+             -rc resultClass parameter for the CIM Operation
+
+             -i  Interactive  request - If this parameter is supplied and the
+             objectname is a classname, the environment performs  an  enumer
+             ateinstances on the objectname and presents the list of possible
+             instances for user selection
+
+
+       im invokeMethod
+             This operation executes an  extrinsic  operation  to  execute  a
+             method on a CIM class or instance.
+
+             The form of the command is:
+
+             cimcli im [objectname] [methodname] *[parameters] [options]
+
+             Note that there are two required parameters to this command, the
+             objectname and the [methodname].
+
+             Parametere are input in the form:
+
+             The completed operations displays the return code from the  com
+             mand and any parameters that are qualified as OUT parameters.
+
+             Example:
+
+                  cimcli PG_WBEMSLPTemplate register -n root/PG_Interop
+
+             The  parameters are supplied as name=value pairs. In the current
+             version, all parameters are treated as strings.
+
+
+       eq executeQuery
+              The executeQuery operation is not supported in the current ver
+             sion of cimcli.
+
+
+       son    Set  the CIMServer  statistics  to  enabled  by  doing a modify
+             instance of the  CIM_ObjectManager  instance  that  defines  the
+             server. This depends on the server having implemented statistics
+             and having also implemented the functionality  of  enabling  and
+             disabling   statistics   through   setting   this   property  in
+             CIM_ObjectManager.  This should be considered a temporary opera
+             tion  in  cimcli until a more permanent utility is provided with
+             OpenPegasus to manage this type of  functionality.   The  corre
+             sponding  operation  soff  will attempt to disable statistics on
+             the server.  This works with OpenPegasus servers  starting  with
+             version 2.5.1.
+
+             DEPRECATED to be replaced by at some time in the future
+
+             The syntax of the operation is:
+
+             cimcli son
+
+
+       soff   See  the operation son.  This is the corresponding operation to
+             turn off statistics in the server.
+
+             DEPRECATED
+
+             The syntax of the operation is:
+
+             cimcli soff
+
+
+       ns enumeratenamespaces
+             Request an Enumeration of all the namespaces in the  target  CIM
+             Server.   This  command uses both the CIM_Namespace class and if
+             that fails, the __Namespace  class  to  determine  the  list  of
+             namespaces.
+
+             RETURN  -  It  returns a list of the namespace names returned by
+             the CIM Server.
+
+             The format of the operation is:
+
+             cimcli ns [options]
+
+             Note that since this operation enumerates namespaces, the names
+             pace option (-n) is not valid.
+
+             Examples      cimcli ns
+
+       -hc Show Command Options
+             This operation simply shows the Command options
+
+
+OPTIONS LIST
+       There  are  a  significant  number  of options to this utility, some if
+       which provide specific information for one or more commands and some of
+       which  are universal across all of the commands.   In general, the pro
+       gram does not check for spurious options so that if you input an option
+       that  is not used by a particular operation, it is simply ignored. Note
+       that some of the options require parameters.
+
+       The following is an alphabetic list of the options:
+
+       -ac assocaton_class_name
+             The Association Class parameter defines an assocClass string for
+             Associator  calls (associators and associatornames).  Default().
+             Example: -ac CIM_ManagedElement
+
+       -ar [association_role_name]
+             Defines an association role for associator operations.  Example:
+             -ar  dependent.  This  optional  parameter is used only with the
+             association CIM Operations.
+
+       -count [count]
+             Expected count of objects returned if  the  summary  set.  Tests
+             this  count  and display difference.  Terminates the cimcli call
+             with return status nonzero if test fails  . Default(). This  can
+             be  used  in  testing  to  confirm  that  a predefined number of
+             objects is returned. Example: -count 100 will expect 100 objects
+             or names to be returned
+
+       -delay [time in seconds]
+             Delay  between  connection  and  request  .  Default(0). example
+             -delay 3 delays 3 seconds between the call and the  transmission
+             of  the actual CIM operation.  This is used only in some testing
+             environments.
+
+       -di    Specifies the boolean parameter  deepInheritance parameter  for
+             selected  commands.  Setting this options causes the deepinheri
+             tance=true to be transmitted for the operation.  Note that  this
+             means  different  things  to different commands and is used only
+             with the enumerate commands.
+
+       -ic    Boolean to set include class origin operation parameter to true.
+
+       -iq    (DEPRECATED}Specifies   the  includeQualifiers  operation  input
+             parameter for selected commands.Since  the  server  default  for
+             this  parameter  is  normally true, This option is deprecated in
+             favor of the -niq parameters
+
+       -l [location]
+             Define CIM Server host address for the operation.  This includes
+             either  name  or  IP  address  and  optional  port  number(Host
+             Name:port).  The default is localhost:5988.   If  name  is  used
+             without  port,  port 5988 is assumed.  Examples include -l fred,
+             -l fred:9999, -l 10.1.134.66 -l 10.1.134.123:5977
+
+
+       -lo    Specifies the localOnly operation parameter  for selected  com
+             mands  if the option is set.  See the commands for more informa
+             tion. This option is Deprecated in favor of the -nlo because the
+             default for local only is on so that generally the -lo is simply
+             the default.  We recommend using -nlo to turn off local only.
+
+
+       -n [Namespace]
+             Defines the namespace for the operation.host name.  The  default
+             is    root/cimv2.    exmple    -n   root/PG_Interop   sets   the
+             root/PG_Interop namespace as the namespace for the current oper
+             ation.
+
+
+       -p [password]
+             Allows input of a password for server authentication of the com
+             mand. ( ex. -p 12345678). The default is  that  the  command  is
+             submitted with no password.
+
+
+       -u [User]
+             Defines  user  name for CIM Server authentication. Default is no
+             user name and no authentication.  ( ex -u john)  Default  is  no
+             user name and no authentication.
+
+
+       -lo    DEPRECATED.  This  was  used  to set LocalOnly. However, default
+             should be true and we cannot use True  as  default.   See  -nlo.
+             Default(true).
+
+
+       -nlo   When  set,  sets LocalOnly  =  false  on  the  CIM  operation .
+             Default(false).
+
+
+       -niq   Sets includeQualifiers = false on operations. Default(false).
+
+
+       -pl [propertyList]
+             Defines a propertyName List which is an optional  parameter  for
+             some  CIM  Operations.  Format  is  p1,p2,p3  (without  spaces).
+             Default is that the property list is set to NULL indicating nor
+             mally  that  the  operation  should  return all properties.  The
+             property list typically has 3 possibilities 1) empty which means
+             return  no  properties, 2) list of properties to be returned, 3)
+             NULL which means return all properties.  Since  the  default  is
+             NULL,  not  applying  the  option  means that all properties are
+             being requested.  To set this parameter to empty  use  the  form
+             -pl "".
+
+
+
+       -r [role]
+             Defines a role string for reference role parameter. Default()
+
+
+       -rc [resultClass]
+             Defines  a  resultClass  string  for References and Associators.
+             Default()
+
+
+       -rr [resultRole]
+             Defines a  role  string  for  associators  operation  resultRole
+             parameter.
+
+
+       -ip [inputParameterList]
+             Defines an invokeMethod input parameter list. Format is:
+
+             p1=v1,p2=v2,..,pn=vn (without spaces) . Default()
+
+
+       -f [filter]
+             Defines a filter to use for query. One String input . Default()
+
+
+       -o [ xml | mof | table ]
+             Output  in  xml,  mof,  or  table format. Default(mof) if the -o
+             options is not included.
+
+
+       -x     Output objects in xml instead of mof format. Default(false)
+
+
+       /B --v Displays cimcli and Pegasus software Version.
+
+
+       -v     Verbose Display. Includes Detailed  parameter  Input  display  .
+             Default(false).  Outputs  extra information about the parameters
+             actually used in the request and the return from the  operation.
+             This is primarily a debugging tool.
+
+
+       --sum  Displays only  summary  counts  for  enumerations, associators,
+             etc.This option is used to with the repeat option to  repeat  an
+             operation  without  getting the full return display.  It reduces
+             the display to summary information.  It is often used  with  the
+             time  option  --t  to generate time for execution information on
+             many repetitions of a command.
+
+
+   HELP OPTIONS
+       -h     Prints help usage message.
+
+
+       --help Prints full help message with commands, options, examples.
+
+
+       -ho    Prints list of cimcli options.
+
+
+       -hc    Prints cimcli Operation command list.  This  list  includes  the
+             CIM  Operatons  defined  by the CIM Operations specification and
+             other operations that were felt to  be  useful  in  testing  CIM
+             environments.
+
+
+       --timeout [seconds]
+             Set  the  connection timeout in seconds. If not set, the timeout
+             is the default Pegasus client timeout which for Pegasus is  nor
+             mally  to about 30 seconds. This option executes the client call
+             to set timeout.
+
+
+       -d     More detailed debug messages from cimcli. This can be useful  in
+             the case where the user is debugging CIM functionality.
+
+
+       -trace [trace_level]
+             Set  Pegasus Common Components Trace. Sets the Trace level. 0 is
+             off. Default(0). The trace level can be set to 0 - 4.
+
+
+       --r [repeat_count]
+             Number of times to repeat the function. Zero means one time. The
+             option  can  be used to repeat an operation within a single call
+             to cimcli.  It simply repeats the operation defined  the  number
+             of times defined by the repeat_count within the same connection.
+             Thus, it  establishes  the  connection  executes  the  operation
+             repeat_count times and then terminates.  It can be used with the
+             --time option to measure execution times for many repetitions of
+             an operation.
+
+
+       --t    Measure time for the operation and present results. When set the
+             response time for the operation is presented  with  the  command
+             output.   If  the  --r (repeat) option is set, minimum, maximum,
+             and average times are presented.  Note that  the  time  for  the
+             operation  itself  is  presented in addition to the overall time
+             for connect, operation, and disconnect.  If statistics are being
+             gathered  by  the  server, setting this option also presents the
+             server time, and the client round trip time which are calculated
+             by the server and client infrastructure.
+
+
+       -s     Boolean  option that specifies that the Client should attempt to
+             connect over the secure connection using SSL. This option causes
+             cimcli  to  modify the client connect call to set the SSLContext
+             option to the certificate defined  with  the  --cert  and  --key
+             options.   If this option is set but neither the --cert or --key
+             options are included, the SSLContext for  the  connect  call  is
+             submitted with the Cert and key marked NULL.
+
+             NOTE:  since SSL is considered a compilable options with cimcli,
+             these options may not even exist in a Pegasus  environment  that
+             was compiled with the SSL capabilities disabled.
+
+
+       --cert [certificate file path]
+             Defines  a certificate to be used with the client connect if the
+             -s option is set. This is optional and used only   with  the  -s
+             and --key options.
+
+
+       --key [client key file path]
+             Defines  a  Client private key. This is optional and only has an
+             effect on connections made over HTTPS using -s
+
+
+EXAMPLES
+       Execute an enumerateinstancenames CIM operation for the pg_computersys
+       tem Class
+       cimcli  enumerateinstancenames pg_computersystem  -- enumerateinstances
+       of class
+         or
+       cimcli ei pg_computersystem    -- Same as above
+
+       Enumerate the class names from the default namespace "root/cimv2"
+       cimcli enumerateclassnames -- Enumerate classnames from root/cimv2.
+
+       Enumerate class names from the namespace "root"
+       cimcli ec /n root -- Enumerate classnames from namespace root.
+
+       cimcli ec -o xml   -- Enumerate classes with XML  output  starting  at
+       root cimcli enumerateclasses CIM_Computersystem -o xml
+          -- Enumerate classes in MOF starting with CIM_Computersystem
+
+       cimcli getclass CIM_door -a -u guest -p guest
+          --  Get  class with authentication set and user = guest, password =
+       guest.
+
+       cimcli rn TST_Person.name=@MIKE@ -n root/sampleprovider  -rc  TST_Lin
+       eage.
+
+       cimcli  ec -o XML -- enumerate classes and output XML rather than MOF.
+
+       cimcli getqualifiers -- Get the qualifiers in mof output format
+
+BUGS
+       Currently at least some platforms and shells  have  problems  with  the
+       double-quote  which  is used extensively in object names within CIM. To
+       get around this, the character @ has been mapped to the double-quote
+       so that inputting a command line with this character in place of quotes
+       is acceptable.  Thus, for example,
+
+       cimcli rn TST_Person.name=@MIKE@ ...
+
+       is equivalent to
+
+       cimcli rn TST_Person.name-"MIKE" ...
+
+       In this version there is no way to  turn  this  character  mapping  off
+       which means that the @ character is lost.
+
+
+WARNINGS
+RETURN VALUE
+       cimcli returns a significant number of error codes:
+
+       0 - Successful execution of the operation.
+
+       1-30  - Operation returned a CIM Exception as defined in the CIM Opera
+       tions over HTTP specification.   The  status  code  of  the  error  is
+       returned. cimcli will not return any error codes in this range that are
+       not specifically defined by DMTF error status codes.
+
+       50 - Pegasus Exception encountered during execution  of Pegasus  Func
+       tions
+
+       51 - CIMCLI general error not covered by other errors
+
+       52 - Unknown exception occurred during execution of the operation
+
+       53 - Input Parsing error
+
+       54 - Connection to server failed error
+
+       60  -  cimcli  failed a compare with one of the test operations such as
+       testInstance
+
+
+AUTHOR
+       Karl Schopmeyer k.schopmeyer@opengroup.org
+
+
+
+                                    LOCAL                           cimcli(1)