You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by kw...@apache.org on 2002/11/09 07:21:09 UTC
cvs commit: xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline XindiceToolAssemblyInterface.java BaseCommand.java BasePrompt.java Command.java CommandRegister.java Prompt.java ShellPrompt.java XindiceTools.java
kward 2002/11/08 22:21:09
Modified: java/scratchpad/admin/src/org/apache/xindice/admin/commandline
BaseCommand.java BasePrompt.java Command.java
CommandRegister.java Prompt.java ShellPrompt.java
XindiceTools.java
Added: java/scratchpad/admin/src/org/apache/xindice/admin/commandline
XindiceToolAssemblyInterface.java
Log:
getting build to run
Revision Changes Path
1.3 +15 -15 xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/BaseCommand.java
Index: BaseCommand.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/BaseCommand.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BaseCommand.java 9 Nov 2002 01:24:55 -0000 1.2
+++ BaseCommand.java 9 Nov 2002 06:21:08 -0000 1.3
@@ -71,14 +71,14 @@
* Author: kward <ku...@yahoo.com>
*/
-public abstract class BaseCommand implements CommandInterface {
+public abstract class BaseCommand implements Command {
protected String name_;
protected int numArgs_;
protected CommandRegister register_;
protected String help_;
- protected static XmlRpcClient client;
+ protected XmlRpcClient client;
protected static BasePrompt prompt = null;
@@ -86,18 +86,6 @@
name_ = name;
numArgs_ = numArgs;
help_ = help;
- XmlRpc.setEncoding("UTF8");
- //System.out.println("created XML-RPC client in command " + name);
- try {
- XmlRpc.setDriver("xerces");
- } catch(Exception e) {
- System.out.println("XML-RPC requires Xerces for UTF-8 support.");
- }
- try {
- client = new XmlRpcClient("http://localhost:8080/Xindice");
- } catch(Exception e){
- System.out.println("Error connecting to Xindice");
- }
}
/**
@@ -181,6 +169,18 @@
}
public Hashtable run(Hashtable message) {
+ XmlRpc.setEncoding("UTF8");
+
+ try {
+ XmlRpc.setDriver("xerces");
+ } catch(Exception e) {
+ System.out.println("XML-RPC requires Xerces for UTF-8 support.");
+ }
+ try {
+ client = new XmlRpcClient("http://localhost:8080/Xindice");
+ } catch(Exception e){
+ System.out.println("Error connecting to Xindice");
+ }
Vector params = new Vector();
params.addElement(message);
Hashtable result = new Hashtable();
1.3 +3 -3 xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/BasePrompt.java
Index: BasePrompt.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/BasePrompt.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- BasePrompt.java 9 Nov 2002 01:24:55 -0000 1.2
+++ BasePrompt.java 9 Nov 2002 06:21:08 -0000 1.3
@@ -69,7 +69,7 @@
* Base class for all command prompts.
* Author: kward <ku...@yahoo.com>
*/
-public class BasePrompt extends Thread implements PromptInterface {
+public class BasePrompt extends Thread implements Prompt {
private String name_;
private BufferedReader reader_;
@@ -105,7 +105,7 @@
/**
* This method is called to register a new command to be used with the prompt.
*/
- public void registerCommand(CommandInterface command) {
+ public void registerCommand(Command command) {
register_.add(command);
}
1.2 +2 -4 xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/Command.java
Index: Command.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/Command.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Command.java 9 Nov 2002 01:13:47 -0000 1.1
+++ Command.java 9 Nov 2002 06:21:08 -0000 1.2
@@ -3,11 +3,9 @@
import java.util.Iterator;
/**
- * Interface implemented by all commands. Note that this interface is
- * implemented by BaseCommand.
- *
- * @see BaseCommand
+ * Interface implemented by all commands.
*/
+
public interface Command {
String getName();
String getHelp();
1.3 +6 -6 xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/CommandRegister.java
Index: CommandRegister.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/CommandRegister.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- CommandRegister.java 9 Nov 2002 01:24:55 -0000 1.2
+++ CommandRegister.java 9 Nov 2002 06:21:08 -0000 1.3
@@ -78,7 +78,7 @@
add(new XindiceTools());
}
- public final void add(CommandInterface command) {
+ public final void add(Command command) {
command.set(this);
put(command.getName(), command);
}
@@ -91,7 +91,7 @@
}
packages_.put(key, xta);
- CommandInterface[] commands = xta.getCommands();
+ Command[] commands = xta.getCommands();
for (int i=0; i<commands.length; i++) {
add(commands[i]);
}
@@ -155,9 +155,9 @@
return vector.iterator();
}
- public final CommandInterface getCommand(String name) {
+ public final Command getCommand(String name) {
if (containsKey(name)) {
- return (CommandInterface)get(name);
+ return (Command)get(name);
}
return null;
}
@@ -171,7 +171,7 @@
throw new CommandException("no command specified");
}
String name = (String)iter.next();
- CommandInterface command = getCommand(name);
+ Command command = getCommand(name);
if (command != null) {
command.execute(iter);
} else {
1.2 +1 -4 xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/Prompt.java
Index: Prompt.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/Prompt.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Prompt.java 9 Nov 2002 01:13:47 -0000 1.1
+++ Prompt.java 9 Nov 2002 06:21:08 -0000 1.2
@@ -8,10 +8,7 @@
public interface Prompt {
public void registerCommand(Command command);
- public void registerPackage(XindiceToolBuilder ci);
+ public void registerPackage(XindiceToolAssemblyInterface xta);
public void start();
public void exit();
- public boolean askBooleanQuestion(String question);
- public String askQuestion(String question);
-
}
1.3 +2 -2 xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/ShellPrompt.java
Index: ShellPrompt.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/ShellPrompt.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ShellPrompt.java 9 Nov 2002 01:24:55 -0000 1.2
+++ ShellPrompt.java 9 Nov 2002 06:21:08 -0000 1.3
@@ -65,7 +65,7 @@
import java.io.*;
/**
- * CommandInterface prompt
+ * Command prompt
* Author: kward <ku...@yahoo.com>
*/
1.3 +3 -3 xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/XindiceTools.java
Index: XindiceTools.java
===================================================================
RCS file: /home/cvs/xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/XindiceTools.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XindiceTools.java 9 Nov 2002 01:24:55 -0000 1.2
+++ XindiceTools.java 9 Nov 2002 06:21:08 -0000 1.3
@@ -70,8 +70,8 @@
class XindiceTools implements XindiceToolAssemblyInterface {
- public CommandInterface[] getCommands() {
- CommandInterface[] commands = {
+ public Command[] getCommands() {
+ Command[] commands = {
new HelpCommand(),
new DirCommand(),
new TimeCommand(),
1.1 xml-xindice/java/scratchpad/admin/src/org/apache/xindice/admin/commandline/XindiceToolAssemblyInterface.java
Index: XindiceToolAssemblyInterface.java
===================================================================
package org.apache.xindice.admin.commandline;
/**
* Tools Interface
* author: kward <kw...@yahoo.com>
*/
public interface XindiceToolAssemblyInterface {
public Command[] getCommands();
public void exit();
}