nl.gx.webmanager.services.contentrepresentation
Interface RepresentationGeneratorService


public interface RepresentationGeneratorService

This is the OSGi service interface of a registry of RepresentationGenerator instances. Clients can register their own RepresentationGenerator by making it available through the OSGi service registry. The single implementation of this module does not implement service ranking. I.e., if there are two services registered for a given type, then it is not specified which of the two services is used to represent the content item.

The search order for a given type T is defined as follows:

  1. If T is mapped to a set of generators then return an arbitrary generator from that set.
  2. For all interfaces I of T do: If I is mapped to a set of generators then return an arbitrary generator from that set.
  3. Let S be the super type of T. Start from (1) with S.

On startup, the service registers a number of default representation generators for the following types:


Method Summary
 ContentRepresentation represent(java.lang.Object contentItem)
          Represents the given content item.
 

Method Detail

represent

ContentRepresentation represent(java.lang.Object contentItem)
                                throws ContentRepresentationException
Represents the given content item. It finds appropriate RepresentationGenerator instances in its registry and uses them to generate the representation. The look-up is done using the run-time class of the given content item instance and the RepresentationGenerator.getSupportedType() method. If no suitable RepresentationGenerator service has registered then an exception is thrown.

Parameters:
contentItem - the content item to represent
Returns:
a ContentRepresentation for the given content item instance
Throws:
ContentRepresentationException - on error (such as a cycle in the content item object structure)


Copyright © 2007-2011 GX Software BV. All Rights Reserved.