wt.notify
Class StandardNotificationManager

java.lang.Object
  extended bywt.services.StandardManager
      extended bywt.notify.StandardNotificationManager
All Implemented Interfaces:
Manager, NetFactor, NotificationManager, NotificationManagerSvr, Serializable

public class StandardNotificationManager
extends StandardManager
implements NotificationManager, NotificationManagerSvr, Serializable

Standard implementation of the notification service interfaces. It is mainly responsible for the capturing and queuing of notifications. It also maintains a notification list cache for performance reasons.

Use the newStandardNotificationManager static factory method(s), not the StandardNotificationManager constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: true

Extendable: false

See Also:
Serialized Form

Nested Class Summary
(package private)  class StandardNotificationManager.CheckinListener
          -- Listener class to listen to checkins of Notifiable objects: - if the original object is Notifiable and has subscriptions, then its subscriptions are moved to the working copy (checked in object).
(package private)  class StandardNotificationManager.DeletionListener
          -- Listener class to listen to deletion of objects: - if deleted object is Notifiable, checks if there are associated subscriptions and deletes them
(package private)  class StandardNotificationManager.DomainListener
          -- Listener class to listen to domain events: - updates notification lists to reflect domain hierarchy changes - deletes notification lists when a domain is deleted
(package private)  class StandardNotificationManager.IterationListener
          -- Listener class to listen to new iterations of Notifiable objects: - copies subscriptions to the new iteration if the iteration is for a new version; if TRANSFER_ON_REVISE is true, copies all subscriptions and if false, copies only the NEW VERSION subscriptions
(package private)  class StandardNotificationManager.NotificationEventListener
          -- Listener class for notification (policy and object): - if the there is a non-empty notification list for the object's domain, type, state and event then a request for notification is sent.
 
Field Summary
private static String ADMIN_RESOURCE
           
private static String CHECKIN_EVENT
           
private static String CLASSNAME
           
private static String CREATE_EVENT
           
private static String MODIFY_EVENT
           
private static String NEW_VERSION_EVENT
           
private static String NOTIFICATION_QUEUE_NAME
          Notification queue name.
private static String NOTIFICATION_SCHEDULE_QUEUE_NAME
          Name of the queue that holds expiration requests for object subscriptions.
private  ProcessingQueue notificationQueue
           
private  ScheduleQueue notificationScheduleQueue
           
private static String NOTIFY_STRING
           
private static NotificationListCache notifyCache
           
private static WTProperties notifyProperties
           
private static String OBJECT_NOTIFICATION_TEMPLATE
           
private static String POLICY_NOTIFICATION_TEMPLATE
           
private static long QUEUE_INTERVAL
           
private static String RESOURCE
           
private static String SB_CHECKIN_EVENT
           
private static String SENDER_EMAIL
           
private static String STATE_ATTRIBUTE_NAME
           
private static boolean TRANSFER_ON_REVISE
           
private static Hashtable typeEventTable
           
private static boolean USE_QUEUE
           
private static boolean USE_TEMPLATE
           
private static boolean VERBOSE
           
private static boolean VERBOSE_EXECUTION
           
private static boolean VERBOSE_POLICY
           
 
Fields inherited from class wt.services.StandardManager
 
Fields inherited from interface wt.services.Manager
MANAGER_SERVICE, STARTUP_AUTOMATIC, STARTUP_MANUAL, STATUS_EMERGENCY_SHUTDOWN, STATUS_EMERGENCY_SHUTTING_DOWN, STATUS_SHUTDOWN, STATUS_SHUTDOWN_ERRORS, STATUS_SHUTDOWN_FAILURE, STATUS_SHUTTING_DOWN, STATUS_STARTED, STATUS_STARTED_ERRORS, STATUS_STARTING_UP, STATUS_STARTUP_FAILURE
 
Constructor Summary
StandardNotificationManager()
           
 
Method Summary
protected  void addEventToObject(ObjectReference target_ref, String event_key)
          Updates the event set of the object passed as argument by the count given.
 NotificationRule addNotificationRule(Selector selector, NotificationSet set)
          Deprecated.  
protected  void addSubscriberToObject(ObjectReference ref, ObjectSubscription subscription, WTPrincipal owner)
          Subscribes to an object given a reference to the subscriber and a subscription object.
protected static void addUserSubscription(ObjectSubscription subscription, Vector equiv_subs, Vector dist_lists)
          Updates vectors of subscriptions and distribution lists with the content of the subscritpion passed as argument.
private  void constructRuleSet(NotificationList list, Selector selector)
          Constructs a rule set for the given list and selector.
static void copyCheckinSubscription(ObjectIdentifier obj_id, ObjectIdentifier predecessor_id)
          Does actual copying of checkin event subscriptions to a new iteration.
static void copySubscriptions(ObjectIdentifier target_obj_id, ObjectIdentifier source_obj_id)
           
static Notification createNotification(ObjectSubscription subscription, DistributionList subscribers)
          Creates notification.
private  NotificationList createNotificationList(Selector selector)
          Creates notification policy list for the given selector.
 void createNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key, Hashtable attribute_value_map, Vector principal_refs)
          Creates a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.
 void createNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key, Vector principal_refs)
          Creates a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.
private static void createNotifyCache()
           
private static void debug(String displayObject)
           
private static void debug(String displayObject, boolean printStackTrace)
           
private static void debug(String methodName, String displayObject)
           
private static void debug(String methodName, String displayObject, boolean printStackTrace)
           
