airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chath...@apache.org
Subject svn commit: r1408798 [1/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
Author: chathuri
Date: Tue Nov 13 15:52:16 2012
New Revision: 1408798

URL: http://svn.apache.org/viewvc?rev=1408798&view=rev
Log:
adding airavata rest services to trunk

Added:
    airavata/trunk/modules/airavata-rest-services/
    airavata/trunk/modules/airavata-rest-services/README.txt
    airavata/trunk/modules/airavata-rest-services/pom.xml
    airavata/trunk/modules/airavata-rest-services/src/
    airavata/trunk/modules/airavata-rest-services/src/main/
    airavata/trunk/modules/airavata-rest-services/src/main/java/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/Test.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/ConfigurationResourceClient.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/DescriptorResourceClient.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/ExperimentResourceClient.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/ProjectResourceClient.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/ProvenanceResourceClient.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/PublishedWorkflowResourceClient.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/UserWorkflowResourceClient.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ApplicationDescriptor.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ApplicationDescriptorList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ConfigurationList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/DescriptorNameList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ExperimentDataList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ExperimentIDList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ExperimentList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptionList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptor.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/PublishWorkflowNamesList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ServiceDescriptionList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ServiceDescriptor.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/ServiceParameters.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/URLList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/Workflow.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/WorkflowInstancesList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/WorkflowList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/WorkflowNodeIODataList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/WorkspaceProjectList.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/ApplicationRegistration.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/ConfigurationRegistryResource.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/DescriptorRegistryResource.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/ExperimentRegistryResource.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/ProjectRegistryResource.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/ProvenanceRegistryResource.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/PublishWorkflowRegistryResource.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryApplication.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/resources/UserWorkflowRegistryResource.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ApplicationDescriptorTypes.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/DescriptorUtil.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/HostTypes.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RegistryListener.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/ResourcePathConstants.java
    airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/utils/RestServicesConstants.java
    airavata/trunk/modules/airavata-rest-services/src/main/resources/
    airavata/trunk/modules/airavata-rest-services/src/main/resources/airavata-server.properties
    airavata/trunk/modules/airavata-rest-services/src/main/resources/log4j.xml
    airavata/trunk/modules/airavata-rest-services/src/main/webapp/
    airavata/trunk/modules/airavata-rest-services/src/main/webapp/WEB-INF/
    airavata/trunk/modules/airavata-rest-services/src/main/webapp/WEB-INF/web.xml
    airavata/trunk/modules/airavata-rest-services/src/main/webapp/index.jsp
    airavata/trunk/modules/airavata-rest-services/src/test/
    airavata/trunk/modules/airavata-rest-services/src/test/resources/

Added: airavata/trunk/modules/airavata-rest-services/README.txt
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/README.txt?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/README.txt (added)
+++ airavata/trunk/modules/airavata-rest-services/README.txt Tue Nov 13 15:52:16 2012
@@ -0,0 +1,164 @@
+To build
+mvn clean install
+
+For development run
+mvn cargo:start
+
+To test
+* Start database according what you specified in the airavata-server.properties
+* for simple methods you can use curl for testing.
+
+**************For Configuration releated methods********************
+   curl -v 'http://localhost:9080/airavata-services/registry/api/configuration?key=key1'
+   curl -v 'http://localhost:9080/airavata-services/registry/api/configurationlist?key=key1'
+   curl -H "Accept: text/plain" -X POST -d "key=key1&value=value4&date=2012-09-21 04:09:56" http://localhost:9080/airavata-services/registry/api/save/configuration
+   curl -H "Accept: text/plain" -X POST -d "key=key1&value=value5&date=2012-09-23 04:09:56" http://localhost:9080/airavata-services/registry/api/update/configuration
+   curl --request DELETE http://localhost:9080/airavata-services/registry/api/delete/allconfiguration?key=key1
+   curl --request DELETE 'http://localhost:9080/airavata-services/registry/api/delete/configuration?key=key2&value=value2'
+   curl --request GET http://localhost:9080/airavata-services/registry/api/gfac/urilist
+   curl --request GET http://localhost:9080/airavata-services/registry/api/workflowinterpreter/urilist
+   curl --request GET http://localhost:9080/airavata-services/registry/api/eventingservice/uri
+   curl --request GET http://localhost:9080/airavata-services/registry/api/messagebox/uri
+   curl -H "Accept: text/plain" -X POST -d "uri=http://192.168.17.1:8080/axis2/services/GFacService2" http://localhost:9080/airavata-services/registry/api/add/gfacuri
+   curl -H "Accept: text/plain" -X POST -d "uri=http://192.168.17.1:8080/axis2/services/WorkflowInterpretor2" http://localhost:9080/airavata-services/registry/api/add/workflowinterpreteruri
+   curl -H "Accept: text/plain" -X POST -d "uri=http://192.168.17.1:8080/axis2/services/EventingService2" http://localhost:9080/airavata-services/registry/api/add/eventinguri
+   curl -H "Accept: text/plain" -X POST -d "uri=http://192.168.17.1:8080/axis2/services/MsgBoxService2" http://localhost:9080/airavata-services/registry/api/add/msgboxuri
+   curl -H "Accept: text/plain" -X POST -d "uri=http://192.168.17.1:8080/axis2/services/GFacService2&date=2012-10-18 00:00:00" http://localhost:9080/airavata-services/registry/api/add/gfacuri/date
+   curl -H "Accept: text/plain" -X POST -d "uri=http://192.168.17.1:8080/axis2/services/WorkflowInterpretor2&date=2012-10-18 00:00:00" http://localhost:9080/airavata-services/registry/api/add/workflowinterpreteruri/date
+   curl -H "Accept: text/plain" -X POST -d "uri=http://192.168.17.1:8080/axis2/services/MsgBoxService2&date=2012-10-18 00:00:00" http://localhost:9080/airavata-services/registry/api/add/msgboxuri/date
+   curl --request DELETE http://localhost:9080/airavata-services/registry/api/delete/gfacuri?uri=http://192.168.17.1:8080/axis2/services/GFacService2
+   curl --request DELETE http://localhost:9080/airavata-services/registry/api/delete/allgfacuris
+   curl --request DELETE http://localhost:9080/airavata-services/registry/api/delete/workflowinterpreteruri?uri=http://192.168.17.1:8080/axis2/services/WorkflowInterpretor2
+   curl --request DELETE http://localhost:9080/airavata-services/registry/api/delete/allworkflowinterpreteruris
+   curl --request DELETE http://localhost:9080/airavata-services/registry/api/delete/eventinguri
+   curl --request DELETE http://localhost:9080/airavata-services/registry/api/delete/msgboxuri
+
+************For descriptiors*********************************
+    ############## Host descriptrors ##########################
+
+    curl --request GET http://localhost:9080/airavata-services/registry/api/hostdescriptor/exist?descriptorName=ember
+    curl -H "Accept:application/json"  -X POST -H "Content-Type:application/json" -d '{"hostname":"testHost1", "hostAddress":"testHostAddress" }' http://localhost:9080/airavata-services/registry/api/hostdescriptor/save
+    curl -H "Accept:application/json"  -X POST -H "Content-Type:application/json" -d '{"hostname":"testHost1", "hostAddress":"testHostAddress2" }' http://localhost:9080/airavata-services/registry/api/hostdescriptor/update
+    curl --request GET http://localhost:9080/airavata-services/registry/api/host/description?hostName=testHost1
+    curl --request DELETE http://localhost:9080/airavata-services/registry/api/hostdescriptor/delete?hostName=testHost1
+    curl --request GET http://localhost:9080/airavata-services/registry/api/get/hostdescriptors
+
+    ############## Service descriptrors ##########################
+    curl --request GET http://localhost:9080/airavata-services/registry/api/servicedescriptor/exist?descriptorName=echo
+    curl -H "Accept:application/json"  -X POST -H "Content-Type:application/json" -d '{"serviceName":"testService1", "description":"test description","inputParams":{"dataType":"input", "description":"myinput","name":"myinput","type":"String"},"outputParams":{"dataType":"output","description":"myoutput","name":"myoutput","type":"String"}}' http://localhost:9080/airavata-services/registry/api/servicedescriptor/save
+    curl -H "Accept:application/json"  -X POST -H "Content-Type:application/json" -d '{"serviceName":"testService2", "description":"test description2","inputParams":{"dataType":"input", "description":"myinput2","name":"myinput2","type":"String"},"outputParams":{"dataType":"output","description":"myoutput2","name":"myoutput2","type":"String"}}' http://localhost:9080/airavata-services/registry/api/servicedescriptor/update
+    curl --request GET http://localhost:9080/airavata-services/registry/api/servicedescriptor/description?serviceName=echo1
+    curl --request DELETE http://localhost:9080/airavata-services/registry/api/servicedescriptor/delete?serviceName=echo1
+    curl --request GET http://localhost:9080/airavata-services/registry/api/get/servicedescriptors
+
+    ############## Application descriptrors ##########################
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/applicationdescriptor/exist?serviceName=echo&hostName=LocalHost&descriptorName=LocalHost_application'
+    curl -H "Accept:application/json"  -X POST -H "Content-Type:application/json" -d '{"name":"abc1", "hostdescName":"LocalHost", "executablePath":"cccc", "workingDir":"dddd" , "serviceDescriptor":{"inputParams":{"dataType":"input", "description":"myinput","name":"myinput","type":"String"},"outputParams":{"dataType":"output","description":"myoutput","name":"myoutput","type":"String"}}}' http://localhost:9080/airavata-services/registry/api/applicationdescriptor/build/save
+     curl -H "Accept:application/json"  -X POST -H "Content-Type:application/json" -d '{"name":"abc1", "hostdescName":"LocalHost", "executablePath":"cccc111", "workingDir":"dddd1111" , "serviceDescriptor":{"inputParams":{"dataType":"input", "description":"myinput11","name":"myinput11","type":"String"},"outputParams":{"dataType":"output","description":"myoutput11","name":"myoutput11","type":"String"}}}' http://localhost:9080/airavata-services/registry/api/applicationdescriptor/update
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/applicationdescriptor/description?serviceName=echo&hostName=LocalHost&applicationName=LocalHost_application2'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/applicationdescriptors/alldescriptors/host/service?serviceName=echo&hostName=LocalHost'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/applicationdescriptor/alldescriptors/service?serviceName=echo'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/applicationdescriptor/alldescriptors'
+    curl --request DELETE 'http://localhost:9080/airavata-services/registry/api/applicationdescriptor/delete?serviceName=echo&hostName=LocalHost&appName=LocalHost_application2'
+
+************ Project Registry *********************************
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/project/exist?projectName=default'
+    curl -H "Accept: text/plain" -X POST -d 'projectName=project1' http://localhost:9080/airavata-services/registry/api/add/project
+    curl -H "Accept: text/plain" -X POST -d 'projectName=project1' http://localhost:9080/airavata-services/registry/api/update/project
+    curl --request DELETE 'http://localhost:9080/airavata-services/registry/api/delete/project?projectName=project1'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/project?projectName=project1'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/projects'
+
+************* Experiments *************************************
+    curl --request DELETE 'http://localhost:9080/airavata-services/registry/api/delete/experiment?experimentId=eb9e67cf-6fe3-46f1-b50b-7b42936d347d
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experiments/all'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experiments/project?projectName=default'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experiments/date?fromDate=2012-10-16%2000:00:00&toDate=2012-10-18%2000:00:00'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experiments/project/date?projectName=default&fromDate=2012-10-16%2000:00:00&toDate=2012-10-18%2000:00:00'
+    curl -H "Accept: text/plain" -X POST -d 'projectName=project1&experimentID=testexpID1&submittedDate=2012-10-18 00:00:00' http://localhost:9080/airavata-services/registry/api/add/experiment
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/experiment/exist?experimentId=testexpID1'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/experiment/notexist/create?experimentId=testExpID2&createIfNotPresent=true'
+    curl -H "Accept: text/plain" -X POST -d 'experimentId=testExpID2&user=abc' http://localhost:9080/airavata-services/registry/api/update/experiment
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experiment/executionuser?experimentId=testExpID2'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experiment/name?experimentId=testExpID2'
+    curl -H "Accept: text/plain" -X POST -d 'experimentId=testExpID2&experimentName=ddscsddsss111' http://localhost:9080/airavata-services/registry/api/update/experimentname
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experimentmetadata?experimentId=testExpID2'
+    curl -H "Accept: text/plain" -X POST -d 'experimentId=testExpID2&metadata=aaaaaaa' http://localhost:9080/airavata-services/registry/api/update/experimentmetadata
+
+************* Workflow Execution *************************************
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/workflowtemplatename?workflowInstanceId=e00ddc5e-f8d5-4492-9eb2-10372efb103c'
+    curl -H "Accept: text/plain" -X POST -d 'workflowInstanceId=e00ddc5e-f8d5-4492-9eb2-10372efb103c&templateName=wftemplate1' http://localhost:9080/airavata-services/registry/api/update/workflowinstancetemplatename
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experimentworkflowinstances?experimentId=ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/workflowinstance/exist/check?instanceId=e00ddc5e-f8d5-4492-9eb2-10372efb103c'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/workflowinstance/exist/create?instanceId=testWFInstanceID&createIfNotPresent=true'
+    curl -H "Accept: text/plain" -X POST -d 'instanceId=testWFInstanceID&executionStatus=FINISHED' http://localhost:9080/airavata-services/registry/api/update/workflowinstancestatus/instanceid
+    curl -H "Accept: text/plain" -X POST -d 'experimentId=testWFInstanceID&workflowInstanceId=testWFInstanceID&executionStatus=STARTED&statusUpdateTime=2012-10-23 00:00:00' http://localhost:9080/airavata-services/registry/api/update/workflowinstancestatus/experimentid
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/workflowinstancestatus?instanceId=testWFInstanceID'
+    curl -H "Accept: text/plain" -X POST -d 'nodeID=TempConvertSoap_FahrenheitToCelsius&workflowInstanceId=ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4&data=testInputdata' http://localhost:9080/airavata-services/registry/api/update/workflownodeinput
+    curl -H "Accept: text/plain" -X POST -d 'nodeID=TempConvertSoap_FahrenheitToCelsius&workflowInstanceId=ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4&data=testOutputdata' http://localhost:9080/airavata-services/registry/api/update/workflownodeoutput
+
+
+****************** Experiment Data *************************************
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experiment?experimentId=ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experimentId/user?username=admin'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/experiment/user?username=admin'
+    curl -H "Accept: text/plain" -X POST -d 'workflowInstanceId=ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4&nodeId=TempConvertSoap_FahrenheitToCelsius&executionStatus=STARTED' http://localhost:9080/airavata-services/registry/api/update/workflownode/status
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/workflownode/status?workflowInstanceId=ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4&nodeId=TempConvertSoap_FahrenheitToCelsius'
+    curl --request GET 'http://localhost:9080/airavata-services/registry/api/get/workflownode/starttime?workflowInstanceId=ff7338c9-f9ad-4d86-b486-1e8e9c3a9cc4&nodeId=TempConvertSoap_FahrenheitToCelsius'
+
+
+
+********* Sample JSON message for Application and service *****************
+
+{
+   "name":"Tesing",
+   "cpuCount":"12",
+   "hostdescName":"localhost",
+   "executablePath":"cccc",
+   "workingDir":"dddd"
+   "maxMemory":"0",
+   "maxWallTime":"0",
+   "minMemory":"0",
+   "nodeCount":"1",
+   "processorsPerNode":"12",
+   "serviceDescriptor":{
+      "serviceName":"service1",
+      "inputParams":[
+         {
+            "dataType":"input",
+            "description":"myinput",
+            "name":"myinput",
+            "type":"String"
+         },
+         {
+            "dataType":"input",
+            "description":"myinput",
+            "name":"myinput",
+            "type":"String"
+         }
+      ],
+      "outputParams":[
+         {
+            "dataType":"output",
+            "description":"myoutput",
+            "name":"myoutput",
+            "type":"String"
+         },
+         {
+            "dataType":"output",
+            "description":"my output",
+            "name":"myoutput",
+            "type":"String"
+         }
+      ]
+   }
+}
+
+*** Sample XML message to create application and service
+
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?><application><applicationName>Testing</applicationName><cpuCount>0</cpuCount><hostdescName>localhost</hostdescName><maxMemory>0</maxMemory><maxWallTime>0</maxWallTime><minMemory>0</minMemory><nodeCount>0</nodeCount><processorsPerNode>0</processorsPerNode><serviceDesc><inputParams><dataType>input</dataType><description>my input</description><name>myinput</name><type>String</type></inputParams><inputParams><dataType>input</dataType><description>my input</description><name>myinput</name><type>String</type></inputParams><outputParams><dataType>output</dataType><description>my output</description><name>myoutput</name><type>String</type></outputParams><outputParams><dataType>output</dataType><description>my output</description><name>myoutput</name><type>String</type></outputParams></serviceDesc></application>
+
+
+
+
+

Added: airavata/trunk/modules/airavata-rest-services/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/pom.xml?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/pom.xml (added)
+++ airavata/trunk/modules/airavata-rest-services/pom.xml Tue Nov 13 15:52:16 2012
@@ -0,0 +1,208 @@
+<?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-services</artifactId>
+	<packaging>war</packaging>
+	<name>airavata-rest-services</name>
+	<build>
+		<finalName>airavata-rest-services</finalName>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.cargo</groupId>
+				<artifactId>cargo-maven2-plugin</artifactId>
+				<version>${cargo.version}</version>
+				<configuration>
+					<wait>true</wait>
+					<configuration>
+						<properties>
+							<cargo.servlet.port>9080</cargo.servlet.port>
+							<cargo.tomcat.ajp.port>9009</cargo.tomcat.ajp.port>
+							<cargo.rmi.port>9099</cargo.rmi.port>
+							<cargo.jvmargs>
+                                <![CDATA[-Xdebug -Xrunjdwp:transport=dt_socket,address=${cargo.debug.address},server=y,suspend=${cargo.debug.suspend} -noverify ${javaagent}]]>
+							</cargo.jvmargs>
+							<cargo.tomcat.context.reloadable>true</cargo.tomcat.context.reloadable>
+						</properties>
+						<home>${project.build.directory}/tomcat6x</home>
+						<deployables>
+							<deployable>
+								<groupId>org.apache.airavata</groupId>
+								<artifactId>airavata-rest-services</artifactId>
+								<type>war</type>
+								<properties>
+									<context>/airavata-services</context>
+								</properties>
+							</deployable>
+						</deployables>
+					</configuration>
+					<container>
+						<containerId>tomcat6x</containerId>
+						<timeout>180000</timeout>
+						<zipUrlInstaller>
+							<url>
+								http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32.tar.gz
+							</url>
+						</zipUrlInstaller>
+						<systemProperties>
+
+						</systemProperties>
+					</container>
+				</configuration>
+			</plugin>
+		</plugins>
+
+	</build>
+	<dependencies>
+		<dependency>
+			<groupId>com.sun.jersey</groupId>
+			<artifactId>jersey-servlet</artifactId>
+			<version>${jersey.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.sun.jersey</groupId>
+			<artifactId>jersey-json</artifactId>
+			<version>${jersey.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.sun.jersey.contribs</groupId>
+			<artifactId>jersey-multipart</artifactId>
+			<version>${jersey.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.sun.jersey.jersey-test-framework</groupId>
+			<artifactId>jersey-test-framework-grizzly2</artifactId>
+			<version>${jersey.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>com.sun.jersey</groupId>
+			<artifactId>jersey-server</artifactId>
+			<version>${jersey.version}</version>
+		</dependency>
+		<dependency>
+            <groupId>com.sun.jersey</groupId>
+            <artifactId>jersey-client</artifactId>
+			<version>${jersey.version}</version>
+		</dependency>
+        <!--dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <version>5.1.6</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>
+        <dependency>
+            <groupId>org.apache.airavata</groupId>
+            <artifactId>airavata-jpa-registry</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>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+			<version>${log4j.version}</version>
+		</dependency>
+        <!--dependency>
+              <groupId>org.apache.airavata</groupId>
+              <artifactId>airavata-security</artifactId>
+              <version>0.5-incubating-SNAPSHOT</version>
+          </dependency-->
+	</dependencies>
+	<properties>
+		<jersey.version>1.13</jersey.version>
+		<grizzly.version>2.0.0-M3</grizzly.version>
+		<org.slf4j.version>1.6.1</org.slf4j.version>
+		<log4j.version>1.2.16</log4j.version>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<cargo.version>1.2.1</cargo.version>
+		<!-- if you want a remote debugging on a different a address override on
+			command line with -Dcargo.debug.addres=xxxx -->
+		<cargo.debug.address>8000</cargo.debug.address>
+		<!-- if you want to start remote debugging session suspended override on
+			command line with -Dcargo.debug.suspend=y -->
+		<cargo.debug.suspend>n</cargo.debug.suspend>
+		<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-services/src/main/java/org/apache/airavata/services/registry/rest/Test.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/Test.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/Test.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/Test.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,145 @@
+/*
+*
+* 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;
+
+
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.services.registry.rest.client.ConfigurationResourceClient;
+import org.apache.airavata.services.registry.rest.client.DescriptorResourceClient;
+import org.apache.airavata.services.registry.rest.resourcemappings.HostDescriptor;
+
+import java.net.URI;
+import java.util.List;
+
+public class Test {
+    public static void main(String[] args) {
+        configurationResourceClientTest();
+//        descriptorClientTest();
+    }
+
+    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 descriptorClientTest(){
+        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();
+//        System.out.println(localHost.getType().getHostName());
+//        System.out.println(localHost.getType().getHostAddress());
+
+    }
+
+
+}

Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/ConfigurationResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/ConfigurationResourceClient.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/ConfigurationResourceClient.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/ConfigurationResourceClient.java Tue Nov 13 15:52:16 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.services.registry.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.services.registry.rest.resourcemappings.ConfigurationList;
+import org.apache.airavata.services.registry.rest.resourcemappings.URLList;
+import org.apache.airavata.services.registry.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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+                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("Failed : HTTP error code : " + status);
+                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("Failed : HTTP error code : " + status);
+                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("Failed : HTTP error code : " + status);
+                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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            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("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+}

Added: airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/DescriptorResourceClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/DescriptorResourceClient.java?rev=1408798&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/DescriptorResourceClient.java (added)
+++ airavata/trunk/modules/airavata-rest-services/src/main/java/org/apache/airavata/services/registry/rest/client/DescriptorResourceClient.java Tue Nov 13 15:52:16 2012
@@ -0,0 +1,488 @@
+/*
+ *
+ * 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.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.commons.gfac.type.ApplicationDeploymentDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.services.registry.rest.resourcemappings.*;
+import org.apache.airavata.services.registry.rest.utils.DescriptorUtil;
+import org.apache.airavata.services.registry.rest.utils.ResourcePathConstants;
+import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider;
+import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
+import org.codehaus.jackson.map.DeserializationConfig;
+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.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class DescriptorResourceClient {
+    private WebResource webResource;
+    private final static Logger logger = LoggerFactory.getLogger(DescriptorResourceClient.class);
+
+    private URI getBaseURI() {
+        logger.info("Creating Base URI");
+        return UriBuilder.fromUri("http://localhost:9080/airavata-services/").build();
+    }
+
+    private WebResource getDescriptorRegistryBaseResource (){
+        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.DecResourcePathConstants.DESC_RESOURCE_PATH);
+        return webResource;
+    }
+
+    public boolean isHostDescriptorExists(String hostDescriptorName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.HOST_DESC_EXISTS);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("hostDescriptorName", hostDescriptorName);
+        ClientResponse response = webResource.queryParams(queryParams).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        } else {
+            return true;
+        }
+    }
+
+    public void addHostDescriptor (HostDescription hostDescription){
+        HostDescriptor hostDescriptor = DescriptorUtil.createHostDescriptor(hostDescription);
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.HOST_DESC_SAVE);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, hostDescriptor);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void updateHostDescriptor (HostDescription hostDescription){
+        HostDescriptor hostDescriptor = DescriptorUtil.createHostDescriptor(hostDescription);
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.HOST_DESC_UPDATE);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, hostDescriptor);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public HostDescription getHostDescriptor (String hostName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.HOST_DESC);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("hostName", hostName);
+        ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).type(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        HostDescriptor hostDescriptor = response.getEntity(HostDescriptor.class);
+        HostDescription hostDescription = DescriptorUtil.createHostDescription(hostDescriptor);
+        return hostDescription;
+    }
+
+    public void removeHostDescriptor(String hostName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.HOST_DESC_DELETE);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("hostName", hostName);
+        ClientResponse response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public List<HostDescription> getHostDescriptors() {
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.GET_HOST_DESCS);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        HostDescriptionList hostDescriptionList = response.getEntity(HostDescriptionList.class);
+        HostDescriptor[] hostDescriptors = hostDescriptionList.getHostDescriptions();
+        List<HostDescription> hostDescriptions = new ArrayList<HostDescription>();
+        for (HostDescriptor hostDescriptor : hostDescriptors){
+           HostDescription hostDescription = DescriptorUtil.createHostDescription(hostDescriptor);
+            hostDescriptions.add(hostDescription);
+        }
+
+        return hostDescriptions;
+    }
+
+    public List<String> getHostDescriptorNames(){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.GET_HOST_DESCS_NAMES);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        DescriptorNameList descriptorNameList = response.getEntity(DescriptorNameList.class);
+        return descriptorNameList.getDescriptorNames();
+    }
+
+    public boolean isServiceDescriptorExists(String serviceDescriptorName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.SERVICE_DESC_EXISTS);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("serviceDescriptorName", serviceDescriptorName);
+        ClientResponse response = webResource.queryParams(queryParams).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        } else {
+            return true;
+        }
+    }
+
+    public void saveServiceDescriptor (ServiceDescription serviceDescription){
+        ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.SERVICE_DESC_SAVE);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, serviceDescriptor);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void updateServiceDescriptor(ServiceDescription serviceDescription){
+        ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.SERVICE_DESC_UPDATE);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, serviceDescriptor);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public ServiceDescription getServiceDescriptor (String serviceName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.SERVICE_DESC);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("serviceName", serviceName);
+        ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        ServiceDescriptor serviceDescriptor = response.getEntity(ServiceDescriptor.class);
+        ServiceDescription serviceDescription = DescriptorUtil.createServiceDescription(serviceDescriptor);
+        return serviceDescription;
+    }
+
+    public void removeServiceDescriptor(String serviceName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.SERVICE_DESC_DELETE);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("serviceName", serviceName);
+        ClientResponse response = webResource.queryParams(queryParams).delete(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public List<ServiceDescription> getServiceDescriptors (){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.GET_SERVICE_DESCS);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        ServiceDescriptionList serviceDescriptionList = response.getEntity(ServiceDescriptionList.class);
+        ServiceDescriptor[] serviceDescriptors = serviceDescriptionList.getServiceDescriptions();
+        List<ServiceDescription> serviceDescriptions = new ArrayList<ServiceDescription>();
+        for (ServiceDescriptor serviceDescriptor : serviceDescriptors){
+            ServiceDescription serviceDescription = DescriptorUtil.createServiceDescription(serviceDescriptor);
+            serviceDescriptions.add(serviceDescription);
+        }
+        return serviceDescriptions;
+    }
+
+    public boolean isApplicationDescriptorExist (String serviceName, String hostName, String appDescriptorName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APPL_DESC_EXIST);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("serviceName", serviceName);
+        queryParams.add("hostName", hostName);
+        queryParams.add("appDescName", appDescriptorName);
+        ClientResponse response = webResource.queryParams(queryParams).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        } else {
+            return true;
+        }
+    }
+
+    public void addApplicationDescriptor(ServiceDescription serviceDescription,
+                                         HostDescription hostDescriptor,
+                                         ApplicationDeploymentDescription descriptor){
+        ApplicationDescriptor applicationDescriptor = DescriptorUtil.createApplicationDescriptor(descriptor);
+        applicationDescriptor.setHostdescName(hostDescriptor.getType().getHostName());
+        ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
+        applicationDescriptor.setServiceDescriptor(serviceDescriptor);
+
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_BUILD_SAVE);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, applicationDescriptor);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void addApplicationDescriptor(String serviceName, String hostName, ApplicationDeploymentDescription descriptor){
+        ServiceDescription serviceDescription = getServiceDescriptor(serviceName);
+        ApplicationDescriptor applicationDescriptor = DescriptorUtil.createApplicationDescriptor(descriptor);
+        applicationDescriptor.setHostdescName(hostName);
+        ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
+        applicationDescriptor.setServiceDescriptor(serviceDescriptor);
+
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_BUILD_SAVE);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, applicationDescriptor);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void udpateApplicationDescriptor(ServiceDescription serviceDescription,
+                                            HostDescription hostDescriptor,
+                                            ApplicationDeploymentDescription descriptor){
+        ApplicationDescriptor applicationDescriptor = DescriptorUtil.createApplicationDescriptor(descriptor);
+        applicationDescriptor.setHostdescName(hostDescriptor.getType().getHostName());
+        ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
+        applicationDescriptor.setServiceDescriptor(serviceDescriptor);
+
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_UPDATE);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, applicationDescriptor);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public void updateApplicationDescriptor(String serviceName, String hostName, ApplicationDeploymentDescription descriptor){
+        ServiceDescription serviceDescription = getServiceDescriptor(serviceName);
+        ApplicationDescriptor applicationDescriptor = DescriptorUtil.createApplicationDescriptor(descriptor);
+        applicationDescriptor.setHostdescName(hostName);
+        ServiceDescriptor serviceDescriptor = DescriptorUtil.createServiceDescriptor(serviceDescription);
+        applicationDescriptor.setServiceDescriptor(serviceDescriptor);
+
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_UPDATE);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).post(ClientResponse.class, applicationDescriptor);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+    }
+
+    public ApplicationDeploymentDescription getApplicationDescriptor(String serviceName,
+                                                                     String hostname,
+                                                                     String applicationName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_DESCRIPTION);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("serviceName", serviceName);
+        queryParams.add("hostName", hostname);
+        queryParams.add("applicationName", applicationName);
+
+        ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        ApplicationDescriptor applicationDescriptor = response.getEntity(ApplicationDescriptor.class);
+        ApplicationDeploymentDescription applicationDeploymentDescription = DescriptorUtil.createApplicationDescription(applicationDescriptor);
+        return applicationDeploymentDescription;
+    }
+
+    public ApplicationDeploymentDescription getApplicationDescriptors(String serviceName, String hostname){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_PER_HOST_SERVICE);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("serviceName", serviceName);
+        queryParams.add("hostName", hostname);
+
+        ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        ApplicationDescriptor applicationDescriptor = response.getEntity(ApplicationDescriptor.class);
+        ApplicationDeploymentDescription applicationDeploymentDescription = DescriptorUtil.createApplicationDescription(applicationDescriptor);
+        return applicationDeploymentDescription;
+    }
+
+    public Map<String, ApplicationDeploymentDescription> getApplicationDescriptors(String serviceName){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_ALL_DESCS_SERVICE);
+        MultivaluedMap queryParams = new MultivaluedMapImpl();
+        queryParams.add("serviceName", serviceName);
+        ClientResponse response = webResource.queryParams(queryParams).accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        ApplicationDescriptorList applicationDescriptorList = response.getEntity(ApplicationDescriptorList.class);
+        ApplicationDescriptor[] applicationDescriptors = applicationDescriptorList.getApplicationDescriptors();
+        Map<String, ApplicationDeploymentDescription> applicationDeploymentDescriptionMap = new HashMap<String, ApplicationDeploymentDescription>();
+        for (ApplicationDescriptor applicationDescriptor : applicationDescriptors){
+            ApplicationDeploymentDescription applicationDeploymentDescription = DescriptorUtil.createApplicationDescription(applicationDescriptor);
+            applicationDeploymentDescriptionMap.put(applicationDescriptor.getHostdescName(), applicationDeploymentDescription);
+        }
+        return applicationDeploymentDescriptionMap;
+    }
+
+    public Map<String[], ApplicationDeploymentDescription> getApplicationDescriptors(){
+        Map<String[], ApplicationDeploymentDescription> applicationDeploymentDescriptionMap = new HashMap<String[], ApplicationDeploymentDescription>();
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_ALL_DESCRIPTORS);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        ApplicationDescriptorList applicationDescriptorList = response.getEntity(ApplicationDescriptorList.class);
+        ApplicationDescriptor[] applicationDescriptors = applicationDescriptorList.getApplicationDescriptors();
+        for (ApplicationDescriptor applicationDescriptor : applicationDescriptors){
+            ApplicationDeploymentDescription applicationDeploymentDescription = DescriptorUtil.createApplicationDescription(applicationDescriptor);
+            String[] descriptors = {applicationDescriptor.getServiceDescriptor().getServiceName(), applicationDescriptor.getHostdescName()};
+            applicationDeploymentDescriptionMap.put(descriptors, applicationDeploymentDescription);
+        }
+        return applicationDeploymentDescriptionMap;
+    }
+
+    private List<String> getApplicationDescriptorNames (){
+        webResource = getDescriptorRegistryBaseResource().path(ResourcePathConstants.DecResourcePathConstants.APP_DESC_NAMES);
+        ClientResponse response = webResource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
+        int status = response.getStatus();
+
+        if (status != 200) {
+            logger.error("Failed : HTTP error code : " + status);
+            throw new RuntimeException("Failed : HTTP error code : "
+                    + status);
+        }
+
+        DescriptorNameList descriptorNameList = response.getEntity(DescriptorNameList.class);
+        return descriptorNameList.getDescriptorNames();
+    }
+}



Mime
View raw message