You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by pa...@apache.org on 2011/09/02 01:14:33 UTC

svn commit: r1164298 - /incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/impl/JCRRegistry.java

Author: patanachai
Date: Thu Sep  1 23:14:33 2011
New Revision: 1164298

URL: http://svn.apache.org/viewvc?rev=1164298&view=rev
Log:
Implement search service method

Modified:
    incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/impl/JCRRegistry.java

Modified: incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/impl/JCRRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/impl/JCRRegistry.java?rev=1164298&r1=1164297&r2=1164298&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/impl/JCRRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/impl/JCRRegistry.java Thu Sep  1 23:14:33 2011
@@ -343,8 +343,27 @@ public class JCRRegistry implements Axis
 	}
 
 	public List<ServiceDescription> searchServiceDescription(String name) {
-		// TODO implementation
-		return null;
+	    Session session = null;
+        ArrayList<ServiceDescription> result = new ArrayList<ServiceDescription>();
+        try {
+            session = getSession();
+            Node node = getServiceNode(session);
+            NodeIterator nodes = node.getNodes();
+            for (; nodes.hasNext();) {
+                Node service = nodes.nextNode();
+                Property prop = service.getProperty(XML_PROPERTY_NAME);
+                result.add((ServiceDescription) SchemaUtil.parseFromXML(prop.getString()));
+            }
+        } catch (Exception e) {
+            System.out.println(e);
+            e.printStackTrace();
+            // TODO propagate
+        } finally {
+            if (session != null && session.isLive()) {
+                session.logout();
+            }
+        }	   
+		return result;
 	}
 
 	public List<ApplicationDeploymentDescription> searchDeploymentDescription(