private  void deleteNotificationLists(AdminDomainRef domain_ref)
          Deletes the notification lists for a domain.
 void deleteNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key)
          Deletes a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.
 void deleteNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key, Hashtable attribute_value_map)
          Deletes a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.
 void deleteNotificationRules(AdminDomainRef domain_ref)
          Deletes all notification rules within a domain.
protected  void deleteSubscriptions(WTSet targets)
          Deletes subscriptions associated with object passed as argument.
private static boolean equivalent(ObjectSubscription subs1, ObjectSubscription subs2)
           
private static boolean equivalent(String str1, String str2)
           
static String eventToString(String event)
          Debugging method.
static void expireSubscription(ObjectIdentifier obj_id, Timestamp time)
          Deletes the subscription passed as argument.
protected static boolean filterSubscription(ObjectIdentifier obj_id, ObjectSubscription subscription)
          Returns true if target's attribute-value pair matches that of the subscription; otherwise returns false.
 String getConceptualClassname()
          Deprecated.  
private static Vector getExistingSubscribers(ObjectSubscription subscription)
           
 String getMessage(WTUser user, String template, Object ctxt)
          Returns the notification message given its name.
 NotificationList getNotificationList(Selector selector)
          Returns the notification list for a given selector.
protected  NotificationList getNotificationList(String event_type, Object target_object)
          Auxiliary method used to retirve the notification list.
 NotificationRule getNotificationRule(Selector selector)
          Returns notification rule given the selector.
 Enumeration getNotificationRules(AdminDomainRef domain_ref)
          Returns all the notification policy rules for the specified domain in the form of an enumeration.
 Enumeration getNotificationSets(WTStringSet rule_set, ObjectIdentifier obj_id)
          Returns an enumeration of NotificationSet from notification rules in the rule set that match the specified object, as far as attribute values are concerned.
private static NotificationListCache getNotifyCache()
           
 WTStringSet getRelevantEvents(Object target)
          Returns all events that are relevant for a specific object.
private  AttributeValueSelector getRuleSelector(AdminDomainRef domain_ref, String type_id, String event_key, Hashtable attribute_value_map)
          Gets a notification rule selector for the specified domain, type, event, and attribute map.
protected static Enumeration getSubscriptions(ObjectIdentifier target_id, String event_key)
          Returns all subscriptions for the object and event.
 Enumeration getSubscriptions(Object subscriber, Notifiable target, String event_key)
          Returns all subscriptions for a given subscriber, target and event key.
private static Hashtable getTypeEventTable(WTProperties properties)
          Sets the type event table, that maps types into sets of events.
 ArrayList getUserSubscriptions(WTUser user, Notifiable target)
          Returns the subscriptions for a specific object, for which the subscriber is a principal.
private static boolean isNewVersion(Object target_obj)
          Returns whether a target object is indeed a new version (necessary given that NEW_VERSION events are emitted even when the new object isn't a new version).
static void moveNewVersionSubscription(ObjectIdentifier obj_id, ObjectIdentifier predecessor_id)
          Does actual subscription copying from a target object to another.
static void moveSubscriptions(ObjectIdentifier target_obj_id, ObjectIdentifier source_obj_id)
          Moves subscriptions to a target object from its predecessor.
static StandardNotificationManager newStandardNotificationManager()
          No-arg constructor.
static void notifyObjectEvent(ObjectIdentifier obj_id, String event_key)
          Gets the subscriptions associated with the object and event.
static void notifyObjectSubscription(ObjectIdentifier subs_id)
          Carries out the actual notification based on object subscriptions for non-user subscribers.
static void notifyPolicyEvent(ObjectIdentifier obj_id, String event_key, WTStringSet rule_set)
          Gets the notification sets for notification policy rules associated with the object and event.
static void notifyPolicyListener(ObjectIdentifier obj_id, String event_key, ObjectIdentifier listener_id)
          Carries out the actual notification based on notification policy rules for non-user subscribers.
protected  void performStartupProcess()
          Manager initialization: mostly subscription to events of interest.
static void processSend(Notification notification)
          Sends a queued notification request.
 void queueCopyCheckinSubscription(Iterated target, Iterated predecessor)
          Queues copying of checkin event subscriptions to a new iteration.
 void queueMoveNewVersionSubscription(Notifiable target, ObjectReference predecessor_ref)
          Queues moving a subscription to the new version event to a new iteration.
 void queueMoveNewVersionSubscription(WTList targets, WTList predecessor_refs)
          Multi-object version of this method.
 void queueMoveSubscriptions(Notifiable target, ObjectReference predecessor_ref)
          Queues a request to move subscriptions from one target object to another.
 void queueMoveSubscriptions(WTList targets, WTList predecessors)
          Multi-Object version of the API to Queue requests to move subscriptions from one target object to another.
private  void queueNotification(String method_name, Class[] argTypes, ArrayList args)
          Multi-object version of this method.
private  void queueNotification(String method_name, Class[] argTypes, Object[] args)
          Adds an entry to the notification queue.
 void queueObjectNotification(Notifiable target, String event_key)
          Queues a notification generated from an object subscription.
 void queueObjectNotification(WTList targets, String event_key)
          Multi-object version of this method.
 void queueObjectSubscriptionNotification(ObjectSubscription subscription)
          Queues a subscription object for an event that has occurred when the subscriber is an ObjectSubscriptionListener (as opposed to a user).
 void queuePolicyListenerNotification(ObjectIdentifier obj_id, String event_key, NotificationSet set)
          Queues a request for notification of an event that has occurred, based on a notification policy rule, when the subscriber is an ObjectSubscriptionListener (as opposed to a user).
 void queuePolicyNotification(Notifiable target, String event_key, NotificationList list)
          Queues a notification of an event generated based on a notification policy rule.
 void queuePolicyNotification(WTList targets, String event_key, WTList lists)
          Multi-object version of this method.
 void queueSubscriptionExpiration(ObjectSubscription subscription)
          Queues a request to delete a subscription at the expiration time.
private  String recipientsToString(EnumeratorVector principal_refs)
           
protected  void registerListeners()
          Creates and registers event listeners.
protected static void removeObjectEvent(ObjectIdentifier obj_id, String event_key)
          Removes event from object set.
protected  void resolveSubscriber(Object subscriber_obj, Vector subscribers)
          Adds references to users corresponding to the subscribe_obj passed as an argument, to the subscribers Vector.
protected static boolean sameTime(Timestamp time1, Timestamp time2)
          Returns true if the two timestamps differ by less than one second.
 void send(Notification notification)
          Sends an email message to the recipients specified by the notification's distribution list.
protected static void sendObjectNotification(ObjectSubscription subscription, DistributionList subscribers)
          Constructs and queues notification.
protected static void sendPolicyNotification(ObjectIdentifier obj_id, String event_key, NotificationSet set)
          Constructs and queues policy notification.
protected  ObjectSubscription setAdhocRights(ObjectSubscription subscription, WTPrincipal owner)
          Sets add hoc rights to owner and subscriber (if a user) to read/write/delete subscription.
protected  void startNotificationQueue()
          Starts notification queue.
protected  void startScheduleQueue()
          Starts schedule queue.
private  void subscribeToAllEvents(KeyedEventListener listener)
          Subscribes to all events to be listened to.
 void subscribeToObject(Vector subscribers, ObjectSubscription subscription)
          Subscribes to object event.
static String targetToString(ObjectReference target_ref)
          Produces identifying information about a target object.
 void unsubscribeToObject(Vector subscriptions)
          Deletes all object subscriptions passed as argument.
private  void updateNotificationList(NotificationList list)
          Updates the specified notification list.
private  void updateNotificationLists(AdminDomainRef domain_ref)
          Updates all existing notification lists for the domain passed as argument and its descendents.
 void updateNotificationLists(Selector selector)
          Deprecated.  
 void updateNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key, Hashtable attribute_value_map, Vector principal_refs)
          Updates a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.
 void updateNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key, Vector principal_refs)
          Updates a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.
 
