airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1182607 - in /incubator/airavata/trunk/modules: commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/ commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/ xbaya-gui/src/main/java/org/apache/airavata...
Date Wed, 12 Oct 2011 22:48:20 GMT
Author: lahiru
Date: Wed Oct 12 22:48:19 2011
New Revision: 1182607

URL: http://svn.apache.org/viewvc?rev=1182607&view=rev
Log:
https://issues.apache.org/jira/browse/AIRAVATA-137 autogenerate wsdl & save when creating
a service description

Modified:
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
    incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/util/WebServiceUtil.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionDialog.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/JCRComponentRegistry.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/ws/WSComponent.java

Modified: incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java?rev=1182607&r1=1182606&r2=1182607&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
(original)
+++ incubator/airavata/trunk/modules/commons/registry-api/src/main/java/org/apache/airavata/registry/api/impl/JCRRegistry.java
Wed Oct 12 22:48:19 2011
@@ -283,8 +283,6 @@ public class JCRRegistry implements Axis
             session.save();
 
             result = node.getIdentifier();
-            
-    		//TODO save the wsdl for this service as well
 
         } catch (Exception e) {
             System.out.println(e);

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=1182607&r1=1182606&r2=1182607&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
Wed Oct 12 22:48:19 2011
@@ -14,7 +14,8 @@ public class WebServiceUtil {
         builder.append("<wsdl:types>");
         builder.append("<xs:schema attributeFormDefault=\"qualified\" elementFormDefault=\"unqualified\"
targetNamespace=\"http://www.wso2.org/types\">");
 
-        if (service.getInputParameters() != null && service.getInputParameters().size()
> 0) {
+        boolean isInputParametersPresent = service.getInputParameters() != null &&
service.getInputParameters().size() > 0;
+		if (isInputParametersPresent) {
             builder.append("<xs:element name=\"invoke\">");
             builder.append("<xs:complexType>");
             builder.append("<xs:sequence>");
@@ -28,7 +29,8 @@ public class WebServiceUtil {
             builder.append("</xs:element>");
         }
 
-        if (service.getOutputParameters() != null && service.getOutputParameters().size()
> 0) {
+		boolean isOutputParametersPresent = service.getOutputParameters() != null && service.getOutputParameters().size()
> 0;
+		if (isOutputParametersPresent) {
             builder.append("<xs:element name=\"invokeResponse\">");
             builder.append("<xs:complexType>");
             builder.append("<xs:sequence>");
@@ -46,18 +48,24 @@ public class WebServiceUtil {
         builder.append("</wsdl:types>");
 
         builder.append("<wsdl:message name=\"invokeRequest\">");
-        builder.append("<wsdl:part name=\"parameters\" element=\"ns:invoke\"/>");
-        builder.append("</wsdl:message>");
-        builder.append("<wsdl:message name=\"invokeResponse\">");
-        builder.append("<wsdl:part name=\"parameters\" element=\"ns:invokeResponse\"/>");
-        builder.append("</wsdl:message>");
+        if (isInputParametersPresent) {
+			builder.append("<wsdl:part name=\"parameters\" element=\"ns:invoke\"/>");
+		}
+		builder.append("</wsdl:message>");
+        if (isOutputParametersPresent) {
+        	builder.append("<wsdl:message name=\"invokeResponse\">");
+			builder.append("<wsdl:part name=\"parameters\" element=\"ns:invokeResponse\"/>");
+			builder.append("</wsdl:message>");
+        }
 
         builder.append("<wsdl:portType name=\"");
         builder.append(service.getId());
         builder.append("\">");
         builder.append("<wsdl:operation name=\"invoke\">");
         builder.append("<wsdl:input message=\"ns:invokeRequest\" wsaw:Action=\"urn:invoke\"/>");
-        builder.append("<wsdl:output message=\"ns:invokeResponse\" wsaw:Action=\"urn:invokeResponse\"/>");
+        if (isOutputParametersPresent) {
+			builder.append("<wsdl:output message=\"ns:invokeResponse\" wsaw:Action=\"urn:invokeResponse\"/>");
+		}
         builder.append("</wsdl:operation>");
         builder.append("</wsdl:portType>");
 
@@ -67,9 +75,42 @@ public class WebServiceUtil {
     }
 
     private static void generateElementFromType(Parameter parameter, StringBuilder builder)
{
-        builder.append("<xs:element minOccurs=\"0\" name=\"");
-        builder.append(parameter.getName());
-        builder.append("\" nillable=\"true\" type=\"xs:string\"/>");
+        switch (parameter.getType()) {
+	        case String:
+	            builder.append("<xs:element minOccurs=\"0\" name=\"");
+	            builder.append(parameter.getName());
+	            builder.append("\" nillable=\"true\" type=\"xs:string\"/>");
+	            break;
+	        case Integer:
+	        	builder.append("<xs:element minOccurs=\"0\" name=\"");
+	            builder.append(parameter.getName());
+	            builder.append("\" type=\"xs:int\"/>");
+	            break;
+	        case Boolean:
+	        	builder.append("<xs:element minOccurs=\"0\" name=\"");
+	            builder.append(parameter.getName());
+	            builder.append("\" type=\"xs:boolean\"/>");
+	            break;
+	        case Double:
+	        	builder.append("<xs:element minOccurs=\"0\" name=\"");
+	            builder.append(parameter.getName());
+	            builder.append("\" type=\"xs:double\"/>");
+	            break;
+	        case Float:
+	        	builder.append("<xs:element minOccurs=\"0\" name=\"");
+	            builder.append(parameter.getName());
+	            builder.append("\" type=\"xs:float\"/>");
+	            break;
+	        case File:
+	        	//TODO adding this means adding a new complex type for File type
+//	        	builder.append("<xs:element minOccurs=\"0\" name=\"");
+//	            builder.append(parameter.getName());
+//	            builder.append("\"  nillable=\"true\" type=\"ax22:File\"/>");
+//	            break;
+	        
+	        default:
+	            break;
+        }
 
     }
 

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java?rev=1182607&r1=1182606&r2=1182607&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/RegisterApplicationsMenu.java
Wed Oct 12 22:48:19 2011
@@ -31,6 +31,7 @@ import javax.swing.JMenuItem;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.component.gui.JCRRegistryWindow;
 import org.apache.airavata.xbaya.myproxy.gui.MyProxyChecker;
+import org.apache.airavata.xbaya.registrybrowser.JCRBrowserDialog;
 
 public class RegisterApplicationsMenu {
 
@@ -95,6 +96,7 @@ public class RegisterApplicationsMenu {
     }
     
     private void createRegisterThroughFile() {
+    	
         this.registerThroughFile = new JMenuItem("Register Description Through File");
 
         this.registerThroughFile.addActionListener(new AbstractAction() {
@@ -102,26 +104,27 @@ public class RegisterApplicationsMenu {
 
             @Override
             public void actionPerformed(ActionEvent e) {
-                if (this.window == null) {
-                    RegisterApplicationsMenu.this.myProxyChecker = new MyProxyChecker(
-                            RegisterApplicationsMenu.this.engine);
-                    boolean loaded = RegisterApplicationsMenu.this.myProxyChecker.loadIfNecessary();
-                    if (loaded) {
-                        // intended to be blank
-                    } else {
-                        return; // error
-                    }
-
-                    this.window = RegisterThroughFileWindow.getInstance();
-                }
-                if (!this.window.isEngineSet()) {
-                    this.window.setXBayaEngine(RegisterApplicationsMenu.this.engine);
-                }
-                try {
-                    this.window.show();
-                } catch (Exception e1) {
-                    RegisterApplicationsMenu.this.engine.getErrorWindow().error(e1);
-                }
+            	new JCRBrowserDialog(engine).open();
+//                if (this.window == null) {
+//                    RegisterApplicationsMenu.this.myProxyChecker = new MyProxyChecker(
+//                            RegisterApplicationsMenu.this.engine);
+//                    boolean loaded = RegisterApplicationsMenu.this.myProxyChecker.loadIfNecessary();
+//                    if (loaded) {
+//                        // intended to be blank
+//                    } else {
+//                        return; // error
+//                    }
+//
+//                    this.window = RegisterThroughFileWindow.getInstance();
+//                }
+//                if (!this.window.isEngineSet()) {
+//                    this.window.setXBayaEngine(RegisterApplicationsMenu.this.engine);
+//                }
+//                try {
+//                    this.window.show();
+//                } catch (Exception e1) {
+//                    RegisterApplicationsMenu.this.engine.getErrorWindow().error(e1);
+//                }
             }
         });
     }

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionDialog.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionDialog.java?rev=1182607&r1=1182606&r2=1182607&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionDialog.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/appwrapper/ServiceDescriptionDialog.java
Wed Oct 12 22:48:19 2011
@@ -41,6 +41,9 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.parameter.ParameterFactory;
 import org.apache.airavata.xbaya.XBayaEngine;
 import org.apache.airavata.xbaya.component.registry.JCRComponentRegistry;
+import javax.swing.JCheckBox;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.ChangeEvent;
 
 public class ServiceDescriptionDialog extends JDialog {
 
@@ -56,6 +59,8 @@ public class ServiceDescriptionDialog ex
 	private JButton okButton;
 	private JButton btnDeleteParameter;
 	private DefaultTableModel defaultTableModel;
+	private JCheckBox chckbxAutoGenerateWsdl;
+	private JButton btnWSDL;
 	
 	/**
 	 * Launch the application.
@@ -107,7 +112,7 @@ public class ServiceDescriptionDialog ex
 	
 	private void initGUI() {
 		setTitle("New Service Description");
-		setBounds(100, 100, 463, 369);
+		setBounds(100, 100, 463, 386);
 		setModal(true);
 		setLocationRelativeTo(null);
 		BorderLayout borderLayout = new BorderLayout();
@@ -143,29 +148,44 @@ public class ServiceDescriptionDialog ex
 			}
 		});
 		btnDeleteParameter.setEnabled(false);
+		
+		chckbxAutoGenerateWsdl = new JCheckBox("Auto generate WSDL");
+		chckbxAutoGenerateWsdl.setSelected(true);
+		
+		btnWSDL = new JButton("Specify WSDL...");
+		btnWSDL.setEnabled(false);
+		chckbxAutoGenerateWsdl.addChangeListener(new ChangeListener() {
+			public void stateChanged(ChangeEvent arg0) {
+//				btnWSDL.setEnabled(!chckbxAutoGenerateWsdl.isSelected());
+			}
+		});
 		GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
 		gl_contentPanel.setHorizontalGroup(
 			gl_contentPanel.createParallelGroup(Alignment.LEADING)
 				.addGroup(gl_contentPanel.createSequentialGroup()
-					.addGap(177)
-					.addComponent(lblInputParameters)
-					.addContainerGap(313, Short.MAX_VALUE))
-				.addGroup(Alignment.TRAILING, gl_contentPanel.createSequentialGroup()
-					.addContainerGap(171, Short.MAX_VALUE)
+					.addContainerGap(196, Short.MAX_VALUE)
 					.addComponent(lblServiceName)
 					.addGap(18)
 					.addComponent(txtServiceName, GroupLayout.PREFERRED_SIZE, 309, GroupLayout.PREFERRED_SIZE)
 					.addGap(30))
-				.addGroup(Alignment.TRAILING, gl_contentPanel.createSequentialGroup()
+				.addGroup(gl_contentPanel.createSequentialGroup()
 					.addGap(181)
-					.addComponent(separator)
+					.addComponent(separator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
 					.addContainerGap())
-				.addGroup(Alignment.TRAILING, gl_contentPanel.createSequentialGroup()
-					.addContainerGap(195, Short.MAX_VALUE)
+				.addGroup(gl_contentPanel.createSequentialGroup()
+					.addContainerGap(210, Short.MAX_VALUE)
 					.addGroup(gl_contentPanel.createParallelGroup(Alignment.TRAILING)
-						.addComponent(btnDeleteParameter)
-						.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 380, GroupLayout.PREFERRED_SIZE))
+						.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 380, GroupLayout.PREFERRED_SIZE)
+						.addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING, false)
+							.addComponent(btnWSDL, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+							.addComponent(btnDeleteParameter, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)))
 					.addGap(27))
+				.addGroup(gl_contentPanel.createSequentialGroup()
+					.addGap(177)
+					.addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
+						.addComponent(chckbxAutoGenerateWsdl)
+						.addComponent(lblInputParameters))
+					.addContainerGap(313, Short.MAX_VALUE))
 		);
 		gl_contentPanel.setVerticalGroup(
 			gl_contentPanel.createParallelGroup(Alignment.LEADING)
@@ -182,7 +202,11 @@ public class ServiceDescriptionDialog ex
 					.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 182, GroupLayout.PREFERRED_SIZE)
 					.addPreferredGap(ComponentPlacement.RELATED)
 					.addComponent(btnDeleteParameter)
-					.addGap(74))
+					.addPreferredGap(ComponentPlacement.UNRELATED)
+					.addGroup(gl_contentPanel.createParallelGroup(Alignment.BASELINE)
+						.addComponent(chckbxAutoGenerateWsdl)
+						.addComponent(btnWSDL))
+					.addGap(44))
 		);
 		
 		tblParameters = new JTable();
@@ -366,20 +390,28 @@ public class ServiceDescriptionDialog ex
 		for(int i=0;i<defaultTableModel.getRowCount();i++){
 			Parameter parameter = new Parameter();
 			String parameterName = (String)defaultTableModel.getValueAt(i, 1);
-			DataType parameterDataType = (DataType)defaultTableModel.getValueAt(i, 2);
-			String parameterDescription = (String)defaultTableModel.getValueAt(i, 3);
-			parameter.setName(parameterName);
-			parameter.setDescription(parameterDescription);
-			parameter.setType(parameterDataType);
-			if (getIOStringList()[0].equals(defaultTableModel.getValueAt(i, 0))){
-				getServiceDescription().getInputParameters().add(parameter);
-			}else{
-				getServiceDescription().getOutputParameters().add(parameter);
+			if (parameterName!=null) {
+				DataType parameterDataType = (DataType) defaultTableModel
+						.getValueAt(i, 2);
+				String parameterDescription = (String) defaultTableModel
+						.getValueAt(i, 3);
+				parameter.setName(parameterName);
+				parameter.setDescription(parameterDescription);
+				parameter.setType(parameterDataType);
+				if (getIOStringList()[0].equals(defaultTableModel.getValueAt(i,
+						0))) {
+					getServiceDescription().getInputParameters().add(parameter);
+				} else {
+					getServiceDescription().getOutputParameters()
+							.add(parameter);
+				}
 			}
 		}
 		
 		getJCRComponentRegistry().saveServiceDescription(getServiceName(), getServiceDescription());
-		
+		if (chckbxAutoGenerateWsdl.isSelected()){
+			getJCRComponentRegistry().saveWSDL(getServiceDescription());
+		}
 		setServiceCreated(true);
 	}
 

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/JCRComponentRegistry.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/JCRComponentRegistry.java?rev=1182607&r1=1182606&r2=1182607&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/JCRComponentRegistry.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/JCRComponentRegistry.java
Wed Oct 12 22:48:19 2011
@@ -152,4 +152,7 @@ public class JCRComponentRegistry extend
 		return registry;
 	}
 
+	public String saveWSDL(ServiceDescription service) {
+		return registry.saveWSDL(service);
+	}
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/ws/WSComponent.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/ws/WSComponent.java?rev=1182607&r1=1182606&r2=1182607&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/ws/WSComponent.java
(original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/ws/WSComponent.java
Wed Oct 12 22:48:19 2011
@@ -304,7 +304,10 @@ public class WSComponent extends Compone
         for (WSComponentPort port : ports) {
             buf.append("<dt><strong>" + port.getName() + "</strong></dt>\n");
             buf.append("<dd>Type: " + port.getType().getLocalPart() + "</dd>\n");
-            buf.append("<dd>Description: " + port.getDescription() + "</dd>\n");
+            if (port.getDescription()!=null && !port.getDescription().equals(""))
{
+				buf.append("<dd>Description: " + port.getDescription()
+						+ "</dd>\n");
+			}
         }
         buf.append("</dl>\n");
     }



Mime
View raw message