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

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


        ServiceDescriptionList serviceDescriptionList = response.getEntity(ServiceDescriptionList.class);
        ServiceDescriptor[] serviceDescriptors = serviceDescriptionList.getServiceDescriptions();

        for (ServiceDescriptor serviceDescriptor : serviceDescriptors) {
            ServiceDescription serviceDescription = DescriptorUtil.createServiceDescription(serviceDescriptor);
            serviceDescriptions.add(serviceDescription);
        }
        return serviceDescriptions;
    }
View Full Code Here


    }

    public void addApplicationDescriptor(String serviceName,
                                         String hostName,
                                         ApplicationDescription descriptor) throws DescriptorAlreadyExistsException {
        ServiceDescription serviceDescription = getServiceDescriptor(serviceName);
        ApplicationDescriptor applicationDescriptor = DescriptorUtil.createApplicationDescriptor(descriptor);
        applicationDescriptor.setHostdescName(hostName);
        ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
        applicationDescriptor.setServiceDescriptor(serviceDescriptor);
View Full Code Here

    }

    public void updateApplicationDescriptor(String serviceName,
                                            String hostName,
                                            ApplicationDescription descriptor) {
        ServiceDescription serviceDescription = getServiceDescriptor(serviceName);
        ApplicationDescriptor applicationDescriptor = DescriptorUtil.createApplicationDescriptor(descriptor);
        applicationDescriptor.setHostdescName(hostName);
        ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
        applicationDescriptor.setServiceDescriptor(serviceDescriptor);
View Full Code Here

  protected abstract ApplicationDescription getApplicationDesc(
      JobTypeType jobType);

  protected ServiceDescription getServiceDesc(String serviceName) {
    ServiceDescription serv = new ServiceDescription();
    serv.getType().setName(serviceName);
    return serv;
  }
View Full Code Here

        inputParameters.add(descriptorBuilder.buildInputParameterType("data2", "data2", DataType.STRING));

        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
        outputParameters.add(descriptorBuilder.buildOutputParameterType("out", "out", DataType.STD_OUT));

        ServiceDescription serviceDescription = descriptorBuilder.buildServiceDescription("comma_app", "comma_app",
                inputParameters, outputParameters);
       
        ServiceDescription serviceDescription2 = descriptorBuilder.buildServiceDescription("echo_app", "echo_app",
                inputParameters, outputParameters);

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

        // Deployment descriptor
        File executable = getFile("src/test/resources/comma_data.sh");
        Runtime.getRuntime().exec("chmod +x "+executable.getAbsolutePath());
    ApplicationDescription applicationDeploymentDescription = descriptorBuilder
                .buildApplicationDeploymentDescription("comma_app_localhost", executable.getAbsolutePath(), "/tmp");
    ApplicationDescription applicationDeploymentDescription2 = descriptorBuilder
                .buildApplicationDeploymentDescription("echo_app_localhost", "/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()));
       
        airavataAPI.getApplicationManager().addApplicationDescription(serviceDescription2, hostDescription,
                applicationDeploymentDescription2);

        Assert.assertTrue(airavataAPI.getApplicationManager().isApplicationDescriptorExists(
                serviceDescription2.getType().getName(), hostDescription.getType().getHostName(),
                applicationDeploymentDescription2.getType().getApplicationName().getStringValue()));
  }
View Full Code Here

    }

    public static ServiceDescription getServiceDescription(String serviceName, String inputName, String inputType,
                                                           String outputName, String outputType) {
        // Create Service Description
        ServiceDescription serv = new ServiceDescription();
        serv.getType().setName(serviceName);

        InputParameterType input = InputParameterType.Factory.newInstance();
        input.setParameterName(inputName);
        ParameterType parameterType = input.addNewParameterType();
        parameterType.setType(DataType.Enum.forString(inputType));
        parameterType.setName(inputName);
        List<InputParameterType> inputList = new ArrayList<InputParameterType>();
        inputList.add(input);
        InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
                .size()]);

        OutputParameterType output = OutputParameterType.Factory.newInstance();
        output.setParameterName(outputName);
        ParameterType parameterType1 = output.addNewParameterType();
        parameterType1.setType(DataType.Enum.forString(outputType));
        parameterType1.setName(outputName);
        List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
        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

        return hostDescription;
    }

    public static ServiceDescription createServiceDescription (ServiceDescriptor serviceDescriptor){
        ServiceDescription serviceDescription = new ServiceDescription();
        serviceDescription.getType().setName(serviceDescriptor.getServiceName());
        serviceDescription.getType().setDescription(serviceDescriptor.getDescription());
        List<ServiceParameters> inputParams = serviceDescriptor.getInputParams();
        InputParameterType[] inputParameterTypeArray = new InputParameterType[inputParams.size()];
        for (int i = 0; i < inputParams.size(); i++){
            InputParameterType parameter = InputParameterType.Factory.newInstance();
            parameter.setParameterName(inputParams.get(i).getName());
            parameter.setParameterValueArray(new String[]{inputParams.get(i).getName()});
            ParameterType parameterType = parameter.addNewParameterType();
            parameterType.setType(DataType.Enum.forString(inputParams.get(i).getType()));
            parameterType.setName(inputParams.get(i).getType());
            parameter.setParameterType(parameterType);
            inputParameterTypeArray[i] = parameter;
        }
        serviceDescription.getType().setInputParametersArray(inputParameterTypeArray);

        List<ServiceParameters> outputParams = serviceDescriptor.getOutputParams();
        OutputParameterType[] outputParameterTypeArray = new OutputParameterType[outputParams.size()];
        for (int i = 0; i < outputParams.size(); i++){
            OutputParameterType parameter = OutputParameterType.Factory.newInstance();
            parameter.setParameterName(outputParams.get(i).getName());
            ParameterType parameterType = parameter.addNewParameterType();
            parameterType.setType(DataType.Enum.forString(outputParams.get(i).getType()));
            parameterType.setName(outputParams.get(i).getType());
            parameter.setParameterType(parameterType);
            outputParameterTypeArray[i] = parameter;
        }
        serviceDescription.getType().setOutputParametersArray(outputParameterTypeArray);
        return serviceDescription;
    }
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.