Nitido Inc.

com.nitido.nimx.services.notification
Class NotificationServiceImpl

java.lang.Object
  extended by com.nitido.nim.NiMKernelService
      extended by com.nitido.nim.NotificationService
          extended by com.nitido.nimx.services.notification.NotificationServiceImpl
All Implemented Interfaces:
NiMConstants, NotificationConstants

public class NotificationServiceImpl
extends NotificationService
implements NotificationConstants


Field Summary
 
Fields inherited from interface com.nitido.nimx.services.notification.NotificationConstants
CONF_KEY_CACHE_EXPIRE_TIME, CONF_KEY_CACHE_MAX_TIME, CONF_KEY_CACHE_PREFIX, CONF_KEY_CACHE_REMOVE_FINAL, CONF_KEY_CACHE_SLEEP_TIME, CONF_KEY_DELIVERY_CHANNEL_LIST_PREFIX, CONF_KEY_DELIVERY_CHANNELS_PREFIX, KEY_TRANSACTION_PREFIX, LEN_PREFIX_TOKEN, LEN_PREFIX_USER_SPACE, PREFIX_TOKEN, PREFIX_USER_SPACE, PROTOCOL_ADDRESS_SEPARATOR, TICKET_SEPARATOR
 
Fields inherited from interface com.nitido.nim.NiMConstants
ACTION_CREATE_NUGGET, ACTION_CREATE_NUGGET_BY_NAME, ACTION_CRED_SPACE_ADD, ACTION_CRED_SPACE_GET_KEYS, ACTION_CRED_SPACE_GET_KEYS_START_WITH, ACTION_CRED_SPACE_GET_VALUE, ACTION_CRED_SPACE_GET_VALUES, ACTION_CRED_SPACE_MODIFY, ACTION_CRED_SPACE_REMOVE_VALUE, ACTION_CRED_SPACE_REMOVE_VALUES, ACTION_CRED_SPACE_REPLACE, ACTION_DEPROVISION_ENTITY, ACTION_ENTITY_CHANGE_CRED, ACTION_LOG_EVENT, ACTION_PROVISION_ENTITY, ACTION_USER_SPACE_ADD, ACTION_USER_SPACE_GET_KEYS, ACTION_USER_SPACE_GET_KEYS_START_WITH, ACTION_USER_SPACE_GET_VALUE, ACTION_USER_SPACE_GET_VALUES, ACTION_USER_SPACE_MODIFY, ACTION_USER_SPACE_REMOVE_VALUE, ACTION_USER_SPACE_REMOVE_VALUES, ACTION_USER_SPACE_REPLACE, CONF_PREFIX_SECURITY_ACCESS, CONF_PREFIX_SECURITY_ALLOW, CONF_PREFIX_SECURITY_ASSIGN, CONF_PREFIX_SECURITY_RESOURCE, PARAM_CHANGE_CRED, PARAM_DEPROVISION_CREDENTIAL, PARAM_EVENT_NAME, PARAM_MODIFIER_CONTAINER, PARAM_NUGGET_CREATE_CRED, PARAM_NUGGET_NAME, PARAM_NUGGET_SETTINGS, PARAM_NUGGET_TYPE, PARAM_PROVISION_DESCRIPTOR, PARAM_SPACE_KEY, PARAM_SPACE_KEYS_START_WITH, PARAM_SPACE_VALUE, PREFIX_ACCESS_CLASS_IN_PACKAGE
 
Constructor Summary
NotificationServiceImpl(NiMKernelServiceVisa visa)
           
 
Method Summary
static java.lang.String getDeliveryChannelId(java.lang.String recipient)
          Extracts the delivery channel ID from the full recipient string.
protected  IndividualStatus getIndividualStatus(java.lang.String ticket)
          Get the individual status stored in the status cache for this ticket.
protected static NotificationService getInstance()
          Get the singleton instance of the notification service.
static java.lang.String getRecipientId(java.lang.String recipient)
          Extracts the recipient address from the full string.
 NotificationStatus getStatus(java.lang.String ticket)
          Retrieves the latest status for a given status ticket.
protected  void init(NiMKernel kernel, ConfigurationService confService)
          This method is used to initialize the kernel service.
protected  void loadDeliveryChannel(java.lang.String className)
          Loads a delivery channel based on the class name given as argument.
