jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From astra123 <sandhya.jayachand...@tcs.com>
Subject Re: problem in viewing the repository nodes in JCR browser using JNDI
Date Tue, 05 May 2009 08:54:51 GMT

Hi,

I have tried that first hop...i have a doubt like how to register the
created repository with JNDI.
the sample code which i tried is

           String configFile = "repository.xml";
            String repHomeDir = "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");
           // System.out.println("............."+ctx.list("repo"));


            //obtaining workspace and nodes
            SimpleCredentials cred = new SimpleCredentials("userid",
                                                            
"".toCharArray());

            Session session = r.login(cred, null);
            Workspace ws = session.getWorkspace();
            Node rn = session.getRootNode();

            //print the root node name

            System.out.println("Name of the
RootNode"+rn.getPrimaryNodeType().getName());

Using the above code i am able to create a repository.But how should i
register that with JNDI.
What are all the files i need to touch and what change needs to be done.
Please can you help me on this.

Thanks in advance


Bertrand Delacretaz wrote:
> 
> On Tue, May 5, 2009 at 8:19 AM, astra123 <sandhya.jayachandran@tcs.com>
> wrote:
>> ...can i use this link
>> http://jackrabbit.apache.org/jcr-client-application-howto.html
>> for accessing the repository via JNDI....
> 
> That should work.
> 
>> if so in my case the client is jcr-explorer.war (which i deployed in
>> tomcat
>> and imported to netbeans).
>> how i will place the code snippets in the client pgm..
> 
> You could use http://jackrabbit.apache.org/first-hops.html as an
> example, and replace the TransientRepository with the one that you get
> via JNDI.
> 
> -Bertrand
> 
> 

-- 
View this message in context: http://www.nabble.com/problem-in-viewing-the-repository-nodes-in-JCR-browser-using-JNDI-tp23380352p23383528.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message