Class RepositoryAccessor


  • public class RepositoryAccessor
    extends Object
    Access a Repository via JNDI or RMI.
    • Field Detail

      • REPOSITORY_URL_OVERRIDE_PROPERTY

        public static final String REPOSITORY_URL_OVERRIDE_PROPERTY
        Name of the property that the jcr client and server bundles to override their default configuration settings and connect to the specified repository instead (SLING-254 and SLING-260)
        See Also:
        Constant Field Values
    • Constructor Detail

      • RepositoryAccessor

        public RepositoryAccessor()
    • Method Detail

      • getRepository

        public Repository getRepository​(String repositoryName,
                                        Hashtable<String,​Object> jndiContext)
        First try to access the Repository via JNDI (unless jndiContext is null), and if not successful try RMI.
        Parameters:
        repositoryName - JNDI name or RMI URL (must start with "rmi://") of the Repository
        jndiContext - if null, JNDI is not tried
        Returns:
        a Repository, or null if not found
      • getRepositoryFromURL

        public Repository getRepositoryFromURL​(String url)
        Acquire a Repository from the given URL
        Parameters:
        url - for RMI, an RMI URL. For JNDI, "jndi://", followed by the JNDI repository name, followed by a colon and a comma-separated list of JNDI context values, for example:
              jndi://jackrabbit:java.naming.factory.initial=org.SomeClass,java.naming.provider.url=http://foo.com
         
        Returns:
        the repository for the given url
        Throws:
        NullPointerException - If url is null.