Nitido Inc.

com.nitido.nimx.services.notification.channels
Class DeliveryChannel

java.lang.Object
  extended by com.nitido.nimx.services.notification.channels.DeliveryChannel
All Implemented Interfaces:
NotificationConstants
Direct Known Subclasses:
EmailDeliveryChannel, SMSDeliveryChannel

public abstract class DeliveryChannel
extends java.lang.Object
implements NotificationConstants


Field Summary
protected  ConfigurationService _confService
          The configuration service
protected  StatusTicketCache _ticketCache
          The status ticket cache
 
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
 
Constructor Summary
DeliveryChannel(NiMKernelServiceVisa visa)
          The constructor for a delivery channel takes a NiMKernelServiceVisa to make sure that only certain classes can instantiate the channel.
 
Method Summary
abstract  boolean canDeliverTo(Member target)
          Determines whether the member has the requied information for this delivery channel to be able to send a message to the user.
abstract  java.lang.String deliver(NotificationMessage msg)
          Starts the delivery process for this message (or places it into some sort of internal queue).
 java.util.Properties getConfigPropertiesByPrefix(java.lang.String confKeyPrefix)
          Get all configuration specified for the channel and starts with the specified prefix.
 java.lang.String getConfigProperty(java.lang.String propertyKey)
          Get the configuration property form the configurationi service.
abstract  java.lang.String getKey()
          Returns the key to use when referring to this delivery method.
abstract  java.lang.String getProtocolPrefix()
          "mailto://" -> EmailDeliveryChannel "mobile://" -> SMSDeliveryChannel etc.
abstract  IndividualStatus getStatus(java.lang.String ticket)
          Notification service uses this method to get an updated status object before returning to the client.
 StatusTicketCache getTicketCache()
          Get the status ticket cache object.
 void init(StatusTicketCache cache, ConfigurationService conf)
          Initializes the delivery channel by providing access to the status ticket cache and the configuration service.
abstract  boolean isStandardTicket(java.lang.String ticket)
          The implementation of the delivery channel determines whether the given status ticket belongs to its set of standard tickets that do not require storage in the status cache.
abstract  boolean validateRecipient(java.lang.String recipient)
          Determines whether the recipient string is a valid address/phone etc that this delivery channel can use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_ticketCache

protected StatusTicketCache _ticketCache
The status ticket cache


_confService

protected ConfigurationService _confService
The configuration service

Constructor Detail

DeliveryChannel

public DeliveryChannel(NiMKernelServiceVisa visa)
The constructor for a delivery channel takes a NiMKernelServiceVisa to make sure that only certain classes can instantiate the channel. In this case the visa is passed in from the notification service which in turn receives it in its constructor from the NiMKernel.

Parameters:
visa - kernel service visa object
Method Detail

init

public void init(StatusTicketCache cache,
                 ConfigurationService conf)
          throws InitializationFailedException
Initializes the delivery channel by providing access to the status ticket cache and the configuration service.

Parameters:
cache - status ticket cache
conf - configuration service
Throws:
InitializationFailedException

getTicketCache

public StatusTicketCache getTicketCache()
Get the status ticket cache object. The delivery channel implementations will use the cache to store status objects for the messages they send out if they require. The cache is cleaned up automatically based on settings from the configuration files.

Returns:
the status ticket cache.

getKey

public abstract java.lang.String getKey()
Returns the key to use when referring to this delivery method.

Returns:
key for this delivery channel

getProtocolPrefix

public abstract java.lang.String getProtocolPrefix()
"mailto://" -> EmailDeliveryChannel "mobile://" -> SMSDeliveryChannel etc. an address with a prefix that is not listed will generate an error,


getStatus

public abstract IndividualStatus getStatus(java.lang.String ticket)
                                    throws StatusNotFoundException
Notification service uses this method to get an updated status object before returning to the client. The delivery channel implementations will individually determine whether the ticket represents a standard status, in which case the status object is constructed right there, or the delivery channel retrieves the status object from the status cache.

Parameters:
ticket - the status ticket that is being requested from the channel
Returns:
the individual status which corresponds to the ticket provided as an argument
Throws:
StatusNotFoundException - thrown if the delivery channel could not find a status object for the given ticket

deliver

public abstract java.lang.String deliver(NotificationMessage msg)
                                  throws NotificationServiceException
Starts the delivery process for this message (or places it into some sort of internal queue).

Parameters:
msg - the message to be sent out
Returns:
the status ticket for this message
Throws:
NotificationServiceException - if the delivery channel is unable to initiate the delivery of the message

canDeliverTo

public abstract boolean canDeliverTo(Member target)
Determines whether the member has the requied information for this delivery channel to be able to send a message to the user.

Parameters:
target - the Member object to which the message will be delivered
Returns:
true if the Member object contains the information this delivery channel requires to attempt a message delivery, false otherwise

validateRecipient

public abstract boolean validateRecipient(java.lang.String recipient)
Determines whether the recipient string is a valid address/phone etc that this delivery channel can use.


getConfigProperty

public java.lang.String getConfigProperty(java.lang.String propertyKey)
Get the configuration property form the configurationi service. The property is retrieved from the configuration files by concatenating the following three strings - the CONF_KEY_DELIVERY_CHANNELS_PREFIX constants - the key of this delivery channel - the property's key provided as the argument

Parameters:
propertyKey - the name of the property. If the key is null, it will return a null object.
Returns:
the value of the property

getConfigPropertiesByPrefix

public java.util.Properties getConfigPropertiesByPrefix(java.lang.String confKeyPrefix)
Get all configuration specified for the channel and starts with the specified prefix.

It will return a Properties object with all configurations with keys starts with the confKeyPrefix. This Properties object's key will contain the string confKeyPrefix, but it will strip out all configuration prefix for the delivery channel.

For example, if the full configuration keys for the "email" channels are:


isStandardTicket

public abstract boolean isStandardTicket(java.lang.String ticket)
The implementation of the delivery channel determines whether the given status ticket belongs to its set of standard tickets that do not require storage in the status cache.

Parameters:
ticket - status ticket
Returns:
true if the ticket is this delivery's channel standard ticket, false otherwise

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.