Navigation:
Documentation
Archive



Page Tree:

Child pages
  • Document Handler Service Contract Description v0.9-alpha

This wiki space contains archival documentation of Project Bamboo, April 2008 - March 2013.

Skip to end of metadata
Go to start of metadata

Brief Description

Version

This page describes the Notification service API, version 0.9

 

To discover the version and other metadata about deployed service code that fulfills this API, please utilize the  Service Catalog Service .

 

Overview and Definitions

The Document Handler Service specifies the functions that a document handler must support and provides the default service provider for resources in BSP.

The Document Handler Service specifies the methods that a resource's document handler must implement for serializing resource representations based on supported media (mime) types. Service developers should create a document handler (and potentially a sub-interface of DocumentHandlerService) for each resource. Apart from its use within its owning service, these document handlers are also used by the Result Set Cache service to marshal cached representations. Alternatively, a service developer may opt to allow BSP to use its default document handler, which is also provided by the Document Handler Service.

There is no RESTful interface for this helper service.

Assumptions

  1. A resource is not required to have a document handler. If a resource does not have a document handler, the document handler function will be performed by the default handler.
  2. Document handlers will be published in the Service Catalog as needed.

References

 

  • Codebase: ${REPOSITORY_ROOT}/platform-services/bsp/trunk/bsp/core-services/documenthandler-registry-service/

Known Issues

 

n/a


SOA Layer API

Document handler service providers must implement the following API.

Also see generated Javadoc for this service. Packages are org.projectbamboo.bsp.utility.documenthandler.*.

Marshal the content of a resource into a representation of a specific content type

/**
 * Marshal the content of a resource into a representation of a specific content type.
 *
 * @param The content type for the representation to be produced
 * @param The resource as a Java object
 * @return Stream from which to read the serialized representation
 * @throws <pre>DocumentHandlerException; since the root cause of the exception is dependent
 *                 on the representation abstraction, interrogate the exception message for
 *                 the reason for the exception </pre>
 */
InputStream marshal(MediaType mT, T resource) throws DocumentHandlerException;

Unmarshal a representation into the Java class for the resource.

/**
 * Unmarshal a representation into the Java class for the resource.
 *
 * @param The content type of the representation's content
 * @param Stream from which to get the content
 * @return Java object for the resource
 * @throws <pre>DocumentHandlerException; since the root cause of the exception is dependent
 * 				on the representation abstraction, interrogate the exception message for
 * 				the reason for the exception </pre>
 */
T unmarshal (MediaType mT, InputStream iS) throws DocumentHandlerException;

Determine if a content type is supported by the document handler.

/**
 * Determine if a content type is supported by the document handler.
 *
 * @param <code>Media Type</code> of the representation
 * @return boolean true if supported
 */
boolean isSupported(MediaType mT);

Marshal the content of a list of resource into a list of representations of a specific content type.

/**
 * Marshal the content of a list of resource into a list of
 * representations of a specific content type.
 *
 * @param The content type for the representation to be produced
 * @param The resource as a <code>List<T></code> object
 * @param The filter to apply when creating the list
 * @return Stream from which to read the serialized representation of the list
 * @throws <pre>DocumentHandlerException; since the root cause of the exception is dependent
 * 				on the representation abstraction, interrogate the exception message for
 * 				the reason for the exception </pre>
 */
InputStream marshal(MediaType mT, List<T> listT, CollectionFilter filter) throws DocumentHandlerException;