diff --git a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/InternalTransferAction.java b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/InternalTransferAction.java index 371106f2..356132be 100644 --- a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/InternalTransferAction.java +++ b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/InternalTransferAction.java @@ -177,7 +177,7 @@ public void doAction() throws Exception { String srcPath = Utils.getPath(srcNode); String destPath = Utils.getPath(destContainer); if (destPath.contains(srcPath)) { - throw NodeFault.ContainerNotFound.getStatus( + throw NodeFault.InvalidArgument.getStatus( "Cannot move container node into its descendants: source " + "path " + srcPath + " in resolved path " + destPath); } diff --git a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PullToVOSpaceAction.java b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PullToVOSpaceAction.java index c0e1e388..183f968e 100644 --- a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PullToVOSpaceAction.java +++ b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PullToVOSpaceAction.java @@ -3,7 +3,7 @@ ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** * -* (c) 2011. (c) 2011. +* (c) 2024. (c) 2024. * Government of Canada Gouvernement du Canada * National Research Council Conseil national de recherches * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 @@ -69,19 +69,11 @@ package org.opencadc.vospace.server.transfers; -import ca.nrc.cadc.net.TransientException; import ca.nrc.cadc.uws.Job; -import ca.nrc.cadc.uws.server.JobNotFoundException; -import ca.nrc.cadc.uws.server.JobPersistenceException; import ca.nrc.cadc.uws.server.JobUpdater; -import java.io.IOException; -import java.net.URISyntaxException; -import org.opencadc.vospace.LinkingException; -import org.opencadc.vospace.NodeNotFoundException; import org.opencadc.vospace.server.NodePersistence; import org.opencadc.vospace.transfer.Direction; import org.opencadc.vospace.transfer.Transfer; -import org.opencadc.vospace.transfer.TransferParsingException; /** * @@ -93,10 +85,7 @@ public PullToVOSpaceAction(NodePersistence per, JobUpdater ju, Job job, Transfer super(per, ju, job, transfer); } - public void doAction() - throws JobPersistenceException, JobNotFoundException, - LinkingException, NodeNotFoundException, TransferParsingException, - IOException, TransientException, URISyntaxException { + public void doAction() throws Exception { throw new UnsupportedOperationException(Direction.pullToVoSpaceValue + " not implemented"); } } diff --git a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PushFromVOSpaceAction.java b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PushFromVOSpaceAction.java index 8d1e112e..25fd2ad8 100644 --- a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PushFromVOSpaceAction.java +++ b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PushFromVOSpaceAction.java @@ -3,7 +3,7 @@ ******************* CANADIAN ASTRONOMY DATA CENTRE ******************* ************** CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES ************** * -* (c) 2011. (c) 2011. +* (c) 2024. (c) 2024. * Government of Canada Gouvernement du Canada * National Research Council Conseil national de recherches * Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6 @@ -69,19 +69,11 @@ package org.opencadc.vospace.server.transfers; -import ca.nrc.cadc.net.TransientException; import ca.nrc.cadc.uws.Job; -import ca.nrc.cadc.uws.server.JobNotFoundException; -import ca.nrc.cadc.uws.server.JobPersistenceException; import ca.nrc.cadc.uws.server.JobUpdater; -import java.io.IOException; -import java.net.URISyntaxException; -import org.opencadc.vospace.LinkingException; -import org.opencadc.vospace.NodeNotFoundException; import org.opencadc.vospace.server.NodePersistence; import org.opencadc.vospace.transfer.Direction; import org.opencadc.vospace.transfer.Transfer; -import org.opencadc.vospace.transfer.TransferParsingException; /** * @@ -93,10 +85,7 @@ public PushFromVOSpaceAction(NodePersistence per, JobUpdater ju, Job job, Transf super(per, ju, job, transfer); } - public void doAction() - throws JobPersistenceException, JobNotFoundException, - LinkingException, NodeNotFoundException, TransferParsingException, - IOException, TransientException, URISyntaxException { + public void doAction() throws Exception { throw new UnsupportedOperationException(Direction.pushFromVoSpaceValue + " not implemented"); } } diff --git a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PushToVOSpaceNegotiation.java b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PushToVOSpaceNegotiation.java index 528b41ca..639fe6b9 100644 --- a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PushToVOSpaceNegotiation.java +++ b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/PushToVOSpaceNegotiation.java @@ -164,69 +164,4 @@ public void doAction() } } } - - /* - private Node resolveNodeForWrite(VOSpaceAuthorizer voSpaceAuthorizer, - NodePersistence nodePer, VOSURI uri, - Class newNodeType, boolean persist, boolean resolveLeafNode, boolean allowWriteToLink) - throws NodeNotFoundException, LinkingException, FileNotFoundException, URISyntaxException, TransientException { - try { - - Node result = resolveNodeForRead(voSpaceAuthorizer, nodePer, uri, resolveLeafNode); - try { - result = (Node) voSpaceAuthorizer.getWritePermission(result); - - // check to ensure the parent node isn't locked - if (result.getParent() != null && result.getParent().isLocked()) { - throw new NodeLockedException(result.getParent().getUri().toString()); - } - - return result; - } catch (NodeLockedException e) { - // allow the DuplicateNode exception to happen later if this is a link node - if (!allowWriteToLink && result != null && result instanceof LinkNode) { - return result; - } - throw e; - } - - } catch (NodeNotFoundException ex) { - // this could be a new file. - Node pn = resolveNodeForRead(voSpaceAuthorizer, nodePer, - uri.getParentURI(), true); - // parent node exists - if (!(pn instanceof ContainerNode)) { - throw new IllegalArgumentException( - "parent is not a ContainerNode: " - + pn.getUri().getURI() - .toASCIIString()); - } - voSpaceAuthorizer.getWritePermission(pn); - // create the new DataNode - - try { - Node newNode = null; - if (newNodeType.equals(DataNode.class)) { - newNode = new DataNode(new VOSURI(pn.getUri() - + "/" + uri.getName())); - } else if (newNodeType.equals(ContainerNode.class)) { - newNode = new ContainerNode(new VOSURI(pn.getUri() - + "/" + uri.getName())); - } else { - throw new IllegalArgumentException( - "BUG: Only DataNode and ContainerNode supported"); - } - newNode.setParent((ContainerNode) pn); - if (persist) { - nodePer.put(newNode); - } - return newNode; - } catch (NodeNotSupportedException e2) { - throw new IllegalArgumentException( - "node type not supported.", e2); - } - - } - } - */ } diff --git a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/TransferRunner.java b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/TransferRunner.java index 9b8d1848..4f44cce4 100644 --- a/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/TransferRunner.java +++ b/cadc-vos-server/src/main/java/org/opencadc/vospace/server/transfers/TransferRunner.java @@ -313,23 +313,20 @@ private void doit() { sendError(job.getExecutionPhase(), ErrorType.FATAL, "NotAuthenticated", HttpURLConnection.HTTP_UNAUTHORIZED, true); return; } catch (IllegalArgumentException ex) { - // target node was not a DataNode - String msg = "Invalid Argument (target node is not a DataNode)"; + // target not valid for specified operation + String msg = ex.getMessage(); log.debug(msg, ex); sendError(job.getExecutionPhase(), ErrorType.FATAL, msg, HttpURLConnection.HTTP_BAD_REQUEST, true); return; } catch (LinkingException link) { - String msg = "Link Exception: " + link.getMessage(); + String msg = link.getMessage(); log.debug(msg, link); - // now set the job to error sendError(job.getExecutionPhase(), ErrorType.FATAL, msg, HttpURLConnection.HTTP_BAD_REQUEST, true); return; } catch (UnsupportedOperationException ex) { - ex.printStackTrace(); - String msg = "Unsupported Operation: " + ex.getMessage(); + String msg = ex.getMessage(); log.debug(msg, ex); - // now set the job to error - sendError(job.getExecutionPhase(), ErrorType.FATAL, msg, HttpURLConnection.HTTP_NOT_IMPLEMENTED, true); + sendError(job.getExecutionPhase(), ErrorType.FATAL, msg, HttpURLConnection.HTTP_BAD_METHOD, true); return; } } catch (TransientException e) { diff --git a/cavern/src/main/webapp/WEB-INF/web.xml b/cavern/src/main/webapp/WEB-INF/web.xml index 70c42fef..79a9d9b3 100644 --- a/cavern/src/main/webapp/WEB-INF/web.xml +++ b/cavern/src/main/webapp/WEB-INF/web.xml @@ -32,14 +32,6 @@ ca.nrc.cadc.auth ca.nrc.cadc.uws - - - logAccessGroup - ivo://cadc.nrc.ca/gms?CADC - - - groupAuthorizer - ca.nrc.cadc.ac.client.GroupAuthorizer 1