[Mulgara-svn] r476 - in branches/nw-interface/src/jar: itql/java/org/mulgara/itql query/java/org/mulgara/query/operation
pag at mulgara.org
pag at mulgara.org
Thu Oct 11 20:25:22 UTC 2007
Author: pag
Date: 2007-10-11 15:25:22 -0500 (Thu, 11 Oct 2007)
New Revision: 476
Modified:
branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBean.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/Backup.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/DataTx.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/Restore.java
Log:
Moved serverURI extraction from Backup to DataTx. Also, only Restore overrides getServerUri now, while Load uses the default method.
Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBean.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBean.java 2007-10-11 17:14:53 UTC (rev 475)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/itql/ItqlInterpreterBean.java 2007-10-11 20:25:22 UTC (rev 476)
@@ -57,6 +57,7 @@
import org.mulgara.query.TuplesException;
import org.mulgara.query.operation.Backup;
import org.mulgara.query.operation.Command;
+import org.mulgara.query.operation.DataTx;
import org.mulgara.query.operation.Load;
import org.mulgara.query.operation.Restore;
import org.mulgara.query.rdf.LiteralImpl;
@@ -388,7 +389,8 @@
// TODO REMOVE Constants.FAULT_CODE_SERVER,
log.error("Execute query failed. Returning error", interpreter.getLastException());
throw new SOAPException("ItqlInterpreter error - " +
- ItqlUtil.getCause(interpreter.getLastException(), 0));
+ ItqlUtil.getCause(interpreter.getLastException(), 0) + EOL +
+ "Query: [" + singleQuery + "]");
}
// Ensure answer is null.
answer = null;
@@ -770,7 +772,7 @@
* @throws QueryException if the backup cannot be completed.
*/
public void backup(URI sourceURI, OutputStream outputStream) throws QueryException {
- URI serverUri = Backup.calcServerUri(sourceURI);
+ URI serverUri = DataTx.calcServerUri(sourceURI);
try {
Connection conn = interpreter.establishConnection(serverUri);
Backup.backup(conn, sourceURI, outputStream);
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/Backup.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/Backup.java 2007-10-11 17:14:53 UTC (rev 475)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/Backup.java 2007-10-11 20:25:22 UTC (rev 476)
@@ -18,7 +18,6 @@
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URI;
-import java.net.URISyntaxException;
import java.rmi.NoSuchObjectException;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
@@ -149,29 +148,4 @@
serverUri = calcServerUri(uri);
return serverUri;
}
-
-
- /**
- * Determine the URI to be used for a server when processing a backup.
- * @param uri Can contain the URI of a graph, or of an entire server.
- * @return The URI for the server containing the uri.
- */
- public static URI calcServerUri(URI uri) {
- URI calcUri = null;
-
- // check if backing up a graph or a server
- String fragment = uri.getFragment();
- if (fragment == null) {
- if (logger.isDebugEnabled()) logger.debug("Backup for server: " + uri);
- calcUri = uri;
- } else {
- String serverUriString = uri.toString().replaceAll("#" + fragment, "");
- try {
- calcUri = new URI(serverUriString);
- } catch (URISyntaxException e) {
- throw new Error("Unable to truncate a fragment from a valid URI");
- }
- }
- return calcUri;
- }
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/DataTx.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/DataTx.java 2007-10-11 17:14:53 UTC (rev 475)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/DataTx.java 2007-10-11 20:25:22 UTC (rev 476)
@@ -14,6 +14,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
+import java.net.URISyntaxException;
import java.net.URL;
import java.rmi.NoSuchObjectException;
import java.rmi.server.UnicastRemoteObject;
@@ -83,13 +84,6 @@
}
/**
- * @return The URI of the destination graph.
- */
- public URI getServerURI() throws UnsupportedOperationException {
- return destination;
- }
-
- /**
* @return the URI of the source data.
*/
public URI getSource() {
@@ -185,5 +179,30 @@
assert stream != null;
return stream;
}
+
+ /**
+ * Determine the URI to be used for a server when processing a backup.
+ * @param uri Can contain the URI of a graph, or of an entire server.
+ * @return The URI for the server containing the uri.
+ */
+ public static URI calcServerUri(URI uri) {
+ URI calcUri = null;
+
+ // check if backing up a graph or a server
+ String fragment = uri.getFragment();
+ if (fragment == null) {
+ if (logger.isDebugEnabled()) logger.debug("Backup for server: " + uri);
+ calcUri = uri;
+ } else {
+ String serverUriString = uri.toString().replaceAll("#" + fragment, "");
+ try {
+ calcUri = new URI(serverUriString);
+ } catch (URISyntaxException e) {
+ throw new Error("Unable to truncate a fragment from a valid URI");
+ }
+ }
+ return calcUri;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/Restore.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/Restore.java 2007-10-11 17:14:53 UTC (rev 475)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/operation/Restore.java 2007-10-11 20:25:22 UTC (rev 476)
@@ -32,6 +32,13 @@
super(source, destination, local);
}
+ /**
+ * The destination of a restore command is a database, not a graph.
+ * @return The URI of the destination server.
+ */
+ public URI getServerURI() {
+ return getDestination();
+ }
/**
* Restore the data into the destination graph through the given connection.
More information about the Mulgara-svn
mailing list