[Mulgara-svn] r438 - branches/nw-interface/src/jar/itql/java/org/mulgara/itql
pag at mulgara.org
pag at mulgara.org
Fri Sep 14 20:56:31 UTC 2007
Author: pag
Date: 2007-09-14 15:56:30 -0500 (Fri, 14 Sep 2007)
New Revision: 438
Modified:
branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java
Log:
Started setting up for establishing sessions, but need to move to another computer before continuing
Modified: branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java
===================================================================
--- branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java 2007-09-14 20:54:21 UTC (rev 437)
+++ branches/nw-interface/src/jar/itql/java/org/mulgara/itql/TqlAutoInterpreter.java 2007-09-14 20:56:30 UTC (rev 438)
@@ -12,11 +12,14 @@
package org.mulgara.itql;
import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
import org.apache.log4j.Logger;
import org.mulgara.connection.Connection;
import org.mulgara.parser.Interpreter;
import org.mulgara.query.Answer;
+import org.mulgara.query.QueryException;
import org.mulgara.query.operation.Command;
import org.mulgara.query.operation.LocalCommand;
@@ -41,6 +44,9 @@
private Exception lastException;
+ private Map<URI,Connection> establishedConnections = new HashMap<URI,Connection>();
+
+
public TqlAutoInterpreter() {
resetState();
}
@@ -97,6 +103,13 @@
* Close any resources that are still in use.
*/
public void close() {
+ for (Connection c: establishedConnections.values()) {
+ try {
+ c.close();
+ } catch (QueryException e) {
+ logger.warn("Unable to close connection", e);
+ }
+ }
}
@@ -111,6 +124,12 @@
private Connection establishConnection(URI serverUri) {
- return null;
+ if (serverUri == null) throw new IllegalArgumentException("Server URI may not be null.");
+ Connection connection = establishedConnections.get(serverUri);
+ if (connection == null) {
+ // RMI here
+ }
+
+ return connection;
}
}
More information about the Mulgara-svn
mailing list