| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfulmine.AbstractLifeCycle
fulmine.context.FTDistributionManager
public class FTDistributionManager
A DistributionManager for an FTContext. This takes over the
 subscription and unsubscription implementations and only issues remote
 subscriptions if the FT context is not active, otherwise normal behaviour
 continues.
| Constructor Summary | |
|---|---|
FTDistributionManager(IFrameworkContext context,
                      FTContext ftContext)
 | 
|
| Method Summary | |
|---|---|
 boolean | 
addSubscriptionListener(ISubscriptionListener listener)
Add a container subscription listener.  | 
protected  boolean | 
applicationListenersExist(List<IEventListener> listeners)
Identify if there are any application listeners in the list of listeners.  | 
protected  void | 
doDestroy()
Overridden in subclasses to perform custom logic on destruction.  | 
protected  boolean | 
doRemoteSubscribe(String remoteContextIdentity,
                  ISubscriptionParameters parameters,
                  IEventListener listener)
Performs the actions to service a remote subscription  | 
protected  boolean | 
doRemoteUnsubscribe(String remoteContextIdentity,
                    ISubscriptionParameters parameters,
                    IEventListener listener)
Performs the actions to service an unsubscribe operation for a remote container.  | 
protected  void | 
doStart()
Overridden in subclasses to perform custom logic on activation.  | 
 IChannel[] | 
getConnectedChannels()
Get all the currently connected channels  | 
 IFrameReader | 
getFrameReader()
Get the frame reader for this context  | 
 IFrameWriter | 
getFrameWriter()
Get the frame writer for this context  | 
protected  AsyncLog | 
getLog()
Get the log to use for the object hierarchy  | 
 void | 
invokeRpc(String remoteContextIdentity,
          byte[] rpcData)
Send the RPC invocation to the remote context.  | 
 void | 
logConnectedChannels()
Log the current connected channels  | 
 boolean | 
removeSubscriptionListener(ISubscriptionListener listener)
Remove a container subscription listener.  | 
 void | 
requestRetransmit(String contextIdentity,
                  String identityRegularExpression,
                  IType type,
                  IDomain domain)
Send a request to the named remote context to retransmit the complete state of the IContainer instances with matching type and identity
 subscribe for by the local context. | 
 void | 
requestRetransmitAll(String contextIdentity)
Send a request to the named remote context to retransmit the complete state of all IContainer instances subscribed for by the local
 context. | 
 void | 
retransmit(String contextIdentity,
           String identityRegularExpression,
           IType type,
           IDomain domain)
Retransmit the complete state of the IContainer instances with
 matching type and identity to the (connected) remote context. | 
 void | 
retransmitAll(String contextIdentity)
Retransmit the complete state of all the IContainer instances
 that the (connected) remote context has subscribed for. | 
 void | 
retransmitAllToAll()
Retransmit the complete state of all the IContainer instances to
 all (connected) remote contexts that have a subscription for the
 container instances. | 
 void | 
retransmitToAll(String identityRegularExpression,
                IType type,
                IDomain domain)
Retransmit the complete state of the IContainer instances with
 matching type and identity to all (connected) remote contexts that have a
 subscription for the matching container. | 
 boolean | 
subscribe(String contextIdentity,
          String identityRegex,
          IType type,
          IDomain domain,
          IEventListener listener)
Subscribe the listener for the events generated by the IContainer
 instance(s) in the identified context that match the type, domain and
 identity regular expression. | 
 boolean | 
unsubscribe(String contextIdentity,
            String identityRegex,
            IType type,
            IDomain domain,
            IEventListener listener)
Unsubscribe the listener from the IContainer instance(s)
 identified by the type, domain and identity regular expression in the
 specified context. | 
 String | 
updateRemoteContainer(String remoteContextIdentity,
                      String identity,
                      IType type,
                      IDomain domain,
                      String fieldName,
                      String fieldValueAsString)
Update a named field with a new value in a container in a remote context.  | 
| Methods inherited from class fulmine.AbstractLifeCycle | 
|---|
checkActive, destroy, finalize, isActive, start, toString | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Methods inherited from interface fulmine.ILifeCycle | 
|---|
isActive, start | 
| Methods inherited from interface fulmine.IDestroyable | 
|---|
destroy | 
| Constructor Detail | 
|---|
public FTDistributionManager(IFrameworkContext context,
                             FTContext ftContext)