protected  void loadDeliveryChannels()
          Loads all of the delivery channels sepcified in the configuration properties.
 java.lang.String sendNotification(NotificationMessage msg)
          Send out the notification message to the recipient(s) supplied in the message object.
 void signalBirth()
          Invoked by the system's listener when the whole server is starting up.
 void signalDeath()
          Invoked by the system's listener when the whole server is shutting down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NotificationServiceImpl

public NotificationServiceImpl(NiMKernelServiceVisa visa)
Method Detail

init

protected void init(NiMKernel kernel,
                    ConfigurationService confService)
             throws InitializationFailedException,
                    NiMException
Description copied from class: NiMKernelService
This method is used to initialize the kernel service. Extenders of this class must implement this method.

Overrides:
init in class NotificationService
Parameters:
kernel - Reference to the NiMKernel object that instantiated the service.
confService - A reference to the configuration service. All the service implementations (except ConfigurationService) should retrieve the setting information from it.
Throws:
InitializationFailedException - If unable to initialize the kernel service.
NiMException - If service initialization can not be done due to failure in establish a connection to the back-end service. Not all service implementation will throw this exception.

loadDeliveryChannels

protected void loadDeliveryChannels()
                             throws NotificationServiceException
Loads all of the delivery channels sepcified in the configuration properties.

Throws:
NotificationServiceException - if the protocol prefix has already been loaded, if there is a problem loading the appropriate implementation class for the delivery channel

loadDeliveryChannel

protected void loadDeliveryChannel(java.lang.String className)
                            throws NotificationServiceException
Loads a delivery channel based on the class name given as argument.

Parameters:
className - the full class name of the delivery channel to load
Throws:
NotificationServiceException

getInstance

protected static NotificationService getInstance()
Get the singleton instance of the notification service.

Returns:
instance of the notification service

sendNotification

public java.lang.String sendNotification(NotificationMessage msg)
                                  throws NotificationServiceException
Description copied from class: NotificationService
Send out the notification message to the recipient(s) supplied in the message object. If the message returns without an exception being thrown then the service has accepted the message for delivery, meaning that there were no immediate errors in the message object. It does not imply that the message has been sent out or delivered successfully.

Specified by:
sendNotification in class NotificationService
Parameters:
msg - the notification message object containing the recipient(s) and the message content.
Returns:
The ticket ID returned can be used to retrieve the latest status for this message.
Throws:
NotificationServiceException - thrown for one of two reasons - unable to create a status ticket to return to the client - invalid data in the notification message object

getDeliveryChannelId

public static java.lang.String getDeliveryChannelId(java.lang.String recipient)
Extracts the delivery channel ID from the full recipient string.

Parameters:
recipient - the full recipient string
Returns:
the delivery channel ID

getRecipientId

public static java.lang.String getRecipientId(java.lang.String recipient)
Extracts the recipient address from the full string.

Parameters:
recipient - the full recipient string
Returns:
the recipient ID

getStatus

public NotificationStatus getStatus(java.lang.String ticket)
                             throws StatusNotFoundException
Description copied from class: NotificationService
Retrieves the latest status for a given status ticket. The status object allows the client to determine whether their notification has been sent out and/or delivered. In case of failure the status object will contain the cause of the failure as an exception and/or error code.

Specified by:
getStatus in class NotificationService
Parameters:
ticket - the ticket ID that was returned by the sendNotification method
Returns:
a status object containing details about the message that was accepted to be sent out to each of the recipients.
Throws:
StatusNotFoundException - if the ticket does not match any tickets known to the service

getIndividualStatus

protected IndividualStatus getIndividualStatus(java.lang.String ticket)
                                        throws StatusNotFoundException
Get the individual status stored in the status cache for this ticket. At the moment this is used by the clean-up thread to retrieve the individual status and figure out whether the status object has expired.

Parameters:
ticket - the status ticket
Returns:
individual status object for the ticket
Throws:
StatusNotFoundException - if no status object was found for the provided ticket

signalBirth

public void signalBirth()
Description copied from class: NotificationService
Invoked by the system's listener when the whole server is starting up.

Specified by:
signalBirth in class NotificationService

signalDeath

public void signalDeath()
Description copied from class: NotificationService
Invoked by the system's listener when the whole server is shutting down. This is mainly used to stop the clean up thread.

Specified by:
signalDeath in class NotificationService

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.