org.benow.web.subscription
Class SubscriptionHandler

java.lang.Object
  extended by java.lang.Thread
      extended by org.benow.web.subscription.SubscriptionHandler
All Implemented Interfaces:
java.lang.Runnable, org.benow.java.notify.condition.NotificationListener

public abstract class SubscriptionHandler
extends java.lang.Thread
implements org.benow.java.notify.condition.NotificationListener

A subscription handler bridges between repository notifications and subscriptions. Subscribed objects are registered (notifyFor(PersistentObject)) and notification of a required subscription event are triggered (doNotify()). The actual response for the subscription is left to the implementors.

Author:
andy

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SubscriptionHandler(java.lang.Class<?>[] subscribedClasses)
           
 
Method Summary
protected abstract  void doNotify(org.benow.security.user.User user, org.benow.repository.util.PersistentObject obj)
          Called when the object has changed and notification is to take place
protected  void init(java.lang.Class<?>[] subscribedClasses)
          initialize the handler by fetching and adding all subscriptions
 void notifyFor(org.benow.repository.util.PersistentObject obj)
           
 void onNotify(org.benow.java.notify.condition.NotificationSource source, org.benow.java.notify.condition.NotificationCondition condition)
           
 void run()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubscriptionHandler

public SubscriptionHandler(java.lang.Class<?>[] subscribedClasses)
Method Detail

init

protected void init(java.lang.Class<?>[] subscribedClasses)
initialize the handler by fetching and adding all subscriptions

Parameters:
subscribedClasses -

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

doNotify

protected abstract void doNotify(org.benow.security.user.User user,
                                 org.benow.repository.util.PersistentObject obj)
Called when the object has changed and notification is to take place

Parameters:
user -
obj -

onNotify

public void onNotify(org.benow.java.notify.condition.NotificationSource source,
                     org.benow.java.notify.condition.NotificationCondition condition)
Specified by:
onNotify in interface org.benow.java.notify.condition.NotificationListener

notifyFor

public void notifyFor(org.benow.repository.util.PersistentObject obj)