Entity Provider Capabilities

Information

Defines entity provider capabilities and explains how to extend the entity provider system.

Entity Provider Capabilities

  • Capabilities are extensions to the the entity provider and broker system.
    • Allows anyone to include additional functionality for entities without having to touch the code in the entity broker itself.
    • Only adds a dependency on the entity broker API to your project code.
  • Capabilities can be created by anyone and should be located within the relevant project (e.g. Search)
    • There are some capabilities that are within the entity broker project. These are referred to as internal capbilities.
    • Capabilities which are true extensions and live outside the entity broker project are referred to as external capabilities.

Creating a new capability

  • TODO

Internal capabilities

Information

This documents all known internal capabilities (capabilities included in the main entity broker project) of the Entity Provider.

Internal Capabilities

  1. AutoRegisterEntityProvider - Causes the EntityProvider which implements this 0 method interface to automatically be reigstered with the EntityBrokerManager when Sakai starts up
  2. Resolvable - Allows access to an actual object which represents this entity (does not have to be the persistent object itself), requires implementation of a 2 method interface
  3. Propertyable/PropertyProvidable - Allows an entity provider to determine that entities can have persistent properties attached to them
  4. ReferenceParseable - Indicates an entity provider has the capability of parsing its own reference string. An entity that does not implement this interface is assumed to deal in IdEntityReference references.

Under development

  1. Importable - Allows an entity to be imported
  2. Exportable - Allows an entity to be exported
  3. Taggable/TagProvidable - Allows tags to be attached to an entity and entities to be able to be located by tags
  4. Searchable - Allows entities to be searched and filtered
  5. ParseSpecParseable - Allows an entity provider to define the parsing specification for its own reference string
  6. Cacheable - Allows an entity provider to specify that all responses to entity broker calls should be cached and defines the amount of time to cache the calls

External capabilities

Information

This documents the ways to create external capabilities and some of the more prominent examples of them.

External Capabilities creation

  • External capabilities allow anyone to extend the functionality of the entity system without needing to add their code into the core project. Creation of external capabilities normally requires the use of an adaptor project. This adaptor project would be external to the projects which use the capability and also external to the projects which define the entity set it is related to. This way it is possible to leave out this capability and still have all projects function without creating a dependency web. More info about this on Adaptor projects.
  1. If you do not have a project which defines an entity set then you either need to use someone elses or create one. For this example, we will assume we have a project (widgetmaker) which defines the widget entities. It is a simple entity set and only implements the CoreEntityProvider.
  2. Define the widget attaching functionality in the widgetmaker service (implement the code which supports the attaching of widgets)
    public WidgetMakerService {
    ...
       public void attachWidget(String reference, Widget widget);
    
       public List<Widget> getAttachedWidgets(String reference);
    }
    
    
  3. Create an Adaptor project for the new external capability. This project should depend on ONLY the entitybroker and widgetmaker.
  4. Define the new WidgetAttacher capability by extending EntityProvider
    • This widget attacher allows someone to make it so their entities can have widgets attached to them
    • It would be undesirable to force the widgetmaker into the kernel just so that entities could potentially support the attaching of widgets for many reasons (it is beta, it does not perform well enough, it is not a functionality that is widely desired, etc.) so the adapator allows us to have the flexibility of extending without requiring
      /**
       * Allow your entities to have widgets attached to them, capabilities extension of the entitybroker system
       */
      public interface WidgetAttacher extends EntityProvider {
          // this space left intentionally blank
      }
      
    • You should have lots of comments, I omitted them here for readability
    • Note that it is ok to include the Widget object from the widgetmaker project because it is a dependency
  5. Wire in the capability by checking for providers which use this capability
    1. Inject the EntityProviderManager which allows you to get to EntityProviders which are implementing your capability