Kodo 4.2.0. generated on July 28 2008

com.solarmetric.remote
Class CommandIO

java.lang.Object
  extended by com.solarmetric.remote.CommandIO

public class CommandIO
extends Object

Manages command input and output.


Constructor Summary
CommandIO()
          Default constructor.
CommandIO(ContextFactory context, Log log)
          Constructor.
 
Method Summary
 boolean execute(Transport.Channel channel)
          Execute a command via the given channel.
 ContextFactory getContextFactory()
          A context factory to use to given executed commands context.
 Log getLog()
          A log to write about sent and recieved a commands.
protected  ObjectInput getObjectInput(InputStream in)
          Create an ObjectInput instance from the given stream.
protected  ObjectOutput getObjectOutput(OutputStream out)
          Create an ObjectOutput instance from the given stream.
 StreamDecorator[] getStreamDecorators()
          Stream decorators.
protected  Command readType(ObjectInput in)
          Read the command type from the given stream and return a new command of the proper type.
 void send(Command cmd, Transport.Channel channel)
          Send a command via the given channel.
 void setContextFactory(ContextFactory context)
          A context factory to use to given executed commands context.
 void setLog(Log log)
          A log to write about sent and recieved a commands.
 void setStreamDecorators(StreamDecorator[] streamDecs)
          Stream decorators.
 void test(Transport.Channel channel)
          Test that the given client channel is still connected.
protected  void writeType(Command cmd, ObjectOutput out)
          Write the type of this command to the given stream so that readType(java.io.ObjectInput) will be able to reconstruct the command.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandIO

public CommandIO()
Default constructor.


CommandIO

public CommandIO(ContextFactory context,
                 Log log)
Constructor. Supply context factory and log.

Method Detail

getLog

public Log getLog()
A log to write about sent and recieved a commands.


setLog

public void setLog(Log log)
A log to write about sent and recieved a commands.


getStreamDecorators

public StreamDecorator[] getStreamDecorators()
Stream decorators.


setStreamDecorators

public void setStreamDecorators(StreamDecorator[] streamDecs)
Stream decorators.


getContextFactory

public ContextFactory getContextFactory()
A context factory to use to given executed commands context.


setContextFactory

public void setContextFactory(ContextFactory context)
A context factory to use to given executed commands context.


execute

public boolean execute(Transport.Channel channel)
Execute a command via the given channel.

Returns:
false if the channel to the client should be closed, true otherwise
Throws:
TransportException - on transport error

send

public void send(Command cmd,
                 Transport.Channel channel)
          throws Exception
Send a command via the given channel.

Throws:
TransportException - on transport error
Exception - if the command caused an error on the server

test

public void test(Transport.Channel channel)
          throws Exception
Test that the given client channel is still connected.

Throws:
Exception

readType

protected Command readType(ObjectInput in)
                    throws Exception
Read the command type from the given stream and return a new command of the proper type. By default, this method assumes the next item in the stream is a class name.

Throws:
Exception

writeType

protected void writeType(Command cmd,
                         ObjectOutput out)
                  throws Exception
Write the type of this command to the given stream so that readType(java.io.ObjectInput) will be able to reconstruct the command. By default, this method writes the command class name to the stream.

Throws:
Exception

getObjectInput

protected ObjectInput getObjectInput(InputStream in)
                              throws Exception
Create an ObjectInput instance from the given stream. This default implementation uses a standard ObjectInputStream.

Throws:
Exception

getObjectOutput

protected ObjectOutput getObjectOutput(OutputStream out)
                                throws Exception
Create an ObjectOutput instance from the given stream. This default implementation uses a standard ObjectOutputStream.

Throws:
Exception

Kodo 4.2.0. generated on July 28 2008

Copyright 2001-2006 BEA Systems, Inc. All Rights Reserved.