Package org.apache.airavata.commons.gfac.type

Examples of org.apache.airavata.commons.gfac.type.ServiceDescription


    }

    private OMElement createActualParameters() throws AiravataAPIInvocationException, RegistryException, XMLStreamException {
        OMFactory omFactory = OMAbstractFactory.getOMFactory();
        OMElement invoke_inputParams = omFactory.createOMElement(new QName("invoke_InputParams"));
        ServiceDescription serviceDescription = airavataAPI.getApplicationManager().getServiceDescription(this.serviceName);
        if (serviceDescription == null) {
            throw new RegistryException(new Exception("Service Description not found in registry."));
        }
        ServiceDescriptionType serviceDescriptionType = serviceDescription.getType();
        for (String inputName : this.inputNames) {
            OMElement omElement = omFactory.createOMElement(new QName(inputName));
            int index = this.inputNames.indexOf(inputName);
            Object value = this.inputValues.get(index);
            InputParameterType parameter = serviceDescriptionType.getInputParametersArray(index);
View Full Code Here


        inputParameters.add(descriptorBuilder.buildInputParameterType("echo_input", "echo input", DataType.STRING));

        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        outputParameters.add(descriptorBuilder.buildOutputParameterType("echo_output", "Echo output", DataType.STRING));

        ServiceDescription serviceDescription = descriptorBuilder.buildServiceDescription("Echo", "Echo service",
                inputParameters, outputParameters);

        log("Adding service description ...");
        airavataAPI.getApplicationManager().addServiceDescription(serviceDescription);
        Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
                serviceDescription.getType().getName()));

        // Deployment descriptor
        ApplicationDescription applicationDeploymentDescription = descriptorBuilder
                .buildApplicationDeploymentDescription("EchoApplication", "/bin/echo", "/tmp");

        log("Adding deployment description ...");
        airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription, hostDescription,
                applicationDeploymentDescription);

        Assert.assertTrue(airavataAPI.getApplicationManager().isApplicationDescriptorExists(
                serviceDescription.getType().getName(), hostDescription.getType().getHostName(),
                applicationDeploymentDescription.getType().getApplicationName().getStringValue()));

        log("Saving workflow ...");
        Workflow workflow = new Workflow(getWorkflowComposeContent("src/test/resources/EchoWorkflow.xwf"));
        airavataAPI.getWorkflowManager().addWorkflow(workflow);
View Full Code Here

        inputParameters.add(descriptorBuilder.buildInputParameterType("echo_input", "echo input", DataType.STRING));

        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        outputParameters.add(descriptorBuilder.buildOutputParameterType("echo_output", "Echo output", DataType.STRING));

        ServiceDescription serviceDescription = descriptorBuilder.buildServiceDescription("Echo", "Echo service",
                inputParameters, outputParameters);

        log("Adding service description ...");
        try {
            airavataAPI.getApplicationManager().addServiceDescription(serviceDescription);
            Assert.fail("Service Descriptor should already exists and should go to update.");
        } catch (DescriptorRecordAlreadyExistsException e) {

            log("Updating service description ....");
            airavataAPI.getApplicationManager().updateServiceDescription(serviceDescription);
        }

        Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
                serviceDescription.getType().getName()));

        // Deployment descriptor
        ApplicationDescription applicationDeploymentDescription = descriptorBuilder
                .buildApplicationDeploymentDescription("EchoApplication", "/bin/echo", "/tmp");

        log("Adding deployment description ...");
        try {
            airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription, hostDescription,
                    applicationDeploymentDescription);
            Assert.fail("Application Descriptor should already exists and should go to update.");
        } catch (DescriptorRecordAlreadyExistsException e) {

            log("Updating application description ....");
            airavataAPI.getApplicationManager().updateApplicationDescription(serviceDescription, hostDescription,
                    applicationDeploymentDescription);
        }

        Assert.assertTrue(airavataAPI.getApplicationManager().isApplicationDescriptorExists(
                serviceDescription.getType().getName(), hostDescription.getType().getHostName(),
                applicationDeploymentDescription.getType().getApplicationName().getStringValue()));

        log("Saving workflow ...");
        Workflow workflow = new Workflow(getWorkflowComposeContent("src/test/resources/EchoWorkflow.xwf"));