| Method Detail | 
|---|
public boolean subscribe(String contextIdentity,
                         String identityRegex,
                         IType type,
                         IDomain domain,
                         IEventListener listener)
IDistributionManagerIContainer
 instance(s) in the identified context that match the type, domain and
 identity regular expression. The supplied listener will be registered
 against the matching container instance(s). Events (changes to the
 container instance(s)) will be received by the listener.
 
 The container type and domain is matched exactly. However, a 'wildcard'
 match for the type or domain can be specified using
 ISubscription.WILDCARD_TYPE and
 ISubscription.WILDCARD_DOMAIN. The identity regular expression
 can identify an exact container identity or it can identify multiple
 container identities (it is a regular expression matched against
 container identities).
 
 All subscription operations occur indefinitely; the operation examines
 all current containers and then future created containers for an identity
 match. The listener is registered against any matching container. The
 subscription exists until either the context terminates or the
 IDistributionManager.unsubscribe(String, String, IType, IDomain, IEventListener)
 method is invoked with the same arguments. Using a regular expression
 matching subscription allows a listener to receive updates for containers
 whose identities are currently unknown or do not yet exist.
 
When the subscription is for a remote context (the contextIdentity does not match the local context identity), the subscription request is transmitted to the named remote context. The remote context handles the subscription using the same contract as for a local subscription. If the remote context has not yet come online, the subscription is saved until the identified remote context becomes available, at which point the subscription is transmitted.
Calling this method multiple times with the same arguments has no effect; it is idempotent.
subscribe in interface IDistributionManagercontextIdentity - the identity of context where the container(s) existidentityRegex - the identity regular expression that will be matched against a
            container's identitytype - the type of the containerdomain - the domain of the containerlistener - the listener that will be registered for receiving events from
            the matching container(s)
true if the subscription was created,
         false if it already existedIDistributionManager.unsubscribe(String, String, IType, IDomain, IEventListener)
public boolean unsubscribe(String contextIdentity,
                           String identityRegex,
                           IType type,
                           IDomain domain,
                           IEventListener listener)
IDistributionManagerIContainer instance(s)
 identified by the type, domain and identity regular expression in the
 specified context.
 
 The IDistributionManager.subscribe(String, String, IType, IDomain, IEventListener)
 method is idempotent so if it is called multiple times with the
 same arguments, one call to
 IDistributionManager.unsubscribe(String, String, IType, IDomain, IEventListener) will
 remove it.
 
Two subscriptions with equal type and domain but identity "foo.*" and "foo" are separate subscriptions and require two unsubscribe operations; the unsubscribe for "foo.*" does not unsubscribe the "foo" subscription.
unsubscribe in interface IDistributionManagercontextIdentity - the identity of the remote contextidentityRegex - the identity regular expression that will be matched against a
            container's identitytype - the type of the containerdomain - the domain of the containerlistener - the listener that will be unregistered from receiving events
            from matching container(s)
true if the subscription was found and removed,
         false otherwiseIDistributionManager.subscribe(String, String, IType, IDomain, IEventListener)protected AsyncLog getLog()
AbstractLifeCycle
getLog in class AbstractLifeCycleprotected void doStart()
AbstractLifeCycleRuntimeException or subclass
 thereof. When this method is called, the AbstractLifeCycle.isActive() method will
 return true.
doStart in class AbstractLifeCycle
protected boolean doRemoteSubscribe(String remoteContextIdentity,
                                    ISubscriptionParameters parameters,
                                    IEventListener listener)
remoteContextIdentity - the remote context for the subscriptionparameters - the parameters for the subscriptionlistener - the listener for the subscription
true if the subscription was created,
         false if it already existedprotected boolean applicationListenersExist(List<IEventListener> listeners)
listeners - the list of listeners to examine for any application listeners
false if there are any application listeners and
         unsubscription should not continue
protected boolean doRemoteUnsubscribe(String remoteContextIdentity,
                                      ISubscriptionParameters parameters,
                                      IEventListener listener)
