Repository: incubator-taverna-server
Updated Branches:
  refs/heads/master d6871def3 -> 51ca0bfed


Remove broken code.

The execution delegate code simply did not work. It depended on a model
of execution that simply isn't present; it didn't build and couldn't
build.

Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/commit/51ca0bfe
Tree: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/tree/51ca0bfe
Diff: 
http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/diff/51ca0bfe

Branch: refs/heads/master
Commit: 51ca0bfeda26fceb2d9ed921273d5036c45dc0b1
Parents: d6871de
Author: Donal Fellows <[email protected]>
Authored: Thu Sep 8 14:36:08 2016 +0100
Committer: Donal Fellows <[email protected]>
Committed: Thu Sep 8 14:36:08 2016 +0100

----------------------------------------------------------------------
 taverna-server-execution-delegate/pom.xml       |  41 ----
 .../execution_delegate/ExecutionDelegate.java   | 188 -----------------
 .../execution_delegate/RemoteExecution.java     | 204 -------------------
 .../src/test/java/SerializationTest.java        |  54 -----
 4 files changed, 487 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/51ca0bfe/taverna-server-execution-delegate/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-server-execution-delegate/pom.xml 
b/taverna-server-execution-delegate/pom.xml
deleted file mode 100644
index da825af..0000000
--- a/taverna-server-execution-delegate/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
-       <modelVersion>4.0.0</modelVersion>
-       <parent>
-               <groupId>org.apache.taverna.server</groupId>
-               <artifactId>apache-taverna-server</artifactId>
-               <version>3.1.0-incubating-SNAPSHOT</version>
-       </parent>
-       <artifactId>taverna-server-execution-delegate</artifactId>
-       <packaging>bundle</packaging>
-       <name>Apache Taverna Server Reporting Probe</name>
-       <dependencies>
-               <dependency>
-                       <groupId>org.apache.taverna.engine</groupId>
-                       <artifactId>taverna-execution-api</artifactId>
-                       <version>${taverna.engine.version}</version>
-                       <type>bundle</type>
-               </dependency>
-               <dependency>
-                       <groupId>junit</groupId>
-                       <artifactId>junit</artifactId>
-                       <scope>test</scope>
-               </dependency>
-       </dependencies>
-</project>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/51ca0bfe/taverna-server-execution-delegate/src/main/java/org/taverna/server/execution_delegate/ExecutionDelegate.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-execution-delegate/src/main/java/org/taverna/server/execution_delegate/ExecutionDelegate.java
 