View Full Code Here

 
  @Override
  public ServiceDescription getServiceDescription(String serviceId)
      throws AiravataAPIInvocationException {
    try {
      ServiceDescription desc = getClient().getRegistryClient().getServiceDescriptor(serviceId);
      if(desc!=null){
            return desc;
          }
//      throw new AiravataAPIInvocationException(new Exception("Service Description not found in registry."));
    } catch (Exception e) {
View Full Code Here

*/
public class RegistryDataService extends DataServiceChain {

    public boolean execute(InvocationContext context) throws ExtensionException {

        ServiceDescription serviceDesc = context.getExecutionDescription().getService();
        HostDescription hostDesc = context.getExecutionDescription().getHost();
        ApplicationDeploymentDescriptionType appDesc = context.getExecutionDescription().getApp().getType();
        if (serviceDesc != null && hostDesc != null && appDesc != null) {
            /*
             * if there is no setting in deployment description, use from host
             */
            if (appDesc.getScratchWorkingDirectory() == null) {
                appDesc.setScratchWorkingDirectory("/tmp");
            }

            /*
             * Working dir
             */
            if (appDesc.getStaticWorkingDirectory() == null || "null".equals(appDesc.getStaticWorkingDirectory())) {
                String date = new Date().toString();
                date = date.replaceAll(" ", "_");
                date = date.replaceAll(":", "_");

                String tmpDir = appDesc.getScratchWorkingDirectory() + File.separator
                        + serviceDesc.getType().getName() + "_" + date + "_" + UUID.randomUUID();

                appDesc.setStaticWorkingDirectory(tmpDir);
            }

            /*
 
View Full Code Here

            e.printStackTrace();
        }
        //Set the WorkflowContext Header to the ThreadLocal of the Gfac Service, so that this can be accessed easilly
        WorkflowContextHeaderBuilder.setCurrentContextHeader(document.getContextHeader());
        Map<Parameter,ActualParameter> actualParameters = new LinkedHashMap<Parameter,ActualParameter>();
        ServiceDescription serviceDescription = getRegistry(context).getServiceDescriptor(serviceName);
        if(serviceDescription==null){
          throw new RegistryException(new Exception("Service Description not found in registry."));
        }
        ServiceDescriptionType serviceDescriptionType = serviceDescription.getType();
        for (Parameter parameter : serviceDescriptionType.getInputParametersArray()) {
            OMElement element = input.getFirstChildWithName(new QName(null,parameter.getParameterName().replaceAll(WSDLConstants.HYPHEN, WSDLConstants.HYPHEN_REPLACEMENT)));
            if(element == null){
                element = input.getFirstChildWithName(new QName(GFacSchemaConstants.GFAC_NAMESPACE,parameter.getParameterName().replaceAll(WSDLConstants.HYPHEN, WSDLConstants.HYPHEN_REPLACEMENT)));
            }
View Full Code Here

            e.printStackTrace();
        }
        //Set the WorkflowContext Header to the ThreadLocal of the Gfac Service, so that this can be accessed easilly
        WorkflowContextHeaderBuilder.setCurrentContextHeader(document.getContextHeader());
        Map<Parameter,ActualParameter> actualParameters = new LinkedHashMap<Parameter,ActualParameter>();
        ServiceDescription serviceDescription = getRegistry(context).getServiceDescriptor(serviceName);
        if(serviceDescription==null){
          throw new RegistryException(new Exception("Service Description not found in registry."));
        }
        ServiceDescriptionType serviceDescriptionType = serviceDescription.getType();
        for (Parameter parameter : serviceDescriptionType.getInputParametersArray()) {
            OMElement element = input.getFirstChildWithName(new QName(null,parameter.getParameterName().replaceAll(WSDLConstants.HYPHEN, WSDLConstants.HYPHEN_REPLACEMENT)));
            if(element == null){
                element = input.getFirstChildWithName(new QName(GFacSchemaConstants.GFAC_NAMESPACE,parameter.getParameterName().replaceAll(WSDLConstants.HYPHEN, WSDLConstants.HYPHEN_REPLACEMENT)));
            }
View Full Code Here

        inputParameters.add(descriptorBuilder.buildInputParameterType("echo_input", "echo input", DataType.STRING));

        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        outputParameters.add(descriptorBuilder.buildOutputParameterType("echo_output", "Echo output", DataType.STRING));

        ServiceDescription serviceDescription = descriptorBuilder.buildServiceDescription("Echo", "Echo service",
                inputParameters, outputParameters);

        log("Adding service description ...");
        airavataAPI.getApplicationManager().addServiceDescription(serviceDescription);
        Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
                serviceDescription.getType().getName()));

        // Deployment descriptor
        ApplicationDescription applicationDeploymentDescription = descriptorBuilder
                .buildApplicationDeploymentDescription("EchoApplication", "/bin/echo", "/tmp");

        log("Adding deployment description ...");
        airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription, hostDescription,
                applicationDeploymentDescription);

        Assert.assertTrue(airavataAPI.getApplicationManager().isApplicationDescriptorExists(
                serviceDescription.getType().getName(), hostDescription.getType().getHostName(),
                applicationDeploymentDescription.getType().getApplicationName().getStringValue()));

        log("Saving workflow ...");
        Workflow workflow = new Workflow(getWorkflowComposeContent("src/test/resources/EchoWorkflow.xwf"));
        airavataAPI.getWorkflowManager().addWorkflow(workflow);
View Full Code Here

        inputParameters.add(descriptorBuilder.buildInputParameterType("echo_input", "echo input", DataType.STRING));

        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        outputParameters.add(descriptorBuilder.buildOutputParameterType("echo_output", "Echo output", DataType.STRING));

        ServiceDescription serviceDescription = descriptorBuilder.buildServiceDescription("Echo", "Echo service",
                inputParameters, outputParameters);

        log("Adding service description ...");
        try {
            airavataAPI.getApplicationManager().addServiceDescription(serviceDescription);
            Assert.fail("Service Descriptor should already exists and should go to update.");
        } catch (DescriptorAlreadyExistsException e) {

            log("Updating service description ....");
            airavataAPI.getApplicationManager().updateServiceDescription(serviceDescription);
        }

        Assert.assertTrue(airavataAPI.getApplicationManager().isServiceDescriptorExists(
                serviceDescription.getType().getName()));

        // Deployment descriptor
        ApplicationDescription applicationDeploymentDescription = descriptorBuilder
                .buildApplicationDeploymentDescription("EchoApplication", "/bin/echo", "/tmp");

        log("Adding deployment description ...");
        try {
            airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription, hostDescription,
                    applicationDeploymentDescription);
            Assert.fail("Application Descriptor should already exists and should go to update.");
        } catch (DescriptorAlreadyExistsException e) {

            log("Updating application description ....");
            airavataAPI.getApplicationManager().updateApplicationDescription(serviceDescription, hostDescription,
                    applicationDeploymentDescription);
        }

        Assert.assertTrue(airavataAPI.getApplicationManager().isApplicationDescriptorExists(
                serviceDescription.getType().getName(), hostDescription.getType().getHostName(),
                applicationDeploymentDescription.getType().getApplicationName().getStringValue()));

        log("Saving workflow ...");
        Workflow workflow = new Workflow(getWorkflowComposeContent("src/test/resources/EchoWorkflow.xwf"));
View Full Code Here

        ((UnicoreHostType) host.getType()).setGridFTPEndPointArray(new String[] { gridftpAddress });
        return host;
    }

    protected ServiceDescription getServiceDesc() {
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName("SimpleCat");

        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        InputParameterType input = InputParameterType.Factory.newInstance();
        input.setParameterName("echo_input");
        input.setParameterType(StringParameterType.Factory.newInstance());
        inputList.add(input);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList.size()]);

        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        OutputParameterType output = OutputParameterType.Factory.newInstance();
        output.setParameterName("echo_output");
        output.setParameterType(StringParameterType.Factory.newInstance());
        outputList.add(output);
        OutputParameterType[] outputParamList = outputList.toArray(new OutputParameterType[outputList.size()]);

        serv.getType().setInputParametersArray(inputParamList);
        serv.getType().setOutputParametersArray(outputParamList);

        return serv;
    }
View Full Code Here

TOP

Related Classes of org.apache.airavata.commons.gfac.type.ServiceDescription

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.