org.sakaiproject.portal.chat.entity
Class PCServiceEntityProvider

java.lang.Object
  extended by org.sakaiproject.entitybroker.util.AbstractEntityProvider
      extended by org.sakaiproject.portal.chat.entity.PCServiceEntityProvider
All Implemented Interfaces:
org.jgroups.MembershipListener, org.jgroups.MessageListener, org.jgroups.Receiver, org.sakaiproject.entitybroker.collector.AutoRegister, org.sakaiproject.entitybroker.entityprovider.capabilities.ActionsExecutable, org.sakaiproject.entitybroker.entityprovider.capabilities.AutoRegisterEntityProvider, org.sakaiproject.entitybroker.entityprovider.capabilities.Createable, org.sakaiproject.entitybroker.entityprovider.capabilities.Inputable, org.sakaiproject.entitybroker.entityprovider.capabilities.Outputable, org.sakaiproject.entitybroker.entityprovider.capabilities.Sampleable, org.sakaiproject.entitybroker.entityprovider.EntityProvider, org.sakaiproject.entitybroker.entityprovider.extension.Formats, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean

public class PCServiceEntityProvider
extends org.sakaiproject.entitybroker.util.AbstractEntityProvider
implements org.jgroups.Receiver, org.sakaiproject.entitybroker.entityprovider.EntityProvider, org.sakaiproject.entitybroker.entityprovider.capabilities.Createable, org.sakaiproject.entitybroker.entityprovider.capabilities.Inputable, org.sakaiproject.entitybroker.entityprovider.capabilities.Outputable, org.sakaiproject.entitybroker.entityprovider.capabilities.ActionsExecutable, org.sakaiproject.entitybroker.entityprovider.capabilities.AutoRegisterEntityProvider

Provides all the RESTful targets for the portal chat code in chat.js. Clustering is catered for using a JGroups channel.

Author:
Adrian Fish (a.fish@lancaster.ac.uk)

Nested Class Summary
 class PCServiceEntityProvider.PortalChatUser
           
 class PCServiceEntityProvider.UserMessage
           
 
Field Summary
static String ENTITY_PREFIX
           
protected  org.apache.log4j.Logger logger
           
 
Fields inherited from class org.sakaiproject.entitybroker.util.AbstractEntityProvider
developerHelperService
 
Fields inherited from interface org.sakaiproject.entitybroker.entityprovider.extension.Formats
ALL_KNOWN_FORMATS, ATOM, ATOM_EXTENSIONS, ATOM_MIME_TYPE, FORM, FORM_EXTENSIONS, FORM_MIME_TYPE, HTML, HTML_EXTENSIONS, HTML_MIME_TYPE, JSON, JSON_EXTENSIONS, JSON_MIME_TYPE, JSONP, JSONP_EXTENSIONS, JSONP_MIME_TYPE, RSS, RSS_EXTENSIONS, RSS_MIME_TYPE, TXT, TXT_EXTENSIONS, TXT_MIME_TYPE, UTF_8, XML, XML_EXTENSIONS, XML_MIME_TYPE
 
Fields inherited from interface org.sakaiproject.entitybroker.entityprovider.capabilities.ActionsExecutable
ACTION_METHOD_SUFFIX
 
Constructor Summary
PCServiceEntityProvider()
           
 
Method Summary
 void block()
           
 String createEntity(org.sakaiproject.entitybroker.EntityReference ref, Object entity, Map<String,Object> params)
          New messages come in here.
 void destroy()
           
 String getEntityPrefix()
           
 String[] getHandledInputFormats()
           
 String[] getHandledOutputFormats()
           
 Object getSampleEntity()
           
 void getState(OutputStream arg0)
           
 Map<String,Object> handleLatestData(org.sakaiproject.entitybroker.EntityReference ref, Map<String,Object> params)
          The JS client calls this to grab the latest data in one call.
 String handlePing(org.sakaiproject.entitybroker.EntityReference ref)
           
 void init()
           
 void receive(org.jgroups.Message msg)
          JGroups message listener.
 void setDeveloperService(org.sakaiproject.entitybroker.DeveloperHelperService developerService)
           
 void setEmailService(org.sakaiproject.email.api.EmailService emailService)
           
 void setPresenceService(org.sakaiproject.presence.api.PresenceService presenceService)
           
 void setServerConfigurationService(org.sakaiproject.component.api.ServerConfigurationService serverConfigurationService)
           
 void setState(InputStream arg0)
           
 void setUserDirectoryService(org.sakaiproject.user.api.UserDirectoryService userDirectoryService)
           
 void suspect(org.jgroups.Address arg0)
           
 void unblock()
           
 void viewAccepted(org.jgroups.View arg0)
           
 
