airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1410008 [1/4] - in /airavata/trunk/modules/airavata-rest-client: ./ 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/rest/ src/main/java/org/apa...
Date Thu, 15 Nov 2012 21:00:43 GMT
Author: chathuri
Date: Thu Nov 15 21:00:39 2012
New Revision: 1410008

URL: http://svn.apache.org/viewvc?rev=1410008&view=rev
Log:
adding seperate module for REST client

Added:
    airavata/trunk/modules/airavata-rest-client/
    airavata/trunk/modules/airavata-rest-client/pom.xml
    airavata/trunk/modules/airavata-rest-client/src/
    airavata/trunk/modules/airavata-rest-client/src/main/
    airavata/trunk/modules/airavata-rest-client/src/main/java/
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/Test.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/AllRegistryResourceClients.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/DescriptorResourceClient.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/ExperimentResourceClient.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/ProjectResourceClient.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/ProvenanceResourceClient.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/PublishedWorkflowResourceClient.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/UserWorkflowResourceClient.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ApplicationDescriptor.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ApplicationDescriptorList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ConfigurationList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/DescriptorNameList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ExperimentDataList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ExperimentIDList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ExperimentList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/HostDescriptionList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/HostDescriptor.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/PublishWorkflowNamesList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ServiceDescriptionList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ServiceDescriptor.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/ServiceParameters.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/URLList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/Workflow.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/WorkflowInstancesList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/WorkflowList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/WorkflowNodeIODataList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/resourcemappings/WorkspaceProjectList.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/utils/
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/utils/ApplicationDescriptorTypes.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/utils/BasicAuthHeaderUtil.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/utils/DescriptorUtil.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/utils/HostTypes.java
    airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/utils/ResourcePathConstants.java

