Package org.ogce.schemas.gfac.documents

Examples of org.ogce.schemas.gfac.documents.MethodType


    ServiceMapType serviceMapType = DescriptionUtils.getServiceMapDocument(regService, stringQName);

    if (serviceMapType.getLifeTime() != null) {
      notAfterInactiveMinutes = serviceMapType.getLifeTime().getNotAfterInactiveMinutes();
    }
    MethodType method = GfacUtils.findOperationWithApplication(serviceMapType);
    ApplicationType appType = method.getApplication();
    ApplicationName appxbeanName = method.getApplication().getApplicationName();
    String appName = new QName(appxbeanName.getTargetNamespace(), appxbeanName.getStringValue()).toString();
    MethodBean methodBean = new MethodBean(method.getMethodName(), method.getMethodDescription(),
        method.isSetStageOutputDataFiles(), method.isSetForceFileStagingToWorkDir(),
        appType.isSetUseLEADNameListFile(), appType.isSetUseLEADNameListPropertiesFile());

    // Done to convert the parameter type of enum to string which was not
    // possible in JSF selectOneListbox. For inputText it works without
    // doing this change
    InputParameterType[] inputparams = method.getInputParameterArray();
    ServiceParam[] inparam = new ServiceParam[inputparams.length];

    for (int i = 0; i < inputparams.length; i++) {
      inparam[i] = new ServiceParam();
      InputParameterType inputParameterType = inputparams[i];
      inparam[i].paramName = inputParameterType.getParameterName();
      inparam[i].paramDesc = inputParameterType.getParameterDescription();
      inparam[i].paramValue = inputParameterType.getParameterType().toString();

    }
    // Done to convert the parameter type of enum to string which was not
    // possible in JSF selectOneListbox. For inputText it works without
    // doing this change
    OutputParameterType[] outparams = method.getOutputParameterArray();
    ServiceParam[] outparam = new ServiceParam[outparams.length];
    for (int i = 0; i < outparams.length; i++) {
      outparam[i] = new ServiceParam();
      OutputParameterType outputParameterType = outparams[i];
      outparam[i].paramName = outputParameterType.getParameterName();
View Full Code Here


      if (op == null) {
        throw new GfacException("Operation can not be Null", FaultCode.InvaliedLocalArgumnet);
      }

      MethodType[] methods = pt.getMethodArray();
      MethodType method = null;
      if (methods != null) {
        for (MethodType oldMethod : methods) {
          if (op.getMethodName().equals(oldMethod.getMethodName())) {
            method = oldMethod;
          }
        }
      }
      if (method == null) {
        method = pt.addNewMethod();
      }
      method.setMethodName(op.getMethodName());
      method.setMethodDescription(op.getMethodDescription());
      ApplicationType appType = method.getApplication();
      if (appType == null) {
        appType = method.addNewApplication();
      }
      appType.setParamValuesOnly(true);
      ApplicationName appNameType = appType.getApplicationName();
      if (appNameType == null) {
        appNameType = appType.addNewApplicationName();
      }
      QName appName = new QName(serviceInfo.getObjectNamespace(), serviceInfo.getApplicationName());
      appNameType.setStringValue(appName.getLocalPart());
      appNameType.setTargetNamespace(appName.getNamespaceURI());
      appType.setApplicationDescription(op.getMethodDescription());

      // Boolean parameters from Service screen
      if (op.isStageOutputDataFiles()) {
        method.setStageOutputDataFiles(true);
      }

      if (op.isForceFileStagingToWorkDir()) {
        method.setForceFileStagingToWorkDir(true);
      }

      if (op.isUseLEADNameListFile()) {
        appType.setUseLEADNameListFile(true);
      }

      if (op.isUseLEADNameListPropertiesFile()) {
        appType.setUseLEADNameListPropertiesFile(true);
      }

      InputParameterType[] inputs = method.getInputParameterArray();
      HashMap<String, InputParameterType> inputMap = new HashMap<String, InputParameterType>();
      if (inputs != null) {
        for (InputParameterType inputParameterType : inputs) {
          inputMap.put(inputParameterType.getParameterName(), inputParameterType);
        }
      }

      OutputParameterType[] outputs = method.getOutputParameterArray();
      HashMap<String, OutputParameterType> outputMap = new HashMap<String, OutputParameterType>();
      if (inputs != null) {
        for (OutputParameterType outputParameterType : outputs) {
          outputMap.put(outputParameterType.getParameterName(), outputParameterType);
        }
      }

      ArrayList<ParamObject> inputparams = op.getInputParms();
      for (int y = 0; y < inputparams.size(); y++) {
        ParamObject param = (ParamObject) inputparams.get(y);
        InputParameterType inputParm = inputMap.get(param.getName());
        if (inputParm == null) {
          inputParm = method.addNewInputParameter();
        }
        inputParm.setParameterName(param.getName());
        inputParm.setParameterDescription(param.getDesc());
        InputDataType.Enum type = InputDataType.Enum.forString(param.getType());
        inputParm.setParameterType(type);
      }

      ArrayList<ParamObject> outputparams = op.getOutputParms();
      for (int y = 0; y < outputparams.size(); y++) {
        ParamObject param = (ParamObject) outputparams.get(y);
        OutputParameterType outputParm = outputMap.get(param.getName());
        if (outputParm == null) {
          outputParm = method.addNewOutputParameter();
        }
        outputParm.setParameterName(param.getName());
        outputParm.setParameterDescription(param.getDesc());
        OutputDataType.Enum type = OutputDataType.Enum.forString(param.getType());
        outputParm.setParameterType(type);
View Full Code Here

      if (op == null) {
        throw new GfacException("Operation can not be Null", FaultCode.InvaliedLocalArgumnet);
      }

      MethodType[] methods = pt.getMethodArray();
      MethodType method = null;
      if (methods != null) {
        for (MethodType oldMethod : methods) {
          if (op.getMethodName().equals(oldMethod.getMethodName())) {
            method = oldMethod;
          }
        }
      }
      if (method == null) {
        method = pt.addNewMethod();
      }
      method.setMethodName(op.getMethodName());
      method.setMethodDescription(op.getMethodDescription());
      ApplicationType appType = method.getApplication();
      if (appType == null) {
        appType = method.addNewApplication();
      }
      appType.setParamValuesOnly(true);
      ApplicationName appNameType = appType.getApplicationName();
      if (appNameType == null) {
        appNameType = appType.addNewApplicationName();
      }
      QName appName = new QName(serviceInfo.getObjectNamespace(), serviceInfo.getApplicationName());
      appNameType.setStringValue(appName.getLocalPart());
      appNameType.setTargetNamespace(appName.getNamespaceURI());
      appType.setApplicationDescription(op.getMethodDescription());

      // Boolean parameters from Service screen
      if (op.isStageOutputDataFiles()) {
        method.setStageOutputDataFiles(true);
      }

      if (op.isForceFileStagingToWorkDir()) {
        method.setForceFileStagingToWorkDir(true);
      }

      if (op.isUseLEADNameListFile()) {
        appType.setUseLEADNameListFile(true);
      }

      if (op.isUseLEADNameListPropertiesFile()) {
        appType.setUseLEADNameListPropertiesFile(true);
      }

      InputParameterType[] inputs = method.getInputParameterArray();
      HashMap<String, InputParameterType> inputMap = new HashMap<String, InputParameterType>();
      if (inputs != null) {
        for (InputParameterType inputParameterType : inputs) {
          inputMap.put(inputParameterType.getParameterName(), inputParameterType);
        }
      }

      OutputParameterType[] outputs = method.getOutputParameterArray();
      HashMap<String, OutputParameterType> outputMap = new HashMap<String, OutputParameterType>();
      if (inputs != null) {
        for (OutputParameterType outputParameterType : outputs) {
          outputMap.put(outputParameterType.getParameterName(), outputParameterType);
        }
      }

      ArrayList<ParamObject> inputparams = op.getInputParms();
      for (int y = 0; y < inputparams.size(); y++) {
        ParamObject param = (ParamObject) inputparams.get(y);
        InputParameterType inputParm = inputMap.get(param.getName());
        if (inputParm == null) {
          inputParm = method.addNewInputParameter();
        }
        inputParm.setParameterName(param.getName());
        inputParm.setParameterDescription(param.getDesc());
        InputDataType.Enum type = InputDataType.Enum.forString(param.getType());
        inputParm.setParameterType(type);
      }

      ArrayList<ParamObject> outputparams = op.getOutputParms();
      for (int y = 0; y < outputparams.size(); y++) {
        ParamObject param = (ParamObject) outputparams.get(y);
        OutputParameterType outputParm = outputMap.get(param.getName());
        if (outputParm == null) {
          outputParm = method.addNewOutputParameter();
        }
        outputParm.setParameterName(param.getName());
        outputParm.setParameterDescription(param.getDesc());
        OutputDataType.Enum type = OutputDataType.Enum.forString(param.getType());
        outputParm.setParameterType(type);
View Full Code Here

      if (op == null) {
        throw new GFacSchemaException("Operation can not be Null");
      }

      MethodType[] methods = pt.getMethodArray();
      MethodType method = null;
      if (methods != null) {
        for (MethodType oldMethod : methods) {
          if (op.getMethodName().equals(oldMethod.getMethodName())) {
            method = oldMethod;
          }
        }
      }
      if (method == null) {
        method = pt.addNewMethod();
      }
      method.setMethodName(op.getMethodName());
      method.setMethodDescription(op.getMethodDescription());
      ApplicationType appType = method.getApplication();
      if (appType == null) {
        appType = method.addNewApplication();
      }
      appType.setParamValuesOnly(true);
      ApplicationName appNameType = appType.getApplicationName();
      if (appNameType == null) {
        appNameType = appType.addNewApplicationName();
      }
      QName appName = new QName(serviceInfo.getObjectNamespace(),
          serviceInfo.getApplicationName());
      appNameType.setStringValue(appName.getLocalPart());
      appNameType.setTargetNamespace(appName.getNamespaceURI());
      appType.setApplicationDescription(op.getMethodDescription());

      // Boolean parameters from Service screen
      if (op.isStageOutputDataFiles()) {
        method.setStageOutputDataFiles(true);
      }

      if (op.isForceFileStagingToWorkDir()) {
        method.setForceFileStagingToWorkDir(true);
      }

      if (op.isUseLEADNameListFile()) {
        appType.setUseLEADNameListFile(true);
      }

      if (op.isUseLEADNameListPropertiesFile()) {
        appType.setUseLEADNameListPropertiesFile(true);
      }

      InputParameterType[] inputs = method.getInputParameterArray();
      HashMap<String, InputParameterType> inputMap = new HashMap<String, InputParameterType>();
      if (inputs != null) {
        for (InputParameterType inputParameterType : inputs) {
          inputMap.put(inputParameterType.getParameterName(),
              inputParameterType);
        }
      }

      OutputParameterType[] outputs = method.getOutputParameterArray();
      HashMap<String, OutputParameterType> outputMap = new HashMap<String, OutputParameterType>();
      if (inputs != null) {
        for (OutputParameterType outputParameterType : outputs) {
          outputMap.put(outputParameterType.getParameterName(),
              outputParameterType);
        }
      }

      ArrayList<ParamObject> inputparams = op.getInputParms();
      for (int y = 0; y < inputparams.size(); y++) {
        ParamObject param = (ParamObject) inputparams.get(y);
        InputParameterType inputParm = inputMap.get(param.getName());
        if (inputParm == null) {
          inputParm = method.addNewInputParameter();
        }
        inputParm.setParameterName(param.getName());
        inputParm.setParameterDescription(param.getDesc());
        InputDataType.Enum type = InputDataType.Enum.forString(param
            .getType());
        inputParm.setParameterType(type);
      }

      ArrayList<ParamObject> outputparams = op.getOutputParms();
      for (int y = 0; y < outputparams.size(); y++) {
        ParamObject param = (ParamObject) outputparams.get(y);
        OutputParameterType outputParm = outputMap.get(param.getName());
        if (outputParm == null) {
          outputParm = method.addNewOutputParameter();
        }
        outputParm.setParameterName(param.getName());
        outputParm.setParameterDescription(param.getDesc());
        OutputDataType.Enum type = OutputDataType.Enum.forString(param
            .getType());
View Full Code Here

    if (serviceMapType.getLifeTime() != null) {
      notAfterInactiveMinutes = serviceMapType.getLifeTime()
          .getNotAfterInactiveMinutes();
    }
    MethodType method = findOperationWithApplication(serviceMapType);
    ApplicationType appType = method.getApplication();
    ApplicationName appxbeanName = method.getApplication()
        .getApplicationName();
    String appName = new QName(appxbeanName.getTargetNamespace(),
        appxbeanName.getStringValue()).toString();
    MethodBean methodBean = new MethodBean(method.getMethodName(), method
        .getMethodDescription(), method.isSetStageOutputDataFiles(),
        method.isSetForceFileStagingToWorkDir(), appType
            .isSetUseLEADNameListFile(), appType
            .isSetUseLEADNameListPropertiesFile());

    InputParameterType[] inputparams = method.getInputParameterArray();
    for (int index = 0; index < inputparams.length; index++) {

      InputParameterType inputParameterType = inputparams[index];
      methodBean.addInputParms(new ParamObject(inputParameterType
          .getParameterName(), inputParameterType.getParameterType()
          .toString(), index, inputParameterType
          .getParameterDescription()));

    }

    OutputParameterType[] outparams = method.getOutputParameterArray();
    for (int index = 0; index < outparams.length; index++) {

      OutputParameterType outputParameterType = outparams[index];
      methodBean.addOutputParms(new ParamObject(outputParameterType
          .getParameterName(), outputParameterType.getParameterType()
View Full Code Here

                return methods[i];
            }
        }

        if (isInbuiltOperation(operationName)) {
            MethodType method = portType.addNewMethod();
            method.setMethodName(operationName);
            return method;
        }

        throw new GFacSchemaException("Method name " + operationName + " not found");
    }
View Full Code Here

        anno.addChild(value);
        return builder.serializeToString(anno);
    }

    public static QName findApplcationName(ServiceMapType serviceMap) throws GFacSchemaException{
        MethodType method = GfacUtils.findOperationWithApplication(serviceMap);

        if (method == null) {
            throw new GFacSchemaException("None of the methods has application defined");
        }

        String applicationName = method.getApplication().getApplicationName().getStringValue();
        String applicationNameNs = method.getApplication().getApplicationName()
                .getTargetNamespace();
        return new QName(applicationNameNs, applicationName);
    }
View Full Code Here

                throw new GFacSchemaException("Each port type must have at least one method a.k.a operation");
            }

            for(int j = 0; j < methods.length; ++j)
            {
                MethodType method = methods[i];
                if(method.getMethodName() == null)
                {
                    throw new GFacSchemaException("Every method must have a name");
                }

                if(method.getMethodName().equals(GFacConstants.PING) ||
                   method.getMethodName().equals(GFacConstants.SHUTDOWN) ||
                   method.getMethodName().equals(GFacConstants.KILL) ||
                   method.getMethodName().equals(GFacConstants.CREATE_SERVICE))
                {
                    if(method.getApplication() != null)
                    {
                        throw new GFacSchemaException("Ping, Shutdown, Kill and CreateService are system defined methods");
                    }
                }


                if(!(method.getMethodName().equals(GFacConstants.PING) ||
                         method.getMethodName().equals(GFacConstants.SHUTDOWN) ||
                         method.getMethodName().equals(GFacConstants.KILL) ||
                         method.getMethodName().equals(GFacConstants.CREATE_SERVICE)))
                {
                    if(method.getApplication() == null)
                    {
                        throw new GFacSchemaException("Every user defined method must have one application associated with it");
                    }


                    ApplicationType app = method.getApplication();

                    if(app.getApplicationName() == null)
                    {
                        throw new GFacSchemaException("Application must have a name");
                    }

                    if(app.getApplicationName().getTargetNamespace() == null)
                    {
                        throw new GFacSchemaException("Application must have a target namespace");
                    }

                    InputParameterType[] inputs = method.getInputParameterArray();
                    if(inputs != null && inputs.length > 0)
                    {
                        InputParameterType input = inputs[i];
                        if(input.getParameterName() == null)
                        {
                            throw new GFacSchemaException("Every input parameter must have a parameter name");
                        }

                        if(input.getParameterType() == null)
                        {
                            throw new GFacSchemaException("Every input parameter must have a valid data type");
                        }

                        ParameterValueType[] values = input.getParameterValueArray();

                        if(values != null && values.length > 0)
                        {
                            for(int k = 0; k < values.length; ++k)
                            {
                                if(values[k].getValue() == null)
                                {
                                    throw new GFacSchemaException("Every parameter value must have a value");
                                }
                            }
                        }

                    }

                    OutputParameterType[] outputs = method.getOutputParameterArray();
                    if(outputs != null && outputs.length > 0)
                    {
                        OutputParameterType output = outputs[i];
                        if(output.getParameterName() == null)
                        {
View Full Code Here

        return methods[i];
      }
    }

    if (isInbuiltOperation(operationName)) {
      MethodType method = portType.addNewMethod();
      method.setMethodName(operationName);
      return method;
    }

    throw new GfacException("Method name " + operationName + " not found", FaultCode.InvaliedLocalArgumnet);
  }
View Full Code Here

  // anno.addChild(value);
  // return builder.serializeToString(anno);
  // }

  public static QName findApplcationName(ServiceMapType serviceMap) throws GfacException {
    MethodType method = GfacUtils.findOperationWithApplication(serviceMap);

    if (method == null) {
      throw new GfacException("None of the methods has application defined", FaultCode.InvaliedLocalArgumnet);
    }

    String applicationName = method.getApplication().getApplicationName().getStringValue();
    String applicationNameNs = method.getApplication().getApplicationName().getTargetNamespace();
    return new QName(applicationNameNs, applicationName);
  }
View Full Code Here

TOP

Related Classes of org.ogce.schemas.gfac.documents.MethodType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.