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/04/24 15:52:29 UTC

svn commit: r1329726 - in /incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya: XBaya.java XBayaEngine.java gui/ErrorMessages.java

Author: lahiru
Date: Tue Apr 24 13:52:28 2012
New Revision: 1329726

URL: http://svn.apache.org/viewvc?rev=1329726&view=rev
Log:
fixing https://issues.apache.org/jira/browse/AIRAVATA-392.

Modified:
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
    incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorMessages.java

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java?rev=1329726&r1=1329725&r2=1329726&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java Tue Apr 24 13:52:28 2012
@@ -24,6 +24,7 @@ package org.apache.airavata.xbaya;
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import org.apache.airavata.xbaya.component.registry.JCRComponentRegistry;
 import org.apache.airavata.xbaya.gui.ErrorMessages;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -204,7 +205,7 @@ public class XBaya {
                         logger.warn(message, e);
                         this.config.addError(new XBayaException(message, e));
                     }
-                } else if ("-registryUserName".equalsIgnoreCase(arg)) {
+                    } else if ("-registryUserName".equalsIgnoreCase(arg)) {
 
                     index++;
                     this.config.setRegigstryUserName(args[index]);
@@ -262,6 +263,8 @@ public class XBaya {
                     logger.error(message);
                     this.config.addError(new XBayaException(message));
                 }
+                this.config.setJcrComponentRegistry(new
+                        JCRComponentRegistry(this.config.getRegistryURL(),this.config.getRegistryUserName(),this.config.getRegistryPassphrase()));
                 index++;
             }
         } catch (ArrayIndexOutOfBoundsException e) {

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java?rev=1329726&r1=1329725&r2=1329726&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java Tue Apr 24 13:52:28 2012
@@ -25,16 +25,13 @@ import java.io.File;
 import java.io.IOException;
 import java.util.List;
 
+import org.apache.airavata.common.registry.api.exception.RegistryException;
 import org.apache.airavata.common.utils.XMLUtil;
 import org.apache.airavata.xbaya.component.ComponentException;
 import org.apache.airavata.xbaya.component.SubWorkflowComponent;
 import org.apache.airavata.xbaya.component.gui.ComponentSelector;
 import org.apache.airavata.xbaya.component.gui.ComponentTreeNode;
-import org.apache.airavata.xbaya.component.registry.AmazonComponentRegistry;
-import org.apache.airavata.xbaya.component.registry.ComponentRegistryException;
-import org.apache.airavata.xbaya.component.registry.LocalComponentRegistry;
-import org.apache.airavata.xbaya.component.registry.SystemComponentReference;
-import org.apache.airavata.xbaya.component.registry.SystemComponentRegistry;
+import org.apache.airavata.xbaya.component.registry.*;
 import org.apache.airavata.xbaya.graph.GraphException;
 import org.apache.airavata.xbaya.gui.ErrorMessages;
 import org.apache.airavata.xbaya.gui.ErrorWindow;
@@ -50,6 +47,12 @@ import org.apache.airavata.xbaya.wf.gui.
 import org.apache.airavata.xbaya.workflow.WorkflowClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.xmlpull.infoset.XmlElement;
+
+import javax.jcr.Node;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.xml.namespace.QName;
 
 public class XBayaEngine {
 
@@ -210,7 +213,7 @@ public class XBayaEngine {
         // initGPEL();
 
         // This has to be after gpel initialization.
-        // loadDefaultGraph();
+        loadDefaultGraph();
 
         // This has to be after loading a graph.
         initMonitor();
@@ -394,4 +397,29 @@ public class XBayaEngine {
 		this.workflowInterpreter = workflowInterpreter;
 	}
 
+    private void loadDefaultGraph() {
+        if (this.configuration.getWorkflow() != null) {
+            this.getGUI().newGraphCanvas(true, false);
+            JCRComponentRegistry jcrComponentRegistry = this.getConfiguration().getJcrComponentRegistry();
+            try {
+                Node node = jcrComponentRegistry.getRegistry().getWorkflow(new QName(XBayaConstants.LEAD_NS, this.configuration.getWorkflow()), this.getConfiguration().getRegistryUserName());
+                XmlElement xwf = XMLUtil.stringToXmlElement(node.getProperty("workflow").getString());
+                Workflow workflow = new Workflow(xwf);
+                this.setWorkflow(workflow);
+            } catch (RegistryException e) {
+               getErrorWindow().error(ErrorMessages.REPOSITORY_CONFIGURATION_IS_WRONG_FAILED_TO_LOAD_THE_WORKFLOW, e);
+            } catch (PathNotFoundException e) {
+                getErrorWindow().error(ErrorMessages.GIVEN_WORKFLOW_NAME_IS_WRONG, e);
+            } catch (RepositoryException e) {
+                getErrorWindow().error(ErrorMessages.REPOSITORY_CONFIGURATION_IS_WRONG_FAILED_TO_LOAD_THE_WORKFLOW, e);
+            } catch (GraphException e) {
+                getErrorWindow().error(ErrorMessages.WORKFLOW_IS_WRONG, e);
+            } catch (ComponentException e) {
+                getErrorWindow().error(ErrorMessages.COMPONENT_FORMAT_ERROR, e);
+            }
+        }
+
+    }
+
+
 }
\ No newline at end of file

Modified: incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorMessages.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorMessages.java?rev=1329726&r1=1329725&r2=1329726&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorMessages.java (original)
+++ incubator/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/gui/ErrorMessages.java Tue Apr 24 13:52:28 2012
@@ -243,4 +243,7 @@ public interface ErrorMessages {
      */
     public static final String MORE_THAN_ONE_CONNECTIONS = "Cannot connect more than one output ports to an input port.";
     String CREDENTIALS_WRONG = "Please check credentials";
+    String GIVEN_WORKFLOW_NAME_IS_WRONG = "Given Workflow Name is Wrong ";
+    String REPOSITORY_CONFIGURATION_IS_WRONG_FAILED_TO_LOAD_THE_WORKFLOW = "Repository Configuration is Wrong, Failed to load the Workflow";
+    String WORKFLOW_IS_WRONG = "Workflow is Wrong";
 }
\ No newline at end of file