You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by re...@apache.org on 2015/03/23 17:37:50 UTC
[06/51] [partial] incubator-taverna-engine git commit:
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/AnnotationAssertionImpl.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/AnnotationAssertionImpl.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/AnnotationAssertionImpl.java
deleted file mode 100644
index cb63cd6..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/AnnotationAssertionImpl.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.impl;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.AnnotationRole;
-import net.sf.taverna.t2.annotation.AnnotationSourceSPI;
-import net.sf.taverna.t2.annotation.CurationEvent;
-import net.sf.taverna.t2.annotation.Person;
-
-public class AnnotationAssertionImpl implements AnnotationAssertion<AnnotationBeanSPI> {
-
- private AnnotationBeanSPI annotationBean;
- private AnnotationRole annotationRole;
- private Date date;
- private List<Person> creators;
- private AnnotationSourceSPI annotationSource;
- private List<CurationEvent<?>> curationEventList;
-
- public AnnotationAssertionImpl(){
- date = new Date();
- curationEventList = new ArrayList<CurationEvent<?>>();
- creators = new ArrayList<Person>();
-
- }
-
- public AnnotationAssertionImpl(AnnotationBeanSPI freeTextDescription, AnnotationRole annotationRole, List<Person> creators, AnnotationSourceSPI annotationSource) {
- this.annotationBean = freeTextDescription;
- this.annotationRole = annotationRole;
- this.creators = creators;
- this.annotationSource = annotationSource;
- }
-
- @Override
- public AnnotationBeanSPI getDetail() {
- return annotationBean;
- }
-
- @Override
- public AnnotationRole getRole() {
- return annotationRole;
- }
-
- @Override
- public Date getCreationDate() {
- return date;
- }
-
- @Override
- public List<? extends Person> getCreators() {
- return creators;
- }
-
- public void addCreator(Person person) {
- creators.add(person);
- }
-
- public void removeCreator(Person person) {
- creators.remove(person);
- }
-
- @Override
- public List<CurationEvent<?>> getCurationAssertions() {
- return curationEventList;
- }
-
- @Override
- public AnnotationSourceSPI getSource() {
- return annotationSource;
- }
-
- public void setAnnotationBean(AnnotationBeanSPI annotationBean) {
- this.annotationBean = annotationBean;
- }
-
- public void setAnnotationRole(AnnotationRole annotationRole) {
- this.annotationRole = annotationRole;
- }
-
- public void removeAnnotationRole() {
- this.annotationRole = null;
- }
-
- public void setDate(Date date) {
- this.date = date;
- }
-
- public void setCreators(List<Person> creators) {
- this.creators = creators;
- }
-
- public void setAnnotationSource(AnnotationSourceSPI annotationSource) {
- this.annotationSource = annotationSource;
- }
-
- public void removeAnnotationSource() {
- this.annotationSource = null;
- }
-
- public void removeAnnotationBean() {
- annotationBean = null;
- }
-
- public void addCurationEvent(CurationEvent<?> curationEvent) {
- curationEventList.add(curationEvent);
- }
-
- public void removeCurationEvent(CurationEvent<?> curationEvent) {
- curationEventList.remove(curationEvent);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/AnnotationChainImpl.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/AnnotationChainImpl.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/AnnotationChainImpl.java
deleted file mode 100644
index 452044d..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/AnnotationChainImpl.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationChain;
-
-public class AnnotationChainImpl implements AnnotationChain{
- private List<AnnotationAssertion<?>> annotationAssertions = new ArrayList<>();
-
- @Override
- public List<AnnotationAssertion<?>> getAssertions() {
- return new ArrayList<>(annotationAssertions);
- }
-
- /**
- * Add an annotation to the chain Added because without the edits stuff how
- * else can we do it?
- *
- * @param annotationAssertion
- */
- public void addAnnotationAssertion(AnnotationAssertion<?> annotationAssertion) {
- annotationAssertions.add(annotationAssertion);
- }
-
- public void removeAnnotationAssertion(AnnotationAssertion<?> annotationAssertion) {
- annotationAssertions.remove(annotationAssertion);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/DisputeEvent.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/DisputeEvent.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/DisputeEvent.java
deleted file mode 100644
index 151768f..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/DisputeEvent.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.impl;
-
-import net.sf.taverna.t2.annotation.Curateable;
-import net.sf.taverna.t2.annotation.CurationEvent;
-import net.sf.taverna.t2.annotation.CurationEventType;
-
-public class DisputeEvent implements CurationEvent<DisputeEventDetails> {
- private DisputeEventDetails disputeEventDetails;
- private CurationEventType curationEventType;
- private Curateable targetEvent;
-
- public DisputeEvent() {
- }
-
- public DisputeEvent(DisputeEventDetails disputeEventDetails,
- CurationEventType curationEventType, Curateable targetEvent) {
- this.disputeEventDetails = disputeEventDetails;
- this.curationEventType = curationEventType;
- this.targetEvent = targetEvent;
- }
-
- @Override
- public DisputeEventDetails getDetail() {
- return disputeEventDetails;
- }
-
- @Override
- public Curateable getTarget() {
- return targetEvent;
- }
-
- @Override
- public CurationEventType getType() {
- return curationEventType;
- }
-
- public void setDisputeEventDetails(DisputeEventDetails disputeEventDetails) {
-// if (disputeEventDetails != null)
-// throw new RuntimeException("Dispute event details have already been set");
- this.disputeEventDetails = disputeEventDetails;
- }
-
- public void setCurationEventType(CurationEventType curationEventType) {
-// if (curationEventType != null)
-// throw new RuntimeException("Curation event details have already been set");
- this.curationEventType = curationEventType;
- }
-
- public void setTargetEvent(Curateable targetEvent) {
-// if (targetEvent!= null)
-// throw new RuntimeException("Target event details have already been set");
- this.targetEvent = targetEvent;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/DisputeEventDetails.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/DisputeEventDetails.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/DisputeEventDetails.java
deleted file mode 100644
index 55aed16..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/DisputeEventDetails.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.impl;
-
-import net.sf.taverna.t2.annotation.CurationEventBeanSPI;
-
-public class DisputeEventDetails implements CurationEventBeanSPI {
- public DisputeEventDetails() {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/PersonImpl.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/PersonImpl.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/PersonImpl.java
deleted file mode 100644
index 8a80e81..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/PersonImpl.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.impl;
-
-import net.sf.taverna.t2.annotation.Person;
-
-public class PersonImpl implements Person {
- @SuppressWarnings("unused")
- private String name;
-
- public PersonImpl(String name) {
- this.name = name;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/URISource.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/URISource.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/URISource.java
deleted file mode 100644
index 7cee476..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/annotation/impl/URISource.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.annotation.impl;
-
-import java.net.URI;
-
-import net.sf.taverna.t2.annotation.AnnotationSourceSPI;
-
-public class URISource implements AnnotationSourceSPI{
- private URI uri;
-
- public URISource() {
- }
-
- public URISource(URI uri) {
- this.uri = uri;
- }
-
- public void setUri(URI uri) {
-// if (uri != null)
-// throw new RuntimeException("URI has already been set");
- this.uri = uri;
- }
-
- public URI getUri() {
- return uri;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/facade/impl/WorkflowInstanceFacadeImpl.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/facade/impl/WorkflowInstanceFacadeImpl.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/facade/impl/WorkflowInstanceFacadeImpl.java
deleted file mode 100644
index a21fae6..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/facade/impl/WorkflowInstanceFacadeImpl.java
+++ /dev/null
@@ -1,631 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.facade.impl;
-
-import static java.lang.System.currentTimeMillis;
-import static java.util.Collections.synchronizedList;
-import static java.util.UUID.randomUUID;
-
-import java.lang.ref.WeakReference;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.List;
-import java.util.UUID;
-import java.util.WeakHashMap;
-import java.util.concurrent.atomic.AtomicLong;
-
-import net.sf.taverna.t2.facade.FacadeListener;
-import net.sf.taverna.t2.facade.ResultListener;
-import net.sf.taverna.t2.facade.WorkflowInstanceFacade;
-import net.sf.taverna.t2.facade.WorkflowRunCancellation;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.TokenOrderException;
-import net.sf.taverna.t2.invocation.WorkflowDataToken;
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.monitor.MonitorManager;
-import net.sf.taverna.t2.monitor.MonitorNode;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.monitor.NoSuchPropertyException;
-import net.sf.taverna.t2.provenance.item.DataflowRunComplete;
-import net.sf.taverna.t2.provenance.item.WorkflowDataProvenanceItem;
-import net.sf.taverna.t2.provenance.item.WorkflowProvenanceItem;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.WorkflowRunIdEntity;
-import net.sf.taverna.t2.utility.TypedTreeModel;
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.DataflowValidationReport;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.Edits;
-import net.sf.taverna.t2.workflowmodel.InvalidDataflowException;
-import net.sf.taverna.t2.workflowmodel.Processor;
-import net.sf.taverna.t2.workflowmodel.ProcessorFinishedEvent;
-import net.sf.taverna.t2.workflowmodel.impl.EditsImpl;
-import net.sf.taverna.t2.workflowmodel.impl.ProcessorImpl;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchStack;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.ErrorBounce;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.IntermediateProvenance;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Parallelize;
-import net.sf.taverna.t2.workflowmodel.processor.dispatch.layers.Stop;
-
-import org.apache.log4j.Logger;
-
-/**
- * Implementation of {@link WorkflowInstanceFacade}
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- * @author Ian Dunlop
- * @author Alex Nenadic
- */
-public class WorkflowInstanceFacadeImpl implements WorkflowInstanceFacade {
- private static Logger logger = Logger
- .getLogger(WorkflowInstanceFacadeImpl.class);
-
- protected static AtomicLong owningProcessId = new AtomicLong(0);
- private InvocationContext context;
- private State state = State.prepared;
- public Date stateLastModified = new Date();
-
- @Override
- public InvocationContext getContext() {
- return context;
- }
-
- private Dataflow dataflow;
- private FacadeResultListener facadeResultListener;
- /** How many processors have finished so far */
- private int processorsToComplete;
- private String instanceOwningProcessId;
- private String localName;
- private MonitorManager monitorManager = MonitorManager.getInstance();
- protected List<FacadeListener> facadeListeners = synchronizedList(new ArrayList<FacadeListener>());
- protected List<ResultListener> resultListeners = synchronizedList(new ArrayList<ResultListener>());
- private boolean provEnabled = false;
- private WeakHashMap<String, T2Reference> pushedDataMap = new WeakHashMap<>();
- /** Id of this run */
- private String workflowRunId;
- private Timestamp workflowStarted;
- private WorkflowProvenanceItem workflowItem = null;
- private int portsToComplete;
-
- private enum WorkflowInstanceFacadeChange {
- CANCELLATION, PORT_DECREMENT, PROCESSOR_DECREMENT
- };
-
- public WorkflowInstanceFacadeImpl(Dataflow dataflow,
- InvocationContext context, String parentProcess)
- throws InvalidDataflowException {
- if (dataflow == null) {
- logger.error("Dataflow is null");
- throw new IllegalArgumentException("Dataflow is null");
- }
- DataflowValidationReport report = dataflow.checkValidity();
- if (!report.isValid())
- throw new InvalidDataflowException(dataflow, report);
-
- this.dataflow = dataflow;
- this.context = context;
- this.portsToComplete = dataflow.getOutputPorts().size();
- this.processorsToComplete = dataflow.getProcessors().size();
- this.localName = "facade" + owningProcessId.getAndIncrement();
- // Set the wf run id
- workflowRunId = UUID.randomUUID().toString();
- if (parentProcess.isEmpty()) {
- // Top-level workflow
-
- /*
- * add top level workflow run so that reference service can generate
- * identifiers linked to our run
- */
- context.addEntity(new WorkflowRunIdEntity(workflowRunId));
- this.instanceOwningProcessId = localName;
-
- /*
- * Add this WorkflowInstanceFacade to the map of all workflow run
- * IDs against the corresponding WorkflowInstanceFacadeS/ - to be
- * used by DependencyActivity's such as API consumer and Beanshell
- */
- workflowRunFacades.put(localName, new WeakReference<WorkflowInstanceFacade>(this));
- /*
- * Note that we do not put the IDs for nested workflows, just for
- * the main ones!
- */
- } else {
- // Nested workflow
- this.instanceOwningProcessId = parentProcess + ":" + localName;
- }
-
- if (context.getProvenanceReporter() != null) {
- provEnabled = true;
- workflowItem = new WorkflowProvenanceItem();
- workflowItem.setDataflow(dataflow);
- workflowItem.setProcessId(instanceOwningProcessId);
- workflowItem.setIdentifier(workflowRunId);
- workflowItem.setParentId(dataflow.getIdentifier());
- workflowItem.setWorkflowId(dataflow.getIdentifier());
-
- /*
- * FIXME: workflowItem is local to each instanceOwningProcessId, but
- * might be added to the Processor within different concurrent runs.
- * (T3-930)
- */
- addProvenanceLayerToProcessors(workflowItem);
- context.getProvenanceReporter().setSessionID(workflowRunId);
- }
- facadeResultListener = new FacadeResultListener(dataflow, workflowItem);
-
- // Register an observer with each of the processors
- for (Processor processor : dataflow.getProcessors()) {
- String expectedProcessId = instanceOwningProcessId + ":"
- + dataflow.getLocalName() + ":" + processor.getLocalName();
- ProcessorFinishedObserver observer = new ProcessorFinishedObserver(
- workflowItem, expectedProcessId);
- ((ProcessorImpl) processor).addObserver(observer);
- }
- }
-
- private void addProvenanceLayerToProcessors(WorkflowProvenanceItem workflowItem) {
- // TODO Shouldn't we use a bean for this?
- Edits edits = new EditsImpl();
- for (Processor processor : dataflow.getProcessors())
- /*
- * Synchronized per processor as we might be modifying its dispatch
- * stack (fixes T3-929)
- */
- synchronized (processor) {
- DispatchStack dispatchStack = processor.getDispatchStack();
- List<DispatchLayer<?>> layers = dispatchStack.getLayers();
- if (isProvenanceAlreadyAdded(layers))
- continue;
- IntermediateProvenance provenance = new IntermediateProvenance();
- provenance.setWorkflow(workflowItem);
- provenance.setReporter(context.getProvenanceReporter());
-
- try {
- edits.getAddDispatchLayerEdit(dispatchStack, provenance,
- provenancePosition(layers)).doEdit();
- break;
- } catch (EditException e) {
- logger.warn("adding provenance layer to dispatch stack failed "
- + e.toString());
- }
- }
- }
-
- private boolean isProvenanceAlreadyAdded(List<DispatchLayer<?>> layers) {
- for (DispatchLayer<?> layer : layers)
- if (layer instanceof IntermediateProvenance)
- return true;
- return false;
- }
-
- private int provenancePosition(List<DispatchLayer<?>> layers) {
- int position=0; // fallback - beginning of list
- for (int i = 0; i < layers.size(); i++) {
- DispatchLayer<?> layer = layers.get(i);
- if (layer instanceof Parallelize)
- // Below Parallelize (should be there!)
- position = i+1;
- else if (layer instanceof ErrorBounce)
- // and inserted just above ErrorBounce (if it's there)
- position = i;
- }
- return position;
- }
-
- @Override
- public void addFacadeListener(FacadeListener listener) {
- facadeListeners.add(listener);
- }
-
- @Override
- public void addResultListener(ResultListener listener) {
- synchronized (resultListeners) {
- if (resultListeners.isEmpty())
- for (DataflowOutputPort port : dataflow.getOutputPorts())
- port.addResultListener(facadeResultListener);
- resultListeners.add(listener);
- }
- }
-
- @Override
- public synchronized void fire() throws IllegalStateException {
- if (getState().equals(State.running))
- throw new IllegalStateException("Workflow is already running!");
- workflowStarted = new Timestamp(currentTimeMillis());
- setState(State.running);
- if (provEnabled) {
- workflowItem.setInvocationStarted(workflowStarted);
- context.getProvenanceReporter().addProvenanceItem(workflowItem);
- }
-
- HashSet<MonitorableProperty<?>> properties = new HashSet<>();
- properties.add(new StateProperty());
- monitorManager.registerNode(this, instanceOwningProcessId.split(":"),
- properties);
- dataflow.fire(instanceOwningProcessId, context);
- }
-
- public final class StateProperty implements MonitorableProperty<State> {
- @Override
- public Date getLastModified() {
- return stateLastModified;
- }
-
- @Override
- public String[] getName() {
- return new String[] { "facade", "state" };
- }
-
- @Override
- public State getValue() throws NoSuchPropertyException {
- return getState();
- }
- }
-
- @Override
- public Dataflow getDataflow() {
- return dataflow;
- }
-
- @Override
- public TypedTreeModel<MonitorNode> getStateModel() {
- // TODO WorkflowInstanceFacade.getStateModel not yet implemented
- return null;
- }
-
- @Override
- public void pushData(WorkflowDataToken token, String portName)
- throws TokenOrderException {
- State currentState = getState();
- if (! currentState.equals(State.running))
- throw new IllegalStateException(
- "Can't push data, current state is not running, but "
- + currentState);
- /*
- * TODO: throw TokenOrderException when token stream is violates order
- * constraints.
- */
- for (DataflowInputPort port : dataflow.getInputPorts()) {
- if (!portName.equals(port.getName()))
- continue;
- if (token.getIndex().length == 0) {
- if (pushedDataMap.containsKey(portName))
- throw new IllegalStateException("Already pushed for port " + portName);
- pushedDataMap.put(portName, token.getData());
- }
- if (provEnabled) {
- WorkflowDataProvenanceItem provItem = new WorkflowDataProvenanceItem();
- provItem.setPortName(portName);
- provItem.setInputPort(true);
- provItem.setData(token.getData());
- provItem.setReferenceService(context.getReferenceService());
- provItem.setParentId(workflowItem.getIdentifier());
- provItem.setWorkflowId(workflowItem.getParentId());
- provItem.setIdentifier(randomUUID().toString());
- provItem.setParentId(instanceOwningProcessId);
- provItem.setProcessId(instanceOwningProcessId);
- provItem.setIndex(token.getIndex());
- provItem.setFinal(token.isFinal());
- context.getProvenanceReporter().addProvenanceItem(provItem);
- }
- port.receiveEvent(token.pushOwningProcess(localName));
- }
- }
-
- @Override
- public void removeFacadeListener(FacadeListener listener) {
- facadeListeners.remove(listener);
- }
-
- private <T> ArrayList<T> copyList(List<T> listenerList) {
- synchronized (listenerList) {
- return new ArrayList<>(listenerList);
- }
- }
-
- @Override
- public void removeResultListener(ResultListener listener) {
- synchronized (resultListeners) {
- resultListeners.remove(listener);
- if (resultListeners.isEmpty())
- for (DataflowOutputPort port : dataflow.getOutputPorts())
- port.removeResultListener(facadeResultListener);
- }
- }
-
- protected class FacadeResultListener implements ResultListener {
- private final WorkflowProvenanceItem workflowItem;
-
- public FacadeResultListener(Dataflow dataflow,
- WorkflowProvenanceItem workflowItem) {
- this.workflowItem = workflowItem;
- }
-
- @Override
- public void resultTokenProduced(WorkflowDataToken token, String portName) {
- if (!instanceOwningProcessId.equals(token.getOwningProcess()))
- return;
- if (getState().equals(State.cancelled))
- // Throw the token away
- return;
-
- if (provEnabled) {
- WorkflowDataProvenanceItem provItem = new WorkflowDataProvenanceItem();
- provItem.setPortName(portName);
- provItem.setInputPort(false);
- provItem.setData(token.getData());
- provItem.setReferenceService(context.getReferenceService());
- provItem.setParentId(workflowItem.getIdentifier());
- provItem.setWorkflowId(workflowItem.getParentId());
- provItem.setIdentifier(randomUUID().toString());
- provItem.setParentId(instanceOwningProcessId);
- provItem.setProcessId(instanceOwningProcessId);
- provItem.setIndex(token.getIndex());
- provItem.setFinal(token.isFinal());
- context.getProvenanceReporter().addProvenanceItem(provItem);
- }
-
- for (ResultListener resultListener : copyList(resultListeners))
- try {
- resultListener.resultTokenProduced(
- token.popOwningProcess(), portName);
- } catch (RuntimeException ex) {
- logger.warn("Could not notify result listener "
- + resultListener, ex);
- }
- if (token.getIndex().length == 0)
- checkWorkflowFinished(WorkflowInstanceFacadeChange.PORT_DECREMENT);
- }
- }
-
-
- /**
- * An observer of events that occur when a processor finishes with execution.
- *
- */
- private class ProcessorFinishedObserver implements Observer<ProcessorFinishedEvent>{
- private final String expectedProcessId;
-
- public ProcessorFinishedObserver(WorkflowProvenanceItem workflowItem, String expectedProcessId) {
- this.expectedProcessId = expectedProcessId;
- }
-
- @Override
- public void notify(Observable<ProcessorFinishedEvent> sender,
- ProcessorFinishedEvent message) throws Exception {
- if (! message.getOwningProcess().equals(expectedProcessId))
- return;
-
- // De-register the processor node from the monitor as it has finished
- monitorManager.deregisterNode(message.getOwningProcess());
-
- // De-register this observer from the processor
- message.getProcessor().removeObserver(this);
-
- // All processors have finished => the workflow run has finished
- checkWorkflowFinished(WorkflowInstanceFacadeChange.PROCESSOR_DECREMENT);
- }
- }
-
- private void applyChange(WorkflowInstanceFacadeChange change) {
- switch (change) {
- case CANCELLATION:
- processorsToComplete = 0;
- portsToComplete = 0;
- break;
- case PORT_DECREMENT:
- portsToComplete--;
- break;
- case PROCESSOR_DECREMENT:
- processorsToComplete--;
- break;
- }
- }
- protected void checkWorkflowFinished(WorkflowInstanceFacadeChange change) {
- synchronized (this) {
- applyChange(change);
- if (getState().equals(State.cancelled) && processorsToComplete < 0) {
- logger.error("Already cancelled workflow run "
- + instanceOwningProcessId);
- return;
- }
- if (getState().equals(State.completed)) {
- logger.error("Already finished workflow run "
- + instanceOwningProcessId, new IllegalStateException());
- return;
- }
- if (processorsToComplete > 0 || portsToComplete > 0)
- // Not yet finished
- return;
- if (processorsToComplete < 0 || portsToComplete < 0) {
- logger.error("Already finished workflow run "
- + instanceOwningProcessId, new IllegalStateException());
- return;
- }
- if (!getState().equals(State.cancelled))
- setState(State.completed);
- processorsToComplete = -1;
- portsToComplete = -1;
- }
- // De-register the workflow node from the monitor
- monitorManager.deregisterNode(instanceOwningProcessId + ":" + dataflow.getLocalName());
-
- /*
- * De-register this facade node from the monitor - this will effectively
- * tell the monitor that the workflow run has finished
- */
- monitorManager.deregisterNode(instanceOwningProcessId);
-
- if (provEnabled) {
- DataflowRunComplete provItem = new DataflowRunComplete();
- provItem.setInvocationEnded(new Timestamp(currentTimeMillis()));
- provItem.setParentId(workflowItem.getIdentifier());
- provItem.setWorkflowId(workflowItem.getParentId());
- provItem.setProcessId(instanceOwningProcessId);
- provItem.setIdentifier(randomUUID().toString());
- provItem.setState(getState());
- context.getProvenanceReporter().addProvenanceItem(provItem);
- }
- }
-
- @Override
- public WeakHashMap<String, T2Reference> getPushedDataMap() {
- return pushedDataMap;
- }
-
- public void setWorkflowRunId(String workflowRunId) {
- this.workflowRunId = workflowRunId;
- }
-
- @Override
- public String getWorkflowRunId() {
- return workflowRunId;
- }
-
- @Override
- public synchronized State getState() {
- return state;
- }
-
- public synchronized void setState(State newState) throws IllegalStateException {
- State oldState = state;
- if (newState.equals(state))
- return;
- switch (newState) {
- case running:
- switch (state) {
- case prepared:
- case paused:
- stateLastModified = new Date();
- state = newState;
- notifyFacadeListeners(oldState, newState);
- return;
- default:
- throw new IllegalStateException("Can't change state from "
- + state + " to " + newState);
- }
- case paused:
- switch (state) {
- case running:
- stateLastModified = new Date();
- state = newState;
- notifyFacadeListeners(oldState, newState);
- return;
- default:
- throw new IllegalStateException("Can't change state from "
- + state + " to " + newState);
- }
- case completed:
- switch (state) {
- case running:
- stateLastModified = new Date();
- state = newState;
- notifyFacadeListeners(oldState, newState);
- return;
- case cancelled:
- // Keep as cancelled
- return;
- default:
- throw new IllegalStateException("Can't change state from "
- + state + " to " + newState);
- }
- case cancelled:
- switch (state) {
- case completed:
- throw new IllegalStateException("Can't change state from "
- + state + " to " + newState);
- default:
- stateLastModified = new Date();
- state = newState;
- notifyFacadeListeners(oldState, newState);
- return;
- }
- default:
- throw new IllegalStateException("Can't change state from " + state + " to " + newState);
- }
- }
-
- private void notifyFacadeListeners(State oldState, State newState) {
- for (FacadeListener facadeListener : copyList(facadeListeners))
- try {
- facadeListener.stateChange(this, oldState, newState);
- } catch (RuntimeException ex) {
- logger.warn("Could not notify facade listener "
- + facadeListener, ex);
- }
- }
-
- @Override
- public synchronized boolean cancelWorkflowRun() {
- if (getState().equals(State.completed))
- return false;
- boolean result = Stop.cancelWorkflow(getWorkflowRunId());
- if (result) {
- setState(State.cancelled);
- logger.info("Cancelled workflow runId=" + getWorkflowRunId()
- + " processId=" + instanceOwningProcessId);
- for (FacadeListener facadeListener : copyList(facadeListeners))
- try {
- facadeListener.workflowFailed(this, "Workflow was cancelled",
- new WorkflowRunCancellation(getWorkflowRunId()));
- } catch (RuntimeException ex) {
- logger.warn("Could not notify failure listener "
- + facadeListener, ex);
- }
- checkWorkflowFinished(WorkflowInstanceFacadeChange.CANCELLATION);
- }
- return result;
- }
-
- @Override
- public boolean pauseWorkflowRun() {
- setState(State.paused);
- if (Stop.pauseWorkflow(getWorkflowRunId())) {
- logger.info("Paused workflow runId=" + getWorkflowRunId()
- + " processId=" + instanceOwningProcessId);
- return true;
- }
- return false;
- }
-
- @Override
- public boolean resumeWorkflowRun() {
- setState(State.running);
- if (Stop.resumeWorkflow(getWorkflowRunId())) {
- logger.info("Resumed paused workflow runId=" + getWorkflowRunId()
- + " processId=" + instanceOwningProcessId);
- return true;
- }
- return false;
- }
-
- @Override
- public String getIdentifier() {
- return localName;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/invocation/impl/InvocationContextImpl.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/invocation/impl/InvocationContextImpl.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/invocation/impl/InvocationContextImpl.java
deleted file mode 100644
index de4abe4..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/invocation/impl/InvocationContextImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.invocation.impl;
-
-import static java.util.Collections.synchronizedList;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.provenance.reporter.ProvenanceReporter;
-import net.sf.taverna.t2.reference.ReferenceService;
-
-public class InvocationContextImpl implements InvocationContext {
- private final ReferenceService referenceService;
- private final ProvenanceReporter provenanceReporter;
- private List<Object> entities = synchronizedList(new ArrayList<Object>());
-
- public InvocationContextImpl(ReferenceService referenceService,
- ProvenanceReporter provenanceReporter) {
- this.referenceService = referenceService;
- this.provenanceReporter = provenanceReporter;
- }
-
- @Override
- public ReferenceService getReferenceService() {
- return referenceService;
- }
-
- @Override
- public ProvenanceReporter getProvenanceReporter() {
- return provenanceReporter;
- }
-
- @Override
- public <T extends Object> List<T> getEntities(Class<T> entityType) {
- List<T> entitiesOfType = new ArrayList<>();
- synchronized (entities) {
- for (Object entity : entities)
- if (entityType.isInstance(entity))
- entitiesOfType.add(entityType.cast(entity));
- }
- return entitiesOfType;
- }
-
- @Override
- public void addEntity(Object entity) {
- entities.add(entity);
- }
-
- public void removeEntity(Object entity) {
- entities.remove(entity);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModel.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModel.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModel.java
deleted file mode 100644
index 2709164..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/monitor/impl/MonitorTreeModel.java
+++ /dev/null
@@ -1,423 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.monitor.impl;
-
-import java.awt.BorderLayout;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Collections;
-import java.util.Date;
-import java.util.Set;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import javax.swing.JFrame;
-import javax.swing.JScrollPane;
-import javax.swing.JTree;
-import javax.swing.SwingUtilities;
-import javax.swing.event.TreeModelEvent;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.DefaultTreeCellRenderer;
-import javax.swing.tree.DefaultTreeModel;
-import javax.swing.tree.MutableTreeNode;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
-import net.sf.taverna.t2.lang.observer.Observable;
-import net.sf.taverna.t2.lang.observer.Observer;
-import net.sf.taverna.t2.monitor.MonitorNode;
-import net.sf.taverna.t2.monitor.MonitorableProperty;
-import net.sf.taverna.t2.monitor.NoSuchPropertyException;
-import net.sf.taverna.t2.monitor.MonitorManager.AddPropertiesMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.DeregisterNodeMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.MonitorMessage;
-import net.sf.taverna.t2.monitor.MonitorManager.RegisterNodeMessage;
-
-import org.apache.log4j.Logger;
-
-/**
- * A relatively naive Monitor interface which holds all
- * state in a tree model. Use getMonitor() to get the monitor singleton, all
- * workflows under a given JVM use the same instance in this implementation with
- * the root node of the monitor tree corresponding to the monitor itself.
- * <p>
- * Internally we use a default tree model with default mutable tree nodes where
- * the user object is set to instances of MonitorNode, with the exception of the
- * 'true' root of the tree in which it is set to the MonitorImpl itself
- *
- * @author Tom Oinn
- * @author Stian Soiland-Reyes
- *
- */
-public class MonitorTreeModel implements Observer<MonitorMessage> {
- private static MonitorTreeModel instance = null;
- private static Logger logger = Logger.getLogger(MonitorTreeModel.class);
-
- /**
- * Get the MonitorImpl singleton
- *
- * @return The MonitorImpl singleton
- */
- public synchronized static MonitorTreeModel getInstance() {
- // TODO Convert to a bean?
- if (instance == null)
- instance = new MonitorTreeModel();
- return instance;
- }
-
- private long nodeRemovalDelay = 1000;
- private DefaultTreeModel monitorTree;
- private Timer nodeRemovalTimer;
-
- /**
- * Protected constructor, use singleton access {@link #getInstance()}
- * instead.
- *
- */
- protected MonitorTreeModel() {
- monitorTree = new DefaultTreeModel(new DefaultMutableTreeNode(this));
- // Create the node removal timer as a daemon thread
- nodeRemovalTimer = new Timer(true);
- }
-
- /**
- * Returns a tree view over the monitor.
- *
- * @return a tree view over the monitor
- */
- public JTree getJTree() {
- return new AlwaysOpenJTree(monitorTree);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public void notify(Observable<MonitorMessage> sender, MonitorMessage message)
- throws Exception {
- if (message instanceof RegisterNodeMessage) {
- RegisterNodeMessage regMessage = (RegisterNodeMessage) message;
- registerNode(regMessage.getWorkflowObject(), regMessage
- .getOwningProcess(), regMessage.getProperties());
- } else if (message instanceof DeregisterNodeMessage) {
- deregisterNode(message.getOwningProcess());
- } else if (message instanceof AddPropertiesMessage) {
- AddPropertiesMessage addMessage = (AddPropertiesMessage) message;
- addPropertiesToNode(addMessage.getOwningProcess(), addMessage
- .getNewProperties());
- } else {
- logger.warn("Unknown message " + message + " from " + sender);
- }
- }
-
- /**
- * Nodes will be removed at least delayTime milliseconds after their initial
- * deregistration request, this allows UI components to show nodes which
- * would otherwise vanish almost instantaneously.
- *
- * @param delayTime
- * time in milliseconds between the deregistration request and
- * attempt to actually remove the node in question
- */
- public void setNodeRemovalDelay(long delayTime) {
- nodeRemovalDelay = delayTime;
- }
-
- /**
- * Very simple UI!
- */
- public void showMonitorFrame() {
- final JTree tree = new AlwaysOpenJTree(monitorTree);
- final JScrollPane jsp = new JScrollPane(tree);
- JFrame frame = new JFrame();
- frame.getContentPane().setLayout(new BorderLayout());
- frame.getContentPane().add(jsp);
- frame.pack();
- frame.setVisible(true);
- new javax.swing.Timer(500, new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent ae) {
- jsp.repaint();
- }
- }).start();
- }
-
- /**
- * Return the node pointed to by the first 'limit' number of elements in the
- * owning process string array. If limit is -1 then use owningProcess.length
- *
- * @param owningProcess
- * @param limit
- * @return
- */
- protected DefaultMutableTreeNode nodeAtProcessPath(String[] owningProcess,
- int limit) throws IndexOutOfBoundsException {
- if (limit == -1)
- limit = owningProcess.length;
- DefaultMutableTreeNode currentNode = (DefaultMutableTreeNode) monitorTree
- .getRoot();
- for (int index = 0; index < limit && index < owningProcess.length; index++) {
- boolean found = false;
- for (int childIndex = 0; childIndex < monitorTree
- .getChildCount(currentNode)
- && !found; childIndex++) {
- DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) monitorTree
- .getChild(currentNode, childIndex);
- MonitorNode childMonitorNode = (MonitorNode) childNode
- .getUserObject();
- if (childMonitorNode.getOwningProcess()[index]
- .equals(owningProcess[index])) {
- currentNode = childNode;
- found = true;
- // break;
- }
- }
- if (!found)
- throw new IndexOutOfBoundsException(
- "Cannot locate node with process ID "
- + printProcess(owningProcess));
- }
- return currentNode;
- }
-
- protected String printProcess(String[] process) {
- StringBuffer sb = new StringBuffer();
- for (String part : process)
- sb.append("{").append(part).append("}");
- return sb.toString();
- }
-
- /**
- * Inject properties into an existing node
- */
- protected void addPropertiesToNode(String[] owningProcess,
- Set<MonitorableProperty<?>> newProperties) {
- try {
- DefaultMutableTreeNode node = nodeAtProcessPath(owningProcess, -1);
- MonitorNode mn = (MonitorNode) node.getUserObject();
- for (MonitorableProperty<?> prop : newProperties)
- mn.addMonitorableProperty(prop);
- } catch (IndexOutOfBoundsException ioobe) {
- // Fail silently here, the node wasn't found in the state tree
- logger.warn("Could not add properties to unknown node "
- + printProcess(owningProcess));
- }
- }
-
- /**
- * Request the removal of the specified node from the monitor tree. In this
- * particular case the removal task will be added to a timer and executed at
- * some (slightly) later time as determined by the removalDelay property.
- */
- protected void deregisterNode(String[] owningProcess) {
- // logger.debug("Remove node @" + printProcess(owningProcess));
- final DefaultMutableTreeNode nodeToRemove = nodeAtProcessPath(
- owningProcess, -1);
- ((MonitorNodeImpl) nodeToRemove.getUserObject()).expire();
- nodeRemovalTimer.schedule(new TimerTask() {
- @Override
- public void run() {
- synchronized (monitorTree) {
- monitorTree.removeNodeFromParent(nodeToRemove);
- }
- }
- }, getNodeRemovalDelay());
- }
-
- /**
- * Create a new node in the monitor
- */
- protected void registerNode(final Object workflowObject,
- final String[] owningProcess,
- final Set<MonitorableProperty<?>> properties) {
- // logger.debug("Registering node " + printProcess(owningProcess));
-
- // Create a new MonitorNode
- final DefaultMutableTreeNode newNode = new DefaultMutableTreeNode(
- new MonitorNodeImpl(workflowObject, owningProcess, properties));
- synchronized (monitorTree) {
- final MutableTreeNode parentNode = nodeAtProcessPath(owningProcess,
- owningProcess.length - 1);
- monitorTree.insertNodeInto(newNode, parentNode, monitorTree
- .getChildCount(parentNode));
- }
- }
-
- class AlwaysOpenJTree extends JTree {
- private static final long serialVersionUID = -3769998854485605447L;
-
- public AlwaysOpenJTree(TreeModel newModel) {
- super(newModel);
- setRowHeight(18);
- setLargeModel(true);
- setEditable(false);
- setExpandsSelectedPaths(false);
- setDragEnabled(false);
- setScrollsOnExpand(false);
- setSelectionModel(EmptySelectionModel.sharedInstance());
- setCellRenderer(new CellRenderer());
- }
-
- @Override
- public void setModel(TreeModel model) {
- if (treeModel == model)
- return;
- if (treeModelListener == null)
- treeModelListener = new TreeModelListener();
- if (model != null) {
- model.addTreeModelListener(treeModelListener);
- }
- TreeModel oldValue = treeModel;
- treeModel = model;
- firePropertyChange(TREE_MODEL_PROPERTY, oldValue, model);
- }
-
- protected class CellRenderer extends DefaultTreeCellRenderer {
- private static final long serialVersionUID = 7106767124654545039L;
-
- @Override
- public Component getTreeCellRendererComponent(JTree tree,
- Object value, boolean sel, boolean expanded,
- boolean leaf, int row, boolean hasFocus) {
- super.getTreeCellRendererComponent(tree, value, sel,
- expanded, leaf, row, hasFocus);
- if (value instanceof DefaultMutableTreeNode) {
- Object o = ((DefaultMutableTreeNode) value)
- .getUserObject();
- if (o instanceof MonitorNode)
- if (((MonitorNode) o).hasExpired())
- setEnabled(false);
- }
- return this;
- }
- }
-
- protected class TreeModelListener extends TreeModelHandler {
- @Override
- public void treeNodesInserted(final TreeModelEvent ev) {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- TreePath path = ev.getTreePath();
- setExpandedState(path, true);
- fireTreeExpanded(path);
- }
- });
- }
- @Override
- public void treeStructureChanged(final TreeModelEvent ev) {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- TreePath path = ev.getTreePath();
- setExpandedState(path, true);
- fireTreeExpanded(path);
- }
- });
- }
- }
- }
-
- class MonitorNodeImpl implements MonitorNode {
- private boolean expired = false;
- private String[] owningProcess;
- private Set<MonitorableProperty<?>> properties;
- private Object workflowObject;
- Date creationDate = new Date();
-
- MonitorNodeImpl(Object workflowObject, String[] owningProcess,
- Set<MonitorableProperty<?>> properties) {
- this.properties = properties;
- this.workflowObject = workflowObject;
- this.owningProcess = owningProcess;
- }
-
- @Override
- public void addMonitorableProperty(MonitorableProperty<?> newProperty) {
- properties.add(newProperty);
- }
-
- public void expire() {
- expired = true;
- }
-
- @Override
- public Date getCreationDate() {
- return creationDate;
- }
-
- @Override
- public String[] getOwningProcess() {
- return owningProcess;
- }
-
- /**
- * Return an unmodifiable copy of the property set
- */
- @Override
- public Set<? extends MonitorableProperty<?>> getProperties() {
- return Collections.unmodifiableSet(properties);
- }
-
- @Override
- public Object getWorkflowObject() {
- return workflowObject;
- }
-
- @Override
- public boolean hasExpired() {
- return this.expired;
- }
-
- @Override
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append(getWorkflowObject().getClass().getSimpleName());
- sb.append(", ");
- sb.append(owningProcess[owningProcess.length - 1]);
- sb.append(" : ");
- for (MonitorableProperty<?> prop : getProperties()) {
- String separator = "";
- for (String nameElement : prop.getName()) {
- sb.append(separator).append(nameElement);
- separator = ".";
- }
- sb.append("=");
- try {
- sb.append(prop.getValue().toString());
- } catch (NoSuchPropertyException nspe) {
- sb.append("EXPIRED");
- }
- sb.append(" ");
- }
- return sb.toString();
- }
- }
-
- public long getNodeRemovalDelay() {
- return nodeRemovalDelay;
- }
-
- protected DefaultTreeModel getMonitorTree() {
- return monitorTree;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractActivityEdit.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractActivityEdit.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractActivityEdit.java
deleted file mode 100644
index 2725d2f..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractActivityEdit.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.processor.activity.AbstractActivity;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
-
-/**
- * Abstraction of an edit acting on a Activity instance. Handles the check to
- * see that the Activity supplied is really a AbstractActivity.
- *
- * @author David Withers
- * @author Stian Soiland-Reyes
- */
-public abstract class AbstractActivityEdit<T> extends EditSupport<Activity<T>> {
- private final AbstractActivity<T> activity;
-
- protected AbstractActivityEdit(Activity<T> activity) {
- if (activity == null)
- throw new RuntimeException(
- "Cannot construct an activity edit with null activity");
- if (!(activity instanceof AbstractActivity))
- throw new RuntimeException(
- "Edit cannot be applied to an Activity which isn't an instance of AbstractActivity");
- this.activity = (AbstractActivity<T>) activity;
- }
-
- @Override
- public final Activity<T> applyEdit() throws EditException {
- synchronized (activity) {
- doEditAction(activity);
- }
- return activity;
- }
-
- /**
- * Do the actual edit here
- *
- * @param processor
- * The ProcessorImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(AbstractActivity<T> processor)
- throws EditException;
-
- @Override
- public final Activity<T> getSubject() {
- return activity;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractAnnotationEdit.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractAnnotationEdit.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractAnnotationEdit.java
deleted file mode 100644
index ff89988..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractAnnotationEdit.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2014 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.annotation.AnnotationAssertion;
-import net.sf.taverna.t2.annotation.AnnotationBeanSPI;
-import net.sf.taverna.t2.annotation.impl.AnnotationAssertionImpl;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Abstraction of an edit acting on a AnnotationAssertion instance. Handles the
- * check to see that the AnnotationAssertion supplied is really an
- * AnnotationAssertionImpl.
- */
-abstract class AbstractAnnotationEdit extends
- EditSupport<AnnotationAssertion<AnnotationBeanSPI>> {
- private final AnnotationAssertionImpl annotation;
-
- protected AbstractAnnotationEdit(AnnotationAssertion<AnnotationBeanSPI> annotation) {
- if (annotation == null)
- throw new RuntimeException(
- "Cannot construct an annotation edit with null annotation");
- if (!(annotation instanceof AnnotationAssertionImpl))
- throw new RuntimeException(
- "Edit cannot be applied to an AnnotationAssertion which isn't an instance of AnnotationAssertionImpl");
- this.annotation = (AnnotationAssertionImpl) annotation;
- }
-
- @Override
- public final AnnotationAssertion<AnnotationBeanSPI> applyEdit()
- throws EditException {
- synchronized (annotation) {
- doEditAction(annotation);
- }
- return annotation;
- }
-
- /**
- * Do the actual edit here
- *
- * @param annotationAssertion
- * The AnnotationAssertionImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(
- AnnotationAssertionImpl annotationAssertion) throws EditException;
-
- @Override
- public final AnnotationAssertion<AnnotationBeanSPI> getSubject() {
- return annotation;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractBinaryProcessorEdit.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractBinaryProcessorEdit.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractBinaryProcessorEdit.java
deleted file mode 100644
index ba1c505..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractBinaryProcessorEdit.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2014 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import static java.lang.System.identityHashCode;
-import net.sf.taverna.t2.workflowmodel.EditException;
-import net.sf.taverna.t2.workflowmodel.OrderedPair;
-import net.sf.taverna.t2.workflowmodel.Processor;
-
-/**
- * Generalization over all operations acting on an ordered pair of ProcessorImpl
- * objects. These include most operations where a relationship is created,
- * modified or destroyed between two processors.
- *
- * @author Tom Oinn
- * @author Donal Fellows
- */
-abstract class AbstractBinaryProcessorEdit extends
- EditSupport<OrderedPair<Processor>> {
- private final OrderedPair<Processor> processors;
-
- public AbstractBinaryProcessorEdit(Processor a, Processor b) {
- if (!(a instanceof ProcessorImpl) || !(b instanceof ProcessorImpl))
- throw new RuntimeException(
- "Edit cannot be applied to a Processor which isn't an instance of ProcessorImpl");
- processors = new OrderedPair<>(a, b);
- }
-
- @Override
- public final OrderedPair<Processor> applyEdit() throws EditException {
- ProcessorImpl pia = (ProcessorImpl) processors.getA();
- ProcessorImpl pib = (ProcessorImpl) processors.getB();
-
- /*
- * Acquire both locks. Guarantee to acquire in a consistent order, based
- * on the system hash code (i.e., the object addresses, which we're not
- * supposed to know). This means that we should not deadlock, as we've
- * got a total order over all extant processors.
- *
- * If someone is silly enough to use the same processor for both halves,
- * it doesn't matter which arm of the conditional we take.
- */
- if (identityHashCode(pia) < identityHashCode(pib)) {
- synchronized (pia) {
- synchronized (pib) {
- doEditAction(pia, pib);
- }
- }
- } else {
- synchronized (pib) {
- synchronized (pia) {
- doEditAction(pia, pib);
- }
- }
- }
- return processors;
- }
-
- @Override
- public final OrderedPair<Processor> getSubject() {
- return processors;
- }
-
- /**
- * Do the actual edit here
- *
- * @param processorA
- * The ProcessorImpl which is in some sense the source of the
- * relation between the two being asserted or operated on by this
- * edit
- * @param processorB
- * The ProcessorImpl at the other end of the relation. *
- * @throws EditException
- */
- protected abstract void doEditAction(ProcessorImpl processorA,
- ProcessorImpl processorB) throws EditException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractCrystalizer.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractCrystalizer.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractCrystalizer.java
deleted file mode 100644
index 7d519af..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractCrystalizer.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.sf.taverna.t2.invocation.Completion;
-import net.sf.taverna.t2.invocation.InvocationContext;
-import net.sf.taverna.t2.invocation.IterationInternalEvent;
-import net.sf.taverna.t2.invocation.TreeCache;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.workflowmodel.processor.activity.Job;
-
-/**
- * Receives Job and Completion events and emits Jobs unaltered. Completion
- * events additionally cause registration of lists for each key in the datamap
- * of the jobs at immediate child locations in the index structure. These list
- * identifiers are sent in place of the Completion events.
- * <p>
- * State for a given process ID is purged when a final completion event is
- * received so there is no need for an explicit cache purge operation in the
- * public API (although for termination of partially complete workflows it may
- * be sensible for subclasses to provide one)
- * <p>
- *
- * @author Tom Oinn
- * @author David Withers
- */
-public abstract class AbstractCrystalizer implements Crystalizer {
- private Map<String, CompletionAwareTreeCache> cacheMap = new HashMap<>();
-
- public abstract Job getEmptyJob(String owningProcess, int[] index,
- InvocationContext context);
-
- /**
- * Receive a Job or Completion, Jobs are emitted unaltered and cached,
- * Completion events trigger registration of a corresponding list - this may
- * be recursive in nature if the completion event's index implies nested
- * lists which have not been registered.
- * <p>
- * If the baseListDepth property is defined then completion events on nodes
- * which don't already exist create empty jobs instead and emit those, if
- * undefined the completion event is emited intact.
- *
- * @param e The event (a {@link Job} or a {@link Completion})
- */
- @Override
- public void receiveEvent(IterationInternalEvent<?> e) {
- String owningProcess = e.getOwningProcess();
- CompletionAwareTreeCache cache = null;
- synchronized (cacheMap) {
- if (!cacheMap.containsKey(owningProcess)) {
- cache = new CompletionAwareTreeCache(owningProcess, e
- .getContext());
- cacheMap.put(owningProcess, cache);
- } else
- cache = cacheMap.get(owningProcess);
- }
- if (e instanceof Job) {
- // Pass through Job after storing it in the cache
- Job j = (Job) e;
- synchronized (cache) {
- cache.insertJob(new Job("", j.getIndex(), j.getData(), j
- .getContext()));
- jobCreated(j);
- if (j.getIndex().length == 0)
- cacheMap.remove(j.getOwningProcess());
- }
- } else if (e instanceof Completion) {
- Completion c = (Completion) e;
- synchronized (cache) {
- cache.resolveAt(owningProcess, c.getIndex());
- if (c.getIndex().length == 0)
- cacheMap.remove(c.getOwningProcess());
- }
- }
- }
-
- protected class CompletionAwareTreeCache extends TreeCache {
- private String owningProcess;
- private InvocationContext context;
-
- public CompletionAwareTreeCache(String owningProcess,
- InvocationContext context) {
- super();
- this.context = context;
- this.owningProcess = owningProcess;
- }
-
- public void resolveAt(String owningProcess, int[] completionIndex) {
- NamedNode n = nodeAt(completionIndex);
- if (n != null) {
- assignNamesTo(n, completionIndex);
- return;
- }
-
- /*
- * We know what the list depth should be, so we can construct
- * appropriate depth empty lists to fill in the gaps.
- */
-
- Job j = getEmptyJob(owningProcess, completionIndex, context);
- insertJob(j);
- jobCreated(j);
- }
-
- private void assignNamesTo(NamedNode n, int[] index) {
- /* Only act if contents of this node undefined */
- if (n.contents != null)
- return;
-
- Map<String, List<T2Reference>> listItems = new HashMap<>();
- int pos = 0;
- for (NamedNode child : n.children) {
- /*
- * If child doesn't have a defined name map yet then define it.
- */
- Job j;
- if (child == null) {
- /*
- * happens if we're completing a partially empty collection
- * structure
- */
- int[] newIndex = new int[index.length + 1];
- for (int i = 0; i < index.length; i++)
- newIndex[i] = index[i];
- newIndex[index.length] = pos++;
- j = getEmptyJob(owningProcess, newIndex, context);
- jobCreated(j);
- } else if (child.contents == null) {
- int[] newIndex = new int[index.length + 1];
- for (int i = 0; i < index.length; i++)
- newIndex[i] = index[i];
- newIndex[index.length] = pos++;
- assignNamesTo(child, newIndex);
- j = child.contents;
- } else {
- pos++;
- j = child.contents;
- }
-
- /*
- * Now pull the names out of the child job map and push them
- * into lists to be registered
- */
-
- for (String outputName : j.getData().keySet()) {
- List<T2Reference> items = listItems.get(outputName);
- if (items == null) {
- items = new ArrayList<>();
- listItems.put(outputName, items);
- }
- items.add(j.getData().get(outputName));
- }
- }
- Map<String, T2Reference> newDataMap = new HashMap<>();
- for (String outputName : listItems.keySet())
- newDataMap.put(
- outputName,
- context.getReferenceService()
- .getListService()
- .registerList(listItems.get(outputName),
- context).getId());
- Job newJob = new Job(owningProcess, index, newDataMap, context);
- n.contents = newJob;
-
- /* Get rid of the children as we've now named this node */
-
- n.children.clear();
- jobCreated(n.contents);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowEdit.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowEdit.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowEdit.java
deleted file mode 100644
index 9f8bc33..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowEdit.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007-2008 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Dataflow;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Abstraction of an edit acting on a Dataflow instance. Handles the check to
- * see that the Dataflow supplied is really a DataflowImpl.
- *
- * @author David Withers
- *
- */
-public abstract class AbstractDataflowEdit extends EditSupport<Dataflow> {
- private final DataflowImpl dataflow;
-
- protected AbstractDataflowEdit(Dataflow dataflow) {
- if (dataflow == null)
- throw new RuntimeException(
- "Cannot construct a dataflow edit with null dataflow");
- if (!(dataflow instanceof DataflowImpl))
- throw new RuntimeException(
- "Edit cannot be applied to a Dataflow which isn't an instance of DataflowImpl");
- this.dataflow = (DataflowImpl) dataflow;
- }
-
- @Override
- public final Dataflow applyEdit() throws EditException {
- synchronized (dataflow) {
- doEditAction(dataflow);
- }
- return dataflow;
- }
-
- /**
- * Do the actual edit here
- *
- * @param dataflow
- * The DataflowImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(DataflowImpl dataflow)
- throws EditException;
-
- @Override
- public final Dataflow getSubject() {
- return dataflow;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowInputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowInputPortEdit.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowInputPortEdit.java
deleted file mode 100644
index 8f90758..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowInputPortEdit.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.DataflowInputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Abstraction of an edit acting on a DataflowInputPort instance. Handles the check to
- * see that the DataflowInputPort supplied is really a DataflowInputPortImpl.
- *
- * @author David Withers
- *
- */
-public abstract class AbstractDataflowInputPortEdit extends EditSupport<DataflowInputPort> {
- private final DataflowInputPortImpl dataflowInputPort;
-
- protected AbstractDataflowInputPortEdit(DataflowInputPort dataflowInputPort) {
- if (dataflowInputPort == null)
- throw new RuntimeException(
- "Cannot construct a DataflowInputPort edit with null DataflowInputPort");
- if (!(dataflowInputPort instanceof DataflowInputPortImpl))
- throw new RuntimeException(
- "Edit cannot be applied to a DataflowInputPort which isn't an instance of DataflowInputPortImpl");
- this.dataflowInputPort = (DataflowInputPortImpl) dataflowInputPort;
- }
-
- @Override
- public final DataflowInputPort applyEdit() throws EditException {
- synchronized (dataflowInputPort) {
- doEditAction(dataflowInputPort);
- }
- return dataflowInputPort;
- }
-
- /**
- * Do the actual edit here
- *
- * @param dataflowInputPort
- * The DataflowInputPortImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(DataflowInputPortImpl dataflowInputPort)
- throws EditException;
-
- @Override
- public final DataflowInputPort getSubject() {
- return dataflowInputPort;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowOutputPortEdit.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowOutputPortEdit.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowOutputPortEdit.java
deleted file mode 100644
index 401faa5..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDataflowOutputPortEdit.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.DataflowOutputPort;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Abstraction of an edit acting on a DataflowOutputPort instance. Handles the
- * check to see that the DataflowOutputPort supplied is really a
- * DataflowOutputPortImpl.
- *
- * @author David Withers
- */
-public abstract class AbstractDataflowOutputPortEdit extends
- EditSupport<DataflowOutputPort> {
- private final DataflowOutputPortImpl dataflowOutputPort;
-
- protected AbstractDataflowOutputPortEdit(
- DataflowOutputPort dataflowOutputPort) {
- if (dataflowOutputPort == null)
- throw new RuntimeException(
- "Cannot construct a DataflowOutputPort edit with null DataflowOutputPort");
- if (!(dataflowOutputPort instanceof DataflowOutputPortImpl))
- throw new RuntimeException(
- "Edit cannot be applied to a DataflowOutputPort which isn't an instance of DataflowOutputPortImpl");
- this.dataflowOutputPort = (DataflowOutputPortImpl) dataflowOutputPort;
- }
-
- @Override
- public final DataflowOutputPort applyEdit() throws EditException {
- synchronized (dataflowOutputPort) {
- doEditAction(dataflowOutputPort);
- }
- return dataflowOutputPort;
- }
-
- /**
- * Do the actual edit here
- *
- * @param dataflowOutputPort
- * The DataflowOutputPortImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(
- DataflowOutputPortImpl dataflowOutputPort) throws EditException;
-
- @Override
- public final DataflowOutputPort getSubject() {
- return dataflowOutputPort;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEdit.java
----------------------------------------------------------------------
diff --git a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEdit.java b/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEdit.java
deleted file mode 100644
index 31b7480..0000000
--- a/taverna-workflowmodel-impl/src/main/java/net/sf/taverna/t2/workflowmodel/impl/AbstractDatalinkEdit.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (C) 2007 The University of Manchester
- *
- * Modifications to the initial code base are copyright of their
- * respective authors, or their employers as appropriate.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- ******************************************************************************/
-package net.sf.taverna.t2.workflowmodel.impl;
-
-import net.sf.taverna.t2.workflowmodel.Datalink;
-import net.sf.taverna.t2.workflowmodel.EditException;
-
-/**
- * Abstraction of an edit acting on a Datalink instance. Handles the check to
- * see that the Datalink supplied is really a DatalinkImpl.
- *
- * @author David Withers
- */
-public abstract class AbstractDatalinkEdit extends EditSupport<Datalink> {
- private final DatalinkImpl datalink;
-
- protected AbstractDatalinkEdit(Datalink datalink) {
- if (datalink == null)
- throw new RuntimeException(
- "Cannot construct a datalink edit with null datalink");
- if (!(datalink instanceof DatalinkImpl))
- throw new RuntimeException(
- "Edit cannot be applied to a Datalink which isn't an instance of DatalinkImpl");
- this.datalink = (DatalinkImpl) datalink;
- }
-
- @Override
- public final Datalink applyEdit() throws EditException {
- synchronized (datalink) {
- doEditAction(datalink);
- }
- return datalink;
- }
-
- /**
- * Do the actual edit here
- *
- * @param datalink
- * The DatalinkImpl to which the edit applies
- * @throws EditException
- */
- protected abstract void doEditAction(DatalinkImpl datalink)
- throws EditException;
-
- @Override
- public final Datalink getSubject() {
- return datalink;
- }
-}