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:38:23 UTC
[39/51] [partial] incubator-taverna-engine git commit:
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/ValueToReferenceConverterSPI.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/ValueToReferenceConverterSPI.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ValueToReferenceConverterSPI.java
new file mode 100644
index 0000000..7a93bbe
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/ValueToReferenceConverterSPI.java
@@ -0,0 +1,64 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference;
+
+/**
+ * SPI for components that can convert an arbitrary object to an
+ * ExternalReferenceSPI representing the value of that object. Used by
+ * implementations of {@link ReferenceService#register(Object, int, boolean)} to
+ * map arbitrary objects to ExternalReferenceSPI instances if encountered during
+ * the registration process. This SPI is only used if the boolean
+ * useConverterSPI parameter is set to true on that method.
+ *
+ * @author Tom Oinn
+ */
+public interface ValueToReferenceConverterSPI {
+ /**
+ * Can this SPI implementation convert the specified object to an
+ * ExternalReferenceSPI? This test should be as lightweight as possible, and
+ * will usually be based on the Class of the object supplied.
+ *
+ * @param context
+ * a ReferenceContext to use if required by the plugin, the
+ * ability to convert should be interpreted in the scope of this
+ * context. In general the context probably not used by most
+ * implementations but it's here if required.
+ *
+ * @return whether this converter is applicable to the specified object
+ */
+ boolean canConvert(Object o, ReferenceContext context);
+
+ /**
+ * Construct and return a new ExternalReferenceSPI implementation which is
+ * in some way equivalent to the supplied object. This is not intended to be
+ * a two-way process necessarily, although the conversion should attempt to
+ * be conservative (so not actually changing the data!).
+ *
+ * @param context
+ * a ReferenceContext to use, if required, during construction of
+ * the new external reference
+ * @return A new instance of ExternalReferenceSPI which references, as far
+ * as possible, the value represented by the specified object
+ * @throws ValueToReferenceConversionException
+ * if any problem occurs during the conversion
+ */
+ ExternalReferenceSPI convert(Object o, ReferenceContext context)
+ throws ValueToReferenceConversionException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/WorkflowRunIdEntity.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/WorkflowRunIdEntity.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/WorkflowRunIdEntity.java
new file mode 100644
index 0000000..126fa0b
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/WorkflowRunIdEntity.java
@@ -0,0 +1,43 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference;
+
+/**
+ * Entity that wraps workflow run id and can be passed through (
+ * {@link ReferenceContext} to be used by {@link T2ReferenceGenerator} to
+ * generate references that are specific for a workflow run.
+ *
+ * @author Alex Nenadic
+ */
+public class WorkflowRunIdEntity {
+ private String workflowRunId;
+
+ public WorkflowRunIdEntity(String workflowRunId) {
+ this.setWorkflowRunId(workflowRunId);
+ }
+
+ public void setWorkflowRunId(String workflowRunId) {
+ this.workflowRunId = workflowRunId;
+ }
+
+ public String getWorkflowRunId() {
+ return workflowRunId;
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/DeleteIdentifiedOperation.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/DeleteIdentifiedOperation.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/DeleteIdentifiedOperation.java
new file mode 100644
index 0000000..5e821ba
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/DeleteIdentifiedOperation.java
@@ -0,0 +1,37 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Applied to methods in Dao implementations which delete data in the backing
+ * store.
+ *
+ * @author Stuart Owen
+ */
+@Retention(RUNTIME)
+@Target(METHOD)
+public @interface DeleteIdentifiedOperation {
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/GetIdentifiedOperation.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/GetIdentifiedOperation.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/GetIdentifiedOperation.java
new file mode 100644
index 0000000..eb34a5e
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/GetIdentifiedOperation.java
@@ -0,0 +1,37 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Applied to methods in Dao implementations which fetch data from the backing
+ * store by ID
+ *
+ * @author Tom Oinn
+ */
+@Retention(RUNTIME)
+@Target(METHOD)
+public @interface GetIdentifiedOperation {
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/PutIdentifiedOperation.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/PutIdentifiedOperation.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/PutIdentifiedOperation.java
new file mode 100644
index 0000000..1cae928
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/PutIdentifiedOperation.java
@@ -0,0 +1,37 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference.annotations;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Applied to methods in Dao implementations which store or update data in the
+ * backing store.
+ *
+ * @author Tom Oinn
+ */
+@Retention(RUNTIME)
+@Target(METHOD)
+public @interface PutIdentifiedOperation {
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/package.html b/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/package.html
new file mode 100644
index 0000000..0d38e1e
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/annotations/package.html
@@ -0,0 +1,4 @@
+<body>
+Annotations to make methods in the data access object implementations
+for cache injection.
+</body>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/HibernateComponentClass.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/HibernateComponentClass.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/HibernateComponentClass.java
new file mode 100644
index 0000000..b0a59f1
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/HibernateComponentClass.java
@@ -0,0 +1,37 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference.h3;
+
+/**
+ * A marker used to denote that the class should be pre-loaded into hibernate's
+ * class mapping. Used for component classes which are not going to be mapped to
+ * the RDBMS but which must be loadable for mapped classes to instantiate
+ * correctly. Basically if you refer to a class that isn't itself going to be
+ * mapped in hibernate within a mapping definition you'll need to add that
+ * component class to this SPI or hibernate won't be able to find it as it won't
+ * know that it should associate it with the appropriate class loader.
+ * <p>
+ * This should be used as an SPI marker, and set as the first SPI registry in
+ * the preloadRegistries property of the SpiRegistryAwareLocalSessionFactoryBean
+ *
+ * @author Tom Oinn
+ */
+public interface HibernateComponentClass {
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/HibernateMappedEntity.java
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/HibernateMappedEntity.java b/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/HibernateMappedEntity.java
new file mode 100644
index 0000000..c607e3d
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/HibernateMappedEntity.java
@@ -0,0 +1,38 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+package org.apache.taverna.reference.h3;
+
+import org.apache.taverna.reference.ExternalReferenceSPI;
+import org.apache.taverna.reference.ReferenceSet;
+
+/**
+ * A marker interface used to denote that the component should be registered
+ * with the Hibernate ORM system prior to any {@link ExternalReferenceSPI}
+ * implementations. This is here to allow implementations of e.g.
+ * {@link ReferenceSet} to be in the implementation package where they belong
+ * and still guarantee that they are registered before any other plugins.
+ * <p>
+ * This should be used as an SPI marker, and set as the first SPI registry in
+ * the spiRegistries property of the SpiRegistryAwareLocalSessionFactoryBean
+ *
+ * @author Tom Oinn
+ */
+public interface HibernateMappedEntity {
+}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/package.html b/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/package.html
new file mode 100644
index 0000000..4ffba14
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/h3/package.html
@@ -0,0 +1,8 @@
+<body>
+Contains the marker interfaces used by the implementation package to
+ensure that all appropriate classes are mapped in hibernate
+<em>before</em>
+implementations of classes that depend upon them, and to ensure that
+'static' classes such as the implementations of reference set etc are
+mapped correctly.
+</body>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/java/org/apache/taverna/reference/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/java/org/apache/taverna/reference/package.html b/taverna-reference-api/src/main/java/org/apache/taverna/reference/package.html
new file mode 100644
index 0000000..503dc3b
--- /dev/null
+++ b/taverna-reference-api/src/main/java/org/apache/taverna/reference/package.html
@@ -0,0 +1,43 @@
+<body>
+<p>Interfaces for the Taverna 2 reference manager. This replaces the
+(badly named) DataManager and is, in effect, a version 2 of that system.
+While these APIs are implementation neutral the intent is heavily
+towards the use of an object relational mapping (ORM) tool such as
+Hibernate backed by a relational database to hold the various
+collection, external reference and error documents managed by the
+reference manager.</p>
+<p>For those familiar with the previous DataManager code the table
+below shows the old class names and the equivalent (where appropriate)
+in the new code:
+</p>
+<table>
+ <tr>
+ <td>DataDocument</td>
+ <td>{@link net.sf.taverna.t2.reference.ReferenceSet}</td>
+ </tr>
+ <tr>
+ <td>ReferenceScheme</td>
+ <td>{@link net.sf.taverna.t2.reference.ExternalReferenceSPI}</td>
+ </tr>
+ <tr>
+ <td>EntityIdentifier</td>
+ <td>{@link net.sf.taverna.t2.reference.T2Reference}</td>
+ </tr>
+ <tr>
+ <td colspan="2">...</td>
+ </tr>
+</table>
+<p>One fundamental change is a move to runtime exceptions rather
+than checked exceptions. This follows the pattern used by Spring and
+Hibernate. The rationale is the same as in those systems - in general
+checked exceptions are not handled properly by client code. The loss of
+compiler level functionality from moving to runtime exceptions is
+countered by much higher readability of code which in itself leads to
+more robust and reliable systems.</p>
+<p>A second change is the availability of asynchronous versions of
+all the critical APIs. Reference construction or translation in
+particular can be a costly process taking substantial time to complete.
+Synchronous versions of the get methods still exist but in general the
+simple callback based asynchronous ones are recommended over them for
+most applications.</p>
+</body>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/resources/net/sf/taverna/t2/reference/AbstractExternalReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/resources/net/sf/taverna/t2/reference/AbstractExternalReference.hbm.xml b/taverna-reference-api/src/main/resources/net/sf/taverna/t2/reference/AbstractExternalReference.hbm.xml
deleted file mode 100644
index e8851e9..0000000
--- a/taverna-reference-api/src/main/resources/net/sf/taverna/t2/reference/AbstractExternalReference.hbm.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-<!-- Hibernate mapping for the abstract superclass of -->
-<!-- ExternalReferenceSPI implementations -->
-<hibernate-mapping>
- <class name="net.sf.taverna.t2.reference.AbstractExternalReference"
- abstract="true">
- <!-- Let hibernate choose the primary key generation strategy -->
- <id name="primaryKey" unsaved-value="0" column="bean_id">
- <generator class="native" />
- </id>
- </class>
-</hibernate-mapping>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-api/src/main/resources/org/apache/taverna/reference/AbstractExternalReference.hbm.xml
----------------------------------------------------------------------
diff --git a/taverna-reference-api/src/main/resources/org/apache/taverna/reference/AbstractExternalReference.hbm.xml b/taverna-reference-api/src/main/resources/org/apache/taverna/reference/AbstractExternalReference.hbm.xml
new file mode 100644
index 0000000..c73b273
--- /dev/null
+++ b/taverna-reference-api/src/main/resources/org/apache/taverna/reference/AbstractExternalReference.hbm.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
+<!-- Hibernate mapping for the abstract superclass of -->
+<!-- ExternalReferenceSPI implementations -->
+<hibernate-mapping>
+ <class abstract="true" name="org.apache.taverna.reference.AbstractExternalReference">
+ <!-- Let hibernate choose the primary key generation strategy -->
+ <id column="bean_id" name="primaryKey" unsaved-value="0">
+ <generator class="native"/>
+ </id>
+ </class>
+</hibernate-mapping>
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBC.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBC.java b/taverna-reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBC.java
deleted file mode 100644
index d041320..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/TemporaryJDBC.java
+++ /dev/null
@@ -1,75 +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.platform.spring.jdbc;
-
-import static java.io.File.createTempFile;
-
-import java.io.File;
-import java.io.IOException;
-
-/**
- * Create JDBC connection strings for temporary use (ie. from tests)
- * <p>
- * {@link #getTemporaryDerbyJDBC()} creates a temporary directory that is used
- * to construct the JDBC connection string for a local Derby database.
- * </p>
- * <p>
- * This is most useful from a spring configuration, for example when using
- * {@link InterpolatingDriverManagerDataSource}:
- * </p>
- *
- * <pre>
- * <!-- Apache Derby rooted at a temporary directory -->
- * <bean id="t2reference.jdbc.temporaryjdbc"
- * class="net.sf.taverna.platform.spring.jdbc.TemporaryJDBC">
- * </bean>
- * <bean id="t2reference.jdbc.url" class="java.lang.String"
- * factory-bean="t2reference.jdbc.temporaryjdbc"
- * factory-method="getTemporaryDerbyJDBC" />
- * <bean id="t2reference.jdbc.datasource"
- * class="net.sf.taverna.platform.spring.jdbc.InterpolatingDriverManagerDataSource">
- * <property name="driverClassName">
- * <value>org.apache.derby.jdbc.EmbeddedDriver</value>
- * </property>
- * <property name="url">
- * <ref bean="t2reference.jdbc.url" />
- * </property>
- * <property name="repository">
- * <ref bean="raven.repository" />
- * </property>
- * <property name="driverArtifact">
- * <value>org.apache.derby:derby:10.4.1.3</value>
- * </property>
- * </bean>
- * </pre>
- *
- * @author Stian Soiland-Reyes
- */
-public class TemporaryJDBC {
- public String getTemporaryDerbyJDBC() throws IOException {
- File tmpDir = createTempFile("t2platform-", ".db");
- tmpDir.delete();
- if (!tmpDir.mkdir())
- throw new IOException("Could not create temporary directory "
- + tmpDir);
- return "jdbc:derby:" + tmpDir.getPath() + "/database;create=true";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/package.html
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/package.html b/taverna-reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/package.html
deleted file mode 100644
index 2355a14..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/platform/spring/jdbc/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<body>
-Extensions to the JDBC parts of Spring, and support for proxying of JDBC
-drivers so we can load them dynamically from raven artifacts. The proxy
-approach is inspired by http://www.jroller.com/tackline/entry/dynamically_loading_jdbc_drivers
-with additions to build from raven rather than from existing jar files.
-</body>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractEntityImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractEntityImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractEntityImpl.java
deleted file mode 100644
index 8559607..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractEntityImpl.java
+++ /dev/null
@@ -1,66 +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.reference.impl;
-
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Abstract superclass of ReferenceSetImpl, IdentifiedArrayList and
- * ErrorDocumentImpl, manages the T2Reference field for these types and their
- * hibernate backing.
- *
- * @author Tom Oinn
- */
-public class AbstractEntityImpl {
- private T2ReferenceImpl id;
- private String compactId = null;
-
- public T2Reference getId() {
- return id;
- }
-
- /**
- * This method is only ever called from within Hibernate, and is used to
- * initialize the unique ID of this reference set.
- */
- public void setTypedId(T2ReferenceImpl newId) {
- id = newId;
- }
-
- /**
- * Used because technically you can't accept and return implementation types
- * in the methods on a bean which implements an interface, but Hibernate
- * needs to construct concrete input and output types!
- */
- public T2ReferenceImpl getTypedId() {
- return id;
- }
-
- public void setInternalId(String newId) {
- compactId = newId;
- }
-
- public final String getInternalId() {
- if (compactId == null)
- compactId = id.getCompactForm();
- return compactId;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractErrorDocumentServiceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractErrorDocumentServiceImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractErrorDocumentServiceImpl.java
deleted file mode 100644
index ccabf5a..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractErrorDocumentServiceImpl.java
+++ /dev/null
@@ -1,119 +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.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentDao;
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.ErrorDocumentServiceCallback;
-import net.sf.taverna.t2.reference.ErrorDocumentServiceException;
-import net.sf.taverna.t2.reference.ListServiceException;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-
-/**
- * Abstract implementation of ErrorDocumentService, inject with an appropriate
- * ErrorDocumentDao and T2ReferenceGenerator to enable. Contains injectors for
- * id generation and dao along with other bookkeeping, leaving the
- * implementation of the actual service logic to the subclass.
- *
- * @author Tom Oinn
- */
-public abstract class AbstractErrorDocumentServiceImpl extends
- AbstractServiceImpl implements ErrorDocumentService {
- protected ErrorDocumentDao errorDao = null;
- protected T2ReferenceGenerator t2ReferenceGenerator = null;
-
- /**
- * Inject the error document data access object.
- */
- public final void setErrorDao(ErrorDocumentDao dao) {
- errorDao = dao;
- }
-
- /**
- * Inject the T2Reference generator used to allocate new IDs when
- * registering ErrorDocuments
- */
- public final void setT2ReferenceGenerator(T2ReferenceGenerator t2rg) {
- t2ReferenceGenerator = t2rg;
- }
-
- /**
- * Check that the list dao is configured
- *
- * @throws ListServiceException
- * if the dao is still null
- */
- protected final void checkDao() throws ErrorDocumentServiceException {
- if (errorDao == null)
- throw new ErrorDocumentServiceException(
- "ErrorDocumentDao not initialized, error document "
- + "service operations are not available");
- }
-
- /**
- * Check that the t2reference generator is configured
- *
- * @throws ListServiceException
- * if the generator is still null
- */
- protected final void checkGenerator() throws ErrorDocumentServiceException {
- if (t2ReferenceGenerator == null)
- throw new ErrorDocumentServiceException(
- "T2ReferenceGenerator not initialized, error document "
- + "service operations not available");
- }
-
- @Override
- public final void getErrorAsynch(final T2Reference id,
- final ErrorDocumentServiceCallback callback)
- throws ErrorDocumentServiceException {
- checkDao();
- Runnable r = new Runnable() {
- @Override
- public void run() {
- try {
- ErrorDocument e = errorDao.get(id);
- callback.errorRetrieved(e);
- } catch (DaoException de) {
- callback.errorRetrievalFailed(new ErrorDocumentServiceException(
- de));
- }
- }
- };
- executeRunnable(r);
- }
-
- @Override
- public final ErrorDocument registerError(String message, int depth,
- ReferenceContext context) throws ErrorDocumentServiceException {
- return registerError(message, (Throwable) null, depth, context);
- }
-
- @Override
- public final ErrorDocument registerError(Throwable t, int depth,
- ReferenceContext context) throws ErrorDocumentServiceException {
- return registerError("", t, depth, context);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractListServiceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractListServiceImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractListServiceImpl.java
deleted file mode 100644
index ad564fb..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractListServiceImpl.java
+++ /dev/null
@@ -1,100 +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.reference.impl;
-
-import net.sf.taverna.t2.reference.ListDao;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.ListServiceCallback;
-import net.sf.taverna.t2.reference.ListServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-
-/**
- * Abstract implementation of ListService, inject with an appropriate ListDao
- * and T2ReferenceGenerator to enable. Contains injectors for id generation and
- * dao along with other bookkeeping, leaving the implementation of the actual
- * service logic to the subclass.
- *
- * @author Tom Oinn
- *
- */
-public abstract class AbstractListServiceImpl extends AbstractServiceImpl
- implements ListService {
- protected ListDao listDao = null;
- protected T2ReferenceGenerator t2ReferenceGenerator = null;
-
- /**
- * Inject the list data access object.
- */
- public final void setListDao(ListDao dao) {
- listDao = dao;
- }
-
- /**
- * Inject the T2Reference generator used to allocate new IDs when
- * registering lists of T2Reference
- */
- public final void setT2ReferenceGenerator(T2ReferenceGenerator t2rg) {
- t2ReferenceGenerator = t2rg;
- }
-
- /**
- * Check that the list dao is configured
- *
- * @throws ListServiceException
- * if the dao is still null
- */
- protected final void checkDao() throws ListServiceException {
- if (listDao == null)
- throw new ListServiceException("ListDao not initialized, list "
- + "service operations are not available");
- }
-
- /**
- * Check that the t2reference generator is configured
- *
- * @throws ListServiceException
- * if the generator is still null
- */
- protected final void checkGenerator() throws ListServiceException {
- if (t2ReferenceGenerator == null)
- throw new ListServiceException(
- "T2ReferenceGenerator not initialized, list "
- + "service operations not available");
- }
-
- @Override
- public final void getListAsynch(final T2Reference id,
- final ListServiceCallback callback) throws ListServiceException {
- checkDao();
- Runnable r = new Runnable() {
- @Override
- public void run() {
- try {
- callback.listRetrieved(getList(id));
- } catch (ListServiceException lse) {
- callback.listRetrievalFailed(lse);
- }
- }
- };
- executeRunnable(r);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceServiceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceServiceImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceServiceImpl.java
deleted file mode 100644
index 3ef8e9b..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceServiceImpl.java
+++ /dev/null
@@ -1,171 +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.reference.impl;
-
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ListService;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceService;
-import net.sf.taverna.t2.reference.ReferenceServiceException;
-import net.sf.taverna.t2.reference.ReferenceServiceResolutionCallback;
-import net.sf.taverna.t2.reference.ReferenceSetService;
-import net.sf.taverna.t2.reference.StreamToValueConverterSPI;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.ValueToReferenceConverterSPI;
-
-/**
- * Implementation of ReferenceService, inject with ReferenceSetService,
- * ErrorDocumentService and ListService to enable. Inject with an instance
- * registry of ValueToReferenceConvertorSPI to enable on the fly registration of
- * otherwise illegal object types. This class contains the basic injection
- * functionality and the getters for the sub-services, mostly to isolate these
- * mundane bits of code from the more interesting actual implementation of the
- * reference service logic.
- *
- * @author Tom Oinn
- */
-public abstract class AbstractReferenceServiceImpl extends AbstractServiceImpl
- implements ReferenceService {
- protected ErrorDocumentService errorDocumentService = null;
- protected ReferenceSetService referenceSetService = null;
- protected ListService listService = null;
- protected List<ValueToReferenceConverterSPI> converters = null;
- @SuppressWarnings("rawtypes")
- protected List<StreamToValueConverterSPI> valueBuilders = null;
-
- /**
- * Inject value to reference convertor SPI
- */
- public final void setConverters(
- List<ValueToReferenceConverterSPI> converters) {
- this.converters = converters;
- }
-
- /**
- * Inject stream to value converter SPI
- */
- @SuppressWarnings("rawtypes")
- public final void setValueBuilders(
- List<StreamToValueConverterSPI> valueBuilders) {
- this.valueBuilders = valueBuilders;
- }
-
- /**
- * Inject error document service
- */
- public final void setErrorDocumentService(ErrorDocumentService eds) {
- this.errorDocumentService = eds;
- }
-
- /**
- * Inject reference set service
- */
- public final void setReferenceSetService(ReferenceSetService rss) {
- this.referenceSetService = rss;
- }
-
- /**
- * Inject list service
- */
- public final void setListService(ListService ls) {
- this.listService = ls;
- }
-
- /**
- * Throw a ReferenceServiceException if methods in ReferenceService are
- * called without the necessary sub-services configured.
- */
- protected final void checkServices() throws ReferenceServiceException {
- if (errorDocumentService == null)
- throw new ReferenceServiceException(
- "Reference service must be configued with an "
- + "instance of ErrorDocumentService to function");
- if (referenceSetService == null)
- throw new ReferenceServiceException(
- "Reference service must be configued with an "
- + "instance of ReferenceSetService to function");
- if (listService == null)
- throw new ReferenceServiceException(
- "Reference service must be configued with an "
- + "instance of ListService to function");
- }
-
- /**
- * Check whether the converter registry has been defined, throw a
- * ReferenceServiceException if not
- */
- protected final void checkConverterRegistry()
- throws ReferenceServiceException {
- if (converters == null)
- throw new ReferenceServiceException(
- "Reference service must be configued with an "
- + "instance registry of ValueToReferenceConvertorSPI "
- + "to enable on the fly mapping of arbitrary objects "
- + "during compound registration");
- }
-
- @Override
- public final ErrorDocumentService getErrorDocumentService() {
- checkServices();
- return this.errorDocumentService;
- }
-
- @Override
- public final ListService getListService() {
- checkServices();
- return this.listService;
- }
-
- @Override
- public final ReferenceSetService getReferenceSetService() {
- checkServices();
- return this.referenceSetService;
- }
-
- /**
- * Wraps the synchronous form, using the executeRunnable method to schedule
- * it.
- */
- @Override
- public void resolveIdentifierAsynch(final T2Reference id,
- final Set<Class<ExternalReferenceSPI>> ensureTypes,
- final ReferenceContext context,
- final ReferenceServiceResolutionCallback callback)
- throws ReferenceServiceException {
- checkServices();
- Runnable r = new Runnable() {
- @Override
- public void run() {
- try {
- callback.identifierResolved(resolveIdentifier(id,
- ensureTypes, context));
- } catch (ReferenceServiceException rse) {
- callback.resolutionFailed(rse);
- }
- }
- };
- executeRunnable(r);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceSetServiceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceSetServiceImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceSetServiceImpl.java
deleted file mode 100644
index 9c930a5..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractReferenceSetServiceImpl.java
+++ /dev/null
@@ -1,160 +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.reference.impl;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ExternalReferenceSPI;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceSet;
-import net.sf.taverna.t2.reference.ReferenceSetAugmentor;
-import net.sf.taverna.t2.reference.ReferenceSetDao;
-import net.sf.taverna.t2.reference.ReferenceSetService;
-import net.sf.taverna.t2.reference.ReferenceSetServiceCallback;
-import net.sf.taverna.t2.reference.ReferenceSetServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-
-/**
- * Abstract implementation of ReferenceSetService, inject with an appropriate
- * ReferenceSetDao to enable. Implements translation functionality as long as an
- * appropriate ReferenceSetAugmentor implementation is injected. Contains
- * injectors for id generation and dao along with other bookkeeping, leaving the
- * implementation of the actual service logic to the subclass.
- *
- * @author Tom Oinn
- */
-public abstract class AbstractReferenceSetServiceImpl extends
- AbstractServiceImpl implements ReferenceSetService {
- protected ReferenceSetDao referenceSetDao = null;
- protected T2ReferenceGenerator t2ReferenceGenerator = null;
- protected ReferenceSetAugmentor referenceSetAugmentor = null;
-
- /**
- * Inject the reference set data access object.
- */
- public final void setReferenceSetDao(ReferenceSetDao dao) {
- this.referenceSetDao = dao;
- }
-
- /**
- * Inject the T2Reference generator used to allocate new IDs when
- * registering sets of ExternalReferenceSPI
- */
- public final void setT2ReferenceGenerator(T2ReferenceGenerator t2rg) {
- this.t2ReferenceGenerator = t2rg;
- }
-
- /**
- * Inject the ReferenceSetAugmentor used to translate or construct new
- * ExternalReferenceSPI instances within a ReferenceSet
- */
- public final void setReferenceSetAugmentor(ReferenceSetAugmentor rse) {
- this.referenceSetAugmentor = rse;
- }
-
- /**
- * Check that the reference set dao is configured
- *
- * @throws ReferenceSetServiceException
- * if the dao is still null
- */
- protected final void checkDao() throws ReferenceSetServiceException {
- if (referenceSetDao == null)
- throw new ReferenceSetServiceException(
- "ReferenceSetDao not initialized, reference set "
- + "service operations are not available");
- }
-
- /**
- * Check that the t2reference generator is configured
- *
- * @throws ReferenceSetServiceException
- * if the generator is still null
- */
- protected final void checkGenerator() throws ReferenceSetServiceException {
- if (t2ReferenceGenerator == null)
- throw new ReferenceSetServiceException(
- "T2ReferenceGenerator not initialized, reference "
- + "set service operations not available");
- }
-
- /**
- * Check that the reference set augmentor is configured
- *
- * @throws ReferenceSetServiceException
- * if the reference set augmentor is still null
- */
- protected final void checkAugmentor() throws ReferenceSetServiceException {
- if (referenceSetAugmentor == null)
- throw new ReferenceSetServiceException(
- "ReferenceSetAugmentor not initialized, reference "
- + "set service operations not available");
- }
-
- @Override
- public final void getReferenceSetAsynch(final T2Reference id,
- final ReferenceSetServiceCallback callback)
- throws ReferenceSetServiceException {
- checkDao();
- Runnable r = new Runnable() {
- @Override
- public void run() {
- try {
- ReferenceSet rs = referenceSetDao.get(id);
- callback.referenceSetRetrieved(rs);
- } catch (DaoException de) {
- callback.referenceSetRetrievalFailed(new ReferenceSetServiceException(
- de));
- }
- }
- };
- executeRunnable(r);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public final void getReferenceSetWithAugmentationAsynch(
- final T2Reference id,
- final Set<Class<ExternalReferenceSPI>> ensureTypes,
- final ReferenceContext context,
- final ReferenceSetServiceCallback callback)
- throws ReferenceSetServiceException {
- checkDao();
- checkAugmentor();
- Runnable r = new Runnable() {
- @Override
- public void run() {
- try {
- callback.referenceSetRetrieved(getReferenceSetWithAugmentation(
- id, ensureTypes, context));
- } catch (ReferenceSetServiceException rsse) {
- callback.referenceSetRetrievalFailed(rsse);
- }
- }
- };
- executeRunnable(r);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractServiceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractServiceImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractServiceImpl.java
deleted file mode 100644
index c24981e..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractServiceImpl.java
+++ /dev/null
@@ -1,44 +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.reference.impl;
-
-/**
- * Abstract superclass for all service implementation objects, will be used to
- * allow injection of thread pooling logic as and when we implement it.
- *
- * @author Tom Oinn
- */
-public class AbstractServiceImpl {
- /**
- * Schedule a runnable for execution - current naive implementation uses a
- * new thread and executes immediately, but this is where any thread pool
- * logic would go if we wanted to add that.
- *
- * @param r
- */
- protected void executeRunnable(Runnable r) {
- makeExecutionThread(r).start();
- }
-
- protected Thread makeExecutionThread(Runnable r) {
- return new Thread(r);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractT2ReferenceGenerator.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractT2ReferenceGenerator.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractT2ReferenceGenerator.java
deleted file mode 100644
index dedcc67..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/AbstractT2ReferenceGenerator.java
+++ /dev/null
@@ -1,111 +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.reference.impl;
-
-import static net.sf.taverna.t2.reference.T2ReferenceType.ErrorDocument;
-import static net.sf.taverna.t2.reference.T2ReferenceType.IdentifiedList;
-import static net.sf.taverna.t2.reference.T2ReferenceType.ReferenceSet;
-
-import java.util.List;
-
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.T2ReferenceGenerator;
-import net.sf.taverna.t2.reference.WorkflowRunIdEntity;
-
-/**
- * An abstract class for implementing simple {@link T2ReferenceGenerator}s.
- *
- * @author Stian Soiland-Reyes
- */
-public abstract class AbstractT2ReferenceGenerator implements
- T2ReferenceGenerator {
- public AbstractT2ReferenceGenerator() {
- super();
- }
-
- private void initReferenceNamespace(T2ReferenceImpl r, ReferenceContext context) {
- if (context == null) {
- // this is not good, just use the default namespace
- r.setNamespacePart(getNamespace());
- return;
- }
-
- List<WorkflowRunIdEntity> workflowRunIdEntities = context
- .getEntities(WorkflowRunIdEntity.class);
- if (workflowRunIdEntities == null || workflowRunIdEntities.isEmpty()) {
- // this is not good, just use the default namespace
- r.setNamespacePart(getNamespace());
- return;
- }
-
- // there should be only one wf run id entity
- String workflowRunId = ((WorkflowRunIdEntity) workflowRunIdEntities
- .get(0)).getWorkflowRunId();
- r.setNamespacePart(workflowRunId);
- }
-
- @Override
- public synchronized T2Reference nextReferenceSetReference(
- ReferenceContext context) {
- T2ReferenceImpl r = new T2ReferenceImpl();
- initReferenceNamespace(r, context);
- r.setLocalPart(getNextLocalPart());
- r.setReferenceType(ReferenceSet);
- r.setDepth(0);
- r.setContainsErrors(false);
- return r;
- }
-
- /**
- * Generate a new local part for a new {@link T2Reference reference}. The
- * local part should be unique within this
- * {@link T2ReferenceGenerator#getNamespace() namespace}.
- *
- * @return A new, unique local part to identify a new reference.
- */
- protected abstract String getNextLocalPart();
-
- @Override
- public T2Reference nextListReference(boolean containsErrors, int listDepth,
- ReferenceContext context) {
- T2ReferenceImpl r = new T2ReferenceImpl();
- initReferenceNamespace(r, context);
- r.setLocalPart(getNextLocalPart());
- r.setReferenceType(IdentifiedList);
- r.setDepth(listDepth);
- r.setContainsErrors(containsErrors);
- return r;
- }
-
- @Override
- public T2Reference nextErrorDocumentReference(int depth,
- ReferenceContext context) {
- T2ReferenceImpl r = new T2ReferenceImpl();
- initReferenceNamespace(r, context);
- r.setLocalPart(getNextLocalPart());
- r.setReferenceType(ErrorDocument);
- r.setDepth(depth);
- // This is an error document, it contains errors by definition
- r.setContainsErrors(true);
- return r;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/CacheAspect.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/CacheAspect.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/CacheAspect.java
deleted file mode 100644
index 59b5e04..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/CacheAspect.java
+++ /dev/null
@@ -1,127 +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.reference.impl;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.Identified;
-import net.sf.taverna.t2.reference.ReferenceServiceCacheProvider;
-import net.sf.taverna.t2.reference.T2Reference;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-
-/**
- * An aspect used to intercept calls to the various data access objects and
- * divert through a write-through cache provider
- *
- * @author Tom Oinn
- */
-public class CacheAspect {
- private ReferenceServiceCacheProvider cacheProvider;
-
- /**
- * Return an injected ReferenceServiceCacheProvider
- */
- private final ReferenceServiceCacheProvider getCacheProvider() {
- return cacheProvider;
- }
-
- /**
- * Inject an instance of ReferenceServiceCacheProvider
- *
- * @param cacheProvider
- * the cache provider to use
- */
- public final void setCacheProvider(
- final ReferenceServiceCacheProvider cacheProvider) {
- this.cacheProvider = cacheProvider;
- }
-
- /**
- * Handle a 'get by T2Reference' operation on a Dao
- *
- * @param pjp
- * the join point representing the ongoing method call to the dao
- * @return the entity identified by the T2Reference supplied to the method
- * to which this advice applies
- * @throws DaoException
- * if anything goes wrong
- */
- public final Identified getObject(final ProceedingJoinPoint pjp)
- throws DaoException {
- Identified result = null;
-
- // Get the T2Reference from the argument to the get method
- T2Reference id = (T2Reference) pjp.getArgs()[0];
- if (id != null) {
- result = getCacheProvider().get(id);
- if (result != null)
- return result;
- }
- // If we miss the cache then call the method as usual
- try {
- result = (Identified) pjp.proceed();
- } catch (DaoException e) {
- throw e;
- } catch (Throwable e) {
- throw new DaoException("Unexpected exception type during aspect "
- + "based invocation", e);
- }
-
- // Write back to the cache
- if (result != null)
- getCacheProvider().put(result);
-
- return result;
- }
-
- /**
- * Called around a write or update operation on the backing store, writes
- * through to the cache after modifying the state of the backing store and
- * before returning from the dao method
- *
- * @param pjp
- * join point representing the ongoing method invocation to cache
- * @throws DaoException
- * if anything goes wrong
- */
- public void putObject(final ProceedingJoinPoint pjp) throws DaoException {
- // Get the Identified being stored by the method we're advising
- Identified storedObject = (Identified) pjp.getArgs()[0];
-
- try {
- // Run the store or update method
- pjp.proceed();
- } catch (DaoException e) {
- throw e;
- } catch (Throwable e) {
- throw new DaoException("Unexpected exception type during aspect "
- + "based invocation", e);
- }
-
- /*
- * Assuming the method isn't null and has an identifier (which it will
- * if we haven't thrown an exception before now) write it back to the
- * cache provider
- */
- if (storedObject != null && storedObject.getId() != null)
- getCacheProvider().put(storedObject);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ContextualizedT2ReferenceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ContextualizedT2ReferenceImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ContextualizedT2ReferenceImpl.java
deleted file mode 100644
index 30d8492..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ContextualizedT2ReferenceImpl.java
+++ /dev/null
@@ -1,61 +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.reference.impl;
-
-import net.sf.taverna.t2.reference.ContextualizedT2Reference;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Simple implementation of ContextualizedT2Reference
- *
- * @author Tom Oinn
- */
-public class ContextualizedT2ReferenceImpl implements ContextualizedT2Reference {
- private T2Reference reference;
- private int[] index;
-
- public ContextualizedT2ReferenceImpl(T2Reference ref, int[] context) {
- this.reference = ref;
- this.index = context;
- }
-
- @Override
- public int[] getIndex() {
- return this.index;
- }
-
- @Override
- public T2Reference getReference() {
- return this.reference;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("[");
- String sep = "";
- for (int idx : index) {
- sb.append(sep).append(idx);
- sep = ",";
- }
- return sb.append("]").append(reference).toString();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/EmptyReferenceContext.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/EmptyReferenceContext.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/EmptyReferenceContext.java
deleted file mode 100644
index 6af0430..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/EmptyReferenceContext.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.reference.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import net.sf.taverna.t2.reference.ReferenceContext;
-
-/**
- * A trivial implementation of ReferenceContext, used if the context parameter
- * to any service method is null.
- *
- * @author Tom Oinn
- */
-public class EmptyReferenceContext implements ReferenceContext {
- /**
- * Return an empty entity set for all queries.
- */
- @Override
- public <T> List<T> getEntities(Class<T> arg0) {
- return new ArrayList<>();
- }
-
- @Override
- public void addEntity(Object entity) {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.java
deleted file mode 100644
index da00d59..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentImpl.java
+++ /dev/null
@@ -1,120 +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.reference.impl;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.StackTraceElementBean;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.h3.HibernateMappedEntity;
-
-/**
- * Simple bean implementation of ErrorDocument
- *
- * @author Tom Oinn
- */
-public class ErrorDocumentImpl extends AbstractEntityImpl implements
- ErrorDocument, HibernateMappedEntity {
- private String exceptionMessage = "";
- private String message = "";
- List<StackTraceElementBean> stackTrace;
- Set<T2Reference> errorReferences = new HashSet<>();
-
- public ErrorDocumentImpl() {
- this.stackTrace = new ArrayList<>();
- }
-
- @Override
- public String getExceptionMessage() {
- return this.exceptionMessage;
- }
-
- public void setExceptionMessage(String exceptionMessage) {
- this.exceptionMessage = exceptionMessage;
- }
-
- @Override
- public String getMessage() {
- return this.message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- /**
- * From interface, not used by hibernate internally
- */
- @Override
- public List<StackTraceElementBean> getStackTraceStrings() {
- return this.stackTrace;
- }
-
- /**
- * Used by Hibernate to bodge around problems with interface types in the
- * API
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public void setStackTraceList(List newList) {
- this.stackTrace = newList;
- }
-
- /**
- * Used by Hibernate to bodge around problems with interface types in the
- * API
- */
- @SuppressWarnings("rawtypes")
- public List getStackTraceList() {
- return this.stackTrace;
- }
-
- @Override
- public Set<T2Reference> getErrorReferences() {
- return errorReferences;
- }
-
- /**
- * Used by Hibernate to bodge around problems with interface types in the
- * API
- */
- @SuppressWarnings({ "unchecked", "rawtypes" })
- public void setErrorReferenceSet(Set errorReferenceSet) {
- this.errorReferences = errorReferenceSet;
- }
-
- /**
- * Used by Hibernate to bodge around problems with interface types in the
- * API
- */
- @SuppressWarnings("rawtypes")
- public Set getErrorReferenceSet() {
- return this.errorReferences;
- }
-
- @Override
- public String toString() {
- return getMessage();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceImpl.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceImpl.java
deleted file mode 100644
index 1e78f92..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/ErrorDocumentServiceImpl.java
+++ /dev/null
@@ -1,163 +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.reference.impl;
-
-import static net.sf.taverna.t2.reference.impl.T2ReferenceImpl.getAsImpl;
-
-import java.util.Set;
-
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentService;
-import net.sf.taverna.t2.reference.ErrorDocumentServiceException;
-import net.sf.taverna.t2.reference.ReferenceContext;
-import net.sf.taverna.t2.reference.ReferenceServiceException;
-import net.sf.taverna.t2.reference.T2Reference;
-
-/**
- * Implementation of ErrorDocumentService, inject with an appropriate
- * ErrorDocumentDao and T2ReferenceGenerator to enable.
- *
- * @author Tom Oinn
- */
-public class ErrorDocumentServiceImpl extends AbstractErrorDocumentServiceImpl
- implements ErrorDocumentService {
- @Override
- public ErrorDocument getError(T2Reference id)
- throws ErrorDocumentServiceException {
- checkDao();
- try {
- return errorDao.get(id);
- } catch (Throwable t) {
- throw new ErrorDocumentServiceException(t);
- }
- }
-
- /**
- * Register the specified error and any child errors (which have the same
- * namespace and local part but a lower depth, down to depth of zero
- */
- @Override
- public ErrorDocument registerError(String message, Throwable t, int depth,
- ReferenceContext context) throws ErrorDocumentServiceException {
- checkDao();
- checkGenerator();
-
- T2Reference ref = t2ReferenceGenerator.nextErrorDocumentReference(
- depth, context);
- T2ReferenceImpl typedId = getAsImpl(ref);
-
- ErrorDocument docToReturn = null;
- for (; depth >= 0; depth--) {
- ErrorDocumentImpl edi = new ErrorDocumentImpl();
- if (docToReturn == null)
- docToReturn = edi;
- edi.setTypedId(typedId);
- if (message != null)
- edi.setMessage(message);
- else
- edi.setMessage("");
- if (t != null) {
- edi.setExceptionMessage(t.toString());
- for (StackTraceElement ste : t.getStackTrace()) {
- StackTraceElementBeanImpl stebi = new StackTraceElementBeanImpl();
- stebi.setClassName(ste.getClassName());
- stebi.setFileName(ste.getFileName());
- stebi.setLineNumber(ste.getLineNumber());
- stebi.setMethodName(ste.getMethodName());
- edi.stackTrace.add(stebi);
- }
- } else
- edi.setExceptionMessage("");
- try {
- errorDao.store(edi);
- } catch (Throwable t2) {
- throw new ErrorDocumentServiceException(t2);
- }
- if (depth > 0)
- typedId = typedId.getDeeperErrorReference();
- }
- return docToReturn;
- }
-
- @Override
- public ErrorDocument registerError(String message, Set<T2Reference> errors,
- int depth, ReferenceContext context)
- throws ErrorDocumentServiceException {
- checkDao();
- checkGenerator();
-
- T2Reference ref = t2ReferenceGenerator.nextErrorDocumentReference(
- depth, context);
- T2ReferenceImpl typedId = T2ReferenceImpl.getAsImpl(ref);
-
- ErrorDocument docToReturn = null;
- for (; depth >= 0; depth--) {
- ErrorDocumentImpl edi = new ErrorDocumentImpl();
- if (docToReturn == null)
- docToReturn = edi;
- edi.setTypedId(typedId);
- if (message != null)
- edi.setMessage(message);
- else
- edi.setMessage("");
- if (errors != null)
- edi.setErrorReferenceSet(errors);
- edi.setExceptionMessage("");
-
- try {
- errorDao.store(edi);
- } catch (Throwable t2) {
- throw new ErrorDocumentServiceException(t2);
- }
- if (depth > 0)
- typedId = typedId.getDeeperErrorReference();
- }
- return docToReturn;
- }
-
- @Override
- public T2Reference getChild(T2Reference errorId)
- throws ErrorDocumentServiceException {
- T2ReferenceImpl refImpl = getAsImpl(errorId);
- try {
- return refImpl.getDeeperErrorReference();
- } catch (Throwable t) {
- throw new ErrorDocumentServiceException(t);
- }
- }
-
- @Override
- public boolean delete(T2Reference reference)
- throws ReferenceServiceException {
- checkDao();
- ErrorDocument doc = errorDao.get(reference);
- if (doc == null)
- return false;
- return errorDao.delete(doc);
- }
-
- @Override
- public void deleteErrorDocumentsForWorkflowRun(String workflowRunId)
- throws ReferenceServiceException {
- checkDao();
- errorDao.deleteErrorDocumentsForWFRun(workflowRunId);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/5f1ddb71/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateErrorDocumentDao.java
----------------------------------------------------------------------
diff --git a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateErrorDocumentDao.java b/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateErrorDocumentDao.java
deleted file mode 100644
index 470a82e..0000000
--- a/taverna-reference-impl/src/main/java/net/sf/taverna/t2/reference/impl/HibernateErrorDocumentDao.java
+++ /dev/null
@@ -1,154 +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.reference.impl;
-
-import static net.sf.taverna.t2.reference.T2ReferenceType.ErrorDocument;
-
-import java.util.List;
-
-import net.sf.taverna.t2.reference.DaoException;
-import net.sf.taverna.t2.reference.ErrorDocument;
-import net.sf.taverna.t2.reference.ErrorDocumentDao;
-import net.sf.taverna.t2.reference.T2Reference;
-import net.sf.taverna.t2.reference.annotations.DeleteIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.GetIdentifiedOperation;
-import net.sf.taverna.t2.reference.annotations.PutIdentifiedOperation;
-
-import org.hibernate.Query;
-import org.hibernate.Session;
-import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
-
-/**
- * An implementation of ErrorDocumentDao based on Spring's HibernateDaoSupport.
- * To use this in spring inject a property 'sessionFactory' with either a
- * {@link org.springframework.orm.hibernate3.LocalSessionFactoryBean
- * LocalSessionFactoryBean} or the equivalent class from the T2Platform module
- * to add SPI based implementation discovery and mapping. To use outside of
- * Spring ensure you call the setSessionFactory(..) method before using this
- * (but really, use it from Spring, so much easier).
- *
- * @author Tom Oinn
- */
-public class HibernateErrorDocumentDao extends HibernateDaoSupport implements
- ErrorDocumentDao {
- private static final String GET_ERRORS_FOR_RUN = "FROM ErrorDocumentImpl WHERE namespacePart = :workflow_run_id";
-
- /**
- * Fetch an ErrorDocument list by id
- *
- * @param ref
- * the T2Reference to fetch
- * @return a retrieved identified list of T2 references
- * @throws DaoException
- * if the supplied reference is of the wrong type or if
- * something goes wrong fetching the data or connecting to the
- * database
- */
- @Override
- @GetIdentifiedOperation
- public ErrorDocument get(T2Reference ref) throws DaoException {
- if (ref == null)
- throw new DaoException(
- "Supplied reference is null, can't retrieve.");
- if (!ref.getReferenceType().equals(ErrorDocument))
- throw new DaoException(
- "This dao can only retrieve reference of type T2Reference.ErrorDocument");
- if (!(ref instanceof T2ReferenceImpl))
- throw new DaoException(
- "Reference must be an instance of T2ReferenceImpl");
-
- try {
- return (ErrorDocumentImpl) getHibernateTemplate().get(
- ErrorDocumentImpl.class,
- ((T2ReferenceImpl) ref).getCompactForm());
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- }
-
- @Override
- @PutIdentifiedOperation
- public void store(ErrorDocument theDocument) throws DaoException {
- if (theDocument.getId() == null)
- throw new DaoException(
- "Supplied error document set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- if (!theDocument.getId().getReferenceType().equals(ErrorDocument))
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.ErrorDocument, something has probably "
- + "gone badly wrong somewhere earlier!");
- if (!(theDocument instanceof ErrorDocumentImpl))
- throw new DaoException(
- "Supplied ErrorDocument not an instance of ErrorDocumentImpl");
-
- try {
- getHibernateTemplate().save(theDocument);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- }
-
- @Override
- @DeleteIdentifiedOperation
- public boolean delete(ErrorDocument theDocument) throws DaoException {
- if (theDocument.getId() == null)
- throw new DaoException(
- "Supplied error document set has a null ID, allocate "
- + "an ID before calling the store method in the dao.");
- if (!theDocument.getId().getReferenceType()
- .equals(ErrorDocument))
- throw new DaoException("Strangely the list ID doesn't have type "
- + "T2ReferenceType.ErrorDocument, something has probably "
- + "gone badly wrong somewhere earlier!");
- if (!(theDocument instanceof ErrorDocumentImpl))
- throw new DaoException(
- "Supplied ErrorDocument not an instance of ErrorDocumentImpl");
-
- try {
- getHibernateTemplate().delete(theDocument);
- return true;
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- }
-
- @Override
- @SuppressWarnings("unchecked")
- @DeleteIdentifiedOperation
- public synchronized void deleteErrorDocumentsForWFRun(String workflowRunId)
- throws DaoException {
- try {
- // Select all ErrorDocuments for this wf run
- Session session = getSession();
- Query selectQuery = session.createQuery(GET_ERRORS_FOR_RUN);
- selectQuery.setString("workflow_run_id", workflowRunId);
- List<ErrorDocument> errorDocuments = selectQuery.list();
- session.close();
- /*
- * need to close before we do delete otherwise hibernate complains
- * that two sessions are accessing collection
- */
- getHibernateTemplate().deleteAll(errorDocuments);
- } catch (Exception ex) {
- throw new DaoException(ex);
- }
- }
-}