-
Feature Request
-
Resolution: Done
-
Major
-
2.6.0.Beta2
JCR 1.0 suggested finding Repository instances in JNDI directly, using something like this:
InitialContext initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); Repository repository = (Repository) envCtx.lookup("jcr/local");
ModeShape's JndiRepositoryFactory can be used within web servers to deploy a ModeShape engine instance and register a particular Repository instance in JNDI.
However, JCR 2.0 changed this and instead uses the ServiceLoader mechanism and introduced a RepositoryFactory interface that allowed a different way to find a Repository instance:
Map<String, String> parameters = ... for (RepositoryFactory factory : ServiceLoader.load(RepositoryFactory.class)) { repository = factory.getRepository(parameters); if (repository != null) break; }
where the parameters are implementation-dependent. ModeShape expects a single "org.modeshape.jcr.URL" parameter whose value is a URL of several forms. However, the only JNDI form expects the *ModeShape engine* to be found in JNDI, and thus this is not compatible with the JndiRepositoryFactory approach described above.
Therefore, the JndiRepositoryFactory implementation should be changed to allow registering the *ModeShape engine* in JNDI (for example, when no repository name is supplied). See also MODE-1242 for a change to RepositoryFactory to look for a JNDI URL that points directly to a Repository instance.
- is related to
-
MODE-1242 RepositoryFactory should accept JNDI URL to Repository instance (not just RepositoryEngine) instance
- Closed