/**
 * ContentManagerServiceBindingStub.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis Wsdl2java emitter.
 */

package com.cognos.developer;

public class ContentManagerServiceBindingStub extends org.apache.axis.client.Stub implements com.cognos.developer.ContentManagerServicePortType {
    private java.util.Vector cachedSerClasses = new java.util.Vector();
    private java.util.Vector cachedSerQNames = new java.util.Vector();
    private java.util.Vector cachedSerFactories = new java.util.Vector();
    private java.util.Vector cachedDeserFactories = new java.util.Vector();

    public ContentManagerServiceBindingStub() throws org.apache.axis.AxisFault {
         this(null);
    }

    public ContentManagerServiceBindingStub(java.net.URL endpointURL, javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
         this(service);
         super.cachedEndpoint = endpointURL;
    }

    public ContentManagerServiceBindingStub(javax.xml.rpc.Service service) throws org.apache.axis.AxisFault {
        try {
            if (service == null) {
                super.service = new org.apache.axis.client.Service();
            } else {
                super.service = service;
            }
            Class cls;
            javax.xml.rpc.namespace.QName qName;
            Class beansf = org.apache.axis.encoding.ser.BeanSerializerFactory.class;
            Class beandf = org.apache.axis.encoding.ser.BeanDeserializerFactory.class;
            Class enumsf = org.apache.axis.encoding.ser.EnumSerializerFactory.class;
            Class enumdf = org.apache.axis.encoding.ser.EnumDeserializerFactory.class;
            Class arraysf = org.apache.axis.encoding.ser.ArraySerializerFactory.class;
            Class arraydf = org.apache.axis.encoding.ser.ArrayDeserializerFactory.class;
            qName = new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "SortPropertyStruct");
            cachedSerQNames.add(qName);
            cls = com.cognos.developer.SortPropertyStruct.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

            qName = new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "arrayOfQueryPropertyStruct");
            cachedSerQNames.add(qName);
            cls = com.cognos.developer.QueryPropertyStruct[].class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(arraysf);
            cachedDeserFactories.add(arraydf);

            qName = new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "sortType");
            cachedSerQNames.add(qName);
            cls = com.cognos.developer.SortType.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(enumsf);
            cachedDeserFactories.add(enumdf);

            qName = new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "CMObject");
            cachedSerQNames.add(qName);
            cls = com.cognos.developer.CMObject.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

            qName = new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "queryPropertyStruct");
            cachedSerQNames.add(qName);
            cls = com.cognos.developer.QueryPropertyStruct.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(beansf);
            cachedDeserFactories.add(beandf);

            qName = new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "arrayOfSortPropertyStruct");
            cachedSerQNames.add(qName);
            cls = com.cognos.developer.SortPropertyStruct[].class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(arraysf);
            cachedDeserFactories.add(arraydf);

            qName = new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "propertyType");
            cachedSerQNames.add(qName);
            cls = com.cognos.developer.PropertyType.class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(enumsf);
            cachedDeserFactories.add(enumdf);

            qName = new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "arrayOfCMObject");
            cachedSerQNames.add(qName);
            cls = com.cognos.developer.CMObject[].class;
            cachedSerClasses.add(cls);
            cachedSerFactories.add(arraysf);
            cachedDeserFactories.add(arraydf);

        }
        catch(Exception t) {
            throw org.apache.axis.AxisFault.makeFault(t);
        }
    }

    private org.apache.axis.client.Call getCall() throws java.rmi.RemoteException {
        try {
            org.apache.axis.client.Call call =
                    (org.apache.axis.client.Call) super.service.createCall();
            if (super.maintainSessionSet) {
                call.setMaintainSession(super.maintainSession);
            }
            if (super.cachedUsername != null) {
                call.setUsername(super.cachedUsername);
            }
            if (super.cachedPassword != null) {
                call.setPassword(super.cachedPassword);
            }
            if (super.cachedEndpoint != null) {
                call.setTargetEndpointAddress(super.cachedEndpoint);
            }
            if (super.cachedTimeout != null) {
                call.setTimeout(super.cachedTimeout);
            }
            java.util.Enumeration keys = super.cachedProperties.keys();
            while (keys.hasMoreElements()) {
                String key = (String) keys.nextElement();
                call.setProperty(key, super.cachedProperties.get(key));
            }
            // All the type mapping information is registered
            // when the first call is made.
            // The type mapping information is actually registered in
            // the TypeMappingRegistry of the service, which
            // is the reason why registration is only needed for the first call.
            if (firstCall()) {
                for (int i = 0; i < cachedSerFactories.size(); ++i) {
                    Class cls = (Class) cachedSerClasses.get(i);
                    javax.xml.rpc.namespace.QName qName =
                            (javax.xml.rpc.namespace.QName) cachedSerQNames.get(i);
                    Class sf = (Class)
                             cachedSerFactories.get(i);
                    Class df = (Class)
                             cachedDeserFactories.get(i);
                    call.registerTypeMapping(cls, qName, sf, df, false);
                }
            }
            return call;
        }
        catch (Throwable t) {
            throw new org.apache.axis.AxisFault("Failure trying to get the Call object", t);
        }
    }

    public com.cognos.developer.CMObject[] query(java.lang.String select, java.lang.String permission, boolean schemaInfo, java.lang.String relativeURI, long maxObjects, long skipObjects, boolean continueOnError, com.cognos.developer.QueryPropertyStruct[] properties, com.cognos.developer.SortPropertyStruct[] sort) throws java.rmi.RemoteException{
        if (super.cachedEndpoint == null) {
            throw new org.apache.axis.NoEndPointException();
        }
        org.apache.axis.client.Call call = getCall();
        call.addParameter("select", new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.addParameter("permission", new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.addParameter("schemaInfo", new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.addParameter("relativeURI", new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.addParameter("maxObjects", new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.addParameter("skipObjects", new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "long"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.addParameter("continueOnError", new javax.xml.rpc.namespace.QName("http://www.w3.org/2001/XMLSchema", "boolean"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.addParameter("properties", new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "arrayOfQueryPropertyStruct"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.addParameter("sort", new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "arrayOfSortPropertyStruct"), javax.xml.rpc.ParameterMode.PARAM_MODE_IN);
        call.setReturnType(new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/cm/1/", "arrayOfCMObject"));
        call.setUseSOAPAction(true);
        call.setSOAPActionURI("");
        call.setOperationStyle("rpc");
        call.setOperationName(new javax.xml.rpc.namespace.QName("http://developer.cognos.com/schemas/wsdl/query", "query"));

        Object resp = call.invoke(new Object[] {select, permission, new Boolean(schemaInfo), relativeURI, new Long(maxObjects), new Long(skipObjects), new Boolean(continueOnError), properties, sort});

        if (resp instanceof java.rmi.RemoteException) {
            throw (java.rmi.RemoteException)resp;
        }
        else {
             // REVISIT THIS!
             return (com.cognos.developer.CMObject[])org.apache.axis.utils.JavaUtils.convert(resp,com.cognos.developer.CMObject[].class);
        }
    }

}
