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

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


        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 (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

    public String getService() {
        return service;
    }

    public ServiceDescription getServiceDescription() throws AiravataAPIInvocationException {
        ServiceDescription desc = getAiravataAPI().getApplicationManager().getServiceDescription(getService());
        if(desc!=null){
          return desc;
        }
        throw new AiravataAPIInvocationException(new Exception("Service Description not found in registry."));
    }
View Full Code Here

            String hostName = null;
            if(contextHeader != null){
                hostName = contextHeader.getSoaServiceEprs().getHostDescriptor();
            }
            //todo This is the basic scheduling, have to do proper scheduling implementation
            ServiceDescription serviceDescription = airavataAPI.getApplicationManager().getServiceDescription(serviceName);
            HostDescription registeredHost = getRegisteredHost(airavataAPI, this.serviceName);
            // if user specify a host, no matter what we pick that host for all the nodes, todo: allow users to specifi node specific host
            if(hostName != null) {
                registeredHost = airavataAPI.getApplicationManager().getHostDescription(hostName);
            }
View Full Code Here

    }

    private OMElement getInParameters() 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

    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response addServiceDescriptor(ServiceDescriptor service) {
        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
        try {
            ServiceDescription serviceDescription = DescriptorUtil.createServiceDescription(service);
            airavataRegistry.addServiceDescriptor(serviceDescription);
            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
            builder.entity("Service descriptor saved successfully...");
            return builder.build();
        } catch (DescriptorAlreadyExistsException e) {
View Full Code Here

    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response updateServiceDescriptor(ServiceDescriptor service) {
        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
        try {
            ServiceDescription serviceDescription = DescriptorUtil.createServiceDescription(service);
            airavataRegistry.updateServiceDescriptor(serviceDescription);
            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
            builder.entity("Service descriptor updated successfully...");
            return builder.build();
        } catch (DescriptorAlreadyExistsException e) {
View Full Code Here

    @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response getServiceDescriptor(@QueryParam("serviceName") String serviceName) {
        AiravataRegistry2 airavataRegistry = RegPoolUtils.acquireRegistry(context);
        try {
            ServiceDescription serviceDescription = airavataRegistry.getServiceDescriptor(serviceName);
            if (serviceDescription != null) {
                ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
                builder.entity(serviceDescriptor);
                return builder.build();
View Full Code Here

        try {
            ApplicationDescription applicationDescription = airavataRegistry.getApplicationDescriptor(serviceName, hostName, applicationName);
            if (applicationDescription != null) {
                ApplicationDescriptor applicationDescriptor = DescriptorUtil.createApplicationDescriptor(applicationDescription);
                applicationDescriptor.setHostdescName(hostName);
                ServiceDescription serviceDescription = airavataRegistry.getServiceDescriptor(serviceName);
                ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
                applicationDescriptor.setServiceDescriptor(serviceDescriptor);

                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
                builder.entity(applicationDescriptor);
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.