org.sapia.ubik.rmi.server
Class RMICommand

java.lang.Object
  extended by org.sapia.ubik.rmi.server.command.Command
      extended by org.sapia.ubik.rmi.server.RMICommand
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, Executable
Direct Known Subclasses:
CommandConnect, CommandGc, CommandPing, CommandRefer, HelloWorldCommand, InvokeCommand, RMICommandProcessor.ResponseListCommand

public abstract class RMICommand
extends Command
implements java.io.Externalizable

This class models an executable command. Typically, a command object is created on the client side, then sent to the server where it is executed.

Author:
Yanick Duchesne
Copyright:
Copyright © 2002-2003 Sapia Open Source Software. All Rights Reserved.
License:
Read the license.txt file of the jar or visit the license page at the Sapia OSS web site
See Also:
Serialized Form

Field Summary
protected  Config _config
           
protected  VmId _vmId
           
 
Constructor Summary
RMICommand()
           
 
Method Summary
abstract  java.lang.Object execute()
          Executes this command.
 Connection getConnection()
          Returns this command's connection.
 ServerAddress getServerAddress()
          Returns this command's target server address, which corresponds to the server that received this command.
 VmId getVmId()
          Returns the identifier of the VM from which this command comes from.
 void init(Config config)
          Initializes this instance with a CommandConfig upon its arrival at the server.
 void readExternal(java.io.ObjectInput in)
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_config

protected transient Config _config

_vmId

protected VmId _vmId
Constructor Detail

RMICommand

public RMICommand()
Method Detail

init

public void init(Config config)
Initializes this instance with a CommandConfig upon its arrival at the server. It is a server's responsability to call this method once it receives a command.

When overriding this method, super.init(config) must be called. If a command nests another one, it should also call init() on the nested command.

Parameters:
config - CommandConfig

getVmId

public VmId getVmId()
Returns the identifier of the VM from which this command comes from.

Returns:
a VmId.

getServerAddress

public ServerAddress getServerAddress()
Returns this command's target server address, which corresponds to the server that received this command.

Returns:
this command's ServerAddress

getConnection

public final Connection getConnection()
Returns this command's connection.

Returns:
a Connection

execute

public abstract java.lang.Object execute()
                                  throws java.lang.Throwable
Executes this command.

Specified by:
execute in interface Executable
Specified by:
execute in class Command
Returns:
any value returned by this method.
Throws:
java.lang.Throwable - if an error occurs while executing this command

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
Externalizable.readExternal(ObjectInput)

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException
See Also:
Externalizable.writeExternal(ObjectOutput)


Copyright © 2010 Sapia OSS. All Rights Reserved.