b/taverna-server-execution-delegate/src/main/java/org/taverna/server/execution_delegate/ExecutionDelegate.java
deleted file mode 100644
index 439841d..0000000
--- 
a/taverna-server-execution-delegate/src/main/java/org/taverna/server/execution_delegate/ExecutionDelegate.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.taverna.server.execution_delegate;
-/*
- * 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.
- */
-
-import java.net.URI;
-import java.rmi.RemoteException;
-import java.rmi.server.UnicastRemoteObject;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Map;
-
-import javax.xml.datatype.DatatypeConfigurationException;
-import javax.xml.datatype.DatatypeFactory;
-import javax.xml.datatype.XMLGregorianCalendar;
-
-import 
org.taverna.server.execution_delegate.RemoteExecution.ProcessorReportDocument.Property;
-
-import uk.org.taverna.platform.data.api.Data;
-import uk.org.taverna.platform.data.api.DataLocation;
-import uk.org.taverna.platform.execution.api.Execution;
-import uk.org.taverna.platform.report.ActivityReport;
-import uk.org.taverna.platform.report.ProcessorReport;
-import uk.org.taverna.platform.report.StatusReport;
-import uk.org.taverna.platform.report.WorkflowReport;
-import org.apache.taverna.scufl2.api.common.AbstractNamed;
-
-public class ExecutionDelegate extends UnicastRemoteObject implements
-               RemoteExecution {
-       private Execution delegated;
-       private DatatypeFactory dtf;
-
-       public ExecutionDelegate(Execution execution) throws RemoteException,
-                       DatatypeConfigurationException {
-               super();
-               delegated = execution;
-               dtf = DatatypeFactory.newInstance();
-       }
-
-       @Override
-       public String getID() {
-               return delegated.getID();
-       }
-
-       @Override
-       public void delete() {
-               delegated.delete();
-       }
-
-       @Override
-       public void start() {
-               delegated.start();
-       }
-
-       @Override
-       public void pause() {
-               delegated.pause();
-       }
-
-       @Override
-       public void resume() {
-               delegated.resume();
-       }
-
-       @Override
-       public void cancel() {
-               delegated.cancel();
-       }
-
-       private XMLGregorianCalendar date(Date d) {
-               if (d == null)
-                       return null;
-               GregorianCalendar c = new GregorianCalendar();
-               c.setTime(d);
-               return dtf.newXMLGregorianCalendar(c);
-       }
-
-       private <R extends ReportDocument, T extends AbstractNamed> R init(
-                       R snapshot, StatusReport<T, ?, ?> report) {
-               snapshot.created = date(report.getCreatedDate());
-               snapshot.completed = date(report.getCompletedDate());
-               snapshot.cancelled = date(report.getCancelledDate());
-               snapshot.failed = date(report.getFailedDate());
-               snapshot.started = date(report.getStartedDate());
-               for (Date d : report.getPausedDates())
-                       snapshot.paused.add(date(d));
-               for (Date d : report.getResumedDates())
-                       snapshot.resumed.add(date(d));
-               snapshot.subject = report.getSubject().getName();
-               snapshot.state = report.getState().toString();
-               return snapshot;
-       }
-
-       private WorkflowReportDocument getReport(WorkflowReport report) {
-               WorkflowReportDocument snapshot = init(new 
WorkflowReportDocument(),
-                               report);
-               for (ProcessorReport pr : report.getChildReports())
-                       snapshot.processor.add(getReport(pr));
-               initMap(snapshot.inputs, report.getInputs());
-               initMap(snapshot.outputs, report.getOutputs());
-               return snapshot;
-       }
-
-       private void initMap(ArrayList<PortMapping> snapshot, Map<String, ?> 
report) {
-               for (String port : report.keySet())
-                       snapshot.add(data(port, report.get(port)));
-       }
-
-       private static final String DEFAULT_PROPERTY_STRING = "";
-
-       private PortMapping data(String name, Object o) {
-               String loc;
-               if (o instanceof DataLocation) {
-                       DataLocation d = (DataLocation) o;
-                       loc = d.getDataServiceURI() + "#" + d.getDataID();
-               } else {
-                       Data d = (Data) o;
-                       loc = null;
-                       if (d.hasReferences()) {
-                               try {
-                                       loc = 
d.getReferences().iterator().next().getURI()
-                                                       .toString();
-                               } catch (Exception e) {
-                               }
-                       }
-                       if (loc == null) {
-                               DataLocation dl = 
d.getDataService().getDataLocation(d);
-                               loc = dl.getDataServiceURI() + "#" + 
dl.getDataID();
-                       }
-               }
-               return new PortMapping(name, URI.create(loc));
-       }
-
-       private ProcessorReportDocument getReport(ProcessorReport report) {
-               ProcessorReportDocument snapshot = init(new 
ProcessorReportDocument(),
-                               report);
-               for (ActivityReport pr : report.getChildReports())
-                       snapshot.activity.add(getReport(pr));
-               snapshot.jobsQueued = report.getJobsStarted();
-               snapshot.jobsStarted = report.getJobsStarted();
-               snapshot.jobsCompleted = report.getJobsCompleted();
-               snapshot.jobsErrored = report.getJobsCompletedWithErrors();
-               for (String key : report.getPropertyKeys()) {
-                       Object value = report.getProperty(key);
-                       if (value instanceof String || value instanceof Number)
-                               snapshot.properties.add(new Property(key, 
value.toString()));
-                       else
-                               snapshot.properties.add(new Property(key,
-                                               DEFAULT_PROPERTY_STRING));
-               }
-               return snapshot;
-       }
-
-       private ActivityReportDocument getReport(ActivityReport report) {
-               ActivityReportDocument snapshot = init(new 
ActivityReportDocument(),
-                               report);
-               for (WorkflowReport pr : report.getChildReports())
-                       snapshot.workflow.add(getReport(pr));
-               initMap(snapshot.inputs, report.getInputs());
-               initMap(snapshot.outputs, report.getOutputs());
-               return snapshot;
-       }
-
-       @Override
-       public WorkflowReportDocument getWorkflowReport() {
-               return getReport(delegated.getWorkflowReport());
-       }
-}
-
-// ExecutionDelegate.java:[96,2]
-// 
initMap(java.util.ArrayList<org.taverna.server.execution_delegate.RemoteExecution.PortMapping>,java.util.Map<java.lang.String,uk.org.taverna.platform.data.api.Data>)
-// in org.taverna.server.execution_delegate.ExecutionDelegate cannot be applied
-// to
-// 
(java.util.ArrayList<org.taverna.server.execution_delegate.RemoteExecution.PortMapping>,java.util.Map<java.lang.String,uk.org.taverna.platform.data.api.DataLocation>)

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/51ca0bfe/taverna-server-execution-delegate/src/main/java/org/taverna/server/execution_delegate/RemoteExecution.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-execution-delegate/src/main/java/org/taverna/server/execution_delegate/RemoteExecution.java
 
