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 2018/01/09 23:30:26 UTC

[10/42] incubator-taverna-server git commit: package org.taverna -> org.apache.taverna

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadInputPortNameHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadInputPortNameHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadInputPortNameHandler.java
deleted file mode 100644
index a78693d..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadInputPortNameHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.NOT_FOUND;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.BadInputPortNameException;
-
-@Provider
-public class BadInputPortNameHandler extends HandlerCore implements
-		ExceptionMapper<BadInputPortNameException> {
-	@Override
-	public Response toResponse(BadInputPortNameException exn) {
-		return respond(NOT_FOUND, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/BadPropertyValueHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadPropertyValueHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadPropertyValueHandler.java
deleted file mode 100644
index e956749..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadPropertyValueHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.BAD_REQUEST;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.BadPropertyValueException;
-
-@Provider
-public class BadPropertyValueHandler extends HandlerCore implements
-		ExceptionMapper<BadPropertyValueException> {
-	@Override
-	public Response toResponse(BadPropertyValueException exn) {
-		return respond(BAD_REQUEST, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/BadStateChangeHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadStateChangeHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadStateChangeHandler.java
deleted file mode 100644
index 53f441b..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/BadStateChangeHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.BAD_REQUEST;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.BadStateChangeException;
-
-@Provider
-public class BadStateChangeHandler extends HandlerCore implements
-		ExceptionMapper<BadStateChangeException> {
-	@Override
-	public Response toResponse(BadStateChangeException exn) {
-		return respond(BAD_REQUEST, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/EntryHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/EntryHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/EntryHandler.java
deleted file mode 100644
index bc79c22..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/EntryHandler.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.taverna.server.master.rest.handler;
-/*
- * 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.singletonMap;
-import static javax.ws.rs.core.Response.notAcceptable;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.nio.charset.Charset;
-import java.nio.charset.IllegalCharsetNameException;
-import java.nio.charset.UnsupportedCharsetException;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Variant;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Document;
-import org.apache.abdera.model.Entry;
-import org.apache.abdera.parser.Parser;
-import org.apache.abdera.writer.Writer;
-import org.springframework.beans.factory.annotation.Required;
-
-@Provider
-@Produces({ "application/atom+xml", "application/atom+xml;type=entry" })
-@Consumes({ "application/atom+xml", "application/atom+xml;type=entry" })
-public class EntryHandler implements MessageBodyWriter<Entry>,
-		MessageBodyReader<Entry> {
-	private static final String ENC = "UTF-8";
-	private static final MediaType ENTRY = new MediaType("application",
-			"atom+xml", singletonMap("type", "entry"));
-	private static final Variant VARIANT = new Variant(ENTRY, (String) null,
-			ENC);
-	private static final Charset UTF8 = Charset.forName(ENC);
-
-	@Required
-	public void setAbdera(Abdera abdera) {
-		parser = abdera.getParser();
-		writer = abdera.getWriterFactory().getWriter("prettyxml");
-	}
-
-	private Parser parser;
-	private Writer writer;
-
-	@Override
-	public boolean isReadable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		if (!Entry.class.isAssignableFrom(type))
-			return false;
-		if (!ENTRY.isCompatible(mediaType))
-			return false;
-		if (mediaType.getParameters().containsKey("type"))
-			return "entry".equalsIgnoreCase(mediaType.getParameters().get(
-					"type"));
-		return true;
-	}
-
-	@Override
-	public Entry readFrom(Class<Entry> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-			throws IOException, WebApplicationException {
-		Charset cs = UTF8;
-		try {
-			String charset = mediaType.getParameters().get("charset");
-			if (charset != null)
-				cs = Charset.forName(charset);
-		} catch (IllegalCharsetNameException e) {
-			throw new WebApplicationException(notAcceptable(asList(VARIANT))
-					.entity("bad charset name").build());
-		} catch (UnsupportedCharsetException e) {
-			throw new WebApplicationException(notAcceptable(asList(VARIANT))
-					.entity("unsupportd charset name").build());
-		}
-		try {
-			Document<Entry> doc = parser.parse(new InputStreamReader(
-					entityStream, cs));
-			if (!Entry.class.isAssignableFrom(doc.getRoot().getClass())) {
-				throw new WebApplicationException(
-						notAcceptable(asList(VARIANT)).entity(
-								"not really a feed entry").build());
-			}
-			return doc.getRoot();
-		} catch (ClassCastException e) {
-			throw new WebApplicationException(notAcceptable(asList(VARIANT))
-					.entity("not really a feed entry").build());
-
-		}
-	}
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		if (!Entry.class.isAssignableFrom(type))
-			return false;
-		if (!ENTRY.isCompatible(mediaType))
-			return false;
-		if (mediaType.getParameters().containsKey("type"))
-			return "entry".equalsIgnoreCase(mediaType.getParameters().get(
-					"type"));
-		return true;
-	}
-
-	@Override
-	public long getSize(Entry t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return -1;
-	}
-
-	@Override
-	public void writeTo(Entry t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException,
-			WebApplicationException {
-		httpHeaders.putSingle("Content-Type", ENTRY.toString() + ";charset="
-				+ ENC);
-		writer.writeTo(t, new OutputStreamWriter(entityStream, UTF8));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FeedHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FeedHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FeedHandler.java
deleted file mode 100644
index 77e7e49..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FeedHandler.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Collections.singletonMap;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-
-import org.apache.abdera.Abdera;
-import org.apache.abdera.model.Feed;
-import org.apache.abdera.writer.Writer;
-import org.springframework.beans.factory.annotation.Required;
-
-@Provider
-@Produces({ "application/atom+xml", "application/atom+xml;type=feed" })
-public class FeedHandler implements MessageBodyWriter<Feed> {
-	private static final MediaType FEED = new MediaType("application",
-			"atom+xml", singletonMap("type", "feed"));
-	private static final String ENC = "UTF-8";
-
-	@Required
-	public void setAbdera(Abdera abdera) {
-		writer = abdera.getWriterFactory().getWriter("prettyxml");
-	}
-
-	private Writer writer;
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		if (!Feed.class.isAssignableFrom(type))
-			return false;
-		if (!FEED.isCompatible(mediaType))
-			return false;
-		if (mediaType.getParameters().containsKey("type"))
-			return "feed".equalsIgnoreCase(mediaType.getParameters()
-					.get("type"));
-		return true;
-	}
-
-	@Override
-	public long getSize(Feed t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return -1;
-	}
-
-	@Override
-	public void writeTo(Feed t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException,
-			WebApplicationException {
-		httpHeaders.putSingle("Content-Type", FEED.toString() + ";charset="
-				+ ENC);
-		writer.writeTo(t, new OutputStreamWriter(entityStream, ENC));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileConcatenationHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileConcatenationHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileConcatenationHandler.java
deleted file mode 100644
index e0924ad..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileConcatenationHandler.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.taverna.server.master.rest.handler;
-/*
- * 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.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyWriter;
-
-import org.springframework.beans.factory.annotation.Required;
-import org.taverna.server.master.FileConcatenation;
-import org.taverna.server.master.exceptions.FilesystemAccessException;
-import org.taverna.server.master.interfaces.File;
-
-public class FileConcatenationHandler implements
-		MessageBodyWriter<FileConcatenation> {
-	/** How much to pull from the worker in one read. */
-	private int maxChunkSize;
-
-	/**
-	 * @param maxChunkSize
-	 *            How much to pull from the worker in one read.
-	 */
-	@Required
-	public void setMaxChunkSize(int maxChunkSize) {
-		this.maxChunkSize = maxChunkSize;
-	}
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return type.isAssignableFrom(FileConcatenation.class);
-	}
-
-	@Override
-	public long getSize(FileConcatenation fc, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return fc.size();
-	}
-
-	@Override
-	public void writeTo(FileConcatenation fc, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException {
-		for (File f : fc)
-			try {
-				byte[] buffer;
-				for (int off = 0; true ; off += buffer.length) {
-					buffer = f.getContents(off, maxChunkSize);
-					if (buffer == null || buffer.length == 0)
-						break;
-					entityStream.write(buffer);
-				}
-			} catch (FilesystemAccessException e) {
-				// Ignore/skip to next file
-			}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileMessageHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileMessageHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileMessageHandler.java
deleted file mode 100644
index 7d2b381..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileMessageHandler.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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 java.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-
-import org.apache.commons.logging.Log;
-import org.taverna.server.master.exceptions.FilesystemAccessException;
-import org.taverna.server.master.interfaces.File;
-
-/**
- * How to write out a File object with JAX-RS.
- * 
- * @author Donal Fellows
- */
-@Provider
-public class FileMessageHandler implements MessageBodyWriter<File> {
-	private Log log = getLog("Taverna.Server.Webapp");
-	/** How much to pull from the worker in one read. */
-	private int maxChunkSize;
-
-	/**
-	 * @param maxChunkSize
-	 *            How much to pull from the worker in one read.
-	 */
-	public void setMaxChunkSize(int maxChunkSize) {
-		this.maxChunkSize = maxChunkSize;
-	}
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return File.class.isAssignableFrom(type);
-	}
-
-	@Override
-	public long getSize(File t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		try {
-			return t.getSize(); // Is it really raw bytes?
-		} catch (FilesystemAccessException e) {
-			log.info("failed to get file length", e);
-			return -1;
-		}
-	}
-
-	@Override
-	public void writeTo(File t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException,
-			WebApplicationException {
-		try {
-			int off = 0;
-			while (true) {
-				byte[] buffer = t.getContents(off, maxChunkSize);
-				if (buffer == null || buffer.length == 0)
-					break;
-				entityStream.write(buffer);
-				off += buffer.length;
-			}
-		} catch (FilesystemAccessException e) {
-			throw new IOException("problem when reading file", e);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileSegmentHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileSegmentHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileSegmentHandler.java
deleted file mode 100644
index 82d5e0a..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FileSegmentHandler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.lang.Math.min;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.FilesystemAccessException;
-import org.taverna.server.master.rest.FileSegment;
-
-/**
- * How to write out a segment of a file with JAX-RS.
- * 
- * @author Donal Fellows
- */
-@Provider
-public class FileSegmentHandler implements MessageBodyWriter<FileSegment> {
-	/** How much to pull from the worker in one read. */
-	private int maxChunkSize;
-
-	/**
-	 * @param maxChunkSize
-	 *            How much to pull from the worker in one read.
-	 */
-	public void setMaxChunkSize(int maxChunkSize) {
-		this.maxChunkSize = maxChunkSize;
-	}
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return FileSegment.class.isAssignableFrom(type);
-	}
-
-	@Override
-	public long getSize(FileSegment t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return t.to - t.from;
-	}
-
-	@Override
-	public void writeTo(FileSegment t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException,
-			WebApplicationException {
-		try {
-			int off = t.from;
-			while (off < t.to) {
-				byte[] buffer = t.file.getContents(off,
-						min(maxChunkSize, t.to - off));
-				if (buffer == null || buffer.length == 0)
-					break;
-				entityStream.write(buffer);
-				off += buffer.length;
-			}
-		} catch (FilesystemAccessException e) {
-			throw new IOException("problem when reading file", e);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FilesystemAccessHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FilesystemAccessHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FilesystemAccessHandler.java
deleted file mode 100644
index cfa863c..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/FilesystemAccessHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.FORBIDDEN;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.FilesystemAccessException;
-
-@Provider
-public class FilesystemAccessHandler extends HandlerCore implements
-		ExceptionMapper<FilesystemAccessException> {
-	@Override
-	public Response toResponse(FilesystemAccessException exn) {
-		return respond(FORBIDDEN, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/GeneralFailureHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/GeneralFailureHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/GeneralFailureHandler.java
deleted file mode 100644
index fe4ba0b..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/GeneralFailureHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.INTERNAL_SERVER_ERROR;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-
-import org.taverna.server.master.exceptions.GeneralFailureException;
-
-public class GeneralFailureHandler extends HandlerCore implements
-		ExceptionMapper<GeneralFailureException> {
-	@Override
-	public Response toResponse(GeneralFailureException exception) {
-		return respond(INTERNAL_SERVER_ERROR, exception);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/HandlerCore.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/HandlerCore.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/HandlerCore.java
deleted file mode 100644
index bc92154..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/HandlerCore.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.MediaType.TEXT_PLAIN_TYPE;
-import static javax.ws.rs.core.Response.status;
-import static org.apache.commons.logging.LogFactory.getLog;
-
-import javax.ws.rs.core.Response;
-
-import org.apache.commons.logging.Log;
-import org.taverna.server.master.api.ManagementModel;
-
-/**
- * Base class for handlers that grants Spring-enabled access to the management
- * model.
- * 
- * @author Donal Fellows
- */
-public class HandlerCore {
-	private Log log = getLog("Taverna.Server.Webapp");
-	private ManagementModel managementModel;
-
-	/**
-	 * @param managementModel
-	 *            the managementModel to set
-	 */
-	public void setManagementModel(ManagementModel managementModel) {
-		this.managementModel = managementModel;
-	}
-
-	/**
-	 * Simplified interface for building responses.
-	 * 
-	 * @param status
-	 *            What status code to use?
-	 * @param exception
-	 *            What exception to report on?
-	 * @return The build response.
-	 */
-	protected Response respond(Response.Status status, Exception exception) {
-		if (managementModel.getLogOutgoingExceptions()
-				|| status.getStatusCode() >= 500)
-			log.info("converting exception to response", exception);
-		return status(status).type(TEXT_PLAIN_TYPE)
-				.entity(exception.getMessage()).build();
-	}
-
-	/**
-	 * Simplified interface for building responses.
-	 * 
-	 * @param status
-	 *            What status code to use?
-	 * @param partialMessage
-	 *            The prefix to the message.
-	 * @param exception
-	 *            What exception to report on?
-	 * @return The build response.
-	 */
-	protected Response respond(Response.Status status, String partialMessage,
-			Exception exception) {
-		if (managementModel.getLogOutgoingExceptions()
-				|| status.getStatusCode() >= 500)
-			log.info("converting exception to response", exception);
-		return status(status).type(TEXT_PLAIN_TYPE)
-				.entity(partialMessage + "\n" + exception.getMessage()).build();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/IllegalArgumentHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/IllegalArgumentHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/IllegalArgumentHandler.java
deleted file mode 100644
index d7ec8f4..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/IllegalArgumentHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.UNSUPPORTED_MEDIA_TYPE;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-@Provider
-public class IllegalArgumentHandler extends HandlerCore implements
-		ExceptionMapper<IllegalArgumentException> {
-	@Override
-	public Response toResponse(IllegalArgumentException exn) {
-		return respond(UNSUPPORTED_MEDIA_TYPE, exn);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/ImplementationProblemHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/ImplementationProblemHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/ImplementationProblemHandler.java
deleted file mode 100644
index 806fc67..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/ImplementationProblemHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.INTERNAL_SERVER_ERROR;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-
-import org.taverna.server.localworker.remote.ImplementationException;
-
-public class ImplementationProblemHandler extends HandlerCore implements
-		ExceptionMapper<ImplementationException> {
-	@Override
-	public Response toResponse(ImplementationException exception) {
-		return respond(INTERNAL_SERVER_ERROR, exception);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/InputStreamMessageHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/InputStreamMessageHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/InputStreamMessageHandler.java
deleted file mode 100644
index 6b4470b..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/InputStreamMessageHandler.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.lang.Long.parseLong;
-import static javax.ws.rs.core.MediaType.APPLICATION_OCTET_STREAM;
-import static org.apache.commons.logging.LogFactory.getLog;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.Provider;
-
-import org.apache.commons.logging.Log;
-
-/**
- * Maps a stream from a client into a bounded ordinary input stream that the
- * webapp can work with more easily.
- * 
- * @author Donal Fellows
- */
-@Provider
-@Consumes(APPLICATION_OCTET_STREAM)
-public class InputStreamMessageHandler implements
-		MessageBodyReader<InputStream> {
-	@Override
-	public boolean isReadable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return InputStream.class.isAssignableFrom(type);
-	}
-
-	@Override
-	public InputStream readFrom(Class<InputStream> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-			throws IOException, WebApplicationException {
-		return new TransferStream(entityStream,
-				httpHeaders.get("Content-Length"));
-	}
-}
-
-/**
- * The actual transfer thunk.
- * 
- * @author Donal Fellows
- */
-class TransferStream extends InputStream {
-	private Log log = getLog("Taverna.Server.Handlers");
-
-	public TransferStream(InputStream entityStream, List<String> contentLength) {
-		this.entityStream = new BufferedInputStream(entityStream);
-		if (contentLength != null && contentLength.size() > 0) {
-			this.limit = parseLong(contentLength.get(0));
-			if (log.isDebugEnabled())
-				log.debug("will attempt to transfer " + this.limit + " bytes");
-		} else {
-			this.limit = -1;
-			if (log.isDebugEnabled())
-				log.debug("will attempt to transfer until EOF");
-		}
-	}
-
-	InputStream entityStream;
-	long limit;
-	long doneBytes = 0;
-
-	@Override
-	public int read() throws IOException {
-		if (limit >= 0 && doneBytes >= limit)
-			return -1;
-		int result = entityStream.read();
-		if (result >= 0)
-			doneBytes++;
-		return result;
-	}
-
-	@Override
-	public int read(byte[] ary, int off, int len) throws IOException {
-		if (limit >= 0) {
-			if (doneBytes >= limit)
-				return -1;
-			if (doneBytes + len > limit)
-				len = (int) (limit - doneBytes);
-		}
-		int readBytes = entityStream.read(ary, off, len);
-		if (readBytes >= 0)
-			doneBytes += readBytes;
-		return readBytes;
-	}
-
-	@Override
-	public void close() throws IOException {
-		entityStream.close();
-	}
-}
\ 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/taverna/server/master/rest/handler/InvalidCredentialHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/InvalidCredentialHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/InvalidCredentialHandler.java
deleted file mode 100644
index 7208aa4..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/InvalidCredentialHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.BAD_REQUEST;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.InvalidCredentialException;
-
-@Provider
-public class InvalidCredentialHandler extends HandlerCore implements
-		ExceptionMapper<InvalidCredentialException> {
-	@Override
-	public Response toResponse(InvalidCredentialException exn) {
-		return respond(BAD_REQUEST, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/JAXBExceptionHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/JAXBExceptionHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/JAXBExceptionHandler.java
deleted file mode 100644
index cf5952e..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/JAXBExceptionHandler.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.BAD_REQUEST;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-import javax.xml.bind.JAXBException;
-
-@Provider
-public class JAXBExceptionHandler extends HandlerCore implements
-		ExceptionMapper<JAXBException> {
-	@Override
-	public Response toResponse(JAXBException exn) {
-		return respond(BAD_REQUEST, "APIEpicFail: " + exn.getErrorCode(), exn);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NegotiationFailedHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NegotiationFailedHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NegotiationFailedHandler.java
deleted file mode 100644
index 00457fe..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NegotiationFailedHandler.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.MediaType.TEXT_PLAIN;
-import static javax.ws.rs.core.Response.notAcceptable;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.rest.TavernaServerDirectoryREST.NegotiationFailedException;
-
-@Provider
-public class NegotiationFailedHandler implements
-		ExceptionMapper<NegotiationFailedException> {
-	@Override
-	public Response toResponse(NegotiationFailedException exn) {
-		return notAcceptable(exn.accepted).type(TEXT_PLAIN)
-				.entity(exn.getMessage()).build();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoCreateHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoCreateHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoCreateHandler.java
deleted file mode 100644
index f20f876..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoCreateHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.SERVICE_UNAVAILABLE;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.NoCreateException;
-
-@Provider
-public class NoCreateHandler extends HandlerCore implements
-		ExceptionMapper<NoCreateException> {
-	@Override
-	public Response toResponse(NoCreateException exn) {
-		return respond(SERVICE_UNAVAILABLE, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/NoCredentialHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoCredentialHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoCredentialHandler.java
deleted file mode 100644
index 6644901..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoCredentialHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.NOT_FOUND;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-
-import org.taverna.server.master.exceptions.NoCredentialException;
-
-public class NoCredentialHandler extends HandlerCore implements
-		ExceptionMapper<NoCredentialException> {
-	@Override
-	public Response toResponse(NoCredentialException exn) {
-		return respond(NOT_FOUND, exn);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoDestroyHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoDestroyHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoDestroyHandler.java
deleted file mode 100644
index 2c0f5a9..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoDestroyHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.FORBIDDEN;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.NoDestroyException;
-
-@Provider
-public class NoDestroyHandler extends HandlerCore implements
-		ExceptionMapper<NoDestroyException> {
-	@Override
-	public Response toResponse(NoDestroyException exn) {
-		return respond(FORBIDDEN, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/NoDirectoryEntryHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoDirectoryEntryHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoDirectoryEntryHandler.java
deleted file mode 100644
index 2f72487..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoDirectoryEntryHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.NOT_FOUND;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.NoDirectoryEntryException;
-
-@Provider
-public class NoDirectoryEntryHandler extends HandlerCore implements
-		ExceptionMapper<NoDirectoryEntryException> {
-	@Override
-	public Response toResponse(NoDirectoryEntryException exn) {
-		return respond(NOT_FOUND, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/NoListenerHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoListenerHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoListenerHandler.java
deleted file mode 100644
index e119b60..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoListenerHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.BAD_REQUEST;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.NoListenerException;
-
-@Provider
-public class NoListenerHandler extends HandlerCore implements
-		ExceptionMapper<NoListenerException> {
-	@Override
-	public Response toResponse(NoListenerException exn) {
-		return respond(BAD_REQUEST, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/NoUpdateHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoUpdateHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoUpdateHandler.java
deleted file mode 100644
index 2d5dde3..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NoUpdateHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.FORBIDDEN;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.NoUpdateException;
-
-@Provider
-public class NoUpdateHandler extends HandlerCore implements
-		ExceptionMapper<NoUpdateException> {
-	@Override
-	public Response toResponse(NoUpdateException exn) {
-		return respond(FORBIDDEN, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/NotOwnerHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NotOwnerHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NotOwnerHandler.java
deleted file mode 100644
index baeb6aa..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/NotOwnerHandler.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.FORBIDDEN;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-
-import org.taverna.server.master.exceptions.NotOwnerException;
-
-public class NotOwnerHandler extends HandlerCore implements
-		ExceptionMapper<NotOwnerException> {
-	@Override
-	public Response toResponse(NotOwnerException exn) {
-		return respond(FORBIDDEN, exn);
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/OverloadedHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/OverloadedHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/OverloadedHandler.java
deleted file mode 100644
index 9e142f3..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/OverloadedHandler.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.SERVICE_UNAVAILABLE;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.OverloadedException;
-
-@Provider
-public class OverloadedHandler extends HandlerCore implements
-		ExceptionMapper<OverloadedException> {
-	@Override
-	public Response toResponse(OverloadedException exn) {
-		return respond(SERVICE_UNAVAILABLE, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/PermissionHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/PermissionHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/PermissionHandler.java
deleted file mode 100644
index d7a4afc..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/PermissionHandler.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.MediaType.TEXT_PLAIN_TYPE;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-
-import org.taverna.server.master.common.Permission;
-
-/**
- * Handler that allows CXF to send and receive {@linkplain Permission
- * permissions} as plain text directly.
- * 
- * @author Donal Fellows
- */
-public class PermissionHandler implements MessageBodyReader<Permission>,
-		MessageBodyWriter<Permission> {
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return type.isAssignableFrom(Permission.class)
-				&& mediaType.isCompatible(TEXT_PLAIN_TYPE);
-	}
-
-	@Override
-	public long getSize(Permission t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return t.toString().length();
-	}
-
-	@Override
-	public void writeTo(Permission t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException,
-			WebApplicationException {
-		new OutputStreamWriter(entityStream).write(t.toString());
-	}
-
-	@Override
-	public boolean isReadable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return type.isAssignableFrom(Permission.class)
-				&& mediaType.isCompatible(TEXT_PLAIN_TYPE);
-	}
-
-	@Override
-	public Permission readFrom(Class<Permission> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-			throws IOException, WebApplicationException {
-		char[] cbuf = new char[7];
-		int len = new InputStreamReader(entityStream).read(cbuf);
-		if (len < 0)
-			throw new IllegalArgumentException("no entity supplied");
-		return Permission.valueOf(new String(cbuf, 0, len));
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/Scufl2DocumentHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/Scufl2DocumentHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/Scufl2DocumentHandler.java
deleted file mode 100644
index cf1ccdf..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/Scufl2DocumentHandler.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.common.Workflow;
-
-import org.apache.taverna.scufl2.api.io.ReaderException;
-import org.apache.taverna.scufl2.api.io.WorkflowBundleIO;
-import org.apache.taverna.scufl2.api.io.WriterException;
-
-/**
- * Handler that allows a .scufl2 document to be read from and written to a REST
- * message directly.
- * 
- * @author Donal Fellows
- */
-@Provider
-public class Scufl2DocumentHandler implements MessageBodyReader<Workflow>,
-		MessageBodyWriter<Workflow> {
-	private static final MediaType SCUFL2_TYPE = new MediaType("application",
-			"vnd.taverna.scufl2.workflow-bundle");
-	public static final String SCUFL2 = "application/vnd.taverna.scufl2.workflow-bundle";
-	private WorkflowBundleIO io = new WorkflowBundleIO();
-
-	@Override
-	public boolean isReadable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		if (type.isAssignableFrom(Workflow.class))
-			return mediaType.isCompatible(SCUFL2_TYPE);
-		return false;
-	}
-
-	@Override
-	public Workflow readFrom(Class<Workflow> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-			throws IOException, WebApplicationException {
-		try {
-			return new Workflow(io.readBundle(entityStream, SCUFL2));
-		} catch (ReaderException e) {
-			throw new WebApplicationException(e, 403);
-		}
-	}
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		if (Workflow.class.isAssignableFrom(type))
-			return mediaType.isCompatible(SCUFL2_TYPE);
-		return false;
-	}
-
-	@Override
-	public long getSize(Workflow workflow, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return -1;
-	}
-
-	@Override
-	public void writeTo(Workflow workflow, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException,
-			WebApplicationException {
-		try {
-			io.writeBundle(workflow.getScufl2Workflow(), entityStream, SCUFL2);
-		} catch (WriterException e) {
-			throw new WebApplicationException(e);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/T2FlowDocumentHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/T2FlowDocumentHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/T2FlowDocumentHandler.java
deleted file mode 100644
index 1f6d328..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/T2FlowDocumentHandler.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.taverna.server.master.common.Workflow;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
-/**
- * Handler that allows a .t2flow document to be read from and written to a REST
- * message directly.
- * 
- * @author Donal Fellows
- */
-@Provider
-public class T2FlowDocumentHandler implements MessageBodyReader<Workflow>,
-		MessageBodyWriter<Workflow> {
-	private static final MediaType T2FLOW_TYPE = new MediaType("application",
-			"vnd.taverna.t2flow+xml");
-	public static final String T2FLOW = "application/vnd.taverna.t2flow+xml";
-	public static final String T2FLOW_ROOTNAME = "workflow";
-	public static final String T2FLOW_NS = "http://taverna.sf.net/2008/xml/t2flow";
-	private DocumentBuilderFactory db;
-	private TransformerFactory transformer;
-
-	public T2FlowDocumentHandler() throws ParserConfigurationException,
-			TransformerConfigurationException {
-		db = DocumentBuilderFactory.newInstance();
-		db.setNamespaceAware(true);
-		transformer = TransformerFactory.newInstance();
-	}
-
-	@Override
-	public boolean isReadable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		if (type.isAssignableFrom(Workflow.class))
-			return mediaType.isCompatible(T2FLOW_TYPE);
-		return false;
-	}
-
-	@Override
-	public Workflow readFrom(Class<Workflow> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-			throws IOException, WebApplicationException {
-		Document doc;
-		try {
-			doc = db.newDocumentBuilder().parse(entityStream);
-		} catch (SAXException e) {
-			throw new WebApplicationException(e, 403);
-		} catch (ParserConfigurationException e) {
-			throw new WebApplicationException(e);
-		}
-		Workflow workflow = new Workflow(doc.getDocumentElement());
-		if (doc.getDocumentElement().getNamespaceURI().equals(T2FLOW_NS)
-				&& doc.getDocumentElement().getNodeName()
-						.equals(T2FLOW_ROOTNAME))
-			return workflow;
-		throw new WebApplicationException(Response.status(403)
-				.entity("invalid T2flow document; bad root element")
-				.type("text/plain").build());
-	}
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		if (Workflow.class.isAssignableFrom(type))
-			return mediaType.isCompatible(T2FLOW_TYPE);
-		return false;
-	}
-
-	@Override
-	public long getSize(Workflow workflow, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return -1;
-	}
-
-	@Override
-	public void writeTo(Workflow workflow, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException,
-			WebApplicationException {
-		try {
-			transformer.newTransformer().transform(
-					new DOMSource(workflow.getT2flowWorkflow()),
-					new StreamResult(entityStream));
-		} catch (TransformerException e) {
-			if (e.getCause() != null && e.getCause() instanceof IOException)
-				throw (IOException) e.getCause();
-			throw new WebApplicationException(e);
-		}
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/URIListHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/URIListHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/URIListHandler.java
deleted file mode 100644
index 453ac73..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/URIListHandler.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.status;
-import static org.taverna.server.master.rest.handler.URIListHandler.URI_LIST;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyReader;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-
-/**
- * Deserialization and serialization engine for the <tt>{@value #URI_LIST}</tt>
- * content type.
- * 
- * @author Donal Fellows
- */
-@Provider
-@Consumes(URI_LIST)
-public class URIListHandler implements MessageBodyReader<List<URI>>,
-		MessageBodyWriter<List<URI>> {
-	/** The content type we handle. */
-	public static final String URI_LIST = "text/uri-list";
-	private static final MediaType URILIST = new MediaType("text", "uri-list");
-
-	@Override
-	public boolean isReadable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return type.isAssignableFrom(ArrayList.class)
-				&& genericType instanceof ParameterizedType
-				&& ((Class<?>) ((ParameterizedType) genericType)
-						.getActualTypeArguments()[0])
-						.isAssignableFrom(URI.class)
-				&& URILIST.isCompatible(mediaType);
-	}
-
-	@Override
-	public List<URI> readFrom(Class<List<URI>> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, String> httpHeaders, InputStream entityStream)
-			throws IOException, WebApplicationException {
-		String enc = mediaType.getParameters().get("encoding");
-		Charset c = (enc == null) ? Charset.defaultCharset() : Charset
-				.forName(enc);
-		BufferedReader br = new BufferedReader(new InputStreamReader(
-				entityStream, c));
-		ArrayList<URI> uris = new ArrayList<>();
-		String line;
-		while ((line = br.readLine()) != null) {
-			if (line.startsWith("#"))
-				continue;
-			try {
-				uris.add(new URI(line));
-			} catch (URISyntaxException e) {
-				throw new WebApplicationException(e, status(422).entity(
-						"ill-formed URI").build());
-			}
-		}
-		return uris;
-	}
-
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return List.class.isAssignableFrom(type)
-				&& genericType instanceof ParameterizedType
-				&& ((ParameterizedType) genericType).getActualTypeArguments()[0] == URI.class
-				&& URILIST.isCompatible(mediaType);
-	}
-
-	@Override
-	public long getSize(List<URI> list, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return -1;
-	}
-
-	private static final String PREFERRED_ENCODING = "UTF-8";
-
-	@Override
-	public void writeTo(List<URI> list, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException {
-		String encoding = mediaType.getParameters().get("encoding");
-		if (encoding == null) {
-			encoding = PREFERRED_ENCODING;
-			httpHeaders.putSingle("Content-Type", URI_LIST + ";encoding="
-					+ encoding);
-		}
-		BufferedWriter w = new BufferedWriter(new OutputStreamWriter(
-				entityStream, encoding));
-		for (URI uri : list) {
-			w.write(uri.toString());
-			w.newLine();
-		}
-		w.flush();
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/00397eff/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/UnknownRunHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/UnknownRunHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/UnknownRunHandler.java
deleted file mode 100644
index 4d5c6e8..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/UnknownRunHandler.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.Response.Status.NOT_FOUND;
-
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.exceptions.UnknownRunException;
-
-@Provider
-public class UnknownRunHandler extends HandlerCore implements
-		ExceptionMapper<UnknownRunException> {
-	@Override
-	public Response toResponse(UnknownRunException exn) {
-		return respond(NOT_FOUND, exn);
-	}
-}
\ 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/taverna/server/master/rest/handler/ZipStreamHandler.java
----------------------------------------------------------------------
diff --git a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/ZipStreamHandler.java b/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/ZipStreamHandler.java
deleted file mode 100644
index 69e526d..0000000
--- a/taverna-server-webapp/src/main/java/org/taverna/server/master/rest/handler/ZipStreamHandler.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- */
-package org.taverna.server.master.rest.handler;
-/*
- * 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.io.IOUtils.copy;
-import static org.taverna.server.master.api.ContentTypes.APPLICATION_ZIP_TYPE;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.ws.rs.Produces;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-
-import org.taverna.server.master.interfaces.Directory.ZipStream;
-
-/**
- * How to write a ZIP file as the result entity of a request.
- * 
- * @author Donal Fellows
- */
-@Provider
-@Produces("application/zip")
-public class ZipStreamHandler implements MessageBodyWriter<ZipStream> {
-	@Override
-	public boolean isWriteable(Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return ZipStream.class.isAssignableFrom(type)
-				&& mediaType.equals(APPLICATION_ZIP_TYPE);
-	}
-
-	@Override
-	public long getSize(ZipStream t, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType) {
-		return -1;
-	}
-
-	@Override
-	public void writeTo(ZipStream zipStream, Class<?> type, Type genericType,
-			Annotation[] annotations, MediaType mediaType,
-			MultivaluedMap<String, Object> httpHeaders,
-			OutputStream entityStream) throws IOException,
-			WebApplicationException {
-		copy(zipStream, entityStream);
-	}
-}