fulmine.model.container.subscription
Class ContainerSubscriptionManager

java.lang.Object
  extended by fulmine.AbstractLifeCycle
      extended by fulmine.event.subscription.SubscriptionManager
          extended by fulmine.model.container.subscription.ContainerSubscriptionManager
All Implemented Interfaces:
ISubscriptionManager, IDestroyable, ILifeCycle
Direct Known Subclasses:
RemoteContainerSubscriptionManager

public class ContainerSubscriptionManager
extends SubscriptionManager

Standard implementation of an ISubscriptionManager for IContainer subscriptions. This is thread safe.

Registers for the following system events:

Author:
Ramon Servadei
See Also:
ContainerSubscription

Field Summary
protected  ILifeCycleEventListener eventHandler
           
 
Constructor Summary
ContainerSubscriptionManager(IFrameworkContext context)
          Standard constructor
ContainerSubscriptionManager(IFrameworkContext context, ISubscriptionFactory factory)
          Standard constructor
 
Method Summary
protected  void doAddListener(ISubscriptionParameters parameters, IEventListener listener)
          Called as the final step in SubscriptionManager.addListener(ISubscriptionParameters, IEventListener).
protected  void doDestroy()
          Overridden in subclasses to perform custom logic on destruction.
protected  void doEventSourceCreated(IAddressable identity)
          Called as the final step in the SubscriptionManager.eventSourceCreated(IAddressable) method.
protected  boolean doEventSourceExists(IAddressable id)
          Template method to identify if the IEventSource identified by the IAddressable argument exists.
protected  IEventSource doGetEventSource(IAddressable id)
          Template method to get the IEventSource identified by the IAddressable argument.
protected  Collection<? extends IEventSource> doGetEventSources()
          Template method to get the collection of IEventSource instances the manager will operate over.
protected  void doStart()
          Overridden in subclasses to perform custom logic on activation.
protected  AsyncLog getLog()
          Get the log to use for the object hierarchy
 
Methods inherited from class fulmine.event.subscription.SubscriptionManager
addListener, doRaiseSubscribeEvent, doRaiseUnsubscribeEvent, eventSourceCreated, eventSourceDestroyed, getContext, getListeners, getSubscribedSources, getSubscribedSources, getSubscription, getSubscriptions, includes, isSubscribed, removeListener, subscribe, toString, unsubscribe
 
Methods inherited from class fulmine.AbstractLifeCycle
checkActive, destroy, finalize, isActive, start
 
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
 

Field Detail

eventHandler

protected ILifeCycleEventListener eventHandler
Constructor Detail

ContainerSubscriptionManager

public ContainerSubscriptionManager(IFrameworkContext context)
Standard constructor

Parameters:
context - the context this manager is associated with

ContainerSubscriptionManager

public ContainerSubscriptionManager(IFrameworkContext context,
                                    ISubscriptionFactory factory)
Standard constructor

Parameters:
context - the context this manager is associated with
factory - the container subscription factory to use
Method Detail

doEventSourceCreated

protected final void doEventSourceCreated(IAddressable identity)
Description copied from class: SubscriptionManager
Called as the final step in the SubscriptionManager.eventSourceCreated(IAddressable) method. This provides sub-classes with an opportunity to perform any post creation work.

Specified by:
doEventSourceCreated in class SubscriptionManager

doAddListener

protected void doAddListener(ISubscriptionParameters parameters,
                             IEventListener listener)
Description copied from class: SubscriptionManager
Called as the final step in SubscriptionManager.addListener(ISubscriptionParameters, IEventListener). Sub-classes can perform necessary closure work when the listener is added.

Specified by:
doAddListener in class SubscriptionManager
Parameters:
parameters - the subscription parameters identifying the subscripion(s)
listener - the listener added

doGetEventSource

protected IEventSource doGetEventSource(IAddressable id)
Template method to get the IEventSource identified by the IAddressable argument.

Specified by:
doGetEventSource in class SubscriptionManager
Parameters:
id - identifies the event source
Returns:
the IEventSource implementation to use

doEventSourceExists

protected boolean doEventSourceExists(IAddressable id)
Template method to identify if the IEventSource identified by the IAddressable argument exists.

Specified by:
doEventSourceExists in class SubscriptionManager
Parameters:
id - identifies the event source
Returns:
true if the container exists in the current context scope

doStart

protected final void doStart()
Description copied from class: AbstractLifeCycle
Overridden in subclasses to perform custom logic on activation. Any exceptions should be thrown as a RuntimeException or subclass thereof. When this method is called, the AbstractLifeCycle.isActive() method will return true.

Specified by:
doStart in class AbstractLifeCycle

doDestroy

protected void doDestroy()
Description copied from class: AbstractLifeCycle
Overridden in subclasses to perform custom logic on destruction. Any exceptions should be thrown as a RuntimeException or subclass thereof.

Overrides:
doDestroy in class SubscriptionManager

getLog

protected AsyncLog getLog()
Description copied from class: AbstractLifeCycle
Get the log to use for the object hierarchy

Overrides:
getLog in class SubscriptionManager
Returns:
the log to use for the object hierarchy

doGetEventSources

protected Collection<? extends IEventSource> doGetEventSources()
Description copied from class: SubscriptionManager
Template method to get the collection of IEventSource instances the manager will operate over.

Specified by:
doGetEventSources in class SubscriptionManager
Returns:
a collection of IEventSource instances


Copyright © 2007-2009. All Rights Reserved.