Index: src/test/java/org/modeshape/jcr/JcrConfigurationTest.java =================================================================== --- src/test/java/org/modeshape/jcr/JcrConfigurationTest.java (revision 2494) +++ src/test/java/org/modeshape/jcr/JcrConfigurationTest.java (working copy) @@ -257,6 +257,7 @@ options.put(Option.QUERY_INDEX_DIRECTORY, DefaultOption.QUERY_INDEX_DIRECTORY); options.put(Option.QUERY_INDEXES_UPDATED_SYNCHRONOUSLY, DefaultOption.QUERY_INDEXES_UPDATED_SYNCHRONOUSLY); options.put(Option.PERFORM_REFERENTIAL_INTEGRITY_CHECKS, DefaultOption.PERFORM_REFERENTIAL_INTEGRITY_CHECKS); + options.put(Option.REPOSITORY_JNDI_LOCATION,DefaultOption.REPOSITORY_JNDI_LOCATION); assertThat(repository.getOptions(), is(options)); } Index: src/main/java/org/modeshape/jcr/JcrI18n.java =================================================================== --- src/main/java/org/modeshape/jcr/JcrI18n.java (revision 2494) +++ src/main/java/org/modeshape/jcr/JcrI18n.java (working copy) @@ -115,6 +115,7 @@ public static I18n cannotRemoveNodeFromClone; public static I18n cannotRemoveNodeFromCloneDueToChangesInSession; public static I18n constraintViolatedOnReference; + public static I18n unableToBindToJndi; public static I18n cannotRemoveRootNode; public static I18n cannotRemoveParentNodeOfTarget; Index: src/main/java/org/modeshape/jcr/JcrRepository.java =================================================================== --- src/main/java/org/modeshape/jcr/JcrRepository.java (revision 2494) +++ src/main/java/org/modeshape/jcr/JcrRepository.java (working copy) @@ -104,6 +104,8 @@ import org.modeshape.jcr.xpath.XPathQueryParser; import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.Multimap; +import javax.naming.InitialContext; +import javax.naming.NamingException; /** * Creates JCR {@link Session sessions} to an underlying repository (which may be a federated repository). @@ -268,9 +270,17 @@ * The default value is 'true', meaning that these checks are performed. *
*/ - PERFORM_REFERENTIAL_INTEGRITY_CHECKS; + PERFORM_REFERENTIAL_INTEGRITY_CHECKS, /** + * A String property that when specified tells the {@link JcrEngine} where to put the + * {@link Repository} in to JNDI. Assumes that you have write access + * to the JNDI tree. If no value set, then the {@link Repository} will not be bound to JNDI. + * + */ + REPOSITORY_JNDI_LOCATION; + + /** * Determine the option given the option name. This does more than {@link Option#valueOf(String)}, since this method first * tries to match the supplied string to the option's {@link Option#name() name}, then the uppercase version of the * supplied string to the option's name, and finally if the supplied string is a camel-case version of the name (e.g., @@ -353,6 +363,11 @@ */ public static final String PERFORM_REFERENTIAL_INTEGRITY_CHECKS = Boolean.TRUE.toString(); + /** + * The default value for the {@link Option#REPOSITORY_JNDI_LOCATION} option is {@value} + */ + public static final String REPOSITORY_JNDI_LOCATION = ""; + } /** @@ -411,6 +426,7 @@ defaults.put(Option.QUERY_INDEXES_UPDATED_SYNCHRONOUSLY, DefaultOption.QUERY_INDEXES_UPDATED_SYNCHRONOUSLY); defaults.put(Option.QUERY_INDEX_DIRECTORY, DefaultOption.QUERY_INDEX_DIRECTORY); defaults.put(Option.PERFORM_REFERENTIAL_INTEGRITY_CHECKS, DefaultOption.PERFORM_REFERENTIAL_INTEGRITY_CHECKS); + defaults.put(Option.REPOSITORY_JNDI_LOCATION,DefaultOption.REPOSITORY_JNDI_LOCATION); DEFAULT_OPTIONS = Collections.