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/23 23:20:41 UTC

svn commit: r1401492 - in /airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest: resourcemappings/HostDescriptionList.java resourcemappings/HostDescriptor.java resources/RegistryResource.java

Author: chathuri
Date: Tue Oct 23 21:20:41 2012
New Revision: 1401492

URL: http://svn.apache.org/viewvc?rev=1401492&view=rev
Log:
updating getHostDescriptors method

Modified:
    airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptionList.java
    airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptor.java
    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/resourcemappings/HostDescriptionList.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptionList.java?rev=1401492&r1=1401491&r2=1401492&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptionList.java (original)
+++ airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptionList.java Tue Oct 23 21:20:41 2012
@@ -20,19 +20,18 @@
  */
 package org.apache.airavata.services.registry.rest.resourcemappings;
 
-import org.apache.airavata.commons.gfac.type.HostDescription;
 
 import javax.xml.bind.annotation.XmlRootElement;
 
 @XmlRootElement
 public class HostDescriptionList {
-    private HostDescription[] hostDescriptions = null;
+    private HostDescriptor[] hostDescriptions = null;
 
-    public HostDescription[] getHostDescriptions() {
+    public HostDescriptor[] getHostDescriptions() {
         return hostDescriptions;
     }
 
-    public void setHostDescriptions(HostDescription[] hostDescriptions) {
+    public void setHostDescriptions(HostDescriptor[] hostDescriptions) {
         this.hostDescriptions = hostDescriptions;
     }
 

Modified: airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptor.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptor.java?rev=1401492&r1=1401491&r2=1401492&view=diff
==============================================================================
--- airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptor.java (original)
+++ airavata/sandbox/airavata-registry-rest/src/main/java/org/apache/airavata/services/registry/rest/resourcemappings/HostDescriptor.java Tue Oct 23 21:20:41 2012
@@ -23,7 +23,18 @@ package org.apache.airavata.services.reg
 
 import javax.xml.bind.annotation.XmlRootElement;
 
-@XmlRootElement(name="stream")
+@XmlRootElement
 public class HostDescriptor {
+    private String hostDocument;
 
+    public HostDescriptor() {
+    }
+
+    public String getHostDocument() {
+        return hostDocument;
+    }
+
+    public void setHostDocument(String hostDocument) {
+        this.hostDocument = hostDocument;
+    }
 }

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=1401492&r1=1401491&r2=1401492&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 Tue Oct 23 21:20:41 2012
@@ -624,23 +624,22 @@ import java.util.Map;
     @GET
     @Path("get/hostdescriptors")
     @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response getHostDescriptors(){
+    public Response getHostDescriptors() {
         airavataRegistry = (AiravataRegistry2) context.getAttribute(AIRAVATA_CONTEXT);
         try {
             List<HostDescription> hostDescriptionList = airavataRegistry.getHostDescriptors();
             HostDescriptionList list = new HostDescriptionList();
-            HostDescription[] hostDescriptions = new HostDescription[hostDescriptionList.size()];
+            HostDescriptor[] hostDescriptions = new HostDescriptor[hostDescriptionList.size()];
             for (int i = 0; i < hostDescriptionList.size(); i++) {
-                hostDescriptions[i] = hostDescriptionList.get(i);
+                HostDescriptor hostDescriptor = new HostDescriptor();
+                String document = hostDescriptionList.get(i).toXML();
+                hostDescriptor.setHostDocument(document);
+                hostDescriptions[i] = hostDescriptor;
             }
             list.setHostDescriptions(hostDescriptions);
             if (hostDescriptionList.size() != 0) {
                 Response.ResponseBuilder builder = Response.status(Response.Status.OK);
                 builder.entity(list);
-                HostDescription[] descriptions = list.getHostDescriptions();
-                for (int i =0; i < descriptions.length; i++){
-                    System.out.println("*********host[" + i + "] =" + descriptions[i].getType().getHostName() );
-                }
                 return builder.build();
             } else {
                 Response.ResponseBuilder builder = Response.status(Response.Status.NO_CONTENT);