mChaRM.multichannel
Class senderStub

java.lang.Object
  |
  +--uka.karmi.rmi.server.RemoteObject
        |
        +--uka.karmi.rmi.server.UnicastRemoteObject
              |
              +--mChaRM.multichannel.stub
                    |
                    +--mChaRM.multichannel.senderStub
All Implemented Interfaces:
java.lang.Cloneable, uka.karmi.rmi.Remote, senderStubInterface, stubInterface
Direct Known Subclasses:
verboseSenderStub

public class senderStub
extends stub
implements senderStubInterface

Instances of this class are used as stubs of the multi-channel on the sender side. Each sender which asks a reflective computation to a multi-channel will be extended by a stub of such a multi-channel.
This class defines the meta-computations that must be performed on the sender side. Each new meta-behavior to be performed on the sender side can be defined extending this class and overrinding the method senderSideMetaBehavior.

Since:
Version 1.0
Version:
1.2
Author:
Walter Cazzola (cazzola@disi.unige.it)

Fields inherited from class uka.karmi.rmi.server.RemoteObject
serverRef
 
Constructor Summary
senderStub(java.lang.Object myReferent, java.lang.String myKind, java.lang.String myReferentName)
          senderStub constructor.
 
Method Summary
 void afterSenderSideMetaBehavior(mChaRMMethodCall msg)
          This method performs the sender side meta-behavior.
 void beforeSenderSideMetaBehavior(mChaRMMethodCall msg)
          This method performs part of the sender side meta-behavior.
 java.lang.Object stubBehavior(mChaRMMethodCall msg)
          This method embodies the reflective behaviour performed on the source locus, and also forwards the trapped request to the abstract locus.
 
Methods inherited from class mChaRM.multichannel.stub
referent, retrieveField, setReferent, setWhoIsMyCore, WhoIsMyCore
 
Methods inherited from class uka.karmi.rmi.server.UnicastRemoteObject
buildStub, clone, exportObject, exportObject, unexportObject
 
Methods inherited from class uka.karmi.rmi.server.RemoteObject
equals, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mChaRM.multichannel.stubInterface
retrieveField
 

Constructor Detail

senderStub

public senderStub(java.lang.Object myReferent,
                  java.lang.String myKind,
                  java.lang.String myReferentName)
           throws SenderStubNotFoundException,
                  CoreNotFoundException,
                  SenderStubCannotBeRegisteredAsAServerException,
                  uka.karmi.rmi.RemoteException
senderStub constructor. it initialize the stub, registers it as a remote server, and connect it to the core of the multi-channeli, and vice versa.
Parameters:
myReferent - a representant of the stub referent.
myKind - the multi-channel's name.
myReferentName - the referent's name.
Throws:
CoreNotFoundException - thrown when the core of the multi-channel, which the stub is part of, doesn't exist or isn't correctly registered as a server.
SenderStubCannotBeRegisteredAsAServerException - thrown when the stub we are creating cannot be registerd as a server.
SenderStubNotFoundException - thrown when the core can't link to the this sender stub.
Method Detail

stubBehavior

public final java.lang.Object stubBehavior(mChaRMMethodCall msg)
This method embodies the reflective behaviour performed on the source locus, and also forwards the trapped request to the abstract locus.
This method starts on the source locus of the meta-computations related to the reified method call:
multiRMI(RsName, methodName, args)
then it passes all the stuff to the core of the multi-channel.
the computations performed can make assumption about the fact it will be performed on the sender site. This method can't be neither overrode nor directly called by the programmer.
Note that receivers can be a subset of the multi-channel's receivers, and as side-effect the {link #senderSideMetaBehavior senderSideMetaBehavior} method can change the arguments passed to the core of channel
Parameters:
msg - the hijacked method call.
Returns:
the result of the method call.

beforeSenderSideMetaBehavior

public void beforeSenderSideMetaBehavior(mChaRMMethodCall msg)
This method performs part of the sender side meta-behavior.
It is called before passing all the staff to the core and it permits to perform meta-computations on sender side. As default behavior, nothing it is done, it is possible to define new behavior defing a new subclass overriding this method.
Parameters:
msg - the hijacked method call.
args - the actual arguments of the call.

afterSenderSideMetaBehavior

public void afterSenderSideMetaBehavior(mChaRMMethodCall msg)
This method performs the sender side meta-behavior.
It is called before passing all the staff to the core and it permits to perform meta-computations on sender side. As default behavior, nothing it is done, it is possible to define new behavior defing a new subclass overriding this method.
Parameters:
msg - the hijacked method call.
args - the actual arguments of the call.