Methods inherited from class wt.services.StandardManager
emergencyShutdown, emergencyShutdownComplete, emergencyShuttingDown, getClassInfo, getManagerService, getManagerStatus, getName, getStartupType, init, initialize, initialize, isStarted, newStandardManager, newStandardManager, performEmergencyShutdownProcess, performShutdownProcess, registerEvents, setManagerService, shutdown, shutdownFailure, shutdownSuccess, shuttingDown, started, startedErrors, startingUp, startup, startupFailure, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

NOTIFICATION_QUEUE_NAME

private static final String NOTIFICATION_QUEUE_NAME
Notification queue name.

See Also:
Constant Field Values

NOTIFICATION_SCHEDULE_QUEUE_NAME

private static final String NOTIFICATION_SCHEDULE_QUEUE_NAME
Name of the queue that holds expiration requests for object subscriptions.

See Also:
Constant Field Values

notificationQueue

private ProcessingQueue notificationQueue

notificationScheduleQueue

private ScheduleQueue notificationScheduleQueue

notifyCache

private static NotificationListCache notifyCache

STATE_ATTRIBUTE_NAME

private static final String STATE_ATTRIBUTE_NAME
See Also:
Constant Field Values

NOTIFY_STRING

private static final String NOTIFY_STRING
See Also:
Constant Field Values

typeEventTable

private static Hashtable typeEventTable

CHECKIN_EVENT

private static final String CHECKIN_EVENT
See Also:
Constant Field Values

CREATE_EVENT

private static final String CREATE_EVENT
See Also:
Constant Field Values

MODIFY_EVENT

private static final String MODIFY_EVENT
See Also:
Constant Field Values

NEW_VERSION_EVENT

private static final String NEW_VERSION_EVENT
See Also:
Constant Field Values

SB_CHECKIN_EVENT

private static final String SB_CHECKIN_EVENT
See Also:
Constant Field Values

OBJECT_NOTIFICATION_TEMPLATE

private static final String OBJECT_NOTIFICATION_TEMPLATE
See Also:
Constant Field Values

POLICY_NOTIFICATION_TEMPLATE

private static final String POLICY_NOTIFICATION_TEMPLATE
See Also:
Constant Field Values

ADMIN_RESOURCE

private static final String ADMIN_RESOURCE
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

VERBOSE_EXECUTION

private static boolean VERBOSE_EXECUTION

VERBOSE_POLICY

private static boolean VERBOSE_POLICY

USE_QUEUE

private static boolean USE_QUEUE

USE_TEMPLATE

private static boolean USE_TEMPLATE

TRANSFER_ON_REVISE

private static boolean TRANSFER_ON_REVISE

QUEUE_INTERVAL

private static long QUEUE_INTERVAL

SENDER_EMAIL

private static String SENDER_EMAIL

notifyProperties

private static WTProperties notifyProperties
Constructor Detail

StandardNotificationManager

public StandardNotificationManager()
Method Detail

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Overrides:
getConceptualClassname in class StandardManager
Returns:
String

newStandardNotificationManager

public static StandardNotificationManager newStandardNotificationManager()
                                                                  throws WTException
No-arg constructor.

Supported API: false

Returns:
StandardNotificationManager
Throws:
WTException

