Index: src/java/org/apache/jackrabbit/jca/JCARepositoryManager.java =================================================================== --- src/java/org/apache/jackrabbit/jca/JCARepositoryManager.java (revision 387099) +++ src/java/org/apache/jackrabbit/jca/JCARepositoryManager.java (working copy) @@ -20,6 +20,7 @@ import org.apache.jackrabbit.core.config.RepositoryConfig; import javax.jcr.RepositoryException; +import java.io.InputStream; import java.util.HashMap; import java.util.Map; @@ -28,6 +29,9 @@ */ public final class JCARepositoryManager { + /** The config file prefix that signifies the file is to be loaded from the classpath. */ + public static final String CLASSPATH_CONFIG_PREFIX = "classpath:"; + /** * Instance of manager. */ @@ -48,6 +52,12 @@ /** * Create repository. + * + * @param homeDir The location of the repository. + * @param configFile The path to the repository configuration file. If the file is located on + * the classpath, the path should be prepended with + * JCARepositoryManager.CLASSPATH_CONFIG_PREFIX. + * */ public RepositoryImpl createRepository(String homeDir, String configFile) throws RepositoryException { @@ -57,6 +67,9 @@ /** * Shutdown the repository. + * + * @param homeDir The location of the repository. + * @param configFile The path to the repository configuration file. */ public void shutdownRepository(String homeDir, String configFile) { Reference ref = getReference(homeDir, configFile); @@ -65,6 +78,9 @@ /** * Return the reference. + * + * @param homeDir The location of the repository. + * @param configFile The path to the repository configuration file. */ private synchronized Reference getReference(String homeDir, String configFile) { Reference ref = new Reference(homeDir, configFile); @@ -95,7 +111,8 @@ private final String homeDir; /** - * Configuration file. + * Configuration file. Configuration files located on the classpath begin with + * JCARepositoryManager.CLASSPATH_CONFIG_PREFIX. */ private final String configFile; @@ -125,7 +142,21 @@ public RepositoryImpl create() throws RepositoryException { if (repository == null) { - RepositoryConfig config = RepositoryConfig.create(configFile, homeDir); + RepositoryConfig config = null; + + if (configFile.startsWith(CLASSPATH_CONFIG_PREFIX)) { + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if (cl == null) { + cl = this.getClass().getClassLoader(); + } + + InputStream configInputStream = cl.getResourceAsStream( + configFile.substring(CLASSPATH_CONFIG_PREFIX.length())); + config = RepositoryConfig.create(configInputStream, homeDir); + } else { + config = RepositoryConfig.create(configFile, homeDir); + } + repository = RepositoryImpl.create(config); }