org.apache.slide.content
Interface ContentInterceptor

All Known Implementing Classes:
AbstractContentInterceptor

public interface ContentInterceptor

An interface that allows custom components to observe and intercept storage, retrieval and removal of content.

Multiple ContentInterceptors can be associated with a single Namespace. They are typically configured in the <configuration> section of the domain configuration file like this:

 <content-interceptor class="com.acme.MyContentInterceptor">
  <parameter name="myParam1">someValue</parameter>
  <parameter name="myParam2">anotherValue</parameter>
 </content-interceptor>

As you can see, ContentInterceptors can be configured with parameters. This is optional, and exactly which parameters are available depends on the specific ContentInterceptor implementation.

ContentInterceptor implementations must provide a public constructor without arguments, so that instances of the class can be instantiated at startup. In addition, implementors should pay attention to this minimal lifecycle definition:

The signatures of the preXXX and postXXX specify a wide range of exceptions that can be thrown. If such an exception is thrown it will be propagated up to the the API client. In the case of the preXXX the started operation will be terminated. So be sure to handle all exceptions that shouldn't be propagated back into the core core API - and thus possibly influence success of the operation - yourself.


Method Summary
 void postRemoveContent(SlideToken token, NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor)
          This method will be called just after content has been removed, either of all revisions of a node, or of only one particular revision.
 void postRetrieveContent(SlideToken token, NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent)
          This method will be called just after retrieving content, or the descriptor of a particular revision.
 void postStoreContent(SlideToken token, NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent)
          This method will be called just after the content of a node was stored.
 void preRemoveContent(SlideToken token, NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor)
          This method will be called just before content will get removed, either of all revisions of a node, or of only one particular revision.
 void preRetrieveContent(SlideToken token, NodeRevisionDescriptors revisionDescriptors, NodeRevisionNumber revisionNumber, NodeRevisionDescriptor revisionDescriptor)
          This method will be called just before content is retrieved, or the descriptor of a particular revision is retrieved.
 void preStoreContent(SlideToken token, NodeRevisionDescriptors revisionDescriptors, NodeRevisionDescriptor revisionDescriptor, NodeRevisionContent revisionContent)
          This method will be called just before the content of a node is stored.
 void setNamespace(NamespaceAccessToken nat)
          The setNamespace method will be called during initialization of the ContextInterceptor.
 void setParameters(java.util.Hashtable parameters)
          This method is called during initialization of the ContentInterceptor to allow parameterization from the configuration.
 

Method Detail

preStoreContent

public void preStoreContent(SlideToken token,
                            NodeRevisionDescriptors revisionDescriptors,
                            NodeRevisionDescriptor revisionDescriptor,
                            NodeRevisionContent revisionContent)
                     throws AccessDeniedException,
                            ObjectNotFoundException,
                            LinkedObjectNotFoundException,
                            ObjectLockedException,
                            ServiceAccessException
This method will be called just before the content of a node is stored.

Parameters:
token - the SlideToken
revisionDescriptors - revision tree of the content to be stored
revisionDescriptor - revision descriptor of the content to be stored
revisionContent - the actual content to be stored
Throws:
AccessDeniedException - if access to a resource has been denied
ObjectNotFoundException - if an object could not be found
LinkedObjectNotFoundException - if an object linked to by another object could not be found
ObjectLockedException - if an object is locked
ServiceAccessException - low-level service failure

postStoreContent

public void postStoreContent(SlideToken token,
                             NodeRevisionDescriptors revisionDescriptors,
                             NodeRevisionDescriptor revisionDescriptor,
                             NodeRevisionContent revisionContent)
                      throws AccessDeniedException,
                             ObjectNotFoundException,
                             LinkedObjectNotFoundException,
                             ObjectLockedException,
                             ServiceAccessException
This method will be called just after the content of a node was stored.

Parameters:
token - the SlideToken
revisionDescriptors - revision tree of the content that has been stored
revisionDescriptor - revision descriptor of the content that has been stored
revisionContent - the actual content that has been stored
Throws:
AccessDeniedException - if access to a resource has been denied
ObjectNotFoundException - if an object could not be found
LinkedObjectNotFoundException - if an object linked to by another object could not be found
ObjectLockedException - if an object is locked
ServiceAccessException - low-level service failure

preRetrieveContent