performStartupProcess

protected void performStartupProcess()
                              throws ManagerException
Manager initialization: mostly subscription to events of interest.

Supported API: false

Overrides:
performStartupProcess in class StandardManager
Throws:
ManagerException

expireSubscription

public static void expireSubscription(ObjectIdentifier obj_id,
                                      Timestamp time)
                               throws WTException
Deletes the subscription passed as argument.

This method should be private and non static, but since it is invoked by Reflection to handle queued requests it must be public.

Supported API: false

Parameters:
obj_id -
time -
Throws:
WTException

moveSubscriptions

public static void moveSubscriptions(ObjectIdentifier target_obj_id,
                                     ObjectIdentifier source_obj_id)
                              throws WTException
Moves subscriptions to a target object from its predecessor.

This method should be private and non static, but since it is invoked by Reflection to handle queued requests it must be public.

Supported API: false

Parameters:
target_obj_id - the target object.
source_obj_id - the source object.
Throws:
WTException

notifyObjectEvent

public static void notifyObjectEvent(ObjectIdentifier obj_id,
                                     String event_key)
                              throws WTException
Gets the subscriptions associated with the object and event. Generates a notification for each subscriber to each of the subscriptions and queues a request to send the notification.

This method should be private and non static, but since it is invoked by Reflection to handle queued requests it must be public.

Supported API: false

Parameters:
obj_id -
event_key -
Throws:
WTException

notifyObjectSubscription

public static void notifyObjectSubscription(ObjectIdentifier subs_id)
                                     throws WTException
Carries out the actual notification based on object subscriptions for non-user subscribers.

This method should be private and non static, but since it is invoked by Reflection to handle queued requests it must be public.

Supported API: false

Parameters:
subs_id -
Throws:
WTException

notifyPolicyEvent

public static void notifyPolicyEvent(ObjectIdentifier obj_id,
                                     String event_key,
                                     WTStringSet rule_set)
                              throws WTException
Gets the notification sets for notification policy rules associated with the object and event. Generates a notification for each distinct set and queues a request to send the notification.

This method should be private and non static, but since it is invoked by Reflection it must be public.

Supported API: false

Parameters:
obj_id -
event_key -
rule_set -
Throws:
WTException

notifyPolicyListener

public static void notifyPolicyListener(ObjectIdentifier obj_id,
                                        String event_key,
                                        ObjectIdentifier listener_id)
                                 throws WTException
Carries out the actual notification based on notification policy rules for non-user subscribers.

This method should be private and non static, but since it is invoked by Reflection to handle queued requests it must be public.

Supported API: false

Parameters:
obj_id -
event_key -
listener_id -
Throws:
WTException

processSend

public static void processSend(Notification notification)
                        throws WTException
Sends a queued notification request.

This method should be private and non static, but since it is invoked by Reflection it must be public.

Supported API: false

Parameters:
notification -
Throws:
WTException

createNotificationRule

public void createNotificationRule(AdminDomainRef domain_ref,
                                   String type_id,
                                   String event_key,
                                   Vector principal_refs)
                            throws WTException
Creates a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.

Supported API: true

Specified by:
createNotificationRule in interface NotificationManager
Parameters:
domain_ref - reference to the domain the rule is for
type_id - logical or persisted type identifier
event_key - event key (defined in the wt.admin.adminEventResource resource bundle)
principal_refs - principal references for notification recipients (Vector of WTPrincipalReference)
Throws:
WTException

createNotificationRule

public void createNotificationRule(AdminDomainRef domain_ref,
                                   String type_id,
                                   String event_key,
                                   Hashtable attribute_value_map,
                                   Vector principal_refs)
                            throws WTException
Creates a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.

Supported API: false

Specified by:
createNotificationRule in interface NotificationManager
Parameters:
domain_ref - reference to the domain the rule is for
type_id - logical or persisted type identifier
event_key - event key (defined in the wt.admin.adminEventResource resource bundle)
attribute_value_map - attribute name, value pairs to select an object (name is Hashtable key); may be null
principal_refs - principal references for notification recipients (Vector of WTPrincipalReference)
Throws:
WTException

deleteNotificationRule

public void deleteNotificationRule(AdminDomainRef domain_ref,
                                   String type_id,
                                   String event_key)
                            throws WTException
Deletes a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.

Supported API: true

Specified by:
deleteNotificationRule in interface NotificationManager
Parameters:
domain_ref - reference to the domain the rule is for
type_id - logical or persisted type identifier
event_key - event key (defined in the wt.admin.adminEventResource resource bundle)
Throws:
WTException

deleteNotificationRule

public void deleteNotificationRule(AdminDomainRef domain_ref,
                                   String type_id,
                                   String event_key,
                                   Hashtable attribute_value_map)
                            throws WTException
Deletes a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.

Supported API: false

Specified by:
deleteNotificationRule in interface NotificationManager
Parameters:
domain_ref - reference to the domain the rule is for
type_id - logical or persisted type identifier
event_key - event key (defined in the wt.admin.adminEventResource resource bundle)
attribute_value_map - attribute name, value pairs to select an object (name is Hashtable key); may be null
Throws:
WTException

deleteNotificationRules

public void deleteNotificationRules(AdminDomainRef domain_ref)
                             throws WTException
Deletes all notification rules within a domain.

This method is intended for testing purposes only, to support automated tests that need to reinitialize the testing environment.

Supported API: false

Specified by:
deleteNotificationRules in interface NotificationManager
Parameters:
domain_ref - reference to the domain the rule is for
Throws:
WTException

updateNotificationRule