b/taverna-server-execution-delegate/src/main/java/org/taverna/server/execution_delegate/RemoteExecution.java
deleted file mode 100644
index ad18908..0000000
--- 
a/taverna-server-execution-delegate/src/main/java/org/taverna/server/execution_delegate/RemoteExecution.java
+++ /dev/null
@@ -1,204 +0,0 @@
-package org.taverna.server.execution_delegate;
-/*
- * 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.
- */
-
-import static javax.xml.bind.annotation.XmlAccessType.NONE;
-
-import java.net.URI;
-import java.rmi.Remote;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElementWrapper;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSchemaType;
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-import javax.xml.datatype.XMLGregorianCalendar;
-
-/**
- * Interface for a single execution of a Taverna workflow in a remote process.
- * 
- * @author David Withers
- */
-public interface RemoteExecution extends Remote {
-
-       /**
-        * Returns the identifier for this execution.
-        * 
-        * @return the identifier for this execution
-        */
-       String getID() throws RemoteException;
-
-       /**
-        * Returns the <code>WorkflowReport</code> for the execution.
-        * 
-        * @return the <code>WorkflowReport</code> for the execution
-        */
-       WorkflowReportDocument getWorkflowReport() throws RemoteException;
-
-       /**
-        * Deletes the execution.
-        */
-       void delete() throws RemoteException;
-
-       /**
-        * Starts the execution.
-        */
-       void start() throws RemoteException;
-
-       /**
-        * Pauses the execution.
-        */
-       void pause() throws RemoteException;
-
-       /**
-        * Resumes a paused execution.
-        */
-       void resume() throws RemoteException;
-
-       /**
-        * Cancels the execution.
-        */
-       void cancel() throws RemoteException;
-
-       @XmlType(name = "Report", propOrder = { "state", "created", "started",
-                       "completed", "failed", "cancelled", "paused", "resumed" 
})
-       @XmlSeeAlso({ WorkflowReportDocument.class, 
ProcessorReportDocument.class,
-                       ActivityReportDocument.class })
-       @XmlAccessorType(NONE)
-       public static abstract class ReportDocument {
-               @XmlAttribute
-               public String subject;
-               @XmlElement
-               public String state;
-               @XmlElement(required = true)
-               @XmlSchemaType(name = "dateTime")
-               public XMLGregorianCalendar created;
-               @XmlElement
-               @XmlSchemaType(name = "dateTime")
-               public XMLGregorianCalendar started;
-               @XmlElement
-               @XmlSchemaType(name = "dateTime")
-               public XMLGregorianCalendar completed;
-               @XmlElement
-               @XmlSchemaType(name = "dateTime")
-               public XMLGregorianCalendar failed;
-               @XmlElement
-               @XmlSchemaType(name = "dateTime")
-               public XMLGregorianCalendar cancelled;
-               @XmlElement
-               @XmlSchemaType(name = "dateTime")
-               public List<XMLGregorianCalendar> paused;
-               @XmlElement
-               @XmlSchemaType(name = "dateTime")
-               public List<XMLGregorianCalendar> resumed;
-       }
-
-       @XmlType(name = "WorkflowReport", propOrder = { "processor", "inputs",
-                       "outputs" })
-       @XmlRootElement(name = "workflowReport")
-       @XmlAccessorType(NONE)
-       public static class WorkflowReportDocument extends ReportDocument {
-               @XmlElement(name = "processor")
-               public ArrayList<ProcessorReportDocument> processor = new 
ArrayList<ProcessorReportDocument>();
-               @XmlElement(name = "input")
-               public ArrayList<PortMapping> inputs = new 
ArrayList<PortMapping>();
-               @XmlElement(name = "output")
-               public ArrayList<PortMapping> outputs = new 
ArrayList<PortMapping>();
-       }
-
-       @XmlType(name = "ProcessorReport", propOrder = { "jobsQueued",
-                       "jobsStarted", "jobsCompleted", "jobsErrored", 
"properties",
-                       "activity" })
-       @XmlAccessorType(NONE)
-       public static class ProcessorReportDocument extends ReportDocument {
-               @XmlElement(name = "jobsQueued", required = true)
-               public int jobsQueued;
-               @XmlElement(name = "jobsStarted", required = true)
-               public int jobsStarted;
-               @XmlElement(name = "jobsCompleted", required = true)
-               public int jobsCompleted;
-               @XmlElement(name = "jobsErrored", required = true)
-               public int jobsErrored;
-               @XmlElement(name = "property")
-               @XmlElementWrapper(name = "properties")
-               public ArrayList<Property> properties = new 
ArrayList<Property>();
-               @XmlElement(name = "activity")
-               public ArrayList<ActivityReportDocument> activity = new 
ArrayList<ActivityReportDocument>();
-
-               @XmlType(name = "ProcessorProperty")
-               @XmlAccessorType(NONE)
-               public static class Property {
-                       @XmlAttribute(name = "key", required = true)
-                       String key;
-                       @XmlValue
-                       String value;
-
-                       public Property() {
-                       }
-
-                       public String getKey() {
-                               return key;
-                       }
-
-                       public String getValue() {
-                               return value;
-                       }
-
-                       Property(String key, String value) {
-                               this.key = key;
-                               this.value = value;
-                       }
-               }
-       }
-
-       @XmlType(name = "ActivityReport", propOrder = { "workflow", "inputs",
-                       "outputs" })
-       @XmlAccessorType(NONE)
-       public static class ActivityReportDocument extends ReportDocument {
-               @XmlElement(name = "workflow")
-               public ArrayList<WorkflowReportDocument> workflow = new 
ArrayList<WorkflowReportDocument>();
-               @XmlElement(name = "input")
-               public ArrayList<PortMapping> inputs = new 
ArrayList<PortMapping>();
-               @XmlElement(name = "output")
-               public ArrayList<PortMapping> outputs = new 
ArrayList<PortMapping>();
-       }
-
-       @XmlType(name = "PortMapping")
-       @XmlAccessorType(NONE)
-       public static class PortMapping {
-               public PortMapping() {
-               }
-
-               PortMapping(String port, URI data) {
-                       this.name = port;
-                       this.reference = data;
-               }
-
-               @XmlAttribute(name = "name")
-               public String name;
-               @XmlAttribute(name = "ref")
-               @XmlSchemaType(name = "anyURI")
-               public URI reference;
-       }
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/51ca0bfe/taverna-server-execution-delegate/src/test/java/SerializationTest.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-execution-delegate/src/test/java/SerializationTest.java 
b/taverna-server-execution-delegate/src/test/java/SerializationTest.java
deleted file mode 100644
index c4bf0b9..0000000
--- a/taverna-server-execution-delegate/src/test/java/SerializationTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.SchemaOutputResolver;
-import javax.xml.transform.Result;
-import javax.xml.transform.stream.StreamResult;
-
-import org.junit.Before;
-import org.junit.Test;
-import 
org.taverna.server.execution_delegate.RemoteExecution.WorkflowReportDocument;
-
-public class SerializationTest {
-       private static final boolean PRINT = true;
-       SchemaOutputResolver sink;
-       StringWriter schema;
-
-       String schema() {
-               return schema.toString();
-       }
-
-       @Before
-       public void init() {
-               schema = new StringWriter();
-               sink = new SchemaOutputResolver() {
-                       @Override
-                       public Result createOutput(String namespaceUri,
-                                       String suggestedFileName) throws 
IOException {
-                               StreamResult sr = new StreamResult(schema);
-                               sr.setSystemId("/dev/null");
-                               return sr;
-                       }
-               };
-               assertEquals("", schema());
-       }
-
-       @Test
-       public void testSchemaGeneration() throws JAXBException, IOException {
-               
JAXBContext.newInstance(WorkflowReportDocument.class).generateSchema(
-                               sink);
-               assertFalse("generated schema must be non-empty", 
schema().isEmpty());
-               assertTrue(
-                               "generated schema must define workflowReport 
element",
-                               schema().contains(
-                                               "<xs:element 
name=\"workflowReport\" type=\"WorkflowReport\"/>\n"));
-               if (PRINT)
-                       System.out.print(schema());
-       }
-}

Reply via email to