org.jasig.portlet.notice.service
Class CacheNotificationService

java.lang.Object
  extended by org.jasig.portlet.notice.service.CacheNotificationService
All Implemented Interfaces:
INotificationService

public class CacheNotificationService
extends Object
implements INotificationService

This class contains all the notification service providers. It implements the EHCache implementation. An instance of this class is called from the DataController in order to retrieve the notifications for a given user.


Constructor Summary
CacheNotificationService()
           
 
Method Summary
 NotificationResponse fetchNotificationsFromSource(javax.portlet.PortletRequest req)
          Gathers the collection of notifications for the user associated with the srequest.
 String getName()
          Returns the name of the service.
 NotificationResponse getNotifications(String notificationsContextName, String remoteUser, javax.portlet.PortletRequest req)
          Most implementations need do nothing special with this method.
 void refreshNotifications(String notificationsContextName, String remoteUser)
          After calling this method, the next call to getNotifications will cause the notifications to be fetched from their source(s), not from cache.
 void setEmbeddedServices(List<INotificationService> embeddedServices)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CacheNotificationService

public CacheNotificationService()
Method Detail

getName

public String getName()
Returns the name of the service.

Specified by:
getName in interface INotificationService
Returns:
String.

getNotifications

@Cacheable(cacheName="notificationCache",
           keyGenerator=@KeyGenerator(name="HashCodeCacheKeyGenerator",properties=@Property(name="includeMethod",value="false")))
public NotificationResponse getNotifications(@PartialCacheKey
                                                                             String notificationsContextName,
                                                                             @PartialCacheKey
                                                                             String remoteUser,
                                                                             javax.portlet.PortletRequest req)
                                      throws NotificationServiceException
Description copied from interface: INotificationService
Most implementations need do nothing special with this method. They can extend AbstractNotificationService. Special service impls (such as caching) may want to override it.

Specified by:
getNotifications in interface INotificationService
Parameters:
notificationsContextName - Configured in the -portlet.xml Spring file
remoteUser - From req.getRemoteUser
req - The PortletRequest
Returns:
NotificationResponse
Throws:
NotificationServiceException

refreshNotifications

@TriggersRemove(cacheName="notificationCache",
                keyGenerator=@KeyGenerator(name="HashCodeCacheKeyGenerator",properties=@Property(name="includeMethod",value="false")))
public void refreshNotifications(String notificationsContextName,
                                                                      String remoteUser)
Description copied from interface: INotificationService
After calling this method, the next call to getNotifications will cause the notifications to be fetched from their source(s), not from cache.

Specified by:
refreshNotifications in interface INotificationService

fetchNotificationsFromSource

public NotificationResponse fetchNotificationsFromSource(javax.portlet.PortletRequest req)
                                                  throws NotificationServiceException
Description copied from interface: INotificationService
Gathers the collection of notifications for the user associated with the srequest.

Specified by:
fetchNotificationsFromSource in interface INotificationService
Parameters:
req - The PortletRequest
Returns:
NotificationResponse
Throws:
NotificationServiceException

setEmbeddedServices

public void setEmbeddedServices(List<INotificationService> embeddedServices)


Copyright © 2012 Jasig. All Rights Reserved.