public void updateNotificationRule(AdminDomainRef domain_ref,
                                   String type_id,
                                   String event_key,
                                   Vector principal_refs)
                            throws WTException
Updates a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.

Supported API: true

Specified by:
updateNotificationRule in interface NotificationManager
Parameters:
domain_ref - reference to the domain the rule is for
type_id - logical or persisted type identifier
event_key - event key (defined in the wt.admin.adminEventResource resource bundle)
principal_refs - principal references for notification recipients (Vector of WTPrincipalReference)
Throws:
WTException

updateNotificationRule

public void updateNotificationRule(AdminDomainRef domain_ref,
                                   String type_id,
                                   String event_key,
                                   Hashtable attribute_value_map,
                                   Vector principal_refs)
                            throws WTException
Updates a notification rule defining which users and groups should be notified when a specified event occurs for an object of a specified type, within a domain.

Supported API: false

Specified by:
updateNotificationRule in interface NotificationManager
Parameters:
domain_ref - reference to the domain the rule is for
type_id - logical or persisted type identifier
event_key - event key (defined in the wt.admin.adminEventResource resource bundle)
attribute_value_map - attribute name, value pairs to select an object (name is Hashtable key); may be null
principal_refs - principal references for notification recipients (Vector of WTPrincipalReference)
Throws:
WTException

getNotificationList

public NotificationList getNotificationList(Selector selector)
                                     throws WTException
Returns the notification list for a given selector.

Supported API: false

Specified by:
getNotificationList in interface NotificationManager
Parameters:
selector -
Returns:
NotificationList
Throws:
WTException

updateNotificationLists

public void updateNotificationLists(Selector selector)
                             throws WTException
Deprecated.  

Update the list of the selector and all lists associated with selectors that are more specific than the given one.

This method is no longer needed. The createNotificationRule, deleteNotificationRule, and updateNotificationRule methods update the lists.

Supported API: true

Specified by:
updateNotificationLists in interface NotificationManager
Parameters:
selector -
Throws:
WTException
See Also:
createNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key, Vector principal_refs), deleteNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key), updateNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key, Vector principal_refs)

addNotificationRule

public NotificationRule addNotificationRule(Selector selector,
                                            NotificationSet set)
                                     throws WTException
Deprecated.  

Adds a notification rule given the selector and notification set. If there is a rule for the same selector the rule is replaced. Returns the persisted rule.

Supported API: true

Specified by:
addNotificationRule in interface NotificationManager
Parameters:
selector -
set -
Returns:
NotificationRule
Throws:
WTException
See Also:
createNotificationRule(AdminDomainRef domain_ref, String type_id, String event_key, Vector principal_refs)

getNotificationRule

public NotificationRule getNotificationRule(Selector selector)
                                     throws WTException
Returns notification rule given the selector. If rule for the given selector doesn't exist it returns null.

Supported API: false

Specified by:
getNotificationRule in interface NotificationManager
Parameters:
selector -
Returns:
NotificationRule
Throws:
WTException

getNotificationRules

public Enumeration getNotificationRules(AdminDomainRef domain_ref)
                                 throws WTException
Returns all the notification policy rules for the specified domain in the form of an enumeration.

Supported API: false

Specified by:
getNotificationRules in interface NotificationManager
Parameters:
domain_ref -
Returns:
Enumeration
Throws:
WTException

getMessage

public String getMessage(WTUser user,
                         String template,
                         Object ctxt)
                  throws WTException
Returns the notification message given its name.

Supported API: false

Specified by:
getMessage in interface NotificationManager
Parameters:
user -
template -
ctxt -
Returns:
String
Throws:
WTException

send

public void send(Notification notification)
          throws NotificationException,
                 WTException
Sends an email message to the recipients specified by the notification's distribution list.

The message is not sent right away but queued into the notification queue for asynchronous processing.

Supported API: false

Specified by:
send in interface NotificationManager
Parameters:
notification -
Throws:
NotificationException
WTException

subscribeToObject

public void subscribeToObject(Vector subscribers,
                              ObjectSubscription subscription)
                       throws WTException
Subscribes to object event. Subscribers is a vector of principals (users and groups), teams and subscriber objects (or references to them). ObjectSubscription contains the subscription information. If the ObjectSubscription object is persistent then the key of the newly created subscriptions will be the same; otherwise a new key is generated. This latter feature allows the user of this method to "add" subscriptions to a user action. A side effect of this method is that the target object's event set may be updated (if a subscription for an event not already in the event set is added).

Supported API: true

Specified by:
subscribeToObject in interface NotificationManager
Parameters:
subscribers -
subscription -
Throws:
WTException

unsubscribeToObject

public void unsubscribeToObject(Vector subscriptions)
                         throws WTException
Deletes all object subscriptions passed as argument.

Supported API: true

Specified by:
unsubscribeToObject in interface NotificationManager
Parameters:
subscriptions -
Throws:
WTException

getSubscriptions

public Enumeration getSubscriptions(Object subscriber,
                                    Notifiable target,
                                    String event_key)
                             throws WTException
Returns all subscriptions for a given subscriber, target and event key. Any argument can be null, in which case all subscriptions that match the arguments that are not null are retrieved. If no subscription is found returns an empty enumeration. For example,

getSubscription (subs, null, null)

returns all subscriptions for the given subscriber, for all targets and events. In particular, getSubscriptions (null, null, null) returns all existing subscriptions.

The subscriber must be a user, a reference to a user, a subscriber object or a reference to a subscriber object.

Supported API: false

