You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@taverna.apache.org by st...@apache.org on 2015/02/23 11:10:24 UTC

[49/54] [partial] incubator-taverna-engine git commit: Revert "temporarily empty repository"

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-activity-test-utils/src/main/resources/inMemoryActivityTestsContext.xml
----------------------------------------------------------------------
diff --git a/taverna-activity-test-utils/src/main/resources/inMemoryActivityTestsContext.xml b/taverna-activity-test-utils/src/main/resources/inMemoryActivityTestsContext.xml
new file mode 100644
index 0000000..5268c9d
--- /dev/null
+++ b/taverna-activity-test-utils/src/main/resources/inMemoryActivityTestsContext.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- Context providing a full ReferenceService -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:raven="http://taverna.sf.net/schema/artifact-support"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans 
+	http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
+	http://taverna.sf.net/schema/artifact-support 
+	http://taverna.sf.net/schema/artifact-support/artifact-support.xsd">
+
+	<import resource="context-parts/raven_local.xml" />
+	<!--
+	<import resource="context-parts/hibernateprops_derby.xml" />
+	<import resource="context-parts/dao_hibernate.xml" />
+	-->
+	<import resource="context-parts/dao_inmemory.xml" />
+	<import resource="context-parts/componentservices.xml" />
+	<import resource="context-parts/referenceservice.xml" />
+
+	<!-- Load core extensions, needed for String to reference support -->
+	<bean
+		raven:artifact="net.sf.taverna.t2.core:reference-core-extensions:2.0.1-SNAPSHOT"
+		raven:repository="raven.repository"
+		class="net.sf.taverna.t2.reference.impl.core.LoadCoreExtensions">
+	</bean>
+
+
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-api/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-capability-api/pom.xml b/taverna-capability-api/pom.xml
new file mode 100644
index 0000000..c0bfae5
--- /dev/null
+++ b/taverna-capability-api/pom.xml
@@ -0,0 +1,28 @@
+<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/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.taverna.engine</groupId>
+		<artifactId>taverna-engine</artifactId>
+		<version>3.1.0-incubating-SNAPSHOT</version>
+	</parent>
+	<artifactId>taverna-capability-api</artifactId>
+	<packaging>bundle</packaging>
+	<name>Apache Taverna Platform Capability API</name>
+	<dependencies>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>taverna-workflowmodel-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.taverna.language</groupId>
+			<artifactId>taverna-scufl2-api</artifactId>
+			<version>${taverna.language.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+			<version>${jackson.version}</version>
+		</dependency>
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityConfigurationException.java
----------------------------------------------------------------------
diff --git a/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityConfigurationException.java b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityConfigurationException.java
new file mode 100644
index 0000000..c9833e9
--- /dev/null
+++ b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityConfigurationException.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (C) 2010 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 uk.org.taverna.platform.capability.api;
+
+/**
+ * Thrown when an activity's configuration is incorrect.
+ * 
+ * @author David Withers
+ */
+public class ActivityConfigurationException extends ConfigurationException {
+	private static final long serialVersionUID = 3132495676192826758L;
+
+	public ActivityConfigurationException() {
+		super();
+	}
+
+	public ActivityConfigurationException(String message) {
+		super(message);
+	}
+
+	public ActivityConfigurationException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public ActivityConfigurationException(Throwable cause) {
+		super(cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityNotFoundException.java
----------------------------------------------------------------------
diff --git a/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityNotFoundException.java b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityNotFoundException.java
new file mode 100644
index 0000000..82a6e71
--- /dev/null
+++ b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityNotFoundException.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (C) 2010 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 uk.org.taverna.platform.capability.api;
+
+/**
+ * Thrown when an activity is not found.
+ * 
+ * @author David Withers
+ */
+public class ActivityNotFoundException extends Exception {
+	private static final long serialVersionUID = 1232220199558615801L;
+
+	public ActivityNotFoundException() {
+		super();
+	}
+
+	public ActivityNotFoundException(String message) {
+		super(message);
+	}
+
+	public ActivityNotFoundException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public ActivityNotFoundException(Throwable cause) {
+		super(cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityService.java
----------------------------------------------------------------------
diff --git a/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityService.java b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityService.java
new file mode 100644
index 0000000..8fd1619
--- /dev/null
+++ b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ActivityService.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (C) 2010 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 uk.org.taverna.platform.capability.api;
+
+import java.net.URI;
+import java.util.Set;
+
+import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
+import uk.org.taverna.scufl2.api.port.InputActivityPort;
+import uk.org.taverna.scufl2.api.port.OutputActivityPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Service for discovering available activities and the properties required to
+ * configure the activities.
+ * 
+ * @author David Withers
+ */
+public interface ActivityService {
+	/**
+	 * Returns the available activity types.
+	 * 
+	 * @return the available activity types
+	 */
+	Set<URI> getActivityTypes();
+
+	/**
+	 * Returns true if and only if the activity type exists.
+	 * 
+	 * @param uri
+	 *            the activity type to check
+	 * @return whether the activity type exists
+	 */
+	boolean activityExists(URI activityType);
+
+	/**
+	 * Returns the JSON Schema for the configuration required by an activity.
+	 * 
+	 * @param activityType
+	 *            the activity type
+	 * @return the JSON Schema for the configuration required by an activity
+	 * @throws ActivityNotFoundException
+	 *             if an activity cannot be found for the specified URI
+	 * @throws ActivityConfigurationException
+	 *             if the JSON Schema cannot be created
+	 */
+	JsonNode getActivityConfigurationSchema(URI activityType)
+			throws ActivityNotFoundException, ActivityConfigurationException;
+
+	/**
+	 * Returns the input ports that the activity type requires to be present in
+	 * order to execute with the specified configuration.
+	 * <p>
+	 * If the activity does not require any input port for the configuration
+	 * then an empty set is returned.
+	 * 
+	 * @param configuration
+	 *            the activity configuration
+	 * @throws ActivityNotFoundException
+	 *             if the activity cannot be found
+	 * @throws ActivityConfigurationException
+	 *             if the activity configuration is incorrect
+	 * @return the input ports that the activity requires to be present in order
+	 *         to execute
+	 */
+	Set<InputActivityPort> getActivityInputPorts(URI activityType,
+			JsonNode configuration) throws ActivityNotFoundException,
+			ActivityConfigurationException;
+
+	/**
+	 * Returns the output ports that the activity type requires to be present in
+	 * order to execute with the specified configuration.
+	 * <p>
+	 * If the activity type does not require any output ports for the
+	 * configuration then an empty set is returned.
+	 * 
+	 * @param configuration
+	 *            the activity configuration
+	 * @throws ActivityNotFoundException
+	 *             if the activity cannot be found
+	 * @throws ActivityConfigurationException
+	 *             if the activity configuration is incorrect
+	 * @return the output ports that the activity requires to be present in
+	 *         order to execute
+	 */
+	Set<OutputActivityPort> getActivityOutputPorts(URI activityType,
+			JsonNode configuration) throws ActivityNotFoundException,
+			ActivityConfigurationException;
+
+	/**
+	 * Returns the activity for the specified activity type. If configuration is
+	 * not null the returned activity will be configured.
+	 * 
+	 * @param activityType
+	 *            the activity type
+	 * @param configuration
+	 *            the configuration for the activity, can be <code>null</code>
+	 * @return the activity for the specified activityType
+	 * @throws ActivityNotFoundException
+	 *             if an activity cannot be found for the specified activity
+	 *             type
+	 * @throws ActivityConfigurationException
+	 *             if the configuration is not valid
+	 */
+	Activity<?> createActivity(URI activityType, JsonNode configuration)
+			throws ActivityNotFoundException, ActivityConfigurationException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ConfigurationException.java
----------------------------------------------------------------------
diff --git a/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ConfigurationException.java b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ConfigurationException.java
new file mode 100644
index 0000000..be0e8a5
--- /dev/null
+++ b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/ConfigurationException.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (C) 2010 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 uk.org.taverna.platform.capability.api;
+
+/**
+ * Thrown when a {@link uk.org.taverna.scufl2.api.common.Configurable
+ * Configurable} cannot be configured by a
+ * {@link uk.org.taverna.scufl2.api.configurations.Configuration Configuration}.
+ * 
+ * @author David Withers
+ */
+public class ConfigurationException extends Exception {
+	private static final long serialVersionUID = -6129960388197785712L;
+
+	public ConfigurationException() {
+		super();
+	}
+
+	public ConfigurationException(String message) {
+		super(message);
+	}
+
+	public ConfigurationException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public ConfigurationException(Throwable cause) {
+		super(cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerConfigurationException.java
----------------------------------------------------------------------
diff --git a/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerConfigurationException.java b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerConfigurationException.java
new file mode 100644
index 0000000..824df29
--- /dev/null
+++ b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerConfigurationException.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (C) 2011 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 uk.org.taverna.platform.capability.api;
+
+/**
+ * Thrown when a dispatch layer's configuration is incorrect.
+ * 
+ * @author David Withers
+ */
+public class DispatchLayerConfigurationException extends ConfigurationException {
+	private static final long serialVersionUID = -6180865500734235308L;
+
+	public DispatchLayerConfigurationException() {
+		super();
+	}
+
+	public DispatchLayerConfigurationException(String message) {
+		super(message);
+	}
+
+	public DispatchLayerConfigurationException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public DispatchLayerConfigurationException(Throwable cause) {
+		super(cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerNotFoundException.java
----------------------------------------------------------------------
diff --git a/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerNotFoundException.java b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerNotFoundException.java
new file mode 100644
index 0000000..7492b61
--- /dev/null
+++ b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerNotFoundException.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (C) 2011 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 uk.org.taverna.platform.capability.api;
+
+/**
+ * Thrown when a dispatch layer is not found.
+ * 
+ * @author David Withers
+ */
+public class DispatchLayerNotFoundException extends Exception {
+	private static final long serialVersionUID = -7227237239711803139L;
+
+	public DispatchLayerNotFoundException() {
+		super();
+	}
+
+	public DispatchLayerNotFoundException(String message) {
+		super(message);
+	}
+
+	public DispatchLayerNotFoundException(String message, Throwable cause) {
+		super(message, cause);
+	}
+
+	public DispatchLayerNotFoundException(Throwable cause) {
+		super(cause);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerService.java
----------------------------------------------------------------------
diff --git a/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerService.java b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerService.java
new file mode 100644
index 0000000..978b1b5
--- /dev/null
+++ b/taverna-capability-api/src/main/java/uk/org/taverna/platform/capability/api/DispatchLayerService.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (C) 2011 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 uk.org.taverna.platform.capability.api;
+
+import java.net.URI;
+import java.util.Set;
+
+import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * Service for discovering available dispatch layers and the properties required
+ * to configure the layers.
+ * 
+ * @author David Withers
+ */
+public interface DispatchLayerService {
+	/**
+	 * Returns the available dispatch layer types.
+	 * 
+	 * @return a the available dispatch layer types
+	 */
+	Set<URI> getDispatchLayerTypes();
+
+	/**
+	 * Returns true iff a dispatch layer exists for the specified URI.
+	 * 
+	 * @param dispatchLayerType
+	 *            the dispatch layer type to check
+	 * @return true if a dispatch layer exists for the specified URI
+	 */
+	boolean dispatchLayerExists(URI dispatchLayerType);
+
+	/**
+	 * Returns the JSON Schema for the configuration required by a dispatch
+	 * layer.
+	 * 
+	 * @param activityType
+	 *            the activity type
+	 * @return the JSON Schema for the configuration required by a dispatch
+	 *         layer
+	 * @throws DispatchLayerNotFoundException
+	 *             if a dispatch layer cannot be found for the specified URI
+	 * @throws DispatchLayerConfigurationException
+	 *             if the JSON Schema cannot be created
+	 */
+	JsonNode getDispatchLayerConfigurationSchema(URI dispatchLayerType)
+			throws DispatchLayerNotFoundException,
+			DispatchLayerConfigurationException;
+
+	/**
+	 * Returns the dispatch layer for the specified URI.
+	 * 
+	 * If configuration is not null the returned dispatch layer will be
+	 * configured.
+	 * 
+	 * @param uri
+	 *            a URI that identifies a dispatch layer
+	 * @param configuration
+	 *            the configuration for the dispatch layer, can be
+	 *            <code>null</code>
+	 * @return the dispatch layer for the specified URI
+	 * @throws DispatchLayerNotFoundException
+	 *             if a dispatch layer cannot be found for the specified URI
+	 * @throws DispatchLayerConfigurationException
+	 *             if the configuration is not valid
+	 */
+	DispatchLayer<?> createDispatchLayer(URI uri, JsonNode configuration)
+			throws DispatchLayerNotFoundException,
+			DispatchLayerConfigurationException;
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-impl/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-capability-impl/pom.xml b/taverna-capability-impl/pom.xml
new file mode 100644
index 0000000..14c6212
--- /dev/null
+++ b/taverna-capability-impl/pom.xml
@@ -0,0 +1,59 @@
+<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/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.apache.taverna.engine</groupId>
+		<artifactId>taverna-engine</artifactId>
+		<version>3.1.0-incubating-SNAPSHOT</version>
+	</parent>
+	<artifactId>taverna-capability-impl</artifactId>
+	<packaging>bundle</packaging>
+	<name>Apache Taverna Platform Capability Implementation</name>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.felix</groupId>
+				<artifactId>maven-bundle-plugin</artifactId>
+				<configuration>
+					<instructions>
+						<Import-Package>uk.org.taverna.platform.capability.api;provide:=true,*</Import-Package>
+					</instructions>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+	<dependencies>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>taverna-capability-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>${project.parent.groupId}</groupId>
+			<artifactId>taverna-workflowmodel-api</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.taverna.language</groupId>
+			<artifactId>taverna-scufl2-api</artifactId>
+			<version>${taverna.language.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.jdom</groupId>
+			<artifactId>com.springsource.org.jdom</artifactId>
+			<version>${jdom.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.fasterxml.jackson.core</groupId>
+			<artifactId>jackson-databind</artifactId>
+			<version>${jackson.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-impl/src/main/java/uk/org/taverna/platform/capability/activity/impl/ActivityServiceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-capability-impl/src/main/java/uk/org/taverna/platform/capability/activity/impl/ActivityServiceImpl.java b/taverna-capability-impl/src/main/java/uk/org/taverna/platform/capability/activity/impl/ActivityServiceImpl.java
new file mode 100644
index 0000000..91f910c
--- /dev/null
+++ b/taverna-capability-impl/src/main/java/uk/org/taverna/platform/capability/activity/impl/ActivityServiceImpl.java
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (C) 2010 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 uk.org.taverna.platform.capability.activity.impl;
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import net.sf.taverna.t2.workflowmodel.processor.activity.Activity;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityInputPort;
+import net.sf.taverna.t2.workflowmodel.processor.activity.ActivityOutputPort;
+import uk.org.taverna.platform.capability.api.ActivityConfigurationException;
+import uk.org.taverna.platform.capability.api.ActivityNotFoundException;
+import uk.org.taverna.platform.capability.api.ActivityService;
+import uk.org.taverna.scufl2.api.port.InputActivityPort;
+import uk.org.taverna.scufl2.api.port.OutputActivityPort;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+public class ActivityServiceImpl implements ActivityService {
+	private List<ActivityFactory> activityFactories;
+
+	@Override
+	public Set<URI> getActivityTypes() {
+		Set<URI> activityTypes = new HashSet<>();
+		for (ActivityFactory activityFactory : activityFactories)
+			activityTypes.add(activityFactory.getActivityType());
+		return activityTypes;
+	}
+
+	@Override
+	public boolean activityExists(URI uri) {
+		for (ActivityFactory activityFactory : activityFactories)
+			if (activityFactory.getActivityType().equals(uri))
+				return true;
+		return false;
+	}
+
+	@Override
+	public JsonNode getActivityConfigurationSchema(URI activityType)
+			throws ActivityNotFoundException {
+		ActivityFactory factory = getActivityFactory(activityType);
+		return factory.getActivityConfigurationSchema();
+	}
+
+	@Override
+	public Activity<?> createActivity(URI activityType, JsonNode configuration)
+			throws ActivityNotFoundException, ActivityConfigurationException {
+		ActivityFactory factory = getActivityFactory(activityType);
+		@SuppressWarnings("unchecked")
+		Activity<JsonNode> activity = (Activity<JsonNode>) factory
+				.createActivity();
+		try {
+			if (configuration != null)
+				activity.configure(configuration);
+		} catch (net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException e) {
+			throw new ActivityConfigurationException(e);
+		}
+		return activity;
+	}
+
+	@Override
+	public Set<InputActivityPort> getActivityInputPorts(URI activityType,
+			JsonNode configuration) throws ActivityNotFoundException,
+			ActivityConfigurationException {
+		Set<InputActivityPort> inputPorts = new HashSet<>();
+		try {
+			for (ActivityInputPort port : getActivityFactory(activityType)
+					.getInputPorts(configuration)) {
+				InputActivityPort inputActivityPort = new InputActivityPort();
+				inputActivityPort.setName(port.getName());
+				inputActivityPort.setDepth(port.getDepth());
+				inputPorts.add(inputActivityPort);
+			}
+			return inputPorts;
+		} catch (net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException e) {
+			throw new ActivityConfigurationException(e);
+		}
+	}
+
+	@Override
+	public Set<OutputActivityPort> getActivityOutputPorts(URI activityType,
+			JsonNode configuration) throws ActivityNotFoundException,
+			ActivityConfigurationException {
+		Set<OutputActivityPort> outputPorts = new HashSet<>();
+		try {
+			for (ActivityOutputPort port : getActivityFactory(activityType)
+					.getOutputPorts(configuration)) {
+				OutputActivityPort outputActivityPort = new OutputActivityPort();
+				outputActivityPort.setName(port.getName());
+				outputActivityPort.setDepth(port.getDepth());
+				outputActivityPort.setGranularDepth(port.getGranularDepth());
+				outputPorts.add(outputActivityPort);
+			}
+		} catch (net.sf.taverna.t2.workflowmodel.processor.activity.ActivityConfigurationException e) {
+			throw new ActivityConfigurationException(e);
+		}
+		return outputPorts;
+	}
+
+	/**
+	 * Sets the list of available <code>ActivityFactory</code>s. In a production
+	 * environment this should be set by Spring DM.
+	 * 
+	 * @param activityFactories
+	 *            the list of available <code>ActivityFactory</code>s
+	 */
+	public void setActivityFactories(List<ActivityFactory> activityFactories) {
+		this.activityFactories = activityFactories;
+	}
+
+	private ActivityFactory getActivityFactory(URI activityType)
+			throws ActivityNotFoundException {
+		for (ActivityFactory activityFactory : activityFactories)
+			if (activityFactory.getActivityType().equals(activityType))
+				return activityFactory;
+		throw new ActivityNotFoundException("Could not find an activity for "
+				+ activityType);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-impl/src/main/java/uk/org/taverna/platform/capability/dispatch/impl/DispatchLayerServiceImpl.java
----------------------------------------------------------------------
diff --git a/taverna-capability-impl/src/main/java/uk/org/taverna/platform/capability/dispatch/impl/DispatchLayerServiceImpl.java b/taverna-capability-impl/src/main/java/uk/org/taverna/platform/capability/dispatch/impl/DispatchLayerServiceImpl.java
new file mode 100644
index 0000000..0de59b1
--- /dev/null
+++ b/taverna-capability-impl/src/main/java/uk/org/taverna/platform/capability/dispatch/impl/DispatchLayerServiceImpl.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * Copyright (C) 2011 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 uk.org.taverna.platform.capability.dispatch.impl;
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayer;
+import net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayerFactory;
+import uk.org.taverna.platform.capability.api.DispatchLayerConfigurationException;
+import uk.org.taverna.platform.capability.api.DispatchLayerNotFoundException;
+import uk.org.taverna.platform.capability.api.DispatchLayerService;
+
+import com.fasterxml.jackson.databind.JsonNode;
+
+/**
+ * @author David Withers
+ */
+public class DispatchLayerServiceImpl implements DispatchLayerService {
+	@SuppressWarnings("unused")
+	private static Logger logger = Logger
+			.getLogger(DispatchLayerServiceImpl.class.getName());
+
+	private List<DispatchLayerFactory> dispatchLayerFactories;
+
+	@Override
+	public Set<URI> getDispatchLayerTypes() {
+		Set<URI> dispatchLayerTypes = new HashSet<>();
+		for (DispatchLayerFactory dispatchLayerFactory : dispatchLayerFactories)
+			dispatchLayerTypes.addAll(dispatchLayerFactory
+					.getDispatchLayerTypes());
+		return dispatchLayerTypes;
+	}
+
+	@Override
+	public boolean dispatchLayerExists(URI dispatchLayerType) {
+		for (DispatchLayerFactory dispatchLayerFactory : dispatchLayerFactories)
+			if (dispatchLayerFactory.getDispatchLayerTypes().contains(
+					dispatchLayerType))
+				return true;
+		return false;
+	}
+
+	@Override
+	public JsonNode getDispatchLayerConfigurationSchema(URI dispatchLayerType)
+			throws DispatchLayerNotFoundException {
+		DispatchLayerFactory factory = getDispatchLayerFactory(dispatchLayerType);
+		return factory.getDispatchLayerConfigurationSchema(dispatchLayerType);
+	}
+
+	@Override
+	public DispatchLayer<?> createDispatchLayer(URI dispatchLayerType,
+			JsonNode configuration) throws DispatchLayerNotFoundException,
+			DispatchLayerConfigurationException {
+		DispatchLayerFactory factory = getDispatchLayerFactory(dispatchLayerType);
+		@SuppressWarnings("unchecked")
+		DispatchLayer<JsonNode> dispatchLayer = (DispatchLayer<JsonNode>) factory
+				.createDispatchLayer(dispatchLayerType);
+
+		try {
+			if (configuration != null)
+				dispatchLayer.configure(configuration);
+		} catch (net.sf.taverna.t2.workflowmodel.ConfigurationException e) {
+			throw new DispatchLayerConfigurationException(e);
+		}
+		return dispatchLayer;
+	}
+
+	/**
+	 * Sets the list of available <code>DispatchLayerFactory</code>s.
+	 * 
+	 * In a production environment this should be set by Spring DM.
+	 * 
+	 * @param dispatchLayerFactories
+	 *            the list of available <code>DispatchLayerFactory</code>s
+	 */
+	public void setDispatchLayerFactories(
+			List<DispatchLayerFactory> dispatchLayerFactories) {
+		this.dispatchLayerFactories = dispatchLayerFactories;
+	}
+
+	private DispatchLayerFactory getDispatchLayerFactory(URI dispatchLayerType)
+			throws DispatchLayerNotFoundException {
+		for (DispatchLayerFactory dispatchLayerFactory : dispatchLayerFactories)
+			if (dispatchLayerFactory.getDispatchLayerTypes().contains(
+					dispatchLayerType))
+				return dispatchLayerFactory;
+		throw new DispatchLayerNotFoundException(
+				"Could not find a dispatch layer for " + dispatchLayerType);
+	}
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-impl/src/main/resources/META-INF/spring/taverna-capability-context-osgi.xml
----------------------------------------------------------------------
diff --git a/taverna-capability-impl/src/main/resources/META-INF/spring/taverna-capability-context-osgi.xml b/taverna-capability-impl/src/main/resources/META-INF/spring/taverna-capability-context-osgi.xml
new file mode 100644
index 0000000..8aa5619
--- /dev/null
+++ b/taverna-capability-impl/src/main/resources/META-INF/spring/taverna-capability-context-osgi.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/osgi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:beans="http://www.springframework.org/schema/beans"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans
+                                 http://www.springframework.org/schema/beans/spring-beans.xsd
+                                 http://www.springframework.org/schema/osgi
+                                 http://www.springframework.org/schema/osgi/spring-osgi.xsd">
+
+	<service ref="activityService" interface="uk.org.taverna.platform.capability.api.ActivityService" />
+
+	<list id="activityFactories" interface="net.sf.taverna.t2.workflowmodel.processor.activity.ActivityFactory" cardinality="0..N" />
+
+	<service ref="dispatchLayerService" interface="uk.org.taverna.platform.capability.api.DispatchLayerService" />
+
+	<list id="dispatchLayerFactories" interface="net.sf.taverna.t2.workflowmodel.processor.dispatch.DispatchLayerFactory" cardinality="0..N" />
+
+</beans:beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-capability-impl/src/main/resources/META-INF/spring/taverna-capability-context.xml
----------------------------------------------------------------------
diff --git a/taverna-capability-impl/src/main/resources/META-INF/spring/taverna-capability-context.xml b/taverna-capability-impl/src/main/resources/META-INF/spring/taverna-capability-context.xml
new file mode 100644
index 0000000..fad027e
--- /dev/null
+++ b/taverna-capability-impl/src/main/resources/META-INF/spring/taverna-capability-context.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans
+                           http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+	<bean id="activityService" class="uk.org.taverna.platform.capability.activity.impl.ActivityServiceImpl">
+		<property name="activityFactories" ref="activityFactories" />
+	</bean>
+
+	<bean id="dispatchLayerService" class="uk.org.taverna.platform.capability.dispatch.impl.DispatchLayerServiceImpl">
+		<property name="dispatchLayerFactories" ref="dispatchLayerFactories" />
+	</bean>
+
+</beans>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-credential-manager-impl/pom.xml
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-impl/pom.xml b/taverna-credential-manager-impl/pom.xml
new file mode 100644
index 0000000..ab1536c
--- /dev/null
+++ b/taverna-credential-manager-impl/pom.xml
@@ -0,0 +1,89 @@
+<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/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+    <groupId>org.apache.taverna.engine</groupId>
+    <artifactId>taverna-engine</artifactId>
+    <version>3.1.0-incubating-SNAPSHOT</version>
+	</parent>
+	<artifactId>taverna-credential-manager-impl</artifactId>
+	<packaging>bundle</packaging>
+	<name>Apache Taverna Credential Manager Implementation</name>
+
+  <profiles>
+    <profile>
+      <id>strongEncryption</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-failsafe-plugin</artifactId>
+            <version>2.9</version>
+            <configuration>
+              <forkMode>always</forkMode>
+            </configuration>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <goals>
+                  <goal>integration-test</goal>
+                </goals>
+              </execution>
+              <execution>
+                <id>verify</id>
+                <goals>
+                  <goal>verify</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
+	<dependencies>
+		<dependency>
+      <groupId>${project.parent.groupId}</groupId>
+			<artifactId>taverna-credential-manager</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.taverna.osgi</groupId>
+			<artifactId>taverna-app-configuration-api</artifactId>
+			<version>${taverna.osgi.version}</version>
+		</dependency>
+		<dependency>
+      <groupId>${project.parent.groupId}</groupId>
+			<artifactId>taverna-observer</artifactId>
+			<version>${project.parent.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.bouncycastle</groupId>
+			<artifactId>bcprov-jdk16</artifactId>
+			<version>${bcprov.jdk16.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+      <version>${log4j.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+      <version>${commons.io.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+      <version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.mortbay.jetty</groupId>
+			<artifactId>jetty</artifactId>
+			<version>${jetty.version}</version>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-taverna-engine/blob/246a16e2/taverna-credential-manager-impl/src/main/java/net/sf/taverna/t2/security/credentialmanager/impl/CredentialManagerAuthenticator.java
----------------------------------------------------------------------
diff --git a/taverna-credential-manager-impl/src/main/java/net/sf/taverna/t2/security/credentialmanager/impl/CredentialManagerAuthenticator.java b/taverna-credential-manager-impl/src/main/java/net/sf/taverna/t2/security/credentialmanager/impl/CredentialManagerAuthenticator.java
new file mode 100644
index 0000000..3a0193e
--- /dev/null
+++ b/taverna-credential-manager-impl/src/main/java/net/sf/taverna/t2/security/credentialmanager/impl/CredentialManagerAuthenticator.java
@@ -0,0 +1,112 @@
+package net.sf.taverna.t2.security.credentialmanager.impl;
+
+import static java.net.Authenticator.RequestorType.PROXY;
+
+import java.net.Authenticator;
+import java.net.PasswordAuthentication;
+import java.net.URI;
+import java.net.URISyntaxException;
+import net.sf.taverna.t2.security.credentialmanager.CMException;
+import net.sf.taverna.t2.security.credentialmanager.CredentialManager;
+import net.sf.taverna.t2.security.credentialmanager.UsernamePassword;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Credential Manager backed {@link Authenticator}.
+ * <p>
+ * Initialize by using: <code>
+ * Authenticator.setDefault(new CredentialManagerAuthenticator());
+ * </code>
+ * <p>
+ * Special case included for proxy authentication.
+ * 
+ * @author Stian Soiland-Reyes
+ * 
+ */
+public class CredentialManagerAuthenticator extends Authenticator {
+	private Logger logger;
+	private CredentialManager credManager;
+
+	public CredentialManagerAuthenticator(CredentialManager credManager) {
+		logger = Logger.getLogger(CredentialManagerAuthenticator.class);
+		setCredentialManager(credManager);
+	}
+
+	public void setCredentialManager(CredentialManager credManager) {
+		this.credManager = credManager;
+	}
+
+	@Override
+	protected PasswordAuthentication getPasswordAuthentication() {
+		if (getRequestorType().equals(PROXY)) {
+			String password = System.getProperty("http.proxyPassword");
+			String username = System.getProperty("http.proxyUser");
+			if (username == null || password == null)
+				// No proxy authentication set
+				return null;
+
+			return new PasswordAuthentication(username, password.toCharArray());
+		}
+
+		URI uri;
+		if (getRequestingURL() != null) {
+			try {
+				uri = getRequestingURL().toURI();
+			} catch (URISyntaxException e) {
+				logger.warn("Unsupported request (invalid URL) for "
+						+ getRequestingURL());
+				return null;
+			}
+		} else {
+			// Construct an URI of socket://hostname:port
+			String host = getRequestingHost();
+			if (host == null)
+				// Use IP address
+				host = getRequestingSite().getHostAddress();
+			int port = getRequestingPort();
+			if (host == null || port < 0) {
+				logger.warn("Unsupported request for " + getRequestingScheme()
+						+ " " + getRequestingSite());
+				return null;
+			}
+			uri = URI.create("socket://" + host + ":" + port);
+		}
+
+		if (credManager == null) {
+			logger.warn("No Credential Manager");
+			return null;
+		}
+		boolean usePathRecursion = false;
+		String realm = getRequestingPrompt();
+		if (getRequestingScheme().equals("basic")
+				|| getRequestingScheme().equals("digest")) {
+			usePathRecursion = true;
+			if (realm != null && realm.length() > 0)
+				try {
+					uri = DistinguishedNameParserImpl.resolveUriFragment(uri, realm);
+				} catch (URISyntaxException e) {
+					logger.warn("Could not URI-encode fragment for realm: "
+							+ realm);
+				}
+		}
+
+		UsernamePassword usernameAndPassword;
+		try {
+			usernameAndPassword = credManager.getUsernameAndPasswordForService(uri,
+					usePathRecursion, realm);
+		} catch (CMException e) {
+			logger.warn("Could not get username and password for " + uri, e);
+			return null;
+		}
+		if (usernameAndPassword == null) {
+			logger.warn("No username/password found for " + uri);
+			return null;
+		}
+		PasswordAuthentication pwAuth = new PasswordAuthentication(
+				usernameAndPassword.getUsername(), usernameAndPassword
+						.getPassword());
+		usernameAndPassword.resetPassword();
+		return pwAuth;
+	}
+}