!--a11y-->
Implementing the Content Aspect
(IContentManager) 
You implement the content aspect of the repository manager to access the content of the backend objects within the repository framework.
An IContentManager implementation enables every resource to provide content. Content can be anything that implements the IContent interface.
The interface exposes the getContent() method signature. The implementation has to determine the content that is provided for a specific IResourceHandle.
public IContent getContent(IResourceHandle handle)
throws ResourceException {
If the
handle object that is passed to this method is a collection object, the method
should return null. However, the method is not executed for
collections.
Node node = ((SimpleHandle) handle).getNode();
if( node.isCollection() ) {
return null;
}
The
content from the backend system must be accessible as java.io.InputStream objects. The stream is passed
to the Content object together with its mime type (as a
java.lang.String) and the content length
(long) in bytes. If the mime type or content length
cannot be determined by the backend system, the default value
null for mimetype and -1 for contentlength can be provided.
try {
return new Content(node.getInputStream(), null, -1);
}
catch( Exception e ) {
throw new ResourceException(handle.getRid(), e);
}
You implement the following methods of the IContentManager interface:
getContent(IResourceHandle |
Returns the content for the specified IResourceHandle |