Specified by:
getSubscriptions in interface NotificationManager
Parameters:
subscriber -
target -
event_key -
Returns:
Enumeration
Throws:
WTException

getRelevantEvents

public WTStringSet getRelevantEvents(Object target)
                              throws WTException
Returns all events that are relevant for a specific object. These events depend on which interfaces are implemented by the object. A list of the relevant events for each interface is customizable through the wt.properties file. If the object is a reference object, that is it implements WTReference, then the object is retrieved and used rather than the reference itself.

Supported API: false

Specified by:
getRelevantEvents in interface NotificationManager
Parameters:
target -
Returns:
WTStringSet
Throws:
WTException

getUserSubscriptions

public ArrayList getUserSubscriptions(WTUser user,
                                      Notifiable target)
                               throws WTException
Returns the subscriptions for a specific object, for which the subscriber is a principal. An ArrayList is returned where the first element is a Vector of modifiable subscriptions (those either created by the user passed as argument or for which the user is a subscriber) and the second element is a Vector of read only subscriptions (the remaining ones).

Supported API: false

Specified by:
getUserSubscriptions in interface NotificationManager
Parameters:
user -
target -
Returns:
ArrayList
Throws:
WTException

getNotificationSets

public Enumeration getNotificationSets(WTStringSet rule_set,
                                       ObjectIdentifier obj_id)
                                throws WTException
Returns an enumeration of NotificationSet from notification rules in the rule set that match the specified object, as far as attribute values are concerned.

Supported API: false

Specified by:
getNotificationSets in interface NotificationManagerSvr
Parameters:
rule_set - rule set
obj_id - identifier of object to compare against rule set
Returns:
Enumeration
Throws:
WTException

queueMoveSubscriptions

public void queueMoveSubscriptions(Notifiable target,
                                   ObjectReference predecessor_ref)
                            throws WTException
Queues a request to move subscriptions from one target object to another. Used when a new iteration of an object is created.

Supported API: false

Specified by:
queueMoveSubscriptions in interface NotificationManagerSvr
Parameters:
target -
predecessor_ref -
Throws:
WTException

queueMoveSubscriptions

public void queueMoveSubscriptions(WTList targets,
                                   WTList predecessors)
                            throws WTException
Multi-Object version of the API to Queue requests to move subscriptions from one target object to another. Used when a new iterations of objects are created.

Supported API: false

Specified by:
queueMoveSubscriptions in interface NotificationManagerSvr
Parameters:
targets -
predecessors - Collection of predecessor objects or object references; this method works with either.
Throws:
WTException

queueObjectNotification

public void queueObjectNotification(Notifiable target,
                                    String event_key)
                             throws WTException
Queues a notification generated from an object subscription.

Supported API: false

Specified by:
queueObjectNotification in interface NotificationManagerSvr
Parameters:
target -
event_key -
Throws:
WTException

queueObjectNotification

public void queueObjectNotification(WTList targets,
                                    String event_key)
                             throws WTException
Multi-object version of this method. Queues a notification generated from an object subscription.

Supported API: false

Specified by:
queueObjectNotification in interface NotificationManagerSvr
Parameters:
targets -
event_key -
Throws:
WTException

queueObjectSubscriptionNotification

public void queueObjectSubscriptionNotification(ObjectSubscription subscription)
                                         throws WTException
Queues a subscription object for an event that has occurred when the subscriber is an ObjectSubscriptionListener (as opposed to a user). When the request is processed, the subscriber's notifyObjectEvent method is called.

Supported API: false

Specified by:
queueObjectSubscriptionNotification in interface NotificationManagerSvr
Parameters:
subscription -
Throws:
WTException

queuePolicyListenerNotification

public void queuePolicyListenerNotification(ObjectIdentifier obj_id,
                                            String event_key,
                                            NotificationSet set)
                                     throws WTException
Queues a request for notification of an event that has occurred, based on a notification policy rule, when the subscriber is an ObjectSubscriptionListener (as opposed to a user). When the request is processed, the subscriber's notifyObjectEvent method is called.

Supported API: false

Specified by:
queuePolicyListenerNotification in interface NotificationManagerSvr
Parameters:
obj_id -
event_key -
set -
Throws:
WTException

queuePolicyNotification

public void queuePolicyNotification(Notifiable target,
                                    String event_key,
                                    NotificationList list)
                             throws WTException
Queues a notification of an event generated based on a notification policy rule.

Supported API: false

Specified by:
queuePolicyNotification in interface NotificationManagerSvr
Parameters:
target -
event_key -
list -
Throws:
WTException

queuePolicyNotification

public void queuePolicyNotification(WTList targets,
                                    String event_key,
                                    WTList lists)
                             throws WTException
Multi-object version of this method. Queues a notification of an event generated based on a notification policy rule.

Supported API: false

Specified by:
queuePolicyNotification in interface NotificationManagerSvr
Parameters:
targets -
event_key -
lists -
Throws:
WTException

queueSubscriptionExpiration

public void queueSubscriptionExpiration(ObjectSubscription subscription)
                                 throws WTException
Queues a request to delete a subscription at the expiration time.

Supported API: false

Specified by:
queueSubscriptionExpiration in interface NotificationManagerSvr
Parameters:
subscription -
Throws:
WTException

queueNotification

private void queueNotification(String method_name,
                               Class[] argTypes,
                               Object[] args)
                        throws WTException
Adds an entry to the notification queue.

Parameters:
method_name - name of method for processing queued request.
argTypes - argument types.
Returns:
args arguments
Throws:
WTException

queueNotification

private void queueNotification(String method_name,
                               Class[] argTypes,
                               ArrayList args)
                        throws WTException
