Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class fi.hut.tcm.jacob.conduits.ConduitFactory

java.lang.Object
  |
  +--fi.hut.tcm.jacob.conduits.BaseConduit
        |
        +--fi.hut.tcm.jacob.conduits.ConduitFactory

public final class ConduitFactory
extends BaseConduit
implements FactoryEventListener
ConduitFactory A ConduitFactory creates and installes new Sessions or other Conduit structures. Whenever a MessageTransporter arrives at a ConduitFactory, it calls the facture() method. This makes the factory to create a new conduit structure, and install it at appropriate locations within the existing conduit graph.


Field Summary
static int ENDPOINT_NUMBER
           
static int FIRST_ENDPOINT_INDEX
           
static int SIDE_NUMBER
           
static int TOTAL_SIDE_NUMBER
           
 
Fields inherited from class fi.hut.tcm.jacob.conduits.BaseConduit
id, SIDE_NUMBER, sides
 
Constructor Summary
ConduitFactory(Conduit conduitPrototype, Side[] endpoints)
          Creates a new ConduitFactory.
 
Method Summary
void accept(Visitor visitor, Side from)
           
java.lang.Object clone()
           
void facture(Message message)
          Creates a new conduit by cloning the prototype.
Side getEndpoint(int index)
           
Conduit getPrototype()
           
int getSideCount()
           
int initialSideCount()
           
void sendNotification(Message message, int nStatusCode, java.lang.Object nContents)
          If this class weren't final, it could be subclassed, and this method replaced with a null method if notification isn't desired.
void setEndpoint(int index, Side endpoint)
           
void setPrototype(Conduit prototype)
           
 
Methods inherited from class fi.hut.tcm.jacob.conduits.BaseConduit
accept, clone, dump, getId, getSide, getSideCount, initialSideCount, initSides
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Field Detail

SIDE_NUMBER

protected static final int SIDE_NUMBER

ENDPOINT_NUMBER

protected static final int ENDPOINT_NUMBER

FIRST_ENDPOINT_INDEX

protected static final int FIRST_ENDPOINT_INDEX

TOTAL_SIDE_NUMBER

protected static final int TOTAL_SIDE_NUMBER
Constructor Detail

ConduitFactory

public ConduitFactory(Conduit conduitPrototype,
                      Side[] endpoints)
Creates a new ConduitFactory.
Parameters:
conduitPrototype - A Conduit to be cloned if not specified in the message given to facture().
endpoints - Sides to which to attach the cloned Conduit if not specified in the message given to facture(). If a MuxSide is given, the side to use is asked from the Mux, passing the message to the Mux so that it can determine which side to use, or create one if a suitable side doesn't already exist. The length of the array must be ENDPOINT_NUMBER (2).
Method Detail

getEndpoint

public Side getEndpoint(int index)

setEndpoint

public void setEndpoint(int index,
                        Side endpoint)

getPrototype

public Conduit getPrototype()

setPrototype

public void setPrototype(Conduit prototype)

accept

protected final void accept(Visitor visitor,
                            Side from)
                    throws ConductingException,
                           java.lang.IllegalArgumentException
Overrides:
accept in class BaseConduit

initialSideCount

protected int initialSideCount()
Overrides:
initialSideCount in class BaseConduit

getSideCount

public int getSideCount()
Overrides:
getSideCount in class BaseConduit

facture

public void facture(Message message)
Creates a new conduit by cloning the prototype. The newly created conduit is wrapped into two installers, created from the Installer prototypes, which are then sent to sides A and B. The message is included into the Installer; it can be used to determine where to install the newly created conduit.
Specified by:
facture in interface FactoryEventListener

sendNotification

protected void sendNotification(Message message,
                                int nStatusCode,
                                java.lang.Object nContents)
If this class weren't final, it could be subclassed, and this method replaced with a null method if notification isn't desired.

clone

public java.lang.Object clone()
                      throws java.lang.CloneNotSupportedException
Overrides:
clone in class BaseConduit

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD