http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ContentTypes.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ContentTypes.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ContentTypes.java
new file mode 100644
index 0000000..2ad6063
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ContentTypes.java
@@ -0,0 +1,63 @@
+/*
+ */
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static java.util.Arrays.asList;
+import static java.util.Collections.singletonList;
+import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE;
+import static javax.ws.rs.core.MediaType.APPLICATION_OCTET_STREAM_TYPE;
+import static javax.ws.rs.core.MediaType.APPLICATION_XML_TYPE;
+
+import java.util.List;
+
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Variant;
+
+/**
+ * The content types supported at various points in the REST interface.
+ * 
+ * @author Donal Fellows
+ */
+public interface ContentTypes {
+       /** "application/zip" */
+       public static final MediaType APPLICATION_ZIP_TYPE = new MediaType(
+                       "application", "zip");
+
+       /** "application/vnd.taverna.baclava+xml" */
+       public static final MediaType BACLAVA_MEDIA_TYPE = new MediaType(
+                       "application", "vnd.taverna.baclava+xml");
+
+       /**
+        * The media types that we are willing to serve up directories as. Note 
that
+        * we <i>only</i> serve directories up as these.
+        */
+       public static final List<Variant> DIRECTORY_VARIANTS = asList(new 
Variant(
+                       APPLICATION_XML_TYPE, (String) null, "UTF-8"), new 
Variant(
+                       APPLICATION_JSON_TYPE, (String) null, "UTF-8"), new 
Variant(
+                       APPLICATION_ZIP_TYPE, (String) null, null));
+
+       /**
+        * The baseline set of media types that we are willing to serve up 
files as.
+        * Note that we <i>also</i> serve files up as their auto-detected media
+        * type. In all cases, this means we just shovel the bytes (or 
characters,
+        * in the case of <tt>text/*</tt> subtypes) back at the client.
+        */
+       public static final List<Variant> INITIAL_FILE_VARIANTS = 
singletonList(new Variant(
+                       APPLICATION_OCTET_STREAM_TYPE, (String) null, null));
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/DirectoryBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/DirectoryBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/DirectoryBean.java
new file mode 100644
index 0000000..7cb1b7e
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/DirectoryBean.java
@@ -0,0 +1,32 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.taverna.server.master.rest.TavernaServerDirectoryREST;
+import org.taverna.server.master.interfaces.TavernaRun;
+import org.taverna.server.master.utils.FilenameUtils;
+
+/**
+ * Description of properties supported by {@link DirectoryREST}.
+ * 
+ * @author Donal Fellows
+ */
+public interface DirectoryBean extends SupportAware {
+       void setFileUtils(FilenameUtils fileUtils);
+
+       TavernaServerDirectoryREST connect(TavernaRun run);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/FeedBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/FeedBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/FeedBean.java
new file mode 100644
index 0000000..c977974
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/FeedBean.java
@@ -0,0 +1,29 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.taverna.server.master.InteractionFeed;
+import org.taverna.server.master.interaction.InteractionFeedSupport;
+
+/**
+ * Description of properties supported by {@link InteractionFeed}.
+ * 
+ * @author Donal Fellows
+ */
+public interface FeedBean {
+       void setInteractionFeedSupport(InteractionFeedSupport feed);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/InputBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/InputBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/InputBean.java
new file mode 100644
index 0000000..17003e5
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/InputBean.java
@@ -0,0 +1,37 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.ws.rs.core.UriInfo;
+
+import org.taverna.server.master.ContentsDescriptorBuilder;
+import org.taverna.server.master.interfaces.TavernaRun;
+import org.taverna.server.master.rest.TavernaServerInputREST;
+import org.taverna.server.master.utils.FilenameUtils;
+
+/**
+ * Description of properties supported by {@link 
org.taverna.server.master.InputREST}.
+ * 
+ * @author Donal Fellows
+ */
+public interface InputBean extends SupportAware {
+       TavernaServerInputREST connect(TavernaRun run, UriInfo ui);
+
+       void setCdBuilder(ContentsDescriptorBuilder cd);
+
+       void setFileUtils(FilenameUtils fn);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ListenerPropertyBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ListenerPropertyBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ListenerPropertyBean.java
new file mode 100644
index 0000000..52a52f2
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ListenerPropertyBean.java
@@ -0,0 +1,31 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.taverna.server.master.interfaces.Listener;
+import org.taverna.server.master.interfaces.TavernaRun;
+import org.taverna.server.master.rest.TavernaServerListenersREST;
+
+/**
+ * Description of properties supported by {@link ListenerPropertyREST}.
+ * 
+ * @author Donal Fellows
+ */
+public interface ListenerPropertyBean extends SupportAware {
+       TavernaServerListenersREST.Property connect(Listener listen,
+                       TavernaRun run, String propertyName);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ListenersBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ListenersBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ListenersBean.java
new file mode 100644
index 0000000..63035f7
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ListenersBean.java
@@ -0,0 +1,29 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.taverna.server.master.interfaces.TavernaRun;
+import org.taverna.server.master.rest.TavernaServerListenersREST;
+
+/**
+ * Description of properties supported by {@link ListenersREST}.
+ * 
+ * @author Donal Fellows
+ */
+public interface ListenersBean extends SupportAware {
+       TavernaServerListenersREST connect(TavernaRun run);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ManagementModel.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ManagementModel.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ManagementModel.java
new file mode 100644
index 0000000..dc02279
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/ManagementModel.java
@@ -0,0 +1,74 @@
+/*
+ */
+package org.taverna.server.master.api;
+/*
+ * 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.
+ */
+
+/**
+ * The model of the webapp's state Java Bean.
+ * 
+ * @author Donal Fellows
+ */
+public interface ManagementModel {
+       /**
+        * @return whether we allow the creation of new workflow runs.
+        */
+       boolean getAllowNewWorkflowRuns();
+
+       /**
+        * @return whether we should log all workflows sent to us.
+        */
+       boolean getLogIncomingWorkflows();
+
+       /**
+        * @return whether outgoing exceptions should be logged before being
+        *         converted to responses.
+        */
+       boolean getLogOutgoingExceptions();
+
+       /**
+        * @return the file that all usage records should be appended to, or
+        *         <tt>null</tt> if they should be just dropped.
+        */
+       String getUsageRecordLogFile();
+
+       /**
+        * @param logIncomingWorkflows
+        *            whether we should log all workflows sent to us.
+        */
+       void setLogIncomingWorkflows(boolean logIncomingWorkflows);
+
+       /**
+        * @param allowNewWorkflowRuns
+        *            whether we allow the creation of new workflow runs.
+        */
+       void setAllowNewWorkflowRuns(boolean allowNewWorkflowRuns);
+
+       /**
+        * @param logOutgoingExceptions
+        *            whether outgoing exceptions should be logged before being
+        *            converted to responses.
+        */
+       void setLogOutgoingExceptions(boolean logOutgoingExceptions);
+
+       /**
+        * @param usageRecordLogFile
+        *            the file that all usage records should be appended to, or
+        *            <tt>null</tt> if they should be just dropped.
+        */
+       void setUsageRecordLogFile(String usageRecordLogFile);
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/OneListenerBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/OneListenerBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/OneListenerBean.java
new file mode 100644
index 0000000..f7a7134
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/OneListenerBean.java
@@ -0,0 +1,30 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.taverna.server.master.interfaces.Listener;
+import org.taverna.server.master.interfaces.TavernaRun;
+import 
org.taverna.server.master.rest.TavernaServerListenersREST.TavernaServerListenerREST;
+
+/**
+ * Description of properties supported by {@link InputREST}.
+ * 
+ * @author Donal Fellows
+ */
+public interface OneListenerBean {
+       TavernaServerListenerREST connect(Listener listen, TavernaRun run);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/RunBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/RunBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/RunBean.java
new file mode 100644
index 0000000..274d9f0
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/RunBean.java
@@ -0,0 +1,33 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.taverna.server.master.ContentsDescriptorBuilder;
+import org.taverna.server.master.interfaces.TavernaRun;
+
+/**
+ * Description of properties supported by {@link 
org.taverna.server.master.RunREST}.
+ * 
+ * @author Donal Fellows
+ */
+public interface RunBean extends SupportAware {
+       void setCdBuilder(ContentsDescriptorBuilder cdBuilder);
+
+       void setRun(TavernaRun run);
+
+       void setRunName(String runName);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/SecurityBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/SecurityBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/SecurityBean.java
new file mode 100644
index 0000000..ddbc9b9
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/SecurityBean.java
@@ -0,0 +1,30 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.taverna.server.master.interfaces.TavernaRun;
+import org.taverna.server.master.interfaces.TavernaSecurityContext;
+import org.taverna.server.master.rest.TavernaServerSecurityREST;
+
+/**
+ * Description of properties supported by {@link RunSecurityREST}.
+ * 
+ * @author Donal Fellows
+ */
+public interface SecurityBean extends SupportAware {
+       TavernaServerSecurityREST connect(TavernaSecurityContext context, 
TavernaRun run);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/SupportAware.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/SupportAware.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/SupportAware.java
new file mode 100644
index 0000000..117533f
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/SupportAware.java
@@ -0,0 +1,37 @@
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.springframework.beans.factory.annotation.Required;
+import org.taverna.server.master.TavernaServerSupport;
+
+/**
+ * Indicates that this is a class that wants to be told by Spring about the
+ * main support bean.
+ * 
+ * @author Donal Fellows
+ */
+public interface SupportAware {
+       /**
+        * How to tell the bean about the support bean.
+        * 
+        * @param support
+        *            Reference to the support bean.
+        */
+       @Required
+       void setSupport(TavernaServerSupport support);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/TavernaServerBean.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/TavernaServerBean.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/TavernaServerBean.java
new file mode 100644
index 0000000..8873857
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/TavernaServerBean.java
@@ -0,0 +1,114 @@
+/*
+ */
+package org.taverna.server.master.api;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.annotation.Nonnull;
+
+import org.springframework.beans.factory.annotation.Required;
+import org.taverna.server.master.ContentsDescriptorBuilder;
+import org.taverna.server.master.TavernaServerSupport;
+import org.taverna.server.master.interfaces.Policy;
+import org.taverna.server.master.interfaces.RunStore;
+import org.taverna.server.master.interfaces.TavernaSecurityContext;
+import org.taverna.server.master.interfaces.UriBuilderFactory;
+import org.taverna.server.master.notification.NotificationEngine;
+import org.taverna.server.master.notification.atom.EventDAO;
+import org.taverna.server.master.rest.TavernaServerREST;
+import org.taverna.server.master.soap.TavernaServerSOAP;
+import org.taverna.server.master.utils.FilenameUtils;
+
+/**
+ * The methods of the webapp that are accessed by beans other than itself or
+ * those which are told directly about it. This exists so that an AOP proxy can
+ * be installed around it.
+ * 
+ * @author Donal Fellows
+ */
+public interface TavernaServerBean extends TavernaServerSOAP, 
TavernaServerREST,
+               UriBuilderFactory {
+       /**
+        * @param policy
+        *            The policy being installed by Spring.
+        */
+       @Required
+       void setPolicy(@Nonnull Policy policy);
+
+       /**
+        * @param runStore
+        *            The run store being installed by Spring.
+        */
+       @Required
+       void setRunStore(@Nonnull RunStore runStore);
+
+       /**
+        * @param converter
+        *            The filename converter being installed by Spring.
+        */
+       @Required
+       void setFileUtils(@Nonnull FilenameUtils converter);
+
+       /**
+        * @param cdBuilder
+        *            The contents descriptor builder being installed by Spring.
+        */
+       @Required
+       void setContentsDescriptorBuilder(
+                       @Nonnull ContentsDescriptorBuilder cdBuilder);
+
+       /**
+        * @param notificationEngine
+        *            The notification engine being installed by Spring.
+        */
+       @Required
+       void setNotificationEngine(@Nonnull NotificationEngine 
notificationEngine);
+
+       /**
+        * @param support
+        *            The support bean being installed by Spring.
+        */
+       @Required
+       void setSupport(@Nonnull TavernaServerSupport support);
+
+       /**
+        * @param eventSource
+        *            The event source bean being installed by Spring.
+        */
+       @Required
+       void setEventSource(@Nonnull EventDAO eventSource);
+
+       /**
+        * The nastier parts of security initialisation in SOAP calls, which we 
want
+        * to go away.
+        * 
+        * @param context
+        *            The context to configure.
+        * @return True if we did <i>not</i> initialise things.
+        */
+       boolean initObsoleteSOAPSecurity(@Nonnull TavernaSecurityContext 
context);
+
+       /**
+        * The nastier parts of security initialisation in REST calls, which we 
want
+        * to go away.
+        * 
+        * @param context
+        *            The context to configure.
+        * @return True if we did <i>not</i> initialise things.
+        */
+       boolean initObsoleteRESTSecurity(@Nonnull TavernaSecurityContext 
context);
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/package-info.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/package-info.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/package-info.java
new file mode 100644
index 0000000..0966e24
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/api/package-info.java
@@ -0,0 +1,22 @@
+/**
+ * API <tt>interface</tt>s for the main service classes.
+ * 
+ * @author Donal Fellows
+ */
+package org.taverna.server.master.api;
+/*
+ * 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.
+ */

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Capability.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Capability.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Capability.java
new file mode 100644
index 0000000..75f9549
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Capability.java
@@ -0,0 +1,38 @@
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.net.URI;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Describes a single capability supported by Taverna Server's workflow
+ * execution core.
+ * 
+ * @author Donal Fellows
+ */
+@XmlType(name = "Capability")
+public class Capability {
+       @XmlAttribute
+       @XmlSchemaType(name = "anyURI")
+       public URI capability;
+       @XmlAttribute
+       public String version;
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Credential.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Credential.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Credential.java
new file mode 100644
index 0000000..c6627da
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Credential.java
@@ -0,0 +1,162 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.taverna.server.master.common.Namespaces.XLINK;
+
+import java.io.Serializable;
+import java.net.URI;
+import java.security.Key;
+import java.security.cert.Certificate;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+import javax.annotation.Nonnull;
+
+/**
+ * A description of a private credential. This description is characterised by 
a
+ * file visible to the workflow run that contains a particular key-pair.
+ * 
+ * @author Donal Fellows
+ */
+@XmlType(name = "CredentialDescriptor")
+@XmlSeeAlso({ Credential.KeyPair.class, Credential.Password.class })
+@SuppressWarnings("serial")
+public abstract class Credential implements Serializable {
+       /** The location of this descriptor in the REST world. */
+       @XmlAttribute(namespace = XLINK)
+       public String href;
+       /**
+        * The location of this descriptor in the SOAP world. Must match 
corrected
+        * with the {@link #href} field.
+        */
+       @XmlTransient
+       public String id;
+       /**
+        * The service URI to use this credential with. If omitted, this 
represents
+        * the <i>default</i> credential to use.
+        */
+       @XmlElement
+       @XmlSchemaType(name = "anyURI")
+       public URI serviceURI;
+       /** The key extracted from the keystore. */
+       public transient Key loadedKey;
+       /** The trust chain of the key extracted from the keystore. */
+       public transient Certificate[] loadedTrustChain;
+
+       @Override
+       public int hashCode() {
+               return id.hashCode();
+       }
+
+       @Override
+       public final boolean equals(Object o) {
+               if (o == null || !(o instanceof Credential))
+                       return false;
+               return equals((Credential) o);
+       }
+
+       protected boolean equals(@Nonnull Credential c) {
+               return id.equals(c.id);
+       }
+
+       /**
+        * A description of a credential that is a public/private key-pair in 
some
+        * kind of key store.
+        * 
+        * @author Donal Fellows
+        */
+       @XmlRootElement(name = "keypair")
+       @XmlType(name = "KeyPairCredential")
+       public static class KeyPair extends Credential {
+               /** The name of the credential within its store, i.e., it's 
alias. */
+               @XmlElement(required = true)
+               public String credentialName;
+               /**
+                * The keystore file containing the credential. This is 
resolved with
+                * respect to the workflow run working directory.
+                */
+               @XmlElement
+               public String credentialFile;
+               /**
+                * The type of keystore file. Defaults to <tt>JKS</tt> if 
unspecified.
+                */
+               @XmlElement
+               public String fileType;
+               /**
+                * The password used to unlock the keystore file. It is assumed 
that the
+                * same password is used for unlocking the credential within, 
or that
+                * the inner password is empty.
+                */
+               @XmlElement
+               public String unlockPassword;
+               /**
+                * The encoded serialized keystore containing the credential.
+                */
+               @XmlElement
+               public byte[] credentialBytes;
+
+               @Override
+               public String toString() {
+                       return "keypair(id=" + id + ")";
+               }
+       }
+
+       /**
+        * A description of a credential that is a username and password.
+        * 
+        * @author Donal Fellows
+        */
+       @XmlRootElement(name = "userpass")
+       @XmlType(name = "PasswordCredential")
+       public static class Password extends Credential {
+               @XmlElement(required = true)
+               public String username;
+               @XmlElement(required = true)
+               public String password;
+
+               @Override
+               public String toString() {
+                       return "userpass(id=" + id + ")";
+               }
+       }
+
+       /**
+        * A credential that is just used for deleting credentials by ID. 
Cannot be
+        * marshalled as XML.
+        * 
+        * @author Donal Fellows
+        */
+       public static class Dummy extends Credential {
+               public Dummy(String id) {
+                       this.id = id;
+               }
+
+               @Override
+               public String toString() {
+                       return "dummy(id=" + id + ")";
+               }
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/DirEntryReference.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/DirEntryReference.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/DirEntryReference.java
new file mode 100644
index 0000000..424e32a
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/DirEntryReference.java
@@ -0,0 +1,106 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.taverna.server.master.common.Namespaces.XLINK;
+
+import java.net.URI;
+
+import javax.ws.rs.core.UriBuilder;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.taverna.server.master.interfaces.Directory;
+import org.taverna.server.master.interfaces.DirectoryEntry;
+
+/**
+ * A reference to something that is in a directory below the working directory
+ * of a workflow run, described using JAXB. Note that when creating an XML
+ * document containing one of these in a client, it is <i>not</i> necessary to
+ * supply any attribute.
+ * 
+ * @author Donal Fellows
+ */
+@XmlType(name = "DirectoryEntry")
+@XmlSeeAlso( { DirEntryReference.DirectoryReference.class,
+               DirEntryReference.FileReference.class })
+public class DirEntryReference {
+       /** A link to the entry. Ignored on input. */
+       @XmlAttribute(name = "href", namespace = XLINK)
+       @XmlSchemaType(name = "anyURI")
+       public URI link;
+       /** The last, user-displayable part of the name. Ignored on input. */
+       @XmlAttribute
+       public String name;
+       /** The path of the entry. */
+       @XmlValue
+       public String path;
+
+       /**
+        * Return the directory entry reference instance subclass suitable for 
the
+        * given directory entry.
+        * 
+        * @param entry
+        *            The entry to characterise.
+        * @return An object that describes the directory entry.
+        */
+       public static DirEntryReference newInstance(DirectoryEntry entry) {
+               return newInstance(null, entry);
+       }
+
+       /**
+        * Return the directory entry reference instance subclass suitable for 
the
+        * given directory entry.
+        * 
+        * @param ub
+        *            Used for constructing URIs. The {@link #link} field is not
+        *            filled in if this is <tt>null</tt>.
+        * @param entry
+        *            The entry to characterise.
+        * @return An object that describes the directory entry.
+        */
+       // Really returns a subclass, so cannot be constructor
+       public static DirEntryReference newInstance(UriBuilder ub,
+                       DirectoryEntry entry) {
+               DirEntryReference de = (entry instanceof Directory) ? new 
DirectoryReference()
+                               : new FileReference();
+               de.name = entry.getName();
+               String fullname = entry.getFullName();
+               de.path = fullname.startsWith("/") ? fullname.substring(1) : 
fullname;
+               if (ub != null)
+                       de.link = ub.build(entry.getName());
+               return de;
+       }
+
+       /** A reference to a directory, done with JAXB. */
+       @XmlRootElement(name = "dir")
+       @XmlType(name = "DirectoryReference")
+       public static class DirectoryReference extends DirEntryReference {
+       }
+
+       /** A reference to a file, done with JAXB. */
+       @XmlRootElement(name = "file")
+       @XmlType(name = "FileReference")
+       public static class FileReference extends DirEntryReference {
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/InputDescription.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/InputDescription.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/InputDescription.java
new file mode 100644
index 0000000..b1eb55c
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/InputDescription.java
@@ -0,0 +1,123 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+import org.taverna.server.master.interfaces.Input;
+import org.taverna.server.master.interfaces.TavernaRun;
+
+/**
+ * A description of the inputs to a workflow, described using JAXB.
+ * 
+ * @author Donal Fellows
+ */
+@XmlRootElement(name = "inputConfiguration")
+@XmlType(name = "InputConfigurationDescription")
+public class InputDescription extends VersionedElement {
+       /**
+        * The Baclava file handling the description of the elements. May be
+        * omitted/<tt>null</tt>.
+        */
+       @XmlElement(required = false)
+       public String baclavaFile;
+       /**
+        * The port/value assignment.
+        */
+       @XmlElement(nillable = false)
+       public List<Port> port = new ArrayList<>();
+
+       /**
+        * Make a blank input description.
+        */
+       public InputDescription() {
+       }
+
+       /**
+        * Make an input description suitable for the given workflow run.
+        * 
+        * @param run
+        */
+       public InputDescription(TavernaRun run) {
+               super(true);
+               baclavaFile = run.getInputBaclavaFile();
+               if (baclavaFile == null)
+                       for (Input i : run.getInputs())
+                               port.add(new Port(i));
+       }
+
+       /**
+        * The type of a single port description.
+        * 
+        * @author Donal Fellows
+        */
+       @XmlType(name = "PortConfigurationDescription")
+       public static class Port {
+               /**
+                * The name of this port.
+                */
+               @XmlAttribute(name = "portName", required = true)
+               public String name;
+               /**
+                * The file assigned to this port.
+                */
+               @XmlAttribute(name = "portFile", required = false)
+               public String file;
+               /**
+                * The file assigned to this port.
+                */
+               @XmlAttribute(name = "listDelimiter", required = false)
+               public String delimiter;
+               /**
+                * The value assigned to this port.
+                */
+               @XmlValue
+               public String value;
+
+               /**
+                * Make a blank port description.
+                */
+               public Port() {
+               }
+
+               /**
+                * Make a port description suitable for the given input.
+                * 
+                * @param input
+                */
+               public Port(Input input) {
+                       name = input.getName();
+                       if (input.getFile() != null) {
+                               file = input.getFile();
+                               value = "";
+                       } else {
+                               file = null;
+                               value = input.getValue();
+                       }
+                       delimiter = input.getDelimiter();
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Namespaces.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Namespaces.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Namespaces.java
new file mode 100644
index 0000000..d2035ee
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Namespaces.java
@@ -0,0 +1,52 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * 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.
+ */
+
+/**
+ * A convenient place to keep the names of URIs so that they can be got right
+ * <i>once</i>.
+ * 
+ * @author Donal Fellows
+ */
+public interface Namespaces {
+       /**
+        * The XLink specification's namespace name.
+        */
+       public static final String XLINK = "http://www.w3.org/1999/xlink";;
+       /**
+        * The XML Digital Signature specification's namespace name.
+        */
+       public static final String XSIG = "http://www.w3.org/2000/09/xmldsig#";;
+       /**
+        * The Usage Record specification's namespace name.
+        */
+       public static final String UR = "http://schema.ogf.org/urf/2003/09/urf";;
+       /**
+        * The T2flow document format's namespace name.
+        */
+       public static final String T2FLOW = 
"http://taverna.sf.net/2008/xml/t2flow";;
+       /**
+        * The namespace for the server.
+        */
+       public static final String SERVER = 
"http://ns.taverna.org.uk/2010/xml/server/";;
+       public static final String SERVER_REST = SERVER + "rest/";
+       public static final String SERVER_SOAP = SERVER + "soap/";
+       public static final String FEED = SERVER + "feed/";
+       public static final String ADMIN = SERVER + "admin/";
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Permission.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Permission.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Permission.java
new file mode 100644
index 0000000..3e0a307
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Permission.java
@@ -0,0 +1,56 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlEnumValue;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * Description of a permission to access a particular workflow run. Note that
+ * users always have full access to their own runs, as does any user with the "
+ * <tt>{@value org.taverna.server.master.common.Roles#ADMIN}</tt>" ability.
+ * 
+ * @author Donal Fellows
+ */
+@XmlType(name = "Permission")
+@XmlEnum
+public enum Permission {
+       /** Indicates that a user cannot see the workflow run at all. */
+       @XmlEnumValue("none")
+       None,
+       /**
+        * Indicates that a user can see the workflow run and its contents, but
+        * can't modify anything.
+        */
+       @XmlEnumValue("read")
+       Read,
+       /**
+        * Indicates that a user can update most aspects of a workflow, but 
cannot
+        * work with either its security features or its lifetime.
+        */
+       @XmlEnumValue("update")
+       Update,
+       /**
+        * Indicates that a user can update almost all aspects of a workflow, 
with
+        * only its security features being shrouded.
+        */
+       @XmlEnumValue("destroy")
+       Destroy
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/ProfileList.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/ProfileList.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/ProfileList.java
new file mode 100644
index 0000000..d9b0a9e
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/ProfileList.java
@@ -0,0 +1,55 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * Description of the profiles that can apply to a workflow.
+ * 
+ * @author Donal K. Fellows
+ */
+@XmlRootElement(name = "profiles")
+@XmlType(name = "ProfileList")
+public class ProfileList {
+       public List<ProfileList.Info> profile = new 
ArrayList<ProfileList.Info>();
+
+       /**
+        * Description of a single workflow profile.
+        * 
+        * @author Donal Fellows
+        */
+       @XmlRootElement(name = "profile")
+       @XmlType(name = "Profile")
+       public static class Info {
+               @XmlValue
+               public String name;
+               /**
+                * Whether this is the main profile.
+                */
+               @XmlAttribute(name = "isMain")
+               public Boolean main;
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Roles.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Roles.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Roles.java
new file mode 100644
index 0000000..bdcf876
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Roles.java
@@ -0,0 +1,38 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * 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.
+ */
+
+/**
+ * The roles defined in this webapp.
+ * 
+ * @author Donal Fellows
+ */
+public interface Roles {
+       /** The role of a normal user. */
+       static final String USER = "ROLE_tavernauser";
+       /**
+        * The role of an administrator. Administrators <i>should</i> have the
+        * normal user role as well.
+        */
+       static final String ADMIN = "ROLE_tavernasuperuser";
+       /**
+        * The role of a workflow accessing itself. Do not give users this role.
+        */
+       static final String SELF = "ROLE_tavernaworkflow";
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/RunReference.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/RunReference.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/RunReference.java
new file mode 100644
index 0000000..cc80f60
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/RunReference.java
@@ -0,0 +1,80 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.taverna.server.master.common.Namespaces.SERVER;
+import static org.taverna.server.master.common.Namespaces.XLINK;
+import static org.taverna.server.master.common.VersionedElement.VERSION;
+
+import java.net.URI;
+
+import javax.ws.rs.core.UriBuilder;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
+
+/**
+ * A reference to a single workflow run, described using JAXB.
+ * 
+ * @author Donal Fellows
+ * @see org.taverna.server.master.interfaces.TavernaRun TavernaRun
+ */
+@XmlRootElement
+@XmlType(name = "TavernaRun")
+@XmlSeeAlso( { Workflow.class, DirEntryReference.class })
+public class RunReference {
+       /**
+        * Where to get information about the run. For REST.
+        */
+       @XmlAttribute(name = "href", namespace = XLINK)
+       @XmlSchemaType(name = "anyURI")
+       public URI link;
+       /** What version of server produced this element? */
+       @XmlAttribute(namespace = SERVER)
+       public String serverVersion;
+       /**
+        * The name of the run. For SOAP.
+        */
+       @XmlValue
+       public String name;
+
+       /**
+        * Make a blank run reference.
+        */
+       public RunReference() {
+       }
+
+       /**
+        * Make a reference to the given workflow run.
+        * 
+        * @param name
+        *            The name of the run.
+        * @param ub
+        *            A factory for URIs, or <tt>null</tt> if none is to be 
made.
+        */
+       public RunReference(String name, UriBuilder ub) {
+               this.serverVersion = VERSION;
+               this.name = name;
+               if (ub != null)
+                       this.link = ub.build(name);
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Status.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Status.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Status.java
new file mode 100644
index 0000000..1aad4ef
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Status.java
@@ -0,0 +1,57 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * States of a workflow run. They are {@link #Initialized Initialized},
+ * {@link #Operating Operating}, {@link #Stopped Stopped}, and {@link #Finished
+ * Finished}. Conceptually, there is also a <tt>Destroyed</tt> state, but the
+ * workflow run does not exist (and hence can't have its state queried or set)
+ * in that case.
+ * 
+ * @author Donal Fellows
+ */
+@XmlEnum
+@XmlType(name = "Status")
+public enum Status {
+       /**
+        * The workflow run has been created, but is not yet running. The run 
will
+        * need to be manually moved to {@link #Operating Operating} when ready.
+        */
+       Initialized,
+       /**
+        * The workflow run is going, reading input, generating output, etc. 
Will
+        * eventually either move automatically to {@link #Finished Finished} 
or can
+        * be moved manually to {@link #Stopped Stopped} (where supported).
+        */
+       Operating,
+       /**
+        * The workflow run is paused, and will need to be moved back to
+        * {@link #Operating Operating} manually.
+        */
+       Stopped,
+       /**
+        * The workflow run has ceased; data files will continue to exist until 
the
+        * run is destroyed (which may be manual or automatic).
+        */
+       Finished
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Trust.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Trust.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Trust.java
new file mode 100644
index 0000000..c61e72a
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Trust.java
@@ -0,0 +1,92 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.taverna.server.master.common.Namespaces.XLINK;
+
+import java.io.Serializable;
+import java.security.cert.Certificate;
+import java.util.Collection;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+/**
+ * A description of a trusted identity or identities. This description is
+ * characterised by a file visible to the workflow run that contains one or 
more
+ * certificates.
+ * 
+ * @author Donal Fellows
+ */
+@XmlType(name = "TrustDescriptor")
+@XmlRootElement(name = "trustedIdentity")
+@SuppressWarnings("serial")
+public final class Trust implements Serializable {
+       /** The location of this descriptor in the REST world. */
+       @XmlAttribute(namespace = XLINK)
+       public String href;
+       /**
+        * The location of this descriptor in the SOAP world. Must match 
corrected
+        * with the {@link #href} field.
+        */
+       @XmlTransient
+       public String id;
+       /**
+        * The file containing the certificate(s). This is resolved with 
respect to
+        * the workflow run working directory.
+        */
+       @XmlElement
+       public String certificateFile;
+       /**
+        * The type of certificate file. Defaults to <tt>X.509</tt> if 
unspecified.
+        */
+       @XmlElement
+       public String fileType;
+       /**
+        * The encoded serialized keystore containing the certificate(s).
+        */
+       @XmlElement
+       public byte[] certificateBytes;
+       /**
+        * The names of the server(s) identified by this trust.
+        */
+       @XmlElement
+       public List<String> serverName;
+       /**
+        * The collection of certificates loaded from the specified file. This 
is
+        * always <tt>null</tt> before validation.
+        */
+       public transient Collection<? extends Certificate> loadedCertificates;
+
+       @Override
+       public int hashCode() {
+               return id.hashCode();
+       }
+
+       @Override
+       public boolean equals(Object o) {
+               if (o == null || !(o instanceof Trust))
+                       return false;
+               return id.equals(((Trust) o).id);
+       }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Uri.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Uri.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Uri.java
new file mode 100644
index 0000000..ba0bb3c
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/Uri.java
@@ -0,0 +1,445 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static javax.ws.rs.core.UriBuilder.fromUri;
+import static org.apache.commons.logging.LogFactory.getLog;
+import static org.taverna.server.master.common.Namespaces.XLINK;
+
+import java.lang.reflect.Method;
+import java.net.URI;
+import java.util.Map;
+
+import javax.annotation.PreDestroy;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriBuilderException;
+import javax.ws.rs.core.UriInfo;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.commons.logging.Log;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.web.PortMapper;
+
+import javax.annotation.Nonnull;
+
+/**
+ * A class that makes it simpler to work with an element with a {@link URI} in
+ * an <tt>href</tt> attribute. Done with JAXB.
+ * 
+ * @author Donal Fellows
+ */
+@XmlType(name = "Location")
+public class Uri {
+       static Log log = getLog("Taverna.Server.UriRewriter");
+       private static final String SECURE_SCHEME = "https";
+       /**
+        * This type is characterised by an attribute that is the reference to 
some
+        * other element.
+        */
+       @XmlAttribute(name = "href", namespace = XLINK)
+       @XmlSchemaType(name = "anyURI")
+       public URI ref;
+
+       /** Make a reference that points nowhere. */
+       public Uri() {
+       }
+
+       /**
+        * Make a reference to the given location.
+        * 
+        * @param ref
+        *            Where to point to.
+        */
+       public Uri(@Nonnull URI ref) {
+               this.ref = secure(ref);
+       }
+
+       /**
+        * Make a reference from the factory with the given parameters.
+        * 
+        * @param ub
+        *            The configured factory.
+        * @param strings
+        *            The parameters to the factory.
+        */
+       public Uri(@Nonnull UriBuilder ub, String... strings) {
+               ref = secure(ub).build((Object[]) strings);
+       }
+
+       /**
+        * Make a reference from the factory with the given parameters.
+        * 
+        * @param ui
+        *            The factory factory.
+        * @param path
+        *            The path to configure the factory with.
+        * @param strings
+        *            The parameters to the factory.
+        */
+       public Uri(@Nonnull UriInfo ui, @Nonnull String path, String... 
strings) {
+               this(ui, true, path, strings);
+       }
+
+       /**
+        * Make a reference from the factory with the given parameters.
+        * 
+        * @param ui
+        *            The factory factory.
+        * @param secure
+        *            Whether the URI should be required to use HTTPS.
+        * @param path
+        *            The path to configure the factory with.
+        * @param strings
+        *            The parameters to the factory.
+        */
+       public Uri(@Nonnull UriInfo ui, boolean secure, @Nonnull String path,
+                       String... strings) {
+               UriBuilder ub = ui.getAbsolutePathBuilder();
+               if (secure) {
+                       ub = secure(ub);
+               }
+               ref = ub.path(path).build((Object[]) strings);
+       }
+
+       public static UriBuilder secure(UriBuilder ub) {
+               return Rewriter.getInstance().getSecuredUriBuilder(ub);
+       }
+
+       public static UriBuilder secure(UriInfo ui) {
+               return secure(ui.getAbsolutePathBuilder());
+       }
+
+       public static URI secure(URI uri) {
+               URI newURI = secure(fromUri(uri)).build();
+               if (log.isDebugEnabled())
+                       log.debug("rewrote " + uri + " to " + newURI);
+               return newURI;
+       }
+
+       public static URI secure(URI base, String uri) {
+               URI newURI = secure(fromUri(base.resolve(uri))).build();
+               if (log.isDebugEnabled())
+                       log.debug("rewrote " + uri + " to " + newURI);
+               return newURI;
+       }
+
+       /**
+        * A bean that allows configuration of how to rewrite generated URIs to 
be
+        * secure.
+        * 
+        * @author Donal Fellows
+        */
+       public static class Rewriter {
+               private static Rewriter instance;
+               private PortMapper portMapper;
+               private boolean suppress;
+               private String rewriteRE = "://[^/]+/[^/]+";
+               private String rewriteTarget;
+
+               static Rewriter getInstance() {
+                       if (instance == null)
+                               new Rewriter();
+                       return instance;
+               }
+
+               @Autowired
+               public void setPortMapper(PortMapper portMapper) {
+                       this.portMapper = portMapper;
+               }
+
+               /**
+                * Whether to suppress rewriting of URIs to be secure.
+                * 
+                * @param suppressSecurity
+                *            True if no rewriting should be done.
+                */
+               public void setSuppressSecurity(boolean suppressSecurity) {
+                       suppress = suppressSecurity;
+               }
+
+               public void setRewriteRegexp(String rewriteRegexp) {
+                       this.rewriteRE = rewriteRegexp;
+               }
+
+               /**
+                * What to rewrite the host, port and web-app name to be.
+                * 
+                * @param rewriteTarget
+                *            What to rewrite to, or "<tt>NONE</tt>" for no 
rewrite.
+                */
+               public void setRewriteTarget(String rewriteTarget) {
+                       if (rewriteTarget.isEmpty())
+                               this.rewriteTarget = null;
+                       else if (rewriteTarget.equals("NONE"))
+                               this.rewriteTarget = null;
+                       else if (rewriteTarget.startsWith("${"))
+                               this.rewriteTarget = null;
+                       else
+                               this.rewriteTarget = "://" + rewriteTarget;
+               }
+
+               private Integer lookupHttpsPort(URI uri) {
+                       if (portMapper != null)
+                               return 
portMapper.lookupHttpsPort(uri.getPort());
+                       return null;
+               }
+
+               public Rewriter() {
+                       instance = this;
+               }
+
+               @PreDestroy
+               public void done() {
+                       instance = null;
+                       Uri.log = null;
+               }
+
+               @Nonnull
+               URI rewrite(@Nonnull String url) {
+                       if (rewriteTarget != null)
+                               url = url.replaceFirst(rewriteRE, 
rewriteTarget);
+                       return URI.create(url);
+               }
+
+               @Nonnull
+               public UriBuilder getSecuredUriBuilder(@Nonnull UriBuilder 
uribuilder) {
+                       if (suppress)
+                               return uribuilder.clone();
+                       UriBuilder ub = new RewritingUriBuilder(uribuilder);
+                       Integer secPort = null;
+                       try {
+                               secPort = lookupHttpsPort(ub.build());
+                       } catch (Exception e) {
+                               /*
+                                * Do not log this; we know why it happens and 
don't actually
+                                * care to do anything about it. All it does is 
fill up the log
+                                * with pointless scariness!
+                                */
+
+                               // log.debug("failed to extract current URI 
port", e);
+                       }
+                       if (secPort == null || secPort.intValue() == -1)
+                               return ub.scheme(SECURE_SCHEME);
+                       return ub.scheme(SECURE_SCHEME).port(secPort);
+               }
+
+               /**
+                * {@link UriBuilder} that applies a rewrite rule to the URIs 
produced
+                * by the wrapped builder.
+                * 
+                * @author Donal Fellows
+                */
+               class RewritingUriBuilder extends UriBuilder {
+                       private UriBuilder wrapped;
+
+                       RewritingUriBuilder(UriBuilder builder) {
+                               wrapped = builder.clone();
+                       }
+
+                       private URI rewrite(URI uri) {
+                               return Rewriter.this.rewrite(uri.toString());
+                       }
+
+                       @Override
+                       public UriBuilder clone() {
+                               return new RewritingUriBuilder(wrapped);
+                       }
+
+                       @Override
+                       public URI buildFromMap(Map<String, ?> values)
+                                       throws IllegalArgumentException, 
UriBuilderException {
+                               return rewrite(wrapped.buildFromMap(values));
+                       }
+
+                       @Override
+                       public URI buildFromEncodedMap(Map<String, ? extends 
Object> values)
+                                       throws IllegalArgumentException, 
UriBuilderException {
+                               return 
rewrite(wrapped.buildFromEncodedMap(values));
+                       }
+
+                       @Override
+                       public URI build(Object... values) throws 
IllegalArgumentException,
+                                       UriBuilderException {
+                               return rewrite(wrapped.build(values));
+                       }
+
+                       @Override
+                       public URI build(Object[] values, boolean 
encodeSlashInPath)
+                                       throws IllegalArgumentException, 
UriBuilderException {
+                               return rewrite(wrapped.build(values, 
encodeSlashInPath));
+                       }
+
+                       @Override
+                       public URI buildFromEncoded(Object... values)
+                                       throws IllegalArgumentException, 
UriBuilderException {
+                               return 
rewrite(wrapped.buildFromEncoded(values));
+                       }
+
+                       @Override
+                       public URI buildFromMap(Map<String, ?> values,
+                                       boolean encodeSlashInPath) throws 
IllegalArgumentException,
+                                       UriBuilderException {
+                               return rewrite(wrapped.buildFromEncoded(values,
+                                               encodeSlashInPath));
+                       }
+
+                       @Override
+                       public UriBuilder uri(URI uri) throws 
IllegalArgumentException {
+                               wrapped.uri(uri);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder uri(String uriTemplate)
+                                       throws IllegalArgumentException {
+                               wrapped.uri(uriTemplate);
+                               return this;
+                       }
+
+                       @Override
+                       public String toTemplate() {
+                               return wrapped.toTemplate();
+                       }
+
+                       @Override
+                       public UriBuilder scheme(String scheme)
+                                       throws IllegalArgumentException {
+                               wrapped.scheme(scheme);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder schemeSpecificPart(String ssp)
+                                       throws IllegalArgumentException {
+                               wrapped.schemeSpecificPart(ssp);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder userInfo(String ui) {
+                               wrapped.userInfo(ui);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder host(String host) throws 
IllegalArgumentException {
+                               wrapped.host(host);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder port(int port) throws 
IllegalArgumentException {
+                               wrapped.port(port);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder replacePath(String path) {
+                               wrapped.replacePath(path);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder path(String path) throws 
IllegalArgumentException {
+                               wrapped.path(path);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder path(
+                                       @java.lang.SuppressWarnings("rawtypes") 
Class resource)
+                                       throws IllegalArgumentException {
+                               wrapped.path(resource);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder path(
+                                       @java.lang.SuppressWarnings("rawtypes") 
Class resource,
+                                       String method) throws 
IllegalArgumentException {
+                               wrapped.path(resource, method);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder path(Method method)
+                                       throws IllegalArgumentException {
+                               wrapped.path(method);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder segment(String... segments)
+                                       throws IllegalArgumentException {
+                               wrapped.segment(segments);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder replaceMatrix(String matrix)
+                                       throws IllegalArgumentException {
+                               wrapped.replaceMatrix(matrix);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder matrixParam(String name, Object... 
values)
+                                       throws IllegalArgumentException {
+                               wrapped.matrixParam(name, values);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder replaceMatrixParam(String name, 
Object... values)
+                                       throws IllegalArgumentException {
+                               wrapped.replaceMatrixParam(name, values);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder replaceQuery(String query)
+                                       throws IllegalArgumentException {
+                               wrapped.replaceQuery(query);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder queryParam(String name, Object... 
values)
+                                       throws IllegalArgumentException {
+                               wrapped.queryParam(name, values);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder replaceQueryParam(String name, 
Object... values)
+                                       throws IllegalArgumentException {
+                               wrapped.replaceQueryParam(name, values);
+                               return this;
+                       }
+
+                       @Override
+                       public UriBuilder fragment(String fragment) {
+                               wrapped.fragment(fragment);
+                               return this;
+                       }
+               }
+       }
+}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/VersionedElement.java
----------------------------------------------------------------------
diff --git 
a/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/VersionedElement.java
 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/VersionedElement.java
new file mode 100644
index 0000000..735a72d
--- /dev/null
+++ 
b/taverna-server-webapp/src/main/java/org/apache/taverna/server/master/common/VersionedElement.java
@@ -0,0 +1,78 @@
+/*
+ */
+package org.taverna.server.master.common;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static org.apache.commons.logging.LogFactory.getLog;
+import static org.taverna.server.master.common.Namespaces.SERVER;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+import org.apache.commons.logging.Log;
+
+/**
+ * The type of an element that declares the version of the server that produced
+ * it.
+ * 
+ * @author Donal Fellows
+ */
+@XmlType(name = "VersionedElement", namespace = SERVER)
+public abstract class VersionedElement {
+       /** What version of server produced this element? */
+       @XmlAttribute(namespace = SERVER)
+       public String serverVersion;
+       /** What revision of server produced this element? Derived from SCM 
commit. */
+       @XmlAttribute(namespace = SERVER)
+       public String serverRevision;
+       /** When was the server built? */
+       @XmlAttribute(namespace = SERVER)
+       public String serverBuildTimestamp;
+       public static final String VERSION, REVISION, TIMESTAMP;
+       static {
+               Log log = getLog("Taverna.Server.Webapp");
+               Properties p = new Properties();
+               try {
+                       try (InputStream is = VersionedElement.class
+                                       
.getResourceAsStream("/version.properties")) {
+                               p.load(is);
+                       }
+               } catch (IOException e) {
+                       log.warn("failed to read /version.properties", e);
+               }
+               VERSION = p.getProperty("tavernaserver.version", 
"unknownVersion");
+               REVISION = String.format("%s (tag: %s)",
+                               p.getProperty("tavernaserver.branch", 
"unknownRevision"),
+                               
p.getProperty("tavernaserver.revision.describe", "unknownTag"));
+               TIMESTAMP = p
+                               .getProperty("tavernaserver.timestamp", 
"unknownTimestamp");
+       }
+
+       public VersionedElement() {
+       }
+
+       protected VersionedElement(boolean ignored) {
+               serverVersion = VERSION;
+               serverRevision = REVISION;
+               serverBuildTimestamp = TIMESTAMP;
+       }
+}

Reply via email to