You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2012/09/10 01:22:32 UTC

svn commit: r1382608 - in /incubator/airavata/trunk/modules/commons: common-registry-api/src/main/java/org/apache/airavata/common/registry/api/impl/ registry-api/src/main/java/org/apache/airavata/registry/api/ registry-api/src/main/java/org/apache/aira...

Author: lahiru
Date: Sun Sep  9 23:22:32 2012
New Revision: 1382608

URL: http://svn.apache.org/viewvc?rev=1382608&view=rev
Log:
minor changes to new structure

Added:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry1.java
      - copied, changed from r1382023, incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java
Removed:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java
    incubator/airavata/trunk/modules/commons/registry-service/
Modified:
    incubator/airavata/trunk/modules/commons/common-registry-api/src/main/java/org/apache/airavata/common/registry/api/impl/JCRRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Axis2Registry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Gateway.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java

Modified: incubator/airavata/trunk/modules/commons/common-registry-api/src/main/java/org/apache/airavata/common/registry/api/impl/JCRRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/common-registry-api/src/main/java/org/apache/airavata/common/registry/api/impl/JCRRegistry.java?rev=1382608&r1=1382607&r2=1382608&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/common-registry-api/src/main/java/org/apache/airavata/common/registry/api/impl/JCRRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/common-registry-api/src/main/java/org/apache/airavata/common/registry/api/impl/JCRRegistry.java Sun Sep  9 23:22:32 2012
@@ -251,7 +251,7 @@ public class JCRRegistry extends Observa
         this.credentials = credentials;
     }
 
-	protected Node getRootNode(Session session) throws RepositoryException {
+	public Node getRootNode(Session session) throws RepositoryException {
 		String ROOT_NODE_TEXT = "root";
 		if (!getSessionNodes().containsKey(null) || !getSessionNodes().get(null).get(ROOT_NODE_TEXT).getSession().isLive()){
 			getSessionNodes().put(null, new HashMap<String, Node>());
@@ -320,7 +320,7 @@ public class JCRRegistry extends Observa
         return session;
     }
 
-    protected Node getOrAddNode(Node node, String name) throws RepositoryException {
+    public Node getOrAddNode(Node node, String name) throws RepositoryException {
     	Map<Node, Map<String, Node>> sessionNodes = getSessionNodes();
     	if (sessionNodes.containsKey(node)){
     		if (sessionNodes.get(node)!=null && sessionNodes.get(node).containsKey(name)){

Copied: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry1.java (from r1382023, incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry1.java?p2=incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry1.java&p1=incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java&r1=1382023&r2=1382608&rev=1382608&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/AiravataRegistry1.java Sun Sep  9 23:22:32 2012
@@ -41,7 +41,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.registry.api.workflow.*;
 import org.apache.airavata.registry.api.workflow.WorkflowInstanceStatus.ExecutionStatus;
 
-public interface AiravataRegistry extends Registry{
+public interface AiravataRegistry1 extends Registry{
     /**
      * Find locations where the service is deployed
      * 

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Axis2Registry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Axis2Registry.java?rev=1382608&r1=1382607&r2=1382608&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Axis2Registry.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Axis2Registry.java Sun Sep  9 23:22:32 2012
@@ -24,7 +24,7 @@ package org.apache.airavata.registry.api
 import org.apache.airavata.common.registry.api.exception.RegistryException;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 
-public interface Axis2Registry extends AiravataRegistry{
+public interface Axis2Registry extends AiravataRegistry1 {
 
     /**
      * Load WSDL for Axis2

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Gateway.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Gateway.java?rev=1382608&r1=1382607&r2=1382608&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Gateway.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/Gateway.java Sun Sep  9 23:22:32 2012
@@ -22,7 +22,7 @@
 package org.apache.airavata.registry.api;
 
 public class Gateway {
-	private String gatewayName;
+	private String gatewayName = "default";
 	
 	public Gateway(String gatewayName) {
 		setGatewayName(gatewayName);

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java?rev=1382608&r1=1382607&r2=1382608&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java (original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java Sun Sep  9 23:22:32 2012
@@ -1,33 +1,37 @@
-/*
- *
- * 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.
- *
- */
-
+/*
+ *
+ * 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.registry.api.util;
 
-import org.apache.airavata.commons.gfac.type.ServiceDescription;
-import org.apache.airavata.schemas.gfac.InputParameterType;
-import org.apache.airavata.schemas.gfac.OutputParameterType;
-import org.apache.airavata.schemas.gfac.ServiceDescriptionType;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.commons.gfac.wsdl.WSDLConstants;
+import org.apache.airavata.commons.gfac.wsdl.WSDLGenerator;
+import org.apache.airavata.schemas.gfac.*;
+
+import java.util.Hashtable;
 
 public class WebServiceUtil {
 
+
+
     public static String generateWSDL(ServiceDescription service) {
         StringBuilder builder = new StringBuilder();
         builder.append("<wsdl:definitions xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\" xmlns:ns1=\"http://org.apache.axis2/xsd\" xmlns:ns=\"http://www.wso2.org/types\" xmlns:wsaw=\"http://www.w3.org/2006/05/addressing/wsdl\" xmlns:http=\"http://schemas.xmlsoap.org/wsdl/http/\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:mime=\"http://schemas.xmlsoap.org/wsdl/mime/\" xmlns:soap12=\"http://schemas.xmlsoap.org/wsdl/soap12/\" targetNamespace=\"http://www.wso2.org/types\">");
@@ -167,4 +171,32 @@ public class WebServiceUtil {
 
     }
 
+    public static String getWSDL(ServiceDescription service) throws Exception{
+        try {
+
+            ServiceType type = service.getType().addNewService();
+            ServiceType.ServiceName name = type.addNewServiceName();
+            name.setStringValue(service.getType().getName());
+            name.setTargetNamespace("http://schemas.airavata.apache.org/gfac/type");
+            if(service.getType().getPortType() == null){
+                PortTypeType portType = service.getType().addNewPortType();
+                MethodType methodType = portType.addNewMethod();
+                methodType.setMethodName("invoke");
+            }else{
+                MethodType method = service.getType().getPortType().getMethod();
+                if (method == null) {
+                    MethodType methodType = service.getType().getPortType().addNewMethod();
+                    methodType.setMethodName("invoke");
+                } else {
+                    service.getType().getPortType().getMethod().setMethodName("invoke");
+                }
+            }
+            WSDLGenerator generator = new WSDLGenerator();
+            Hashtable table = generator.generateWSDL(null, null, null, service.getType(), true);
+            return (String) table.get(WSDLConstants.AWSDL);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
+
 }