airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patanac...@apache.org
Subject svn commit: r1161244 - in /incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api: Axis2Registry.java impl/JCRRegistry.java
Date Wed, 24 Aug 2011 19:39:39 GMT
Author: patanachai
Date: Wed Aug 24 19:39:39 2011
New Revision: 1161244

URL: http://svn.apache.org/viewvc?rev=1161244&view=rev
Log:
Add saveWSDL and getWSDL to registry API

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

Added: incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/Axis2Registry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/Axis2Registry.java?rev=1161244&view=auto
==============================================================================
--- incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/Axis2Registry.java
(added)
+++ incubator/airavata/trunk/modules/commons/gfac-schema/src/main/java/org/apache/airavata/core/gfac/api/Axis2Registry.java
Wed Aug 24 19:39:39 2011
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.core.gfac.api;
+
+import org.apache.airavata.core.gfac.type.ServiceDescription;
+
+
+public interface Axis2Registry extends Registry {
+    
+    /**
+     * Save WSDL for Axis2
+     * 
+     * @param service
+     * @param WSDL
+     */
+    public String saveWSDL(String serviceName, String WSDL);
+    
+    /**
+     * Save WSDL for Axis2
+     * 
+     * @param serviceName
+     * @param service
+     */
+    public String saveWSDL(String serviceName, ServiceDescription service);
+    
+    
+    /**
+     * Load WSDL for Axis2
+     * 
+     * @param serviceName
+     * @return WSDL
+     */
+    public String getWSDL(String serviceName);
+}

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=1161244&r1=1161243&r2=1161244&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
Wed Aug 24 19:39:39 2011
@@ -38,7 +38,7 @@ import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 import javax.jcr.Value;
 
-import org.apache.airavata.core.gfac.api.Registry;
+import org.apache.airavata.core.gfac.api.Axis2Registry;
 import org.apache.airavata.core.gfac.type.ApplicationDeploymentDescription;
 import org.apache.airavata.core.gfac.type.HostDescription;
 import org.apache.airavata.core.gfac.type.ServiceDescription;
@@ -46,12 +46,13 @@ import org.apache.airavata.core.gfac.typ
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class JCRRegistry implements Registry {
+public class JCRRegistry implements Axis2Registry {
 
 	private static final String SERVICE_NODE_NAME = "SERVICE_HOST";
 	private static final String DEPLOY_NODE_NAME = "APP_HOST";
 	private static final String HOST_NODE_NAME = "GFAC_HOST";
 	private static final String XML_PROPERTY_NAME = "XML";
+	private static final String WSDL_PROPERTY_NAME = "WSDL";
 	private static final String LINK_NAME = "LINK";
 
 	private Repository repository;
@@ -351,4 +352,53 @@ public class JCRRegistry implements Regi
 		// TODO implementation
 		return null;
 	}
+
+    public String saveWSDL(String name, String WSDL) {
+        Session session = null;
+        String result = null;
+        try {
+            session = getSession();
+            Node serviceNode = getServiceNode(session);
+            Node node = getOrAddNode(serviceNode, name);
+            node.setProperty(WSDL_PROPERTY_NAME, WSDL);
+            session.save();
+
+            result = node.getIdentifier();
+        } catch (Exception e) {
+            System.out.println(e);
+            e.printStackTrace();
+            // TODO propagate
+        } finally {
+            if (session != null && session.isLive()) {
+                session.logout();
+            }
+        }
+        return result;        
+    }
+
+    public String saveWSDL(String serviceName, ServiceDescription service) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getWSDL(String serviceName) {
+        Session session = null;
+        String result = null;
+        try {
+            session = getSession();
+            Node serviceNode = getServiceNode(session);
+            Node node = serviceNode.getNode(serviceName);
+            Property prop = node.getProperty(WSDL_PROPERTY_NAME);
+            result = prop.getString();
+        } catch (Exception e) {
+            System.out.println(e);
+            e.printStackTrace();
+            // TODO propagate
+        } finally {
+            if (session != null && session.isLive()) {
+                session.logout();
+            }
+        }
+        return result;
+    }
 }



Mime
View raw message