jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajesh Muguda <mlraj...@gmail.com>
Subject Re: How to get a Repository objector jcrSession from a Java Class
Date Wed, 18 May 2011 21:06:22 GMT
Well you could use the JCR API's by having those libraries in your path.

 Repository repository =
JcrUtils.getRepository("jndi://com.day.util.jndi.provider.MemoryInitialContextFactory/crx");
    SimpleCredentials creds =
   new SimpleCredentials("admin", "admin".toCharArray());
   Session slingsession = repository.login(creds, "crx.default");

you can refer the jackrabbit api for more details.

Thanks
Rajesh

On Wed, May 18, 2011 at 12:51 PM, Alexander Klimetschek
<aklimets@adobe.com>wrote:

> On 18.05.11 20:55, "davidjgonzalez" <davidjgonzalez@gmail.com> wrote:
> >http://pastie.org/1923026
>
> > new RepoTest().isNull()
>
>
> SCR handled components are created by the framework, you can't use a
> normal constructor. To get it, either reference from another component
> (such as a servlet for example) using @Reference / @scr.reference, or use
> sling.getService() in JSPs for example. But that depends on the context -
> if it's a true background service (you are using immediate=true,
> indicating that), it might just run for itself.
>
> Regards,
> Alex
>
> --
> Alexander Klimetschek
> Developer // Adobe (Day) // Berlin - Basel
>
>
>
>
>

Mime
View raw message