org.figure8.join.services.notification
Class SubscribersNotifierAdapterSupport

java.lang.Object
  extended by org.figure8.join.services.notification.SubscribersNotifierAdapterSupport
All Implemented Interfaces:
Configurable
Direct Known Subclasses:
SubscribersNotifierJMSAdapter

public abstract class SubscribersNotifierAdapterSupport
extends java.lang.Object
implements Configurable

This is a support class to extend for classes wanting to use SubscribersNotifier.

Version:
$Revision: 1.1 $
Author:
Laurent Broudoux

Field Summary
static java.lang.String EVENT_PARAM
          Name of configurable parameter denoting the key of event to notity.
protected static ParameterDefinition eventParam
          ParameterDefinition representation of parameter denoting the key of event to notify.
protected  java.lang.String name
          The name identifying this notifier adapter.
protected static java.util.List parameters
          List of ParameterDefinitions supported by this adapter
static java.lang.String RESOURCE_PARAM
          Name of configuratble parameter denoting the key of resource to notifiy event for.
protected static ParameterDefinition resourceParam
          ParameterDefinition representation of parameter denoting the key of resource to notify event for.
 
Constructor Summary
protected SubscribersNotifierAdapterSupport()
          Creates a new instance of SubscribersNotifierAdapterSupport.
 
Method Summary
 java.lang.String getEventKey()
           
 java.lang.String getName()
          Retrieve the name of this adapter.
 ParameterDefinition[] getParameterDefinitions()
          Get this object parameters definitions as an array
 java.util.List getParameterDefinitionsAsList()
          Get this object parameters definitions as a list
 java.lang.String getResourceKey()
           
abstract  SubscribersNotifier getSubscribersNotifier()
          Subclasses must implement this method in order to specify the Notifier implementation to use (and thus the publication media).
protected  RemoteMailingList retrieveMailingList(java.lang.String eventKey, java.lang.String resourceId)
          Connect to remote reporting service and retrieve mailing list
protected  ReportingService retrieveReportingService()
          Helper method for retrieving remote ReportingService.
protected  RemoteSubscriber[] retrieveSubscribers(RemoteMailingList list)
          Connect to remote reporting service and retrieve subscribers
 void setEventKey(java.lang.String eventKey)
           
 void setName(java.lang.String name)
          Set the name identifying this adapter.
 void setParameter(ParameterDefinition parameter, java.lang.String parameterValue)
          Set the value of a parameter using its definitions
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
          Set the value of a parameter using its nama
 void setParameters(java.util.Properties parameters)
          Convenient methods for setting all attributes values using a single method.
 void setResourceKey(java.lang.String resourceKey)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EVENT_PARAM

public static final java.lang.String EVENT_PARAM
Name of configurable parameter denoting the key of event to notity.

See Also:
Constant Field Values

RESOURCE_PARAM

public static final java.lang.String RESOURCE_PARAM
Name of configuratble parameter denoting the key of resource to notifiy event for.

See Also:
Constant Field Values

parameters

protected static java.util.List parameters
List of ParameterDefinitions supported by this adapter


eventParam

protected static final ParameterDefinition eventParam
ParameterDefinition representation of parameter denoting the key of event to notify.


resourceParam

protected static final ParameterDefinition resourceParam
ParameterDefinition representation of parameter denoting the key of resource to notify event for.


name

protected java.lang.String name
The name identifying this notifier adapter.

Constructor Detail

SubscribersNotifierAdapterSupport

protected SubscribersNotifierAdapterSupport()
Creates a new instance of SubscribersNotifierAdapterSupport.

Method Detail

getName

public java.lang.String getName()
Retrieve the name of this adapter.

Returns:
The name identifying this adapter

setName

public void setName(java.lang.String name)
Set the name identifying this adapter.

Parameters:
name - The name of this adapter

getEventKey

public java.lang.String getEventKey()
Returns:
The key of event to notify to subscribers

setEventKey

public void setEventKey(java.lang.String eventKey)
Parameters:
eventKey - The key of event to notify to subscribers

getResourceKey

public java.lang.String getResourceKey()
Returns:
The key of resource to notify event for

setResourceKey

public void setResourceKey(java.lang.String resourceKey)
Parameters:
resourceKey - The key of resource to notify event for

getSubscribersNotifier

public abstract SubscribersNotifier getSubscribersNotifier()
Subclasses must implement this method in order to specify the Notifier implementation to use (and thus the publication media).

Returns:
The notifier implementation

getParameterDefinitionsAsList

public java.util.List getParameterDefinitionsAsList()
Get this object parameters definitions as a list

Specified by:
getParameterDefinitionsAsList in interface Configurable
Returns:
A list of ParameterDefinition objects

getParameterDefinitions

public ParameterDefinition[] getParameterDefinitions()
Get this object parameters definitions as an array

Specified by:
getParameterDefinitions in interface Configurable
Returns:
An array of ParameterDefinition objects

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String parameterValue)
                  throws InvalidParameterException
Set the value of a parameter using its nama

Specified by:
setParameter in interface Configurable
Parameters:
parameterName - The name of parameter so set value for
parameterValue - The value of the paramater
Throws:
InvalidParameterException - if this parameter is not supported by this object

setParameter

public void setParameter(ParameterDefinition parameter,
                         java.lang.String parameterValue)
                  throws InvalidParameterException
Set the value of a parameter using its definitions

Specified by:
setParameter in interface Configurable
Parameters:
parameter - The definitino of the paramater to set
parameterValue - The value of the parameter
Throws:
InvalidParameterException - if this parameter is not supported by this object

setParameters

public void setParameters(java.util.Properties parameters)
                   throws InvalidParameterException
Convenient methods for setting all attributes values using a single method.

Specified by:
setParameters in interface Configurable
Parameters:
parameters - Properties where keys are parameter names
Throws:
InvalidParameterException - if one of these parameters is not supported by this object

retrieveMailingList

protected RemoteMailingList retrieveMailingList(java.lang.String eventKey,
                                                java.lang.String resourceId)
                                         throws java.lang.Exception
Connect to remote reporting service and retrieve mailing list

Parameters:
eventKey - The key of event to retrieve mailing list for
resourceId - The id of resource to retrieve mailing list for (may be null if no resource specified)
Returns:
The corresponding mailing list
Throws:
java.lang.Exception

retrieveSubscribers

protected RemoteSubscriber[] retrieveSubscribers(RemoteMailingList list)
                                          throws java.lang.Exception
Connect to remote reporting service and retrieve subscribers

Parameters:
list - The mailing list to retrieve subscribers for
Returns:
An array of list subscribers
Throws:
java.lang.Exception

retrieveReportingService

protected ReportingService retrieveReportingService()
                                             throws InfrastructureException,
                                                    java.rmi.RemoteException
Helper method for retrieving remote ReportingService. ReportingService is defined on synchronous side of application and notifiers are expected to run on asynchronous side of application. So we are using the BootstrapManager.getOtherSideUrl() as the root of remote service url.

Returns:
The retievied remote ReportingService
Throws:
InfrastructureException - if BoostrapManager and url cannot be retrieved
java.rmi.RemoteException - if remote service cannot be retievied
See Also:
BootstrapManager


Copyright © 2005-2008 Join. All Rights Reserved.