org.objectweb.carol.cmi
Class DistributorSfsbRemote

java.lang.Object
  extended byorg.objectweb.carol.cmi.Distributor
      extended byorg.objectweb.carol.cmi.DistributorSfsbRemote

public abstract class DistributorSfsbRemote
extends Distributor

Specific Distributor class for the SFSB replication protocol - Handles a link with the Home instance for recreating an instance when an exception occurs - Holds a cluster wide ObjectId - Keeps request number

Author:
Benoit Pelletier, Alberto Paz-Jimenez (apaz@no-spam@fi.upm.es), Francisco Perez-Sorrosal (fpsorrosal@no-spam@fi.upm.es)

Constructor Summary
DistributorSfsbRemote()
           
 
Method Summary
 StubData choose(java.lang.reflect.Method method, java.lang.Object[] parameters)
          Choose a stub - for the SFSB Remote stub, the Distributor class contains only one stub
 boolean equivAtBind()
          To be overriden
 boolean equivAtExport()
          To be overriden
 ObjectId getClusterOID()
          Get the ObjectId
 ClusterId getCurrentServerId()
          Get the current server Id
 java.lang.reflect.Method getHomeCreateMethod()
          Get the home create method Search for a create method with the same parameters as homeCreateParameters
protected  java.lang.Object[] getHomeCreateParameters()
          Get the home create parameters
 Decision onException(java.lang.reflect.Method method, java.lang.Object[] parameters, StubData sd, java.lang.Exception ex)
          Decison on Exception The application deployer can override this method to make its own choices.
 Decision onReturn(java.lang.reflect.Method method, java.lang.Object[] parameters, StubData sd, java.lang.Object retVal)
          Decision on return The application deployer can override this method to make its own choices.
 void preInvoke(java.lang.reflect.Method method, java.lang.Object[] parameters)
          Callback invoked just before the method call Puts RequestId in HAContext
 void read(java.io.ObjectInput in)
          Read the input and builds a server stubs list
 void setClusterHandle(ClusterHandle clusterHandle)
          Sets the associated ClusterHandle
 void setClusterOID(ObjectId objectId)
          Set the ObjectId
 void setCurrentServerId(ClusterId csi)
          Set the current server Id
 void setHomeClusterStub(ClusterStub hcs)
          Set home cluster stub
 void setHomeCreateParameters(java.lang.Object[] parameters)
          Set the home create parameters
 void write(java.io.ObjectOutput out)
          Write the server stubs list
 
Methods inherited from class org.objectweb.carol.cmi.Distributor
chooseLocalFirst, getCurrentState, getMyServerId, getStubList, removeStub, removeStub, toContentsString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DistributorSfsbRemote

public DistributorSfsbRemote()
Method Detail

setClusterOID

public void setClusterOID(ObjectId objectId)
Set the ObjectId


getClusterOID

public ObjectId getClusterOID()
Get the ObjectId

Returns:
Returns the clusterOID.

setHomeClusterStub

public void setHomeClusterStub(ClusterStub hcs)
Set home cluster stub

Parameters:
hcs -

getHomeCreateMethod

public java.lang.reflect.Method getHomeCreateMethod()
                                             throws java.lang.SecurityException,
                                                    java.lang.NoSuchMethodException
Get the home create method Search for a create method with the same parameters as homeCreateParameters

Returns:
Returns the homeCreateMethod.
Throws:
java.lang.NoSuchMethodException
java.lang.SecurityException

setHomeCreateParameters

public void setHomeCreateParameters(java.lang.Object[] parameters)
Set the home create parameters

Parameters:
parameters - parameters list

getHomeCreateParameters

protected java.lang.Object[] getHomeCreateParameters()
Get the home create parameters

Returns:
parameters list

setCurrentServerId

public void setCurrentServerId(ClusterId csi)
Set the current server Id

Parameters:
csi - ClusterId

getCurrentServerId

public ClusterId getCurrentServerId()
Get the current server Id

Returns:
ClusterId

setClusterHandle

public void setClusterHandle(ClusterHandle clusterHandle)
Sets the associated ClusterHandle

Parameters:
clusterHandle - the new ClusterHandle

equivAtBind

public boolean equivAtBind()
Description copied from class: Distributor
To be overriden

Specified by:
equivAtBind in class Distributor
Returns:
true if the bound object have to be clustered
See Also:
Distributor.equivAtBind()

equivAtExport

public boolean equivAtExport()
Description copied from class: Distributor
To be overriden

Specified by:
equivAtExport in class Distributor
Returns:
true if the export object have to be clustered
See Also:
Distributor.equivAtExport()

preInvoke

public void preInvoke(java.lang.reflect.Method method,
                      java.lang.Object[] parameters)
Callback invoked just before the method call Puts RequestId in HAContext

Overrides:
preInvoke in class Distributor
Parameters:
method - calling method
parameters - parameters of the calling method

choose

public StubData choose(java.lang.reflect.Method method,
                       java.lang.Object[] parameters)
                throws NoServerException
Choose a stub - for the SFSB Remote stub, the Distributor class contains only one stub

Overrides:
choose in class Distributor
Parameters:
method - called method
parameters - array of parameters passed in
Returns:
chosen stub
Throws:
NoServerException - if no stub available

onException

public Decision onException(java.lang.reflect.Method method,
                            java.lang.Object[] parameters,
                            StubData sd,
                            java.lang.Exception ex)
Decison on Exception The application deployer can override this method to make its own choices.

Overrides:
onException in class Distributor
Parameters:
method - calling method
parameters - parameters of the calling method
sd - stub data
ex - exception
Returns:
decision

onReturn

public Decision onReturn(java.lang.reflect.Method method,
                         java.lang.Object[] parameters,
                         StubData sd,
                         java.lang.Object retVal)
Decision on return The application deployer can override this method to make its own choices.

Overrides:
onReturn in class Distributor
Parameters:
method - calling method
parameters - parameters of the calling method
sd - stub data
retVal - return value
Returns:
decision

write

public void write(java.io.ObjectOutput out)
           throws java.io.IOException
Write the server stubs list

Overrides:
write in class Distributor
Parameters:
out - output
Throws:
java.io.IOException - if an I/O error occurs

read

public void read(java.io.ObjectInput in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException
Read the input and builds a server stubs list

Overrides:
read in class Distributor
Parameters:
in - input
Returns:
ClusterStub server stub list
Throws:
java.io.IOException - if an I/O error occurs
java.lang.ClassNotFoundException - if the expected class can not be created