Aleksandar Pecanov wrote:
Edgar Poce wrote:

Hi aleksandar

You can get the underlying repository instance through the session.

((RepositoryImpl) session.getRepository()).shutdown() ;

br,
edgar

Aleksandar Pecanov wrote:

How can I shutdown a repository obtained as BindableRepository?


But I get an instance of BindableRepository, not RepositoryImpl. How can I obtain RepositoryImpl? There is a private field inside the BindableRepository with that type but is not accessible.



give it a try to the following code, it should work.


        String configFile = "/temp/repository/repository.xml";
        String repHomeDir = "/temp/repository/";

        Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.jackrabbit.core.jndi.provider.DummyInitialContextFactory");
        env.put(Context.PROVIDER_URL, "localhost");
        InitialContext ctx = new InitialContext(env);

RegistryHelper.registerRepository(ctx, "repo", configFile, repHomeDir, true);
        Repository r = (Repository) ctx.lookup("repo");

        Session s = r.login(new SimpleCredentials("u", "p"
                .toCharArray()));
        ((RepositoryImpl) s.getRepository()).shutdown() ;

br,
edgar

Reply via email to