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:30:56 UTC
[54/90] [abbrv] AIRAVATA-1124
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeNode.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeNode.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeNode.java
new file mode 100644
index 0000000..a2326ed
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/ui/widgets/component/ComponentTreeNode.java
@@ -0,0 +1,107 @@
+/*
+ *
+ * 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.ui.widgets.component;
+
+import java.util.List;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.MutableTreeNode;
+
+import org.apache.airavata.workflow.model.component.ComponentReference;
+import org.apache.airavata.workflow.model.component.ComponentRegistry;
+
+public class ComponentTreeNode extends DefaultMutableTreeNode {
+
+ private ComponentReference componentReference;
+
+ private ComponentRegistry componentRegistry;
+
+ /**
+ * Constructs a ComponentTreeNode.
+ *
+ * @param name
+ */
+ public ComponentTreeNode(String name) {
+ super(name);
+ }
+
+ /**
+ * Constructs a ComponentTreeNode.
+ *
+ * @param componentReference
+ */
+ public ComponentTreeNode(ComponentReference componentReference) {
+ super(componentReference);
+ this.componentReference = componentReference;
+ }
+
+ /**
+ * Constructs a ComponentTreeNode.
+ *
+ * @param componentRegistry
+ */
+ public ComponentTreeNode(ComponentRegistry componentRegistry) {
+ super(componentRegistry);
+ this.componentRegistry = componentRegistry;
+ }
+
+ /**
+ * @return The component reference.
+ */
+ public ComponentReference getComponentReference() {
+ return this.componentReference;
+ }
+
+ /**
+ * @param componentRegistry
+ */
+ public void setComponentRegistry(ComponentRegistry componentRegistry) {
+ super.setUserObject(componentRegistry);
+ this.componentRegistry = componentRegistry;
+ }
+
+ /**
+ * @return The component registry.
+ */
+ public ComponentRegistry getComponentRegistry() {
+ return this.componentRegistry;
+ }
+
+ /**
+ * @see javax.swing.tree.DefaultMutableTreeNode#insert(javax.swing.tree.MutableTreeNode, int)
+ */
+ @Override
+ public void insert(MutableTreeNode newChild, int childIndex) {
+ if (!(newChild instanceof ComponentTreeNode)) {
+ throw new IllegalArgumentException();
+ }
+ super.insert(newChild, childIndex);
+ }
+
+ /**
+ * @return The children.
+ */
+ @SuppressWarnings("unchecked")
+ public List<ComponentTreeNode> getChildren() {
+ return this.children;
+ }
+}
\ 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/util/AmazonUtil.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/AmazonUtil.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/AmazonUtil.java
new file mode 100644
index 0000000..3105d64
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/AmazonUtil.java
@@ -0,0 +1,150 @@
+/*
+ *
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.airavata.xbaya.core.amazon.AmazonCredential;
+
+import com.amazonaws.auth.BasicAWSCredentials;
+import com.amazonaws.services.ec2.AmazonEC2;
+import com.amazonaws.services.ec2.AmazonEC2Client;
+import com.amazonaws.services.ec2.model.DescribeInstancesResult;
+import com.amazonaws.services.ec2.model.DescribeKeyPairsResult;
+import com.amazonaws.services.ec2.model.Instance;
+import com.amazonaws.services.ec2.model.KeyPairInfo;
+import com.amazonaws.services.ec2.model.Reservation;
+import com.amazonaws.services.ec2.model.RunInstancesRequest;
+import com.amazonaws.services.ec2.model.RunInstancesResult;
+import com.amazonaws.services.ec2.model.TerminateInstancesRequest;
+
+public class AmazonUtil {
+
+ /**
+ * Amazon EC2 instance type
+ */
+ public final static String[] INSTANCE_TYPE = { "t1.micro", "m1.small", "m1.large", "m1.xlarge", "m2.xlarge",
+ "m2.2xlarge", "m2.4xlarge", "c1.medium", "c1.xlarge" };
+
+ private static AmazonEC2 getEC2Client() {
+ AmazonEC2 ec2 = new AmazonEC2Client(new BasicAWSCredentials(AmazonCredential.getInstance().getAwsAccessKeyId(),
+ AmazonCredential.getInstance().getAwsSecretAccessKey()));
+ return ec2;
+ }
+
+ /**
+ * Launch a new EC2 instance
+ *
+ * @param AMI_ID
+ * @param type
+ * @param number
+ * @return list of newly launched instances
+ */
+ public static List<Instance> launchInstance(String AMI_ID, String type, Integer number) {
+ List<Instance> resultList = new ArrayList<Instance>();
+
+ RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
+ request.setInstanceType(type);
+
+ RunInstancesResult result = getEC2Client().runInstances(request);
+ resultList.addAll(result.getReservation().getInstances());
+ return resultList;
+ }
+
+ /**
+ * Launch a new EC2 instance
+ *
+ * @param AMI_ID
+ * @param type
+ * @param number
+ * @param keyname
+ * @return list of newly launched instances
+ */
+ public static List<Instance> launchInstance(String AMI_ID, String type, Integer number, String keyname) {
+ List<Instance> resultList = new ArrayList<Instance>();
+
+ RunInstancesRequest request = new RunInstancesRequest(AMI_ID, number, number);
+ request.setInstanceType(type);
+ request.setKeyName(keyname);
+
+ RunInstancesResult result = getEC2Client().runInstances(request);
+ resultList.addAll(result.getReservation().getInstances());
+ return resultList;
+ }
+
+ /**
+ * Load instances
+ *
+ * @return list of instances
+ */
+ public static List<Instance> loadInstances() {
+ List<Instance> resultList = new ArrayList<Instance>();
+ DescribeInstancesResult describeInstancesResult = getEC2Client().describeInstances();
+ List<Reservation> reservations = describeInstancesResult.getReservations();
+ for (Iterator<Reservation> iterator = reservations.iterator(); iterator.hasNext();) {
+ Reservation reservation = iterator.next();
+ for (Instance instance : reservation.getInstances()) {
+ resultList.add(instance);
+ }
+ }
+ return resultList;
+ }
+
+ /**
+ * Load keypairs
+ *
+ * @return list of keypairs
+ */
+ public static List<String> loadKeypairs() {
+ List<String> resultList = new ArrayList<String>();
+ DescribeKeyPairsResult results = getEC2Client().describeKeyPairs();
+ for (KeyPairInfo key : results.getKeyPairs()) {
+ resultList.add(key.getKeyName());
+ }
+ return resultList;
+ }
+
+ /**
+ * Terminate instances
+ *
+ * @param instanceIds
+ */
+ public static void terminateInstances(List<String> instanceIds) {
+ // terminate
+ TerminateInstancesRequest request = new TerminateInstancesRequest(instanceIds);
+ getEC2Client().terminateInstances(request);
+ }
+
+ /**
+ * Terminate instances
+ *
+ * @param instanceIds
+ */
+ public static void terminateInstances(String... instanceIds) {
+ // terminate
+ TerminateInstancesRequest request = new TerminateInstancesRequest();
+ getEC2Client().terminateInstances(request.withInstanceIds(instanceIds));
+ }
+
+}
\ 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/util/Data.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/Data.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/Data.java
new file mode 100644
index 0000000..f41f0b3
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/Data.java
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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.util;
+
+public class Data {
+ private String destination_path;
+ private String verify_size;
+ private String source_path;
+ private boolean recursive;
+ private String DATA_TYPE;
+
+ public String getDestination_path() {
+ return destination_path;
+ }
+
+ public void setDestination_path(String destination_path) {
+ this.destination_path = destination_path;
+ }
+
+ public String getVerify_size() {
+ return verify_size;
+ }
+
+ public void setVerify_size(String verify_size) {
+ this.verify_size = verify_size;
+ }
+
+ public String getSource_path() {
+ return source_path;
+ }
+
+ public void setSource_path(String source_path) {
+ this.source_path = source_path;
+ }
+
+ public boolean getRecursive() {
+ return recursive;
+ }
+
+ public void setRecursive(boolean recursive) {
+ this.recursive = recursive;
+ }
+
+ public String getDATA_TYPE() {
+ return DATA_TYPE;
+ }
+
+ public void setDATA_TYPE(String DATA_TYPE) {
+ this.DATA_TYPE = DATA_TYPE;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/GOConstants.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/GOConstants.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/GOConstants.java
new file mode 100644
index 0000000..50efb17
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/GOConstants.java
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.util;
+
+public class GOConstants {
+ public static final String BASEURL = "https://transfer.api.globusonline.org/v0.10";
+ public static final String NEXUS_API_HOST = "nexus.api.globusonline.org";
+ public static final int NEXUS_API_PORT = 443;
+ public static final String NEXUS_API_SCHEMA = "https";
+ public static final String GOAUTH_TOKEN_REQ_URL = "/goauth/token?grant_type=client_credentials";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/GlobusOnlineUtils.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/GlobusOnlineUtils.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/GlobusOnlineUtils.java
new file mode 100644
index 0000000..e106cb5
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/GlobusOnlineUtils.java
@@ -0,0 +1,245 @@
+///*
+// *
+// * 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.util;
+//
+//import org.apache.http.HttpEntity;
+//import org.apache.http.HttpHost;
+//import org.apache.http.auth.AuthScope;
+//import org.apache.http.auth.UsernamePasswordCredentials;
+//import org.apache.http.client.AuthCache;
+//import org.apache.http.client.ClientProtocolException;
+//import org.apache.http.client.CredentialsProvider;
+//import org.apache.http.client.methods.CloseableHttpResponse;
+//import org.apache.http.client.methods.HttpGet;
+//import org.apache.http.client.protocol.HttpClientContext;
+//import org.apache.http.impl.auth.BasicScheme;
+//import org.apache.http.impl.client.BasicAuthCache;
+//import org.apache.http.impl.client.BasicCredentialsProvider;
+//import org.apache.http.impl.client.CloseableHttpClient;
+//import org.apache.http.impl.client.HttpClients;
+//import org.apache.http.util.EntityUtils;
+//import org.globusonline.transfer.APIError;
+//import org.globusonline.transfer.Authenticator;
+//import org.globusonline.transfer.GoauthAuthenticator;
+//import org.globusonline.transfer.JSONTransferAPIClient;
+//import org.json.JSONArray;
+//import org.json.JSONException;
+//import org.json.JSONObject;
+//import org.json.JSONTokener;
+//
+//import java.io.File;
+//import java.io.IOException;
+//import java.io.InputStream;
+//import java.io.InputStreamReader;
+//import java.security.GeneralSecurityException;
+//import java.security.KeyManagementException;
+//import java.security.NoSuchAlgorithmException;
+//import java.text.DateFormat;
+//import java.text.SimpleDateFormat;
+//import java.util.*;
+//
+//public class GlobusOnlineUtils {
+// public static final String ACCESS_TOKEN = "access_token";
+//
+// private static String goUserName;
+// private static String goPWD;
+//
+// public static void main(String[] args) {
+//// String s = appendFileName("/~/Desktop/1.docx", "/~/");
+//// System.out.println(s);
+//
+// }
+//
+// public GlobusOnlineUtils(String goUsername, String goPwd) {
+// goUserName = goUsername;
+// goPWD = goPwd;
+// }
+//
+// public String getAuthenticationToken() {
+// String token = null;
+// HttpHost targetHost = new HttpHost(GOConstants.NEXUS_API_HOST, GOConstants.NEXUS_API_PORT, GOConstants.NEXUS_API_SCHEMA);
+// CredentialsProvider credsProvider = new BasicCredentialsProvider();
+// credsProvider.setCredentials(
+// new AuthScope(targetHost.getHostName(), targetHost.getPort()),
+// new UsernamePasswordCredentials(goUserName, goPWD));
+//
+// CloseableHttpClient httpclient = HttpClients.custom()
+// .setDefaultCredentialsProvider(credsProvider).build();
+// try {
+//
+// // Create AuthCache instance
+// AuthCache authCache = new BasicAuthCache();
+// // Generate BASIC scheme object and add it to the local
+// // auth cache
+// BasicScheme basicScheme = new BasicScheme();
+// authCache.put(targetHost, basicScheme);
+//
+// // Add AuthCache to the execution context
+// HttpClientContext localContext = HttpClientContext.create();
+// localContext.setAuthCache(authCache);
+//
+// HttpGet httpget = new HttpGet(GOConstants.GOAUTH_TOKEN_REQ_URL);
+// httpget.addHeader("accept", "application/json");
+// System.out.println("executing request: " + httpget.getRequestLine());
+// System.out.println("to target: " + targetHost);
+//
+// CloseableHttpResponse response = httpclient.execute(targetHost, httpget, localContext);
+// try {
+// HttpEntity entity = response.getEntity();
+// InputStream entityContent = entity.getContent();
+// InputStreamReader reader = new InputStreamReader(entityContent);
+// JSONTokener tokenizer = new JSONTokener(reader);
+// JSONObject json = new JSONObject(tokenizer);
+// token = (String)json.get(ACCESS_TOKEN);
+// entityContent.close();
+// EntityUtils.consume(entity);
+//
+// } catch (JSONException e) {
+// e.printStackTrace();
+// } finally {
+// response.close();
+// }
+// //}
+// } catch (ClientProtocolException e) {
+// e.printStackTrace();
+// } catch (IOException e) {
+// e.printStackTrace();
+// } finally {
+// try {
+// httpclient.close();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+// }
+// return token;
+// }
+//
+// public JSONTransferAPIClient getAuthenticated (){
+// JSONTransferAPIClient jsonTransferAPIClient = null;
+// try {
+// String authenticationToken = getAuthenticationToken();
+// Authenticator authenticator = new GoauthAuthenticator(authenticationToken);
+// jsonTransferAPIClient = new JSONTransferAPIClient(goUserName,
+// null, GOConstants.BASEURL);
+// jsonTransferAPIClient.setAuthenticator(authenticator);
+// } catch (KeyManagementException e) {
+// e.printStackTrace();
+// } catch (NoSuchAlgorithmException e) {
+// e.printStackTrace();
+// }
+// return jsonTransferAPIClient;
+// }
+//
+// public String transferFiles (TransferFile tf){
+// String taskId = null;
+// try {
+// JSONTransferAPIClient apiClient = getAuthenticated();
+// String submissionId = apiClient.getSubmissionId();
+// tf.setSubmission_id(submissionId);
+// JSONObject jsonObject = new JSONObject(tf);
+// JSONTransferAPIClient.Result result = apiClient.transfer(jsonObject);
+// taskId = (String)result.document.get("task_id");
+// } catch (IOException e) {
+// e.printStackTrace();
+// } catch (GeneralSecurityException e) {
+// e.printStackTrace();
+// } catch (JSONException e) {
+// e.printStackTrace();
+// } catch (APIError apiError) {
+// apiError.printStackTrace();
+// }
+// return taskId;
+// }
+//
+// public TransferFile getTransferFile (String sourceEp,
+// String destEp,
+// String sourcePath,
+// String destPath,
+// String label){
+//
+// TransferFile transferFile = new TransferFile();
+//
+//
+// transferFile.setPreserve_timestamp(false);
+// transferFile.setDATA_TYPE("transfer");
+// transferFile.setEncrypt_data(false);
+// transferFile.setSync_level(null);
+// transferFile.setSource_endpoint(sourceEp);
+// transferFile.setLabel(label);
+// transferFile.setDestination_endpoint(destEp);
+// transferFile.setLength(2);
+// transferFile.setDeadline(getDeadlineForTransfer());
+// transferFile.setNotify_on_succeeded(true);
+// transferFile.setNotify_on_failed(true);
+// transferFile.setVerify_checksum(false);
+// transferFile.setDelete_destination_extra(false);
+// Data[] datas = new Data[1];
+// Data data = new Data();
+// data.setDATA_TYPE("transfer_item");
+// data.setDestination_path(appendFileName(sourcePath, destPath));
+// data.setVerify_size(null);
+// data.setSource_path(sourcePath);
+// data.setRecursive(false);
+// datas[0] = data;
+// transferFile.setDATA(datas);
+// return transferFile;
+// }
+//
+// private static String appendFileName(String sourcePath, String destPath){
+// String[] split = sourcePath.split(File.separator);
+// String fileName = split[split.length - 1];
+// if (destPath.endsWith(File.separator)){
+// destPath = destPath.concat(fileName);
+// }else {
+// destPath = destPath.concat("/" + fileName);
+// }
+// System.out.println(destPath);
+// return destPath;
+// }
+//
+// private String getDeadlineForTransfer (){
+// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+// Calendar calendar = Calendar.getInstance();
+// calendar.add(calendar.DAY_OF_MONTH, 1);
+// Date tomorrow = calendar.getTime();
+// String date = dateFormat.format(tomorrow);
+// System.out.println(date);
+// return date;
+// }
+//
+// public List<String> getEPList() throws IOException, APIError, GeneralSecurityException, JSONException {
+// List<String> epList = new ArrayList<String>();
+// Map<String, String> params = new HashMap<String, String>();
+// params.put("limit", "0");
+// JSONTransferAPIClient transferAPIClient = getAuthenticated();
+// JSONTransferAPIClient.Result result = transferAPIClient.getResult("/endpoint_list", params);
+// JSONObject document = result.document;
+// JSONArray dataArray = document.getJSONArray("DATA");
+// for (int i = 0; i < dataArray.length(); i++ ){
+// JSONObject jsonObject = dataArray.getJSONObject(i);
+// String epName = (String)jsonObject.get("canonical_name");
+// epList.add(epName);
+// }
+// return epList;
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
new file mode 100644
index 0000000..8f1a01d
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/InterpreterUtil.java
@@ -0,0 +1,391 @@
+/*
+ *
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.Node.NodeExecutionState;
+import org.apache.airavata.workflow.model.graph.amazon.InstanceNode;
+import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+import org.apache.airavata.workflow.model.graph.system.DifferedInputNode;
+import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
+import org.apache.airavata.workflow.model.graph.system.EndDoWhileNode;
+import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
+import org.apache.airavata.workflow.model.graph.system.EndifNode;
+import org.apache.airavata.workflow.model.graph.system.ForEachNode;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.graph.system.SystemDataPort;
+import org.apache.airavata.workflow.model.graph.ws.WSGraph;
+import org.apache.airavata.workflow.model.graph.ws.WSNode;
+import org.apache.airavata.workflow.model.graph.ws.WSPort;
+import org.apache.airavata.xbaya.interpretor.SystemComponentInvoker;
+import org.apache.airavata.xbaya.interpretor.WorkFlowInterpreterException;
+import org.apache.airavata.xbaya.invoker.GenericInvoker;
+import org.apache.airavata.xbaya.invoker.Invoker;
+import org.apache.airavata.xbaya.invoker.WorkflowInvokerWrapperForGFacInvoker;
+import org.xmlpull.infoset.XmlElement;
+import org.xmlpull.infoset.impl.XmlElementWithViewsImpl;
+
+import xsul5.XmlConstants;
+import xsul5.wsdl.WsdlPort;
+import xsul5.wsdl.WsdlService;
+//import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler;
+//import org.apache.airavata.xbaya.ui.monitor.MonitorEventHandler.NodeState;
+
+public class InterpreterUtil {
+ /**
+ * This method returns the input values for given foreach node
+ *
+ * @param forEachNode
+ * @param listOfValues
+ * @param invokerMap
+ * @return
+ * @throws WorkflowException
+ */
+ public static Object getInputsForForEachNode(final ForEachNode forEachNode, final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap)
+ throws WorkflowException {
+ List<DataPort> inputPorts = forEachNode.getInputPorts();
+
+ Object returnValForProvenance = null;
+ for (DataPort inputPort : inputPorts) {
+
+ Node inputNode = inputPort.getFromNode();
+ // if input node for for-each is WSNode
+ if (inputNode instanceof InputNode) {
+// for (DataPort dataPort : forEachNode.getInputPorts()) {
+ returnValForProvenance = InterpreterUtil.findInputFromPort(inputPort, invokerMap);
+ if (null == returnValForProvenance) {
+ throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
+ }
+ String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
+ listOfValues.addAll(Arrays.asList(vals));
+// }
+ } else {
+ Invoker workflowInvoker = invokerMap.get(inputNode);
+ if (workflowInvoker != null) {
+ if (workflowInvoker instanceof GenericInvoker) {
+
+ String outputName = inputNode.getOutputPort(0).getName();
+ returnValForProvenance = workflowInvoker.getOutput(outputName);
+ Iterator children = null;
+ if (returnValForProvenance instanceof org.xmlpull.v1.builder.XmlElement) {
+ org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
+ children = msgElmt.children();
+ } else {
+ XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
+ children = msgElmt.children().iterator();
+ }
+ while (children.hasNext()) {
+ Object object = children.next();
+ if (object instanceof org.xmlpull.v1.builder.XmlElement) {
+ org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
+ Iterator valItr = child.children();
+ if (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof String) {
+ listOfValues.add(object2.toString());
+ }
+ }
+ }
+ if (object instanceof XmlElement) {
+ listOfValues.add(((XmlElement) object).children().iterator().next().toString());
+ }if (object instanceof String){
+ listOfValues.add(object.toString());
+ }
+ }
+ } else if (workflowInvoker instanceof SystemComponentInvoker) {
+ int index = inputNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort());
+ String outputName = "";
+ if (inputNode.getInputPort(index) instanceof SystemDataPort) {
+ outputName = ((SystemDataPort) inputNode.getInputPort(index)).getWSComponentPort().getName();
+ } else if (inputNode.getInputPort(index) instanceof WSPort) {
+ outputName = ((SystemDataPort) inputNode.getInputPort(inputNode.getOutputPorts().indexOf(
+ inputPort.getEdge(0).getFromPort()))).getWSComponentPort().getName();
+ }
+ returnValForProvenance = workflowInvoker.getOutput(outputName);
+ XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
+ Iterator valItr = msgElmt.children().iterator();
+ while (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof XmlElement) {
+ listOfValues.add(((XmlElement) object2).children().iterator().next().toString());
+ }
+ }
+ }
+ } else {
+ throw new WorkFlowInterpreterException("Did not find inputs from WS to foreach");
+ }
+ }
+ }
+ return returnValForProvenance;
+ }
+
+ /**
+ *
+ * @param inputPort
+ * @param invokerMap
+ * @return
+ * @throws WorkflowException
+ */
+ public static Object findInputFromPort(DataPort inputPort, Map<Node, Invoker> invokerMap) throws WorkflowException {
+ Object outputVal = null;
+ Node fromNode = inputPort.getFromNode();
+ if (fromNode instanceof InputNode) {
+ outputVal = ((InputNode) fromNode).getDefaultValue();
+ } else if (fromNode instanceof ConstantNode) {
+ outputVal = ((ConstantNode) fromNode).getValue();
+ } else if (fromNode instanceof DifferedInputNode && ((DifferedInputNode) fromNode).isConfigured()) {
+ outputVal = ((DifferedInputNode) fromNode).getDefaultValue();
+ } else if (fromNode instanceof EndifNode || fromNode instanceof DoWhileNode || fromNode instanceof EndDoWhileNode) {
+ Invoker fromInvoker = invokerMap.get(fromNode);
+ outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
+ } else if (fromNode instanceof InstanceNode) {
+ return ((InstanceNode) fromNode).getOutputInstanceId();
+ } else if (fromNode instanceof EndForEachNode) {
+ outputVal = "";
+ Invoker workflowInvoker = invokerMap.get(fromNode);
+ String outputName = "";
+ if (inputPort instanceof SystemDataPort) {
+ outputName = ((SystemDataPort) inputPort).getWSComponentPort().getName();
+
+ } else if (inputPort instanceof WSPort) {
+ outputName = ((SystemDataPort) fromNode.getInputPort(fromNode.getOutputPorts().indexOf(inputPort.getEdge(0).getFromPort())))
+ .getWSComponentPort().getName();
+ }
+ XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + workflowInvoker.getOutput(outputName) + "</temp>");
+ Iterator valItr = msgElmt.children().iterator();
+ while (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof XmlElement) {
+
+ if (((XmlElement) object2).children().iterator().hasNext()) {
+ outputVal = outputVal + StringUtil.DELIMETER + StringUtil.quoteString(((XmlElement) object2).children().iterator().next().toString());
+ }
+ }
+ }
+
+ if (((String) outputVal).length() == 0) {
+ throw new WorkflowException("Empty Output Generated");
+ }
+ outputVal = ((String) outputVal).substring(1, ((String) outputVal).length());
+ } else {
+ Invoker fromInvoker = invokerMap.get(fromNode);
+ try {
+ if (fromInvoker != null)
+ outputVal = fromInvoker.getOutput(inputPort.getFromPort().getName());
+
+ } catch (Exception e) {
+ // if the value is still null look it up from the inputport name
+ // because the value is set to the input port name at some point
+ // there is no harm in doing this
+ if (null == outputVal) {
+ outputVal = fromInvoker.getOutput(inputPort.getName());
+ }
+ }
+
+ }
+ return outputVal;
+
+ }
+
+ /**
+ * @param node
+ * @return
+ */
+ public static Node findEndForEachFor(ForEachNode node) {
+
+ Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
+ if (toNodes.size() != 1) {
+ throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
+ }
+ Node middleNode = toNodes.iterator().next();
+ List<DataPort> outputPorts = middleNode.getOutputPorts();
+ for (DataPort dataPort : outputPorts) {
+ if (dataPort.getToNodes().size() == 1) {
+ Node possibleEndForEachNode = dataPort.getToNodes().get(0);
+ if (possibleEndForEachNode instanceof EndForEachNode) {
+ return possibleEndForEachNode;
+ }
+ }
+ }
+ throw new WorkflowRuntimeException("EndForEachNode not found");
+ }
+
+ public static Integer[] getNumberOfInputsForForEachNode(final ForEachNode forEachNode, Map<Node, Invoker> invokerMap) throws WorkflowException {
+ List<DataPort> inputPorts = forEachNode.getInputPorts();
+ Integer[] inputNumbers = new Integer[inputPorts.size()];
+ for (DataPort forEachInputPort : inputPorts) {
+ // if input node for for-each is WSNode
+ Node forEachInputNode = forEachInputPort.getFromNode();
+ int index = 0;
+ Object returnValForProvenance = null;
+ if (forEachInputNode instanceof InputNode) {
+ returnValForProvenance = InterpreterUtil.findInputFromPort(forEachInputPort, invokerMap);
+ if (null == returnValForProvenance) {
+ throw new WorkFlowInterpreterException("Unable to find input for the node:" + forEachNode.getID());
+ }
+ String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
+ inputNumbers[inputPorts.indexOf(forEachInputPort)] = vals.length;
+ } else {
+ Invoker workflowInvoker = invokerMap.get(forEachInputNode);
+ if (workflowInvoker != null) {
+ if (workflowInvoker instanceof GenericInvoker) {
+
+ returnValForProvenance = ((GenericInvoker) workflowInvoker).getOutputs();
+ String message = returnValForProvenance.toString();
+
+ XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString(message);
+ Iterator children = msgElmt.children().iterator();
+ while (children.hasNext()) {
+ Object object = children.next();
+ // foreachWSNode.getInputPort(0).getType()
+ if (object instanceof XmlElement) {
+ index++;
+ }
+ }
+ } else if (workflowInvoker instanceof WorkflowInvokerWrapperForGFacInvoker) {
+ String outputName = forEachInputNode.getOutputPort(0).getName();
+ returnValForProvenance = workflowInvoker.getOutput(outputName);
+ org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
+ Iterator children = msgElmt.children();
+ while (children.hasNext()) {
+ Object object = children.next();
+ if (object instanceof org.xmlpull.v1.builder.XmlElement) {
+ org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
+ Iterator valItr = child.children();
+ if (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof String) {
+ index++;
+ }
+ }
+ }
+ }
+ inputNumbers[inputPorts.indexOf(forEachInputPort)] = index;
+ } else if (workflowInvoker instanceof SystemComponentInvoker) {
+ int portIndex = forEachInputNode.getOutputPorts().indexOf(forEachInputPort.getEdge(0).getFromPort());
+ String outputName = "";
+ if (forEachInputNode.getInputPort(portIndex) instanceof SystemDataPort) {
+ outputName = ((SystemDataPort) forEachInputNode.getInputPort(portIndex)).getWSComponentPort().getName();
+ } else if (forEachInputNode.getInputPort(portIndex) instanceof WSPort) {
+ outputName = ((WSPort) forEachInputNode.getInputPort(portIndex)).getComponentPort().getName();
+ }
+ returnValForProvenance = workflowInvoker.getOutput(outputName);
+ XmlElement msgElmt = XmlConstants.BUILDER.parseFragmentFromString("<temp>" + returnValForProvenance + "</temp>");
+ Iterator valItr = msgElmt.children().iterator();
+ while (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof XmlElement) {
+ index++;
+ }
+ }
+ inputNumbers[inputPorts.indexOf(forEachInputPort)] = index;
+ }
+
+ } else {
+ throw new WorkFlowInterpreterException("Did not find inputs from WS to foreach");
+ }
+ }
+ }
+ return inputNumbers;
+ }
+
+ public static ArrayList<Node> getFinishedNodesDynamically(WSGraph graph) {
+ return getNodesWithBodyColor(NodeExecutionState.FINISHED, graph);
+ }
+
+ public static ArrayList<Node> getFailedNodesDynamically(WSGraph graph) {
+ return getNodesWithBodyColor(NodeExecutionState.FAILED, graph);
+ }
+
+ public static ArrayList<Node> getWaitingNodesDynamically(WSGraph graph) {
+ return getNodesWithBodyColor(NodeExecutionState.WAITING, graph);
+ }
+
+ public static ArrayList<Node> getNodesWithBodyColor(NodeExecutionState state, WSGraph graph) {
+ ArrayList<Node> list = new ArrayList<Node>();
+ List<NodeImpl> nodes = graph.getNodes();
+ for (Node node : nodes) {
+ if (node.getState()==state) {
+ list.add(node);
+ }
+ }
+ return list;
+ }
+
+ public static int getRunningNodeCountDynamically(WSGraph graph) {
+ return getNodeCountWithBodyColor(NodeExecutionState.EXECUTING, graph);
+ }
+
+ public static int getFailedNodeCountDynamically(WSGraph graph) {
+ return getFailedNodesDynamically(graph).size();
+ }
+
+ public static int getWaitingNodeCountDynamically(WSGraph graph) {
+ return getNodeCountWithBodyColor(NodeExecutionState.WAITING, graph);
+ }
+
+ public static int getNodeCountWithBodyColor(NodeExecutionState state, WSGraph graph) {
+ int sum = 0;
+ List<NodeImpl> nodes = graph.getNodes();
+ for (Node node : nodes) {
+ if (node.getState()==state) {
+ ++sum;
+ }
+ }
+ return sum;
+ }
+
+ public static String getEPR(WSNode wsNode) {
+ Iterable<WsdlService> services = wsNode.getComponent().getWSDL().services();
+ Iterator<WsdlService> iterator = services.iterator();
+ if (iterator.hasNext()) {
+ Iterable<WsdlPort> ports = iterator.next().ports();
+ Iterator<WsdlPort> portIterator = ports.iterator();
+ if (portIterator.hasNext()) {
+ WsdlPort port = portIterator.next();
+ Iterable children = port.xml().children();
+ Iterator childIterator = children.iterator();
+ while (childIterator.hasNext()) {
+ Object next = childIterator.next();
+ if (next instanceof XmlElementWithViewsImpl) {
+ org.xmlpull.infoset.XmlAttribute epr = ((XmlElementWithViewsImpl) next).attribute("location");
+ return epr.getValue();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/RegistryConstants.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/RegistryConstants.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/RegistryConstants.java
new file mode 100644
index 0000000..d59dad4
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/RegistryConstants.java
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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.util;
+
+public class RegistryConstants {
+ public static final String REGISTRY_TYPE_JCR="registry.type.jcr";
+ public static final String REGISTRY_TYPE_LOCAL="registry.type.local";
+ public static final String REGISTRY_TYPE_URL="registry.type.url";
+ public static final String REGISTRY_TYPE_GPEL="registry.type.gpel";
+ public static final String REGISTRY_TYPE_WEB="registry.type.web";
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/TransferFile.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/TransferFile.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/TransferFile.java
new file mode 100644
index 0000000..2748aa2
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/TransferFile.java
@@ -0,0 +1,170 @@
+/*
+ *
+ * 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.util;
+
+
+public class TransferFile {
+ private String submission_id;
+ private boolean preserve_timestamp;
+ private String DATA_TYPE;
+ private boolean encrypt_data;
+ private String sync_level;
+ private String source_endpoint;
+ private String label;
+ private String destination_endpoint;
+ private int length;
+ private String deadline;
+ private boolean notify_on_succeeded;
+ private boolean notify_on_failed;
+ private boolean verify_checksum;
+ private boolean notify_on_inactive;
+ private boolean delete_destination_extra;
+ private Data[] DATA;
+
+ public String getSubmission_id() {
+ return submission_id;
+ }
+
+ public void setSubmission_id(String submission_id) {
+ this.submission_id = submission_id;
+ }
+
+ public boolean getPreserve_timestamp() {
+ return preserve_timestamp;
+ }
+
+ public void setPreserve_timestamp(boolean preserve_timestamp) {
+ this.preserve_timestamp = preserve_timestamp;
+ }
+
+ public String getDATA_TYPE() {
+ return DATA_TYPE;
+ }
+
+ public void setDATA_TYPE(String DATA_TYPE) {
+ this.DATA_TYPE = DATA_TYPE;
+ }
+
+ public boolean getEncrypt_data() {
+ return encrypt_data;
+ }
+
+ public void setEncrypt_data(boolean encrypt_data) {
+ this.encrypt_data = encrypt_data;
+ }
+
+ public String getSync_level() {
+ return sync_level;
+ }
+
+ public void setSync_level(String sync_level) {
+ this.sync_level = sync_level;
+ }
+
+ public String getSource_endpoint() {
+ return source_endpoint;
+ }
+
+ public void setSource_endpoint(String source_endpoint) {
+ this.source_endpoint = source_endpoint;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDestination_endpoint() {
+ return destination_endpoint;
+ }
+
+ public void setDestination_endpoint(String destination_endpoint) {
+ this.destination_endpoint = destination_endpoint;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ public void setLength(int length) {
+ this.length = length;
+ }
+
+ public String getDeadline() {
+ return deadline;
+ }
+
+ public void setDeadline(String deadline) {
+ this.deadline = deadline;
+ }
+
+ public boolean getNotify_on_succeeded() {
+ return notify_on_succeeded;
+ }
+
+ public void setNotify_on_succeeded(boolean notify_on_succeeded) {
+ this.notify_on_succeeded = notify_on_succeeded;
+ }
+
+ public boolean getNotify_on_failed() {
+ return notify_on_failed;
+ }
+
+ public void setNotify_on_failed(boolean notify_on_failed) {
+ this.notify_on_failed = notify_on_failed;
+ }
+
+ public boolean getVerify_checksum() {
+ return verify_checksum;
+ }
+
+ public void setVerify_checksum(boolean verify_checksum) {
+ this.verify_checksum = verify_checksum;
+ }
+
+ public boolean getNotify_on_inactive() {
+ return notify_on_inactive;
+ }
+
+ public void setNotify_on_inactive(boolean notify_on_inactive) {
+ this.notify_on_inactive = notify_on_inactive;
+ }
+
+ public boolean getDelete_destination_extra() {
+ return delete_destination_extra;
+ }
+
+ public void setDelete_destination_extra(boolean delete_destination_extra) {
+ this.delete_destination_extra = delete_destination_extra;
+ }
+
+ public Data[] getDATA() {
+ return DATA;
+ }
+
+ public void setDATA(Data[] DATA) {
+ this.DATA = DATA;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
new file mode 100644
index 0000000..326cb02
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/util/XBayaUtil.java
@@ -0,0 +1,353 @@
+/*
+ *
+ * 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.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.SocketTimeoutException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.airavata.client.stub.interpretor.NameValue;
+import org.apache.airavata.common.utils.StringUtil;
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.workflow.model.graph.DataPort;
+import org.apache.airavata.workflow.model.graph.Node;
+import org.apache.airavata.workflow.model.graph.amazon.InstanceNode;
+import org.apache.airavata.workflow.model.graph.system.ConstantNode;
+import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
+import org.apache.airavata.workflow.model.graph.system.EndifNode;
+import org.apache.airavata.workflow.model.graph.system.ForEachNode;
+import org.apache.airavata.workflow.model.graph.system.InputNode;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.ws.monitor.MonitorConfiguration;
+import org.apache.airavata.xbaya.XBayaConfiguration;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.apache.airavata.xbaya.interpretor.SystemComponentInvoker;
+import org.apache.airavata.xbaya.interpretor.WorkFlowInterpreterException;
+import org.apache.airavata.xbaya.invoker.GenericInvoker;
+import org.apache.airavata.xbaya.invoker.Invoker;
+import org.apache.airavata.xbaya.invoker.WorkflowInvokerWrapperForGFacInvoker;
+import org.apache.airavata.xbaya.lead.LeadContextHeaderHelper;
+import org.apache.airavata.xbaya.ui.dialogs.registry.RegistryWindow;
+import org.apache.axis2.util.XMLUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.xmlpull.infoset.XmlElement;
+
+import xsul.lead.LeadContextHeader;
+import xsul.lead.LeadResourceMapping;
+import xsul5.XmlConstants;
+
+public class XBayaUtil {
+
+ private static final Logger logger = LoggerFactory.getLogger(XBayaUtil.class);
+ public static final String JCR_USER = "jcr.username";
+ public static final String JCR_PASS = "jcr.password";
+ public static final String JCR_URL = "jcr.url";
+
+ public static LeadContextHeader buildLeadContextHeader(final XBayaEngine engine,
+ MonitorConfiguration monitorConfiguration, String nodeId, LeadResourceMapping resourceMapping)
+ throws URISyntaxException {
+
+ XBayaConfiguration configuration = engine.getConfiguration();
+ Workflow workflow = engine.getGUI().getWorkflow();
+
+ LeadContextHeader leadContext = buildLeadContextHeader(workflow, configuration, monitorConfiguration, nodeId,
+ resourceMapping);
+
+ return leadContext;
+
+ }
+
+ /**
+ *
+ * @param workflow
+ * @param configuration
+ * @param monitorConfiguration
+ * @param nodeId
+ * @param resourceMapping
+ * @return
+ * @throws URISyntaxException
+ */
+ public static LeadContextHeader buildLeadContextHeader(Workflow workflow, XBayaConfiguration configuration,
+ MonitorConfiguration monitorConfiguration, String nodeId, LeadResourceMapping resourceMapping)
+ throws URISyntaxException {
+ LeadContextHeaderHelper leadContextHelper = new LeadContextHeaderHelper();
+ leadContextHelper.setXBayaConfiguration(configuration);
+
+ leadContextHelper.setWorkflowInstanceID(workflow.getGPELInstanceID());
+ leadContextHelper.setWorkflowTemplateID(workflow.getUniqueWorkflowName());
+
+ leadContextHelper.setMonitorConfiguration(monitorConfiguration);
+
+ LeadContextHeader leadContext = leadContextHelper.getLeadContextHeader();
+
+ leadContext.setNodeId(nodeId);
+
+ leadContext.setTimeStep("1");
+
+ if (resourceMapping != null) {
+ leadContext.setResourceMapping(resourceMapping);
+ }
+ return leadContext;
+
+ }
+
+ public static boolean isURLExists(String URLName) {
+ try {
+ if (!URLName.toUpperCase().contains("HTTP"))
+ URLName = "http://" + URLName;
+ URL url = new URL(URLName);
+ System.setProperty("java.net.useSystemProxies", "true");
+ HttpURLConnection urlConn = (HttpURLConnection) url.openConnection();
+ urlConn.setConnectTimeout(9000);
+ urlConn.setReadTimeout(9000);
+ urlConn.connect();
+ if (HttpURLConnection.HTTP_OK == urlConn.getResponseCode())
+ return true;
+ else
+ return false;
+ } catch (SocketTimeoutException e) {
+ return false;
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ }
+
+ public static boolean acquireJCRRegistry(XBayaEngine engine) {
+ XBayaConfiguration configuration = engine.getConfiguration();
+ if (configuration.getAiravataAPI() == null) {
+ updateJCRRegistryInfo(engine);
+ }
+ return engine.getConfiguration().getAiravataAPI() != null;
+ }
+
+ public static void updateJCRRegistryInfo(XBayaEngine xbayaEngine) {
+ RegistryWindow window = new RegistryWindow(xbayaEngine);
+ window.show();
+ }
+
+ public static Object getInputsForForEachNode(final ForEachNode forEachNode,
+ final LinkedList<String> listOfValues, Map<Node, Invoker> invokerMap) throws WorkflowException {
+ Node forEachInputNode = forEachNode.getInputPort(0).getFromNode();
+ // if input node for for-each is WSNode
+ Object returnValForProvenance = null;
+ if (forEachInputNode instanceof InputNode) {
+ for (DataPort dataPort : forEachNode.getInputPorts()) {
+ returnValForProvenance = XBayaUtil
+ .findInputFromPort(dataPort, invokerMap);
+ if (null == returnValForProvenance) {
+ throw new WorkFlowInterpreterException(
+ "Unable to find input for the node:"
+ + forEachNode.getID());
+ }
+ String[] vals = StringUtil.getElementsFromString(returnValForProvenance.toString());
+ listOfValues.addAll(Arrays.asList(vals));
+ }
+ } else {
+ Invoker workflowInvoker = invokerMap
+ .get(forEachInputNode);
+ if (workflowInvoker != null) {
+ if (workflowInvoker instanceof GenericInvoker) {
+
+ returnValForProvenance = ((GenericInvoker) workflowInvoker)
+ .getOutputs();
+ String message = returnValForProvenance.toString();
+
+ XmlElement msgElmt = XmlConstants.BUILDER
+ .parseFragmentFromString(message);
+ Iterator children = msgElmt.children().iterator();
+ while (children.hasNext()) {
+ Object object = children.next();
+ // foreachWSNode.getInputPort(0).getType()
+ if (object instanceof XmlElement) {
+ listOfValues.add(XmlConstants.BUILDER
+ .serializeToString(object));
+ // TODO fix for simple type - Done
+ }
+ }
+ } else if (workflowInvoker instanceof WorkflowInvokerWrapperForGFacInvoker) {
+ String outputName = forEachInputNode.getOutputPort(0)
+ .getName();
+ returnValForProvenance = workflowInvoker
+ .getOutput(outputName);
+ org.xmlpull.v1.builder.XmlElement msgElmt = (org.xmlpull.v1.builder.XmlElement) returnValForProvenance;
+ Iterator children = msgElmt.children();
+ while (children.hasNext()) {
+ Object object = children.next();
+ if (object instanceof org.xmlpull.v1.builder.XmlElement) {
+ org.xmlpull.v1.builder.XmlElement child = (org.xmlpull.v1.builder.XmlElement) object;
+ Iterator valItr = child.children();
+ if (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof String) {
+ listOfValues.add(object2.toString());
+ }
+ }
+ }
+ }
+ } else if (workflowInvoker instanceof SystemComponentInvoker) {
+ String outputName = forEachInputNode.getOutputPort(0)
+ .getName();
+ returnValForProvenance = workflowInvoker
+ .getOutput(outputName);
+ XmlElement msgElmt = XmlConstants.BUILDER
+ .parseFragmentFromString("<temp>"
+ + returnValForProvenance + "</temp>");
+ Iterator valItr = msgElmt.children().iterator();
+ while (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof XmlElement) {
+ listOfValues.add(((XmlElement) object2).children()
+ .iterator().next().toString());
+ }
+ }
+ }
+ } else {
+ throw new WorkFlowInterpreterException(
+ "Did not find inputs from WS to foreach");
+ }
+ }
+ return returnValForProvenance;
+ }
+
+ /**
+ *
+ * @param inputPort
+ * @param invokerMap
+ * @return
+ * @throws WorkflowException
+ */
+ public static Object findInputFromPort(DataPort inputPort, Map<Node, Invoker> invokerMap) throws WorkflowException {
+ Object outputVal = null;
+ Node fromNode = inputPort.getFromNode();
+ if (fromNode instanceof InputNode) {
+ outputVal = ((InputNode) fromNode).getDefaultValue();
+ } else if (fromNode instanceof ConstantNode) {
+ outputVal = ((ConstantNode) fromNode).getValue();
+ } else if (fromNode instanceof EndifNode) {
+ Invoker fromInvoker = invokerMap.get(fromNode);
+ outputVal = fromInvoker.getOutput(inputPort.getFromPort().getID());
+ } else if (fromNode instanceof InstanceNode) {
+ return ((InstanceNode) fromNode).getOutputInstanceId();
+ } else if (fromNode instanceof EndForEachNode) {
+ outputVal = "";
+ Invoker workflowInvoker = invokerMap.get(fromNode);
+ String outputName = fromNode.getOutputPort(0).getName();
+ XmlElement msgElmt = XmlConstants.BUILDER
+ .parseFragmentFromString("<temp>"
+ + workflowInvoker.getOutput(outputName) + "</temp>");
+ Iterator valItr = msgElmt.children().iterator();
+ while (valItr.hasNext()) {
+ Object object2 = valItr.next();
+ if (object2 instanceof XmlElement) {
+ outputVal = outputVal
+ + StringUtil.DELIMETER
+ + StringUtil.quoteString(((XmlElement) object2).children().iterator()
+ .next().toString());
+ }
+ }
+ outputVal = ((String) outputVal).substring(1,
+ ((String) outputVal).length());
+ } else {
+ Invoker fromInvoker = invokerMap.get(fromNode);
+ try {
+ if (fromInvoker != null)
+ outputVal = fromInvoker.getOutput(inputPort.getFromPort()
+ .getName());
+
+ } catch (Exception e) {
+ // if the value is still null look it up from the inputport name
+ // because the value is set to the input port name at some point
+ // there is no harm in doing this
+ if (null == outputVal) {
+ outputVal = fromInvoker.getOutput(inputPort.getName());
+ }
+ }
+
+ }
+ return outputVal;
+
+ }
+
+ /**
+ * @param node
+ * @return
+ */
+ public static Node findEndForEachFor(ForEachNode node) {
+
+ Collection<Node> toNodes = node.getOutputPort(0).getToNodes();
+ if(toNodes.size() != 1){
+ throw new WorkflowRuntimeException("ForEach output does not contain single out-edge");
+ }
+ Node middleNode = toNodes.iterator().next();
+ List<DataPort> outputPorts = middleNode.getOutputPorts();
+ for (DataPort dataPort : outputPorts) {
+ if(dataPort.getToNodes().size() == 1){
+ Node possibleEndForEachNode = dataPort.getToNodes().get(0);
+ if(possibleEndForEachNode instanceof EndForEachNode){
+ return possibleEndForEachNode;
+ }
+ }
+ }
+ throw new WorkflowRuntimeException("EndForEachNode not found");
+ }
+
+
+ public static List<NameValue> getIOParameterData(String xml) throws ParserConfigurationException, SAXException, IOException{
+ List<NameValue> parameters=new ArrayList<NameValue>();
+ Document parameterDocument = XMLUtils.newDocument(new ByteArrayInputStream(xml.getBytes()));
+ org.w3c.dom.NodeList childNodes = parameterDocument.getDocumentElement().getChildNodes();
+ for(int i=0;i<childNodes.getLength();i++){
+ org.w3c.dom.Node parameterNode = childNodes.item(i);
+ NameValue pair = new NameValue();
+ pair.setName(parameterNode.getLocalName());
+ pair.setValue(parameterNode.getTextContent());
+ parameters.add(pair);
+ }
+ return parameters;
+ }
+
+// public static AiravataRegistry2 getRegistry(URL url) throws IOException, RepositoryException, URISyntaxException {
+// Properties properties = new Properties();
+// properties.load(url.openStream());
+// JCRComponentRegistry jcrComponentRegistry = new JCRComponentRegistry(new URI((String) properties.get(JCR_URL)),
+// (String) properties.get(JCR_USER),(String) properties.get(JCR_PASS));
+// return jcrComponentRegistry.getRegistry();
+// }
+
+}
\ 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/workflow/WorkflowClient.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowClient.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowClient.java
new file mode 100644
index 0000000..c19f7db
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowClient.java
@@ -0,0 +1,246 @@
+/*
+ *
+ * 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.workflow;
+
+import java.net.URI;
+import java.util.Map;
+
+import org.apache.airavata.workflow.model.component.ComponentException;
+import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
+import org.apache.airavata.workflow.model.graph.GraphException;
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.apache.airavata.ws.monitor.event.EventProducer;
+import org.apache.airavata.xbaya.XBayaEngine;
+import org.gpel.client.GcInstance;
+import org.gpel.client.GcSearchList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import xsul5.wsdl.WsdlDefinitions;
+
+public abstract class WorkflowClient extends EventProducer {
+ /**
+ * Either workflow template or workflow instance
+ */
+ public enum WorkflowType {
+ /**
+ * Workflow template
+ */
+ TEMPLATE,
+
+ /**
+ * Workflow instance
+ */
+ INSTANCE
+ }
+
+ protected static final String PROCESS_WSDL_TYTLE = "process.wsdl";
+
+ protected static final String PROCESS_GPEL_TITLE = "process.gpel";
+
+ protected static final String PNG_MIME_TYPE = "image/png";
+
+ protected static final String GRAPH_MIME_TYPE = "application/x-xbaya+xml";
+
+ protected final static Logger logger = LoggerFactory.getLogger(WorkflowClient.class);
+
+ protected URI engineURL;
+
+ // ===========================================================================
+ // Concrete Methods
+ // ===========================================================================
+
+ /**
+ * @param engineURL
+ * @throws WorkflowEngineException
+ */
+ public void setEngineURL(URI engineURL) throws WorkflowEngineException {
+ this.engineURL = engineURL;
+ connect();
+ }
+
+ /**
+ * @return The URL of the GPEL Engine.
+ */
+ public URI getEngineURL() {
+ return this.engineURL;
+ }
+
+ /**
+ * Deploys a workflow to the GPEL Engine.
+ *
+ * @param workflow
+ * @param redeploy
+ * @return The workflow template ID.
+ * @throws GraphException
+ * @throws WorkflowEngineException
+ */
+ public URI createScriptAndDeploy(Workflow workflow, boolean redeploy) throws GraphException,
+ WorkflowEngineException {
+ logger.debug("Entering: " + workflow.toString());
+
+ // Generate a BPEL process.
+ workflow.createScript();
+
+ return deploy(workflow, redeploy);
+ }
+
+ /**
+ * Loads a workflow with s specified workflow template ID.
+ *
+ * @param templateID
+ * The workflow template ID.
+ * @return The workflow loaded
+ * @throws GraphException
+ * @throws WorkflowEngineException
+ * @throws org.apache.airavata.workflow.model.component.ComponentException
+ *
+ */
+ public Workflow load(URI templateID) throws GraphException, WorkflowEngineException, ComponentException {
+ // Don't delete this method because the portal uses it.
+ return load(templateID, WorkflowType.TEMPLATE);
+ }
+
+ /**
+ * Returns the List of GcSearchResult.
+ * <p/>
+ * This method returns the first 100 matches.
+ *
+ * @return The List of GcSearchResult.
+ * @throws WorkflowEngineException
+ */
+ public GcSearchList list() throws WorkflowEngineException {
+ return list(100, WorkflowType.TEMPLATE);
+ }
+
+ /**
+ * @param workflow
+ * @param dscURL
+ * @return The instance of workflow
+ * @throws WorkflowEngineException
+ * @throws ComponentException
+ * @throws GraphException
+ */
+ public GcInstance instantiate(Workflow workflow, URI dscURL) throws WorkflowEngineException, ComponentException,
+ GraphException {
+ return instantiate(workflow, dscURL, null);
+ }
+
+ /**
+ * @return True if the connection is secure; false otherwise.
+ */
+ public boolean isSecure() {
+ return true;
+ // return SecurityUtil.isSecureService(this.engineURL);
+ }
+
+ /**
+ * Checks if the client is connected to the BPEL engine.
+ *
+ * @return true if the client is connected to the BPEL engine; false otherwise.
+ */
+ protected synchronized boolean isConnected() {
+ throw new WorkflowRuntimeException("Critical Error: Called a unsupported API");
+ }
+
+ // ===========================================================================
+ // Abstract Methods
+ // ===========================================================================
+
+ /**
+ * @param workflow
+ * @param redeploy
+ * @return The workflow template ID.
+ * @throws WorkflowEngineException
+ */
+ public abstract URI deploy(Workflow workflow, boolean redeploy) throws WorkflowEngineException;
+
+ /**
+ * @param id
+ * @param workflowType
+ * @return The workflow loaded
+ * @throws GraphException
+ * @throws WorkflowEngineException
+ * @throws ComponentException
+ */
+ public abstract Workflow load(URI id, WorkflowType workflowType) throws GraphException, WorkflowEngineException,
+ ComponentException;
+
+ /**
+ * Returns the List of GcSearchResult.
+ *
+ * @param maxNum
+ * The maximum number of results
+ * @param type
+ * @return The List of GcSearchResult.
+ * @throws WorkflowEngineException
+ */
+ @SuppressWarnings("boxing")
+ public abstract GcSearchList list(int maxNum, WorkflowType type) throws WorkflowEngineException;
+
+ /**
+ * @param workflow
+ * The workflow to instantiate.
+ * @param dscURL
+ * The URL of the DSC.
+ * @param name
+ * The name that becomes a part of the workflow instance name.
+ * @return The instance of workflow
+ * @throws WorkflowEngineException
+ * @throws ComponentException
+ * @throws GraphException
+ */
+ public abstract GcInstance instantiate(Workflow workflow, URI dscURL, String name) throws WorkflowEngineException,
+ ComponentException, GraphException;
+
+ /**
+ * Instantiate a specified workflow.
+ * <p/>
+ * The workflow must have been dployed.
+ *
+ * @param workflow
+ * @param wsdlMap
+ * Map<partnerLinkName, CWSDL>
+ * @return The workflow instance.
+ * @throws WorkflowEngineException
+ * @Deprecated This one doesn't support hierarchical workflows. Use instantiate(workflow, dscURL) instead.
+ */
+ @Deprecated
+ public abstract GcInstance instantiate(Workflow workflow, Map<String, WsdlDefinitions> wsdlMap)
+ throws WorkflowEngineException;
+
+ /**
+ * Starts the workflow instance.
+ * <p/>
+ * The AWSDLs in workflow must have been modified to CWSDLs.
+ *
+ * @param instance
+ * @return The WSDL of the workflow.
+ * @throws WorkflowEngineException
+ */
+ public abstract WsdlDefinitions start(final GcInstance instance) throws WorkflowEngineException;
+
+ public abstract void connect() throws WorkflowEngineException;
+
+ public abstract void setXBayaEngine(XBayaEngine xBayaEngine);
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowEngineException.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowEngineException.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowEngineException.java
new file mode 100644
index 0000000..b5017de
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/WorkflowEngineException.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.workflow;
+
+import org.apache.airavata.workflow.model.exceptions.WorkflowException;
+
+public class WorkflowEngineException extends WorkflowException {
+ public WorkflowEngineException() {
+ super(); // To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public WorkflowEngineException(String message) {
+ super(message); // To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public WorkflowEngineException(Throwable cause) {
+ super(cause); // To change body of overridden methods use File | Settings | File Templates.
+ }
+
+ public WorkflowEngineException(String message, Throwable cause) {
+ super(message, cause); // To change body of overridden methods use File | Settings | File Templates.
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/ProxyWSDL.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/ProxyWSDL.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/ProxyWSDL.java
new file mode 100644
index 0000000..f270f2c
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/ProxyWSDL.java
@@ -0,0 +1,87 @@
+/*
+ *
+ * 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.workflow.proxy;
+
+public class ProxyWSDL {
+ // FIXME Remove this once the duel network problem is solved
+ public static String WSDL = "<wsdl:definitions targetNamespace='http://extreme.indiana.edu/weps' "
+ + "xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' "
+ + "xmlns:tns='http://extreme.indiana.edu/weps' xmlns:http='http://schemas.xmlsoap.org/wsdl/http/' "
+ + "xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' "
+ + "xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/'> " + "<wsdl:types> "
+ + "<xs:schema elementFormDefault='qualified' " + "targetNamespace='http://extreme.indiana.edu/weps'> "
+ + "<xs:element name='DeploymentInformation'> " + "<xs:complexType> " + "<xs:sequence> "
+ + "<xs:element name='ProcessName' type='xs:string' /> "
+ + "<xs:element maxOccurs='1' minOccurs='0' name='TemplateId' " + "type='xs:string' /> "
+ + "<xs:element name='DeploymentDocuments' type='tns:DeploymentDocumentsType'> " +
+
+ "</xs:element> " + "</xs:sequence> " + "</xs:complexType> " + "</xs:element> "
+ + "<xs:complexType name='DeploymentDocumentsType'> " + "<xs:sequence> "
+ + "<xs:element name='BPEL' type='xs:anyType' /> "
+ + "<xs:element name='DeploymentDescriptor' type='xs:anyType' /> "
+ + "<xs:element name='ProcessWSDL' type='tns:XMLFile' /> " +
+
+ "<xs:element maxOccurs='unbounded' minOccurs='1' " + "name='ServiceWSDLs' type='tns:XMLFile' /> "
+ + "<xs:element maxOccurs='unbounded' minOccurs='0' name='Other' " + "type='xs:anyType' /> "
+ + "</xs:sequence> " + "</xs:complexType> " + "<xs:complexType name='XMLFile'> " + "<xs:sequence> "
+ + "<xs:element name='FileName' type='xs:string' /> " + "<xs:element name='Content' type='xs:anyType'> "
+ + "</xs:element> " +
+
+ "</xs:sequence> " + "</xs:complexType> " + "<xs:element name='Result' type='xs:string' /> "
+ + "<xs:element name='ProcessName' type='xs:string' /> " + "<xs:element name='CreateInstanceResponse'> "
+ + "<xs:complexType> " + "<xs:sequence> " + "<xs:element name='ProcessName' type='xs:string' /> "
+ + "<xs:element name='ProcessWSDL' type='xs:anyType'> " +
+
+ "</xs:element> " + "</xs:sequence> " + "</xs:complexType> " + "</xs:element> " + "</xs:schema> "
+ + "</wsdl:types> " + "<wsdl:message name='DeployRequest'> "
+ + "<wsdl:part name='DeploymentInformation' element='tns:DeploymentInformation'> " + "</wsdl:part> " +
+
+ "</wsdl:message> " + "<wsdl:message name='CreateInstanceResponse'> "
+ + "<wsdl:part name='Response' element='tns:CreateInstanceResponse'> " + "</wsdl:part> "
+ + "</wsdl:message> " + "<wsdl:message name='CreateInstanceRequest'> "
+ + "<wsdl:part name='ProcessName' element='tns:ProcessName'> " + "</wsdl:part> " + "</wsdl:message> " +
+
+ "<wsdl:message name='DeployResponse'> " + "<wsdl:part name='Response' element='tns:Result'> "
+ + "</wsdl:part> " + "</wsdl:message> " + "<wsdl:portType name='WEPSPortType'> "
+ + "<wsdl:operation name='deploy'> " + "<wsdl:input message='tns:DeployRequest'> " + "</wsdl:input> "
+ + "<wsdl:output message='tns:DeployResponse'> " +
+
+ "</wsdl:output> " + "</wsdl:operation> " + "<wsdl:operation name='createInstance'> "
+ + "<wsdl:input message='tns:CreateInstanceRequest'> " + "</wsdl:input> "
+ + "<wsdl:output message='tns:CreateInstanceResponse'> " + "</wsdl:output> " + "</wsdl:operation> "
+ + "</wsdl:portType> " +
+
+ "<wsdl:binding name='WEPSBinding' type='tns:WEPSPortType'> " + "<soap:binding style='document' "
+ + "transport='http://schemas.xmlsoap.org/soap/http' /> " + "<wsdl:operation name='deploy'> "
+ + "<soap:operation soapAction='urn:deploy' /> " + "<wsdl:input> " + "<soap:body use='literal' /> "
+ + "</wsdl:input> " + "<wsdl:output> " + "<soap:body use='literal' /> " +
+
+ "</wsdl:output> " + "</wsdl:operation> " + "<wsdl:operation name='createInstance'> "
+ + "<soap:operation soapAction='urn:createInstance' /> " + "<wsdl:input> " + "<soap:body use='literal' /> "
+ + "</wsdl:input> " + "<wsdl:output> " + "<soap:body use='literal' /> " +
+
+ "</wsdl:output> " + "</wsdl:operation> " + "</wsdl:binding> " + "<wsdl:service name='WEPSService'> "
+ + "<wsdl:port name='WEPS' binding='tns:WEPSBinding'> " + "<soap:address "
+ + "location='http://silktree.cs.indiana.edu:18080/axis2/services/WEPSService' /> " + "</wsdl:port> "
+ + "</wsdl:service> " + "</wsdl:definitions> ";
+
+}
\ 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/workflow/proxy/WorkflowClient.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/WorkflowClient.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/WorkflowClient.java
new file mode 100644
index 0000000..d2afec5
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/WorkflowClient.java
@@ -0,0 +1,35 @@
+/*
+ *
+ * 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.workflow.proxy;
+
+import org.apache.airavata.common.utils.Pair;
+import org.ietf.jgss.GSSException;
+
+public interface WorkflowClient {
+
+ public Pair<String, String> invoke(Pair<String, String>[] inputs) throws GSSException;
+
+ public void init();
+
+ public String getInstanceID();
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/9c47eec8/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/WorkflowContext.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/WorkflowContext.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/WorkflowContext.java
new file mode 100644
index 0000000..f2b28be
--- /dev/null
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/workflow/proxy/WorkflowContext.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.workflow.proxy;
+
+import java.net.URISyntaxException;
+
+import org.apache.airavata.workflow.model.wf.Workflow;
+import org.ietf.jgss.GSSCredential;
+import org.ietf.jgss.GSSException;
+
+import xsul.lead.LeadContextHeader;
+
+public interface WorkflowContext {
+
+ public void prepare(WorkflowClient client, Workflow workflow) throws GSSException, URISyntaxException;
+
+ public LeadContextHeader getHeader();
+
+ public GSSCredential getCredentials();
+
+ public String getTopic();
+
+}