z/OS DFSMSrmm Implementation and Customization Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Java client for use with invokeMethod

z/OS DFSMSrmm Implementation and Customization Guide
SC23-6874-00

Search is the only supported method name for the invokeMethod function. It returns a list of objects from DFSMSrmm by name. It is particularly useful when working with the CONTINUE operand for search requests. Only the number of objects that are actually returned to the client are specified by the LIMIT operand. The client is able to get the list incrementally, in an interactive way.

Input parameters are passed as CIMProperty objects, which are wrapped in an vector. Valid CIMProperty names are CdsID and Operands. CdsID is a mandatory parameter. If you issue invokeMethod against the IBMrmm_ShelfLocation class, and you would like to get BINs returned, you need to specifiy the BIN operand in the Operands parameter. Otherwise, RACKs are returned as the default. For example,
new CIMProperty("Operands", new CIMValue("BIN(*) LIMIT(20) CONTINUE"))

The returned objects from DFSMSrmm are CIMObjectPath objects, which are wrapped as values in CIMProperty objects. The CIMProperty objects are wrapped in the output Vector.

The invokeMethod function returns a operands string, ready to be used for the next data request. See Figure 1 for Java code as a sample client for invokeMethod.
Figure 1. Sample client for invokeMethod
public class IMClient {

    public static void main(String[] args) throws CIMException {

        /*******************************************************************
        * Set variables
        *******************************************************************/
        CIMClient      cc  = null;
        CIMNameSpace   cns = null;
        CIMObjectPath  cop = null;
        CIMInstance    ci  = null;
        CIMClass       cls = null;

        String host = "http://localhost:5988";
        String nameSpace = "root/cimv2";
        String className = null;
        String user = "";
        String password = "";
        String method = "search";
        String cdsId = null;
        String operands = null;
        CIMValue retValue = null;
        boolean repeat = false;
        int p = 0;
        String arg;

        /*******************************************************************
        * Extract command line arguments
        *******************************************************************/
        while (p < args.length && args[p].startsWith("-")) {

            arg = args[p++];

            /***************************************************************
            * Get -cds option
            ***************************************************************/
            if (arg.equals("-cds")) {
                if (p < args.length)
                    cdsId = args[p++];
                else
                    System.err.println("-cds requires CdsID");
            }
            /***************************************************************
            * Get -op option
            ***************************************************************/
            else if (arg.equals("-op")) {
                if (p < args.length)
                    operands = args[p++];
                else
                    System.err.println("-op requires operands string");
            }
            /***************************************************************
            * Get -cls option
            ***************************************************************/
            else if (arg.equals("-cls")) {
                if (p < args.length)
                    className = args[p++];
                else
                    System.err.println("-cls requires class name");
            }

        }

        /*******************************************************************
        * Exit if no class specified
        *******************************************************************/
        if (className == null) {
            System.err.println(
                "Usage: IMClient [-cds CdsID]"
                + " [-op search_operands] [-cls class_name]");
            System.exit(1);
        }

        /*******************************************************************
        * Create CIM client
        *******************************************************************/
        cns = new CIMNameSpace(host, nameSpace);
        cc = new CIMClient(cns, user, password);
        cop = new CIMObjectPath(className, nameSpace);

        /*******************************************************************
        * Create input and output Vectors
        *******************************************************************/
        Vector inParams = new Vector();
        Vector outParams = new Vector();

        /*******************************************************************
        * Loop while invokeMethod returns something
        *******************************************************************/
        do {
            /***************************************************************
            * Set value for input parameter CdsID, if specified
            ***************************************************************/
            if (cdsId != null)
                inParams.addElement(
                    new CIMProperty(
                        "CdsID", new CIMValue(cdsId)));
            /***************************************************************
            * Set value for input parameter Operands, if specified
            ***************************************************************/
            if (operands != null)
                inParams.addElement(
                    new CIMProperty(
                        "Operands", new CIMValue(operands)));

            /***************************************************************
            * Call invokeMethod
            ***************************************************************/
            try {
                retValue =
                    cc.invokeMethod(cop, method, inParams, outParams);
            } catch (CIMException ce) {
                System.err.println("\nInvokeMethod() Failed: " + ce);
                System.exit(1);
            }

            /***************************************************************
            * Evaluate response
            ***************************************************************/
            if (retValue != null) {

                /***********************************************************
                * Copy return value for next operands
                ***********************************************************/
                if ((operands != null) &&
                    retValue.toString().startsWith(operands.substring(0,5))) {
                    operands = retValue.toString();
                    repeat = true;
                }
                /***********************************************************
                * Stop loop if no operands returned
                ***********************************************************/
                else {
                    repeat = false;
                }

                /***********************************************************
                * Show the output Vector
                ***********************************************************/
                for (int i = 0; i < outParams.size(); i++) {
                    System.out.println(
                        ((CIMProperty)outParams.elementAt(i))
                            .getValue().toString());
                }

                /***********************************************************
                * Show the return value
                ***********************************************************/
                System.out.println(retValue.toString());

            }

        } while ((retValue != null) && repeat);

    }

}

Sample invocation:
java IMClient -cds RMM_TC -cls IBMRMM_LogicalVolume
              -op "Volume(X*) Owner(*) Limit(10) Continue"

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014