Added: airavata/trunk/modules/airavata-rest-client/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-client/pom.xml?rev=1410008&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-client/pom.xml (added)
+++ airavata/trunk/modules/airavata-rest-client/pom.xml Thu Nov 15 21:00:39 2012
@@ -0,0 +1,116 @@
+<?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. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.apache.airavata</groupId>
+        <artifactId>airavata</artifactId>
+        <version>0.6-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>airavata-rest-client</artifactId>
+    <packaging>jar</packaging>
+    <name>airavata-rest-client</name>
+    <build>
+        <finalName>airavata-rest-client</finalName>
+
+    </build>
+    <dependencies>
+        
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-json</artifactId>
+            <version>${jersey.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-client</artifactId>
+            <version>${jersey.version}</version>
+        </dependency>
+	
+        <!-- Airavata -->
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-gfac-schema-utils</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-registry-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- Logging -->
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>jcl-over-slf4j</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <version>${org.slf4j.version}</version>
+        </dependency>
+    </dependencies>
+    <properties>
+        <jersey.version>1.13</jersey.version>
+        <org.slf4j.version>1.6.1</org.slf4j.version>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <javaagent/>
+    </properties>
+    <repositories>
+        <repository>
+            <id>central</id>
+            <name>Maven Central</name>
+            <url>http://repo1.maven.org/maven2</url>
+            <releases>
+                <enabled>true</enabled>
+            </releases>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+        <repository>
+            <name>ogce.m2.all</name>
+            <id>ogce.m2.all</id>
+            <url>http://community.ucs.indiana.edu:9090/archiva/repository/ogce.m2.all</url>
+            <snapshots>
+                <!--updatePolicy>daily</updatePolicy -->
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+        <repository>
+            <id>m2-snapshot-repository</id>
+            <url>http://people.apache.org/repo/m2-snapshot-repository</url>
+            <releases>
+            </releases>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+        <repository>
+            <id>OW2</id>
+            <name>OW2 Repository</name>
+            <url>http://maven.ow2.org/maven2</url>
+        </repository>
+    </repositories>
+</project>

Added: airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/Test.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/Test.java?rev=1410008&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/Test.java (added)
+++ airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/Test.java Thu Nov 15 21:00:39 2012
@@ -0,0 +1,542 @@
+/*
+*
+* 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.rest;
+
+
+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.registry.api.AiravataExperiment;
+import org.apache.airavata.registry.api.WorkspaceProject;
+import org.apache.airavata.registry.api.exception.RegistryException;
+import org.apache.airavata.registry.api.workflow.*;
+import org.apache.airavata.rest.client.*;
+import org.apache.airavata.schemas.gfac.*;
+
+import java.sql.*;
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.Date;
+
+public class Test {
+    public static void main(String[] args) {
+//        configurationResourceClientTest();
+//        hostDescriptorClientTest();
+//        serviceDescriptorClientTest();
+//          appDescriptorClientTest();
+//        projectRegistryClientTest();
+//        experimentRegistryClient();
+//        userWFClientTest();
+//        publishWFClientTest();
+        provenanceClientTest();
+    }
+
+
+    public static void configurationResourceClientTest(){
+        //configuration resource test
+        ConfigurationResourceClient configurationResourceClient = new ConfigurationResourceClient();
+
+//        System.out.println("###############getConfiguration###############");
+//        Object configuration = configurationResourceClient.getConfiguration("interpreter.url");
+//        System.out.println(configuration.toString());
+//
+//        System.out.println("###############getConfigurationList###############");
+//        configurationResourceClient.addWFInterpreterURI("http://192.168.17.1:8080/axis2/services/WorkflowInterpretor2");
+//        List<Object> configurationList = configurationResourceClient.getConfigurationList("testKey1");
+//        for(Object object : configurationList){
+//            System.out.println(object.toString());
+//        }
+//
+//        System.out.println("###############setConfiguration###############");
+//        configurationResourceClient.setConfiguration("testKey1", "testVal1", "2012-11-12 00:12:31");
+//
+//        System.out.println("###############addConfiguration###############");
+//        configurationResourceClient.addConfiguration("testKey1", "testVal2", "2012-11-12 05:12:31");
+
+//        System.out.println("###############remove all configuration ###############");
+//        configurationResourceClient.removeAllConfiguration("testKey1");
+//
+//        System.out.println("###############remove configuration ###############");
+//        configurationResourceClient.setConfiguration("testKey2", "testVal2", "2012-11-12 00:12:31");
+//        configurationResourceClient.removeAllConfiguration("testKey2");
+//
+//        System.out.println("###############get GFAC URI ###############");
+//        configurationResourceClient.addGFacURI("http://192.168.17.1:8080/axis2/services/GFacService2");
+//        List<URI> gFacURIs = configurationResourceClient.getGFacURIs();
+//        for (URI uri : gFacURIs){
+//            System.out.println(uri.toString());
+//        }
+
+//        System.out.println("###############get WF interpreter URIs ###############");
+//        List<URI> workflowInterpreterURIs = configurationResourceClient.getWorkflowInterpreterURIs();
+//        for (URI uri : workflowInterpreterURIs){
+//            System.out.println(uri.toString());
+//        }
+//
+//        System.out.println("###############get eventing URI ###############");
+//        URI eventingURI = configurationResourceClient.getEventingURI();
+//        System.out.println(eventingURI.toString());
+//
+//        System.out.println("###############get message Box URI ###############");
+//        URI mesgBoxUri = configurationResourceClient.getMsgBoxURI();
+//        System.out.println(mesgBoxUri.toString());
+//
+//        System.out.println("###############Set eventing URI ###############");
+//        configurationResourceClient.setEventingURI("http://192.168.17.1:8080/axis2/services/EventingService2");
+//
+//        System.out.println("###############Set MSGBox URI ###############");
+//        configurationResourceClient.setEventingURI("http://192.168.17.1:8080/axis2/services/MsgBoxService2");
+//
+//        System.out.println("###############Add GFAC URI by date ###############");
+//        configurationResourceClient.addGFacURIByDate("http://192.168.17.1:8080/axis2/services/GFacService3", "2012-11-12 00:12:27");
+//
+//        System.out.println("###############Add WF interpreter URI by date ###############");
+//        configurationResourceClient.addWorkflowInterpreterURI("http://192.168.17.1:8080/axis2/services/WorkflowInterpretor3", "2012-11-12 00:12:27");
+
+//        System.out.println("###############Set eventing URI by date ###############");
+//        configurationResourceClient.setEventingURIByDate("http://192.168.17.1:8080/axis2/services/EventingService3", "2012-11-12 00:12:27");
+//
+//        System.out.println("###############Set MsgBox URI by date ###############");
+//        configurationResourceClient.setMessageBoxURIByDate("http://192.168.17.1:8080/axis2/services/MsgBoxService3", "2012-11-12 00:12:27");
+
+//        System.out.println("############### Remove GFac URI ###############");
+//        configurationResourceClient.removeGFacURI("http://192.168.17.1:8080/axis2/services/GFacService3");
+//
+//        System.out.println("############### Remove all GFac URI ###############");
+//        configurationResourceClient.removeAllGFacURI();
+//
+//        System.out.println("############### Remove removeWorkflowInterpreter URI ###############");
+//        configurationResourceClient.removeWorkflowInterpreterURI("http://192.168.17.1:8080/axis2/services/WorkflowInterpretor3");
+
+//        System.out.println("############### Remove removeAllWorkflowInterpreterURI ###############");
+//        configurationResourceClient.removeAllWorkflowInterpreterURI();
+//
+//        System.out.println("############### Remove eventing URI ###############");
+//        configurationResourceClient.unsetEventingURI();
+//
+//        System.out.println("############### unsetMessageBoxURI ###############");
+//        configurationResourceClient.unsetMessageBoxURI();
+    }
+
+    public static void hostDescriptorClientTest(){
+        DescriptorResourceClient descriptorResourceClient = new DescriptorResourceClient();
+
+//        boolean localHost = descriptorResourceClient.isHostDescriptorExists("LocalHost");
+//        System.out.println(localHost);
+
+//        HostDescription descriptor = new HostDescription(GlobusHostType.type);
+//        descriptor.getType().setHostName("testHost");
+//        descriptor.getType().setHostAddress("testHostAddress2");
+//        descriptorResourceClient.addHostDescriptor(descriptor);
+
+//        HostDescription localHost = descriptorResourceClient.getHostDescriptor("purdue.teragrid.org");
+//        List<HostDescription> hostDescriptors = descriptorResourceClient.getHostDescriptors();
+//        for(HostDescription hostDescription : hostDescriptors){
+//            System.out.println(hostDescription.getType().getHostName());
+//            System.out.println(hostDescription.getType().getHostAddress());
+//        }
+//
+//        List<String> hostDescriptorNames = descriptorResourceClient.getHostDescriptorNames();
+//        for (String hostName : hostDescriptorNames){
+//            System.out.println(hostName);
+//        }
+
+        descriptorResourceClient.removeHostDescriptor("testHost");
+
+//        System.out.println(localHost.getType().getHostName());
+//        System.out.println(localHost.getType().getHostAddress());
+
+    }
+
+    public static void serviceDescriptorClientTest (){
+        DescriptorResourceClient descriptorResourceClient = new DescriptorResourceClient();
+        //service descriptor exists
+//        boolean exists = descriptorResourceClient.isServiceDescriptorExists("echo");
+//        System.out.println(exists);
+
+        //service descriptor save
+//        ServiceDescription serviceDescription = new ServiceDescription();
+//        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
+//        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
+//        serviceDescription.getType().setName("testServiceDesc");
+//        serviceDescription.getType().setDescription("testDescription");
+//        InputParameterType parameter = InputParameterType.Factory.newInstance();
+//        parameter.setParameterName("input1");
+//        parameter.setParameterDescription("testDesc");
+//        ParameterType parameterType = parameter.addNewParameterType();
+//        parameterType.setType(DataType.STRING);
+//        parameterType.setName("testParamtype");
+//        inputParameters.add(parameter);
+//
+//        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
+//        outputParameter.setParameterName("output1");
+//        outputParameter.setParameterDescription("testDesc");
+//        ParameterType outputParaType = outputParameter.addNewParameterType();
+//        outputParaType.setType(DataType.STRING);
+//        outputParaType.setName("testParamtype");
+//        outputParameters.add(outputParameter);
+//
+//        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
+//        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));
+//
+//        descriptorResourceClient.saveServiceDescriptor(serviceDescription);
+
+        // Service descriptor update
+//        ServiceDescription testServiceDesc = descriptorResourceClient.getServiceDescriptor("testServiceDesc");
+//        testServiceDesc.getType().setDescription("testDescription2");
+//        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
+//        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
+//        InputParameterType parameter = InputParameterType.Factory.newInstance();
+//        parameter.setParameterName("input2");
+//        parameter.setParameterDescription("testDesc2");
+//        ParameterType parameterType = parameter.addNewParameterType();
+//        parameterType.setType(DataType.STRING);
+//        parameterType.setName("testParamtype2");
+//        inputParameters.add(parameter);
+//
+//        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
+//        outputParameter.setParameterName("output2");
+//        outputParameter.setParameterDescription("testDesc2");
+//        ParameterType outputParaType = outputParameter.addNewParameterType();
+//        outputParaType.setType(DataType.STRING);
+//        outputParaType.setName("testParamtype2");
+//        outputParameters.add(outputParameter);
+//
+//        testServiceDesc.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
+//        testServiceDesc.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));
+//
+//        descriptorResourceClient.updateServiceDescriptor(testServiceDesc);
+
+         //getServiceDescriptor
+//        ServiceDescription testServiceDesc = descriptorResourceClient.getServiceDescriptor("testServiceDesc");
+//        System.out.println(testServiceDesc.getType().getName());
+//        System.out.println(testServiceDesc.getType().getDescription());
+
+        //removeServiceDescriptor
+//        descriptorResourceClient.removeServiceDescriptor("testServiceDesc");
+
+        //getServiceDescriptors
+//        List<ServiceDescription> serviceDescriptors = descriptorResourceClient.getServiceDescriptors();
+//        for (ServiceDescription serviceDescription : serviceDescriptors){
+//            System.out.println(serviceDescription.getType().getName());
+//            System.out.println(serviceDescription.getType().getDescription());
+//        }
+    }
+
+    public static void appDescriptorClientTest (){
+//        DescriptorResourceClient descriptorResourceClient = new DescriptorResourceClient();
+
+        //isApplicationDescriptorExist
+//        boolean descriptorExist = descriptorResourceClient.isApplicationDescriptorExist("echo", "LocalHost", "LocalHost_application");
+//        System.out.println(descriptorExist);
+
+        // addApplicationDescriptor
+//        ServiceDescription serviceDescription = new ServiceDescription();
+//        List<InputParameterType> inputParameters = new ArrayList<InputParameterType>();
+//        List<OutputParameterType> outputParameters = new ArrayList<OutputParameterType>();
+//        serviceDescription.getType().setName("testServiceDesc");
+//        serviceDescription.getType().setDescription("testDescription");
+//        InputParameterType parameter = InputParameterType.Factory.newInstance();
+//        parameter.setParameterName("input1");
+//        parameter.setParameterDescription("testDesc");
+//        ParameterType parameterType = parameter.addNewParameterType();
+//        parameterType.setType(DataType.STRING);
+//        parameterType.setName("testParamtype");
+//        inputParameters.add(parameter);
+//
+//        OutputParameterType outputParameter = OutputParameterType.Factory.newInstance();
+//        outputParameter.setParameterName("output1");
+//        outputParameter.setParameterDescription("testDesc");
+//        ParameterType outputParaType = outputParameter.addNewParameterType();
+//        outputParaType.setType(DataType.STRING);
+//        outputParaType.setName("testParamtype");
+//        outputParameters.add(outputParameter);
+//
+//        serviceDescription.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
+//        serviceDescription.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));
+//
+//        HostDescription hostDescription = new HostDescription(GlobusHostType.type);
+//        hostDescription.getType().setHostName("testHost");
+//        hostDescription.getType().setHostAddress("testHostAddress");
+//        descriptorResourceClient.addHostDescriptor(hostDescription);
+//
+//        ApplicationDeploymentDescription applicationDeploymentDescription = new ApplicationDeploymentDescription(ApplicationDeploymentDescriptionType.type);
+//        ApplicationDeploymentDescriptionType.ApplicationName applicationName = applicationDeploymentDescription.getType().addNewApplicationName();
+//        applicationName.setStringValue("testApplication");
+//        applicationDeploymentDescription.getType().setApplicationName(applicationName);
+//        applicationDeploymentDescription.getType().setInputDataDirectory("/bin");
+//        applicationDeploymentDescription.getType().setExecutableLocation("/bin/echo");
+//        applicationDeploymentDescription.getType().setOutputDataDirectory("/tmp");
+//
+//        descriptorResourceClient.addApplicationDescriptor(serviceDescription, hostDescription, applicationDeploymentDescription);
+
+        //addApplicationDescriptor(String serviceName, String hostName, ApplicationDeploymentDescription descriptor)
+//        ApplicationDeploymentDescription applicationDeploymentDescription = new ApplicationDeploymentDescription(ApplicationDeploymentDescriptionType.type);
+//        ApplicationDeploymentDescriptionType.ApplicationName applicationName = applicationDeploymentDescription.getType().addNewApplicationName();
+//        applicationName.setStringValue("testApplication2");
+//        applicationDeploymentDescription.getType().setApplicationName(applicationName);
+//        applicationDeploymentDescription.getType().setInputDataDirectory("/bin");
+//        applicationDeploymentDescription.getType().setExecutableLocation("/bin/echo");
+//        applicationDeploymentDescription.getType().setOutputDataDirectory("/tmp");
+//        descriptorResourceClient.addApplicationDescriptor("testServiceDesc", "testHost", applicationDeploymentDescription);
+
+        //udpateApplicationDescriptor
+//        ApplicationDeploymentDescription applicationDescriptor = descriptorResourceClient.getApplicationDescriptor("testServiceDesc", "testHost", "testApplication2");
+//        applicationDescriptor.getType().setInputDataDirectory("/bin1");
+//        applicationDescriptor.getType().setExecutableLocation("/bin/echo1");
+//        applicationDescriptor.getType().setOutputDataDirectory("/tmp1");
+//        descriptorResourceClient.updateApplicationDescriptor("testServiceDesc", "testHost", applicationDescriptor);
+
+        //getApplicationDescriptors(String serviceName, String hostname)
+//        ApplicationDeploymentDescription applicationDescriptors = descriptorResourceClient.getApplicationDescriptors("testServiceDesc", "testHost");
+//        System.out.println(applicationDescriptors.getType().getApplicationName().getStringValue());
+//        System.out.println(applicationDescriptors.getType().getExecutableLocation());
+//        System.out.println(applicationDescriptors.getType().getOutputDataDirectory());
+
+        //getApplicationDescriptors(String serviceName)
+//        Map<String,ApplicationDeploymentDescription> testServiceDesc = descriptorResourceClient.getApplicationDescriptors("testServiceDesc");
+//        for (String host : testServiceDesc.keySet()){
+//            System.out.println(host);
+//            ApplicationDeploymentDescription applicationDeploymentDescription = testServiceDesc.get(host);
+//            System.out.println(applicationDeploymentDescription.getType().getApplicationName().getStringValue());
+//        }
+         //getApplicationDescriptors()
+//        Map<String[], ApplicationDeploymentDescription> applicationDescriptors = descriptorResourceClient.getApplicationDescriptors();
+//        for (String[] desc : applicationDescriptors.keySet()){
+//            System.out.println(desc[0]);
+//            System.out.println(desc[1]);
+//            ApplicationDeploymentDescription applicationDeploymentDescription = applicationDescriptors.get(desc);
+//            System.out.println(applicationDeploymentDescription.getType().getApplicationName().getStringValue());
+//        }
+
+        //getApplicationDescriptorNames ()
+//        List<String> applicationDescriptorNames = descriptorResourceClient.getApplicationDescriptorNames();
+//        for (String appName : applicationDescriptorNames){
+//            System.out.println(appName);
+//        }
+    }
+
+    public static void projectRegistryClientTest(){
+        ProjectResourceClient projectResourceClient = new ProjectResourceClient();
+        //isWorkspaceProjectExists
+//        boolean projectExists = projectResourceClient.isWorkspaceProjectExists("default");
+//        System.out.println(projectExists);
+       //isWorkspaceProjectExists(String projectName, boolean createIfNotExists)
+//        projectResourceClient.isWorkspaceProjectExists("testproject", true);
+        // addWorkspaceProject
+//        projectResourceClient.addWorkspaceProject("testproject2");
+
+        //updateWorkspaceProject(String projectName)
+//        projectResourceClient.updateWorkspaceProject("testproject");
+
+        // deleteWorkspaceProject
+//        projectResourceClient.deleteWorkspaceProject("testproject");
+
+        //getWorkspaceProject
+//        WorkspaceProject project = projectResourceClient.getWorkspaceProject("default");
+//        System.out.println(project.getGateway().getGatewayName());
+
+        //getWorkspaceProjects
+//        List<WorkspaceProject> workspaceProjects = projectResourceClient.getWorkspaceProjects();
+//        for (WorkspaceProject workspaceProject : workspaceProjects){
+//            System.out.println(workspaceProject.getProjectName());
+//        }
+
+    }
+
+    public static void experimentRegistryClient(){
+        ExperimentResourceClient experimentResourceClient = new ExperimentResourceClient();
+        //add experiment
+//        try {
+//            AiravataExperiment experiment = new AiravataExperiment();
+//            experiment.setExperimentId("testExperiment2");
+//            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//            Date formattedDate = dateFormat.parse("2012-11-13 11:50:32");
+//            experiment.setSubmittedDate(formattedDate);
+//            experimentResourceClient.addExperiment("default", experiment);
+//        } catch (ParseException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//        }
+
+        //remove experiment
+//        experimentResourceClient.removeExperiment("testExperiment");
+
+//        List<AiravataExperiment> experiments = experimentResourceClient.getExperiments();
+//        System.out.println(experiments.size());
+        //getExperiments(Date from, Date to)
+//        try{
+//            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//            Date date1 = dateFormat.parse("2012-11-01 11:50:32");
+//            Date date2 = dateFormat.parse("2012-11-15 11:50:32");
+//            List<AiravataExperiment> experiments = experimentResourceClient.getExperiments(date1, date2);
+//            System.out.println(experiments.size());
+//        } catch (ParseException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//        }
+
+        //getExperiments(String projectName, Date from, Date to)
+//        try{
+//            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//            Date date1 = dateFormat.parse("2012-11-01 11:50:32");
+//            Date date2 = dateFormat.parse("2012-11-15 11:50:32");
+//            List<AiravataExperiment> experiments = experimentResourceClient.getExperiments("default",date1, date2);
+//            System.out.println(experiments.size());
+//        } catch (ParseException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//        }
+
+          //isExperimentExists(String experimentId)
+//        boolean exists = experimentResourceClient.isExperimentExists("testExperiment");
+//        System.out.println(exists);
+
+
+        //isExperimentExists(String experimentId, boolean createIfNotPresent)
+//        experimentResourceClient.isExperimentExists("testExp", true);
+
+
+    }
+
+    public static void userWFClientTest (){
+        UserWorkflowResourceClient userWorkflowResourceClient = new UserWorkflowResourceClient();
+//        boolean exists = userWorkflowResourceClient.isWorkflowExists("Workflow1");
+//        System.out.println(exists);
+//         userWorkflowResourceClient.addWorkflow("workflow5", "testworlflowcontent");
+//         userWorkflowResourceClient.updateWorkflow("worklfow5", "updatedtestworlflowcontent");
+//        String workflow2 = userWorkflowResourceClient.getWorkflowGraphXML("workflow2");
+//        System.out.println(workflow2);
+//        Map<String, String> workflows = userWorkflowResourceClient.getWorkflows();
+//        System.out.println(workflows.size());
+//        userWorkflowResourceClient.removeWorkflow("workflow5");
+    }
+
+    public static void publishWFClientTest () {
+        PublishedWorkflowResourceClient publishedWorkflowResourceClient = new PublishedWorkflowResourceClient();
+//        boolean exists = publishedWorkflowResourceClient.isPublishedWorkflowExists("Workflow2");
+//        System.out.println(exists);
+
+//        publishedWorkflowResourceClient.publishWorkflow("workflow3", "publishedWF3");
+//        publishedWorkflowResourceClient.publishWorkflow("workflow4");
+//        String workflow1 = publishedWorkflowResourceClient.getPublishedWorkflowGraphXML("Workflow2");
+//        System.out.println(workflow1);
+//        List<String> publishedWorkflowNames = publishedWorkflowResourceClient.getPublishedWorkflowNames();
+//        System.out.println(publishedWorkflowNames.size());
+
+//        publishedWorkflowResourceClient.removePublishedWorkflow("workflow4");
+
+    }
+
+    public static void provenanceClientTest()  {
+//        ProvenanceResourceClient provenanceResourceClient = new ProvenanceResourceClient();
+//        provenanceResourceClient.updateExperimentExecutionUser("eb9e67cf-6fe3-46f1-b50b-7b42936d347d", "aaa");
+//        String experimentExecutionUser = provenanceResourceClient.getExperimentExecutionUser("eb9e67cf-6fe3-46f1-b50b-7b42936d347d");
+//        System.out.println(experimentExecutionUser);
+//        boolean nameExist = provenanceResourceClient.isExperimentNameExist("exp1");
+//        System.out.println(nameExist);
+//        String experimentName = provenanceResourceClient.getExperimentName("eb9e67cf-6fe3-46f1-b50b-7b42936d347d");
+//        System.out.println(experimentName);
+//        String workflowExecutionTemplateName = provenanceResourceClient.getWorkflowExecutionTemplateName("e00ddc5e-f8d5-4492-9eb2-10372efb103c");
+//        System.out.println(workflowExecutionTemplateName);
+//        provenanceResourceClient.setWorkflowInstanceTemplateName("eb9e67cf-6fe3-46f1-b50b-7b42936d347d", "wftemplate2");
+//        List<WorkflowInstance> experimentWorkflowInstances = provenanceResourceClient.getExperimentWorkflowInstances("e00ddc5e-f8d5-4492-9eb2-10372efb103c");
+//        System.out.println(experimentWorkflowInstances.size());
+//        System.out.println(provenanceResourceClient.isWorkflowInstanceExists("e00ddc5e-f8d5-4492-9eb2-10372efb103c"));
+//        provenanceResourceClient.isWorkflowInstanceExists("testInstance", true);
+
+//        try {
+//            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+//            Date date = dateFormat.parse("2012-11-01 11:50:32");
+//            WorkflowInstanceStatus workflowInstanceStatus = new WorkflowInstanceStatus(new WorkflowInstance("testInstance", "testInstance"), WorkflowInstanceStatus.ExecutionStatus.FINISHED, date);
+//            provenanceResourceClient.updateWorkflowInstanceStatus(workflowInstanceStatus);
+//        } catch (ParseException e) {
+//            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+//        }
+
+//        System.out.println(provenanceResourceClient.getWorkflowInstanceStatus("testInstance").getExecutionStatus().name());
+//        WorkflowInstanceNode workflowInstanceNode = new WorkflowInstanceNode(provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius").getWorkflowInstance(), "TempConvertSoap_FahrenheitToCelsius");
+//        provenanceResourceClient.updateWorkflowNodeInput(workflowInstanceNode, "testInput2");
+
+//        WorkflowInstanceNode workflowInstanceNode = new WorkflowInstanceNode(provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius").getWorkflowInstance(), "TempConvertSoap_FahrenheitToCelsius");
+//        provenanceResourceClient.updateWorkflowNodeOutput(workflowInstanceNode, "testOutput");
+
+//        ExperimentData experiment = provenanceResourceClient.getExperiment("ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4");
+//        String experimentName = experiment.getExperimentName();
+//        System.out.println(experimentName);
+
+//        ExperimentData experiment = provenanceResourceClient.getExperimentMetaInformation("ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4");
+//        String experimentName = experiment.getExperimentName();
+//        System.out.println(experimentName);
+
+//        List<ExperimentData> admin = provenanceResourceClient.getAllExperimentMetaInformation("admin");
+//        System.out.println(admin.size());
+
+//        List<ExperimentData> experimentDataList = provenanceResourceClient.searchExperiments("admin", "exp");
+//        System.out.println(experimentDataList.size());
+
+//        List<String> admin = provenanceResourceClient.getExperimentIdByUser("admin");
+//        for (String exp : admin){
+//            System.out.println(exp);
+//        }
+//        List<ExperimentData> experimentByUser = provenanceResourceClient.getExperimentByUser("admin");
+//        System.out.println(experimentByUser.size());
+
+//        WorkflowInstanceNode workflowInstanceNode = new WorkflowInstanceNode(provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius").getWorkflowInstance(), "TempConvertSoap_FahrenheitToCelsius");
+//        WorkflowInstanceNodeStatus workflowInstanceNodeStatus = new WorkflowInstanceNodeStatus(workflowInstanceNode, WorkflowInstanceStatus.ExecutionStatus.STARTED);
+//        provenanceResourceClient.updateWorkflowNodeStatus(workflowInstanceNodeStatus);
+
+//        WorkflowInstanceNode workflowInstanceNode = new WorkflowInstanceNode(provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius").getWorkflowInstance(), "TempConvertSoap_FahrenheitToCelsius");
+//        provenanceResourceClient.updateWorkflowNodeStatus(workflowInstanceNode, WorkflowInstanceStatus.ExecutionStatus.FINISHED);
+
+//        WorkflowInstanceNode workflowInstanceNode = new WorkflowInstanceNode(provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius").getWorkflowInstance(), "TempConvertSoap_FahrenheitToCelsius");
+//        WorkflowInstanceNodeStatus workflowNodeStatus = provenanceResourceClient.getWorkflowNodeStatus(workflowInstanceNode);
+//        System.out.println(workflowNodeStatus.getExecutionStatus().name());
+
+//        WorkflowInstanceNode workflowInstanceNode = new WorkflowInstanceNode(provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius").getWorkflowInstance(), "TempConvertSoap_FahrenheitToCelsius");
+//        Date workflowNodeStartTime = provenanceResourceClient.getWorkflowNodeStartTime(workflowInstanceNode);
+//        System.out.println(workflowNodeStartTime.toString());
+
+//        WorkflowInstance tempConvertSoap_fahrenheitToCelsius = provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius").getWorkflowInstance();
+//        Date workflowStartTime = provenanceResourceClient.getWorkflowStartTime(tempConvertSoap_fahrenheitToCelsius);
+//        System.out.println(workflowStartTime.toString());
+
+//        WorkflowNodeGramData workflowNodeGramData = new WorkflowNodeGramData("TempConvertSoap_FahrenheitToCelsius", "TempConvertSoap_FahrenheitToCelsius", "rsl", "invokedHost", "jobID");
+//        provenanceResourceClient.updateWorkflowNodeGramData(workflowNodeGramData);
+
+//        WorkflowInstanceData instanceData = provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius");
+//        System.out.println(instanceData.getWorkflowInstance().getExperimentId());
+
+//        System.out.println(provenanceResourceClient.isWorkflowInstanceNodePresent("TempConvertSoap_FahrenheitToCelsius", "TempConvertSoap_FahrenheitToCelsius"));
+
+//        provenanceResourceClient.isWorkflowInstanceNodePresent("TempConvertSoap_FahrenheitToCelsius", "TempConvertSoap_FahrenheitToCelsius1", true);
+
+//        provenanceResourceClient.addWorkflowInstance("testInstance", "testWF", "testWotrfklow");
+//        WorkflowInstanceNode workflowInstanceNode = new WorkflowInstanceNode(provenanceResourceClient.getWorkflowInstanceData("TempConvertSoap_FahrenheitToCelsius").getWorkflowInstance(), "TempConvertSoap_FahrenheitToCelsius");
+//        WorkflowNodeType workflowNodeType = new WorkflowNodeType();
+//        workflowNodeType.setNodeType(WorkflowNodeType.WorkflowNode.SERVICENODE);
+//        provenanceResourceClient.updateWorkflowNodeType(workflowInstanceNode, workflowNodeType);
+
+//         provenanceResourceClient.addWorkflowInstanceNode("TempConvertSoap_FahrenheitToCelsius", "testNode");
+    }
+
+
+}

Added: airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/AllRegistryResourceClients.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/AllRegistryResourceClients.java?rev=1410008&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/AllRegistryResourceClients.java (added)
+++ airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/AllRegistryResourceClients.java Thu Nov 15 21:00:39 2012
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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.rest.client;
+
+public class AllRegistryResourceClients {
+    private BasicRegistryResourceClient basicRegistryResourceClient = new BasicRegistryResourceClient();
+    private ConfigurationResourceClient configurationResourceClient = new ConfigurationResourceClient();
+    private DescriptorResourceClient descriptorResourceClient = new DescriptorResourceClient();
+    private ExperimentResourceClient experimentResourceClient = new ExperimentResourceClient();
+    private ProjectResourceClient projectResourceClient = new ProjectResourceClient();
+    private ProvenanceResourceClient provenanceResourceClient = new ProvenanceResourceClient();
+    private PublishedWorkflowResourceClient publishedWorkflowResourceClient = new PublishedWorkflowResourceClient();
+    private UserWorkflowResourceClient userWorkflowResourceClient = new UserWorkflowResourceClient();
+
+    public BasicRegistryResourceClient getBasicRegistryResourceClient() {
+        return basicRegistryResourceClient;
+    }
+
+    public ConfigurationResourceClient getConfigurationResourceClient() {
+        return configurationResourceClient;
+    }
+
+    public DescriptorResourceClient getDescriptorResourceClient() {
+        return descriptorResourceClient;
+    }
+
+    public ExperimentResourceClient getExperimentResourceClient() {
+        return experimentResourceClient;
+    }
+
+    public ProjectResourceClient getProjectResourceClient() {
+        return projectResourceClient;
+    }
+
+    public ProvenanceResourceClient getProvenanceResourceClient() {
+        return provenanceResourceClient;
+    }
+
+    public PublishedWorkflowResourceClient getPublishedWorkflowResourceClient() {
+        return publishedWorkflowResourceClient;
+    }
+
+    public UserWorkflowResourceClient getUserWorkflowResourceClient() {
+        return userWorkflowResourceClient;
+    }
+}

Added: airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java?rev=1410008&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java (added)
+++ airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/BasicRegistryResourceClient.java Thu Nov 15 21:00:39 2012
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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.rest.client;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.json.JSONConfiguration;
+import org.apache.airavata.registry.api.AiravataUser;
+import org.apache.airavata.registry.api.Gateway;
+import org.apache.airavata.rest.utils.ResourcePathConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriBuilder;
+import java.net.URI;
+
+public class BasicRegistryResourceClient {
+    private WebResource webResource;
+    private final static Logger logger = LoggerFactory.getLogger(BasicRegistryResourceClient.class);
+
+    private URI getBaseURI() {
+        logger.info("Creating Base URI");
+        return UriBuilder.fromUri("http://localhost:9080/airavata-services/").build();
+    }
+
+    private WebResource getBasicRegistryBaseResource (){
+        ClientConfig config = new DefaultClientConfig();
+        config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,
+                Boolean.TRUE);
+        Client client = Client.create(config);
+        WebResource baseWebResource = client.resource(getBaseURI());
+        webResource = baseWebResource.path(ResourcePathConstants.BasicRegistryConstants.REGISTRY_API_BASICREGISTRY);
+        return webResource;
+    }
+
+    public Gateway getGateway (){
+        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.GET_GATEWAY);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        Gateway gateway = response.getEntity(Gateway.class);
+        return gateway;
+    }
+
+    public AiravataUser getUser (){
+        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.GET_USER);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        AiravataUser airavataUser = response.getEntity(AiravataUser.class);
+        return airavataUser;
+    }
+
+    public void setGateway (Gateway gateway){
+        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.SET_GATEWAY);
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, gateway);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void setUser (AiravataUser user){
+        webResource = getBasicRegistryBaseResource().path(ResourcePathConstants.BasicRegistryConstants.SET_USER);
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).type(MediaType.APPLICATION_JSON).post(ClientResponse.class, user);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+}

Added: airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java?rev=1410008&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java (added)
+++ airavata/trunk/modules/airavata-rest-client/src/main/java/org/apache/airavata/rest/client/ConfigurationResourceClient.java Thu Nov 15 21:00:39 2012
@@ -0,0 +1,459 @@
+/*
+ *
+ * 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.rest.client;
+
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.ClientResponse;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.json.JSONConfiguration;
+import com.sun.jersey.core.util.MultivaluedMapImpl;
+import org.apache.airavata.rest.resourcemappings.ConfigurationList;
+import org.apache.airavata.rest.resourcemappings.URLList;
+import org.apache.airavata.rest.utils.ResourcePathConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.UriBuilder;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class ConfigurationResourceClient {
+    private WebResource webResource;
+    private final static Logger logger = LoggerFactory.getLogger(ConfigurationResourceClient.class);
+
+    private URI getBaseURI() {
+        logger.info("Creating Base URI");
+        return UriBuilder.fromUri("http://localhost:9080/airavata-services/").build();
+    }
+
+    private WebResource getConfigurationBaseResource (){
+        ClientConfig config = new DefaultClientConfig();
+        config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING,
+                Boolean.TRUE);
+        Client client = Client.create(config);
+        WebResource baseWebResource = client.resource(getBaseURI());
+        webResource = baseWebResource.path(ResourcePathConstants.ConfigResourcePathConstants.CONFIGURATION_REGISTRY_RESOURCE);
+        return webResource;
+    }
+
+
+    public Object getConfiguration(String configKey) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_CONFIGURATION);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("key", configKey);
+        ClientResponse response = webResource.queryParams(queryParams).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+        String output = response.getEntity(String.class);
+        return output;
+    }
+
+    public List<Object> getConfigurationList (String configKey) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_CONFIGURATION_LIST);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("key", configKey);
+        ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+        ConfigurationList configurationList = response.getEntity(ConfigurationList.class);
+        List<Object> configurationValueList = new ArrayList<Object>();
+        Object[] configValList = configurationList.getConfigValList();
+        for(Object configVal : configValList){
+            configurationValueList.add(configVal);
+        }
+
+        return configurationValueList;
+    }
+
+    public void setConfiguration (String configKey, String configVal, String date){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.SAVE_CONFIGURATION);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("key", configKey);
+        formData.add("value", configVal);
+        formData.add("date", date);
+
+        ClientResponse response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void addConfiguration(String configKey, String configVal, String date){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.UPDATE_CONFIGURATION);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("key", configKey);
+        formData.add("value", configVal);
+        formData.add("date", date);
+
+        ClientResponse response = webResource.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void removeAllConfiguration(String key){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_ALL_CONFIGURATION);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("key", key);
+        ClientResponse response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+    }
+
+    public void removeConfiguration(String key, String value){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_CONFIGURATION);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("key", key);
+        queryParams.add("value", value);
+        ClientResponse response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public List<URI> getGFacURIs(){
+        List<URI> uriList = new ArrayList<URI>();
+        try{
+            webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_GFAC_URI_LIST);
+            ClientResponse response = webResource.get(ClientResponse.class);
+            int status = response.getStatus();
+
+            if (status != 200) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            }
+
+            URLList urlList = response.getEntity(URLList.class);
+            String[] uris = urlList.getUris();
+            for (String url: uris){
+                URI uri = new URI(url);
+                uriList.add(uri);
+            }
+        } catch (URISyntaxException e) {
+            logger.error("URI syntax is not correct...");
+            return null;
+        }
+        return uriList;
+    }
+
+    public List<URI> getWorkflowInterpreterURIs(){
+        List<URI> uriList = new ArrayList<URI>();
+        try{
+            webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_WFINTERPRETER_URI_LIST);
+            ClientResponse response = webResource.get(ClientResponse.class);
+            int status = response.getStatus();
+
+            if (status != 200) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            }
+
+            URLList urlList = response.getEntity(URLList.class);
+            String[] uris = urlList.getUris();
+            for (String url: uris){
+                URI uri = new URI(url);
+                uriList.add(uri);
+            }
+        } catch (URISyntaxException e) {
+            return null;
+        }
+        return uriList;
+    }
+
+
+    public URI getEventingURI(){
+        try{
+            webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_EVENTING_URI);
+            ClientResponse response = webResource.get(ClientResponse.class);
+            int status = response.getStatus();
+
+            if (status != 200) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            }
+
+            String uri = response.getEntity(String.class);
+            URI eventingURI = new URI(uri);
+            return eventingURI;
+        } catch (URISyntaxException e) {
+            return null;
+        }
+    }
+
+    public URI getMsgBoxURI(){
+        try{
+            webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.GET_MESSAGE_BOX_URI);
+            ClientResponse response = webResource.get(ClientResponse.class);
+            int status = response.getStatus();
+
+            if (status != 200) {
+                logger.error(response.getEntity(String.class));
+                throw new RuntimeException("Failed : HTTP error code : "
+                        + status);
+            }
+
+            String uri = response.getEntity(String.class);
+            URI msgBoxURI = new URI(uri);
+            return msgBoxURI;
+        } catch (URISyntaxException e) {
+            return null;
+        }
+    }
+
+    public void addGFacURI(String uri) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.ADD_GFAC_URI);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("uri", uri);
+
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void addWFInterpreterURI(String uri) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.ADD_WFINTERPRETER_URI);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("uri", uri);
+
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void setEventingURI(String uri) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.ADD_EVENTING_URI);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("uri", uri);
+
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void setMessageBoxURI(String uri) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.ADD_MESSAGE_BOX_URI);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("uri", uri);
+
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void addGFacURIByDate(String uri, String date) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.ADD_GFAC_URI_DATE);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("uri", uri);
+        formData.add("date", date);
+
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void addWorkflowInterpreterURI(String uri, String date) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.ADD_WFINTERPRETER_URI_DATE);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("uri", uri);
+        formData.add("date", date);
+
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void setEventingURIByDate(String uri, String date) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.ADD_EVENTING_URI_DATE);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("uri", uri);
+        formData.add("date", date);
+
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void setMessageBoxURIByDate(String uri, String date) {
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.ADD_MSG_BOX_URI_DATE);
+        MultivaluedMap formData = new MultivaluedMapImpl();
+        formData.add("uri", uri);
+        formData.add("date", date);
+
+        ClientResponse response = webResource.accept(MediaType.TEXT_PLAIN).post(ClientResponse.class, formData);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void removeGFacURI(String uri){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_GFAC_URI);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("uri", uri);
+        ClientResponse response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void removeAllGFacURI(){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_ALL_GFAC_URIS);
+        ClientResponse response = webResource.delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void removeWorkflowInterpreterURI(String uri){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_WFINTERPRETER_URI);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("uri", uri);
+        ClientResponse response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void removeAllWorkflowInterpreterURI(){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_ALL_WFINTERPRETER_URIS);
+        ClientResponse response = webResource.delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void unsetEventingURI(){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_EVENTING_URI);
+        ClientResponse response = webResource.delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void unsetMessageBoxURI(){
+        webResource = getConfigurationBaseResource().path(ResourcePathConstants.ConfigResourcePathConstants.DELETE_MSG_BOX_URI);
+        ClientResponse response = webResource.delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error(response.getEntity(String.class));
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+}



Mime
View raw message