Multi-object version of this method. Adds an entry to the notification queue.

Parameters:
method_name - name of method for processing queued request.
argTypes - argument types.
Returns:
args arguments
Throws:
WTException

getRuleSelector

private AttributeValueSelector getRuleSelector(AdminDomainRef domain_ref,
                                               String type_id,
                                               String event_key,
                                               Hashtable attribute_value_map)
                                        throws WTException
Gets a notification rule selector for the specified domain, type, event, and attribute map.

Parameters:
domain_ref - reference to the domain the rule is for
type_id - logical or persisted type identifier
event_key - event key (defined in the wt.admin.adminEventResource resource bundle)
attribute_value_map - attribute name, value pairs to select an object
Returns:
AttributeValueSelector notification rule selector
Throws:
WTException

constructRuleSet

private void constructRuleSet(NotificationList list,
                              Selector selector)
                       throws WTException
Constructs a rule set for the given list and selector. The set is constructed by combining all sets of rules whose selector is a parent selector of the given one.

Parameters:
list - notification list.
selector - selector.
Returns:
WTStringSet rule set constructed
Throws:
WTException - if the selector is not appropriate for a list or if there was a problem retrieving or creating the list.

createNotificationList

private NotificationList createNotificationList(Selector selector)
                                         throws WTException
Creates notification policy list for the given selector. List is constructed by combining all rules whose selector is a parent selector of the given one.

Parameters:
selector - selector to be associated with the list.
Returns:
NotificationList notification policy list created.
Throws:
WTException - if the selector is not appropriate for a list or if there was a problem retrieving or creating the list.

deleteNotificationLists

private void deleteNotificationLists(AdminDomainRef domain_ref)
                              throws WTException
Deletes the notification lists for a domain.

Parameters:
domain_ref -
Throws:
WTException

updateNotificationList

private void updateNotificationList(NotificationList list)
                             throws WTException
Updates the specified notification list.

Parameters:
list -
Throws:
WTException - if there was a problem retrieving or creating the list.

isNewVersion

private static boolean isNewVersion(Object target_obj)
                             throws WTException
