You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sa...@apache.org on 2014/04/14 20:31:23 UTC
[81/90] [abbrv] AIRAVATA-1124
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
new file mode 100644
index 0000000..29fdbdf
--- /dev/null
+++ b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
@@ -0,0 +1,225 @@
+/*
+ *
+ * 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.wsmg.util;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.wsmg.broker.BrokerServiceLifeCycle;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.InOutAxisOperation;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.engine.ServiceLifeCycle;
+import org.apache.axis2.transport.http.SimpleHTTPServer;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.nio.channels.ServerSocketChannel;
+
+public class TestUtilServer {
+ private static int count = 0;
+
+ private static SimpleHTTPServer receiver;
+
+ public static int TESTING_PORT = 5555;
+
+ public static final String FAILURE_MESSAGE = "Intentional Failure";
+
+ public static synchronized void deployService(AxisService service) throws AxisFault {
+ receiver.getConfigurationContext().getAxisConfiguration().addService(service);
+ }
+
+ public static synchronized void unDeployService(QName service) throws AxisFault {
+ receiver.getConfigurationContext().getAxisConfiguration().removeService(service.getLocalPart());
+ }
+
+ public static synchronized void unDeployClientService() throws AxisFault {
+ if (receiver.getConfigurationContext().getAxisConfiguration() != null) {
+ receiver.getConfigurationContext().getAxisConfiguration().removeService("AnonymousService");
+ }
+ }
+
+ public static synchronized void start(String repository, String axis2xml) throws Exception {
+ if (count == 0) {
+ ConfigurationContext er = getNewConfigurationContext(repository, axis2xml);
+ TESTING_PORT = getAvailablePort();
+ receiver = new SimpleHTTPServer(er, TESTING_PORT);
+
+ try {
+ receiver.start();
+ System.out.print("Server started on port " + TESTING_PORT + ".....");
+ } catch (Exception e) {
+ throw AxisFault.makeFault(e);
+ }
+
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e1) {
+ throw new AxisFault("Thread interuptted", e1);
+ }
+ startBroker();
+ }
+ count++;
+ }
+
+ public static void startBroker() throws Exception {
+
+ ServiceLifeCycle brokerLifeCycle = new BrokerServiceLifeCycle();
+
+ final String configFileParam = "configuration.file.name";
+ final String configFileValue = "airavata-server.properties";
+
+ AxisService notificationService = getNotificationService();
+ notificationService.addParameter(configFileParam, configFileValue);
+ notificationService.setServiceLifeCycle(brokerLifeCycle);
+ TestUtilServer.deployService(notificationService);
+ brokerLifeCycle.startUp(TestUtilServer.getConfigurationContext(), notificationService);
+
+ AxisService eventingService = getEventingService();
+ eventingService.addParameter(configFileParam, configFileValue);
+ eventingService.setServiceLifeCycle(brokerLifeCycle);
+ TestUtilServer.deployService(eventingService);
+ brokerLifeCycle.startUp(TestUtilServer.getConfigurationContext(), eventingService);
+
+ }
+
+ public static AxisService getEventingService() {
+
+ AxisService eventingService = new AxisService("EventingService");
+
+ createOperation(eventingService, "renew",
+ new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew",
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse");
+ createOperation(eventingService, "getStatus",
+ new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus",
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse");
+
+ createOperation(eventingService, "subscriptionEnd",
+ new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscriptionEnd", null);
+
+ createOperation(eventingService, "subscribe",
+ new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe",
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse");
+ createOperation(eventingService, "unsubscribe",
+ new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe",
+ "http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse");
+ createOperation(eventingService, "publish",
+ new org.apache.airavata.wsmg.broker.wseventing.WSEventingPublishMsgReceiver(),
+ "http://org.apache.airavata/WseNotification", null);
+
+ return eventingService;
+ }
+
+ public static AxisService getNotificationService() {
+
+ AxisService notificationService = new AxisService("NotificationService");
+
+ createOperation(notificationService, "notify",
+ new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/Notify",
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/NotifyResponse");
+
+ createOperation(notificationService, "subscribe",
+ new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/SubscribeRequest",
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/SubscribeRequestResponse");
+
+ createOperation(notificationService, "getCurrentMessage",
+ new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/GetCurrentMessageRequest",
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/GetCurrentMessageResponse");
+
+ createOperation(notificationService, "pauseSubscription",
+ new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/PauseSubsriptionRequest",
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/PauseSubscriptionResponse");
+
+ createOperation(notificationService, "resumeSubscription",
+ new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/ResumeSubsriptionRequest",
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/ResumeSubscriptionResponse");
+
+ createOperation(notificationService, "unsubscribe",
+ new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/UnsubsribeRequest",
+ "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/UnsubscribeResponse");
+
+ return notificationService;
+
+ }
+
+ public static void createOperation(AxisService axisService, String name, MessageReceiver messageReceiver,
+ String inputAction, String outputAction) {
+ InOutAxisOperation operation1 = new InOutAxisOperation(new QName(name));
+ operation1.setMessageReceiver(messageReceiver);
+ operation1.setOutputAction(outputAction);
+ axisService.addOperation(operation1);
+ if (inputAction != null) {
+ axisService.mapActionToOperation(inputAction, operation1);
+ }
+ }
+
+ public static ConfigurationContext getNewConfigurationContext(String repository, String axis2xml) throws Exception {
+ return ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository, axis2xml);
+ }
+
+ public static synchronized void stop() throws AxisFault {
+ if (count == 1) {
+ receiver.stop();
+ while (receiver.isRunning()) {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ // nothing to do here
+ }
+ }
+ count = 0;
+ // tp.doStop();
+ System.out.print("Server stopped .....");
+ } else {
+ count--;
+ }
+ receiver.getConfigurationContext().terminate();
+ }
+
+ public static ConfigurationContext getConfigurationContext() {
+ return receiver.getConfigurationContext();
+ }
+
+ public static int getAvailablePort(){
+ ServerSocket serverSocket = null;
+ try {
+ serverSocket = new ServerSocket(0);
+ serverSocket.close();
+ } catch (IOException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ return serverSocket.getLocalPort();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties b/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties
new file mode 100644
index 0000000..33b6161
--- /dev/null
+++ b/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties
@@ -0,0 +1,24 @@
+#
+#
+# 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.
+#
+#
+consumer.port=2222
+consumer.location=http://localhost:2222
+topic.simple=MySimpleTestTopic
+topic.xpath=MyXpathTextTopic
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/pom.xml
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/pom.xml b/modules/xbaya-gui/pom.xml
new file mode 100644
index 0000000..b62feff
--- /dev/null
+++ b/modules/xbaya-gui/pom.xml
@@ -0,0 +1,322 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--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. -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata</artifactId>
+ <version>0.12-SNAPSHOT</version>
+ <relativePath>../../pom.xml</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>airavata-xbaya-gui</artifactId>
+ <packaging>jar</packaging>
+ <name>Airavata XBaya</name>
+ <url>http://airavata.apache.org/</url>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>restore-persistence</id>
+ <phase>prepare-package</phase>
+ <configuration>
+ <tasks>
+ <copy file="${project.build.outputDirectory}/services.xml" tofile="${project.build.outputDirectory}/META-INF/services.xml" />
+ <copy file="src/main/resources/WorkflowInterpretor.wsdl" tofile="${project.build.outputDirectory}/META-INF/service.wsdl" />
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <configuration>
+ <outputDirectory>${basedir}/target/jnlp/lib</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <excludeTransitive>false</excludeTransitive>
+ </configuration>
+ </execution>
+ <!--execution>
+ <id>unpack-dependencies</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>apache-airavata-samples</artifactId>
+ <type>zip</type>
+ <outputDirectory>${project.build.directory}/samples</outputDirectory>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution-->
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <!--dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>apache-airavata-samples</artifactId>
+ <version>${project.version}</version>
+ <type>zip</type>
+ <optional>true</optional>
+ </dependency-->
+
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>xpp3</artifactId>
+ <version>${xpp3.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>xpp5</artifactId>
+ <version>${xpp5.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>xsul</artifactId>
+ <version>${xsul.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>gpel-client</artifactId>
+ <version>${gpel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ogce</groupId>
+ <artifactId>atomixmiser</artifactId>
+ <version>${atomixmiser.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.python</groupId>
+ <artifactId>jython</artifactId>
+ <version>${jython.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xmlbeans</groupId>
+ <artifactId>xmlbeans</artifactId>
+ <version>${xmlbeans.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-adb</artifactId>
+ <version>${axis2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-kernel</artifactId>
+ <version>${axis2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.axiom</groupId>
+ <artifactId>axiom-dom</artifactId>
+ <version>1.2.8</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ws.commons.schema</groupId>
+ <artifactId>XmlSchema</artifactId>
+ <version>1.4.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.neethi</groupId>
+ <artifactId>neethi</artifactId>
+ <version>2.0.4</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport-local</artifactId>
+ <version>${axis2.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.axis2</groupId>
+ <artifactId>axis2-transport-http</artifactId>
+ <version>${axis2.version}</version>
+ </dependency>
+
+ <!-- AMAZON STUFFS -->
+ <dependency>
+ <groupId>com.amazonaws</groupId>
+ <artifactId>aws-java-sdk</artifactId>
+ <version>1.3.20</version>
+ </dependency>
+ <dependency>
+ <groupId>net.java.dev.jets3t</groupId>
+ <artifactId>jets3t</artifactId>
+ <version>0.8.0</version>
+ </dependency>
+
+ <!-- AIRAVATA modules -->
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-model-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-model-component</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-message-monitor</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-client-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-message-broker</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-common-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-tracking</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-jpa-registry</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-registry-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- JCR Support -->
+ <!-- TODO need clean up -->
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-gfac-schema-utils</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-gfac-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-gfac-ec2</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ <version>${jcr.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-workflow-execution-context</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <!--dependency> <groupId>org.apache.airavata</groupId> <artifactId>airavata-jpa-registry</artifactId> <version>${project.version}</version>
+ </dependency -->
+ <dependency>
+ <groupId>org.apache.derby</groupId>
+ <artifactId>derbyclient</artifactId>
+ <version>${derby.version}</version>
+ </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.globusonline</groupId>-->
+ <!--<artifactId>transfer-api-client-java</artifactId>-->
+ <!--<version>0.10.8</version>-->
+ <!--</dependency>-->
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
+ <version>4.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpcore</artifactId>
+ <version>4.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-client-configuration</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.airavata</groupId>
+ <artifactId>airavata-server-configuration</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
new file mode 100644
index 0000000..6f4d2db
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBaya.java
@@ -0,0 +1,315 @@
+/*
+ *
+ * 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.xbaya;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.xbaya.XBayaConfiguration.XBayaExecutionMode;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class XBaya {
+
+ private static final Logger logger = LoggerFactory.getLogger(XBaya.class);
+
+ private XBayaConfiguration config;
+
+ private XBayaEngine engine;
+
+ public static int preservice = 0;
+
+ /**
+ * Constructs an XBayaEngine.
+ *
+ * @param args
+ */
+ public XBaya(String[] args) {
+ parseArguments(args);
+ try {
+ this.engine = new XBayaEngine(this.config);
+
+ } catch (RuntimeException e) {
+ logger.error(e.getMessage(), e);
+ try {
+ this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ } catch (Throwable t) {
+ // Cannot do anything
+ e.printStackTrace();
+ }
+ } catch (Error e) {
+ logger.error(e.getMessage(), e);
+ try {
+ this.engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ } catch (Throwable t) {
+ // Cannot do anything
+ System.out.println(e);
+
+ }
+ }
+ }
+
+ /**
+ * Returns the XBayaEngine.
+ *
+ * @return The XBayaEngine
+ */
+ public XBayaEngine getEngine() {
+ return this.engine;
+ }
+
+ private void printUsage() {
+ System.err.println("Usage: java " + XBaya.class.getName() + " [-help]" + "[-config file]" + " [-title title]"
+ + " [-workflow workflow]" + " [-enableLocalRegistry]" + " [-localRegistry dir]"
+ + " [-gpelEngineURL url]" + " [-templateID templateID]" + " [-instanceID instanceID]"
+ + " [-gfacURL url]" + " [-dscURL url" + " [-startMonitor {true,false}]" + " [-brokerURL url]"
+ + " [-topic topic]" + " [-pullMode {true,false}]" + " [-myProxyServer host]" + " [-karmaURL url]"
+ + " [-karmaWorkflowInstanceID]" + " [-myProxyPort port]" + " [-myProxyUsername username]"
+ + " [-myProxyLifetime sec]" + " [-loadMyProxy {true,false}]" + " [-messageBoxURL url]"
+ + " [-width width]" + " [-height height]" + " [-exitOnClose false/true]" + "[-enableProvenance false/true]"
+ + "[-enableProvenanceSmartRun false/true]" + "[-runWithCrossProduct true/false]"+"[-mode ide/monitor]" + "[--x x-coordinates of left top corner] " +
+ "+ [--y y-coordinate of left top corner]");
+ }
+
+ private void parseArguments(String[] args) {
+ try {
+ this.config = new XBayaConfiguration();
+
+ int index = 0;
+ while (index < args.length) {
+ String arg = args[index];
+ String possibleValue = "";
+ if ((index + 1) < args.length) {
+ possibleValue = args[index + 1];
+ }
+ logger.debug("arg: " + arg + " " + possibleValue);
+ if ("-help".equalsIgnoreCase(arg)) {
+ printUsage();
+ System.exit(0);
+ } else if ("-config".equalsIgnoreCase(arg)) {
+ index++;
+ String configPath = args[index];
+ try {
+ this.config.loadConfiguration(configPath);
+ } catch (RuntimeException e) {
+ String message = "Error while reading config file, " + configPath;
+ logger.warn(message, e);
+ this.config.addError(new WorkflowException(message, e));
+ }
+ } else if ("-title".equalsIgnoreCase(arg)) {
+ index++;
+ this.config.setTitle(args[index]);
+ } else if ("-workflow".equalsIgnoreCase(arg)) {
+ index++;
+ this.config.setWorkflow(args[index]);
+ } else if ("-gfacURL".equalsIgnoreCase(arg)) {
+ index++;
+ String url = args[index];
+ try {
+ this.config.setGFacURL(parseURL(url));
+ } catch (URISyntaxException e) {
+ String message = "The GFac URL is in wrong format: " + url;
+ logger.warn(message, e);
+ this.config.addError(new WorkflowException(message, e));
+ }
+ } else if ("-dscURL".equalsIgnoreCase(arg)) {
+ index++;
+ String url = args[index];
+ try {
+ this.config.setDSCURL(parseURL(url));
+ } catch (URISyntaxException e) {
+ String message = "The DSC URL is in wrong format: " + url;
+ logger.warn(message, e);
+ this.config.addError(new WorkflowException(message, e));
+ }
+ } else if ("-startMonitor".equalsIgnoreCase(arg)) {
+ this.config.setStartMonitor(true);
+ } else if ("-brokerURL".equalsIgnoreCase(arg)) {
+ index++;
+ String brokerURL = args[index];
+ try {
+ this.config.setBrokerURL(parseURL(brokerURL));
+ } catch (URISyntaxException e) {
+ String message = "The broker URL is in wrong format: " + brokerURL;
+ logger.warn(message, e);
+ this.config.addError(new WorkflowException(message, e));
+ }
+ } else if ("-odeEngine".equalsIgnoreCase(arg)) {
+ index++;
+ this.config.setOdeURL(args[index]);
+
+ } else if ("-templateID".equalsIgnoreCase(arg)) {
+ index++;
+ this.config.setWorkflow(args[index]);
+
+ } else if ("-topic".equalsIgnoreCase(arg)) {
+
+ index++;
+ this.config.setTopic(args[index]);
+ } else if ("-pullMode".equalsIgnoreCase(arg)) {
+ if (index < args.length - 1) {
+ String nextArg = args[index + 1];
+ if (nextArg.startsWith("-")) {
+ this.config.setPullMode(true);
+ } else if ("true".equalsIgnoreCase(nextArg)) {
+ index++;
+ this.config.setPullMode(true);
+ } else if ("false".equalsIgnoreCase(nextArg)) {
+ index++;
+ this.config.setPullMode(false);
+ } else {
+ String message = "-pullMode has to be either true or false, not " + nextArg;
+ logger.warn(message);
+ this.config.addError(new WorkflowException(message));
+ }
+ } else {
+ // This is the last arg
+ this.config.setPullMode(true);
+ }
+ } else if ("-messageBoxURL".equalsIgnoreCase(arg) || "-msgBoxURL".equalsIgnoreCase(arg)) {
+ index++;
+ String messageBoxURL = args[index];
+ try {
+ this.config.setMessageBoxURL(parseURL(messageBoxURL));
+ } catch (URISyntaxException e) {
+ String message = "The message box URL is in wrong format: " + messageBoxURL;
+ logger.warn(message, e);
+ this.config.addError(new WorkflowException(message, e));
+ }
+ } else if ("-registryURL".equalsIgnoreCase(arg)) {
+ index++;
+ String registryURL = args[index];
+ try {
+ this.config.setRegistryURL(parseURL(registryURL));
+ // we need to give preference when a user set registry url from the
+ // command line
+ this.config.setRegURLSetByCMD(true);
+ } catch (URISyntaxException e) {
+ String message = "The message box URL is in wrong format: " + registryURL;
+ logger.warn(message, e);
+ this.config.addError(new WorkflowException(message, e));
+ }
+ } else if ("-registryUserName".equalsIgnoreCase(arg)) {
+
+ index++;
+ this.config.setRegigstryUserName(args[index]);
+ } else if ("-registryPassphrase".equalsIgnoreCase(arg)) {
+
+ index++;
+ this.config.setRegistryPassphrase(args[index]);
+ } else if ("-width".equalsIgnoreCase(arg)) {
+ index++;
+ String width = args[index];
+ try {
+ this.config.setWidth(Integer.parseInt(width));
+ } catch (NumberFormatException e) {
+ String message = "The width must be an integer: " + width;
+ logger.warn(message, e);
+ this.config.addError(new WorkflowException(message, e));
+ }
+ } else if ("-height".equalsIgnoreCase(arg)) {
+ index++;
+ String height = args[index];
+ try {
+ this.config.setHeight(Integer.parseInt(height));
+ } catch (NumberFormatException e) {
+ String message = "The height must be an integer: " + height;
+ logger.warn(message, e);
+ this.config.addError(new WorkflowException(message, e));
+ }
+ } else if ("-exitOnClose".equalsIgnoreCase(arg)) {
+ index++;
+ String exit = args[index];
+ if ("false".equalsIgnoreCase(exit)) {
+ this.config.setCloseOnExit(false);
+ }
+ } else if ("-enableProvenance".equalsIgnoreCase(arg)) {
+ index++;
+ String exit = args[index];
+ if ("true".equalsIgnoreCase(exit)) {
+ this.config.setCollectProvenance(true);
+ }
+ } else if ("-enableProvenanceSmartRun".equalsIgnoreCase(arg)) {
+ index++;
+ String exit = args[index];
+ if ("true".equalsIgnoreCase(exit)) {
+ this.config.setProvenanceSmartRun(true);
+ }
+ } else if ("-runWithCrossProduct".equalsIgnoreCase(arg)) {
+ index++;
+ String exit = args[index];
+ if ("false".equalsIgnoreCase(exit)) {
+ this.config.setRunWithCrossProduct(false);
+ }
+ } else if ("-mode".equalsIgnoreCase(arg)) {
+ index++;
+ String modeValue = args[index].toUpperCase();
+ this.config.setXbayaExecutionMode(XBayaExecutionMode.valueOf(modeValue));
+ } else if ("-x".equalsIgnoreCase(arg)) {
+ index++;
+ this.config.setX(Integer.parseInt(args[index]));
+ } else if ("-y".equalsIgnoreCase(arg)) {
+ index++;
+ this.config.setY(Integer.parseInt(args[index]));
+ } else {
+ String message = "Unknown option: " + arg;
+ logger.error(message);
+ this.config.addError(new WorkflowException(message));
+ }
+ this.config.setAiravataAPI(this.config.getAiravataAPI());
+ index++;
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ String message = "Argument is missing after " + args[args.length - 1];
+ logger.error(message, e);
+ this.config.addError(new WorkflowException(message));
+ } catch (Throwable e) {
+ logger.error(e.getMessage(), e);
+ String message = "Unknown error while parsing the arguments";
+ this.config.addError(new WorkflowException(message, e));
+ }
+
+ }
+
+ private URI parseURL(String urlString) throws URISyntaxException {
+ if (urlString.trim().length() == 0) {
+ // This makes it possible to not use some of our default services.
+ return null;
+ } else if ("null".equalsIgnoreCase(urlString)) {
+ // This is a workaround that JNLP doesn't take empty string as an
+ // argument.
+ return null;
+ } else {
+ return new URI(urlString).parseServerAuthority();
+ }
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) {
+ new XBaya(args);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
new file mode 100644
index 0000000..4aae6b4
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConfiguration.java
@@ -0,0 +1,974 @@
+/*
+ *
+ * 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.xbaya;
+
+import java.io.File;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Observable;
+import java.util.Observer;
+
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.gfac.ec2.AmazonSecurityContext;
+import org.apache.airavata.schemas.wec.ContextHeaderDocument;
+import org.apache.airavata.workflow.model.component.registry.JCRComponentRegistry;
+import org.apache.airavata.xbaya.core.ide.XBayaExecutionModeListener;
+import org.apache.airavata.xbaya.file.XBayaPathConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import xsul.lead.LeadDeploymentConfig;
+
+public class XBayaConfiguration extends Observable implements Observer {
+
+ private static final Logger logger = LoggerFactory.getLogger(XBayaConfiguration.class);
+
+ private String title = XBayaConstants.APPLICATION_NAME;
+
+ private String workflow = null;
+
+ private String ogceWorkflow = null;
+
+ private List<String> localRegistris = new ArrayList<String>();
+
+ // GPEL Engine related
+
+ private URI gpelEngineURL = XBayaConstants.DEFAULT_GPEL_ENGINE_URL;
+
+ private URI gpelTemplateID = null;
+
+ private URI gpelInstanceID = null;
+
+ private AiravataAPI airavataAPI = null;
+ // ODE
+ private String odeURL = XBayaConstants.DEFAULT_ODE_URL;
+
+ // WorkflowInterpreter
+ private URI workflowInterpreterURL = XBayaConstants.DEFAULT_WORKFLOW_INTERPRETER_URL;
+
+ // Proxy Service
+
+ private URI proxyURI = XBayaConstants.DEFAULT_PROXY_URI;
+
+ private URI gfacURL = XBayaConstants.DEFAULT_GFAC_URL;
+
+ private URI registryURL = XBayaConstants.REGISTRY_URL;
+
+ private String regigstryUserName = XBayaConstants.REGISTRY_USERNAME;
+
+ private String registryPassphrase = XBayaConstants.REGISTRY_PASSPHRASE;
+
+ private String defaultGateway = XBayaConstants.DEFAULT_GATEWAY;
+
+ private URI dscURL = XBayaConstants.DEFAULT_DSC_URL;
+
+ // Monitor related
+
+ private boolean startMonitor = false;
+
+ private URI brokerURL = XBayaConstants.DEFAULT_BROKER_URL;
+
+ private String topic = null;
+
+ private boolean pullMode = true;
+
+ private URI messageBoxURL = XBayaConstants.DEFAULT_MESSAGE_BOX_URL;
+
+ // Kerma
+
+ private URI karmaURL = null;
+
+ private URI karmaWorkflowInstanceID = null;
+
+ // MyProxy
+
+ private String myProxyServer = XBayaConstants.DEFAULT_MYPROXY_SERVER;
+
+ private int myProxyPort = XBayaConstants.DEFAULT_MYPROXY_PORT;
+
+ private int myProxyLifetime = XBayaConstants.DEFAULT_MYPROXY_LIFTTIME;
+
+ private String myProxyUsername = null;
+
+ private String myProxyPassphrase = null;
+
+ private boolean loadMyProxy = false;
+
+ private boolean loadRunJythonWorkflow = false;
+
+ // Size
+
+ private int width;
+
+ private int height;
+
+ private int x = 50;
+
+ private int y= 50;
+
+ // Errors
+
+ private List<Throwable> errors;
+
+ private boolean closeOnExit = true;
+
+ private boolean collectProvenance = false;
+
+ private boolean provenanceSmartRun = false;
+
+ private boolean runWithCrossProduct = true;
+
+ private String trustedCertLocation = "";
+
+ private JCRComponentRegistry jcrComponentRegistry=null;
+
+ private XBayaExecutionMode xbayaExecutionMode=XBayaExecutionMode.IDE;
+
+ private List<XBayaExecutionModeListener> xbayaExecutionModeChangeListners=new ArrayList<XBayaExecutionModeListener>();
+
+ private boolean regURLSetByCMD = false;
+
+ private AmazonSecurityContext amazonSecurityContext = null;
+
+ private ContextHeaderDocument.ContextHeader contextHeader;
+
+ public enum XBayaExecutionMode{
+ IDE,
+ MONITOR
+ }
+ /**
+ * Constructs an XwfConfiguration.
+ */
+ public XBayaConfiguration() {
+ this.errors = new ArrayList<Throwable>();
+
+ // Read from system properties first.
+ String systemConfig = System.getProperty("xbaya.config");
+ try {
+ if (systemConfig != null) {
+ loadConfiguration(systemConfig);
+ }
+ } catch (RuntimeException e) {
+ String message = "Error while reading a configuration file, " + systemConfig;
+ logger.warn(message, e);
+ }
+ }
+
+ /**
+ * @param configFilePath
+ */
+ public void loadConfiguration(String configFilePath) {
+ File configFile = new File(configFilePath);
+ URI uri = configFile.toURI();
+ loadConfiguration(uri);
+ }
+
+ private void loadConfiguration(URI uri) {
+ LeadDeploymentConfig config = LeadDeploymentConfig.loadConfig(null, uri);
+ URI gpel = config.getGpelUrl();
+ if (gpel != null) {
+ this.gpelEngineURL = config.getGpelUrl();
+ }
+ URI gfac = config.getGfacUrl();
+ if (gfac != null) {
+ this.gfacURL = gfac;
+ }
+ URI dsc = config.getDscUrl();
+ if (dsc != null) {
+ this.dscURL = dsc;
+ }
+ URI broker = config.getBrokerUrl();
+ if (broker != null) {
+ this.brokerURL = broker;
+ }
+ URI msgBox = config.getMsgBoxUrl();
+ if (msgBox != null) {
+ this.messageBoxURL = msgBox;
+ }
+ }
+
+ /**
+ * Returns the title.
+ *
+ * @return The title
+ */
+ public String getTitle() {
+ return this.title;
+ }
+
+ /**
+ * Sets title.
+ *
+ * @param title
+ * The title to set.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * Returns the defaultWorkflow.
+ *
+ * @return The defaultWorkflow
+ */
+ public String getWorkflow() {
+ return this.workflow;
+ }
+
+ /**
+ * Sets defaultWorkflow.
+ *
+ * @param defaultWorkflow
+ * The defaultWorkflow to set.
+ */
+ public void setWorkflow(String defaultWorkflow) {
+ this.workflow = defaultWorkflow;
+ }
+
+ /**
+ * Sets ogceWorkflow.
+ *
+ * @param ogceWorkflow
+ * The ogceWorkflow to set.
+ */
+ public void setOGCEWorkflow(String ogceWorkflow) {
+ this.ogceWorkflow = ogceWorkflow;
+ }
+
+ /**
+ * Returns the ogceWorkflow.
+ *
+ * @return The ogceWorkflow
+ */
+ public String getOGCEWorkflow() {
+ return this.ogceWorkflow;
+ }
+
+ /**
+ * Enable the system default local registry.
+ */
+ public void enableLocalRegistry() {
+ addLocalRegistry(XBayaPathConstants.WSDL_DIRECTORY);
+ }
+
+ /**
+ * @param path
+ * The path of local registry.
+ */
+ public void addLocalRegistry(String path) {
+ this.localRegistris.add(path);
+ }
+
+ /**
+ * @return The list of pathes of local registries.
+ */
+ public List<String> getLocalRegistry() {
+ return this.localRegistris;
+ }
+
+ /**
+ * Returns the gpelEngineUrl.
+ *
+ * @return The gpelEngineUrl
+ */
+ public URI getGPELEngineURL() {
+ return this.gpelEngineURL;
+ }
+
+ /**
+ * Sets gpelEngineUrl.
+ *
+ * @param gpelEngineURL
+ * The gpelEngineUrl to set.
+ */
+ public void setGPELEngineURL(URI gpelEngineURL) {
+ this.gpelEngineURL = gpelEngineURL;
+ }
+
+ /**
+ * @param templateID
+ */
+ public void setGPELTemplateID(URI templateID) {
+ this.gpelTemplateID = templateID;
+ }
+
+ /**
+ * @return The GPEL template ID.
+ */
+ public URI getGPELTemplateID() {
+ return this.gpelTemplateID;
+ }
+
+ /**
+ * Returns the gpelInstanceID.
+ *
+ * @return The gpelInstanceID
+ */
+ public URI getGPELInstanceID() {
+ return this.gpelInstanceID;
+ }
+
+ /**
+ * Sets gpelInstanceID.
+ *
+ * @param gpelInstanceID
+ * The gpelInstanceID to set.
+ */
+ public void setGPELInstanceID(URI gpelInstanceID) {
+ this.gpelInstanceID = gpelInstanceID;
+ }
+
+ /**
+ * Get the AmazonSecurityContext needed for cloud job submission.
+ * @return AmazonSecurityContext
+ */
+ public AmazonSecurityContext getAmazonSecurityContext() {
+ return amazonSecurityContext;
+ }
+
+ /**
+ * Set the AmazonSecurityContext needed for cloud job submission.
+ * @param amazonSecurityContext amazon security context.
+ */
+ public void setAmazonSecurityContext(AmazonSecurityContext amazonSecurityContext) {
+ this.amazonSecurityContext = amazonSecurityContext;
+ }
+
+ /**
+ * @return The GFac URL
+ */
+ public URI getGFacURL() {
+ return this.gfacURL;
+ }
+
+ /**
+ * @param gfacURL
+ */
+ public void setGFacURL(URI gfacURL) {
+ this.gfacURL = gfacURL;
+ }
+
+ /**
+ * @return The DSC URL
+ */
+ public URI getDSCURL() {
+ return this.dscURL;
+ }
+
+ /**
+ * @param dscURL
+ */
+ public void setDSCURL(URI dscURL) {
+ this.dscURL = dscURL;
+ }
+
+ /**
+ * Returns the topic.
+ *
+ * @return The topic
+ */
+ public String getTopic() {
+ return this.topic;
+ }
+
+ /**
+ * Sets topic.
+ *
+ * @param topic
+ * The topic to set.
+ */
+ public void setTopic(String topic) {
+ this.topic = topic;
+ }
+
+ /**
+ * Returns the messageBoxUrl.
+ *
+ * @return The messageBoxUrl
+ */
+ public URI getMessageBoxURL() {
+ return this.messageBoxURL;
+ }
+
+ /**
+ * Sets messageBoxUrl.
+ *
+ * @param messageBoxURL
+ * The messageBoxUrl to set.
+ */
+ public void setMessageBoxURL(URI messageBoxURL) {
+ this.messageBoxURL = messageBoxURL;
+ }
+
+ /**
+ * Returns the pullMode.
+ *
+ * @return The pullMode
+ */
+ public boolean isPullMode() {
+ return this.pullMode;
+ }
+
+ /**
+ * Sets pullMode.
+ *
+ * @param pullMode
+ * The pullMode to set.
+ */
+ public void setPullMode(boolean pullMode) {
+ this.pullMode = pullMode;
+ }
+
+ /**
+ * Returns the brokerLocation.
+ *
+ * @return The brokerLocation
+ */
+ public URI getBrokerURL() {
+ return this.brokerURL;
+ }
+
+ /**
+ * Sets brokerLocation.
+ *
+ * @param brokerURL
+ * The brokerLocation to set.
+ */
+ public void setBrokerURL(URI brokerURL) {
+ this.brokerURL = brokerURL;
+ }
+
+ /**
+ * Returns the startMonitor.
+ *
+ * @return The startMonitor
+ */
+ public boolean isStartMonitor() {
+ return this.startMonitor;
+ }
+
+ /**
+ * Sets startMonitor.
+ *
+ * @param startMonitor
+ * The startMonitor to set.
+ */
+ public void setStartMonitor(boolean startMonitor) {
+ this.startMonitor = startMonitor;
+ }
+
+ /**
+ * Returns the kermaURI.
+ *
+ * @return The kermaURI
+ */
+ public URI getKarmaURL() {
+ return this.karmaURL;
+ }
+
+ /**
+ * Sets kermaURI.
+ *
+ * @param kermaURI
+ * The kermaURI to set.
+ */
+ public void setKarmaURL(URI kermaURI) {
+ this.karmaURL = kermaURI;
+ }
+
+ /**
+ * Returns the kermaWorkflowInstanceID.
+ *
+ * @return The kermaWorkflowInstanceID
+ */
+ public URI getKarmaWorkflowInstanceID() {
+ return this.karmaWorkflowInstanceID;
+ }
+
+ /**
+ * Sets kermaWorkflowInstanceID.
+ *
+ * @param karmaWorkflowInstanceID
+ * The kermaWorkflowInstanceID to set.
+ */
+ public void setKarmaWorkflowInstanceID(URI karmaWorkflowInstanceID) {
+ this.karmaWorkflowInstanceID = karmaWorkflowInstanceID;
+ }
+
+ /**
+ * Returns the myProxyServer.
+ *
+ * @return The myProxyServer
+ */
+ public String getMyProxyServer() {
+ return this.myProxyServer;
+ }
+
+ /**
+ * Sets myProxyServer.
+ *
+ * @param myProxyServer
+ * The myProxyServer to set.
+ */
+ public void setMyProxyServer(String myProxyServer) {
+ this.myProxyServer = myProxyServer;
+ }
+
+ /**
+ * Returns the myProxyPort.
+ *
+ * @return The myProxyPort
+ */
+ public int getMyProxyPort() {
+ return this.myProxyPort;
+ }
+
+ /**
+ * Sets myProxyPort.
+ *
+ * @param myProxyPort
+ * The myProxyPort to set.
+ */
+ public void setMyProxyPort(int myProxyPort) {
+ this.myProxyPort = myProxyPort;
+ }
+
+ /**
+ * Returns the myProxyLifetime.
+ *
+ * @return The myProxyLifetime
+ */
+ public int getMyProxyLifetime() {
+ return this.myProxyLifetime;
+ }
+
+ /**
+ * Sets myProxyLifetime.
+ *
+ * @param myProxyLifetime
+ * The myProxyLifetime to set.
+ */
+ public void setMyProxyLifetime(int myProxyLifetime) {
+ this.myProxyLifetime = myProxyLifetime;
+ }
+
+ /**
+ * Returns the myProxyUsername.
+ *
+ * @return The myProxyUsername
+ */
+ public String getMyProxyUsername() {
+ return this.myProxyUsername;
+ }
+
+ /**
+ * Sets myProxyUsername.
+ *
+ * @param myProxyUsername
+ * The myProxyUsername to set.
+ */
+ public void setMyProxyUsername(String myProxyUsername) {
+ this.myProxyUsername = myProxyUsername;
+ }
+
+ /**
+ * Returns the odeURL.
+ *
+ * @return The odeURL
+ */
+ public String getOdeURL() {
+ return this.odeURL;
+ }
+
+ /**
+ * Sets odeURL.
+ *
+ * @param odeURL
+ * The odeURL to set.
+ */
+ public void setOdeURL(String odeURL) {
+ this.odeURL = odeURL;
+ }
+
+ /**
+ * Returns the workflowInterpreterURL.
+ *
+ * @return The workflowInterpreterURL
+ */
+ public URI getWorkflowInterpreterURL() {
+ return this.workflowInterpreterURL;
+ }
+
+ /**
+ * Sets workflowInterpreterURL.
+ *
+ * @param workflowInterpreterURL
+ * The workflowInterpreterURL to set.
+ */
+ public void setWorkflowInterpreterURL(URI workflowInterpreterURL) {
+ this.workflowInterpreterURL = workflowInterpreterURL;
+ }
+
+ /**
+ * Sets proxyURI.
+ *
+ * @param proxyURI
+ * The proxyURI to set.
+ */
+ public void setProxyURI(URI proxyURI) {
+ this.proxyURI = proxyURI;
+ }
+
+ /**
+ * Returns the myProxyPassphrase.
+ *
+ * @return The myProxyPassphrase
+ */
+ public String getMyProxyPassphrase() {
+ return this.myProxyPassphrase;
+ }
+
+ /**
+ * Sets myProxyPassphrase.
+ *
+ * @param myProxyPassphrase
+ * The myProxyPassphrase to set.
+ */
+ public void setMyProxyPassphrase(String myProxyPassphrase) {
+ this.myProxyPassphrase = myProxyPassphrase;
+ }
+
+ /**
+ * Returns the loadMyProxy.
+ *
+ * @return The loadMyProxy
+ */
+ public boolean isLoadMyProxy() {
+ return this.loadMyProxy;
+ }
+
+ /**
+ * Sets loadMyProxy.
+ *
+ * @param loadMyProxy
+ * The loadMyProxy to set.
+ */
+ public void setLoadMyProxy(boolean loadMyProxy) {
+ this.loadMyProxy = loadMyProxy;
+ }
+
+ /**
+ * Returns the loadRunJythonWorkflow.
+ *
+ * @return The loadRunJythonWorkflow
+ */
+ public boolean isLoadRunJythonWorkflow() {
+ return this.loadRunJythonWorkflow;
+ }
+
+ /**
+ * Sets loadRunJythonWorkflow.
+ *
+ * @param loadRunJythonWorkflow
+ * The loadRunJythonWorkflow to set.
+ */
+ public void setLoadRunJythonWorkflow(boolean loadRunJythonWorkflow) {
+ this.loadRunJythonWorkflow = loadRunJythonWorkflow;
+ }
+
+ /**
+ * Returns the height.
+ *
+ * @return The height
+ */
+ public int getHeight() {
+ return this.height;
+ }
+
+ /**
+ * Sets height.
+ *
+ * @param height
+ * The height to set.
+ */
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
+ /**
+ * Returns the width.
+ *
+ * @return The width
+ */
+ public int getWidth() {
+ return this.width;
+ }
+
+ /**
+ * Sets width.
+ *
+ * @param width
+ * The width to set.
+ */
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
+ /**
+ * Add an error.
+ *
+ * @param e
+ */
+ public void addError(Throwable e) {
+ this.errors.add(e);
+ }
+
+ /**
+ * Returns errors.
+ *
+ * @return Errors.
+ */
+ public Iterable<Throwable> getErrors() {
+ return this.errors;
+ }
+
+ /**
+ * @return
+ */
+ public String getODEURL() {
+ // TODO Auto-generated method stub
+ return this.odeURL;
+ }
+
+ //
+
+ /**
+ * Returns current proxy URI
+ *
+ * @return
+ */
+ public URI getProxyURI() {
+ return this.proxyURI;
+ }
+
+ /**
+ * @param b
+ */
+ public void setCloseOnExit(boolean b) {
+ this.closeOnExit = b;
+ }
+
+ /**
+ * @return
+ */
+ public boolean isCloseOnExit() {
+ return this.closeOnExit;
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ if (this.airavataAPI != null && this.airavataAPI instanceof Observable) {
+ ((Observable) this.airavataAPI).deleteObserver(this);
+ }
+ this.airavataAPI = airavataAPI;
+ if (airavataAPI != null && airavataAPI instanceof Observable) {
+ ((Observable) airavataAPI).addObserver(this);
+ }
+ if (getJcrComponentRegistry()==null){
+ setJcrComponentRegistry(new JCRComponentRegistry(airavataAPI));
+ }else{
+ getJcrComponentRegistry().setAiravataAPI(airavataAPI);
+ }
+ triggerObservers(getJcrComponentRegistry());
+ }
+
+ public URI getRegistryURL() {
+ return registryURL;
+ }
+
+ public void setRegistryURL(URI registryURL) {
+ this.registryURL = registryURL;
+ }
+
+ public void setRegigstryUserName(String regigstryUserName) {
+ this.regigstryUserName = regigstryUserName;
+ }
+
+ public void setRegistryPassphrase(String registryPassphrase) {
+ this.registryPassphrase = registryPassphrase;
+ }
+
+ public String getRegistryUserName() {
+ return regigstryUserName;
+ }
+
+ public String getRegistryPassphrase() {
+ return registryPassphrase;
+ }
+
+ protected void triggerObservers(Object o) {
+ setChanged();
+ notifyObservers(o);
+ }
+
+ public void update(Observable observable, Object o) {
+ triggerObservers(observable);
+ }
+
+ public boolean isCollectProvenance() {
+ return collectProvenance;
+ }
+
+ public boolean isProvenanceSmartRun() {
+ return provenanceSmartRun;
+ }
+
+ public void setCollectProvenance(boolean collectProvenance) {
+ this.collectProvenance = collectProvenance;
+ }
+
+ public void setProvenanceSmartRun(boolean provenanceSmartRun) {
+ this.provenanceSmartRun = provenanceSmartRun;
+ }
+
+ public void setRunWithCrossProduct(boolean runWithCrossProduct) {
+ this.runWithCrossProduct = runWithCrossProduct;
+ }
+
+ public boolean isRunWithCrossProduct() {
+ return runWithCrossProduct;
+ }
+
+ public String getTrustedCertLocation() {
+ return trustedCertLocation;
+ }
+
+ public void setTrustedCertLocation(String trustedCertLocation) {
+ this.trustedCertLocation = trustedCertLocation;
+ }
+
+ public XBayaExecutionMode getXbayaExecutionMode() {
+ return xbayaExecutionMode;
+ }
+
+ public void setXbayaExecutionMode(XBayaExecutionMode xbayaExecutionMode) {
+ boolean modeChanged=(this.xbayaExecutionMode != xbayaExecutionMode);
+ this.xbayaExecutionMode = xbayaExecutionMode;
+ if (modeChanged) {
+ for (XBayaExecutionModeListener listner : xbayaExecutionModeChangeListners) {
+ try {
+ listner.executionModeChanged(this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void registerExecutionModeChangeListener(XBayaExecutionModeListener listner){
+ xbayaExecutionModeChangeListners.add(listner);
+ }
+
+ public void unregisterExecutionModeChangeListener(XBayaExecutionModeListener listner){
+ if (xbayaExecutionModeChangeListners.contains(listner)) {
+ xbayaExecutionModeChangeListners.remove(listner);
+ }
+ }
+
+ public int getX() {
+ return x;
+ }
+
+ public void setX(int x) {
+ this.x = x;
+ }
+
+ public int getY() {
+ return y;
+ }
+
+ public void setY(int y) {
+ this.y = y;
+ }
+
+// public AiravataAPI getAiravataAPI() {
+// return airavataAPI;
+// }
+//
+// public void setAiravataAPI(AiravataAPI airavataAPI) {
+// this.airavataAPI = airavataAPI;
+// }
+
+ public String getDefaultGateway() {
+ return defaultGateway;
+ }
+
+ public void setDefaultGateway(String defaultGateway) {
+ this.defaultGateway = defaultGateway;
+ }
+
+ public JCRComponentRegistry getJcrComponentRegistry() {
+ return jcrComponentRegistry;
+ }
+
+ public void setJcrComponentRegistry(JCRComponentRegistry jcrComponentRegistry) {
+ this.jcrComponentRegistry = jcrComponentRegistry;
+ }
+
+ public boolean isRegURLSetByCMD() {
+ return regURLSetByCMD;
+ }
+
+ public void setRegURLSetByCMD(boolean regURLSetByCMD) {
+ this.regURLSetByCMD = regURLSetByCMD;
+ }
+
+ // public AiravataAPI setAiravataAPI() {
+// try{
+// URI baseUri = new URI(ResourcePathConstants.BASE_URL);
+// PasswordCallbackImpl passwordCallback = new PasswordCallbackImpl(getRegistryUserName(), getRegistryPassphrase());
+// airavataAPI = AiravataClientUtils.getAPI(baseUri,
+// getRegistryUserName(), passwordCallback);
+// } catch (RepositoryException e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// } catch (MalformedURLException e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// } catch (RegistryException e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// } catch (URISyntaxException e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// }
+// return airavataAPI;
+// }
+
+ public ContextHeaderDocument.ContextHeader getContextHeader() {
+ return contextHeader;
+ }
+
+ public void setContextHeader(ContextHeaderDocument.ContextHeader contextHeader) {
+ this.contextHeader = contextHeader;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java
new file mode 100644
index 0000000..d754450
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaConstants.java
@@ -0,0 +1,205 @@
+/*
+ *
+ * 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.xbaya;
+
+import java.net.URI;
+
+public class XBayaConstants {
+
+ /**
+ * XBaya
+ */
+ public static final String APPLICATION_SHORT_NAME = "XBaya";
+
+ /**
+ * The name of the project
+ */
+ public static final String PROJECT_NAME = "Apache Airavata";
+
+ /**
+ * The name of the application
+ */
+ public static final String APPLICATION_NAME = "XBaya Dashboard";
+
+ /**
+ * The URL of the web page of the application
+ */
+ public static final URI WEB_URL = URI.create("http://airavata.apache.org/");
+
+ // Default values
+
+ /**
+ * Default URL of the GPEL Engine
+ */
+ public static final URI DEFAULT_GPEL_ENGINE_URL = URI.create("https://tyr13.cs.indiana.edu:7443/gpel/");
+
+ /**
+ * DEFAULT_GFAC_URL
+ */
+ public static final URI DEFAULT_GFAC_URL = URI.create("http://localhost:8080/axis2/services/GFacService");
+
+ /**
+ * DEFAULT_TOPIC
+ */
+ public static final String DEFAULT_TOPIC = "xbaya-topic";
+
+ /**
+ * Default notification broker URL.
+ */
+ public static final URI DEFAULT_BROKER_URL = URI.create("http://localhost:8080/axis2/services/EventingService");
+
+ /**
+ * Default message box URL.
+ */
+ public static final URI DEFAULT_MESSAGE_BOX_URL = URI.create("http://localhost:8080/axis2/services/MsgBoxService");
+
+ /**
+ * DEFAULT_DSC_URL
+ */
+ public static final URI DEFAULT_DSC_URL = URI.create("https://silktree.cs.indiana.edu:52520/");
+
+ /**
+ * DEFAULT_MYPROXY_SERVER
+ */
+ public static final String DEFAULT_MYPROXY_SERVER = "myproxy.teragrid.org";
+
+ /**
+ * DEFAULT_MYPROXY_PORT
+ */
+ public static final int DEFAULT_MYPROXY_PORT = 7512;
+
+ /**
+ * DEFAULT_MYPROXY_LIFTTIME
+ */
+ public static final int DEFAULT_MYPROXY_LIFTTIME = 3600;
+
+ /**
+ * DEFAULT_WEB_REGISTRY
+ */
+ public static final URI DEFAULT_WEB_REGISTRY = URI.create("http://www.extreme.indiana.edu/xgws/wsdl/");
+
+ // File suffixes
+
+ /**
+ * File suffix for XML
+ */
+ public static final String XML_SUFFIX = ".xml";
+
+ /**
+ * File suffix for WSDL
+ */
+ public static final String WSDL_SUFFIX = ".wsdl";
+
+ /**
+ * File suffix for WSDL
+ */
+ public static final String WSDL_SUFFIX2 = "-wsdl.xml";
+
+ /**
+ * Suffix of a graph file
+ */
+ public static final String GRAPH_FILE_SUFFIX = ".xgr";
+
+ /**
+ * Suffix of a workflow file
+ */
+ public static final String WORKFLOW_FILE_SUFFIX = ".xwf";
+
+ /**
+ * File suffix for Jython scripts
+ */
+ public static final String JYTHON_SCRIPT_SUFFIX = ".py";
+
+ /**
+ * File suffix for BPEL
+ */
+ public static final String BPEL_SUFFIX = ".bpel";
+
+ /**
+ * File suffix for SCUFL
+ */
+ public static final String SCUFL_SCRIPT_SUFFIX = ".xml";
+
+ /**
+ * File suffix for PNG
+ */
+ public static final String PNG_SUFFIX = ".png";
+
+ /**
+ * Format name for png image
+ */
+ public static final String PNG_FORMAT_NAME = "PNG";
+
+ /**
+ * ODE URL
+ */
+ public static final String DEFAULT_ODE_URL = "https://pagodatree.cs.indiana.edu:17443";
+
+ /**
+ * WorkflowInterpreter URL
+ */
+ public static final URI DEFAULT_WORKFLOW_INTERPRETER_URL = URI
+ .create("http://localhost:8080/axis2/services/WorkflowInterpretor?wsdl");
+
+ /**
+ *
+ * PROXY URL
+ */
+
+ public static final URI DEFAULT_PROXY_URI = URI
+ .create("http://silktree.cs.indiana.edu:18080/axis2/services/WEPSService?wsdl");
+
+ /**
+ * WORKFLOW Namespace
+ */
+ public static final String LEAD_NS = "http://extreme.indiana.edu/lead/workflow";
+
+ /**
+ * OGCE WORKFLOW Namespace
+ */
+ public static final String OGCE_WORKFLOW_NS = "http://workflow.ogce.org/";
+
+ public static final String STREAM_SERVER = "http://pagodatree.cs.indiana.edu:8081/axis2/services/StreamService?wsdl";
+
+ public static final String STATIC_LABEL = "STATIC";
+ public static final URI REGISTRY_URL = URI.create("http://localhost:8080/airavata-registry/api");
+ public static final String DEFAULT_GATEWAY = "default";
+ public static final String REGISTRY_USERNAME = "admin";
+ public static final String REGISTRY_PASSPHRASE = "admin";
+ public static final String REGISTRY_TYPE_HOST_DESC = "HostDesc";
+ public static final String REGISTRY_TYPE_APPLICATION_DESC = "ApplicationDesc";
+ public static final String REGISTRY_TYPE_SERVICE_DESC = "ServiceDesc";
+ public static final String REGISTRY_TYPE_WORKFLOW = "workflow";
+ public static final String HTTP_SCHEMAS_AIRAVATA_APACHE_ORG_GFAC_TYPE = "http://airavata.apache.org/schemas/gfac/2012/12";
+
+ public static final String XBAYA_REGISTRY_USER = "xbaya.registry.user";
+ public static final String XBAYA_REGISTRY_URL = "xbaya.registry.url";
+ public static final String XBAYA_DEFAULT_GATEWAY = "xbaya.default.gateway";
+
+ /**
+ * XRegistry Resource Types for OGCE Resource
+ */
+ public static enum XR_Resource_Types {
+ Project, Experiment, WorkflowTemplate, WorkflowInstance, WorkflowInput, WorkflowOutput
+ };
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
new file mode 100644
index 0000000..1973172
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaEngine.java
@@ -0,0 +1,302 @@
+/*
+ *
+ * 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.xbaya;
+
+import java.net.URI;
+import java.util.List;
+
+import org.apache.airavata.client.AiravataAPIFactory;
+import org.apache.airavata.client.api.AiravataAPI;
+import org.apache.airavata.client.api.AiravataManager;
+import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.apache.airavata.workflow.model.component.amazon.AmazonComponentRegistry;
+import org.apache.airavata.workflow.model.component.local.LocalComponentRegistry;
+import org.apache.airavata.workflow.model.component.system.SystemComponentRegistry;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.ws.monitor.Monitor;
+import org.apache.airavata.ws.monitor.MonitorConfiguration;
+import org.apache.airavata.xbaya.component.registry.ComponentController;
+import org.apache.airavata.xbaya.interpretor.WorkflowInterpreter;
+import org.apache.airavata.xbaya.registry.PasswordCallbackImpl;
+import org.apache.airavata.xbaya.ui.XBayaGUI;
+import org.apache.airavata.xbaya.ui.monitor.MonitorStarter;
+import org.apache.airavata.xbaya.ui.utils.ErrorMessages;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentSelector;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentTreeNode;
+import org.apache.airavata.xbaya.workflow.WorkflowClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+//import org.apache.airavata.registry.api.AiravataRegistry2;
+
+public class XBayaEngine {
+
+ private static final Logger logger = LoggerFactory.getLogger(XBayaEngine.class);
+
+ private XBayaConfiguration configuration;
+
+ private XBayaGUI gui;
+
+ private WorkflowClient workflowClient;
+
+ private Monitor monitor;
+
+ private boolean exitOnClose = true;
+
+ private ComponentTreeNode systemComponentTree;
+
+ private SystemComponentRegistry componentRegistry;
+
+ private WorkflowInterpreter workflowInterpreter;
+
+ private AiravataAPI airavataAPI;
+
+ private ComponentSelector componentTreeViewer;
+
+ /**
+ * Constructs a ApplicationClient.
+ *
+ * @param configuration
+ */
+ public XBayaEngine(XBayaConfiguration configuration) {
+ this.configuration = configuration;
+
+ // Creates some essential objects.
+
+ MonitorConfiguration monitorConfiguration = new MonitorConfiguration(configuration.getBrokerURL(),
+ configuration.getTopic(), configuration.isPullMode(), configuration.getMessageBoxURL());
+ this.monitor = new Monitor(monitorConfiguration);
+
+ if (configuration.getAiravataAPI() == null && airavataAPI == null) {
+ try {
+ airavataAPI = AiravataAPIFactory.getAPI(configuration.getRegistryURL(),
+ configuration.getDefaultGateway(), configuration.getRegistryUserName(),
+ new PasswordCallbackImpl(configuration.getRegistryUserName(), configuration.getRegistryPassphrase()));
+ configuration.setAiravataAPI(airavataAPI);
+ } catch (AiravataAPIInvocationException e) {
+ logger.error("Unable to instantiate airavata api instance", e);
+ }
+
+ }
+
+ // MyProxy
+ // this.myProxyClient = new MyProxyClient(this.configuration.getMyProxyServer(),
+ // this.configuration.getMyProxyPort(), this.configuration.getMyProxyUsername(),
+ // this.configuration.getMyProxyPassphrase(), this.configuration.getMyProxyLifetime());
+ //
+ // // These have to be before the GUI setup.
+ // this.workflowClient = WorkflowEngineManager.getWorkflowClient();
+ // this.workflowClient.setXBayaEngine(this);
+
+
+ // Set up the GUI.
+ updateXBayaConfigurationServiceURLs();
+ XBayaEngine.this.gui = new XBayaGUI(XBayaEngine.this);
+
+ // Arguments errors.
+ for (Throwable e : this.configuration.getErrors()) {
+ getGUI().getErrorWindow().error(e.getMessage(), e);
+ }
+
+ // Initialization after the GUI setup.
+ initAfterGUI();
+ }
+
+ /**
+ * Returns the configuration.
+ *
+ * @return The configuration
+ */
+ public XBayaConfiguration getConfiguration() {
+ return this.configuration;
+ }
+
+ /**
+ * Returns the XwfGui. The XwfGui is either XwfAppletGui in case of the applet, or XwfApplicationGui in case of the
+ * application.
+ *
+ * @return the XwfGui
+ */
+ public XBayaGUI getGUI() {
+ return this.gui;
+ }
+
+ /**
+ * Returns the Workflow Client.
+ *
+ * @return the Workflow Client
+ */
+ public WorkflowClient getWorkflowClient() {
+ return this.workflowClient;
+ }
+
+
+ /**
+ * Returns the monitor.
+ *
+ * @return The monitor
+ */
+ public Monitor getMonitor() {
+ return this.monitor;
+ }
+
+ /**
+ * Disposes on exit.
+ *
+ * @throws WorkflowException
+ */
+ public void dispose() throws WorkflowException {
+ this.monitor.stop();
+ }
+
+ /**
+ * Initialization process. This method is called after the GUI is initialized.
+ */
+ private void initAfterGUI() {
+
+ initRegistry();
+
+ initMonitor();
+
+ }
+
+ /**
+ * Initializes registris.
+ */
+ private void initRegistry() {
+
+ componentTreeViewer = this.gui.getComponentSelector();
+ try {
+ this.componentRegistry = new SystemComponentRegistry();
+ // This does not take time, so we can do it in the same thread.
+ this.systemComponentTree = ComponentController.getComponentTree(this.componentRegistry);
+ componentTreeViewer.addComponentTree(0, this.systemComponentTree);
+
+ componentTreeViewer.addComponentTree(1, ComponentController.getComponentTree(new AmazonComponentRegistry()));
+
+ } catch (RuntimeException e) {
+ // This should not happen
+ e.printStackTrace();
+ getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ } catch (ComponentRegistryException e) {
+ e.printStackTrace();
+ getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+
+ List<String> localRegistryPaths = this.configuration.getLocalRegistry();
+ for (String path : localRegistryPaths) {
+ try {
+ LocalComponentRegistry registry = new LocalComponentRegistry(path);
+ // XXX This might take time, so it's better to move to another
+ // thread.
+ ComponentTreeNode componentTree = ComponentController.getComponentTree(registry);
+ componentTreeViewer.addComponentTree(componentTree);
+ } catch (ComponentRegistryException e) {
+ getGUI().getErrorWindow().error(ErrorMessages.COMPONENT_LIST_LOAD_ERROR, e);
+ } catch (RuntimeException e) {
+ getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+ }
+ }
+
+ /**
+ * Initializes monitor.
+ */
+ private void initMonitor() {
+ try {
+ if (this.configuration.isStartMonitor()) {
+ MonitorStarter starter = new MonitorStarter(this);
+ starter.start();
+ }
+ } catch (RuntimeException e) {
+ getGUI().getErrorWindow().error(ErrorMessages.MONITOR_SUBSCRIPTION_ERROR, e);
+ } catch (Error e) {
+ getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
+ }
+ }
+
+ public void resetWorkflowInterpreter() {
+ this.workflowInterpreter = null;
+ }
+
+
+ public WorkflowInterpreter getWorkflowInterpreter() {
+ return workflowInterpreter;
+ }
+
+ public void registerWorkflowInterpreter(WorkflowInterpreter workflowInterpreter) {
+ if (getWorkflowInterpreter()!=null){
+ throw new WorkflowRuntimeException("Critical Error!!! Workflow interpretter already running. Cleanup first");
+ }
+ this.workflowInterpreter = workflowInterpreter;
+ }
+
+
+ public void updateXBayaConfigurationServiceURLs() {
+ try {
+ if (this.getConfiguration().getAiravataAPI()!=null){
+ airavataAPI = getConfiguration().getAiravataAPI();
+ AiravataManager airavataManager = airavataAPI.getAiravataManager();
+// AiravataRegistry2 registry=this.getConfiguration().getJcrComponentRegistry().getRegistry();
+ URI eventingServiceURL = airavataManager.getEventingServiceURL();
+ if (eventingServiceURL!=null) {
+ this.getConfiguration().setBrokerURL(eventingServiceURL);
+ this.getMonitor()
+ .getConfiguration()
+ .setBrokerURL(eventingServiceURL);
+ }
+ URI messageBoxServiceURL = airavataManager.getMessageBoxServiceURL();
+ if (messageBoxServiceURL!=null) {
+ this.getConfiguration()
+ .setMessageBoxURL(messageBoxServiceURL);
+ this.getMonitor()
+ .getConfiguration()
+ .setMessageBoxURL(messageBoxServiceURL);
+ }
+ List<URI> interpreterServiceURLList = airavataManager.getWorkflowInterpreterServiceURLs();
+ if (interpreterServiceURLList.size()>0) {
+ this.getConfiguration()
+ .setWorkflowInterpreterURL(interpreterServiceURLList.get(0));
+ }
+// List<URI> gfacURLList = airavataManager.getGFaCURLs();
+// if (gfacURLList.size()>0) {
+// this.getConfiguration().setGFacURL(gfacURLList.get(0));
+// }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public AiravataAPI getAiravataAPI() {
+ return airavataAPI;
+ }
+
+ public void setAiravataAPI(AiravataAPI airavataAPI) {
+ this.airavataAPI = airavataAPI;
+ }
+
+ public void reloadRegistry(){
+ componentTreeViewer.refresh();
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
new file mode 100644
index 0000000..5e34672
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/XBayaVersion.java
@@ -0,0 +1,42 @@
+/*
+ *
+ * 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.xbaya;
+
+import org.apache.airavata.common.utils.Version;
+
+public class XBayaVersion {
+
+ /**
+ * Version number
+ */
+ public final static Version VERSION = new Version("Airavata XBaya", 0, 11,
+ null, null, null);;
+
+ /**
+ * Prints the version
+ *
+ * @param args
+ */
+ public static void main(String[] args) {
+ System.out.println(VERSION);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java
new file mode 100644
index 0000000..adeaa92
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/component/registry/ComponentController.java
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.xbaya.component.registry;
+
+import java.util.List;
+
+import org.apache.airavata.workflow.model.component.ComponentReference;
+import org.apache.airavata.workflow.model.component.ComponentRegistry;
+import org.apache.airavata.workflow.model.component.ComponentRegistryException;
+import org.apache.airavata.xbaya.ui.widgets.component.ComponentTreeNode;
+
+public class ComponentController {
+
+ public static ComponentTreeNode getComponentTree(ComponentRegistry registry) throws ComponentRegistryException {
+ ComponentTreeNode tree = new ComponentTreeNode(registry);
+ addComponentReferencesToTree(tree, registry.getComponentReferenceList());
+ return tree;
+ }
+
+ private static void addComponentReferencesToTree(ComponentTreeNode tree,
+ List<ComponentReference> componentReferenceList) {
+ for (ComponentReference componentReference : componentReferenceList) {
+ ComponentTreeNode componentTreeNode = new ComponentTreeNode(componentReference);
+ if (componentReference.isParentComponent()){
+ addComponentReferencesToTree(componentTreeNode, componentReference.getChildComponentReferences());
+ }
+ tree.add(componentTreeNode);
+ }
+ }
+
+}