remoteContextIdentity - the remote context to unsubscribe fromparameters - the subscription parameterslistener - the listener to unsubscribe
true if the subscription was found and removed,
         false otherwiseprotected void doDestroy()
AbstractLifeCycleRuntimeException or subclass
 thereof.
doDestroy in class AbstractLifeCyclepublic IFrameReader getFrameReader()
IDistributionManager
getFrameReader in interface IDistributionManagerIFrameReader for this contextpublic IFrameWriter getFrameWriter()
IDistributionManager
getFrameWriter in interface IDistributionManagerIFrameWriter for this context
public void requestRetransmit(String contextIdentity,
                              String identityRegularExpression,
                              IType type,
                              IDomain domain)
IRetransmissionManagerIContainer instances with matching type and identity
 subscribe for by the local context.
requestRetransmit in interface IRetransmissionManagercontextIdentity - the identity of the remote contextidentityRegularExpression - the identity regular expression to match against containers
            currently subscribed for by the local contexttype - the type of the containerdomain - the domain of the containerpublic void requestRetransmitAll(String contextIdentity)
IRetransmissionManagerIContainer instances subscribed for by the local
 context.
requestRetransmitAll in interface IRetransmissionManagercontextIdentity - the identity of the remote context
public void retransmit(String contextIdentity,
                       String identityRegularExpression,
                       IType type,
                       IDomain domain)
IRetransmissionManagerIContainer instances with
 matching type and identity to the (connected) remote context. The
 container must also currently be subscribed for by the remote context.
retransmit in interface IRetransmissionManagercontextIdentity - the identity of the remote contextidentityRegularExpression - the identity regular expression to match against containers
            currently subscribed for by the remote contexttype - the type of the containerdomain - the domain of the containerpublic void retransmitAll(String contextIdentity)
IRetransmissionManagerIContainer instances
 that the (connected) remote context has subscribed for.
retransmitAll in interface IRetransmissionManagercontextIdentity - the identity of the remote contextpublic void retransmitAllToAll()
IRetransmissionManagerIContainer instances to
 all (connected) remote contexts that have a subscription for the
 container instances.
retransmitAllToAll in interface IRetransmissionManager
public void retransmitToAll(String identityRegularExpression,
                            IType type,
                            IDomain domain)
IRetransmissionManagerIContainer instances with
 matching type and identity to all (connected) remote contexts that have a
 subscription for the matching container.
retransmitToAll in interface IRetransmissionManageridentityRegularExpression - the identity regular expression to match against containers
            currently subscribed for by any (connected) remote contexts.type - the type of the containerdomain - the domain of the containerpublic IChannel[] getConnectedChannels()
IDistributionManager
getConnectedChannels in interface IDistributionManagerIChannel instancespublic void logConnectedChannels()
public boolean addSubscriptionListener(ISubscriptionListener listener)
IDistributionManagerThe listener will be added to a list only if it does not already exist in the list. Subscription events will be notified to all listeners in the list in the order they are added.
addSubscriptionListener in interface IDistributionManagerlistener - a listener to add to an internal list.
true if the listener was added, false
         otherwisepublic boolean removeSubscriptionListener(ISubscriptionListener listener)
IDistributionManager
removeSubscriptionListener in interface IDistributionManagerlistener - the listener to remove
true if the listener was found and removed,
         false otherwise
public String updateRemoteContainer(String remoteContextIdentity,
                                    String identity,
                                    IType type,
                                    IDomain domain,
                                    String fieldName,
                                    String fieldValueAsString)
IDistributionManagerNote: This operation may be synchronous and may therefore block on I/O.
updateRemoteContainer in interface IDistributionManagerremoteContextIdentity - the identity of the remote context where the container is
            hostedidentity - the identity of the container with the field to changetype - the type of the containerdomain - the domain of the containerfieldName - the field name in the container to updatefieldValueAsString - the field value (as a string) to set as the new value for the
            named field
#setRemoteUpdateHandler(IRemoteUpdateHandler)
public void invokeRpc(String remoteContextIdentity,
                      byte[] rpcData)
IRpcTransmissionManager
invokeRpc in interface IRpcTransmissionManagerremoteContextIdentity - the identity of the remote context that the RPC should be sent
            torpcData - the RPC in its byte[] formIRpcManager
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||