public void preRetrieveContent(SlideToken token,
                               NodeRevisionDescriptors revisionDescriptors,
                               NodeRevisionNumber revisionNumber,
                               NodeRevisionDescriptor revisionDescriptor)
                        throws AccessDeniedException,
                               ObjectNotFoundException,
                               LinkedObjectNotFoundException,
                               ObjectLockedException,
                               ServiceAccessException
This method will be called just before content is retrieved, or the descriptor of a particular revision is retrieved.

Parameters:
token - the SlideToken
revisionDescriptors - revision tree of the descriptor that should be retrieved, or null if the content should be retrieved
revisionNumber - revision number of the descriptor that should be retrieved, or null if the content should be retrieved
revisionDescriptor - revision descriptor of the content that should be retrieved, or null if the descriptor will be retrieved
Throws:
AccessDeniedException - if access to a resource has been denied
ObjectNotFoundException - if an object could not be found
LinkedObjectNotFoundException - if an object linked to by another object could not be found
ObjectLockedException - if an object is locked
ServiceAccessException - low-level service failure

postRetrieveContent

public void postRetrieveContent(SlideToken token,
                                NodeRevisionDescriptors revisionDescriptors,
                                NodeRevisionDescriptor revisionDescriptor,
                                NodeRevisionContent revisionContent)
                         throws AccessDeniedException,
                                ObjectNotFoundException,
                                LinkedObjectNotFoundException,
                                ObjectLockedException,
                                ServiceAccessException
This method will be called just after retrieving content, or the descriptor of a particular revision.

Parameters:
token - the SlideToken
revisionDescriptors - revision tree of the descriptor that has been retrieved, or null when the content has been retrieved
revisionDescriptor - revision descriptor of the content that has been retrieved, or the descriptor itself has been retrieved
revisionContent - the actual content that has been retrieved, or null when the descriptor has been retrieved
Throws:
AccessDeniedException - if access to a resource has been denied
ObjectNotFoundException - if an object could not be found
LinkedObjectNotFoundException - if an object linked to by another object could not be found
ObjectLockedException - if an object is locked
ServiceAccessException - low-level service failure

preRemoveContent

public void preRemoveContent(SlideToken token,
                             NodeRevisionDescriptors revisionDescriptors,
                             NodeRevisionDescriptor revisionDescriptor)
                      throws AccessDeniedException,
                             ObjectNotFoundException,
                             LinkedObjectNotFoundException,
                             ObjectLockedException,
                             ServiceAccessException
This method will be called just before content will get removed, either of all revisions of a node, or of only one particular revision.

Parameters:
token - the SlideToken
revisionDescriptors - revision tree of the content that will be removed, or null if a only a particular revision should be removed
revisionDescriptor - revision descriptor of the content that will be removed, or null if all revisions of a node should be removed
Throws:
AccessDeniedException - if access to a resource has been denied
ObjectNotFoundException - if an object could not be found
LinkedObjectNotFoundException - if an object linked to by another object could not be found
ObjectLockedException - if an object is locked
ServiceAccessException - low-level service failure

postRemoveContent

public void postRemoveContent(SlideToken token,
                              NodeRevisionDescriptors revisionDescriptors,
                              NodeRevisionDescriptor revisionDescriptor)
                       throws AccessDeniedException,
                              ObjectNotFoundException,
                              LinkedObjectNotFoundException,
                              ObjectLockedException,
                              ServiceAccessException
This method will be called just after content has been removed, either of all revisions of a node, or of only one particular revision.

Parameters:
token - the SlideToken
revisionDescriptors - revision tree of the content that has been removed, or null if a only a particular revision has been removed
revisionDescriptor - revision descriptor of the content that has been removed, or null if all revisions of a node have been removed
Throws:
AccessDeniedException - if access to a resource has been denied
ObjectNotFoundException - if an object could not be found
LinkedObjectNotFoundException - if an object linked to by another object could not be found
ObjectLockedException - if an object is locked
ServiceAccessException - low-level service failure

setNamespace

public void setNamespace(NamespaceAccessToken nat)
The setNamespace method will be called during initialization of the ContextInterceptor.

Parameters:
nat - the access token to the namespace this ContentInterceptor has been associated with

setParameters

public void setParameters(java.util.Hashtable parameters)
This method is called during initialization of the ContentInterceptor to allow parameterization from the configuration. If no parameters have been specified, the Hashtable will be empty

Parameters:
parameters - Hashtable containing the parameters' names as keys and the associated parameter values as values, both of type java.lang.String