Class JndiRepositoryFactory

  • All Implemented Interfaces:
    Direct Known Subclasses:

    public class JndiRepositoryFactory
    extends java.lang.Object
    implements RepositoryFactory
    JNDI-based JCR repository factory. This factory looks up Repository instances from JNDI directories based on the following parameters:
    The value of this parameter is used as a JNDI name for looking up the repository.
    If the URI scheme is "jndi", then the remainder of the URI is used as a JNDI name for looking up the repository.

    All the other repository parameters are passed as the environment of the initial JNDI context.

    Clients should normally only use this class through the Java Service Provider mechanism. See the getRepository utility methods in JcrUtils for an easy way to do that.

    Apache Jackrabbit 2.0
    • Field Summary

      Modifier and Type Field Description
      static java.lang.String JNDI_NAME
      The JNDI name parameter name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Repository getRepository​(java.util.Map parameters)
      Attempts to establish a connection to a repository using the given parameters.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • JNDI_NAME

        public static final java.lang.String JNDI_NAME
        The JNDI name parameter name.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JndiRepositoryFactory

        public JndiRepositoryFactory()
    • Method Detail

      • getRepository

        public Repository getRepository​(java.util.Map parameters)
                                 throws RepositoryException
        Description copied from interface: RepositoryFactory
        Attempts to establish a connection to a repository using the given parameters.

        Parameters are passed in a Map of String key/value pairs. The keys are not specified by JCR and are implementation specific. However, vendors should use keys that are namespace qualified in the Java package style to distinguish their key names. For example an address parameter might be com.vendor.address.

        The implementation must return null if it does not understand the given parameters. The implementation may also return null if a default repository instance is requested (indicated by null parameters) and this factory is not able to identify a default repository.

        An implementation of this method must be thread-safe.

        Specified by:
        getRepository in interface RepositoryFactory
        parameters - map of string key/value pairs as repository arguments or null if none are provided and a client wishes to connect to a default repository.
        a repository instance or null if this implementation does not understand the passed parameters.
        RepositoryException - if if no suitable repository is found or another error occurs.