You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2012/10/19 21:40:02 UTC

svn commit: r1400248 - in /airavata/sandbox/airavata-registry-rest: README.txt src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java

Author: chathuri
Date: Fri Oct 19 19:40:01 2012
New Revision: 1400248

URL: http://svn.apache.org/viewvc?rev=1400248&view=rev
Log:
updating configuration related methods

Modified:
    airavata/sandbox/airavata-registry-rest/README.txt
    airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java

Modified: airavata/sandbox/airavata-registry-rest/README.txt
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/README.txt?rev=1400248&r1=1400247&r2=1400248&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/README.txt (original)
+++ airavata/sandbox/airavata-registry-rest/README.txt Fri Oct 19 19:40:01 2012
@@ -5,7 +5,38 @@ For development run
 mvn cargo:start
 
 To test
-* Start jackrabbit on port 8081
-* for simple methods you can use curl for testing. For example, if you want to get the usename, you can run the command
-curl -v http://localhost:9080/airavata-services/registry/api/username. This will return "admin" for the moment.
+* 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*********************************
+
+
+
+
+
 

Modified: airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java?rev=1400248&r1=1400247&r2=1400248&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java (original)
+++ airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java Fri Oct 19 19:40:01 2012
@@ -139,10 +139,12 @@ import java.util.Map;
     @Produces("text/plain")
     public Response addConfiguration(@FormParam("key") String key,
                                      @FormParam("value") String value,
-                                     @FormParam("date") Date date) {
+                                     @FormParam("date") String date) {
         try{
+            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date formattedDate = dateFormat.parse(date);
             airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
-            airavataRegistry.addConfiguration(key, value, date);
+            airavataRegistry.addConfiguration(key, value, formattedDate);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         }catch (Exception e){
@@ -245,7 +247,7 @@ import java.util.Map;
             URI eventingServiceURI = airavataRegistry.getEventingServiceURI();
             if (eventingServiceURI != null) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(eventingServiceURI);
+                builder.entity(eventingServiceURI.toString());
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
@@ -266,7 +268,7 @@ import java.util.Map;
             URI eventingServiceURI = airavataRegistry.getMessageBoxURI();
             if (eventingServiceURI != null) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
-                builder.entity(eventingServiceURI);
+                builder.entity(eventingServiceURI.toString());
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
@@ -281,10 +283,11 @@ import java.util.Map;
     @POST
     @Path("add/gfacuri")
     @Produces("text/plain")
-    public Response addGFacURI(@FormParam("uri") URI uri) {
+    public Response addGFacURI(@FormParam("uri") String uri) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.addGFacURI(uri);
+            URI gfacURI = new URI(uri);
+            airavataRegistry.addGFacURI(gfacURI);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -296,10 +299,11 @@ import java.util.Map;
     @POST
     @Path("add/workflowinterpreteruri")
     @Produces("text/plain")
-    public Response addWorkflowInterpreterURI(@FormParam("uri") URI uri) {
+    public Response addWorkflowInterpreterURI(@FormParam("uri") String uri) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.addWorkflowInterpreterURI(uri);
+            URI interpreterURI = new URI(uri);
+            airavataRegistry.addWorkflowInterpreterURI(interpreterURI);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -311,10 +315,11 @@ import java.util.Map;
     @POST
     @Path("add/eventinguri")
     @Produces("text/plain")
-    public Response setEventingURI(@FormParam("uri") URI uri) {
+    public Response setEventingURI(@FormParam("uri") String uri) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.setEventingURI(uri);
+            URI eventingURI = new URI(uri);
+            airavataRegistry.setEventingURI(eventingURI);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -326,10 +331,11 @@ import java.util.Map;
     @POST
     @Path("add/msgboxuri")
     @Produces("text/plain")
-    public Response setMessageBoxURI(@FormParam("uri") URI uri) {
+    public Response setMessageBoxURI(@FormParam("uri") String uri) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.setMessageBoxURI(uri);
+            URI msgBoxURI = new URI(uri);
+            airavataRegistry.setMessageBoxURI(msgBoxURI);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -341,10 +347,13 @@ import java.util.Map;
     @POST
     @Path("add/gfacuri/date")
     @Produces("text/plain")
-    public Response addGFacURIByDate(@FormParam("uri") URI uri, @FormParam("date") Date date) {
+    public Response addGFacURIByDate(@FormParam("uri") String uri, @FormParam("date") String date) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.addGFacURI(uri, date);
+            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date formattedDate = dateFormat.parse(date);
+            URI gfacURI = new URI(uri);
+            airavataRegistry.addGFacURI(gfacURI, formattedDate);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -356,10 +365,13 @@ import java.util.Map;
     @POST
     @Path("add/workflowinterpreteruri/date")
     @Produces("text/plain")
-    public Response addWorkflowInterpreterURI(@FormParam("uri") URI uri, @FormParam("date") Date date) {
+    public Response addWorkflowInterpreterURI(@FormParam("uri") String uri, @FormParam("date") String date) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.addWorkflowInterpreterURI(uri, date);
+            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date formattedDate = dateFormat.parse(date);
+            URI interpreterURI = new URI(uri);
+            airavataRegistry.addWorkflowInterpreterURI(interpreterURI, formattedDate);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -371,10 +383,13 @@ import java.util.Map;
     @POST
     @Path("add/eventinguri/date")
     @Produces("text/plain")
-    public Response setEventingURIByDate(@FormParam("uri") URI uri, @FormParam("date") Date date) {
+    public Response setEventingURIByDate(@FormParam("uri") String uri, @FormParam("date") String date) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.setEventingURI(uri, date);
+            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date formattedDate = dateFormat.parse(date);
+            URI eventingURI = new URI(uri);
+            airavataRegistry.setEventingURI(eventingURI, formattedDate);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -386,10 +401,13 @@ import java.util.Map;
     @POST
     @Path("add/msgboxuri/date")
     @Produces("text/plain")
-    public Response setMessageBoxURIByDate(@FormParam("uri") URI uri, @FormParam("date") Date date) {
+    public Response setMessageBoxURIByDate(@FormParam("uri") String uri, @FormParam("date") String date) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.setMessageBoxURI(uri, date);
+            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            Date formattedDate = dateFormat.parse(date);
+            URI msgBoxURI = new URI(uri);
+            airavataRegistry.setMessageBoxURI(msgBoxURI, formattedDate);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -401,10 +419,11 @@ import java.util.Map;
     @DELETE
     @Path("delete/gfacuri")
     @Produces("text/plain")
-    public Response removeGFacURI(@QueryParam("uri") URI uri) {
+    public Response removeGFacURI(@QueryParam("uri") String uri) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.removeGFacURI(uri);
+            URI gfacURI = new URI(uri);
+            airavataRegistry.removeGFacURI(gfacURI);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         } catch (Exception e){
@@ -431,10 +450,11 @@ import java.util.Map;
     @DELETE
     @Path("delete/workflowinterpreteruri")
     @Produces("text/plain")
-    public Response removeWorkflowInterpreterURI(@QueryParam("uri") URI uri) {
+    public Response removeWorkflowInterpreterURI(@QueryParam("uri") String uri) {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try{
-            airavataRegistry.removeWorkflowInterpreterURI(uri);
+            URI intURI = new URI(uri);
+            airavataRegistry.removeWorkflowInterpreterURI(intURI);
             Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
             return builder.build();
         }catch (Exception e){