You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by he...@apache.org on 2012/10/29 15:32:33 UTC
svn commit: r1403313 -
/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java
Author: heshan
Date: Mon Oct 29 14:32:33 2012
New Revision: 1403313
URL: http://svn.apache.org/viewvc?rev=1403313&view=rev
Log:
Updating hostDescritor save method. (Commented out the previous methoda for future referance.
Modified:
airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resources/RegistryResource.java
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=1403313&r1=1403312&r2=1403313&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 Mon Oct 29 14:32:33 2012
@@ -14,6 +14,7 @@ import org.apache.airavata.schemas.gfac.
import org.apache.airavata.services.registry.rest.resourcemappings.*;
import org.apache.airavata.registry.api.AiravataExperiment;
import org.apache.airavata.services.registry.rest.resourcemappings.WorkflowInstanceMapping;
+import org.apache.airavata.services.registry.rest.utils.DescriptorUtil;
import org.apache.airavata.services.registry.rest.utils.HostTypes;
import org.apache.airavata.services.registry.rest.utils.RestServicesConstants;
import org.apache.axiom.om.OMElement;
@@ -540,6 +541,30 @@ import java.util.*;
@POST
@Path("hostdescriptor/save")
+ @Produces(MediaType.TEXT_PLAIN)
+ @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
+ public Response addHostDescriptor(@FormParam("hostName") String hostName,
+ @FormParam("hostAddress") String hostAddress,
+ @FormParam("hostEndpoint") String hostEndpoint,
+ @FormParam("gatekeeperEndpoint") String gatekeeperEndpoint) {
+ airavataRegistry = (AiravataRegistry2) context.getAttribute(RestServicesConstants.AIRAVATA_REGISTRY);
+ try{
+ HostDescription hostDescription = DescriptorUtil.createHostDescription(hostName, hostAddress, hostEndpoint, gatekeeperEndpoint);
+ airavataRegistry.addHostDescriptor(hostDescription);
+ Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);
+ return builder.build();
+ } catch (DescriptorAlreadyExistsException e){
+ Response.ResponseBuilder builder = Response.status(Response.Status.BAD_REQUEST);
+ // TODO : Use WEbapplicationExcpetion
+ return builder.build();
+ } catch (RegistryException e) {
+ Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+ return builder.build();
+ }
+ }
+
+/* @POST
+ @Path("hostdescriptor/save")
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
public Response addHostDescriptor(HostDescriptor host) {
@@ -567,7 +592,7 @@ import java.util.*;
Response.ResponseBuilder builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
return builder.build();
}
- }
+ }*/
@POST
@Path("hostdescriptor/update")