org.sakaiproject.entitybroker.entityprovider
Interface CoreEntityProvider

All Superinterfaces:
EntityProvider

public interface CoreEntityProvider
extends EntityProvider

This is the base unit for working with Sakai entities, by implementing this interface and creating a spring bean you will tie your entities into Sakai, there are many other interfaces which you can implement to extend the interaction of your entities with Sakai in this package
You (the implementor) will want to create one implementation of this interface for each type of entity you want to link to Sakai to track events, provide URL access, etc.

Usage:
1) Implement this interface
2) Implement any additional capabilities interfaces (optional)
3) Create a spring bean definition in the Sakai application context (components.xml)
4) Implement AutoRegisterEntityProvider or register this implementation some other way

Recommended best practices: (example: Thing entity)
1) Create an interface called ThingEntityProvider which extends EntityProvider in api logic (add an entity package for it), (e.g. org.sakaiproject.evaluation.logic.entity.EvaluationEntityProvider.java)
2) Add a public static string which contains the entity prefix (called ENTITY_PREFIX), (e.g. public final static String ENTITY_PREFIX = "eval-evaluation";)
3) Implement your ThingEntityProvider in impl logic as ThingEntityProviderImpl (add an entity package for it), (e.g. org.sakaiproject.evaluation.logic.impl.entity.EvaluationEntityProviderImpl.java)
4) Implement CoreEntityProvider in ThingEntityProviderImpl
5) Implement AutoRegisterEntityProvider in ThingEntityProviderImpl
6) Add a spring bean definition in the Sakai application context (components.xml), use the api name as the id
Example:

<bean id="org.sakaiproject.evaluation.logic.entity.EvaluationEntityProvider" class="org.sakaiproject.evaluation.logic.impl.entity.EvaluationEntityProviderImpl"> </bean>
7) Add the needed maven dependendencies to api/logic and impl/logic project.xml files
Exmaple: <dependency> <groupId>sakaiproject</groupId> <artifactId>sakai-entitybroker-api</artifactId> <version>${sakai.version}</version> </dependency>
That should do it. You should now be able to use the EntityBroker to access information about your entities and register events for your entities (among other things).

Author:
Aaron Zeckoski (aaronz@vt.edu), Antranig Basman (antranig@caret.cam.ac.uk)

Method Summary
 boolean entityExists(String id)
          Check if a specific entity managed by this provider exists.
 
Methods inherited from interface org.sakaiproject.entitybroker.entityprovider.EntityProvider
getEntityPrefix
 

Method Detail

entityExists

boolean entityExists(String id)
Check if a specific entity managed by this provider exists.
This is primarily used to validate references before making other calls or operating on them.
WARNING: This will be called many times and AT LEAST right before calls are made to any methods or capabilities related to specific entities, please make sure this is very efficient. If you are concerned about efficiency, it is ok for this method to always return true but you will no longer be able to be sure that calls through to your capability implementations are always valid.

Parameters:
id - a locally unique id for an entity managed by this provider
NOTE: this will be an empty string if this is an entity space (singleton entity) without an id available
Returns:
true if an entity with given local id exists, false otherwise


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