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/09 02:52:14 UTC
svn commit: r1430653 - in /airavata/trunk/modules:
airavata-client/src/main/java/org/apache/airavata/client/
airavata-client/src/main/java/org/apache/airavata/client/api/
commons/utils/src/main/java/org/apache/airavata/common/utils/
integration-tests/s...
Author: samindaw
Date: Wed Jan 9 01:52:13 2013
New Revision: 1430653
URL: http://svn.apache.org/viewvc?rev=1430653&view=rev
Log:
adding security settings - however not supported for 0.6 release
Added:
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AmazonWebServicesSettings.java (with props)
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/CredentialManagementServiceSettings.java (with props)
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/GridMyProxyRepositorySettings.java (with props)
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SSHAuthenticationSettings.java (with props)
airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SecuritySettings.java (with props)
Modified:
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/ExperimentAdvanceOptions.java
airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java
airavata/trunk/modules/integration-tests/src/test/resources/registry.properties
airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java
airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
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=1430653&r1=1430652&r2=1430653&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 Wed Jan 9 01:52:13 2013
@@ -78,12 +78,10 @@ public class AiravataClient extends Obse
public static final String WORKFLOWSERVICEURL = "xbaya.service.url";
public static final String TRUSTED_CERT_LOCATION = "trusted.cert.location";
private AiravataClientConfiguration clientConfiguration;
- private MonitorConfiguration monitorConfiguration;
- private static String workflow = "";
private static WorkflowContextHeaderBuilder builder;
private String currentUser;
- private URI regitryURI;
- private PasswordCallback callBack;
+ private URI regitryURI;
+ private PasswordCallback callBack;
private AiravataRegistry2 registry;
@@ -95,92 +93,24 @@ public class AiravataClient extends Obse
private UserManagerImpl userManagerImpl;
private ExecutionManagerImpl executionManagerImpl;
private String gateway;
- private boolean configCreated=false;
-
- // private NameValue[] configurations = new NameValue[7];
+ private boolean configCreated = false;
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();
-// }
-// }
// 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 {
-// 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 {
+ 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) {
+ if (registryUrl != null) {
config.put(AiravataClient.REGISTRY, registryUrl.toString());
}
- AiravataRegistry2 registryObject = getRegistry(registryUrl, "default", username, new PasswordCallBackImpl(username, password));
+ AiravataRegistry2 registryObject = getRegistry(registryUrl, "default",
+ username, new PasswordCallBackImpl(username, password));
if (registryObject != null) {
URI uri = registryObject.getEventingServiceURI();
config.put(
@@ -205,30 +135,33 @@ public class AiravataClient extends Obse
config.put(AiravataClient.WITHLISTENER, "true");
}
return config;
- }
-
- @Override
+ }
+
+ @Override
public void initialize() throws AiravataAPIInvocationException {
try {
- if (!configCreated){
- configuration=createConfig(getRegitryURI(), getCurrentUser(), getPassword());
- configCreated=true;
+ if (!configCreated) {
+ configuration = createConfig(getRegitryURI(), getCurrentUser(),
+ getPassword());
+ configCreated = true;
}
updateClientConfiguration(configuration);
// At this point we do not know the workflowExperimentId
// FIXME: Registry URL is set null as its not used. Set this when we
// have rest services
- builder = new WorkflowContextHeaderBuilder(configuration.get(BROKER),
- configuration.get(GFAC), null, null, null,
- configuration.get(MSGBOX));
+ builder = new WorkflowContextHeaderBuilder(
+ configuration.get(BROKER), configuration.get(GFAC), null,
+ null, null, configuration.get(MSGBOX));
- // TODO: At some point this should contain the current user the airavata
+ // TODO: At some point this should contain the current user the
+ // airavata
// client is
// logged in to the Airavata system
setCurrentUser(getClientConfiguration().getJcrUsername());
} catch (Exception e) {
- throw new AiravataAPIInvocationException("Error while initializing the Airavata API",e);
+ throw new AiravataAPIInvocationException(
+ "Error while initializing the Airavata API", e);
}
}
@@ -246,9 +179,6 @@ public class AiravataClient extends Obse
clientConfiguration.setMessagebrokerURL(new URL(configuration
.get(BROKER)));
}
-// if (configuration.containsKey(REGISTRY)) {
-// clientConfiguration.setRegistryURL(new URL(configuration.get(REGISTRY)));
-// }
if (configuration.get(WORKFLOWSERVICEURL) != null) {
clientConfiguration.setXbayaServiceURL(new URL(configuration
.get(WORKFLOWSERVICEURL)));
@@ -261,8 +191,8 @@ public class AiravataClient extends Obse
if (clientConfiguration.getRegistryURL() != null
&& clientConfiguration.getGfacURL() == null) {
try {
- clientConfiguration.setGfacURL(getRegistryClient().getGFacURIs()
- .get(0).toURL());
+ clientConfiguration.setGfacURL(getRegistryClient()
+ .getGFacURIs().get(0).toURL());
configuration.put(GFAC, clientConfiguration.getGfacURL()
.toString());
} catch (Exception e) {
@@ -271,287 +201,20 @@ 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 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);
-// }
-//
-// public Monitor getWorkflowExecutionMonitor(String topic,
-// MonitorEventListener listener) {
-// final String fTopic = topic;
-// MonitorConfiguration monitorConfiguration;
-// try {
-// monitorConfiguration = new MonitorConfiguration(
-// getClientConfiguration().getMessagebrokerURL().toURI(), fTopic,
-// true, getClientConfiguration().getMessageboxURL().toURI());
-// final Monitor monitor = new Monitor(monitorConfiguration);
-// monitor.printRawMessage(false);
-// monitor.getEventDataRepository().registerEventListener(listener);
-// listener.setExperimentMonitor(monitor);
-// return monitor;
-// } catch (URISyntaxException e) {
-// e.printStackTrace();
-// }
-//
-// }
-//
-// 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) {
- registry = getRegistry(getRegitryURI(),
- getGateway(),getCurrentUser(), getCallBack());
- }
- return registry;
- }
-
- public static AiravataRegistry2 getRegistry(URI registryURI, String gateway, String username, PasswordCallback callback) throws RegistryException, AiravataConfigurationException {
- return AiravataRegistryFactory.getRegistry(registryURI,
- new Gateway(gateway), new AiravataUser(
- username), callback);
+ public AiravataRegistry2 getRegistryClient()
+ throws AiravataConfigurationException, RegistryException {
+ if (registry == null) {
+ registry = getRegistry(getRegitryURI(), getGateway(),
+ getCurrentUser(), getCallBack());
+ }
+ return registry;
+ }
+
+ public static AiravataRegistry2 getRegistry(URI registryURI,
+ String gateway, String username, PasswordCallback callback)
+ throws RegistryException, AiravataConfigurationException {
+ return AiravataRegistryFactory.getRegistry(registryURI, new Gateway(
+ gateway), new AiravataUser(username), callback);
}
public AiravataClientConfiguration getClientConfiguration() {
@@ -561,382 +224,6 @@ 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 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 migrateRespositoryData(
- // AiravataJCRRegistry sourceRegistry,
- // AiravataJCRRegistry targetRegistry) throws Exception {
- // Session session1 = null;
- // Session session2 = null;
- // try {
- // session1 = sourceRegistry.getRepository().login(new
- // SimpleCredentials(sourceRegistry.getUsername(), new
- // String(sourceRegistry.getPassword()).toCharArray()));
- // session2 = targetRegistry.getRepository().login(new
- // SimpleCredentials(targetRegistry.getUsername(), new
- // String(targetRegistry.getPassword()).toCharArray()));
- // } catch (Exception e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // throw e;
- // }
- //
- //
- // NodeIterator nodes = session1.getRootNode().getNodes();
- // Node rootNode = session2.getRootNode();
- // List<String> ignoreRoots=Arrays.asList(new
- // String[]{"/AIRAVATA_CONFIGURATION_DATA"});
- // while(nodes.hasNext()){
- // Node nextNode = nodes.nextNode();
- // String path = nextNode.getPath();
- // if (!(path.equals("/jcr:system")||path.equals("/rep:policy") ||
- // ignoreRoots.contains(path))) {
- // addNode(rootNode,nextNode);
- // System.out.println();
- // }
- // }
- // System.out.print("Saving session.");
- // session1.logout();
- // System.out.print(".");
- // session2.save();
- // System.out.print(".");
- // session2.logout();
- // System.out.println(".done");
- // }
-
public AiravataManager getAiravataManager() {
if (airavataManagerImpl == null) {
airavataManagerImpl = new AiravataManagerImpl(this);
@@ -982,77 +269,43 @@ 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 Version getVersion() {
return API_VERSION;
}
- @Override
- public DescriptorBuilder getDescriptorBuilder() {
- return new DescriptorBuilder();
- }
+ @Override
+ public DescriptorBuilder getDescriptorBuilder() {
+ return new DescriptorBuilder();
+ }
- public void setCurrentUser(String currentUser) {
+ 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();
-// }
-// }
-
- public void setRegitryURI(URI regitryURI) {
- this.regitryURI = regitryURI;
- }
-
- public String getPassword() {
- if(getCallBack() != null){
- return getCallBack().getPassword(getCurrentUser());
- }
- return null;
-
- }
-
- public URI getRegitryURI() {
- return regitryURI;
- }
-
- public PasswordCallback getCallBack() {
- return callBack;
- }
-
- public void setCallBack(PasswordCallback callBack) {
- this.callBack = callBack;
- }
-
+
+ public void setRegitryURI(URI regitryURI) {
+ this.regitryURI = regitryURI;
+ }
+
+ public String getPassword() {
+ if (getCallBack() != null) {
+ return getCallBack().getPassword(getCurrentUser());
+ }
+ return null;
+
+ }
+
+ public URI getRegitryURI() {
+ return regitryURI;
+ }
+
+ public PasswordCallback getCallBack() {
+ return callBack;
+ }
+
+ public void setCallBack(PasswordCallback callBack) {
+ this.callBack = callBack;
+ }
public String getGateway() {
return gateway;
Added: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AmazonWebServicesSettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AmazonWebServicesSettings.java?rev=1430653&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AmazonWebServicesSettings.java (added)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AmazonWebServicesSettings.java Wed Jan 9 01:52:13 2013
@@ -0,0 +1,38 @@
+/*
+ *
+ * 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.client.api;
+
+public interface AmazonWebServicesSettings {
+ public String getAccessKeyId();
+ public String getAMIId();
+ public String getInstanceId();
+ public String getInstanceType();
+ public String getSecretAccessKey();
+ public String getUsername();
+
+ public void setAccessKeyId(String accessKeyId);
+ public void setAMIId(String amiId);
+ public void setInstanceId(String instanceId);
+ public void setInstanceType(String instanceType);
+ public void setSecretAccessKey(String secretAccessKey);
+ public void setUsername(String username);
+}
Propchange: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/AmazonWebServicesSettings.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/CredentialManagementServiceSettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/CredentialManagementServiceSettings.java?rev=1430653&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/CredentialManagementServiceSettings.java (added)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/CredentialManagementServiceSettings.java Wed Jan 9 01:52:13 2013
@@ -0,0 +1,33 @@
+/*
+ *
+ * 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.client.api;
+
+public interface CredentialManagementServiceSettings {
+ public String getExecutionSessionId();
+ public String getScmsURL();
+
+ public void setExecutionSessionId(String executionSessionId);
+ public void setScmsURL(String scmsURL);
+
+ public void resetExecutionSessionId();
+ public void resetScmsURL();
+}
Propchange: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/CredentialManagementServiceSettings.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExperimentAdvanceOptions.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExperimentAdvanceOptions.java?rev=1430653&r1=1430652&r2=1430653&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExperimentAdvanceOptions.java (original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/ExperimentAdvanceOptions.java Wed Jan 9 01:52:13 2013
@@ -26,6 +26,8 @@ import java.util.UUID;
import org.apache.airavata.client.impl.WorkflowOutputDataSettingsImpl;
import org.apache.airavata.client.impl.WorkflowSchedulingSettingsImpl;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+
public class ExperimentAdvanceOptions {
private String executionUser;
@@ -143,4 +145,13 @@ public class ExperimentAdvanceOptions {
}
return outputDataSettings;
}
+
+ /**
+ * Get the custom security settings for running the experiment
+ * @return
+ * @throws AiravataAPIInvocationException
+ */
+ public SecuritySettings getCustomSecuritySettings() throws AiravataAPIInvocationException{
+ throw new AiravataAPIInvocationException(new NotImplementedException());
+ }
}
Added: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/GridMyProxyRepositorySettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/GridMyProxyRepositorySettings.java?rev=1430653&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/GridMyProxyRepositorySettings.java (added)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/GridMyProxyRepositorySettings.java Wed Jan 9 01:52:13 2013
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.client.api;
+
+public interface GridMyProxyRepositorySettings {
+ public String getUsername();
+ public String getPassword();
+ public String getMyProxyServer();
+ public int getLifeTime();
+
+ public void setUsername(String username);
+ public void setPassword(String password);
+ public void setMyProxyServer(String myproxyServer);
+ public void setLifeTime(int lifeTime);
+
+ public void resetUsername();
+ public void resetPassword();
+ public void resetMyProxyServer();
+ public void resetLifeTime();
+}
Propchange: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/GridMyProxyRepositorySettings.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SSHAuthenticationSettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SSHAuthenticationSettings.java?rev=1430653&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SSHAuthenticationSettings.java (added)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SSHAuthenticationSettings.java Wed Jan 9 01:52:13 2013
@@ -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.client.api;
+
+public interface SSHAuthenticationSettings {
+ public String getAccessKeyId();
+ public String getSecretAccessKey();
+
+ public void setAccessKeyId(String accessKeyId);
+ public void setSecretAccessKey(String secretAccessKey);
+}
Propchange: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SSHAuthenticationSettings.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SecuritySettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SecuritySettings.java?rev=1430653&view=auto
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SecuritySettings.java (added)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SecuritySettings.java Wed Jan 9 01:52:13 2013
@@ -0,0 +1,29 @@
+/*
+ *
+ * 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.client.api;
+
+public interface SecuritySettings {
+ public AmazonWebServicesSettings getAmazonWSSettings();
+ public CredentialManagementServiceSettings getCMServiceSettings();
+ public GridMyProxyRepositorySettings getGridMyProxyRepositorySettings();
+ public SSHAuthenticationSettings getSSHAuthenticationSettings();
+}
Propchange: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/api/SecuritySettings.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java?rev=1430653&r1=1430652&r2=1430653&view=diff
==============================================================================
--- airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java (original)
+++ airavata/trunk/modules/commons/utils/src/main/java/org/apache/airavata/common/utils/XMLUtil.java Wed Jan 9 01:52:13 2013
@@ -22,6 +22,7 @@
package org.apache.airavata.common.utils;
import java.io.File;
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.StringReader;
@@ -43,7 +44,9 @@ import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlOptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
import org.xml.sax.SAXException;
import org.xmlpull.infoset.XmlDocument;
import org.xmlpull.infoset.XmlElement;
@@ -283,11 +286,20 @@ public class XMLUtil {
* @return The XmlElement in the document.
* @throws IOException
*/
- public static org.xmlpull.infoset.XmlElement loadXML(File file) throws IOException {
- String xmlText = IOUtil.readFileToString(file);
+ public static org.xmlpull.infoset.XmlElement loadXML(InputStream stream) throws IOException {
+ String xmlText = IOUtil.readToString(stream);
XmlDocument document = BUILDER.parseString(xmlText);
return document.getDocumentElement();
}
+
+ /**
+ * @param file
+ * @return The XmlElement in the document.
+ * @throws IOException
+ */
+ public static org.xmlpull.infoset.XmlElement loadXML(File file) throws IOException {
+ return loadXML(new FileInputStream(file));
+ }
/**
* @param string
Modified: airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java?rev=1430653&r1=1430652&r2=1430653&view=diff
==============================================================================
--- airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java (original)
+++ airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/BaseCaseIT.java Wed Jan 9 01:52:13 2013
@@ -22,15 +22,23 @@ import org.apache.airavata.commons.gfac.
import org.apache.airavata.commons.gfac.type.HostDescription;
import org.apache.airavata.commons.gfac.type.ServiceDescription;
import org.apache.airavata.registry.api.PasswordCallback;
-import org.apache.airavata.schemas.gfac.*;
+import org.apache.airavata.registry.api.impl.WorkflowExecutionDataImpl;
+import org.apache.airavata.registry.api.workflow.ExperimentData;
+import org.apache.airavata.registry.api.workflow.NodeExecutionData;
+import org.apache.airavata.schemas.gfac.DataType;
+import org.apache.airavata.schemas.gfac.HostDescriptionType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
import org.apache.airavata.workflow.model.component.ComponentException;
import org.apache.airavata.workflow.model.graph.GraphException;
import org.apache.airavata.workflow.model.wf.Workflow;
import org.apache.airavata.workflow.model.wf.WorkflowInput;
+import org.apache.airavata.ws.monitor.EventData;
+import org.apache.airavata.ws.monitor.EventDataListenerAdapter;
+import org.apache.airavata.ws.monitor.EventDataRepository;
import org.apache.airavata.ws.monitor.Monitor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -359,7 +367,7 @@ public class BaseCaseIT {
log("Workflow setting up completed ...");
try {
- runWorkFlow(workflow, Arrays.asList("echo_output=Airavata Test"));
+ runWorkFlowWithoutMonitor(workflow, Arrays.asList("echo_output=Airavata_Test"));
} catch (Exception e) {
log.error("An error occurred while invoking workflow", e);
}
@@ -369,16 +377,8 @@ public class BaseCaseIT {
AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(),
getUserName(), new PasswordCallbackImpl());
+ List<WorkflowInput> workflowInputs = setupInputs(workflow, inputValues);
String workflowName = workflow.getName();
- List<WorkflowInput> workflowInputs = airavataAPI.getWorkflowManager().getWorkflowInputs(workflowName);
-
- Assert.assertEquals(workflowInputs.size(), inputValues.size());
-
- int i = 0;
- for (String valueString : inputValues) {
- workflowInputs.get(i).setValue(valueString);
- ++i;
- }
ExperimentAdvanceOptions options = airavataAPI.getExecutionManager().createExperimentAdvanceOptions(workflowName,getUserName(),null);
String experimentId = airavataAPI.getExecutionManager().runExperiment(workflowName, workflowInputs, options);
@@ -388,11 +388,69 @@ public class BaseCaseIT {
log.info("Starting monitoring ....");
monitor(experimentId);
+ }
+
+ protected void runWorkFlowWithoutMonitor(Workflow workflow, List<String> inputValues) throws Exception {
+
+ AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(),
+ getUserName(), new PasswordCallbackImpl());
+ List<WorkflowInput> workflowInputs = setupInputs(workflow, inputValues);
+ String workflowName = workflow.getName();
+ ExperimentAdvanceOptions options = airavataAPI.getExecutionManager().createExperimentAdvanceOptions(workflowName,getUserName(),null);
+ String experimentId = airavataAPI.getExecutionManager().runExperiment(workflowName, workflowInputs, options, new EventDataListenerAdapter() {
+ @Override
+ public void notify(EventDataRepository eventDataRepo, EventData eventData) {
+ //do nothing
+ }
+ });
+
+ Assert.assertNotNull(experimentId);
+ airavataAPI.getExecutionManager().waitForExperimentTermination(experimentId);
+
+ log.info("Run workflow completed ....");
+ log.info("Starting monitoring ....");
+ verifyOutput(experimentId, "echo_output=Airavata_Test");
}
- protected String getWorkflowComposeContent(String fileName) throws IOException {
+ protected void verifyOutput(String experimentId, String outputVerifyingString) throws Exception {
+ AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(),
+ getUserName(), new PasswordCallbackImpl());
+ log.info("Workflow Experiment ID Returned : " + experimentId);
+
+ ExperimentData experimentData = airavataAPI.getProvenanceManager().getExperimentData(experimentId);
+
+ log.info("Verifying output ...");
+
+ List<WorkflowExecutionDataImpl> workflowInstanceData = experimentData.getWorkflowExecutionDataList();
+
+ for(WorkflowExecutionDataImpl data:workflowInstanceData){
+ List<NodeExecutionData> nodeDataList = data.getNodeDataList();
+ for(NodeExecutionData nodeData:nodeDataList){
+ System.out.print("******************************");
+ System.out.println(nodeData.getOutputData().get(0).getValue());
+ Assert.assertEquals("Airavata_Test", nodeData.getOutputData().get(0).getValue());
+ Assert.assertEquals(outputVerifyingString, nodeData.getInputData().get(0).getValue());
+ }
+ }
+ }
+
+ private List<WorkflowInput> setupInputs(Workflow workflow,List<String> inputValues) throws Exception {
+ AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(),
+ getUserName(), new PasswordCallbackImpl());
+ List<WorkflowInput> workflowInputs = airavataAPI.getWorkflowManager().getWorkflowInputs(workflow.getName());
+ Assert.assertEquals(workflowInputs.size(), inputValues.size());
+
+ int i = 0;
+ for (String valueString : inputValues) {
+ workflowInputs.get(i).setValue(valueString);
+ ++i;
+ }
+ return workflowInputs;
+ }
+
+ protected String getWorkflowComposeContent(String fileName) throws IOException {
File f = new File(".");
log.info(f.getAbsolutePath());
Modified: airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java?rev=1430653&r1=1430652&r2=1430653&view=diff
==============================================================================
--- airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java (original)
+++ airavata/trunk/modules/integration-tests/src/test/java/org/apache/airavata/integration/TestMonitorListener.java Wed Jan 9 01:52:13 2013
@@ -39,7 +39,7 @@ public class TestMonitorListener impleme
Assert.assertNotNull(event);
if (MonitorUtil.EventType.WORKFLOW_TERMINATED.equals(event.getType())) {
try {
- verifyOutput("echo_output=Airavata Test");
+ verifyOutput("echo_output=Airavata_Test");
} catch (Exception e) {
log.error("Error verifying output", e);
throw new RuntimeException(e);
@@ -65,7 +65,7 @@ public class TestMonitorListener impleme
for(WorkflowExecutionDataImpl data:workflowInstanceData){
List<NodeExecutionData> nodeDataList = data.getNodeDataList();
for(NodeExecutionData nodeData:nodeDataList){
- Assert.assertEquals("Airavata Test", nodeData.getOutputData().get(0).getValue());
+ Assert.assertEquals("Airavata_Test", nodeData.getOutputData().get(0).getValue());
Assert.assertEquals(outputVerifyingString, nodeData.getInputData().get(0).getValue());
}
}
Modified: airavata/trunk/modules/integration-tests/src/test/resources/registry.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/integration-tests/src/test/resources/registry.properties?rev=1430653&r1=1430652&r2=1430653&view=diff
==============================================================================
--- airavata/trunk/modules/integration-tests/src/test/resources/registry.properties (original)
+++ airavata/trunk/modules/integration-tests/src/test/resources/registry.properties Wed Jan 9 01:52:13 2013
@@ -53,11 +53,3 @@ default.registry.gateway=default
#for rest [RegistryClient]
#registry.jdbc.url=http://localhost:9080/airavata-services
-#user defined registry accessor classes
-#class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.descriptor.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.project.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.user.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-#class.published.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
-
Modified: airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java?rev=1430653&r1=1430652&r2=1430653&view=diff
==============================================================================
--- airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java (original)
+++ airavata/trunk/modules/registry/registry-api/src/main/java/org/apache/airavata/registry/api/util/RegistrySettings.java Wed Jan 9 01:52:13 2013
@@ -21,7 +21,6 @@
package org.apache.airavata.registry.api.util;
-import java.io.File;
import java.net.URL;
import java.util.Properties;
@@ -40,17 +39,15 @@ public class RegistrySettings {
private static final String REGISTRY_ACCESSOR_CLASS = "class.registry.accessor";
static{
- String propertyFileName = REPOSITORY_PROPERTIES;
- if (RegistrySettings.class.getClassLoader()
- .getResource(propertyFileName) == null) {
+ URL url = RegistrySettings.class.getClassLoader()
+ .getResource(REPOSITORY_PROPERTIES);
+ if (url == null) {
if (AiravataUtils.isServer()){
- propertyFileName=SERVER_REPOSITORY_PROPERTIES;
+ url=RegistrySettings.class.getClassLoader().getResource(SERVER_REPOSITORY_PROPERTIES);
}else{
- propertyFileName=CLIENT_REPOSITORY_PROPERTIES;
+ url=RegistrySettings.class.getClassLoader().getResource(CLIENT_REPOSITORY_PROPERTIES);
}
}
- URL url = RegistrySettings.class.getClassLoader()
- .getResource(propertyFileName);
try {
properties.load(url.openStream());
} catch (Exception e) {
Modified: airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java?rev=1430653&r1=1430652&r2=1430653&view=diff
==============================================================================
--- airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java (original)
+++ airavata/trunk/modules/workflow-model/workflow-model-core/src/main/java/org/apache/airavata/workflow/model/wf/Workflow.java Wed Jan 9 01:52:13 2013
@@ -24,7 +24,6 @@ package org.apache.airavata.workflow.mod
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
-import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -145,8 +144,6 @@ public class Workflow implements Cloneab
private XmlElement odeDeploymentDiscriptor;
- private QName qname;
-
private volatile WorkflowExecutionState executionState = WorkflowExecutionState.NONE;
private WsdlDefinitions tridentWSDL;
@@ -190,8 +187,7 @@ public class Workflow implements Cloneab
public Workflow(URI workflowFilePath) throws GraphException, ComponentException {
this();
try {
- File filePath = new File(workflowFilePath);
- XmlElement workflowElement = XMLUtil.loadXML(filePath);
+ XmlElement workflowElement = XMLUtil.loadXML(workflowFilePath.toURL().openStream());
parse(workflowElement);
} catch (RuntimeException e) {
throw new GraphException(e);
@@ -853,11 +849,6 @@ public class Workflow implements Cloneab
private void generateODEScripts(URI dscUrl, String odeEprEndingWithPort) throws GraphException, ComponentException {
this.getGraph().setID(this.getName());
- // find whether its Streaming
- List<NodeImpl> nodes = this.graph.getNodes();
- Node activeNode = null;
- String operationName = null;
-
BPELScript script = null;
script = new BPELScript(this);
@@ -910,7 +901,7 @@ public class Workflow implements Cloneab
*/
public QName getQname() {
- return this.qname = new QName(WorkflowConstants.LEAD_NS, this.getName());
+ return new QName(WorkflowConstants.LEAD_NS, this.getName());
}