Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-1243

JndiRepositoryFactory should be able to register the ModeShape engine in JNDI

XMLWordPrintable

      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.

              rhauch Randall Hauch (Inactive)
              rhauch Randall Hauch (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: