You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Aleksandar Pecanov <pe...@mt.net.mk> on 2005/09/12 05:07:10 UTC

Shutting down repository

How can I shutdown a repository obtained as BindableRepository?

Re: Shutting down repository

Posted by Edgar Poce <ed...@gmail.com>.
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

Re: Shutting down repository

Posted by Aleksandar Pecanov <pe...@mt.net.mk>.
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.


Re: Shutting down repository

Posted by Edgar Poce <ed...@gmail.com>.
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?
>