org.apache.sling.jcr.base
Class NamespaceMappingSupport

java.lang.Object
  extended by org.apache.sling.jcr.base.NamespaceMappingSupport
Direct Known Subclasses:
AbstractNamespaceMappingRepository, AbstractSlingRepositoryManager

public abstract class NamespaceMappingSupport
extends Object

The NamespaceMappingSupport is an abstract base class for implementing support for dynamic namespace mapping in SlingRepository instances.

Since:
API version 2.3 (bundle version 2.3)
See Also:
AbstractSlingRepositoryManager

Constructor Summary
NamespaceMappingSupport()
           
 
Method Summary
protected  javax.jcr.Session getNamespaceAwareSession(javax.jcr.Session session)
          Return a namespace aware session.
protected abstract  org.apache.sling.jcr.api.NamespaceMapper[] getNamespaceMapperServices()
          Returns the NamespaceMapper services used by the getNamespaceAwareSession(Session) method to define custom namespaces on sessions.
protected  void setup(org.osgi.framework.BundleContext bundleContext, org.apache.sling.jcr.api.SlingRepository repository)
          Sets up the namespace mapping support.
protected  void tearDown()
          Terminates namespace mapping support.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamespaceMappingSupport

public NamespaceMappingSupport()
Method Detail

getNamespaceMapperServices

protected abstract org.apache.sling.jcr.api.NamespaceMapper[] getNamespaceMapperServices()
Returns the NamespaceMapper services used by the getNamespaceAwareSession(Session) method to define custom namespaces on sessions.

Returns:
the NamespaceMapper services or null if there are none.

setup

protected void setup(org.osgi.framework.BundleContext bundleContext,
                     org.apache.sling.jcr.api.SlingRepository repository)
Sets up the namespace mapping support. This method is called by implementations of this class after having started (or acquired) the backing JCR repository instance.

This method may be overwritten but must be called from overwriting methods.

Parameters:
bundleContext - The OSGi BundleContext to access the framework for namespacing setup
repository - The SlingRepository to register namespaces on

tearDown

protected void tearDown()
Terminates namespace mapping support. This method is called by the implementations of this class before stopping (or letting go of) the backing JCR repository instance.

This method may be overwritten but must be called from overwriting methods.


getNamespaceAwareSession

protected final javax.jcr.Session getNamespaceAwareSession(javax.jcr.Session session)
                                                    throws javax.jcr.RepositoryException
Return a namespace aware session.

This method must be called for each JCR Session to be returned from any of the repository login methods which are expected to support dynamically mapped namespaces.

Parameters:
session - The session convert into a namespace aware session
Returns:
The namespace aware session
Throws:
javax.jcr.RepositoryException - If an error occurrs making the session namespace aware


Copyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.