py4j
Class AbstractCommand

java.lang.Object
  extended by py4j.AbstractCommand
All Implemented Interfaces:
Command
Direct Known Subclasses:
CallCommand, ConstructorCommand, FieldCommand, HelpPageCommand, ListCommand, MemoryCommand, ReflectionCommand, ShutdownGatewayServerCommand

public abstract class AbstractCommand
extends Object
implements Command


Field Summary
protected  Gateway gateway
           
 
Constructor Summary
AbstractCommand()
           
 
Method Summary
abstract  void execute(String commandName, BufferedReader reader, BufferedWriter writer)
           
protected  List<Argument> getArguments(BufferedReader reader)
           
 void init(Gateway gateway)
          Called when a command instance is created and assigned to a connection.
protected  ReturnObject invokeMethod(String methodName, String targetObjectId, List<Argument> arguments)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gateway

protected Gateway gateway
Constructor Detail

AbstractCommand

public AbstractCommand()
Method Detail

execute

public abstract void execute(String commandName,
                             BufferedReader reader,
                             BufferedWriter writer)
                      throws Py4JException,
                             IOException
Specified by:
execute in interface Command
Parameters:
commandName - The command name that was extracted of the command.
reader - The reader from which to read the command parts. Each command part are expected to be on a separate line and readable through BufferedReader.readLine().
writer - The writer to which the return value should be written.
Throws:
Py4JException - If an error occurs while executing the command. All exceptions except IOException caused by the reader and the writer should be wrapper in a Py4JException instance.
IOException - If an error occurs while using the reader or the writer.

init

public void init(Gateway gateway)
Description copied from interface: Command

Called when a command instance is created and assigned to a connection. Called by GatewayConnection.initCommands(Gateway)

Specified by:
init in interface Command

getArguments

protected List<Argument> getArguments(BufferedReader reader)
                               throws IOException
Throws:
IOException

invokeMethod

protected ReturnObject invokeMethod(String methodName,
                                    String targetObjectId,
                                    List<Argument> arguments)