airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1408798 [7/7] - in /airavata/trunk/modules/airavata-rest-services: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/airavata/ src/main/java/org/apache/airavata/services/ src/main/java/o...
Date Tue, 13 Nov 2012 15:52:19 GMT
Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,234 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.services.registry.rest.resources;
+
+import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.exception.worker.UserWorkflowAlreadyExistsException;
+import org.apache.airavata.registry.api.exception.worker.UserWorkflowDoesNotExistsException;
+import org.apache.airavata.services.registry.rest.resourcemappings.Workflow;
+import org.apache.airavata.services.registry.rest.resourcemappings.WorkflowList;
+import org.apache.airavata.services.registry.rest.utils.ResourcePathConstants;
+import org.apache.airavata.services.registry.rest.utils.RestServicesConstants;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.*;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * This class is a REST interface to all the operations related to user workflows that has been
+ * exposed by Airavata Registry API
+ */
+@Path(ResourcePathConstants.UserWFConstants.REGISTRY_API_USERWFREGISTRY)
+public class UserWorkflowRegistryResource {
+    private AiravataRegistry2 airavataRegistry;
+
+    @Context
+    ServletContext context;
+
+    /**---------------------------------User Workflow Registry----------------------------------**/
+
+    /**
+     * This method will check whether a given user workflow name already exists
+     * @param workflowName workflow name
+     * @return HTTP response
+     */
+    @GET
+    @Path(ResourcePathConstants.UserWFConstants.WORKFLOW_EXIST)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response isWorkflowExists(@QueryParam("workflowName") String workflowName){
+        airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            boolean workflowExists = airavataRegistry.isWorkflowExists(workflowName);
+            if (workflowExists){
+                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+                builder.entity("User workflow exists...");
+                return builder.build();
+            }else {
+                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+                builder.entity("User workflow does not exists...");
+                return builder.build();
+            }
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+    }
+
+    /**
+     * This method will add a new workflow
+     * @param workflowName workflow name
+     * @param workflowGraphXml workflow content
+     * @return HTTP response
+     */
+    @POST
+    @Path(ResourcePathConstants.UserWFConstants.ADD_WORKFLOW)
+    @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response addWorkflow(@FormParam("workflowName") String workflowName,
+                                @FormParam("workflowGraphXml") String workflowGraphXml) {
+        airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            airavataRegistry.addWorkflow(workflowName, workflowGraphXml);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("Workflow added successfully...");
+            return builder.build();
+        } catch (UserWorkflowAlreadyExistsException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+    }
+
+    /**
+     * This method will update the workflow
+     * @param workflowName workflow name
+     * @param workflowGraphXml workflow content
+     * @return HTTP response
+     */
+    @POST
+    @Path(ResourcePathConstants.UserWFConstants.UPDATE_WORKFLOW)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response updateWorkflow(@FormParam("workflowName") String workflowName,
+                                   @FormParam("workflowGraphXml") String workflowGraphXml){
+        airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            airavataRegistry.updateWorkflow(workflowName, workflowGraphXml);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("Workflow updated successfully...");
+            return builder.build();
+        } catch (UserWorkflowAlreadyExistsException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+    }
+
+    /**
+     * This method will return the content of the given workflow
+     * @param workflowName workflow name
+     * @return HTTP response
+     */
+    @GET
+    @Path(ResourcePathConstants.UserWFConstants.GET_WORKFLOWGRAPH)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response getWorkflowGraphXML(@QueryParam("workflowName") String workflowName) {
+        airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            String workflowGraphXML = airavataRegistry.getWorkflowGraphXML(workflowName);
+            if (workflowGraphXML != null){
+                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+                builder.entity(workflowGraphXML);
+                return builder.build();
+            }else {
+                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+                builder.entity("Could not get workflow graph...");
+                return builder.build();
+            }
+        } catch (UserWorkflowDoesNotExistsException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+    }
+
+    /**
+     * This method will return all the user workflows
+     * @return HTTP response
+     */
+    @GET
+    @Path(ResourcePathConstants.UserWFConstants.GET_WORKFLOWS)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response getWorkflows()  {
+        airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            Map<String, String> workflows = airavataRegistry.getWorkflows();
+            WorkflowList workflowList = new WorkflowList();
+            List<Workflow> workflowsModels = new ArrayList<Workflow>();
+            for (String workflowName : workflows.keySet()){
+                Workflow workflow = new Workflow();
+                workflow.setWorkflowName(workflowName);
+                workflow.setWorkflowGraph(workflows.get(workflowName));
+                workflowsModels.add(workflow);
+            }
+            workflowList.setWorkflowList(workflowsModels);
+            if(workflows.size() != 0 ){
+                Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+                builder.entity(workflowList);
+                return builder.build();
+            } else {
+                Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+                builder.entity("User workflows do not exists...");
+                return builder.build();
+            }
+
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+    }
+
+    /**
+     * This method will delete a user workflow with the given user workflow name
+     * @param workflowName user workflow name
+     * @return HTTP response
+     */
+    @GET
+    @Path(ResourcePathConstants.UserWFConstants.REMOVE_WORKFLOW)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response removeWorkflow(@QueryParam("workflowName") String workflowName) {
+        airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+        try{
+            airavataRegistry.removeWorkflow(workflowName);
+            Response.ResponseBuilder builder = Response.status(Response.Status.OK);
+            builder.entity("Workflow removed successfully...");
+            return builder.build();
+        } catch (UserWorkflowDoesNotExistsException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        } catch (RegistryException e) {
+            Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+            builder.entity(e.getMessage());
+            return builder.build();
+        }
+    }
+}

Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ApplicationDescriptorTypes.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ApplicationDescriptorTypes.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ApplicationDescriptorTypes.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ApplicationDescriptorTypes.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,29 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.services.registry.rest.utils;
+
+public class ApplicationDescriptorTypes {
+    public static final String APP_DEP_DESC_TYPE = "Default";
+    public static final String BATCH_APP_DEP_DESC_TYPE = "Batch";
+    public static final String GRAM_APP_DEP_DESC_TYPE = "Gram";
+    public static final String HADOOP_APP_DEP_DESC_TYPE = "Hadoop";
+}

Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,312 @@
+package org.apache.airavata.services.registry.rest.utils;
+
+import org.apache.airavata.commons.gfac.type.ApplicationDeploymentDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.schemas.gfac.*;
+import org.apache.airavata.schemas.gfac.impl.GramApplicationDeploymentTypeImpl;
+import org.apache.airavata.services.registry.rest.resourcemappings.ApplicationDescriptor;
+import org.apache.airavata.services.registry.rest.resourcemappings.HostDescriptor;
+import org.apache.airavata.services.registry.rest.resourcemappings.ServiceDescriptor;
+import org.apache.airavata.services.registry.rest.resourcemappings.ServiceParameters;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class DescriptorUtil {
+
+    public static HostDescription createHostDescription(String hostName, String hostAddress,
+                                                        String hostEndpoint, String gatekeeperEndpoint) {
+        HostDescription host = new HostDescription();
+        if("".equalsIgnoreCase(gatekeeperEndpoint) || "".equalsIgnoreCase(hostEndpoint)) {
+            host.getType().changeType(GlobusHostType.type);
+            host.getType().setHostName(hostName);
+            host.getType().setHostAddress(hostAddress);
+            ((GlobusHostType) host.getType()).
+                    setGridFTPEndPointArray(new String[]{hostEndpoint});
+            ((GlobusHostType) host.getType()).
+                    setGlobusGateKeeperEndPointArray(new String[]{gatekeeperEndpoint});
+        } else {
+            host.getType().setHostName(hostName);
+            host.getType().setHostAddress(hostAddress);
+        }
+        return host;
+    }
+
+    public static ApplicationDeploymentDescription registerApplication(String appName, String exeuctableLocation, String scratchWorkingDirectory, String hostName,
+                                                                       String projAccNumber, String queueName, String cpuCount, String nodeCount, String maxMemory) throws Exception {
+        // Create Application Description
+        ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
+        GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
+        app.setCpuCount(Integer.parseInt(cpuCount));
+        app.setNodeCount(Integer.parseInt(nodeCount));
+        ApplicationDeploymentDescriptionType.ApplicationName name = appDesc.getType().addNewApplicationName();
+        name.setStringValue(appName);
+        app.setExecutableLocation(exeuctableLocation);
+        app.setScratchWorkingDirectory(scratchWorkingDirectory);
+        ProjectAccountType projectAccountType = ((GramApplicationDeploymentType) appDesc.getType()).addNewProjectAccount();
+        projectAccountType.setProjectAccountNumber(projAccNumber);
+        QueueType queueType = app.addNewQueue();
+        queueType.setQueueName(queueName);
+        app.setMaxMemory(Integer.parseInt(maxMemory));
+        return appDesc;
+    }
+
+    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;
+    }
+
+
+    public static HostDescriptor createHostDescriptor (HostDescription hostDescription){
+        List<String> hostType = new ArrayList<String>();
+        List<String> gridFTPEndPoint = new ArrayList<String>();
+        List<String> globusGateKeeperEndPoint  = new ArrayList<String>();
+        List<String> imageID  = new ArrayList<String>();
+        List<String> instanceID  = new ArrayList<String>();
+
+        HostDescriptor hostDescriptor = new HostDescriptor();
+        hostDescriptor.setHostname(hostDescription.getType().getHostName());
+        hostDescriptor.setHostAddress(hostDescription.getType().getHostAddress());
+
+        HostDescriptionType hostDescriptionType = hostDescription.getType();
+        if (hostDescriptionType instanceof GlobusHostType){
+            GlobusHostType globusHostType = (GlobusHostType) hostDescriptionType;
+            hostType.add(HostTypes.GLOBUS_HOST_TYPE);
+            String[] globusGateKeeperEndPointArray = globusHostType.getGlobusGateKeeperEndPointArray();
+            for (int i = 0; i < globusGateKeeperEndPointArray.length ; i++){
+                globusGateKeeperEndPoint.add(globusGateKeeperEndPointArray[i]);
+            }
+
+            String[] gridFTPEndPointArray = globusHostType.getGridFTPEndPointArray();
+            for (int i = 0; i < gridFTPEndPointArray.length ; i++){
+                gridFTPEndPoint.add(globusGateKeeperEndPointArray[i]);
+            }
+
+        }else if (hostDescriptionType instanceof GsisshHostType){
+            GsisshHostType gsisshHostType = (GsisshHostType) hostDescriptionType;
+            hostType.add(HostTypes.GSISSH_HOST_TYPE);
+
+            String[] gridFTPEndPointArray = gsisshHostType.getGridFTPEndPointArray();
+            for (int i = 0; i < gridFTPEndPointArray.length ; i++){
+                gridFTPEndPoint.add(gridFTPEndPointArray[i]);
+            }
+        }  else if (hostDescriptionType instanceof  Ec2HostType) {
+            Ec2HostType ec2HostType = (Ec2HostType) hostDescriptionType;
+            hostType.add(HostTypes.EC2_HOST_TYPE);
+
+            String[] imageIDArray = ec2HostType.getImageIDArray();
+            for (int i = 0; i < imageIDArray.length ; i++){
+                imageID.add(imageIDArray[i]);
+            }
+
+            String[] instanceIDArray = ec2HostType.getInstanceIDArray();
+            for (int i = 0; i < instanceIDArray.length ; i++){
+                instanceID.add(instanceIDArray[i]);
+            }
+        } else {
+            hostType.add(HostTypes.HOST_DESCRIPTION_TYPE);
+        }
+        hostDescriptor.setGlobusGateKeeperEndPoint(globusGateKeeperEndPoint);
+        hostDescriptor.setGridFTPEndPoint(gridFTPEndPoint);
+        hostDescriptor.setImageID(imageID);
+        hostDescriptor.setInstanceID(instanceID);
+        hostDescriptor.setHostType(hostType);
+        return hostDescriptor;
+    }
+
+    public static HostDescription createHostDescription (HostDescriptor hostDescriptor){
+        HostDescription hostDescription = new HostDescription();
+        hostDescription.getType().setHostAddress(hostDescriptor.getHostAddress());
+        hostDescription.getType().setHostName(hostDescriptor.getHostname());
+
+        if (hostDescriptor.getHostType() != null && !hostDescriptor.getHostType().isEmpty()) {
+            if (hostDescriptor.getHostType().equals(HostTypes.GLOBUS_HOST_TYPE)) {
+                ((GlobusHostType) hostDescription.getType()).addGlobusGateKeeperEndPoint(hostDescriptor.getGlobusGateKeeperEndPoint().get(0));
+                ((GlobusHostType) hostDescription.getType()).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
+            } else if (hostDescriptor.getHostType().equals(HostTypes.GSISSH_HOST_TYPE)) {
+                ((GsisshHostType) hostDescription).addGridFTPEndPoint(hostDescriptor.getGridFTPEndPoint().get(0));
+            } else if (hostDescriptor.getHostType().equals(HostTypes.EC2_HOST_TYPE)) {
+                ((Ec2HostType) hostDescription).addImageID(hostDescriptor.getImageID().get(0));
+                ((Ec2HostType) hostDescription).addInstanceID(hostDescriptor.getInstanceID().get(0));
+            }
+        }
+
+        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;
+    }
+
+    public static ServiceDescriptor createServiceDescriptor(ServiceDescription serviceDescription){
+        ServiceDescriptor serviceDescriptor = new ServiceDescriptor();
+        serviceDescriptor.setServiceName(serviceDescription.getType().getName());
+        serviceDescriptor.setDescription(serviceDescription.getType().getDescription());
+        InputParameterType[] inputParametersArray = serviceDescription.getType().getInputParametersArray();
+        OutputParameterType[] outputParametersArray = serviceDescription.getType().getOutputParametersArray();
+        List<ServiceParameters> inputParams = new ArrayList<ServiceParameters>();
+        List<ServiceParameters> outputParams = new ArrayList<ServiceParameters>();
+
+        for (int i = 0; i < inputParametersArray.length; i++){
+            ServiceParameters serviceParameters = new ServiceParameters();
+            serviceParameters.setType(inputParametersArray[i].getParameterType().getType().toString());
+//            String[] parameterValueArray = inputParametersArray[i].getParameterValueArray();
+//            if (parameterValueArray.length != 0){
+//                serviceParameters.setName(parameterValueArray[0]);
+//            }
+            serviceParameters.setName(inputParametersArray[i].getParameterName());
+            serviceParameters.setDescription(inputParametersArray[i].getParameterDescription());
+//            serviceParameters.set(inputParametersArray[i].getParameterType().getType().toString());
+            inputParams.add(serviceParameters);
+        }
+        serviceDescriptor.setInputParams(inputParams);
+
+        for (int i = 0; i < outputParametersArray.length; i++){
+            ServiceParameters serviceParameters = new ServiceParameters();
+            serviceParameters.setType(outputParametersArray[i].getParameterType().getType().toString());
+            serviceParameters.setName(outputParametersArray[i].getParameterName());
+            serviceParameters.setDescription(outputParametersArray[i].getParameterDescription());
+//            serviceParameters.setDataType(outputParametersArray[i].getParameterType().getType().toString());
+            outputParams.add(serviceParameters);
+        }
+        serviceDescriptor.setOutputParams(outputParams);
+        return serviceDescriptor;
+    }
+
+    public static ApplicationDeploymentDescription createApplicationDescription(ApplicationDescriptor applicationDescriptor){
+        ApplicationDeploymentDescription applicationDeploymentDescription = new ApplicationDeploymentDescription();
+        ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance();
+        name.setStringValue(applicationDescriptor.getName());
+        applicationDeploymentDescription.getType().setApplicationName(name);
+        applicationDeploymentDescription.getType().setExecutableLocation(applicationDescriptor.getExecutablePath());
+        applicationDeploymentDescription.getType().setOutputDataDirectory(applicationDescriptor.getWorkingDir());
+
+        //set advanced options according app desc type
+        if(applicationDescriptor.getApplicationDescType() != null && !applicationDescriptor.getApplicationDescType().isEmpty()){
+            if (applicationDescriptor.getApplicationDescType().equals(ApplicationDescriptorTypes.GRAM_APP_DEP_DESC_TYPE)){
+                ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(GramApplicationDeploymentType.type);
+                appDesc.getType().setApplicationName(name);
+                appDesc.getType().setExecutableLocation(applicationDescriptor.getExecutablePath());
+                appDesc.getType().setOutputDataDirectory(applicationDescriptor.getWorkingDir());
+                GramApplicationDeploymentType app = (GramApplicationDeploymentType) appDesc.getType();
+                app.setCpuCount(applicationDescriptor.getCpuCount());
+                app.setJobType(JobTypeType.Enum.forString(applicationDescriptor.getJobType()));
+                app.setMaxMemory(applicationDescriptor.getMaxMemory());
+                app.setMinMemory(applicationDescriptor.getMinMemory());
+                app.setMaxWallTime(applicationDescriptor.getMaxWallTime());
+                app.setNodeCount(applicationDescriptor.getNodeCount());
+                app.setProcessorsPerNode(applicationDescriptor.getProcessorsPerNode());
+                return appDesc;
+            } else if (applicationDescriptor.getApplicationDescType().equals(ApplicationDescriptorTypes.BATCH_APP_DEP_DESC_TYPE)){
+                ApplicationDeploymentDescription appDesc = new ApplicationDeploymentDescription(BatchApplicationDeploymentDescriptionType.type);
+                appDesc.getType().setApplicationName(name);
+                appDesc.getType().setExecutableLocation(applicationDescriptor.getExecutablePath());
+                appDesc.getType().setOutputDataDirectory(applicationDescriptor.getWorkingDir());
+                BatchApplicationDeploymentDescriptionType applicationDeploymentType = (BatchApplicationDeploymentDescriptionType) appDesc.getType();
+                applicationDeploymentType.setCpuCount(applicationDescriptor.getCpuCount());
+                applicationDeploymentType.setJobType(JobTypeType.Enum.forString(applicationDescriptor.getJobType()));
+                applicationDeploymentType.setMaxMemory(applicationDescriptor.getMaxMemory());
+                applicationDeploymentType.setMinMemory(applicationDescriptor.getMinMemory());
+                applicationDeploymentType.setMaxWallTime(applicationDescriptor.getMaxWallTime());
+                applicationDeploymentType.setNodeCount(applicationDescriptor.getNodeCount());
+                applicationDeploymentType.setProcessorsPerNode(applicationDescriptor.getProcessorsPerNode());
+                return appDesc;
+            }
+        }
+        return applicationDeploymentDescription;
+    }
+
+    public static ApplicationDescriptor createApplicationDescriptor (ApplicationDeploymentDescription applicationDeploymentDescription){
+        ApplicationDescriptor applicationDescriptor = new ApplicationDescriptor();
+        applicationDescriptor.setName(applicationDeploymentDescription.getType().getApplicationName().getStringValue());
+        applicationDescriptor.setExecutablePath(applicationDeploymentDescription.getType().getExecutableLocation());
+        applicationDescriptor.setWorkingDir(applicationDeploymentDescription.getType().getOutputDataDirectory());
+        if(applicationDeploymentDescription.getType() != null){
+            if(applicationDeploymentDescription.getType() instanceof GramApplicationDeploymentType){
+                GramApplicationDeploymentType gramApplicationDeploymentType = (GramApplicationDeploymentType)applicationDeploymentDescription.getType();
+                if(gramApplicationDeploymentType != null){
+                    applicationDescriptor.setCpuCount(gramApplicationDeploymentType.getCpuCount());
+                    applicationDescriptor.setNodeCount(gramApplicationDeploymentType.getNodeCount());
+                    applicationDescriptor.setMaxMemory(gramApplicationDeploymentType.getMaxMemory());
+                    applicationDescriptor.setMinMemory(gramApplicationDeploymentType.getMinMemory());
+                    applicationDescriptor.setMaxWallTime(gramApplicationDeploymentType.getMaxWallTime());
+                    if(gramApplicationDeploymentType.getQueue() != null){
+                        applicationDescriptor.setQueueName(gramApplicationDeploymentType.getQueue().getQueueName());
+                    }
+                }
+            } else if (applicationDeploymentDescription.getType() instanceof BatchApplicationDeploymentDescriptionType){
+                BatchApplicationDeploymentDescriptionType batchApplicationDeploymentDescriptionType = (BatchApplicationDeploymentDescriptionType)applicationDeploymentDescription.getType();
+                if (batchApplicationDeploymentDescriptionType != null){
+                    applicationDescriptor.setCpuCount(batchApplicationDeploymentDescriptionType.getCpuCount());
+                    applicationDescriptor.setNodeCount(batchApplicationDeploymentDescriptionType.getNodeCount());
+                    applicationDescriptor.setMaxMemory(batchApplicationDeploymentDescriptionType.getMaxMemory());
+                    applicationDescriptor.setMinMemory(batchApplicationDeploymentDescriptionType.getMinMemory());
+                    applicationDescriptor.setMaxWallTime(batchApplicationDeploymentDescriptionType.getMaxWallTime());
+                    if (batchApplicationDeploymentDescriptionType.getQueue() != null){
+                        applicationDescriptor.setQueueName(batchApplicationDeploymentDescriptionType.getQueue().getQueueName());
+                    }
+
+                }
+
+            }
+        }
+
+        return applicationDescriptor;
+    }
+
+}

Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/HostTypes.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/HostTypes.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/HostTypes.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/HostTypes.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,30 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.services.registry.rest.utils;
+
+public class HostTypes {
+    public static final String GLOBUS_HOST_TYPE = "GlobusHostType";
+    public static final String GSISSH_HOST_TYPE = "GsisshHostType";
+    public static final String EC2_HOST_TYPE = "Ec2HostType";
+    public static final String HOST_DESCRIPTION_TYPE = "HostDescriptionType";
+
+}

Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,54 @@
+package org.apache.airavata.services.registry.rest.utils;
+
+import org.apache.airavata.registry.api.AiravataRegistry2;
+import org.apache.airavata.registry.api.AiravataRegistryFactory;
+import org.apache.airavata.registry.api.AiravataUser;
+import org.apache.airavata.registry.api.Gateway;
+
+//import org.apache.airavata.client.AiravataClient;
+//import org.apache.airavata.client.AiravataClientUtils;
+//import org.apache.airavata.client.api.AiravataAPI;
+
+import javax.servlet.ServletContext;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+public class RegistryListener implements ServletContextListener {
+    private static AiravataRegistry2 airavataRegistry;
+
+    public void contextInitialized(ServletContextEvent servletContextEvent) {
+        try {
+            ServletContext servletContext = servletContextEvent.getServletContext();
+
+            URL url = this.getClass().getClassLoader().
+                    getResource(RestServicesConstants.AIRAVATA_SERVER_PROPERTIES);
+            Properties properties = new Properties();
+            try {
+                properties.load(url.openStream());
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+            String gatewayID = properties.getProperty(RestServicesConstants.GATEWAY_ID);
+            String registryUser = properties.getProperty(RestServicesConstants.REGISTRY_USERNAME);
+            Gateway gateway =  new Gateway(gatewayID);
+            AiravataUser airavataUser = new AiravataUser(registryUser) ;
+
+            airavataRegistry = AiravataRegistryFactory.getRegistry(gateway, airavataUser);
+            servletContext.setAttribute(RestServicesConstants.AIRAVATA_REGISTRY, airavataRegistry);
+            servletContext.setAttribute(RestServicesConstants.GATEWAY, gateway);
+            servletContext.setAttribute(RestServicesConstants.REGISTRY_USER, airavataUser);
+
+//            AiravataAPI airavataAPI = AiravataClientUtils.getAPI(url.getPath());
+//            servletContext.setAttribute(RestServicesConstants.AIRAVATA_API, airavataAPI);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void contextDestroyed(ServletContextEvent servletContextEvent) {
+
+    }
+}

Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,168 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.airavata.services.registry.rest.utils;
+
+public class ResourcePathConstants {
+
+
+    public final class ConfigResourcePathConstants {
+        public static final String CONFIGURATION_REGISTRY_RESOURCE = "/registry/api/congfigregistry/";
+        public static final String GET_CONFIGURATION = "get/configuration";
+        public static final String GET_CONFIGURATION_LIST = "get/configurationlist";
+        public static final String SAVE_CONFIGURATION = "save/configuration";
+        public static final String UPDATE_CONFIGURATION = "update/configuration";
+        public static final String DELETE_ALL_CONFIGURATION = "delete/allconfiguration";
+        public static final String DELETE_CONFIGURATION ="delete/configuration";
+        public static final String GET_GFAC_URI_LIST = "get/gfac/urilist";
+        public static final String GET_WFINTERPRETER_URI_LIST = "get/workflowinterpreter/urilist";
+        public static final String GET_EVENTING_URI = "get/eventingservice/uri";
+        public static final String GET_MESSAGE_BOX_URI = "get/messagebox/uri";
+        public static final String ADD_GFAC_URI = "add/gfacuri";
+        public static final String ADD_WFINTERPRETER_URI = "add/workflowinterpreteruri";
+        public static final String ADD_EVENTING_URI = "add/eventinguri";
+        public static final String ADD_MESSAGE_BOX_URI = "add/msgboxuri";
+        public static final String ADD_GFAC_URI_DATE = "add/gfacuri/date";
+        public static final String ADD_WFINTERPRETER_URI_DATE = "add/workflowinterpreteruri/date";
+        public static final String ADD_EVENTING_URI_DATE = "add/eventinguri/date";
+        public static final String ADD_MSG_BOX_URI_DATE = "add/msgboxuri/date";
+        public static final String DELETE_GFAC_URI = "delete/gfacuri";
+        public static final String DELETE_ALL_GFAC_URIS = "delete/allgfacuris";
+        public static final String DELETE_WFINTERPRETER_URI = "delete/workflowinterpreteruri";
+        public static final String DELETE_ALL_WFINTERPRETER_URIS = "delete/allworkflowinterpreteruris";
+        public static final String DELETE_EVENTING_URI = "delete/eventinguri";
+        public static final String DELETE_MSG_BOX_URI = "delete/msgboxuri";
+    }
+
+    public final class DecResourcePathConstants {
+        public static final String DESC_RESOURCE_PATH = "/registry/api/descriptors/";
+        public static final String HOST_DESC_EXISTS = "hostdescriptor/exist";
+        public static final String HOST_DESC_SAVE = "hostdescriptor/save";
+        public static final String HOST_DESC_UPDATE = "hostdescriptor/update";
+        public static final String HOST_DESC = "host/description";
+        public static final String HOST_DESC_DELETE = "hostdescriptor/delete";
+        public static final String GET_HOST_DESCS = "get/hostdescriptors";
+        public static final String GET_HOST_DESCS_NAMES = "get/hostdescriptor/names";
+        public static final String SERVICE_DESC_EXISTS = "servicedescriptor/exist";
+        public static final String SERVICE_DESC_SAVE = "servicedescriptor/save";
+        public static final String SERVICE_DESC_UPDATE = "servicedescriptor/update";
+        public static final String SERVICE_DESC = "servicedescriptor/description";
+        public static final String SERVICE_DESC_DELETE = "servicedescriptor/delete";
+        public static final String GET_SERVICE_DESCS = "get/servicedescriptors";
+        public static final String APPL_DESC_EXIST = "applicationdescriptor/exist";
+        public static final String APP_DESC_BUILD_SAVE = "applicationdescriptor/build/save";
+        public static final String APP_DESC_UPDATE = "applicationdescriptor/update";
+        public static final String APP_DESC_DESCRIPTION = "applicationdescriptor/description";
+        public static final String APP_DESC_PER_HOST_SERVICE = "applicationdescriptors/alldescriptors/host/service";
+        public static final String APP_DESC_ALL_DESCS_SERVICE = "applicationdescriptor/alldescriptors/service";
+        public static final String APP_DESC_ALL_DESCRIPTORS = "applicationdescriptor/alldescriptors";
+        public static final String APP_DESC_NAMES = "applicationdescriptor/names";
+        public static final String APP_DESC_DELETE = "applicationdescriptor/delete";
+    }
+
+    public final class ExperimentResourcePathConstants {
+        public static final String EXP_RESOURCE_PATH  =  "/registry/api/experimentregistry/";
+        public static final String DELETE_EXP = "delete/experiment";
+        public static final String GET_ALL_EXPS = "get/experiments/all" ;
+        public static final String GET_EXPS_BY_PROJECT = "get/experiments/project" ;
+        public static final String GET_EXPS_BY_DATE =  "get/experiments/date";
+        public static final String GET_EXPS_PER_PROJECT_BY_DATE = "get/experiments/project/date";
+        public static final String ADD_EXP = "add/experiment" ;
+        public static final String EXP_EXISTS = "experiment/exist" ;
+        public static final String EXP_EXISTS_CREATE = "experiment/notexist/create" ;
+    }
+
+    public final class ProjectResourcePathConstants {
+        public static final String REGISTRY_API_PROJECTREGISTRY = "/registry/api/projectregistry/";
+        public static final String PROJECT_EXIST = "project/exist";
+        public static final String PROJECT_EXIST_CREATE = "project/exist";
+        public static final String ADD_PROJECT = "add/project";
+        public static final String UPDATE_PROJECT = "update/project";
+        public static final String DELETE_PROJECT = "delete/project";
+        public static final String GET_PROJECT = "get/project";
+        public static final String GET_PROJECTS = "get/projects";
+    }
+
+    public final class ProvenanceResourcePathConstants {
+
+        public static final String REGISTRY_API_PROVENANCEREGISTRY = "/registry/api/provenanceregistry/";
+        public static final String UPDATE_EXPERIMENT_EXECUTIONUSER = "update/experiment/executionuser";
+        public static final String GET_EXPERIMENT_EXECUTIONUSER = "get/experiment/executionuser";
+        public static final String GET_EXPERIMENT_NAME = "get/experiment/name";
+        public static final String UPDATE_EXPERIMENTNAME = "update/experimentname";
+        public static final String GET_EXPERIMENTMETADATA = "get/experimentmetadata";
+        public static final String UPDATE_EXPERIMENTMETADATA = "update/experimentmetadata";
+        public static final String GET_WORKFLOWTEMPLATENAME = "get/workflowtemplatename";
+        public static final String UPDATE_WORKFLOWINSTANCETEMPLATENAME = "update/workflowinstancetemplatename";
+        public static final String GET_EXPERIMENTWORKFLOWINSTANCES = "get/experimentworkflowinstances";
+        public static final String WORKFLOWINSTANCE_EXIST_CHECK = "workflowinstance/exist/check";
+        public static final String WORKFLOWINSTANCE_EXIST_CREATE = "workflowinstance/exist/create";
+        public static final String UPDATE_WORKFLOWINSTANCESTATUS_INSTANCEID = "update/workflowinstancestatus/instanceid";
+        public static final String UPDATE_WORKFLOWINSTANCESTATUS = "update/workflowinstancestatus";
+        public static final String GET_WORKFLOWINSTANCESTATUS = "get/workflowinstancestatus";
+        public static final String UPDATE_WORKFLOWNODEINPUT = "update/workflownodeinput";
+        public static final String UPDATE_WORKFLOWNODEOUTPUT = "update/workflownodeoutput";
+        public static final String GET_EXPERIMENT = "get/experiment";
+        public static final String GET_EXPERIMENT_ID_USER = "get/experimentId/user";
+        public static final String GET_EXPERIMENT_USER = "get/experiment/user";
+        public static final String UPDATE_WORKFLOWNODE_STATUS = "update/workflownode/status";
+        public static final String GET_WORKFLOWNODE_STATUS = "get/workflownode/status";
+        public static final String GET_WORKFLOWNODE_STARTTIME = "get/workflownode/starttime";
+        public static final String GET_WORKFLOW_STARTTIME = "get/workflow/starttime";
+        public static final String UPDATE_WORKFLOWNODE_GRAMDATA = "update/workflownode/gramdata";
+        public static final String GET_WORKFLOWINSTANCEDATA = "get/workflowinstancedata";
+        public static final String WORKFLOWINSTANCE_NODE_EXIST = "wfnode/exist";
+        public static final String WORKFLOWINSTANCE_NODE_EXIST_CREATE = "wfnode/exist/create";
+        public static final String WORKFLOWINSTANCE_NODE_DATA = "workflowinstance/nodeData";
+        public static final String ADD_WORKFLOWINSTANCE = "add/workflowinstance";
+        public static final String UPDATE_WORKFLOWNODETYPE = "update/workflownodetype";
+        public static final String ADD_WORKFLOWINSTANCENODE = "add/workflowinstancenode";
+        public static final String EXPERIMENTNAME_EXISTS = "experimentname/exists";
+
+        public static final String GET_EXPERIMENT_METAINFORMATION = "get/experiment/metainformation";
+        public static final String GET_ALL_EXPERIMENT_METAINFORMATION = "get/all/experiment/metainformation";
+        public static final String SEARCH_EXPERIMENTS = "search/experiments";
+    }
+
+    public final class PublishedWFConstants {
+
+        public static final String REGISTRY_API_PUBLISHWFREGISTRY = "/registry/api/publishwfregistry/";
+        public static final String PUBLISHWF_EXIST = "publishwf/exist";
+        public static final String PUBLISH_WORKFLOW = "publish/workflow";
+        public static final String PUBLISH_DEFAULT_WORKFLOW = "publish/default/workflow";
+        public static final String GET_PUBLISHWORKFLOWGRAPH = "get/publishworkflowgraph";
+        public static final String GET_PUBLISHWORKFLOWNAMES = "get/publishworkflownames";
+        public static final String GET_PUBLISHWORKFLOWS = "get/publishworkflows";
+        public static final String REMOVE_PUBLISHWORKFLOW = "remove/publishworkflow";
+    }
+
+    public final class UserWFConstants {
+
+        public static final String REGISTRY_API_USERWFREGISTRY = "/registry/api/userwfregistry/";
+        public static final String WORKFLOW_EXIST = "workflow/exist";
+        public static final String ADD_WORKFLOW = "add/workflow";
+        public static final String UPDATE_WORKFLOW = "update/workflow";
+        public static final String GET_WORKFLOWGRAPH = "get/workflowgraph";
+        public static final String GET_WORKFLOWS = "get/workflows";
+        public static final String REMOVE_WORKFLOW = "remove/workflow";
+    }
+
+    }

Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RestServicesConstants.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RestServicesConstants.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RestServicesConstants.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RestServicesConstants.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,11 @@
+package org.apache.airavata.services.registry.rest.utils;
+
+public class RestServicesConstants {
+    public static final String AIRAVATA_SERVER_PROPERTIES = "airavata-server.properties";
+    public static final String GATEWAY_ID = "gateway.id";
+    public static final String GATEWAY = "gateway";
+    public static final String REGISTRY_USERNAME = "registry.user";
+    public static final String REGISTRY_USER = "airavata.user";
+    public static final String AIRAVATA_REGISTRY = "airavataRegistry";
+    public static final String AIRAVATA_API = "airavataAPI";
+}

Added: airavata/trunk/modules/airavata-rest-services/src/main/resources/airavata-server.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/resources/airavata-server.properties?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/resources/airavata-server.properties (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/resources/airavata-server.properties Tue Nov 13 15:52:16 2012
@@ -0,0 +1,198 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+###########################################################################
+#
+#  This properties file provides configuration for all Airavata Services: 
+#  Registry, Workflow Interpreter, GFac, Message Broker, Message Box
+#
+###########################################################################
+
+###########################################################################
+# Airavata Axis2-Tomcat Server Configuration
+###########################################################################
+# By default, tomcat runs on port 80. If the port is changed, it will be  
+#  have to be specified with port properties. This will be picked up by 
+#  the registry service to register the service end-points.
+
+port=8080
+
+# Axis2 server automatically picks up IP address from axis configuration, 
+#  but some DHCP enables machines do not report correct ip addresses,  
+#  in which case, the IP address can be manually specified. 
+
+#ip=192.2.33.12 
+
+###########################################################################
+# Airavata Registry Configuration
+###########################################################################
+
+registry.user=admin
+registry.password=admin
+gateway.id=default
+registry.jdbc.user=airavata
+registry.jdbc.password=airavata
+start.derby.server.mode=true
+
+#for mysql
+registry.jdbc.driver=com.mysql.jdbc.Driver
+registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data
+
+#for derby
+#registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+#registry.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=airavata;password=airavata
+
+###########################################################################
+# Airavata Workflow Interpreter Configurations
+###########################################################################
+
+runInThread=false
+provenance=true
+provenanceWriterThreadPoolSize=20
+gfac.embedded=false
+
+#
+# Security Configuration used by Airavata Generic Factory Service
+#  to interact with Computational Resources.
+#
+
+###########################################################################
+# Airavata GFac MyProxy GSI credentials to access Grid Resources.
+###########################################################################
+
+myproxy.server=myproxy.teragrid.org
+myproxy.user=username
+myproxy.pass=password
+myproxy.life=3600
+# XSEDE Trusted certificates can be downloaded from https://software.xsede.org/security/xsede-certs.tar.gz
+trusted.cert.location=/path/to/trusted/certificates
+
+# SSH PKI key pair is SSH based authentication is used.
+#ssh.key=/home/user/.ssh/id_rsa
+#ssh.keypass=
+#ssh.username=usernameAtHost
+
+###########################################################################
+# Airavata Message Broker Basic Configurations.
+#  the Advanced section provides detailed custom configuration properties.
+###########################################################################
+
+# Default derby database configuration
+broker.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
+broker.jdbc.url=jdbc:derby:wsmg;create=true;user=airavata;password=airavata
+
+# Note: This database will only be used  if 'broker.storage.type=persistent' 
+#       is set in advanced properties below.
+# MySql database configuration
+#broker.jdbc.driver=com.mysql.jdbc.Driver
+#broker.jdbc.url=jdbc:mysql://localhost:3306/wsmg?user=airavata&password=airavata
+
+###########################################################################
+# Airavata Message Box Basic Configurations, 
+#  the Advanced section provides detailed custom configuration properties.
+###########################################################################  
+
+# Default derby database
+msgBox.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
+msgBox.jdbc.url=jdbc:derby:wsmg;create=true;user=airavata;password=airavata
+
+# MySql database configuration
+#msgBox.jdbc.driver=com.mysql.jdbc.Driver
+#msgBox.jdbc.url=jdbc:mysql://localhost:3306/wsmg?user=airavata&password=airavata
+
+###########################################################################
+# Advance configuration to change service implementations
+###########################################################################
+
+# By default all provenance data is also cataloged in Airavata Registry. 
+# A custom provenance implementation can be plugged in for Provenance Registry. 
+# The full qualified path to the implementation class has to be specified.
+# BY default a mysql JPA provenanceRegistry implementation is bundled.
+class.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+
+#
+# Class which implemented Scheduler interface. It will be used to determine a Provider
+#
+scheduler.class= org.apache.airavata.core.gfac.scheduler.impl.SchedulerImpl
+
+#
+# Data Service Plugins classes
+#
+datachain.classes= org.apache.airavata.core.gfac.extension.data.RegistryDataService
+
+#
+# Pre execution Plugins classes. For example, GridFTP Input Staging
+#
+prechain.classes= org.apache.airavata.core.gfac.extension.pre.GridFtpInputStaging
+prechain.classes= org.apache.airavata.core.gfac.extension.pre.HttpInputStaging
+
+#
+# Post execution Plugins classes. For example, GridFTP Output Staging
+#
+postchain.classes= org.apache.airavata.core.gfac.extension.post.GridFtpOutputStaging
+postchain.classes= org.apache.airavata.core.gfac.extension.post.OutputRegister
+
+#
+# Advanced Message Broker Configurations
+#
+
+#socket time out in milliseconds for sending messages. (defaults is 20000)
+broker.socket.timeout=60000
+
+broker.storage.type=persistent
+#broker.storage.type=memory
+
+#specifies wether delivery component should be started or not.
+broker.start.delivery.thread=true
+
+#fixed thread pool based delivery
+#broker.delivery.method=pcrew
+
+#dynamic thread pool based delivery
+#broker.delivery.method=parallel
+
+#single thread delivery
+broker.delivery.method=serial
+
+#number of message delivery failures before a url become black listed (default is 2)
+#broker.msg.delivery.retries=2
+
+#time period (in seconds) a url will be kept blacklisted (default is 5 seconds) 
+#consumer.expiration.time.gap=5 
+
+#maximum number of messages to be send to a one consumer/url at time. 
+#applicable if 'broker.delivery.method' is 'pcrew' . (default is 10)
+
+#sending.batch.size=10
+
+#size of the thread pool. only applicable if 'broker.delivery.method' is 'pcrew'. (default is 4)
+#sending.thread.pool.size=4
+
+#
+# Advanced Message Box Configurations
+# 
+msgBox.usedatabase=true
+messagePreservationDays=2
+messagePreservationHours=0
+messagePreservationMinutes=0
+messagePerservationIntervalDays=0
+messagePerservationIntervalHours=1
+messagePerservationIntervalMinutes=0
+

Added: airavata/trunk/modules/airavata-rest-services/src/main/resources/log4j.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/resources/log4j.xml?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/resources/log4j.xml (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/resources/log4j.xml Tue Nov 13 15:52:16 2012
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+
+  $Id$
+-->
+<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+  <!-- Appenders -->
+  <appender name="console" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%-5p: %c - %m%n" />
+    </layout>
+  </appender>
+
+  <!-- Jersey logger -->
+  <logger name="com.sun.jersey">
+    <level value="info" />
+  </logger>
+
+  <!-- Airavata logger -->
+  <logger name="org.apache.airavata">
+    <level value="info" />
+  </logger>
+
+  <!-- Root Logger -->
+  <root>
+    <priority value="info" />
+    <appender-ref ref="console" />
+  </root>
+
+</log4j:configuration>
\ No newline at end of file

Added: airavata/trunk/modules/airavata-rest-services/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/webapp/WEB-INF/web.xml?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/webapp/WEB-INF/web.xml (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/webapp/WEB-INF/web.xml Tue Nov 13 15:52:16 2012
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- This web.xml file is not required when using Servlet 3.0 container,
+     see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html#d4e194 -->
+<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+    <listener>
+      <listener-class>org.apache.airavata.services.registry.rest.utils.RegistryListener</listener-class>
+    </listener>
+     <!--context-param>
+      <param-name>configFile</param-name>
+      <param-value>/WEB-INF/classes/service.properties</param-value>
+    </context-param-->
+    <servlet>
+        <servlet-name>Airavata Web Application</servlet-name>
+        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
+        <init-param>
+            <param-name>com.sun.jersey.config.property.packages</param-name>
+            <param-value>org.apache.airavata.services.registry.rest;org.codehaus.jackson.jaxrs</param-value>
+        </init-param>
+        <!--init-param>
+            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
+            <param-value>org.apache.airavata.services.registry.rest.security.AuthenticationFilter</param-value>
+        </init-param-->
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+    <servlet-mapping>
+        <servlet-name>Airavata Web Application</servlet-name>
+        <url-pattern>/*</url-pattern>
+    </servlet-mapping>
+</web-app>

Added: airavata/trunk/modules/airavata-rest-services/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/webapp/index.jsp?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/webapp/index.jsp (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/webapp/index.jsp Tue Nov 13 15:52:16 2012
@@ -0,0 +1,8 @@
+<html>
+<body>
+<h2>Jersey RESTful Web Application!</h2>
+<p><a href="webresources/myresource">Jersey resource</a>
+<p>Visit the <a href="http://jersey.java.net">Project Jersey website</a>
+for more information on Jersey!
+</body>
+</html>



Mime
View raw message