org.sakaiproject.entitybroker
Interface EntityBrokerManager


public interface EntityBrokerManager

The core of the EB system, this is generally not for use by developers and is mostly for internal use but it should be ok to use most of these methods

Author:
Aaron Zeckoski (azeckoski @ gmail.com)

Field Summary
static String POST_METHOD
           
 
Method Summary
 List<EntityData> browseEntities(String prefix, Search search, String userReference, String associatedReference, EntityReference parentEntityRef, Map<String,Object> params)
          Fetches the browseable entities
 List<EntityData> convertToEntityData(List<?> entities, EntityReference ref)
          Convert a list of objects to entity data objects (also populates them), will preserve null (i.e. null in => null out)
 EntityData convertToEntityData(Object entity, EntityReference ref)
          Convert a single object to an entity data object (also populates it), will preserve null (i.e. null in => null out)
 boolean entityExists(EntityReference ref)
          Determines if an entity exists based on the reference
 List<?> fetchEntities(EntityReference ref, Search search, Map<String,Object> params)
          Get a list of entities from CollectionResolvable first if available or BrowseSearchable if not, returns the entities as actual entities (converts from EntityData if that was used), correctly handles references to single entities as well
 Object fetchEntity(EntityReference ref)
          Get an entity object of some kind for this reference if it has an id, will simply return null if no id is available in this reference
 List<BrowseEntity> getBrowseableEntities(String parentPrefix)
          Get the meta data about browseable entities
 List<EntityData> getEntitiesData(EntityReference ref, Search search, Map<String,Object> params)
          Get a list of entities from CollectionResolvable first if available or BrowseSearchable if not, returns the entities wrapped in EntityData, correctly handles references to single entities as well
 EntityData getEntityData(EntityReference ref)
          Get the entity data for a reference if possible
 EntityPropertiesService getEntityPropertiesService()
          Allows access to the current EntityPropertiesService
 EntityProviderManager getEntityProviderManager()
          Allows access to the current EntityProviderManager service
 EntityProviderMethodStore getEntityProviderMethodStore()
          Allows access to the current EntityProviderMethodStore service
 EntityRESTProvider getEntityRESTProvider()
          Allows access to the registered REST provider if there is one
 String getEntityURL(String reference, String viewKey, String extension)
          Creates the full URL to an entity using the sakai ServerConfigurationService, (e.g. http://server:8080/direct/entity/123/)

Note: the webapp name (relative URL path) of the direct servlet, of "/direct" is hardcoded into this method, and the org.sakaiproject.entitybroker.util.servlet.DirectServlet must be deployed there on this server.
 EntityViewAccessProviderManager getEntityViewAccessProviderManager()
          Allows access to the current EntityViewAccessProviderManager service
 ExternalIntegrationProvider getExternalIntegrationProvider()
          Allows access to any registered ExternalIntegrationProvider
 int getMaxJSONLevel()
          Returns the maximum depth of object graph allowed during transcoding to JSON
 RequestGetterWrite getRequestGetter()
          Allows access to the current RequestGetter service
 RequestStorageWrite getRequestStorage()
          Allows access to the current RequestStorageWrite service
 Object getSampleEntityObject(String prefix, String id)
          Safely get the sample entity object which is defined for a prefix, if there is not one then return null
 String getServletContext()
          FOR INTERNAL USE ONLY (do not mess with this in other words) This gets the known REST servlet context if there is one, will return a default "/rest" if none is known, will not return "" or null
 String getVersionInfo()
          Used to get a version info string which can be output to see what version we are working with
 EntityView makeEntityView(EntityReference ref, String viewKey, String extension)
          Reduce code duplication and ensure custom templates are used
 String makeFullURL(String pathURL)
          Make a full entity URL (http://....) from just a path URL (/prefix/id.xml)
 EntityView parseEntityURL(String entityURL)
          Parses an entity URL into an entity view object, handles custom parsing templates
 EntityReference parseReference(String reference)
          Parses an entity reference into the appropriate reference form
 void populateEntityData(EntityData[] data)
          Add in the extra meta data (URL, title, etc.) to all entity data objects, handles it as efficiently as possible without remaking an entity view on every call, this is fail safe (i.e. it should throw no exceptions)
 void populateEntityData(List<EntityData> data)
          Add in the extra meta data (URL, title, etc.) to all entity data objects, handles it as efficiently as possible without remaking an entity view on every call, this is fail safe (i.e. it should throw no exceptions)
 void setEntityRESTProvider(EntityRESTProvider entityRESTProvider)
          Allows the developer to set a REST provider to add functionality to the EntityBroker system from a REST handler, the system will operate without this set but some methods will fail
 void setExternalIntegrationProvider(ExternalIntegrationProvider externalIntegrationProvider)
          Allows developers to setup providers to handle parts of the EB system which cannot really be handled internally, the system will operate without this set
 void setServletContext(String servletContext)
          FOR INTERNAL USE ONLY (do not mess with this in other words)
 

Field Detail

POST_METHOD

static final String POST_METHOD
See Also:
Constant Field Values
Method Detail

entityExists

boolean entityExists(EntityReference ref)
Determines if an entity exists based on the reference

Parameters:
reference - an entity reference object
Returns:
true if entity exists, false otherwise

getEntityURL

String getEntityURL(String reference,
                    String viewKey,
                    String extension)
Creates the full URL to an entity using the sakai ServerConfigurationService, (e.g. http://server:8080/direct/entity/123/)

Note: the webapp name (relative URL path) of the direct servlet, of "/direct" is hardcoded into this method, and the org.sakaiproject.entitybroker.util.servlet.DirectServlet must be deployed there on this server.

Parameters:
reference - a globally unique reference to an entity, consists of the entity prefix and optionally the local id
viewKey - the specific view type to get the URL for, can be null to determine the key automatically
extension - the optional extension to add to the end, can be null to use no extension
Returns:
the full URL to a specific entity or space

makeEntityView

EntityView makeEntityView(EntityReference ref,
                          String viewKey,
                          String extension)
Reduce code duplication and ensure custom templates are used


parseReference

EntityReference parseReference(String reference)
Parses an entity reference into the appropriate reference form

Parameters:
reference - a unique entity reference
Returns:
the entity reference object or null if there is no provider found for the prefix parsed out
Throws:
IllegalArgumentException - if there is a failure during parsing

parseEntityURL

EntityView parseEntityURL(String entityURL)
Parses an entity URL into an entity view object, handles custom parsing templates

Parameters:
entityURL - an entity URL
Returns:
the entity view object representing this URL or null if there is no provider found for the prefix parsed out
Throws:
IllegalArgumentException - if there is a failure during parsing

makeFullURL

String makeFullURL(String pathURL)
Make a full entity URL (http://....) from just a path URL (/prefix/id.xml)

Parameters:
pathURL - a path (like pathInfo from a request) (e.g. /prefix/id.xml)
Throws:
IllegalArgumentException - is the pathURL is null

fetchEntity

Object fetchEntity(EntityReference ref)
Get an entity object of some kind for this reference if it has an id, will simply return null if no id is available in this reference

Parameters:
ref - an entity reference
Returns:
the entity object for this reference OR null if none can be retrieved

getEntityData

EntityData getEntityData(EntityReference ref)
Get the entity data for a reference if possible

Parameters:
ref - an entity reference
Returns:
an EntityData object for this reference if one can be found OR null if not

fetchEntities

List<?> fetchEntities(EntityReference ref,
                      Search search,
                      Map<String,Object> params)
Get a list of entities from CollectionResolvable first if available or BrowseSearchable if not, returns the entities as actual entities (converts from EntityData if that was used), correctly handles references to single entities as well

Parameters:
ref - the reference
search - a search (should not be null)
params -
Returns:
a list of entities OR empty list if none found for the given reference

getEntitiesData

List<EntityData> getEntitiesData(EntityReference ref,
                                 Search search,
                                 Map<String,Object> params)
Get a list of entities from CollectionResolvable first if available or BrowseSearchable if not, returns the entities wrapped in EntityData, correctly handles references to single entities as well

Parameters:
ref - the reference
search - a search (should not be null)
params -
Returns:
a list of entities OR empty list if none found for the given reference

browseEntities

List<EntityData> browseEntities(String prefix,
                                Search search,
                                String userReference,
                                String associatedReference,
                                EntityReference parentEntityRef,
                                Map<String,Object> params)
Fetches the browseable entities

Parameters:
prefix -
search -
userReference -
associatedReference -
parentEntityRef -
params -
Returns:
a list of entity data results to browse

getBrowseableEntities

List<BrowseEntity> getBrowseableEntities(String parentPrefix)
Get the meta data about browseable entities

Parameters:
parentPrefix - the prefix of the parent type (null for the root types)
Returns:
the list of browseable entity meta data

convertToEntityData

List<EntityData> convertToEntityData(List<?> entities,
                                     EntityReference ref)
Convert a list of objects to entity data objects (also populates them), will preserve null (i.e. null in => null out)


convertToEntityData

EntityData convertToEntityData(Object entity,
                               EntityReference ref)
Convert a single object to an entity data object (also populates it), will preserve null (i.e. null in => null out)


populateEntityData

void populateEntityData(List<EntityData> data)
Add in the extra meta data (URL, title, etc.) to all entity data objects, handles it as efficiently as possible without remaking an entity view on every call, this is fail safe (i.e. it should throw no exceptions)

Parameters:
data - a list of entity data

populateEntityData

void populateEntityData(EntityData[] data)
Add in the extra meta data (URL, title, etc.) to all entity data objects, handles it as efficiently as possible without remaking an entity view on every call, this is fail safe (i.e. it should throw no exceptions)

Parameters:
data - a list of entity data

getSampleEntityObject

Object getSampleEntityObject(String prefix,
                             String id)
Safely get the sample entity object which is defined for a prefix, if there is not one then return null

Parameters:
prefix - the entity prefix
id - (optional) will get the actual entity for this id as a sample
Returns:
a sample object OR null if none can be found

getEntityProviderManager

EntityProviderManager getEntityProviderManager()
Allows access to the current EntityProviderManager service

Returns:
the current EntityProviderManager service

getEntityPropertiesService

EntityPropertiesService getEntityPropertiesService()
Allows access to the current EntityPropertiesService

Returns:
the current EntityPropertiesService

getEntityViewAccessProviderManager

EntityViewAccessProviderManager getEntityViewAccessProviderManager()
Allows access to the current EntityViewAccessProviderManager service

Returns:
the current EntityViewAccessProviderManager

getEntityProviderMethodStore

EntityProviderMethodStore getEntityProviderMethodStore()
Allows access to the current EntityProviderMethodStore service

Returns:
the current EntityProviderMethodStore

getRequestGetter

RequestGetterWrite getRequestGetter()
Allows access to the current RequestGetter service

Returns:
the current RequestGetter

getRequestStorage

RequestStorageWrite getRequestStorage()
Allows access to the current RequestStorageWrite service

Returns:
the current RequestStorageWrite

getExternalIntegrationProvider

ExternalIntegrationProvider getExternalIntegrationProvider()
Allows access to any registered ExternalIntegrationProvider

Returns:
the external integration provider OR null if there is not one

getEntityRESTProvider

EntityRESTProvider getEntityRESTProvider()
Allows access to the registered REST provider if there is one

Returns:
the REST provider OR null if there is not one

setExternalIntegrationProvider

void setExternalIntegrationProvider(ExternalIntegrationProvider externalIntegrationProvider)
Allows developers to setup providers to handle parts of the EB system which cannot really be handled internally, the system will operate without this set

Parameters:
externalIntegrationProvider - the external integration provider to use in the system

setEntityRESTProvider

void setEntityRESTProvider(EntityRESTProvider entityRESTProvider)
Allows the developer to set a REST provider to add functionality to the EntityBroker system from a REST handler, the system will operate without this set but some methods will fail

Parameters:
entityRESTProvider - a service to provide REST functionality

getVersionInfo

String getVersionInfo()
Used to get a version info string which can be output to see what version we are working with


setServletContext

void setServletContext(String servletContext)
FOR INTERNAL USE ONLY (do not mess with this in other words)

Parameters:
servletContext - sets the servlet context being used by the system (defaults to #DIRECT)

getServletContext

String getServletContext()
FOR INTERNAL USE ONLY (do not mess with this in other words) This gets the known REST servlet context if there is one, will return a default "/rest" if none is known, will not return "" or null


getMaxJSONLevel

int getMaxJSONLevel()
Returns the maximum depth of object graph allowed during transcoding to JSON



Copyright © 2007-2013 Sakai Project. All Rights Reserved.