[Mulgara-svn] r1587 - trunk/src/jar/querylang/java/org/mulgara/itql
ronald at mulgara.org
ronald at mulgara.org
Wed Mar 4 14:07:48 UTC 2009
Author: ronald
Date: 2009-03-04 06:07:46 -0800 (Wed, 04 Mar 2009)
New Revision: 1587
Modified:
trunk/src/jar/querylang/java/org/mulgara/itql/TqlSession.java
Log:
Trivial formatting fixes: fixed indentation and removed trailing whitespace.
Modified: trunk/src/jar/querylang/java/org/mulgara/itql/TqlSession.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/itql/TqlSession.java 2009-03-03 22:36:42 UTC (rev 1586)
+++ trunk/src/jar/querylang/java/org/mulgara/itql/TqlSession.java 2009-03-04 14:07:46 UTC (rev 1587)
@@ -81,7 +81,7 @@
/** The default path to the post-loading script */
private final static String POST_LOADING_SCRIPT_PATH = "default-post.tql";
-
+
/** The command prompt */
final static String PROMPT = "TQL> ";
@@ -113,13 +113,13 @@
/** A functor for splitting commands apart. */
private CommandSplitter commandSplitter = null;
-
+
/** A flag to indicate that an executed command was complete */
private boolean incomplete = false;
-
+
/** A flag to indicate whether to use the Swing shell or not */
private boolean useSwing = false;
-
+
/** What machine should we query for models */
private String host = "localhost";
@@ -172,7 +172,7 @@
}
}
-
+
/**
* Convenience method to log errors and terminate the program.
* @param session The current session to close.
@@ -225,7 +225,7 @@
boolean isCommandIncomplete() {
return incomplete;
}
-
+
/**
* Indicates if we should use the Swing shell or not
*/
@@ -239,7 +239,7 @@
String getModelHost() {
return host;
}
-
+
/**
* Executes a series of commands the given command. Accumulates all the
* results of these commands into the answers and messages lists.
@@ -272,7 +272,7 @@
close();
return;
}
-
+
String msg = autoTql.getLastMessage();
if (msg == null) {
if (log.isDebugEnabled()) log.debug("Need to follow on for an incomplete command.");
@@ -342,7 +342,7 @@
String lastMessage = autoTql.getLastMessage();
if ((lastMessage != null) && (lastMessage != "") && (gui != null)) System.out.println(lastMessage);
-
+
Exception e = autoTql.getLastException();
if (e != null) log.warn("Couldn't execute command", e);
}
@@ -359,7 +359,7 @@
private void runInterface(boolean useSwing) {
-
+
if(useSwing) {
// Create the UI.
JFrame mainWindow = new JFrame(SHELL_NAME);
@@ -377,7 +377,7 @@
mainWindow.setVisible(true);
} else {
try {
- ConsoleReader reader = new ConsoleReader();
+ ConsoleReader reader = new ConsoleReader();
File historyFile = getHistoryFile();
History history = reader.getHistory();
history.setHistoryFile(historyFile);
@@ -397,13 +397,13 @@
if (answers.isEmpty()) {
for (String message: messages) out.println(message);
- } else {
+ } else {
int answerIndex = 0;
while (answerIndex < answers.size()) {
@SuppressWarnings("unused")
String lastMessage = (String)messages.get(answerIndex);
-
+
try {
// Assume the same number of answers and messages
Answer answer = answers.get(answerIndex);
@@ -414,7 +414,7 @@
// If there's more than one answer add an extra line before the heading.
out.println("Executing Query " + (answerIndex+1));
}
-
+
// print the results
if (answer != null) {
boolean hasAnswers = true;
@@ -451,7 +451,7 @@
if (line.equalsIgnoreCase("quit") || line.equalsIgnoreCase("exit")) {
break;
}
- }
+ }
} catch(TuplesException te ) {
te.printStackTrace();
}
@@ -463,16 +463,16 @@
e.printStackTrace();
}
-
+
}
if (log.isInfoEnabled()) log.info("Stopping TQL interpreter");
if (log.isDebugEnabled()) log.debug("Executed post-loading script");
}
-
+
/*
- * Get the history file if it exists.
- *
+ * Get the history file if it exists.
+ *
*/
private File getHistoryFile() {
// TODO: Generalize this process
@@ -516,18 +516,18 @@
private URL getPostLoadingScriptURL() {
return postLoadingScriptUrl;
}
-
+
/**
* @return the list of existing model names for tab completion purposes
*/
-
+
private List<String> prefetchModels(String hostname) {
List<String> retValue = new ArrayList<String>();
StringBuffer sb = new StringBuffer();
sb.append("select $model from <rmi://");
sb.append(hostname);
sb.append("/server1#> where $model $p $o;");
-
+
try {
executeCommand(sb.toString());
List<Answer> models = getLastAnswers();
@@ -540,7 +540,7 @@
} catch(Throwable t) {
t.printStackTrace();
}
-
+
return retValue;
}
@@ -649,7 +649,7 @@
// dump the interpreter configuration
if (null != parser.getOptionValue(ItqlOptionParser.DUMP_CONFIG)) dumpConfig();
-
+
String modelHost = (String) parser.getOptionValue(ItqlOptionParser.REMOTE);
if(modelHost != null) {
host = modelHost;
@@ -673,7 +673,7 @@
// override the default post-loading script
String postScript = (String)parser.getOptionValue(ItqlOptionParser.POST_SCRIPT);
if (postScript != null) postLoadingScriptUrl = new URL(preScript);
-
+
// override the default UI environment script
useSwing = parser.getOptionValue(ItqlOptionParser.GUI) != null;
@@ -724,7 +724,7 @@
usage.append("scripts (useful with -s)").append(EOL);
usage.append("-l, --logconfig use an external logging configuration file").append(EOL);
-
+
usage.append("-o, --postload execute an TQL script after interpreter stops,").append(EOL);
usage.append(" overriding default post-loading script").append(EOL);
usage.append("-p, --preload execute an TQL script before interpreter starts,").append(EOL);
More information about the Mulgara-svn
mailing list