Methods inherited from class org.sakaiproject.entitybroker.util.AbstractEntityProvider
afterPropertiesSet, setDeveloperHelperService, setEntityProviderManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.log4j.Logger logger

ENTITY_PREFIX

public static final String ENTITY_PREFIX
See Also:
Constant Field Values
Constructor Detail

PCServiceEntityProvider

public PCServiceEntityProvider()
Method Detail

setUserDirectoryService

public void setUserDirectoryService(org.sakaiproject.user.api.UserDirectoryService userDirectoryService)

setEmailService

public void setEmailService(org.sakaiproject.email.api.EmailService emailService)

setPresenceService

public void setPresenceService(org.sakaiproject.presence.api.PresenceService presenceService)

setServerConfigurationService

public void setServerConfigurationService(org.sakaiproject.component.api.ServerConfigurationService serverConfigurationService)

setDeveloperService

public void setDeveloperService(org.sakaiproject.entitybroker.DeveloperHelperService developerService)

init

public void init()

destroy

public void destroy()
Specified by:
destroy in interface org.springframework.beans.factory.DisposableBean
Overrides:
destroy in class org.sakaiproject.entitybroker.util.AbstractEntityProvider

getEntityPrefix

public String getEntityPrefix()
Specified by:
getEntityPrefix in interface org.sakaiproject.entitybroker.entityprovider.EntityProvider

getHandledOutputFormats

public String[] getHandledOutputFormats()
Specified by:
getHandledOutputFormats in interface org.sakaiproject.entitybroker.entityprovider.capabilities.Outputable

getSampleEntity

public Object getSampleEntity()
Specified by:
getSampleEntity in interface org.sakaiproject.entitybroker.entityprovider.capabilities.Sampleable

createEntity

public String createEntity(org.sakaiproject.entitybroker.EntityReference ref,
                           Object entity,
                           Map<String,Object> params)
New messages come in here. The recipient is indicated by the parameter 'to'.

Specified by:
createEntity in interface org.sakaiproject.entitybroker.entityprovider.capabilities.Createable

getHandledInputFormats

public String[] getHandledInputFormats()
Specified by:
getHandledInputFormats in interface org.sakaiproject.entitybroker.entityprovider.capabilities.Inputable

handleLatestData

public Map<String,Object> handleLatestData(org.sakaiproject.entitybroker.EntityReference ref,
                                           Map<String,Object> params)
The JS client calls this to grab the latest data in one call. Connections, latest messages, online users and present users (in a site) are all returned in one lump of JSON. If the online parameter is supplied and true, a heartbeat is stamped for the sender as well.


handlePing

public String handlePing(org.sakaiproject.entitybroker.EntityReference ref)

receive

public void receive(org.jgroups.Message msg)
JGroups message listener.

Specified by:
receive in interface org.jgroups.MessageListener

getState

public void getState(OutputStream arg0)
              throws Exception
Specified by:
getState in interface org.jgroups.MessageListener
Throws:
Exception

setState

public void setState(InputStream arg0)
              throws Exception
Specified by:
setState in interface org.jgroups.MessageListener
Throws:
Exception

block

public void block()
Specified by:
block in interface org.jgroups.MembershipListener

suspect

public void suspect(org.jgroups.Address arg0)
Specified by:
suspect in interface org.jgroups.MembershipListener

unblock

public void unblock()
Specified by:
unblock in interface org.jgroups.MembershipListener

viewAccepted

public void viewAccepted(org.jgroups.View arg0)
Specified by:
viewAccepted in interface org.jgroups.MembershipListener


Copyright © 2003-2013 University of Michigan. All Rights Reserved.