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 2013/01/07 16:19:50 UTC
svn commit: r1429837 - in /airavata/trunk/modules:
airavata-client/src/main/java/org/apache/airavata/client/
airavata-client/src/main/java/org/apache/airavata/client/api/
airavata-client/src/main/java/org/apache/airavata/client/impl/
registry/registry-...
Author: samindaw
Date: Mon Jan 7 15:19:50 2013
New Revision: 1429837
URL: http://svn.apache.org/viewvc?rev=1429837&view=rev
Log:
cleaning up airavata client
Modified:
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowOutputDataSettings.java
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowOutputDataSettingsImpl.java
airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java
airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java
Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java?rev=1429837&r1=1429836&r2=1429837&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataAPIFactory.java Mon Jan 7 15:19:50 2013
@@ -75,15 +75,4 @@ public class AiravataAPIFactory {
return getAPI(registryURL, null, username, alternateUsername, new PasswordCallBackImpl(username, password));
}
- @Deprecated
- public static AiravataAPI getAPI(Map<String,String> configuration) throws MalformedURLException{
- AiravataClient apiObj = new AiravataClient(configuration);
- return apiObj;
- }
-
- @Deprecated
- public static AiravataAPI getAPI(String filename) throws MalformedURLException, RegistryException, IOException{
- AiravataClient apiObj = new AiravataClient(filename);
- return apiObj;
- }
}
Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java?rev=1429837&r1=1429836&r2=1429837&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java Mon Jan 7 15:19:50 2013
@@ -20,36 +20,18 @@
*/
package org.apache.airavata.client;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-import java.net.URLConnection;
-import java.nio.MappedByteBuffer;
-import java.nio.channels.FileChannel;
-import java.nio.charset.Charset;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Observable;
-import java.util.Properties;
-import java.util.UUID;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.Property;
-import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
-import javax.xml.stream.XMLStreamException;
import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.AiravataAPIInvocationException;
import org.apache.airavata.client.api.AiravataManager;
import org.apache.airavata.client.api.ApplicationManager;
import org.apache.airavata.client.api.ExecutionManager;
@@ -64,11 +46,8 @@ import org.apache.airavata.client.impl.P
import org.apache.airavata.client.impl.ProvenanceManagerImpl;
import org.apache.airavata.client.impl.UserManagerImpl;
import org.apache.airavata.client.impl.WorkflowManagerImpl;
-import org.apache.airavata.client.stub.interpretor.NameValue;
-import org.apache.airavata.client.stub.interpretor.WorkflowInterpretorStub;
import org.apache.airavata.common.exception.AiravataConfigurationException;
import org.apache.airavata.common.utils.Version;
-import org.apache.airavata.common.utils.XMLUtil;
import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
import org.apache.airavata.registry.api.AiravataRegistry2;
import org.apache.airavata.registry.api.AiravataRegistryFactory;
@@ -76,21 +55,9 @@ import org.apache.airavata.registry.api.
import org.apache.airavata.registry.api.Gateway;
import org.apache.airavata.registry.api.PasswordCallback;
import org.apache.airavata.registry.api.exception.RegistryException;
-import org.apache.airavata.registry.api.workflow.ExperimentData;
-import org.apache.airavata.workflow.model.component.ComponentException;
-import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
-import org.apache.airavata.workflow.model.graph.GraphException;
-import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.util.GraphUtil;
-import org.apache.airavata.workflow.model.wf.Workflow;
-import org.apache.airavata.workflow.model.wf.WorkflowInput;
import org.apache.airavata.ws.monitor.Monitor;
import org.apache.airavata.ws.monitor.MonitorConfiguration;
import org.apache.airavata.ws.monitor.MonitorEventListener;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axis2.AxisFault;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -136,74 +103,85 @@ public class AiravataClient extends Obse
private static final Version API_VERSION = new Version("Airavata", 0, 6,
null, null, null);
-
- @Deprecated
- protected AiravataClient(Map<String, String> configuration)
- throws MalformedURLException {
- this.configuration = configuration;
- try {
- initialize();
- } catch (AiravataConfigurationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (RepositoryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (RegistryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
+//
+// @Deprecated
+// protected AiravataClient(Map<String, String> configuration)
+// throws MalformedURLException {
+// this.configuration = configuration;
+// try {
+// initialize();
+// } catch (AiravataConfigurationException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (RepositoryException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (RegistryException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// }
// FIXME: Need a constructor to set registry URL
protected AiravataClient() {
}
- @Deprecated
- protected AiravataClient(String fileName) throws RegistryException,
- MalformedURLException, IOException {
- URL url = this.getClass().getClassLoader().getResource(fileName);
- if (url == null) {
- url = (new File(fileName)).toURL();
- }
- Properties properties = new Properties();
- properties.load(url.openStream());
- configuration.put(GFAC,
- validateAxisService(properties.getProperty(DEFAULT_GFAC_URL)));
- configuration.put(MSGBOX, validateAxisService(properties
- .getProperty(DEFAULT_MESSAGE_BOX_URL)));
- configuration
- .put(BROKER, validateAxisService(properties
- .getProperty(DEFAULT_BROKER_URL)));
- configuration
- .put(WORKFLOWSERVICEURL, validateAxisService(properties
- .getProperty(WORKFLOWSERVICEURL)));
- configuration.put(WITHLISTENER, properties.getProperty(WITHLISTENER));
-
- try {
- initialize();
- } catch (AiravataConfigurationException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (RepositoryException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- protected AiravataClient(URI registryUrl, String username, String password)
- throws MalformedURLException, RepositoryException,
- RegistryException, AiravataConfigurationException {
- this(createConfig(registryUrl, username, password));
- }
-
+// @Deprecated
+// protected AiravataClient(String fileName) throws RegistryException,
+// MalformedURLException, IOException {
+// URL url = this.getClass().getClassLoader().getResource(fileName);
+// if (url == null) {
+// url = (new File(fileName)).toURL();
+// }
+// Properties properties = new Properties();
+// properties.load(url.openStream());
+// configuration.put(GFAC,
+// validateAxisService(properties.getProperty(DEFAULT_GFAC_URL)));
+// configuration.put(MSGBOX, validateAxisService(properties
+// .getProperty(DEFAULT_MESSAGE_BOX_URL)));
+// configuration
+// .put(BROKER, validateAxisService(properties
+// .getProperty(DEFAULT_BROKER_URL)));
+// configuration
+// .put(WORKFLOWSERVICEURL, validateAxisService(properties
+// .getProperty(WORKFLOWSERVICEURL)));
+// configuration.put(WITHLISTENER, properties.getProperty(WITHLISTENER));
+//
+// try {
+// initialize();
+// } catch (AiravataConfigurationException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (RepositoryException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// }
+//
+// protected AiravataClient(URI registryUrl, String username, String password)
+// throws MalformedURLException, RepositoryException,
+// RegistryException, AiravataConfigurationException {
+// Map<String, String> configuration=createConfig(registryUrl, username, password);
+// this.configuration = configuration;
+// try {
+// initialize();
+// } catch (AiravataConfigurationException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (RepositoryException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// } catch (RegistryException e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// }
+//
private static HashMap<String, String> createConfig(URI registryUrl,String username, String password) throws RepositoryException, RegistryException, AiravataConfigurationException {
HashMap<String, String> config = new HashMap<String, String>();
if (registryUrl!=null) {
config.put(AiravataClient.REGISTRY, registryUrl.toString());
}
- // config.put(AiravataClient.JCR_USERNAME, username);
-// config.put(AiravataClient.JCR_PASSWORD, password);
AiravataRegistry2 registryObject = getRegistry(registryUrl, "default", username, new PasswordCallBackImpl(username, password));
if (registryObject != null) {
URI uri = registryObject.getEventingServiceURI();
@@ -289,148 +267,148 @@ public class AiravataClient extends Obse
}
}
- public void loadWorkflowFromaFile(String workflowFile)
- throws URISyntaxException, IOException {
- File workflow = null;
- URL url = AiravataClient.class.getClassLoader().getResource(
- workflowFile);
- if (url == null) {
- url = (new File(workflowFile)).toURL();
- }
- try {
- workflow = new File(url.toURI());
- } catch (URISyntaxException e) {
- e.printStackTrace(); // To change body of catch statement use File |
- // Settings | File Templates.
- }
- FileInputStream stream = new FileInputStream(workflow);
- try {
- FileChannel fc = stream.getChannel();
- MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0,
- fc.size());
- /* Instead of using default, pass in a decoder. */
- this.workflow = Charset.defaultCharset().decode(bb).toString();
- } finally {
- stream.close();
- }
- }
-
- public void loadWorkflowasaString(String workflowAsaString) {
- this.workflow = workflowAsaString;
- }
-
- public static void updateWorkflowInputValuesFromProperties(
- List<WorkflowInput> inputs, String fileName) throws IOException {
- URL url = AiravataClient.class.getClassLoader().getResource(fileName);
- if (url == null) {
- url = (new File(fileName)).toURL();
- }
- Properties properties = new Properties();
- properties.load(url.openStream());
- for (WorkflowInput workflowInput : inputs) {
- if (properties.containsKey(workflowInput.getName())) {
- workflowInput.setValue(properties.get(workflowInput.getName()));
- }
- }
- }
-
- public NameValue[] setInputs(String fileName) throws IOException {
- URL url = this.getClass().getClassLoader().getResource(fileName);
- if (url == null) {
- url = (new File(fileName)).toURL();
- }
- Properties properties = new Properties();
- properties.load(url.openStream());
- try {
- Workflow workflow = new Workflow(this.workflow);
- List<NodeImpl> inputs = workflow.getGraph().getNodes();
- int inputSize = 0;
- for (NodeImpl input : inputs) {
- if (input instanceof InputNode) {
- inputSize++;
- }
- }
- NameValue[] inputNameVals = new NameValue[inputSize];
- int index = 0;
- for (NodeImpl input : inputs) {
- if (input instanceof InputNode) {
- inputNameVals[index] = new NameValue();
- String name = input.getName();
- inputNameVals[index].setName(name);
- inputNameVals[index].setValue(properties.getProperty(name));
- ((InputNode) input).setDefaultValue(properties
- .getProperty(name));
- index++;
- }
- }
- // setWorkflow(XMLUtil.xmlElementToString((workflow.toXML()));
- return inputNameVals;
- } catch (GraphException e) {
- e.printStackTrace(); // To change body of catch statement use File |
- // Settings | File Templates.
- } catch (ComponentException e) {
- e.printStackTrace(); // To change body of catch statement use File |
- // Settings | File Templates.
- }
- return null;
- }
-
- public void setInputs(Properties inputList) {
- try {
- Workflow workflow = new Workflow(this.workflow);
- List<WSComponentPort> inputs = workflow.getInputs();
- for (WSComponentPort input : inputs) {
- input.setValue(inputList.getProperty(input.getName()));
- }
- } catch (GraphException e) {
- e.printStackTrace(); // To change body of catch statement use File |
- // Settings | File Templates.
- } catch (ComponentException e) {
- e.printStackTrace(); // To change body of catch statement use File |
- // Settings | File Templates.
- }
- }
-
- public String runWorkflow(String topic) throws AiravataConfigurationException {
- return runWorkflow(topic, (String) null);
- }
-
- public String runWorkflow(String topic, String user) throws AiravataConfigurationException {
- return runWorkflow(topic, user, null, topic);
- }
-
- public String runWorkflow(String topic, String user, String metadata,
- String workflowInstanceName) throws AiravataConfigurationException {
- return runWorkflow(topic, user, metadata, workflowInstanceName, builder);
- }
+// public void loadWorkflowFromaFile(String workflowFile)
+// throws URISyntaxException, IOException {
+// File workflow = null;
+// URL url = AiravataClient.class.getClassLoader().getResource(
+// workflowFile);
+// if (url == null) {
+// url = (new File(workflowFile)).toURL();
+// }
+// try {
+// workflow = new File(url.toURI());
+// } catch (URISyntaxException e) {
+// e.printStackTrace(); // To change body of catch statement use File |
+// // Settings | File Templates.
+// }
+// FileInputStream stream = new FileInputStream(workflow);
+// try {
+// FileChannel fc = stream.getChannel();
+// MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0,
+// fc.size());
+// /* Instead of using default, pass in a decoder. */
+// this.workflow = Charset.defaultCharset().decode(bb).toString();
+// } finally {
+// stream.close();
+// }
+// }
+//
+// public void loadWorkflowasaString(String workflowAsaString) {
+// this.workflow = workflowAsaString;
+// }
+
+// public static void updateWorkflowInputValuesFromProperties(
+// List<WorkflowInput> inputs, String fileName) throws IOException {
+// URL url = AiravataClient.class.getClassLoader().getResource(fileName);
+// if (url == null) {
+// url = (new File(fileName)).toURL();
+// }
+// Properties properties = new Properties();
+// properties.load(url.openStream());
+// for (WorkflowInput workflowInput : inputs) {
+// if (properties.containsKey(workflowInput.getName())) {
+// workflowInput.setValue(properties.get(workflowInput.getName()));
+// }
+// }
+// }
- public String runWorkflow(String topic, String user, String metadata,
- String workflowInstanceName, WorkflowContextHeaderBuilder builder) throws AiravataConfigurationException {
- String worflowoutput = null;
- try {
- builder.setUserIdentifier(getCurrentUser());
- WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
- getClientConfiguration().getXbayaServiceURL().toString());
- OMElement omElement = AXIOMUtil.stringToOM(XMLUtil
- .xmlElementToString(builder.getXml()));
- stub._getServiceClient().addHeader(omElement);
- worflowoutput = stub.launchWorkflow(workflow, topic, null);
- runPreWorkflowExecutionTasks(worflowoutput, user, metadata,
- workflowInstanceName);
-
- } catch (AxisFault e) {
-
- } catch (RemoteException e) {
- // log.fine(e.getMessage(), e);
- } catch (RegistryException e) {
- // log.fine(e.getMessage(), e);
- } catch (XMLStreamException e) {
- e.printStackTrace(); // To change body of catch statement use File |
- // Settings | File Templates.
- }
- // log.info("Workflow output : " + worflowoutput);
- return worflowoutput;
- }
+// public NameValue[] setInputs(String fileName) throws IOException {
+// URL url = this.getClass().getClassLoader().getResource(fileName);
+// if (url == null) {
+// url = (new File(fileName)).toURL();
+// }
+// Properties properties = new Properties();
+// properties.load(url.openStream());
+// try {
+// Workflow workflow = new Workflow(this.workflow);
+// List<NodeImpl> inputs = workflow.getGraph().getNodes();
+// int inputSize = 0;
+// for (NodeImpl input : inputs) {
+// if (input instanceof InputNode) {
+// inputSize++;
+// }
+// }
+// NameValue[] inputNameVals = new NameValue[inputSize];
+// int index = 0;
+// for (NodeImpl input : inputs) {
+// if (input instanceof InputNode) {
+// inputNameVals[index] = new NameValue();
+// String name = input.getName();
+// inputNameVals[index].setName(name);
+// inputNameVals[index].setValue(properties.getProperty(name));
+// ((InputNode) input).setDefaultValue(properties
+// .getProperty(name));
+// index++;
+// }
+// }
+// // setWorkflow(XMLUtil.xmlElementToString((workflow.toXML()));
+// return inputNameVals;
+// } catch (GraphException e) {
+// e.printStackTrace(); // To change body of catch statement use File |
+// // Settings | File Templates.
+// } catch (ComponentException e) {
+// e.printStackTrace(); // To change body of catch statement use File |
+// // Settings | File Templates.
+// }
+// return null;
+// }
+//
+// public void setInputs(Properties inputList) {
+// try {
+// Workflow workflow = new Workflow(this.workflow);
+// List<WSComponentPort> inputs = workflow.getInputs();
+// for (WSComponentPort input : inputs) {
+// input.setValue(inputList.getProperty(input.getName()));
+// }
+// } catch (GraphException e) {
+// e.printStackTrace(); // To change body of catch statement use File |
+// // Settings | File Templates.
+// } catch (ComponentException e) {
+// e.printStackTrace(); // To change body of catch statement use File |
+// // Settings | File Templates.
+// }
+// }
+//
+// public String runWorkflow(String topic) throws AiravataConfigurationException {
+// return runWorkflow(topic, (String) null);
+// }
+//
+// public String runWorkflow(String topic, String user) throws AiravataConfigurationException {
+// return runWorkflow(topic, user, null, topic);
+// }
+//
+// public String runWorkflow(String topic, String user, String metadata,
+// String workflowInstanceName) throws AiravataConfigurationException {
+// return runWorkflow(topic, user, metadata, workflowInstanceName, builder);
+// }
+//
+// public String runWorkflow(String topic, String user, String metadata,
+// String workflowInstanceName, WorkflowContextHeaderBuilder builder) throws AiravataConfigurationException {
+// String worflowoutput = null;
+// try {
+// builder.setUserIdentifier(getCurrentUser());
+// WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
+// getClientConfiguration().getXbayaServiceURL().toString());
+// OMElement omElement = AXIOMUtil.stringToOM(XMLUtil
+// .xmlElementToString(builder.getXml()));
+// stub._getServiceClient().addHeader(omElement);
+// worflowoutput = stub.launchWorkflow(workflow, topic, null);
+// runPreWorkflowExecutionTasks(worflowoutput, user, metadata,
+// workflowInstanceName);
+//
+// } catch (AxisFault e) {
+//
+// } catch (RemoteException e) {
+// // log.fine(e.getMessage(), e);
+// } catch (RegistryException e) {
+// // log.fine(e.getMessage(), e);
+// } catch (XMLStreamException e) {
+// e.printStackTrace(); // To change body of catch statement use File |
+// // Settings | File Templates.
+// }
+// // log.info("Workflow output : " + worflowoutput);
+// return worflowoutput;
+// }
public Monitor getWorkflowExecutionMonitor(String topic) {
return getWorkflowExecutionMonitor(topic, null);
@@ -452,109 +430,109 @@ public class AiravataClient extends Obse
listener.setExperimentMonitor(monitor);
return monitor;
}
-
- private void runPreWorkflowExecutionTasks(String topic, String user,
- String metadata, String experimentName) throws RegistryException, AiravataConfigurationException {
- if (user != null) {
- getRegistryClient().updateExperimentExecutionUser(topic, user);
- }
- if (metadata != null) {
- getRegistryClient().updateExperimentMetadata(topic, metadata);
- }
- if (experimentName == null) {
- experimentName = topic;
- }
- getRegistryClient().updateExperimentName(topic, experimentName);
- }
-
- public String runWorkflow(String topic, NameValue[] inputs)
- throws Exception {
- return runWorkflow(topic, inputs, null);
- }
-
- public String runWorkflow(String topic, NameValue[] inputs, String user)
- throws Exception {
- return runWorkflow(topic, inputs, user, null, topic);
- }
-
- public String runWorkflow(final String topic, final NameValue[] inputs,
- final String user, final String metadata,
- final String experimentName) throws Exception {
- return runWorkflow(topic, inputs, user, metadata, experimentName,
- builder);
- }
-
- public String runWorkflow(final String topic, final NameValue[] inputs,
- final String user, final String metadata,
- final String experimentName,
- final WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException, AiravataConfigurationException {
- return runWorkflow(topic, inputs, user, metadata, experimentName,
- builder, true);
- }
-
- private static int TIMEOUT_STEP = 1000;
- private static int MAX_TIMEOUT = 60000;
-
- public String runWorkflow(final String topic, final NameValue[] inputs,
- final String user, final String metadata,
- final String experimentName,
- final WorkflowContextHeaderBuilder builder, boolean launchOnThread)
- throws AiravataAPIInvocationException, AiravataConfigurationException {
-
- //TODO - fix user passing
- builder.setUserIdentifier(getCurrentUser());
- try {
- runPreWorkflowExecutionTasks(topic, user, metadata, experimentName);
- } catch (RegistryException e) {
- throw new AiravataAPIInvocationException(e);
- }
- if (launchOnThread) {
- new Thread(new Runnable() {
- public void run() {
- launchWorkflow(topic, inputs, builder);
- }
- }).start();
- int timeout = 0;
- try {
- while (!getRegistryClient().isExperimentExists(topic)
- && timeout < MAX_TIMEOUT) {
- Thread.sleep(TIMEOUT_STEP);
- timeout += MAX_TIMEOUT;
- }
- } catch (InterruptedException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (RegistryException e) {
- throw new AiravataAPIInvocationException(e);
- }
- } else {
- launchWorkflow(topic, inputs, builder);
- }
- return topic;
- }
-
- public List<ExperimentData> getWorkflowExecutionDataByUser(String user)
- throws RegistryException, AiravataConfigurationException {
- return getRegistryClient().getExperimentByUser(user);
- }
-
- public ExperimentData getWorkflowExecutionData(String topic)
- throws RegistryException, AiravataConfigurationException {
- return getRegistryClient().getExperiment(topic);
- }
-
- public List<ExperimentData> getWorkflowExecutionData(String user,
- int pageSize, int PageNo) throws RegistryException {
- return null;
-// return getProvenanceResouceClient().getExperimentByUser(user, pageSize, PageNo);
- }
-
- public static String getWorkflow() {
- return workflow;
- }
-
- public static void setWorkflow(String workflow) {
- AiravataClient.workflow = workflow;
- }
+//
+// private void runPreWorkflowExecutionTasks(String topic, String user,
+// String metadata, String experimentName) throws RegistryException, AiravataConfigurationException {
+// if (user != null) {
+// getRegistryClient().updateExperimentExecutionUser(topic, user);
+// }
+// if (metadata != null) {
+// getRegistryClient().updateExperimentMetadata(topic, metadata);
+// }
+// if (experimentName == null) {
+// experimentName = topic;
+// }
+// getRegistryClient().updateExperimentName(topic, experimentName);
+// }
+//
+// public String runWorkflow(String topic, NameValue[] inputs)
+// throws Exception {
+// return runWorkflow(topic, inputs, null);
+// }
+//
+// public String runWorkflow(String topic, NameValue[] inputs, String user)
+// throws Exception {
+// return runWorkflow(topic, inputs, user, null, topic);
+// }
+//
+// public String runWorkflow(final String topic, final NameValue[] inputs,
+// final String user, final String metadata,
+// final String experimentName) throws Exception {
+// return runWorkflow(topic, inputs, user, metadata, experimentName,
+// builder);
+// }
+//
+// public String runWorkflow(final String topic, final NameValue[] inputs,
+// final String user, final String metadata,
+// final String experimentName,
+// final WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException, AiravataConfigurationException {
+// return runWorkflow(topic, inputs, user, metadata, experimentName,
+// builder, true);
+// }
+//
+// private static int TIMEOUT_STEP = 1000;
+// private static int MAX_TIMEOUT = 60000;
+//
+// public String runWorkflow(final String topic, final NameValue[] inputs,
+// final String user, final String metadata,
+// final String experimentName,
+// final WorkflowContextHeaderBuilder builder, boolean launchOnThread)
+// throws AiravataAPIInvocationException, AiravataConfigurationException {
+//
+// //TODO - fix user passing
+// builder.setUserIdentifier(getCurrentUser());
+// try {
+// runPreWorkflowExecutionTasks(topic, user, metadata, experimentName);
+// } catch (RegistryException e) {
+// throw new AiravataAPIInvocationException(e);
+// }
+// if (launchOnThread) {
+// new Thread(new Runnable() {
+// public void run() {
+// launchWorkflow(topic, inputs, builder);
+// }
+// }).start();
+// int timeout = 0;
+// try {
+// while (!getRegistryClient().isExperimentExists(topic)
+// && timeout < MAX_TIMEOUT) {
+// Thread.sleep(TIMEOUT_STEP);
+// timeout += MAX_TIMEOUT;
+// }
+// } catch (InterruptedException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (RegistryException e) {
+// throw new AiravataAPIInvocationException(e);
+// }
+// } else {
+// launchWorkflow(topic, inputs, builder);
+// }
+// return topic;
+// }
+//
+// public List<ExperimentData> getWorkflowExecutionDataByUser(String user)
+// throws RegistryException, AiravataConfigurationException {
+// return getRegistryClient().getExperimentByUser(user);
+// }
+//
+// public ExperimentData getWorkflowExecutionData(String topic)
+// throws RegistryException, AiravataConfigurationException {
+// return getRegistryClient().getExperiment(topic);
+// }
+//
+// public List<ExperimentData> getWorkflowExecutionData(String user,
+// int pageSize, int PageNo) throws RegistryException {
+// return null;
+//// return getProvenanceResouceClient().getExperimentByUser(user, pageSize, PageNo);
+// }
+//
+// public static String getWorkflow() {
+// return workflow;
+// }
+//
+// public static void setWorkflow(String workflow) {
+// AiravataClient.workflow = workflow;
+// }
public AiravataRegistry2 getRegistryClient() throws AiravataConfigurationException, RegistryException{
if (registry==null) {
@@ -577,340 +555,340 @@ public class AiravataClient extends Obse
return clientConfiguration;
}
- private String validateAxisService(String urlString)
- throws RegistryException {
- String originalURL = urlString;
- if (!urlString.endsWith("?wsdl")) {
- urlString = urlString + "?wsdl";
- }
- try {
- URL url = new URL(urlString);
- URLConnection conn = url.openConnection();
- conn.connect();
- } catch (MalformedURLException e) {
- // the URL is not in a valid form
- throw new RegistryException("Given Axis2 Service URL : "
- + urlString + " is Invalid", e);
- } catch (IOException e) {
- // the connection couldn't be established
- throw new RegistryException("Given Axis2 Service URL : "
- + urlString + " is Invalid", e);
- }
- return originalURL;
- }
-
- private String validateURL(String urlString) throws RegistryException {
- try {
- URL url = new URL(urlString);
- URLConnection conn = url.openConnection();
- conn.connect();
- } catch (MalformedURLException e) {
- // the URL is not in a valid form
- throw new RegistryException("Given URL: " + urlString
- + " is Invalid", e);
- } catch (IOException e) {
- // the connection couldn't be established
- throw new RegistryException("Given URL: " + urlString
- + " is Invalid", e);
- }
- return urlString;
- }
-
- public List<String> getWorkflowTemplateIds() {
- List<String> workflowList = new ArrayList<String>();
- Map<String, String> workflows;
- try {
- workflows = getRegistryClient().getWorkflows();
- for (String name : workflows.keySet()) {
- workflowList.add(name);
- }
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return workflowList;
- }
-
- public String runWorkflow(String workflowTemplateId,
- List<WorkflowInput> inputs) throws Exception {
- return runWorkflow(workflowTemplateId, inputs, getRegistryClient().getUser()
- .getUserName(), null, workflowTemplateId + "_"
- + Calendar.getInstance().getTime().toString());
- }
-
- public String runWorkflow(String workflowTemplateId,
- List<WorkflowInput> inputs, String workflowInstanceName)
- throws Exception {
- return runWorkflow(workflowTemplateId, inputs, getRegistryClient().getUser()
- .getUserName(), null, workflowInstanceName);
- }
-
- public String runWorkflow(String workflowTemplateId,
- List<WorkflowInput> inputs, String user, String metadata,
- String workflowInstanceName) throws Exception {
- Workflow workflowObj = getWorkflow(workflowTemplateId);
- return runWorkflow(workflowObj, inputs, user, metadata,
- workflowInstanceName, builder);
- }
-
- public String runWorkflow(String workflowTemplateId,
- List<WorkflowInput> inputs, String user, String metadata,
- String workflowInstanceName, WorkflowContextHeaderBuilder builder)
- throws Exception {
- Workflow workflowObj = getWorkflowManager().getWorkflowFromString(workflowTemplateId);
-// Workflow workflowObj = extractWorkflow(workflowTemplateId);
- return runWorkflow(workflowObj, inputs, user, metadata,
- workflowInstanceName, builder);
- }
-
- public String runWorkflow(Workflow workflow, List<WorkflowInput> inputs,
- String workflowInstanceName) throws GraphException,
- ComponentException, Exception {
- return runWorkflow(workflow, inputs, null, null, workflowInstanceName,
- builder);
- }
-
- public String runWorkflow(Workflow workflowObj, List<WorkflowInput> inputs,
- String user, String metadata, String workflowInstanceName)
- throws GraphException, ComponentException, Exception {
- return runWorkflow(workflowObj, inputs, user, metadata,
- workflowInstanceName, builder);
- }
-
- public String runWorkflow(Workflow workflowObj, List<WorkflowInput> inputs,
- String user, String metadata, String workflowInstanceName,
- WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException{
- try {
- String workflowString = XMLUtil.xmlElementToString(workflowObj
- .toXML());
- List<WSComponentPort> ports = getWSComponentPortInputs(workflowObj);
- for (WorkflowInput input : inputs) {
- WSComponentPort port = getWSComponentPort(input.getName(),
- ports);
- if (port != null) {
- port.setValue(input.getValue());
- }
- }
- List<NameValue> inputValues = new ArrayList<NameValue>();
- for (WSComponentPort port : ports) {
- NameValue nameValue = new NameValue();
- nameValue.setName(port.getName());
- if (port.getValue() == null) {
- nameValue.setValue(port.getDefaultValue());
- } else {
- nameValue.setValue(port.getValue().toString());
- }
- inputValues.add(nameValue);
- }
- workflow = workflowString;
- String topic = workflowObj.getName() + "_" + UUID.randomUUID();
- getRegistryClient().setWorkflowInstanceTemplateName(topic,
- workflowObj.getName());
- return runWorkflow(topic, inputValues.toArray(new NameValue[] {}),
- user, metadata, workflowInstanceName, builder);
- } catch (GraphException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (ComponentException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (Exception e) {
- throw new AiravataAPIInvocationException(e);
- }
- }
-
- public String runWorkflow(String workflowName, List<WorkflowInput> inputs,
- String user, String metadata, String workflowInstanceName,
- String experimentID) throws AiravataAPIInvocationException {
- try {
- Workflow workflowObj = extractWorkflow(workflowName);
- String workflowString = XMLUtil.xmlElementToString(workflowObj
- .toXML());
- List<WSComponentPort> ports;
- ports = getWSComponentPortInputs(workflowObj);
- for (WorkflowInput input : inputs) {
- WSComponentPort port = getWSComponentPort(input.getName(),
- ports);
- if (port != null) {
- port.setValue(input.getValue());
- }
- }
- List<NameValue> inputValues = new ArrayList<NameValue>();
- for (WSComponentPort port : ports) {
- NameValue nameValue = new NameValue();
- nameValue.setName(port.getName());
- if (port.getValue() == null) {
- nameValue.setValue(port.getDefaultValue());
- } else {
- nameValue.setValue(port.getValue().toString());
- }
- inputValues.add(nameValue);
- }
- workflow = workflowString;
- if (experimentID == null || experimentID.isEmpty()) {
- experimentID = workflowObj.getName() + "_" + UUID.randomUUID();
- }
- getRegistryClient().setWorkflowInstanceTemplateName(experimentID,
- workflowObj.getName());
- return runWorkflow(experimentID,
- inputValues.toArray(new NameValue[] {}), user, metadata,
- workflowInstanceName, this.builder);
- } catch (GraphException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (ComponentException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (Exception e) {
- throw new AiravataAPIInvocationException(
- "Error working with Airavata Registry: "
- + e.getLocalizedMessage(), e);
- }
- }
-
- private Workflow extractWorkflow(String workflowName) throws AiravataAPIInvocationException {
- Workflow workflowObj = null;
- if(!workflowName.contains("http://airavata.apache.org/xbaya/xwf")){//(getClient().getWorkflowManager().isWorkflowExists(workflowName)) {
- workflowObj = getWorkflow(workflowName);
- }else {
- try{
- workflowObj = getWorkflowManager().getWorkflowFromString(workflowName);
- }catch (AiravataAPIInvocationException e){
- getWorkflowManager().getWorkflow(workflowName);
- }
-
- }
- return workflowObj;
- }
-
- public List<WorkflowInput> getWorkflowInputs(String workflowTemplateId)
- throws AiravataAPIInvocationException {
- try {
- Workflow workflowTemplate = getWorkflow(workflowTemplateId);
- List<WSComponentPort> inputs = getWSComponentPortInputs(workflowTemplate);
- List<InputNode> inputNodes = getInputNodes(workflowTemplate);
- List<WorkflowInput> results = new ArrayList<WorkflowInput>();
- for (InputNode port : inputNodes) {
- Object value = null;
- WSComponentPort wsComponentPort = getWSComponentPort(
- port.getName(), inputs);
- if (wsComponentPort != null) {
- value = wsComponentPort.getValue();
- }
- results.add(new WorkflowInput(port.getName(), port
- .getParameterType().getLocalPart(), port
- .getDefaultValue(), value, !port.isVisibility()));
- }
- return results;
- } catch (AiravataAPIInvocationException e) {
- throw e;
- }catch (Exception e) {
- throw new AiravataAPIInvocationException(e);
- }
- }
-
- public String getWorkflowAsString(String workflowTemplateId)
- throws AiravataAPIInvocationException {
- try {
- Map<String, String> workflows = getRegistryClient().getWorkflows();
- for (String name : workflows.keySet()) {
- if (name.equals(workflowTemplateId)) {
- return workflows.get(name);
- }
- }
- return null;
- } catch (Exception e) {
- throw new AiravataAPIInvocationException(e);
- }
-
- }
-
- private List<WSComponentPort> getWSComponentPortInputs(
- String workflowTemplateId) throws AiravataAPIInvocationException{
- Workflow workflow = getWorkflow(workflowTemplateId);
- try {
- return getWSComponentPortInputs(workflow);
- } catch (GraphException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (ComponentException e) {
- throw new AiravataAPIInvocationException(e);
- }
- }
-
- private Workflow getWorkflow(String workflowTemplateId)
- throws AiravataAPIInvocationException {
- try {
- Workflow workflow = new Workflow(
- getWorkflowAsString(workflowTemplateId));
- return workflow;
- } catch (GraphException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (ComponentException e) {
- throw new AiravataAPIInvocationException(e);
- }
-
- }
-
- private List<WSComponentPort> getWSComponentPortInputs(Workflow workflow)
- throws GraphException, ComponentException {
- workflow.createScript();
- List<WSComponentPort> inputs = workflow.getInputs();
- return inputs;
- }
-
- private List<InputNode> getInputNodes(String workflowTemplateId)
- throws AiravataAPIInvocationException {
- Workflow workflow = getWorkflow(workflowTemplateId);
- return getInputNodes(workflow);
- }
-
- private List<InputNode> getInputNodes(Workflow workflow) {
- List<InputNode> inputNodes = GraphUtil.getInputNodes(workflow
- .getGraph());
- return inputNodes;
- }
+// private String validateAxisService(String urlString)
+// throws RegistryException {
+// String originalURL = urlString;
+// if (!urlString.endsWith("?wsdl")) {
+// urlString = urlString + "?wsdl";
+// }
+// try {
+// URL url = new URL(urlString);
+// URLConnection conn = url.openConnection();
+// conn.connect();
+// } catch (MalformedURLException e) {
+// // the URL is not in a valid form
+// throw new RegistryException("Given Axis2 Service URL : "
+// + urlString + " is Invalid", e);
+// } catch (IOException e) {
+// // the connection couldn't be established
+// throw new RegistryException("Given Axis2 Service URL : "
+// + urlString + " is Invalid", e);
+// }
+// return originalURL;
+// }
+//
+// private String validateURL(String urlString) throws RegistryException {
+// try {
+// URL url = new URL(urlString);
+// URLConnection conn = url.openConnection();
+// conn.connect();
+// } catch (MalformedURLException e) {
+// // the URL is not in a valid form
+// throw new RegistryException("Given URL: " + urlString
+// + " is Invalid", e);
+// } catch (IOException e) {
+// // the connection couldn't be established
+// throw new RegistryException("Given URL: " + urlString
+// + " is Invalid", e);
+// }
+// return urlString;
+// }
+//
+// public List<String> getWorkflowTemplateIds() {
+// List<String> workflowList = new ArrayList<String>();
+// Map<String, String> workflows;
+// try {
+// workflows = getRegistryClient().getWorkflows();
+// for (String name : workflows.keySet()) {
+// workflowList.add(name);
+// }
+// } catch (Exception e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+// return workflowList;
+// }
- private WSComponentPort getWSComponentPort(String name,
- List<WSComponentPort> ports) {
- for (WSComponentPort port : ports) {
- if (port.getName().equals(name)) {
- return port;
- }
- }
- return null;
- }
+// public String runWorkflow(String workflowTemplateId,
+// List<WorkflowInput> inputs) throws Exception {
+// return runWorkflow(workflowTemplateId, inputs, getRegistryClient().getUser()
+// .getUserName(), null, workflowTemplateId + "_"
+// + Calendar.getInstance().getTime().toString());
+// }
+//
+// public String runWorkflow(String workflowTemplateId,
+// List<WorkflowInput> inputs, String workflowInstanceName)
+// throws Exception {
+// return runWorkflow(workflowTemplateId, inputs, getRegistryClient().getUser()
+// .getUserName(), null, workflowInstanceName);
+// }
+//
+// public String runWorkflow(String workflowTemplateId,
+// List<WorkflowInput> inputs, String user, String metadata,
+// String workflowInstanceName) throws Exception {
+// Workflow workflowObj = getWorkflow(workflowTemplateId);
+// return runWorkflow(workflowObj, inputs, user, metadata,
+// workflowInstanceName, builder);
+// }
+
+// public String runWorkflow(String workflowTemplateId,
+// List<WorkflowInput> inputs, String user, String metadata,
+// String workflowInstanceName, WorkflowContextHeaderBuilder builder)
+// throws Exception {
+// Workflow workflowObj = getWorkflowManager().getWorkflowFromString(workflowTemplateId);
+//// Workflow workflowObj = extractWorkflow(workflowTemplateId);
+// return runWorkflow(workflowObj, inputs, user, metadata,
+// workflowInstanceName, builder);
+// }
+
+// public String runWorkflow(Workflow workflow, List<WorkflowInput> inputs,
+// String workflowInstanceName) throws GraphException,
+// ComponentException, Exception {
+// return runWorkflow(workflow, inputs, null, null, workflowInstanceName,
+// builder);
+// }
+//
+// public String runWorkflow(Workflow workflowObj, List<WorkflowInput> inputs,
+// String user, String metadata, String workflowInstanceName)
+// throws GraphException, ComponentException, Exception {
+// return runWorkflow(workflowObj, inputs, user, metadata,
+// workflowInstanceName, builder);
+// }
+
+// public String runWorkflow(Workflow workflowObj, List<WorkflowInput> inputs,
+// String user, String metadata, String workflowInstanceName,
+// WorkflowContextHeaderBuilder builder) throws AiravataAPIInvocationException{
+// try {
+// String workflowString = XMLUtil.xmlElementToString(workflowObj
+// .toXML());
+// List<WSComponentPort> ports = getWSComponentPortInputs(workflowObj);
+// for (WorkflowInput input : inputs) {
+// WSComponentPort port = getWSComponentPort(input.getName(),
+// ports);
+// if (port != null) {
+// port.setValue(input.getValue());
+// }
+// }
+// List<NameValue> inputValues = new ArrayList<NameValue>();
+// for (WSComponentPort port : ports) {
+// NameValue nameValue = new NameValue();
+// nameValue.setName(port.getName());
+// if (port.getValue() == null) {
+// nameValue.setValue(port.getDefaultValue());
+// } else {
+// nameValue.setValue(port.getValue().toString());
+// }
+// inputValues.add(nameValue);
+// }
+// workflow = workflowString;
+// String topic = workflowObj.getName() + "_" + UUID.randomUUID();
+// getRegistryClient().setWorkflowInstanceTemplateName(topic,
+// workflowObj.getName());
+// return runWorkflow(topic, inputValues.toArray(new NameValue[] {}),
+// user, metadata, workflowInstanceName, builder);
+// } catch (GraphException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (ComponentException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (Exception e) {
+// throw new AiravataAPIInvocationException(e);
+// }
+// }
+//
+//// public String runWorkflow(String workflowName, List<WorkflowInput> inputs,
+// String user, String metadata, String workflowInstanceName,
+// String experimentID) throws AiravataAPIInvocationException {
+// try {
+// Workflow workflowObj = extractWorkflow(workflowName);
+// String workflowString = XMLUtil.xmlElementToString(workflowObj
+// .toXML());
+// List<WSComponentPort> ports;
+// ports = getWSComponentPortInputs(workflowObj);
+// for (WorkflowInput input : inputs) {
+// WSComponentPort port = getWSComponentPort(input.getName(),
+// ports);
+// if (port != null) {
+// port.setValue(input.getValue());
+// }
+// }
+// List<NameValue> inputValues = new ArrayList<NameValue>();
+// for (WSComponentPort port : ports) {
+// NameValue nameValue = new NameValue();
+// nameValue.setName(port.getName());
+// if (port.getValue() == null) {
+// nameValue.setValue(port.getDefaultValue());
+// } else {
+// nameValue.setValue(port.getValue().toString());
+// }
+// inputValues.add(nameValue);
+// }
+// workflow = workflowString;
+// if (experimentID == null || experimentID.isEmpty()) {
+// experimentID = workflowObj.getName() + "_" + UUID.randomUUID();
+// }
+// getRegistryClient().setWorkflowInstanceTemplateName(experimentID,
+// workflowObj.getName());
+// return runWorkflow(experimentID,
+// inputValues.toArray(new NameValue[] {}), user, metadata,
+// workflowInstanceName, this.builder);
+// } catch (GraphException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (ComponentException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (Exception e) {
+// throw new AiravataAPIInvocationException(
+// "Error working with Airavata Registry: "
+// + e.getLocalizedMessage(), e);
+// }
+// }
+//
+// private Workflow extractWorkflow(String workflowName) throws AiravataAPIInvocationException {
+// Workflow workflowObj = null;
+// if(!workflowName.contains("http://airavata.apache.org/xbaya/xwf")){//(getClient().getWorkflowManager().isWorkflowExists(workflowName)) {
+// workflowObj = getWorkflow(workflowName);
+// }else {
+// try{
+// workflowObj = getWorkflowManager().getWorkflowFromString(workflowName);
+// }catch (AiravataAPIInvocationException e){
+// getWorkflowManager().getWorkflow(workflowName);
+// }
+//
+// }
+// return workflowObj;
+// }
+//
+// public List<WorkflowInput> getWorkflowInputs(String workflowTemplateId)
+// throws AiravataAPIInvocationException {
+// try {
+// Workflow workflowTemplate = getWorkflow(workflowTemplateId);
+// List<WSComponentPort> inputs = getWSComponentPortInputs(workflowTemplate);
+// List<InputNode> inputNodes = getInputNodes(workflowTemplate);
+// List<WorkflowInput> results = new ArrayList<WorkflowInput>();
+// for (InputNode port : inputNodes) {
+// Object value = null;
+// WSComponentPort wsComponentPort = getWSComponentPort(
+// port.getName(), inputs);
+// if (wsComponentPort != null) {
+// value = wsComponentPort.getValue();
+// }
+// results.add(new WorkflowInput(port.getName(), port
+// .getParameterType().getLocalPart(), port
+// .getDefaultValue(), value, !port.isVisibility()));
+// }
+// return results;
+// } catch (AiravataAPIInvocationException e) {
+// throw e;
+// }catch (Exception e) {
+// throw new AiravataAPIInvocationException(e);
+// }
+// }
+//
+// public String getWorkflowAsString(String workflowTemplateId)
+// throws AiravataAPIInvocationException {
+// try {
+// Map<String, String> workflows = getRegistryClient().getWorkflows();
+// for (String name : workflows.keySet()) {
+// if (name.equals(workflowTemplateId)) {
+// return workflows.get(name);
+// }
+// }
+// return null;
+// } catch (Exception e) {
+// throw new AiravataAPIInvocationException(e);
+// }
+//
+// }
+//
+// private List<WSComponentPort> getWSComponentPortInputs(
+// String workflowTemplateId) throws AiravataAPIInvocationException{
+// Workflow workflow = getWorkflow(workflowTemplateId);
+// try {
+// return getWSComponentPortInputs(workflow);
+// } catch (GraphException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (ComponentException e) {
+// throw new AiravataAPIInvocationException(e);
+// }
+// }
+//
+// private Workflow getWorkflow(String workflowTemplateId)
+// throws AiravataAPIInvocationException {
+// try {
+// Workflow workflow = new Workflow(
+// getWorkflowAsString(workflowTemplateId));
+// return workflow;
+// } catch (GraphException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (ComponentException e) {
+// throw new AiravataAPIInvocationException(e);
+// }
+//
+// }
+//
+// private List<WSComponentPort> getWSComponentPortInputs(Workflow workflow)
+// throws GraphException, ComponentException {
+// workflow.createScript();
+// List<WSComponentPort> inputs = workflow.getInputs();
+// return inputs;
+// }
+//
+// private List<InputNode> getInputNodes(String workflowTemplateId)
+// throws AiravataAPIInvocationException {
+// Workflow workflow = getWorkflow(workflowTemplateId);
+// return getInputNodes(workflow);
+// }
+//
+// private List<InputNode> getInputNodes(Workflow workflow) {
+// List<InputNode> inputNodes = GraphUtil.getInputNodes(workflow
+// .getGraph());
+// return inputNodes;
+// }
+//
+// private WSComponentPort getWSComponentPort(String name,
+// List<WSComponentPort> ports) {
+// for (WSComponentPort port : ports) {
+// if (port.getName().equals(name)) {
+// return port;
+// }
+// }
+// return null;
+// }
public static WorkflowContextHeaderBuilder getBuilder() {
return builder;
}
-
- private static void addNode(Node parentNode, Node childNode)
- throws RepositoryException {
- Node node;
- String childNodeName = childNode.getName();
- if (!parentNode.hasNode(childNodeName)) {
- node = parentNode.addNode(childNodeName);
- } else {
- node = parentNode.getNode(childNodeName);
- }
- System.out.println(node.getPath());
- PropertyIterator childProperties = childNode.getProperties();
- while (childProperties.hasNext()) {
- Property childProperty = childProperties.nextProperty();
- if (!(childProperty.getName().startsWith("jcr:") || childProperty
- .getName().startsWith("rep:"))) {
- if (childProperty.isMultiple()) {
- node.setProperty(childProperty.getName(),
- childProperty.getValues());
- } else {
- node.setProperty(childProperty.getName(),
- childProperty.getValue());
- }
-
- }
- }
- NodeIterator children = childNode.getNodes();
- while (children.hasNext()) {
- Node c = children.nextNode();
- addNode(node, c);
- }
- }
+//
+// private static void addNode(Node parentNode, Node childNode)
+// throws RepositoryException {
+// Node node;
+// String childNodeName = childNode.getName();
+// if (!parentNode.hasNode(childNodeName)) {
+// node = parentNode.addNode(childNodeName);
+// } else {
+// node = parentNode.getNode(childNodeName);
+// }
+// System.out.println(node.getPath());
+// PropertyIterator childProperties = childNode.getProperties();
+// while (childProperties.hasNext()) {
+// Property childProperty = childProperties.nextProperty();
+// if (!(childProperty.getName().startsWith("jcr:") || childProperty
+// .getName().startsWith("rep:"))) {
+// if (childProperty.isMultiple()) {
+// node.setProperty(childProperty.getName(),
+// childProperty.getValues());
+// } else {
+// node.setProperty(childProperty.getName(),
+// childProperty.getValue());
+// }
+//
+// }
+// }
+// NodeIterator children = childNode.getNodes();
+// while (children.hasNext()) {
+// Node c = children.nextNode();
+// addNode(node, c);
+// }
+// }
// private static void migrateRespositoryData(
// AiravataJCRRegistry sourceRegistry,
@@ -998,19 +976,19 @@ public class AiravataClient extends Obse
public String getCurrentUser() {
return currentUser;
}
-
- public List<String> getWorkflowServiceNodeIDs(String templateID) throws AiravataAPIInvocationException {
- try {
- Workflow workflow = new Workflow(getWorkflowAsString(templateID));
- return workflow.getWorkflowServiceNodeIDs();
- } catch (GraphException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (ComponentException e) {
- throw new AiravataAPIInvocationException(e);
- } catch (AiravataAPIInvocationException e) {
- throw e;
- }
- }
+//
+// public List<String> getWorkflowServiceNodeIDs(String templateID) throws AiravataAPIInvocationException {
+// try {
+// Workflow workflow = new Workflow(getWorkflowAsString(templateID));
+// return workflow.getWorkflowServiceNodeIDs();
+// } catch (GraphException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (ComponentException e) {
+// throw new AiravataAPIInvocationException(e);
+// } catch (AiravataAPIInvocationException e) {
+// throw e;
+// }
+// }
public Version getVersion() {
return API_VERSION;
@@ -1024,26 +1002,26 @@ public class AiravataClient extends Obse
public void setCurrentUser(String currentUser) {
this.currentUser = currentUser;
}
-
- private void launchWorkflow(final String topic, final NameValue[] inputs,
- final WorkflowContextHeaderBuilder builder) {
- try {
- builder.getWorkflowMonitoringContext().setExperimentId(topic);
- WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
- getClientConfiguration().getXbayaServiceURL().toString());
- stub._getServiceClient().addHeader(
- AXIOMUtil.stringToOM(XMLUtil.xmlElementToString(builder
- .getXml())));
- stub.launchWorkflow(workflow, topic, inputs);
- // log.info("Workflow output : " + worflowoutput);
- } catch (AxisFault e) {
- e.printStackTrace();
- } catch (XMLStreamException e) {
- e.printStackTrace();
- } catch (RemoteException e) {
- e.printStackTrace();
- }
- }
+//
+// private void launchWorkflow(final String topic, final NameValue[] inputs,
+// final WorkflowContextHeaderBuilder builder) {
+// try {
+// builder.getWorkflowMonitoringContext().setExperimentId(topic);
+// WorkflowInterpretorStub stub = new WorkflowInterpretorStub(
+// getClientConfiguration().getXbayaServiceURL().toString());
+// stub._getServiceClient().addHeader(
+// AXIOMUtil.stringToOM(XMLUtil.xmlElementToString(builder
+// .getXml())));
+// stub.launchWorkflow(workflow, topic, inputs);
+// // log.info("Workflow output : " + worflowoutput);
+// } catch (AxisFault e) {
+// e.printStackTrace();
+// } catch (XMLStreamException e) {
+// e.printStackTrace();
+// } catch (RemoteException e) {
+// e.printStackTrace();
+// }
+// }
public void setRegitryURI(URI regitryURI) {
this.regitryURI = regitryURI;
Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java?rev=1429837&r1=1429836&r2=1429837&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExecutionManager.java Mon Jan 7 15:19:50 2013
@@ -57,7 +57,7 @@ public interface ExecutionManager {
* @return
* @throws AiravataAPIInvocationException
*/
- public String runExperiment(Workflow workflow,List<WorkflowInput> inputs) throws AiravataAPIInvocationException;
+ public String runExperiment(Workflow workflow,List<WorkflowInput> inputs, ExperimentAdvanceOptions options) throws AiravataAPIInvocationException;
/**
* @deprecated Use the function <code>runExperiment(String,List<WorkflowInput>,ExperimentAdvanceOptions)</code> instead. <br />
@@ -127,7 +127,7 @@ public interface ExecutionManager {
* @throws AiravataAPIInvocationException
*/
public Monitor getExperimentMonitor(String experimentId, MonitorEventListener listener) throws AiravataAPIInvocationException;
-
+
/**
* @deprecated
* Creates a WorkflowContextHeaderBuilder object that can be used to customize the scheduling of a workflow execution.
Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowOutputDataSettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowOutputDataSettings.java?rev=1429837&r1=1429836&r2=1429837&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowOutputDataSettings.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/WorkflowOutputDataSettings.java Mon Jan 7 15:19:50 2013
@@ -31,6 +31,12 @@ public interface WorkflowOutputDataSetti
/**
* Add a new appliation output data settings
+ * @return
+ */
+ public OutputDataSettings addNewOutputDataSettings();
+
+ /**
+ * Add a new appliation output data settings
* @param outputDataDirectory
* @param dataRegistryURL
* @param isDataPersistent
Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java?rev=1429837&r1=1429836&r2=1429837&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/ExecutionManagerImpl.java Mon Jan 7 15:19:50 2013
@@ -41,6 +41,8 @@ import org.apache.airavata.common.utils.
import org.apache.airavata.common.workflow.execution.context.WorkflowContextHeaderBuilder;
import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus;
import org.apache.airavata.registry.api.workflow.WorkflowExecutionStatus.State;
+import org.apache.airavata.schemas.wec.ApplicationOutputDataHandlingDocument.ApplicationOutputDataHandling;
+import org.apache.airavata.schemas.wec.ApplicationSchedulingContextDocument.ApplicationSchedulingContext;
import org.apache.airavata.workflow.model.component.ComponentException;
import org.apache.airavata.workflow.model.component.ws.WSComponentPort;
import org.apache.airavata.workflow.model.graph.GraphException;
@@ -65,37 +67,67 @@ public class ExecutionManagerImpl implem
@Override
public String runExperiment(String workflowTemplateId,
List<WorkflowInput> inputs) throws AiravataAPIInvocationException {
- return runExperiment(workflowTemplateId, inputs ,getClient().getCurrentUser(),null, workflowTemplateId+"_"+Calendar.getInstance().getTime().toString());
+ ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowTemplateId+"_"+Calendar.getInstance().getTime().toString(), getClient().getCurrentUser(), null);
+ return runExperiment(workflowTemplateId, inputs ,options);
}
+
+ @Override
+ public String runExperiment(String workflow,
+ List<WorkflowInput> inputs, ExperimentAdvanceOptions options)
+ throws AiravataAPIInvocationException {
+ return runWorkflow(workflow, inputs, options);
+ }
+
@Override
- public String runExperiment(Workflow workflow, List<WorkflowInput> inputs)
+ public String runExperiment(Workflow workflow, List<WorkflowInput> inputs, ExperimentAdvanceOptions options)
throws AiravataAPIInvocationException {
- return runExperiment(workflow,inputs, getClient().getCurrentUser(),null);
+ return runExperimentGeneral(workflow,inputs, options, null).toString();
}
+
@Override
- public String runExperiment(String workflowTemplateId,
- List<WorkflowInput> inputs, String user, String metadata, String workflowInstanceName)
+ public ExperimentAdvanceOptions createExperimentAdvanceOptions()
throws AiravataAPIInvocationException {
- try {
- return getClient().runWorkflow(workflowTemplateId, inputs, user, metadata, workflowInstanceName);
- } catch (Exception e) {
- throw new AiravataAPIInvocationException(e);
- }
+ return new ExperimentAdvanceOptions();
+ }
+ @Override
+ public ExperimentAdvanceOptions createExperimentAdvanceOptions(
+ String experimentName, String experimentUser,
+ String experimentMetadata) throws AiravataAPIInvocationException {
+ ExperimentAdvanceOptions options = createExperimentAdvanceOptions();
+ options.setExperimentName(experimentName);
+ options.setExperimentCustomMetadata(experimentMetadata);
+ options.setExperimentExecutionUser(experimentUser);
+ return options;
}
@Override
- public String runExperiment(Workflow workflow, List<WorkflowInput> inputs,
- String user, String metadata) throws AiravataAPIInvocationException {
+ public void waitForExperimentTermination(String experimentId)
+ throws AiravataAPIInvocationException {
+ Monitor experimentMonitor = getExperimentMonitor(experimentId, new MonitorEventListenerAdapter() {
+ @Override
+ public void notify(EventDataRepository eventDataRepo,
+ EventData eventData) {
+ if (eventData.getType()==EventType.WORKFLOW_TERMINATED){
+ getMonitor().stopMonitoring();
+ }
+ }
+ });
+ experimentMonitor.startMonitoring();
try {
- return getClient().runWorkflow(workflow, inputs, user, metadata,workflow.getName()+"_"+Calendar.getInstance().getTime().toString());
- } catch (Exception e) {
- throw new AiravataAPIInvocationException(e);
+ WorkflowExecutionStatus workflowInstanceStatus = getClient().getProvenanceManager().getWorkflowInstanceStatus(experimentId, experimentId);
+ if (workflowInstanceStatus.getExecutionStatus()==State.FINISHED || workflowInstanceStatus.getExecutionStatus()==State.FAILED){
+ experimentMonitor.stopMonitoring();
+ return;
+ }
+ } catch (AiravataAPIInvocationException e) {
+ //Workflow may not have started yet. Best to use the monitor to follow the progress
}
+ experimentMonitor.waitForCompletion();
}
-
+
@Override
public Monitor getExperimentMonitor(String experimentId)
throws AiravataAPIInvocationException {
@@ -103,30 +135,56 @@ public class ExecutionManagerImpl implem
}
@Override
- public Monitor getExperimentMonitor(String experimentId,
- MonitorEventListener listener)
+ public Monitor getExperimentMonitor(String experimentId,MonitorEventListener listener)
throws AiravataAPIInvocationException {
return getClient().getWorkflowExecutionMonitor(experimentId,listener);
}
- public AiravataClient getClient() {
- return client;
- }
- public void setClient(AiravataClient client) {
- this.client = client;
+ //------------------Deprecated Functions---------------------//
+
+ @Override
+ public String runExperiment(String workflowTemplateId,
+ List<WorkflowInput> inputs, String user, String metadata, String workflowInstanceName)
+ throws AiravataAPIInvocationException {
+ ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
+ return runExperiment(workflowTemplateId, inputs, options);
+
}
@Override
+ public String runExperiment(Workflow workflow, List<WorkflowInput> inputs,
+ String user, String metadata) throws AiravataAPIInvocationException {
+ ExperimentAdvanceOptions options=createExperimentAdvanceOptions(workflow.getName()+"_"+Calendar.getInstance().getTime().toString(), user, metadata);
+ return runExperiment(workflow,inputs,options);
+ }
+
+ @Override
public String runExperiment(String workflowTemplateId,
List<WorkflowInput> inputs, String user, String metadata,
String workflowInstanceName, WorkflowContextHeaderBuilder builder)
throws AiravataAPIInvocationException {
- try {
- return getClient().runWorkflow(workflowTemplateId, inputs, user, metadata, workflowInstanceName,builder);
- } catch (Exception e) {
- throw new AiravataAPIInvocationException(e);
+ ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
+ ApplicationSchedulingContext[] nodeSchedules = builder.getWorkflowSchedulingContext().getApplicationSchedulingContextArray();
+ for (ApplicationSchedulingContext context : nodeSchedules) {
+ NodeSettings nodeSettings = options.getCustomWorkflowSchedulingSettings().addNewNodeSettings(context.getWorkflowNodeId());
+ if (context.isSetServiceId()) nodeSettings.setServiceId(context.getServiceId());
+ if (context.isSetGatekeeperEpr()) nodeSettings.getHostSettings().setGatekeeperEPR(context.getGatekeeperEpr());
+ if (context.isSetHostName()) nodeSettings.getHostSettings().setHostId(context.getHostName());
+ if (context.isSetWsgramPreferred()) nodeSettings.getHostSettings().setWSGramPreffered(context.getWsgramPreferred());
+ if (context.isSetCpuCount()) nodeSettings.getHPCSettings().setCPUCount(context.getCpuCount());
+ if (context.isSetJobManager()) nodeSettings.getHPCSettings().setJobManager(context.getJobManager());
+ if (context.isSetMaxWallTime()) nodeSettings.getHPCSettings().setMaxWallTime(context.getMaxWallTime());
+ if (context.isSetNodeCount()) nodeSettings.getHPCSettings().setNodeCount(context.getNodeCount());
+ if (context.isSetQueueName()) nodeSettings.getHPCSettings().setQueueName(context.getQueueName());
+ }
+ ApplicationOutputDataHandling[] dataHandlingSettings = builder.getWorkflowOutputDataHandling().getApplicationOutputDataHandlingArray();
+ for (ApplicationOutputDataHandling handling : dataHandlingSettings) {
+ options.getCustomWorkflowOutputDataSettings().addNewOutputDataSettings(handling.getOutputDataDirectory(),handling.getDataRegistryUrl(),handling.getDataPersistance());
}
+ //TODO rest of the builder configurations as they are added to the experiment options
+ return runExperiment(workflowTemplateId, inputs, options);
}
+
@Override
public WorkflowContextHeaderBuilder createWorkflowContextHeader()
@@ -145,28 +203,41 @@ public class ExecutionManagerImpl implem
List<WorkflowInput> inputs, String user, String metadata,
String workflowInstanceName, String experimentName)
throws AiravataAPIInvocationException {
- try {
- return getClient().runWorkflow(workflowName, inputs, user, metadata, workflowInstanceName,experimentName);
- } catch (Exception e) {
- throw new AiravataAPIInvocationException(e);
- }
+ ExperimentAdvanceOptions options = createExperimentAdvanceOptions(workflowInstanceName, user, metadata);
+ options.setCustomExperimentId(experimentName);
+ return runExperiment(workflowName, inputs, options);
}
+
+ //------------------End of Deprecated Functions---------------------//
- @Override
- public String runExperiment(String workflow,
- List<WorkflowInput> inputs, ExperimentAdvanceOptions options)
- throws AiravataAPIInvocationException {
- return runWorkflow(workflow, inputs, options);
+ public AiravataClient getClient() {
+ return client;
}
-
+ public void setClient(AiravataClient client) {
+ this.client = client;
+ }
+
private String runWorkflow(String workflowName, List<WorkflowInput> inputs, ExperimentAdvanceOptions options) throws AiravataAPIInvocationException {
- Workflow workflowObj = extractWorkflow(workflowName);
- return runWorkflow(workflowName, workflowObj, inputs, options);
+ return runExperimentGeneral(extractWorkflow(workflowName), inputs, options, null).toString();
}
- private String runWorkflow(String workflowName, Workflow workflowObj, List<WorkflowInput> inputs, ExperimentAdvanceOptions options) throws AiravataAPIInvocationException {
+ private Workflow extractWorkflow(String workflowName) throws AiravataAPIInvocationException {
+ Workflow workflowObj = null;
+ //FIXME - There should be a better way to figure-out if the passed string is a name or an xml
+ if(!workflowName.contains("http://airavata.apache.org/xbaya/xwf")){//(getClient().getWorkflowManager().isWorkflowExists(workflowName)) {
+ workflowObj = getClient().getWorkflowManager().getWorkflow(workflowName);
+ }else {
+ try{
+ workflowObj = getClient().getWorkflowManager().getWorkflowFromString(workflowName);
+ }catch (AiravataAPIInvocationException e){
+ getClient().getWorkflowManager().getWorkflow(workflowName);
+ }
+ }
+ return workflowObj;
+ }
+
+ private Object runExperimentGeneral(Workflow workflowObj, List<WorkflowInput> inputs, ExperimentAdvanceOptions options, MonitorEventListener listener) throws AiravataAPIInvocationException {
try {
-
String workflowString = XMLUtil.xmlElementToString(workflowObj.toXML());
List<WSComponentPort> ports = getWSComponentPortInputs(workflowObj);
for (WorkflowInput input : inputs) {
@@ -213,9 +284,16 @@ public class ExecutionManagerImpl implem
}
runPreWorkflowExecutionTasks(experimentID, executionUser, options.getExperimentMetadata(), options.getExperimentName());
NameValue[] inputVals = inputValues.toArray(new NameValue[] {});
+ Monitor monitorObj=null;
+ if (listener!=null){
+ monitorObj=getExperimentMonitor(experimentID, listener);
+ }
launchWorkflow(experimentID, workflowString, inputVals, builder);
- return experimentID;
-
+ if (listener==null){
+ return experimentID;
+ }else{
+ return monitorObj;
+ }
} catch (GraphException e) {
throw new AiravataAPIInvocationException(e);
} catch (ComponentException e) {
@@ -224,21 +302,6 @@ public class ExecutionManagerImpl implem
throw new AiravataAPIInvocationException("Error working with Airavata Registry: " + e.getLocalizedMessage(), e);
}
}
- private Workflow extractWorkflow(String workflowName) throws AiravataAPIInvocationException {
- Workflow workflowObj = null;
- //FIXME - There should be a better way to figure-out if the passed string is a name or an xml
- if(!workflowName.contains("http://airavata.apache.org/xbaya/xwf")){//(getClient().getWorkflowManager().isWorkflowExists(workflowName)) {
- workflowObj = getClient().getWorkflowManager().getWorkflow(workflowName);
- }else {
- try{
- workflowObj = getClient().getWorkflowManager().getWorkflowFromString(workflowName);
- }catch (AiravataAPIInvocationException e){
- getClient().getWorkflowManager().getWorkflow(workflowName);
- }
-
- }
- return workflowObj;
- }
private List<WSComponentPort> getWSComponentPortInputs(Workflow workflow)
throws GraphException, ComponentException {
@@ -288,47 +351,5 @@ public class ExecutionManagerImpl implem
}
getClient().getProvenanceManager().setExperimentName(experimentId, experimentName);
}
-
- @Override
- public ExperimentAdvanceOptions createExperimentAdvanceOptions()
- throws AiravataAPIInvocationException {
- return new ExperimentAdvanceOptions();
- }
-
- @Override
- public ExperimentAdvanceOptions createExperimentAdvanceOptions(
- String experimentName, String experimentUser,
- String experimentMetadata) throws AiravataAPIInvocationException {
- ExperimentAdvanceOptions options = createExperimentAdvanceOptions();
- options.setExperimentName(experimentName);
- options.setExperimentCustomMetadata(experimentMetadata);
- options.setExperimentExecutionUser(experimentUser);
- return options;
- }
-
- @Override
- public void waitForExperimentTermination(String experimentId)
- throws AiravataAPIInvocationException {
- Monitor experimentMonitor = getExperimentMonitor(experimentId, new MonitorEventListenerAdapter() {
- @Override
- public void notify(EventDataRepository eventDataRepo,
- EventData eventData) {
- if (eventData.getType()==EventType.WORKFLOW_TERMINATED){
- getMonitor().stopMonitoring();
- }
- }
- });
- experimentMonitor.startMonitoring();
- try {
- WorkflowExecutionStatus workflowInstanceStatus = getClient().getProvenanceManager().getWorkflowInstanceStatus(experimentId, experimentId);
- if (workflowInstanceStatus.getExecutionStatus()==State.FINISHED || workflowInstanceStatus.getExecutionStatus()==State.FAILED){
- experimentMonitor.stopMonitoring();
- return;
- }
- } catch (AiravataAPIInvocationException e) {
- //Workflow may not have started yet. Best to use the monitor to follow the progress
- }
- experimentMonitor.waitForCompletion();
- }
}
Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowOutputDataSettingsImpl.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowOutputDataSettingsImpl.java?rev=1429837&r1=1429836&r2=1429837&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowOutputDataSettingsImpl.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/impl/WorkflowOutputDataSettingsImpl.java Mon Jan 7 15:19:50 2013
@@ -71,4 +71,9 @@ public class WorkflowOutputDataSettingsI
getOutputDataSettingsListArray().clear();
}
+ @Override
+ public OutputDataSettings addNewOutputDataSettings() {
+ return new ApplicationOutputDataSettingsImpl();
+ }
+
}
Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java?rev=1429837&r1=1429836&r2=1429837&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/workflow/NodeExecutionData.java Mon Jan 7 15:19:50 2013
@@ -215,16 +215,15 @@ public class NodeExecutionData {
if (data!=null) {
String[] pairs = data.split(",");
for (String paras : pairs) {
- String[] nameVals = paras.trim().split("=");
- NameValue pair = null;
- if(nameVals.length >= 2){
- pair = new NameValue(nameVals[0].trim(),
- nameVals.length>1? nameVals[1].trim():"");
- }else if(nameVals.length == 1){
- pair = new NameValue(nameVals[0].trim(),
- "");
- }
- parameters.add(pair);
+ String name=paras.trim();
+ String value="";
+ int i = name.indexOf("=");
+ //if the paras has a value as well
+ if (i!=-1){
+ value=name.substring(i+1);
+ name=name.substring(0,i);
+ }
+ parameters.add(new NameValue(name,value));
}
}
return parameters;
Modified: airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java?rev=1429837&r1=1429836&r2=1429837&view=diff
==============================================================================
--- airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java (original)
+++ airavata/trunk/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java Mon Jan 7 15:19:50 2013
@@ -289,6 +289,14 @@ public class Monitor extends EventProduc
}
/**
+ * Return the id of the experiment which the monitoring is done
+ * @return
+ */
+ public String getExperimentId(){
+ return getConfiguration().getTopic();
+ }
+
+ /**
* @deprecated - Use <code>getEventDataRepository()</code> instead
* @return
*/