org.sakaiproject.pcservice.impl.entity
Class PCServiceEntityProvider

java.lang.Object
  extended by org.jgroups.ReceiverAdapter
      extended by org.sakaiproject.pcservice.impl.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

public class PCServiceEntityProvider
extends org.jgroups.ReceiverAdapter
implements 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.UserMessage
           
 
Field Summary
static String ENTITY_PREFIX
           
protected  org.apache.log4j.Logger logger
           
 
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
 String createEntity(org.sakaiproject.entitybroker.EntityReference ref, Object entity, Map<String,Object> params)
          New messages come in here.
 String getEntityPrefix()
           
 String[] getHandledInputFormats()
           
 String[] getHandledOutputFormats()
           
 Object getSampleEntity()
           
 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 setEmailService(org.sakaiproject.email.api.EmailService emailService)
           
 void setPresenceService(org.sakaiproject.presence.api.PresenceService presenceService)
           
 void setServerConfigurationService(org.sakaiproject.component.api.ServerConfigurationService serverConfigurationService)
           
 void setUserDirectoryService(org.sakaiproject.user.api.UserDirectoryService userDirectoryService)
           
 
Methods inherited from class org.jgroups.ReceiverAdapter
block, getState, setState, suspect, viewAccepted
 
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)

init

public void init()

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. Overrides ReceiverAdapter.

Specified by:
receive in interface org.jgroups.MessageListener
Overrides:
receive in class org.jgroups.ReceiverAdapter


Copyright © 2003-2012 Sakai Project. All Rights Reserved.