Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 34BD417862 for ; Thu, 26 Mar 2015 17:08:01 +0000 (UTC) Received: (qmail 28946 invoked by uid 500); 26 Mar 2015 17:08:01 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 28619 invoked by uid 500); 26 Mar 2015 17:08:00 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 27667 invoked by uid 99); 26 Mar 2015 17:08:00 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Mar 2015 17:08:00 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 2DD54E2F37; Thu, 26 Mar 2015 17:08:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: shameera@apache.org To: commits@airavata.apache.org Date: Thu, 26 Mar 2015 17:08:14 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [15/50] [abbrv] airavata git commit: Renamed the wrong package name http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/airavata/simple/workflow/engine/parser/AiravataDefaultParser.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/airavata/simple/workflow/engine/parser/AiravataDefaultParser.java b/modules/simple-workflow/src/main/java/org/apache/airavata/simple/workflow/engine/parser/AiravataDefaultParser.java new file mode 100644 index 0000000..644eda6 --- /dev/null +++ b/modules/simple-workflow/src/main/java/org/apache/airavata/simple/workflow/engine/parser/AiravataDefaultParser.java @@ -0,0 +1,293 @@ +/* + * + * 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.simple.workflow.engine.parser; + +import org.airavata.appcatalog.cpi.AppCatalogException; +import org.airavata.appcatalog.cpi.WorkflowCatalog; +import org.apache.aiaravata.application.catalog.data.impl.AppCatalogFactory; +import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; +import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; +import org.apache.airavata.model.workspace.experiment.Experiment; +import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory; +import org.apache.airavata.registry.cpi.Registry; +import org.apache.airavata.registry.cpi.RegistryException; +import org.apache.airavata.registry.cpi.RegistryModelType; +import org.apache.airavata.simple.workflow.engine.dag.nodes.ApplicationNodeImpl; +import org.apache.airavata.simple.workflow.engine.dag.nodes.WorkflowInputNode; +import org.apache.airavata.simple.workflow.engine.dag.nodes.WorkflowInputNodeImpl; +import org.apache.airavata.simple.workflow.engine.dag.port.OutPortImpl; +import org.apache.airavata.workflow.model.component.ComponentException; +import org.apache.airavata.workflow.model.component.system.ConstantComponent; +import org.apache.airavata.workflow.model.component.system.InputComponent; +import org.apache.airavata.workflow.model.component.system.S3InputComponent; +import org.apache.airavata.workflow.model.graph.DataEdge; +import org.apache.airavata.workflow.model.graph.DataPort; +import org.apache.airavata.workflow.model.graph.GraphException; +import org.apache.airavata.workflow.model.graph.Node; +import org.apache.airavata.workflow.model.graph.impl.NodeImpl; +import org.apache.airavata.workflow.model.graph.system.OutputNode; +import org.apache.airavata.workflow.model.graph.system.SystemDataPort; +import org.apache.airavata.workflow.model.graph.ws.WSNode; +import org.apache.airavata.workflow.model.graph.ws.WSPort; +import org.apache.airavata.workflow.model.wf.Workflow; +import org.apache.airavata.simple.workflow.engine.WorkflowParser; +import org.apache.airavata.simple.workflow.engine.dag.edge.DirectedEdge; +import org.apache.airavata.simple.workflow.engine.dag.edge.Edge; +import org.apache.airavata.simple.workflow.engine.dag.nodes.ApplicationNode; +import org.apache.airavata.simple.workflow.engine.dag.nodes.WorkflowNode; +import org.apache.airavata.simple.workflow.engine.dag.nodes.WorkflowOutputNode; +import org.apache.airavata.simple.workflow.engine.dag.nodes.WorkflowOutputNodeImpl; +import org.apache.airavata.simple.workflow.engine.dag.port.InPort; +import org.apache.airavata.simple.workflow.engine.dag.port.InputPortIml; +import org.apache.airavata.simple.workflow.engine.dag.port.OutPort; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class AiravataDefaultParser implements WorkflowParser { + + private String credentialToken ; + private Workflow workflow; + + + private Experiment experiment; + private Map wfNodes = new HashMap(); + + + public AiravataDefaultParser(String experimentId, String credentialToken) throws RegistryException { + this.experiment = getExperiment(experimentId); + this.credentialToken = credentialToken; + } + + public AiravataDefaultParser(Experiment experiment, String credentialToken) { + this.credentialToken = credentialToken; + this.experiment = experiment; + } + + @Override + public List parse() throws RegistryException, AppCatalogException, + ComponentException, GraphException { + return parseWorkflow(getWorkflowFromExperiment(experiment)); + } + + public List parseWorkflow(Workflow workflow) { + List gNodes = getInputNodes(workflow); + List wfInputNodes = new ArrayList(); + List portContainers = new ArrayList(); + List experimentInputs = experiment.getExperimentInputs(); + Map inputDataMap=new HashMap(); + WorkflowInputNode wfInputNode = null; + for (InputDataObjectType dataObjectType : experimentInputs) { + inputDataMap.put(dataObjectType.getName(), dataObjectType); + } + for (Node gNode : gNodes) { + wfInputNode = new WorkflowInputNodeImpl(gNode.getID(), gNode.getName()); + wfInputNode.setInputObject(inputDataMap.get(wfInputNode.getName())); + if (wfInputNode.getInputObject() == null) { + // TODO: throw an error and exit. + } + portContainers.addAll(processOutPorts(gNode, wfInputNode)); + wfInputNodes.add(wfInputNode); + } + + // while port container is not empty iterate graph and build the workflow DAG. + buildModel(portContainers); + + return wfInputNodes; + } + + private void buildModel(List portContainerList) { + // end condition of recursive call. + if (portContainerList == null || portContainerList.isEmpty()) { + return ; + } + DataPort dataPort = null; + InPort inPort = null; + ApplicationNode wfApplicationNode = null; + WorkflowOutputNode wfOutputNode = null; + List nextPortContainerList = new ArrayList(); + for (PortContainer portContainer : portContainerList) { + dataPort = portContainer.getDataPort(); + inPort = portContainer.getInPort(); + Node node = dataPort.getNode(); + if (node instanceof WSNode) { + WSNode wsNode = (WSNode) node; + WorkflowNode wfNode = wfNodes.get(wsNode.getID()); + if (wfNode == null) { + wfApplicationNode = createApplicationNode(wsNode); + wfNodes.put(wfApplicationNode.getId(), wfApplicationNode); + nextPortContainerList.addAll(processOutPorts(wsNode, wfApplicationNode)); + } else if (wfNode instanceof ApplicationNode) { + wfApplicationNode = (ApplicationNode) wfNode; + } else { + // TODO : handle this scenario + } + inPort.setNode(wfApplicationNode); + wfApplicationNode.addInPort(inPort); + + }else if (node instanceof OutputNode) { + OutputNode oNode = (OutputNode) node; + wfOutputNode = createWorkflowOutputNode(oNode); + wfOutputNode.setInPort(inPort); + inPort.setNode(wfOutputNode); + wfNodes.put(wfOutputNode.getId(), wfOutputNode); + } + } + buildModel(nextPortContainerList); + + } + + private WorkflowOutputNode createWorkflowOutputNode(OutputNode oNode) { + WorkflowOutputNodeImpl workflowOutputNode = new WorkflowOutputNodeImpl(oNode.getID(), oNode.getName()); + OutputDataObjectType outputDataObjectType = new OutputDataObjectType(); + outputDataObjectType.setType(oNode.getParameterType()); + workflowOutputNode.setOutputObject(outputDataObjectType); + return workflowOutputNode; + } + + private ApplicationNode createApplicationNode(WSNode wsNode) { + ApplicationNode applicationNode = new ApplicationNodeImpl(wsNode.getID(), + wsNode.getComponent().getApplication().getName(), + wsNode.getComponent().getApplication().getApplicationId()); + return applicationNode; + } + + private List processOutPorts(Node node, WorkflowNode wfNode) { + OutPort outPort ; + Edge edge; + InPort inPort = null; + List portContainers = new ArrayList(); + for (DataPort dataPort : node.getOutputPorts()) { + outPort = createOutPort(dataPort); + for (DataEdge dataEdge : dataPort.getEdges()) { + edge = new DirectedEdge(); + edge.setFromPort(outPort); + outPort.addEdge(edge); + inPort = createInPort(dataEdge.getToPort()); + edge.setToPort(inPort); + inPort.addEdge(edge); + portContainers.add(new PortContainer(dataEdge.getToPort(), inPort)); + } + outPort.setNode(wfNode); + if (wfNode instanceof WorkflowInputNode) { + WorkflowInputNode workflowInputNode = (WorkflowInputNode) wfNode; + workflowInputNode.setOutPort(outPort); + } else if (wfNode instanceof ApplicationNode) { + ApplicationNode applicationNode = ((ApplicationNode) wfNode); + applicationNode.addOutPort(outPort); + } + } + return portContainers; + } + + private OutPort createOutPort(DataPort dataPort) { + OutPortImpl outPort = new OutPortImpl(dataPort.getID()); + OutputDataObjectType outputDataObjectType = new OutputDataObjectType(); + if (dataPort instanceof WSPort) { + WSPort wsPort = (WSPort) dataPort; + outputDataObjectType.setName(wsPort.getFromNode().getName()); + outputDataObjectType.setType(wsPort.getType()); + }else if (dataPort instanceof SystemDataPort) { + SystemDataPort sysPort = (SystemDataPort) dataPort; + outputDataObjectType.setName(sysPort.getFromNode().getName()); + outputDataObjectType.setType(sysPort.getType()); + } + + outPort.setOutputObject(outputDataObjectType); + return outPort; + } + + private InPort createInPort(DataPort toPort) { + InPort inPort = new InputPortIml(toPort.getID()); + InputDataObjectType inputDataObjectType = new InputDataObjectType(); + if (toPort instanceof WSPort) { + WSPort wsPort = (WSPort) toPort; + inputDataObjectType.setName(wsPort.getName()); + inputDataObjectType.setType(wsPort.getType()); + inputDataObjectType.setApplicationArgument(wsPort.getComponentPort().getApplicationArgument()); + inputDataObjectType.setIsRequired(!wsPort.getComponentPort().isOptional()); + inputDataObjectType.setInputOrder(wsPort.getComponentPort().getInputOrder()); + + inPort.setDefaultValue(wsPort.getComponentPort().getDefaultValue()); + }else if (toPort instanceof SystemDataPort) { + SystemDataPort sysPort = (SystemDataPort) toPort; + inputDataObjectType.setName(sysPort.getName()); + inputDataObjectType.setType(sysPort.getType()); + } + inPort.setInputObject(inputDataObjectType); + return inPort; + } + + private InputDataObjectType getInputDataObject(DataPort dataPort) { + InputDataObjectType inputDataObject = new InputDataObjectType(); + inputDataObject.setName(dataPort.getName()); + if (dataPort instanceof WSPort) { + WSPort port = (WSPort) dataPort; + inputDataObject.setInputOrder(port.getComponentPort().getInputOrder()); + inputDataObject.setApplicationArgument(port.getComponentPort().getApplicationArgument() == null ? + "" : port.getComponentPort().getApplicationArgument()); + inputDataObject.setType(dataPort.getType()); + } + return inputDataObject; + } + + private OutputDataObjectType getOutputDataObject(InputDataObjectType inputObject) { + OutputDataObjectType outputDataObjectType = new OutputDataObjectType(); + outputDataObjectType.setApplicationArgument(inputObject.getApplicationArgument()); + outputDataObjectType.setName(inputObject.getName()); + outputDataObjectType.setType(inputObject.getType()); + outputDataObjectType.setValue(inputObject.getValue()); + return outputDataObjectType; + } + + private Experiment getExperiment(String experimentId) throws RegistryException { + Registry registry = RegistryFactory.getDefaultRegistry(); + return (Experiment)registry.get(RegistryModelType.EXPERIMENT, experimentId); + } + + private Workflow getWorkflowFromExperiment(Experiment experiment) throws RegistryException, AppCatalogException, GraphException, ComponentException { + WorkflowCatalog workflowCatalog = getWorkflowCatalog(); + return new Workflow(workflowCatalog.getWorkflow(experiment.getApplicationId()).getGraph()); + } + + private WorkflowCatalog getWorkflowCatalog() throws AppCatalogException { + return AppCatalogFactory.getAppCatalog().getWorkflowCatalog(); + } + + private ArrayList getInputNodes(Workflow wf) { + ArrayList list = new ArrayList(); + List nodes = wf.getGraph().getNodes(); + for (Node node : nodes) { + String name = node.getComponent().getName(); + if (InputComponent.NAME.equals(name) || ConstantComponent.NAME.equals(name) || S3InputComponent.NAME.equals(name)) { + list.add(node); + } + } + return list; + } + + public Map getWfNodes() { + return wfNodes; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/airavata/simple/workflow/engine/parser/PortContainer.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/airavata/simple/workflow/engine/parser/PortContainer.java b/modules/simple-workflow/src/main/java/org/apache/airavata/simple/workflow/engine/parser/PortContainer.java new file mode 100644 index 0000000..db3dda5 --- /dev/null +++ b/modules/simple-workflow/src/main/java/org/apache/airavata/simple/workflow/engine/parser/PortContainer.java @@ -0,0 +1,53 @@ +/* + * + * 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.simple.workflow.engine.parser; + +import org.apache.airavata.workflow.model.graph.DataPort; +import org.apache.airavata.simple.workflow.engine.dag.port.InPort; + + +public class PortContainer { + private DataPort dataPort; + private InPort inPort; + + + public PortContainer(DataPort dataPort, InPort inPort) { + this.dataPort = dataPort; + this.inPort = inPort; + } + + public DataPort getDataPort() { + return dataPort; + } + + public void setDataPort(DataPort dataPort) { + this.dataPort = dataPort; + } + + public InPort getInPort() { + return inPort; + } + + public void setInPort(InPort inPort) { + this.inPort = inPort; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/ProcessPack.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/ProcessPack.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/ProcessPack.java deleted file mode 100644 index ab8b724..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/ProcessPack.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine; - -import org.apache.airavata.model.workspace.experiment.TaskDetails; -import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; -import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowNode; - -public class ProcessPack { - private WorkflowNode workflowNode; - private WorkflowNodeDetails wfNodeDetails; - private TaskDetails taskDetails; - - public ProcessPack(WorkflowNode workflowNode, WorkflowNodeDetails wfNodeDetails, TaskDetails taskDetails) { - this.workflowNode = workflowNode; - this.wfNodeDetails = wfNodeDetails; - this.taskDetails = taskDetails; - } - - public WorkflowNode getWorkflowNode() { - return workflowNode; - } - - public void setWorkflowNode(WorkflowNode workflowNode) { - this.workflowNode = workflowNode; - } - - public WorkflowNodeDetails getWfNodeDetails() { - return wfNodeDetails; - } - - public void setWfNodeDetails(WorkflowNodeDetails wfNodeDetails) { - this.wfNodeDetails = wfNodeDetails; - } - - public TaskDetails getTaskDetails() { - return taskDetails; - } - - public void setTaskDetails(TaskDetails taskDetails) { - this.taskDetails = taskDetails; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java deleted file mode 100644 index 93b3bc0..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/SimpleWorkflowInterpreter.java +++ /dev/null @@ -1,470 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine; - -import com.google.common.eventbus.EventBus; -import com.google.common.eventbus.Subscribe; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.apache.airavata.model.messaging.event.TaskIdentifier; -import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent; -import org.apache.airavata.model.messaging.event.TaskStatusChangeEvent; -import org.apache.airavata.model.util.ExperimentModelUtil; -import org.apache.airavata.model.workspace.experiment.ExecutionUnit; -import org.apache.airavata.model.workspace.experiment.Experiment; -import org.apache.airavata.model.workspace.experiment.TaskDetails; -import org.apache.airavata.model.workspace.experiment.TaskState; -import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; -import org.apache.airavata.model.workspace.experiment.WorkflowNodeState; -import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus; -import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory; -import org.apache.airavata.registry.cpi.ChildDataType; -import org.apache.airavata.registry.cpi.Registry; -import org.apache.airavata.registry.cpi.RegistryException; -import org.apache.airavata.registry.cpi.RegistryModelType; -import org.apache.ariavata.simple.workflow.engine.dag.edge.Edge; -import org.apache.ariavata.simple.workflow.engine.dag.nodes.ApplicationNode; -import org.apache.ariavata.simple.workflow.engine.dag.nodes.NodeState; -import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowInputNode; -import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowNode; -import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowOutputNode; -import org.apache.ariavata.simple.workflow.engine.dag.port.InPort; -import org.apache.ariavata.simple.workflow.engine.dag.port.OutPort; -import org.apache.ariavata.simple.workflow.engine.parser.AiravataDefaultParser; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -public class SimpleWorkflowInterpreter implements Runnable{ - - private static final Logger log = LoggerFactory.getLogger(SimpleWorkflowInterpreter.class); - - private List workflowInputNodes; - - private Experiment experiment; - - private String credentialToken; - - private Map readList = new ConcurrentHashMap(); - private Map waitingList = new ConcurrentHashMap(); - private Map processingQueue = new ConcurrentHashMap(); - private Map completeList = new HashMap(); - private Registry registry; - private EventBus eventBus = new EventBus(); - private List completeWorkflowOutputs = new ArrayList(); - - public SimpleWorkflowInterpreter(String experimentId, String credentialToken) throws RegistryException { - setExperiment(experimentId); - this.credentialToken = credentialToken; - } - - public SimpleWorkflowInterpreter(Experiment experiment, String credentialStoreToken) { - // read the workflow file and build the topology to a DAG. Then execute that dag - // get workflowInputNode list and start processing - // next() will return ready task and block the thread if no task in ready state. - this.experiment = experiment; - this.credentialToken = credentialStoreToken; - } - - - public void launchWorkflow() throws Exception { - // process workflow input nodes -// WorkflowFactoryImpl wfFactory = WorkflowFactoryImpl.getInstance(); -// WorkflowParser workflowParser = wfFactory.getWorkflowParser(experiment.getExperimentID(), credentialToken); - WorkflowParser workflowParser = new AiravataDefaultParser(experiment, credentialToken); - log.debug("Initialized workflow parser"); - setWorkflowInputNodes(workflowParser.parse()); - log.debug("Parsed the workflow and got the workflow input nodes"); - processWorkflowInputNodes(getWorkflowInputNodes()); - } - - // try to remove synchronization tag - private synchronized void processReadyList() { - for (WorkflowNode readyNode : readList.values()) { - try { - if (readyNode instanceof WorkflowOutputNode) { - WorkflowOutputNode wfOutputNode = (WorkflowOutputNode) readyNode; - wfOutputNode.getOutputObject().setValue(wfOutputNode.getInPort().getInputObject().getValue()); - addToCompleteOutputNodeList(wfOutputNode); - continue; - } - WorkflowNodeDetails workflowNodeDetails = createWorkflowNodeDetails(readyNode); - TaskDetails process = getProcess(workflowNodeDetails); - ProcessPack processPack = new ProcessPack(readyNode, workflowNodeDetails, process); - addToProcessingQueue(processPack); -// publishToProcessQueue(process); - publishToProcessQueue(processPack); - } catch (RegistryException e) { - // FIXME : handle this exception - } - } - } - - - private void publishToProcessQueue(TaskDetails process) { - Thread thread = new Thread(new TempPublisher(process, eventBus)); - thread.start(); - //TODO: publish to process queue. - } - - // TODO : remove this test method - private void publishToProcessQueue(ProcessPack process) { - WorkflowNode workflowNode = process.getWorkflowNode(); - if (workflowNode instanceof ApplicationNode) { - ApplicationNode applicationNode = (ApplicationNode) workflowNode; - List inputPorts = applicationNode.getInputPorts(); - if (applicationNode.getName().equals("Add")) { - applicationNode.getOutputPorts().get(0).getOutputObject().setValue(String.valueOf( - Integer.parseInt(inputPorts.get(0).getInputObject().getValue()) + Integer.parseInt(inputPorts.get(1).getInputObject().getValue()))); - } else if (applicationNode.getName().equals("Multiply")) { - applicationNode.getOutputPorts().get(0).getOutputObject().setValue(String.valueOf( - Integer.parseInt(inputPorts.get(0).getInputObject().getValue()) * Integer.parseInt(inputPorts.get(1).getInputObject().getValue()))); - } else if (applicationNode.getName().equals("Subtract")) { - applicationNode.getOutputPorts().get(0).getOutputObject().setValue(String.valueOf( - Integer.parseInt(inputPorts.get(0).getInputObject().getValue()) - Integer.parseInt(inputPorts.get(1).getInputObject().getValue()))); - } else { - throw new RuntimeException("Invalid Application name"); - } - - for (Edge edge : applicationNode.getOutputPorts().get(0).getOutEdges()) { - WorkflowUtil.copyValues(applicationNode.getOutputPorts().get(0).getOutputObject(), edge.getToPort().getInputObject()); - if (edge.getToPort().getNode().isReady()) { - addToReadyQueue(edge.getToPort().getNode()); - } else { - addToWaitingQueue(edge.getToPort().getNode()); - } - } - } else if (workflowNode instanceof WorkflowOutputNode) { - WorkflowOutputNode wfOutputNode = (WorkflowOutputNode) workflowNode; - throw new RuntimeException("Workflow output node in processing queue"); - } - - processingQueue.remove(process.getTaskDetails().getTaskID()); - } - - private TaskDetails getProcess(WorkflowNodeDetails wfNodeDetails) throws RegistryException { - // create workflow taskDetails from workflowNodeDetails - TaskDetails taskDetails = ExperimentModelUtil.cloneTaskFromWorkflowNodeDetails(getExperiment(), wfNodeDetails); - taskDetails.setTaskID(getRegistry() - .add(ChildDataType.TASK_DETAIL, taskDetails, wfNodeDetails.getNodeInstanceId()).toString()); - return taskDetails; - } - - private WorkflowNodeDetails createWorkflowNodeDetails(WorkflowNode readyNode) throws RegistryException { - WorkflowNodeDetails wfNodeDetails = ExperimentModelUtil.createWorkflowNode(readyNode.getId(), null); - ExecutionUnit executionUnit = ExecutionUnit.APPLICATION; - String executionData = null; - if (readyNode instanceof ApplicationNode) { - executionUnit = ExecutionUnit.APPLICATION; - executionData = ((ApplicationNode) readyNode).getApplicationId(); - } else if (readyNode instanceof WorkflowInputNode) { - executionUnit = ExecutionUnit.INPUT; - } else if (readyNode instanceof WorkflowOutputNode) { - executionUnit = ExecutionUnit.OUTPUT; - } - wfNodeDetails.setExecutionUnit(executionUnit); - wfNodeDetails.setExecutionUnitData(executionData); - setupNodeDetailsInput(readyNode, wfNodeDetails); - wfNodeDetails.setNodeInstanceId((String) getRegistry() - .add(ChildDataType.WORKFLOW_NODE_DETAIL, wfNodeDetails, getExperiment().getExperimentID())); -// nodeInstanceList.put(node, wfNodeDetails); - return wfNodeDetails; - } - - private void setupNodeDetailsInput(WorkflowNode readyNode, WorkflowNodeDetails wfNodeDetails) { - if (readyNode instanceof ApplicationNode) { - ApplicationNode applicationNode = (ApplicationNode) readyNode; - if (applicationNode.isReady()) { - for (InPort inPort : applicationNode.getInputPorts()) { - wfNodeDetails.addToNodeInputs(inPort.getInputObject()); - } - } else { - // TODO: handle this scenario properly. - } - } else { - // TODO: do we support for other type of workflow nodes ? - } - } - - - private void processWorkflowInputNodes(List wfInputNodes) { - Set tempNodeSet = new HashSet(); - for (WorkflowInputNode wfInputNode : wfInputNodes) { - if (wfInputNode.isReady()) { - log.debug("Workflow node : " + wfInputNode.getId() + " is ready to execute"); - for (Edge edge : wfInputNode.getOutPort().getOutEdges()) { - edge.getToPort().getInputObject().setValue(wfInputNode.getInputObject().getValue()); - if (edge.getToPort().getNode().isReady()) { - addToReadyQueue(edge.getToPort().getNode()); - log.debug("Added workflow node : " + edge.getToPort().getNode().getId() + " to the readyQueue"); - } else { - addToWaitingQueue(edge.getToPort().getNode()); - log.debug("Added workflow node " + edge.getToPort().getNode().getId() + " to the waitingQueue"); - - } - } - } - } - } - - - public List getWorkflowInputNodes() throws Exception { - return workflowInputNodes; - } - - public void setWorkflowInputNodes(List workflowInputNodes) { - this.workflowInputNodes = workflowInputNodes; - } - - - private List parseWorkflowDescription(){ - return null; - } - - - private Registry getRegistry() throws RegistryException { - if (registry==null){ - registry = RegistryFactory.getDefaultRegistry(); - } - return registry; - } - - public Experiment getExperiment() { - return experiment; - } - - private void updateWorkflowNodeStatus(WorkflowNodeDetails wfNodeDetails, WorkflowNodeState state) throws RegistryException{ - WorkflowNodeStatus status = ExperimentModelUtil.createWorkflowNodeStatus(state); - wfNodeDetails.setWorkflowNodeStatus(status); - getRegistry().update(RegistryModelType.WORKFLOW_NODE_STATUS, status, wfNodeDetails.getNodeInstanceId()); - } - - @Subscribe - public void taskOutputChanged(TaskOutputChangeEvent taskOutputEvent){ - String taskId = taskOutputEvent.getTaskIdentity().getTaskId(); - log.debug("Task Output changed event received for workflow node : " + - taskOutputEvent.getTaskIdentity().getWorkflowNodeId() + ", task : " + taskId); - ProcessPack processPack = processingQueue.get(taskId); - Set tempWfNodeSet = new HashSet(); - if (processPack != null) { - WorkflowNode workflowNode = processPack.getWorkflowNode(); - if (workflowNode instanceof ApplicationNode) { - ApplicationNode applicationNode = (ApplicationNode) workflowNode; - // Workflow node can have one to many output ports and each output port can have one to many links - for (OutPort outPort : applicationNode.getOutputPorts()) { - for (OutputDataObjectType outputDataObjectType : taskOutputEvent.getOutput()) { - if (outPort.getOutputObject().getName().equals(outputDataObjectType.getName())) { - outPort.getOutputObject().setValue(outputDataObjectType.getValue()); - break; - } - } - for (Edge edge : outPort.getOutEdges()) { - WorkflowUtil.copyValues(outPort.getOutputObject(), edge.getToPort().getInputObject()); - if (edge.getToPort().getNode().isReady()) { - addToReadyQueue(edge.getToPort().getNode()); - } - } - } - } - processingQueue.remove(taskId); - log.debug("removed task from processing queue : " + taskId); - } - - } - - @Subscribe - public void taskStatusChanged(TaskStatusChangeEvent taskStatus){ - String taskId = taskStatus.getTaskIdentity().getTaskId(); - ProcessPack processPack = processingQueue.get(taskId); - if (processPack != null) { - WorkflowNodeState wfNodeState = WorkflowNodeState.UNKNOWN; - switch (taskStatus.getState()) { - case WAITING: - break; - case STARTED: - break; - case PRE_PROCESSING: - processPack.getWorkflowNode().setState(NodeState.PRE_PROCESSING); - break; - case INPUT_DATA_STAGING: - processPack.getWorkflowNode().setState(NodeState.PRE_PROCESSING); - break; - case EXECUTING: - processPack.getWorkflowNode().setState(NodeState.EXECUTING); - break; - case OUTPUT_DATA_STAGING: - processPack.getWorkflowNode().setState(NodeState.POST_PROCESSING); - break; - case POST_PROCESSING: - processPack.getWorkflowNode().setState(NodeState.POST_PROCESSING); - break; - case COMPLETED: - processPack.getWorkflowNode().setState(NodeState.EXECUTED); - break; - case FAILED: - processPack.getWorkflowNode().setState(NodeState.FAILED); - break; - case UNKNOWN: - break; - case CONFIGURING_WORKSPACE: - break; - case CANCELED: - case CANCELING: - processPack.getWorkflowNode().setState(NodeState.FAILED); - break; - default: - break; - } - if (wfNodeState != WorkflowNodeState.UNKNOWN) { - try { - updateWorkflowNodeStatus(processPack.getWfNodeDetails(), wfNodeState); - } catch (RegistryException e) { - // TODO: handle this. - } - } - } - - } - - /** - * Remove the workflow node from waiting queue and add it to the ready queue. - * @param workflowNode - Workflow Node - */ - private synchronized void addToReadyQueue(WorkflowNode workflowNode) { - waitingList.remove(workflowNode.getId()); - readList.put(workflowNode.getId(), workflowNode); - } - - private void addToWaitingQueue(WorkflowNode workflowNode) { - waitingList.put(workflowNode.getId(), workflowNode); - } - - /** - * First remove the node from ready list and then add the WfNodeContainer to the process queue. - * Note that underline data structure of the process queue is a Map. - * @param processPack - has both workflow and correspond workflowNodeDetails and TaskDetails - */ - private synchronized void addToProcessingQueue(ProcessPack processPack) { - readList.remove(processPack.getWorkflowNode().getId()); - processingQueue.put(processPack.getTaskDetails().getTaskID(), processPack); - } - - private synchronized void addToCompleteQueue(ProcessPack processPack) { - processingQueue.remove(processPack.getTaskDetails().getTaskID()); - completeList.put(processPack.getTaskDetails().getTaskID(), processPack); - } - - - private void addToCompleteOutputNodeList(WorkflowOutputNode wfOutputNode) { - completeWorkflowOutputs.add(wfOutputNode); - readList.remove(wfOutputNode.getId()); - } - - @Override - public void run() { - // TODO: Auto generated method body. - try { - log.debug("Launching workflow"); - launchWorkflow(); - while (!(waitingList.isEmpty() && readList.isEmpty())) { - processReadyList(); - Thread.sleep(1000); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void setExperiment(String experimentId) throws RegistryException { - experiment = (Experiment) getRegistry().get(RegistryModelType.EXPERIMENT, experimentId); - log.debug("Retrieve Experiment for experiment id : " + experimentId); - } - - - class TempPublisher implements Runnable { - private TaskDetails tempTaskDetails; - private EventBus tempEventBus; - - public TempPublisher(TaskDetails tempTaskDetails, EventBus tempEventBus) { - this.tempTaskDetails = tempTaskDetails; - this.tempEventBus = tempEventBus; - } - - @Override - public void run() { - try { - TaskIdentifier identifier = new TaskIdentifier(tempTaskDetails.getTaskID(), null, null, null); - TaskStatusChangeEvent statusChangeEvent = new TaskStatusChangeEvent(TaskState.PRE_PROCESSING, identifier); - tempEventBus.post(statusChangeEvent); - Thread.sleep(1000); - statusChangeEvent = new TaskStatusChangeEvent(TaskState.WAITING, identifier); - tempEventBus.post(statusChangeEvent); - Thread.sleep(1000); - statusChangeEvent = new TaskStatusChangeEvent(TaskState.INPUT_DATA_STAGING, identifier); - tempEventBus.post(statusChangeEvent); - Thread.sleep(1000); - statusChangeEvent = new TaskStatusChangeEvent(TaskState.STARTED, identifier); - tempEventBus.post(statusChangeEvent); - Thread.sleep(1000); - statusChangeEvent = new TaskStatusChangeEvent(TaskState.EXECUTING, identifier); - tempEventBus.post(statusChangeEvent); - Thread.sleep(1000); - statusChangeEvent = new TaskStatusChangeEvent(TaskState.POST_PROCESSING, identifier); - tempEventBus.post(statusChangeEvent); - Thread.sleep(1000); - statusChangeEvent = new TaskStatusChangeEvent(TaskState.OUTPUT_DATA_STAGING, identifier); - tempEventBus.post(statusChangeEvent); - Thread.sleep(1000); - statusChangeEvent = new TaskStatusChangeEvent(TaskState.COMPLETED, identifier); - tempEventBus.post(statusChangeEvent); - Thread.sleep(1000); - - List applicationInputs = tempTaskDetails.getApplicationInputs(); - List applicationOutputs = tempTaskDetails.getApplicationOutputs(); - log.info("************** Task output change event fired for application id :" + tempTaskDetails.getApplicationId()); - if (tempTaskDetails.getApplicationId().equals("Add") || tempTaskDetails.getApplicationId().equals("Add_2")) { - applicationOutputs.get(0).setValue((Integer.parseInt(applicationInputs.get(0).getValue()) + - Integer.parseInt(applicationInputs.get(1).getValue())) + ""); - } else if (tempTaskDetails.getApplicationId().equals("Subtract")) { - applicationOutputs.get(0).setValue((Integer.parseInt(applicationInputs.get(0).getValue()) - - Integer.parseInt(applicationInputs.get(1).getValue())) + ""); - } else if (tempTaskDetails.getApplicationId().equals("Multiply")) { - applicationOutputs.get(0).setValue((Integer.parseInt(applicationInputs.get(0).getValue()) * - Integer.parseInt(applicationInputs.get(1).getValue())) + ""); - } - TaskOutputChangeEvent taskOutputChangeEvent = new TaskOutputChangeEvent(applicationOutputs, identifier); - eventBus.post(taskOutputChangeEvent); - - } catch (InterruptedException e) { - log.error("Thread was interrupted while sleeping"); - } - - } - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java deleted file mode 100644 index b0ee4a1..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine; - -/** - * All classes implement this WorkflowFactory interface, should be abstract or singleton. - */ -public interface WorkflowFactory { - - public WorkflowParser getWorkflowParser(String experimentId, String credentialToken); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java deleted file mode 100644 index dd84df0..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowFactoryImpl.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine; - -import org.apache.airavata.registry.cpi.RegistryException; -import org.apache.ariavata.simple.workflow.engine.parser.AiravataDefaultParser; - -/** - * Singleton class, only one instance can exist in runtime. - */ -public class WorkflowFactoryImpl implements WorkflowFactory { - - private static WorkflowFactoryImpl workflowFactoryImpl; - - private WorkflowParser workflowParser; - - private static final String synch = "sync"; - - private WorkflowFactoryImpl(){ - - } - - public static WorkflowFactoryImpl getInstance() { - if (workflowFactoryImpl == null) { - synchronized (synch) { - if (workflowFactoryImpl == null) { - workflowFactoryImpl = new WorkflowFactoryImpl(); - } - } - } - return workflowFactoryImpl; - } - - - @Override - public WorkflowParser getWorkflowParser(String experimentId, String credentialToken) { - if (workflowParser == null) { - try { - workflowParser = new AiravataDefaultParser(experimentId, credentialToken); - } catch (RegistryException e) { - // TODO : handle this scenario - } - } - return workflowParser; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowParser.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowParser.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowParser.java deleted file mode 100644 index adf0447..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowParser.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine; - -import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowInputNode; - -import java.util.List; - -public interface WorkflowParser { - - public List parse() throws Exception; - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowUtil.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowUtil.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowUtil.java deleted file mode 100644 index 688b170..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/WorkflowUtil.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine; - -import com.google.common.eventbus.EventBus; -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.apache.airavata.model.messaging.event.TaskIdentifier; -import org.apache.airavata.model.messaging.event.TaskStatusChangeEvent; -import org.apache.airavata.model.workspace.experiment.TaskDetails; -import org.apache.airavata.model.workspace.experiment.TaskState; -import org.apache.airavata.persistance.registry.jpa.model.TaskDetail; - -public class WorkflowUtil { - - public static InputDataObjectType copyValues(InputDataObjectType fromInputObj, InputDataObjectType toInputObj){ - if (toInputObj == null) { - // TODO : throw an error - } - toInputObj.setValue(fromInputObj.getValue()); - if (fromInputObj.getApplicationArgument() != null - && !fromInputObj.getApplicationArgument().trim().equals("")) { - toInputObj.setApplicationArgument(fromInputObj.getApplicationArgument()); - } - if (toInputObj.getType() == null) { - toInputObj.setType(fromInputObj.getType()); - } - return fromInputObj; - } - - public static InputDataObjectType copyValues(OutputDataObjectType outputData, InputDataObjectType inputData) { - inputData.setValue(outputData.getValue()); - return inputData; - } - - - public static OutputDataObjectType copyValues(InputDataObjectType inputObject, OutputDataObjectType outputObject) { - if (outputObject == null) { - outputObject = new OutputDataObjectType(); - } - outputObject.setValue(inputObject.getValue()); - return outputObject; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/edge/DirectedEdge.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/edge/DirectedEdge.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/edge/DirectedEdge.java deleted file mode 100644 index 9e1544e..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/edge/DirectedEdge.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.edge; - -import org.apache.ariavata.simple.workflow.engine.dag.port.InPort; -import org.apache.ariavata.simple.workflow.engine.dag.port.OutPort; - - -public class DirectedEdge implements Edge { - - private InPort inPort; - private OutPort outPort; - - @Override - public InPort getToPort() { - return inPort; - } - - @Override - public void setToPort(InPort inPort) { - this.inPort = inPort; - } - - @Override - public OutPort getFromPort() { - return outPort; - } - - @Override - public void setFromPort(OutPort outPort) { - this.outPort = outPort; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/edge/Edge.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/edge/Edge.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/edge/Edge.java deleted file mode 100644 index cc8116a..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/edge/Edge.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.edge; - -import org.apache.ariavata.simple.workflow.engine.dag.port.InPort; -import org.apache.ariavata.simple.workflow.engine.dag.port.OutPort; - -/** - * Edge is a link to one node to another, basically edge should have outPort of a workflow node , - * which is starting point and inPort of a workflow node, which is end point of the edge. - */ - -public interface Edge { - - public InPort getToPort(); - - public void setToPort(InPort inPort); - - public OutPort getFromPort(); - - public void setFromPort(OutPort outPort); - - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNode.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNode.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNode.java deleted file mode 100644 index 6ab5754..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNode.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.nodes; - -import org.apache.ariavata.simple.workflow.engine.dag.port.InPort; -import org.apache.ariavata.simple.workflow.engine.dag.port.OutPort; - -import java.util.List; - -public interface ApplicationNode extends WorkflowNode { - - public String getApplicationId(); - - public void addInPort(InPort inPort); - - public List getInputPorts(); - - public void addOutPort(OutPort outPort); - - public List getOutputPorts(); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNodeImpl.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNodeImpl.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNodeImpl.java deleted file mode 100644 index 1282dd0..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/ApplicationNodeImpl.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.nodes; - -import org.apache.ariavata.simple.workflow.engine.dag.port.InPort; -import org.apache.ariavata.simple.workflow.engine.dag.port.OutPort; - -import java.util.ArrayList; -import java.util.List; - -public class ApplicationNodeImpl implements ApplicationNode { - - private final String nodeId; - private NodeState myState = NodeState.WAITING; - private String applicationId; - private List inPorts = new ArrayList(); - private List outPorts = new ArrayList(); - private String applicationName; - -// public ApplicationNodeImpl(String nodeId) { -// this(nodeId, null); -// } -// -// public ApplicationNodeImpl(String nodeId, String applicationId) { -// this(nodeId, null, applicationId); -// } - - public ApplicationNodeImpl(String nodeId, String applicationName, String applicationId) { - this.nodeId = nodeId; - this.applicationName = applicationName; - this.applicationId = applicationId; - } - - @Override - public String getId() { - return this.nodeId; - } - - @Override - public String getName() { - return applicationName; - } - - @Override - public NodeType getType() { - return NodeType.APPLICATION; - } - - @Override - public NodeState getState() { - return myState; - } - - @Override - public void setState(NodeState newState) { - // TODO: node state can't be reversed , correct order WAITING --> READY --> EXECUTING --> EXECUTED --> COMPLETE - myState = newState; - } - - @Override - public boolean isReady() { - for (InPort inPort : getInputPorts()) { - if (!inPort.isReady()) { - return false; - } - } - return true; - } - - @Override - public String getApplicationId() { - return this.applicationId; - } - - @Override - public void addInPort(InPort inPort) { - this.inPorts.add(inPort); - } - - @Override - public List getInputPorts() { - return this.inPorts; - } - - @Override - public void addOutPort(OutPort outPort) { - this.outPorts.add(outPort); - } - - @Override - public List getOutputPorts() { - return this.outPorts; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeState.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeState.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeState.java deleted file mode 100644 index 088336b..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeState.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.nodes; - -public enum NodeState { - WAITING, // waiting on inputs - READY, // all inputs are available and ready to execute - QUEUED, // - PRE_PROCESSING, // - EXECUTING, // task has been submitted , not yet finish - EXECUTED, // task executed - POST_PROCESSING, // - FAILED, - COMPLETE // all works done -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeType.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeType.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeType.java deleted file mode 100644 index 9cef6ab..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/NodeType.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.nodes; - -public enum NodeType { - APPLICATION, - WORKFLOW_INPUT, - WORKFLOW_OUTPUT -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNode.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNode.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNode.java deleted file mode 100644 index 0c1d0b4..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNode.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.nodes; - -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.ariavata.simple.workflow.engine.dag.port.OutPort; - -public interface WorkflowInputNode extends WorkflowNode { - - public InputDataObjectType getInputObject(); - - public void setInputObject(InputDataObjectType inputObject); - - public OutPort getOutPort(); - - public void setOutPort(OutPort outPort); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNodeImpl.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNodeImpl.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNodeImpl.java deleted file mode 100644 index a015909..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowInputNodeImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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.ariavata.simple.workflow.engine.dag.nodes; - -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.ariavata.simple.workflow.engine.dag.port.OutPort; - -public class WorkflowInputNodeImpl implements WorkflowInputNode { - - private NodeState myState = NodeState.READY; - private final String nodeId; - private String nodeName; - private OutPort outPort; - private InputDataObjectType inputDataObjectType; - private String name; - - public WorkflowInputNodeImpl(String nodeId) { - this(nodeId, null); - } - - public WorkflowInputNodeImpl(String nodeId, String nodeName) { - this.nodeId = nodeId; - this.nodeName = nodeName; - } - - @Override - public String getId() { - return this.nodeId; - } - - @Override - public String getName() { - return this.nodeName; - } - - @Override - public NodeType getType() { - return NodeType.WORKFLOW_INPUT; - } - - @Override - public NodeState getState() { - return myState; - } - - @Override - public void setState(NodeState newState) { - // TODO: node state can't be reversed , correct order WAITING --> READY --> EXECUTING --> EXECUTED --> COMPLETE - myState = newState; - } - - @Override - public boolean isReady() { - return (inputDataObjectType.getValue() != null && !inputDataObjectType.getValue().equals("")) - || !inputDataObjectType.isIsRequired(); - } - - @Override - public InputDataObjectType getInputObject() { - return this.inputDataObjectType; - } - - @Override - public void setInputObject(InputDataObjectType inputObject) { - this.inputDataObjectType = inputObject; - } - - @Override - public OutPort getOutPort() { - return this.outPort; - } - - @Override - public void setOutPort(OutPort outPort) { - this.outPort = outPort; - } - - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowNode.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowNode.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowNode.java deleted file mode 100644 index f875674..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowNode.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.nodes; - -public interface WorkflowNode { - - public String getId(); - - public String getName(); - - public NodeType getType(); - - public NodeState getState(); - - public void setState(NodeState newState); - - public boolean isReady(); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNode.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNode.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNode.java deleted file mode 100644 index 63a52a3..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNode.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.nodes; - -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.apache.ariavata.simple.workflow.engine.dag.port.InPort; - -public interface WorkflowOutputNode extends WorkflowNode { - - public OutputDataObjectType getOutputObject(); - - public void setOutputObject(OutputDataObjectType outputObject); - - public InPort getInPort(); - - public void setInPort(InPort inPort); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNodeImpl.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNodeImpl.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNodeImpl.java deleted file mode 100644 index a44c05f..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/nodes/WorkflowOutputNodeImpl.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.nodes; - -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.apache.ariavata.simple.workflow.engine.dag.port.InPort; - -public class WorkflowOutputNodeImpl implements WorkflowOutputNode { - - private NodeState myState = NodeState.WAITING; - private final String nodeId; - private String nodeName; - private OutputDataObjectType outputDataObjectType; - private InPort inPort; - - public WorkflowOutputNodeImpl(String nodeId) { - this(nodeId, null); - } - - public WorkflowOutputNodeImpl(String nodeId, String nodeName) { - this.nodeId = nodeId; - this.nodeName = nodeName; - } - - @Override - public String getId() { - return this.nodeId; - } - - @Override - public String getName() { - return this.nodeName; - } - - @Override - public NodeType getType() { - return NodeType.WORKFLOW_OUTPUT; - } - - @Override - public NodeState getState() { - return myState; - } - - @Override - public void setState(NodeState newState) { - // TODO: node state can't be reversed , correct order WAITING --> READY --> EXECUTING --> EXECUTED --> COMPLETE - myState = newState; - } - - @Override - public boolean isReady() { - return !(inPort.getInputObject() == null || inPort.getInputObject().getValue() == null - || inPort.getInputObject().getValue().equals("")); - } - - @Override - public OutputDataObjectType getOutputObject() { - return this.outputDataObjectType; - } - - @Override - public void setOutputObject(OutputDataObjectType outputObject) { - this.outputDataObjectType = outputObject; - } - - @Override - public InPort getInPort() { - return this.inPort; - } - - @Override - public void setInPort(InPort inPort) { - this.inPort = inPort; - } - -} - http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/InPort.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/InPort.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/InPort.java deleted file mode 100644 index bac10ee..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/InPort.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.port; - -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.ariavata.simple.workflow.engine.dag.edge.Edge; - -public interface InPort extends Port { - - public void setInputObject(InputDataObjectType inputObject); - - public InputDataObjectType getInputObject(); - - public Edge getEdge(); - - public void addEdge(Edge edge); - - public String getDefaultValue(); - - public void setDefaultValue(String defaultValue); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/InputPortIml.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/InputPortIml.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/InputPortIml.java deleted file mode 100644 index 82160a9..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/InputPortIml.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.ariavata.simple.workflow.engine.dag.port; - -import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType; -import org.apache.ariavata.simple.workflow.engine.dag.edge.Edge; -import org.apache.ariavata.simple.workflow.engine.dag.nodes.WorkflowNode; - -public class InputPortIml implements InPort { - - private InputDataObjectType inputDataObjectType; - private boolean ready = false; - private String portId; - private Edge edge; - private WorkflowNode node; - private String defaultValue; - - public InputPortIml(String portId) { - this.portId = portId; - } - - @Override - public void setInputObject(InputDataObjectType inputObject) { - this.inputDataObjectType = inputObject; - ready = (inputDataObjectType.getValue() != null && !inputDataObjectType.getValue().equals("")) - || !inputDataObjectType.isIsRequired(); - } - - @Override - public InputDataObjectType getInputObject() { - return this.inputDataObjectType; - } - - @Override - public Edge getEdge() { - return this.edge; - } - - @Override - public void addEdge(Edge edge) { - this.edge = edge; - } - - @Override - public String getDefaultValue() { - return defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.defaultValue = defaultValue; - } - - @Override - public boolean isReady() { - return getInputObject() != null && inputDataObjectType.getValue() != null && !inputDataObjectType.getValue().equals(""); - } - - @Override - public WorkflowNode getNode() { - return this.node; - } - - @Override - public void setNode(WorkflowNode workflowNode) { - this.node = workflowNode; - } - - @Override - public String getId() { - return this.portId; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/6bfb9563/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/OutPort.java ---------------------------------------------------------------------- diff --git a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/OutPort.java b/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/OutPort.java deleted file mode 100644 index 04a7e1e..0000000 --- a/modules/simple-workflow/src/main/java/org/apache/ariavata/simple/workflow/engine/dag/port/OutPort.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * 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.ariavata.simple.workflow.engine.dag.port; - -import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; -import org.apache.ariavata.simple.workflow.engine.dag.edge.Edge; - -import java.util.List; - -public interface OutPort extends Port { - - public void setOutputObject(OutputDataObjectType outputObject); - - public OutputDataObjectType getOutputObject(); - - public List getOutEdges(); - - public void addEdge(Edge edge); - -}