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

[26/50] [abbrv] incubator-taverna-server git commit: Fix compilation

Fix compilation

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

Branch: refs/heads/master
Commit: 7c0134d3903489b1517478bbbb6ed93f30366c06
Parents: ad1aa3b
Author: Donal Fellows <do...@manchester.ac.uk>
Authored: Sun May 11 21:28:05 2014 +0100
Committer: Donal Fellows <do...@manchester.ac.uk>
Committed: Sun May 11 21:28:05 2014 +0100

----------------------------------------------------------------------
 .../taverna/server/master/DirectoryREST.java    | 59 +------------------
 .../java/org/taverna/server/master/RunREST.java |  6 ++
 .../taverna/server/master/TavernaServer.java    | 60 ++++++++++++++++++++
 .../master/rest/TavernaServerDirectoryREST.java | 29 ----------
 .../server/master/soap/TavernaServerSOAP.java   | 19 +------
 .../utils/WSDLHeadOptionsInterceptor.java       |  3 +-
 6 files changed, 71 insertions(+), 105 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/7c0134d3/server-webapp/src/main/java/org/taverna/server/master/DirectoryREST.java
----------------------------------------------------------------------
diff --git a/server-webapp/src/main/java/org/taverna/server/master/DirectoryREST.java b/server-webapp/src/main/java/org/taverna/server/master/DirectoryREST.java
index 116014b..5bd6f30 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/DirectoryREST.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/DirectoryREST.java
@@ -341,6 +341,7 @@ class DirectoryREST implements TavernaServerDirectoryREST, DirectoryBean {
 			List<URI> referenceList, UriInfo ui)
 			throws NoDirectoryEntryException, NoUpdateException,
 			FilesystemAccessException {
+		support.permitUpdate(run);
 		if (referenceList.isEmpty() || referenceList.size() > 1)
 			return status(422).entity("URI list must have single URI in it")
 					.build();
@@ -369,62 +370,4 @@ class DirectoryREST implements TavernaServerDirectoryREST, DirectoryBean {
 		else
 			return noContent().build();
 	}
-
-	@Override
-	@CallCounted
-	public Response setFileContentsFromURL(List<PathSegment> filePath,
-			List<URI> referenceList, UriInfo ui)
-			throws NoDirectoryEntryException, NoUpdateException,
-			FilesystemAccessException {
-		support.permitUpdate(run);
-		Directory d;
-		String name;
-		if (filePath == null || filePath.size() == 0)
-			throw new FilesystemAccessException(
-					"Cannot create a file that is not in a directory.");
-
-		List<PathSegment> dirPath = new ArrayList<PathSegment>(filePath);
-		name = dirPath.remove(dirPath.size() - 1).getPath();
-		DirectoryEntry de = fileUtils.getDirEntry(run, dirPath);
-		if (!(de instanceof Directory)) {
-			throw new FilesystemAccessException(
-					"Cannot create a file that is not in a directory.");
-		}
-		d = (Directory) de;
-
-		File f = null;
-		boolean isNew = false;
-		for (DirectoryEntry e : d.getContents()) {
-			if (e.getName().equals(name)) {
-				if (e instanceof File) {
-					f = (File) e;
-					break;
-				}
-				throw new FilesystemAccessException(
-						"Cannot create a file that is not in a directory.");
-			}
-		}
-
-		if (referenceList.isEmpty() || referenceList.size() > 1)
-			return status(422).entity("URI list must have single URI in it")
-					.build();
-		;
-
-		if (f == null) {
-			f = d.makeEmptyFile(support.getPrincipal(), name);
-			isNew = true;
-		}
-		try {
-			support.copyDataToFile(referenceList.get(0), f);
-		} catch (MalformedURLException ex) {
-			throw new NoUpdateException("failed to parse URI", ex);
-		} catch (IOException ex) {
-			throw new FilesystemAccessException("failed to transfer data from URI", ex);
-		}
-
-		if (isNew)
-			return created(ui.getAbsolutePath()).build();
-		else
-			return noContent().build();
-	}
 }

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/7c0134d3/server-webapp/src/main/java/org/taverna/server/master/RunREST.java
----------------------------------------------------------------------
diff --git a/server-webapp/src/main/java/org/taverna/server/master/RunREST.java b/server-webapp/src/main/java/org/taverna/server/master/RunREST.java
index 8b948d3..eb7b38e 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/RunREST.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/RunREST.java
@@ -413,6 +413,12 @@ abstract class RunREST implements TavernaServerRunREST, RunBean {
 
 	@Override
 	@CallCounted
+	public Response profileOptions() {
+		return opt();
+	}
+
+	@Override
+	@CallCounted
 	public Response expiryOptions() {
 		return opt("PUT");
 	}

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/7c0134d3/server-webapp/src/main/java/org/taverna/server/master/TavernaServer.java
----------------------------------------------------------------------
diff --git a/server-webapp/src/main/java/org/taverna/server/master/TavernaServer.java b/server-webapp/src/main/java/org/taverna/server/master/TavernaServer.java
index b8e5a22..7c83c75 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/TavernaServer.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/TavernaServer.java
@@ -60,8 +60,10 @@ import org.taverna.server.master.api.SupportAware;
 import org.taverna.server.master.api.TavernaServerBean;
 import org.taverna.server.master.common.Capability;
 import org.taverna.server.master.common.Credential;
+import org.taverna.server.master.common.DirEntryReference;
 import org.taverna.server.master.common.InputDescription;
 import org.taverna.server.master.common.Permission;
+import org.taverna.server.master.common.ProfileList;
 import org.taverna.server.master.common.RunReference;
 import org.taverna.server.master.common.Status;
 import org.taverna.server.master.common.Trust;
@@ -101,6 +103,7 @@ import org.taverna.server.master.soap.DirEntry;
 import org.taverna.server.master.soap.FileContents;
 import org.taverna.server.master.soap.PermissionList;
 import org.taverna.server.master.soap.TavernaServerSOAP;
+import org.taverna.server.master.soap.WrappedWorkflow;
 import org.taverna.server.master.soap.ZippedDirectory;
 import org.taverna.server.master.utils.CallTimeLogger.PerfLogged;
 import org.taverna.server.master.utils.FilenameUtils;
@@ -380,6 +383,23 @@ public abstract class TavernaServer implements TavernaServerSOAP,
 	@CallCounted
 	@PerfLogged
 	@RolesAllowed(USER)
+	public RunReference submitWorkflowMTOM(WrappedWorkflow workflow)
+			throws NoUpdateException {
+		Workflow wf;
+		try {
+			wf = workflow.getWorkflow();
+		} catch (IOException e) {
+			throw new NoCreateException(e.getMessage(), e);
+		}
+		checkCreatePolicy(wf);
+		String name = support.buildWorkflow(wf);
+		return new RunReference(name, getRunUriBuilder());
+	}
+
+	@Override
+	@CallCounted
+	@PerfLogged
+	@RolesAllowed(USER)
 	public RunReference submitWorkflowByURI(URI workflowURI)
 			throws NoCreateException {
 		checkCreatePolicy(workflowURI);
@@ -465,6 +485,27 @@ public abstract class TavernaServer implements TavernaServerSOAP,
 	@CallCounted
 	@PerfLogged
 	@RolesAllowed(USER)
+	public WrappedWorkflow getRunWorkflowMTOM(String runName)
+			throws UnknownRunException {
+		WrappedWorkflow ww = new WrappedWorkflow();
+		ww.setWorkflow(support.getRun(runName).getWorkflow());
+		return ww;
+	}
+
+	@Override
+	@CallCounted
+	@PerfLogged
+	@RolesAllowed(USER)
+	public ProfileList getRunWorkflowProfiles(String runName)
+			throws UnknownRunException {
+		return support.getProfileDescriptor(support.getRun(runName)
+				.getWorkflow());
+	}
+
+	@Override
+	@CallCounted
+	@PerfLogged
+	@RolesAllowed(USER)
 	public Date getRunExpiry(String runName) throws UnknownRunException {
 		return support.getRun(runName).getExpiry();
 	}
@@ -956,6 +997,25 @@ public abstract class TavernaServer implements TavernaServerSOAP,
 	@CallCounted
 	@PerfLogged
 	@RolesAllowed(USER)
+	public void setRunFileContentsFromURI(String runName,
+			DirEntryReference file, URI reference)
+			throws UnknownRunException, NoUpdateException,
+			FilesystemAccessException, NoDirectoryEntryException {
+		TavernaRun run = support.getRun(runName);
+		support.permitUpdate(run);
+		File f = fileUtils.getFile(run, file);
+		try {
+			support.copyDataToFile(reference, f);
+		} catch (IOException e) {
+			throw new FilesystemAccessException(
+					"problem transferring data from URI", e);
+		}
+	}
+
+	@Override
+	@CallCounted
+	@PerfLogged
+	@RolesAllowed(USER)
 	public void setRunFileContentsMTOM(String runName, FileContents newContents)
 			throws UnknownRunException, NoUpdateException,
 			FilesystemAccessException, NoDirectoryEntryException {

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/7c0134d3/server-webapp/src/main/java/org/taverna/server/master/rest/TavernaServerDirectoryREST.java
----------------------------------------------------------------------
diff --git a/server-webapp/src/main/java/org/taverna/server/master/rest/TavernaServerDirectoryREST.java b/server-webapp/src/main/java/org/taverna/server/master/rest/TavernaServerDirectoryREST.java
index bf72d9c..ea2f776 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/rest/TavernaServerDirectoryREST.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/rest/TavernaServerDirectoryREST.java
@@ -200,35 +200,6 @@ public interface TavernaServerDirectoryREST {
 			FilesystemAccessException;
 
 	/**
-	 * Creates or updates a file in a particular location beneath the working
-	 * directory of the workflow run.
-	 * 
-	 * @param file
-	 *            The path to the file to create or update.
-	 * @param referenceList
-	 *            Location to get the file's contents from. Must be <i>publicly</i>
-	 *            readable.
-	 * @param ui
-	 *            About how this method was called.
-	 * @return An HTTP response indicating what file was created/updated.
-	 * @throws NoDirectoryEntryException
-	 *             If the name of the containing directory can't be looked up.
-	 * @throws NoUpdateException
-	 *             If the user is not permitted to update the run.
-	 * @throws FilesystemAccessException
-	 *             If something went wrong during the filesystem operation.
-	 */
-	@POST
-	@Path("{path:(.*)}")
-	@Consumes("text/uri-list")
-	@Description("Creates or updates a file in a particular location beneath the working directory of the workflow run with the contents of a publicly readable URL.")
-	@NonNull
-	Response setFileContentsFromURL(@PathParam("path") List<PathSegment> file,
-			List<URI> referenceList, @Context UriInfo ui)
-			throws NoDirectoryEntryException, NoUpdateException,
-			FilesystemAccessException;
-
-	/**
 	 * Deletes a file or directory that is in or below the working directory of
 	 * a workflow run.
 	 * 

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/7c0134d3/server-webapp/src/main/java/org/taverna/server/master/soap/TavernaServerSOAP.java
----------------------------------------------------------------------
diff --git a/server-webapp/src/main/java/org/taverna/server/master/soap/TavernaServerSOAP.java b/server-webapp/src/main/java/org/taverna/server/master/soap/TavernaServerSOAP.java
index 69bca0f..e175bf8 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/soap/TavernaServerSOAP.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/soap/TavernaServerSOAP.java
@@ -9,7 +9,6 @@ import static org.taverna.server.master.common.Namespaces.SERVER_SOAP;
 import static org.taverna.server.master.common.Roles.USER;
 
 import java.net.URI;
-import java.net.URL;
 import java.util.Date;
 import java.util.List;
 
@@ -89,21 +88,6 @@ public interface TavernaServerSOAP {
 			throws NoUpdateException;
 
 	/**
-	 * Make a run for a workflow at a particular URL.
-	 * 
-	 * @param workflowURL
-	 *            The public URL of the workflow to instantiate.
-	 * @return Annotated handle for created run.
-	 * @throws NoUpdateException
-	 * @throws NoCreateException
-	 */
-	@WebResult(name = "Run")
-	@WSDLDocumentation("Make a run for a workflow at a particular public URL.")
-	RunReference submitWorkflowReference(
-			@WebParam(name = "reference") @XmlElement(required = true) URL workflowURL)
-			throws NoUpdateException, NoCreateException;
-
-	/**
 	 * Make a run for a particular workflow, where that workflow will be
 	 * downloaded from elsewhere. The URI <i>must</i> be publicly readable.
 	 * 
@@ -114,7 +98,8 @@ public interface TavernaServerSOAP {
 	 * @throws NoCreateException
 	 */
 	@WebResult(name = "Run")
-	@WSDLDocumentation("Make a run for a particular workflow where that workflow is given by publicly readable URI.")
+	@WSDLDocumentation("Make a run for a particular workflow where that "
+			+ "workflow is given by publicly readable URI.")
 	RunReference submitWorkflowByURI(
 			@WebParam(name = "workflowURI") @XmlElement(required = true) URI workflowURI)
 			throws NoCreateException, NoUpdateException;

http://git-wip-us.apache.org/repos/asf/incubator-taverna-server/blob/7c0134d3/server-webapp/src/main/java/org/taverna/server/master/utils/WSDLHeadOptionsInterceptor.java
----------------------------------------------------------------------
diff --git a/server-webapp/src/main/java/org/taverna/server/master/utils/WSDLHeadOptionsInterceptor.java b/server-webapp/src/main/java/org/taverna/server/master/utils/WSDLHeadOptionsInterceptor.java
index ca4ecba..96cdc6d 100644
--- a/server-webapp/src/main/java/org/taverna/server/master/utils/WSDLHeadOptionsInterceptor.java
+++ b/server-webapp/src/main/java/org/taverna/server/master/utils/WSDLHeadOptionsInterceptor.java
@@ -1,11 +1,11 @@
 package org.taverna.server.master.utils;
 
 import static org.apache.commons.logging.LogFactory.getLog;
+import static org.apache.cxf.common.util.UrlUtils.parseQueryString;
 import static org.apache.cxf.message.Message.HTTP_REQUEST_METHOD;
 import static org.apache.cxf.message.Message.QUERY_STRING;
 import static org.apache.cxf.message.Message.REQUEST_URL;
 import static org.apache.cxf.phase.Phase.READ;
-import static org.apache.cxf.transport.http.UrlUtilities.parseQueryString;
 
 import java.util.Map;
 
@@ -15,6 +15,7 @@ import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.phase.AbstractPhaseInterceptor;
 
+
 /**
  * Thunk for TAVSERV-293.
  *