Returns whether a target object is indeed a new version (necessary given that NEW_VERSION events are emitted even when the new object isn't a new version).

Supported API: false

Parameters:
target_obj -
Throws:
WTException

queueMoveNewVersionSubscription

public void queueMoveNewVersionSubscription(Notifiable target,
                                            ObjectReference predecessor_ref)
                                     throws WTException
Queues moving a subscription to the new version event to a new iteration.

Supported API: false

Parameters:
target -
predecessor_ref -
Throws:
WTException

queueMoveNewVersionSubscription

public void queueMoveNewVersionSubscription(WTList targets,
                                            WTList predecessor_refs)
                                     throws WTException
Multi-object version of this method. Queues moving a subscription to the new version event to a new iteration.

Supported API: false

Throws:
WTException

moveNewVersionSubscription

public static void moveNewVersionSubscription(ObjectIdentifier obj_id,
                                              ObjectIdentifier predecessor_id)
                                       throws WTException
Does actual subscription copying from a target object to another.

This method should be private and non static, but since it is invoked by Reflection it must be public.

Supported API: false

Parameters:
obj_id -
predecessor_id -
Throws:
WTException

resolveSubscriber

protected void resolveSubscriber(Object subscriber_obj,
                                 Vector subscribers)
                          throws WTException
Adds references to users corresponding to the subscribe_obj passed as an argument, to the subscribers Vector.

A subscriber object can be one of:

Parameters:
subscriber_obj - represents one or more users.
subscribers - Vector of subscriber references
Throws:
WTException

addSubscriberToObject

protected void addSubscriberToObject(ObjectReference ref,
                                     ObjectSubscription subscription,
                                     WTPrincipal owner)
                              throws WTException
Subscribes to an object given a reference to the subscriber and a subscription object. If the subscription object has a key, this key is used; otherwise a new key is generated.

Parameters:
ref - reference to subscriber.
subscription - subscription object used as a basis of the one to be constructed and persisted
owner - user responsible for creating the subscriptions
Returns:
list of WTPrincipalReference objects in which the principal is a user
Throws:
WTException

setAdhocRights

protected ObjectSubscription setAdhocRights(ObjectSubscription subscription,
                                            WTPrincipal owner)
                                     throws WTException
Sets add hoc rights to owner and subscriber (if a user) to read/write/delete subscription.

Parameters:
subscription - subscription object to be added ad hoc rights.
owner - user responsible for creating the subscriptions
Returns:
updated object subscription
Throws:
WTException

addEventToObject

protected void addEventToObject(ObjectReference target_ref,
                                String event_key)
                         throws WTException
Updates the event set of the object passed as argument by the count given.

Parameters:
event_key - event key to be added to object.
Throws:
WTException

registerListeners

protected void registerListeners()
                          throws WTException
Creates and registers event listeners.

Throws:
WTException

startNotificationQueue

protected void startNotificationQueue()
                               throws WTException
Starts notification queue.

Throws:
WTException

startScheduleQueue

protected void startScheduleQueue()
                           throws WTException
Starts schedule queue.

Throws:
WTException

getNotificationList

protected NotificationList getNotificationList(String event_type,
                                               Object target_object)
                                        throws WTException
Auxiliary method used to retirve the notification list. Assumes target_object is Notifable and DomainAdministered.

Parameters:
event_type -
target_object -
Returns:
NotificationList
Throws:
WTException

removeObjectEvent

protected static void removeObjectEvent(ObjectIdentifier obj_id,
                                        String event_key)
                                 throws WTException
Removes event from object set.

Parameters:
obj_id - identifier of target object
event_key - event key to be removed
Throws:
WTException

getNotifyCache

private static NotificationListCache getNotifyCache()

createNotifyCache

private static void createNotifyCache()

getSubscriptions

protected static Enumeration getSubscriptions(ObjectIdentifier target_id,
                                              String event_key)
                                       throws WTException
Returns all subscriptions for the object and event. Object is specified through its oid and event through its key

Parameters:
target_id - identifier of target object
event_key - event key
Returns:
array of object subscriptions; may be null if no subscription is found
Throws:
WTException

addUserSubscription

protected static void addUserSubscription(ObjectSubscription subscription,
                                          Vector equiv_subs,
                                          Vector dist_lists)
                                   throws WTException
Updates vectors of subscriptions and distribution lists with the content of the subscritpion passed as argument. If subscription is equivalent a susbcription in the equiv_subs vector, then adds its subscriber to the corrresponding distribution list. Otherwise adds subscription to equiv_subs and its subscriber to the corresponding dist_lists element.

Parameters:
subscription - subscription object
equiv_subs - vector of subscriptions no two of them equivalent
dist_lists - vector of distribution lists, each one corresponding to a different subscription
Throws:
WTException

sendObjectNotification

protected static void sendObjectNotification(ObjectSubscription subscription,
                                             DistributionList subscribers)
                                      throws WTException
Constructs and queues notification.

Parameters:
subscription - subscription object
subscribers - notification recipients
Throws:
WTException

createNotification

public static Notification createNotification(ObjectSubscription subscription,
                                              DistributionList subscribers)
                                       throws WTException
Creates notification.

Parameters:
subscription - subscription object
subscribers - notification recipients
Throws:
WTException

sendPolicyNotification

protected static void sendPolicyNotification(ObjectIdentifier obj_id,
                                             String event_key,
                                             NotificationSet set)
                                      throws WTException
Constructs and queues policy notification.

Parameters:
set - notification set
Throws:
WTException

sameTime

protected static boolean sameTime(Timestamp time1,
                                  Timestamp time2)
                           throws WTException
Returns true if the two timestamps differ by less than one second. This is required because the timestamp looses its fractional time when stored in the database. This is used to check if the subscription hasn't been altered: that is, had its expiration time changed.

Parameters:
time1 - timestamp
time2 - timestamp
Returns:
true if times differ by less than one second; false otherwise
Throws:
WTException

filterSubscription

protected static boolean filterSubscription(ObjectIdentifier obj_id,
                                            ObjectSubscription subscription)
                                     throws WTException
Returns true if target's attribute-value pair matches that of the subscription; otherwise returns false. if subscription has no attribute-valeu pair specified, returns true.

Parameters:
subscription - subscription object
Returns:
whether target's attribute-value pair matches that of the subscription
Throws:
WTException

deleteSubscriptions

protected void deleteSubscriptions(WTSet targets)
                            throws WTException
Deletes subscriptions associated with object passed as argument. The objects that are target of the subscriptions are not changed. This method is called when the object is deleted.

Parameters:
targets - Collection of Notifiables that are the targets of the event.
Throws:
WTException

targetToString

public static String targetToString(ObjectReference target_ref)
Produces identifying information about a target object.


subscribeToAllEvents

private void subscribeToAllEvents(KeyedEventListener listener)
                           throws WTException
Subscribes to all events to be listened to.

Throws:
WTException

getTypeEventTable

private static Hashtable getTypeEventTable(WTProperties properties)
                                    throws WTException
Sets the type event table, that maps types into sets of events.

Throws:
WTException

eventToString

public static String eventToString(String event)
Debugging method.


queueCopyCheckinSubscription

public void queueCopyCheckinSubscription(Iterated target,
                                         Iterated predecessor)
                                  throws WTException
Queues copying of checkin event subscriptions to a new iteration.

Supported API: false

Parameters:
target -
Throws:
WTException

copyCheckinSubscription

public static void copyCheckinSubscription(ObjectIdentifier obj_id,
                                           ObjectIdentifier predecessor_id)
                                    throws WTException
Does actual copying of checkin event subscriptions to a new iteration.

This method should be private and non static, but since it is invoked by Reflection it must be public.

Supported API: false

Parameters:
obj_id -
predecessor_id -
Throws:
WTException

getExistingSubscribers

private static Vector getExistingSubscribers(ObjectSubscription subscription)
                                      throws WTException
Throws:
WTException

equivalent

private static boolean equivalent(ObjectSubscription subs1,
                                  ObjectSubscription subs2)
                           throws WTException
Throws:
WTException

equivalent

private static boolean equivalent(String str1,
                                  String str2)

updateNotificationLists

private void updateNotificationLists(AdminDomainRef domain_ref)
                              throws WTException
Updates all existing notification lists for the domain passed as argument and its descendents. This method is called after a domain has been moved in the domain hierarchy.

Supported API: false

Parameters:
domain_ref -
Throws:
WTException

recipientsToString

private String recipientsToString(EnumeratorVector principal_refs)

copySubscriptions

public static void copySubscriptions(ObjectIdentifier target_obj_id,
                                     ObjectIdentifier source_obj_id)
                              throws WTException
Throws:
WTException

debug

private static void debug(String displayObject)

debug

private static void debug(String methodName,
                          String displayObject)

debug

private static void debug(String displayObject,
                          boolean printStackTrace)

debug

private static void debug(String methodName,
                          String displayObject,
                          boolean printStackTrace)