[Mulgara-svn] r370 - in branches/nw-interface/src/jar/query/java/org/mulgara/query: . ast
pag at mulgara.org
pag at mulgara.org
Thu Aug 23 12:10:10 UTC 2007
Author: pag
Date: 2007-08-23 07:10:10 -0500 (Thu, 23 Aug 2007)
New Revision: 370
Added:
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Command.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalCommand.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ServerCommand.java
Removed:
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CommandAst.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalAst.java
Modified:
branches/nw-interface/src/jar/query/java/org/mulgara/query/Query.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ApplyRules.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Backup.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Commit.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CreateGraph.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/DataTx.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Deletion.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/DropGraph.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ExecuteScript.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Help.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Insertion.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Load.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Modification.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Quit.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Restore.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Rollback.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetAutoCommit.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetCommand.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetTime.java
branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetUser.java
Log:
Some updates to make the AST cleaner and allow each element to run on their own. Haven't yet finalized the interfaces (particularly execute())
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/Query.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/Query.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/Query.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -34,7 +34,7 @@
// Third party packages
import org.apache.log4j.*;
-import org.mulgara.query.ast.CommandAst;
+import org.mulgara.query.ast.Command;
/**
* An ITQL query. This is a data structure used as an argument to the
@@ -57,7 +57,7 @@
*
* @licence <a href="{@docRoot}/../../LICENCE">Mozilla Public License v1.1</a>
*/
-public class Query implements Cloneable, Serializable, CommandAst {
+public class Query implements Cloneable, Serializable, Command {
/**
* Allow newer compiled version of the stub to operate when changes
@@ -543,4 +543,9 @@
Set<URI> dbURIs = getModelExpression().getDatabaseURIs();
return dbURIs.isEmpty() ? null : dbURIs.iterator().next();
}
+
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ApplyRules.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ApplyRules.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ApplyRules.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -21,7 +21,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class ApplyRules implements CommandAst {
+public class ApplyRules extends ServerCommand {
/** The graph containing the rules to be run. */
private URI ruleGraph;
@@ -39,35 +39,13 @@
* @param destGraph The graph to put the rule productions into.
*/
public ApplyRules(URI ruleGraph, URI baseGraph, URI destGraph) {
+ super(destGraph);
this.ruleGraph = ruleGraph;
this.baseGraph = baseGraph;
this.destGraph = destGraph;
}
/**
- * @return The URI of the graph containing rule productions.
- */
- public URI getServerURI() throws UnsupportedOperationException {
- return destGraph;
- }
-
- /**
- * Returns false to indicate that this is a server-side operation.
- * @return Always <code>false</code>
- */
- public boolean isLocalOperation() {
- return false;
- }
-
- /**
- * Returns false to indicate that this operation is not tied to a UI.
- * @return Always <code>false</code>
- */
- public boolean isUICommand() {
- return false;
- }
-
- /**
* @return the ruleGraph
*/
public URI getRuleGraph() {
@@ -88,4 +66,9 @@
return destGraph;
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Backup.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Backup.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Backup.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -27,4 +27,9 @@
super(source, destination);
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Copied: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Command.java (from rev 367, branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CommandAst.java)
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CommandAst.java 2007-08-21 17:28:35 UTC (rev 367)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Command.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -0,0 +1,53 @@
+/*
+ * The contents of this file are subject to the Open Software License
+ * Version 3.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.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+
+package org.mulgara.query.ast;
+
+import java.net.URI;
+
+/**
+ * A general Abstract Syntax Tree for TQL commands.
+ *
+ * @created 2007-08-09
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public interface Command {
+
+ /**
+ * Indicates if an AST element is an operation for a local client.
+ * @return <code>true</code> if the operation is only relevant to a client.
+ */
+ boolean isLocalOperation();
+
+ /**
+ * Indicates if an AST represents a command for a user interface.
+ * @return <code>true</code> if the operation is only relevant to a user interface
+ */
+ boolean isUICommand();
+
+ /**
+ * Gets the associated server for a non-local operation.
+ * @return the server URI if one can be determined,
+ * or <code>null</code> if not a valid operation.
+ * @throws UnsupportedOperationException If this command is local only.
+ */
+ URI getServerURI() throws UnsupportedOperationException;
+
+ /**
+ * Executes the operation. This is highly specific to each operation.
+ * @return Data specific to the operation.
+ * @throws Exception specific to the operation.
+ */
+ Object execute() throws Exception;
+}
Deleted: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CommandAst.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CommandAst.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CommandAst.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -1,46 +0,0 @@
-/*
- * The contents of this file are subject to the Open Software License
- * Version 3.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.opensource.org/licenses/osl-3.0.txt
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- */
-
-package org.mulgara.query.ast;
-
-import java.net.URI;
-
-/**
- * A general Abstract Syntax Tree for TQL commands.
- *
- * @created 2007-08-09
- * @author Paul Gearon
- * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
- * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
- */
-public interface CommandAst {
-
- /**
- * Indicates if an AST element is an operation for a local client.
- * @return <code>true</code> if the operation is only relevant to a client.
- */
- boolean isLocalOperation();
-
- /**
- * Indicates if an AST represents a command for a user interface.
- * @return <code>true</code> if the operation is only relevant to a user interface
- */
- boolean isUICommand();
-
- /**
- * Gets the associated server for a non-local operation.
- * @return the server URI if one can be determined,
- * or <code>null</code> if not a valid operation.
- * @throws UnsupportedOperationException If this command is local only.
- */
- URI getServerURI() throws UnsupportedOperationException;
-}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Commit.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Commit.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Commit.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -23,7 +23,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class Commit implements CommandAst {
+public class Commit implements Command {
/**
* Indicates that this operation may require network access.
@@ -52,4 +52,10 @@
return null;
}
+
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CreateGraph.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CreateGraph.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/CreateGraph.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -20,7 +20,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class CreateGraph implements CommandAst {
+public class CreateGraph extends ServerCommand {
/** The URI for the graph. */
private URI graphUri;
@@ -29,35 +29,12 @@
private URI type;
public CreateGraph(URI graphUri, URI type) {
+ super(graphUri);
this.graphUri = graphUri;
this.type = type;
}
/**
- * Finds the server URI for the graph.
- * @return The URI used to find the server.
- */
- public URI getServerURI() {
- return graphUri;
- }
-
- /**
- * Indicates that this operation is for a server.
- * @return Always <code>false</code>
- */
- public boolean isLocalOperation() {
- return false;
- }
-
- /**
- * Indicates that this operation is not tied to the UI.
- * @return Always <code>false</code>
- */
- public boolean isUICommand() {
- return false;
- }
-
- /**
* Get the URI of the graph to create.
* @return the URI of the graph to create.
*/
@@ -73,4 +50,9 @@
return type;
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/DataTx.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/DataTx.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/DataTx.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -21,7 +21,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public abstract class DataTx implements CommandAst {
+public abstract class DataTx extends ServerCommand {
/** The source of data to insert. */
private URI source;
@@ -35,6 +35,7 @@
* @param destination The graph to load data into.
*/
public DataTx(URI source, URI destination) {
+ super(destination);
this.source = source;
this.destination = destination;
}
@@ -47,22 +48,6 @@
}
/**
- * Returns false to indicate that this is a server-side operation.
- * @return Always <code>false</code>
- */
- public boolean isLocalOperation() {
- return false;
- }
-
- /**
- * Returns false to indicate that this operation is not tied to a UI.
- * @return Always <code>false</code>
- */
- public boolean isUICommand() {
- return false;
- }
-
- /**
* @return the URI of the source data.
*/
public URI getSource() {
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Deletion.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Deletion.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Deletion.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -44,4 +44,9 @@
super(graph, selectQuery);
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/DropGraph.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/DropGraph.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/DropGraph.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -20,40 +20,17 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class DropGraph implements CommandAst {
+public class DropGraph extends ServerCommand {
/** The URI for the graph. */
private URI graphUri;
public DropGraph(URI graphUri) {
+ super(graphUri);
this.graphUri = graphUri;
}
/**
- * Finds the server URI for the graph.
- * @return The URI used to find the server.
- */
- public URI getServerURI() {
- return graphUri;
- }
-
- /**
- * Indicates that this operation is for a server.
- * @return Always <code>false</code>
- */
- public boolean isLocalOperation() {
- return false;
- }
-
- /**
- * Indicates that this operation is not tied to the UI.
- * @return Always <code>false</code>
- */
- public boolean isUICommand() {
- return false;
- }
-
- /**
* Get the URI of the graph to drop.
* @return the URI of the graph to drop.
*/
@@ -61,4 +38,9 @@
return graphUri;
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ExecuteScript.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ExecuteScript.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ExecuteScript.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -20,7 +20,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class ExecuteScript extends LocalAst {
+public class ExecuteScript extends LocalCommand {
/** The script to be executed. */
private URL script;
@@ -48,4 +48,9 @@
return script;
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Help.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Help.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Help.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -21,7 +21,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class Help extends LocalAst {
+public class Help extends LocalCommand {
private String helpText;
@@ -42,4 +42,9 @@
return helpText;
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Insertion.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Insertion.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Insertion.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -44,4 +44,9 @@
super(graph, selectQuery);
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Load.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Load.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Load.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -27,4 +27,9 @@
super(source, destination);
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Deleted: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalAst.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalAst.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalAst.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -1,30 +0,0 @@
-/*
- * The contents of this file are subject to the Open Software License
- * Version 3.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.opensource.org/licenses/osl-3.0.txt
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- */
-
-package org.mulgara.query.ast;
-
-import java.net.URI;
-
-public abstract class LocalAst implements CommandAst {
-
- public boolean isLocalOperation() {
- return true;
- }
-
- /**
- * Gets the associated server for a non-local operation.
- * @throws UnsupportedOperationException Always thrown for local commands.
- */
- public URI getServerURI() throws UnsupportedOperationException {
- throw new UnsupportedOperationException("Server URI not available for local commands.");
- }
-}
Copied: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalCommand.java (from rev 367, branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalAst.java)
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalAst.java 2007-08-21 17:28:35 UTC (rev 367)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/LocalCommand.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -0,0 +1,42 @@
+/*
+ * The contents of this file are subject to the Open Software License
+ * Version 3.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.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+
+package org.mulgara.query.ast;
+
+import java.net.URI;
+
+/**
+ * An AST element for non-server commands.
+ *
+ * @created 2007-08-09
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public abstract class LocalCommand implements Command {
+
+ /**
+ * Indicates that this operation is local.
+ * @return Always <code>true</code> to indicate this command is local.
+ */
+ public final boolean isLocalOperation() {
+ return true;
+ }
+
+ /**
+ * Gets the associated server for a non-local operation.
+ * @throws UnsupportedOperationException Always thrown for local commands.
+ */
+ public URI getServerURI() throws UnsupportedOperationException {
+ throw new UnsupportedOperationException("Server URI not available for local commands.");
+ }
+}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Modification.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Modification.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Modification.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -6,7 +6,7 @@
import org.jrdf.graph.Triple;
import org.mulgara.query.Query;
-public abstract class Modification implements CommandAst {
+public abstract class Modification extends ServerCommand {
/** The graph to insert into. */
protected URI graph;
@@ -21,6 +21,7 @@
* @param statements The data to be modified.
*/
public Modification(URI graph, Set<Triple> statements){
+ super(graph);
this.graph = graph;
this.statements = statements;
}
@@ -31,35 +32,12 @@
* @param selectQuery The query to get data for modification.
*/
public Modification(URI graph, Query selectQuery){
+ super(graph);
this.graph = graph;
this.selectQuery = selectQuery;
}
/**
- * Retrieve the URI for a graph on the server receiving the data.
- * @return The server containing the graph to insert into.
- */
- public URI getServerURI() throws UnsupportedOperationException {
- return graph;
- }
-
- /**
- * Indicates that this is a server command.
- * @return <code>false</code> to indicate that this command involves a server.
- */
- public boolean isLocalOperation() {
- return false;
- }
-
- /**
- * Indicates that this is not a UI command.
- * @return <code>false</code> to indicate that this command is unconcerned with the client.
- */
- public boolean isUICommand() {
- return false;
- }
-
- /**
* Test is this insertion is based on a SELECT query.
* @return <code>true</code> if the data to be inserted comes from a SELECT query.
* <code>false</code> otherwise.
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Quit.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Quit.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Quit.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -21,7 +21,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class Quit extends LocalAst {
+public class Quit extends LocalCommand {
/**
* Indicates that this operation is for a UI.
@@ -31,4 +31,9 @@
return true;
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Restore.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Restore.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Restore.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -27,4 +27,9 @@
super(source, destination);
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Rollback.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Rollback.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/Rollback.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -23,7 +23,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class Rollback implements CommandAst {
+public class Rollback implements Command {
/**
* Indicates that this operation may require network access.
@@ -50,4 +50,9 @@
return null;
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Added: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ServerCommand.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ServerCommand.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/ServerCommand.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -0,0 +1,70 @@
+/*
+ * The contents of this file are subject to the Open Software License
+ * Version 3.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.opensource.org/licenses/osl-3.0.txt
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ */
+package org.mulgara.query.ast;
+
+import java.net.URI;
+import java.util.Set;
+
+import org.mulgara.query.ModelResource;
+
+/**
+ * An AST element for server-based commands.
+ *
+ * @created 2007-08-22
+ * @author Paul Gearon
+ * @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
+ * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
+ */
+public abstract class ServerCommand implements Command {
+
+ /** The graph being referred to on the server. */
+ private ModelResource serverGraph;
+
+ /**
+ * Creates a new command, with a principle graph URI.
+ * @param serverGraphUri The URI of the graph.
+ */
+ public ServerCommand(URI serverGraphUri) {
+ serverGraph = new ModelResource(serverGraphUri);
+ }
+
+
+ /**
+ * Finds the server URI for the graph.
+ * @return The URI used to find the server.
+ */
+ public URI getServerURI() {
+ Set<URI> gs = serverGraph.getDatabaseURIs();
+ assert gs.size() == 1;
+ return gs.iterator().next();
+ }
+
+
+ /**
+ * Indicates that this operation is not local.
+ * @return Always <code>false</code> to indicate this command is not local.
+ */
+ public final boolean isLocalOperation() {
+ return false;
+ }
+
+
+ /**
+ * Indicates that this operation is not a UI command by default.
+ * @return By default this will be <code>false</code> as a server side operation should not
+ * affect the local UI.
+ */
+ public boolean isUICommand() {
+ return false;
+ }
+
+}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetAutoCommit.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetAutoCommit.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetAutoCommit.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -28,4 +28,9 @@
super(option);
}
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetCommand.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetCommand.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetCommand.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -18,7 +18,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public abstract class SetCommand extends LocalAst {
+public abstract class SetCommand extends LocalCommand {
/**
* Check if this command is for the local UI.
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetTime.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetTime.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetTime.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -27,4 +27,9 @@
public SetTime(boolean option) {
super(option);
}
+
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
}
Modified: branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetUser.java
===================================================================
--- branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetUser.java 2007-08-23 12:07:29 UTC (rev 369)
+++ branches/nw-interface/src/jar/query/java/org/mulgara/query/ast/SetUser.java 2007-08-23 12:10:10 UTC (rev 370)
@@ -23,7 +23,7 @@
* @copyright © 2007 <a href="mailto:pgearon at users.sourceforge.net">Paul Gearon</a>
* @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
*/
-public class SetUser extends LocalAst {
+public class SetUser extends LocalCommand {
/** The user logging in. */
private String user;
@@ -82,4 +82,10 @@
return securityDomain;
}
+
+ public Object execute() throws Exception {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
More information about the Mulgara-svn
mailing list