jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Markus" <cal...@gmx.net>
Subject RE: Jackrabit and webdav
Date Sat, 21 Jun 2008 12:59:46 GMT
Sorry, I forgot the probably most obvious possibility:

3. Accessing the repository with RMI (needs jackrabbit-jcr-rmi in client
classpath):

With running tomcat try the following code in your application (running on
the same machine as the tomcat server):

package test;

import org.apache.jackrabbit.rmi.repository.RMIRemoteRepository;

import javax.jcr.*;

public class RMITest {
    public static void main(String[] args) throws RepositoryException {
        Repository repository = new
RMIRemoteRepository("//localhost/jackrabbit.repository");
        Session session = repository.login(new SimpleCredentials("admin",
"admin".toCharArray()));

        NodeIterator nodeIterator = session.getRootNode().getNodes();
        while(nodeIterator.hasNext()) {
            System.out.println(nodeIterator.nextNode().getName());
        }
        
        session.logout();
    }
}

Regards,
Markus

-----Original Message-----
From: Markus [mailto:caleb7@gmx.net] 
Sent: Saturday, June 21, 2008 2:44 PM
To: users@jackrabbit.apache.org
Subject: RE: Jackrabit and webdav

Hi Paulo,

I think there are two approaches for a simple access to the repository
running in your default Jackrabbit-Tomcat installation:

1. Access the repository over the TransientRepository class from your client
application:
- String configLocation = <Path to config - usually
[tomcat]\bin\jackrabbit\repository.xml>;
- String repositoryLocation = <Path to config - usually
[tomcat]\bin\jackrabbit>;
- Repository repository = new TransientRepository(configLocation,
repositoryLocation);
- Session session = repository.login("admin", "admin");

Please note, that with this approach you can access the repository only with
either your client OR the web application. Which means, tomcat must not be
running while you access it with your application.

2. Access the repository over JNDI within another webapplication:
- This needs a little extra Tomcat configuration and is briefly described in
http://localhost:8080/jackrabbit-webapp-1.4/local.jsp

Regards,
Markus


-----Original Message-----
From: Paulo Sergio [mailto:pauloslf@gmail.com] 
Sent: Saturday, June 21, 2008 2:13 PM
To: users@jackrabbit.apache.org
Subject: Re: Jackrabit and webdav

Hi guys,
thanks for all the answers,
i gues i have a problem i have to fix before these one, as i said i pretty
new to jcr and i seem to have missed a point.
when i run the client it creates a new repository and does not use the one
running on tomcat (i assumes it was using localhost as default)

so first problem is making the client program "talk " with the repository in
tomcat..  any directions in order to achive this?


thanks for helping..

paulo f.
On Sat, Jun 21, 2008 at 10:09 AM, Bertrand Delacretaz <
bdelacretaz@apache.org> wrote:

> Hi Paulo,
>
> On Sat, Jun 21, 2008 at 9:49 AM, Paulo Sergio <pauloslf@gmail.com> wrote:
> > ...is there any place where i can get examples of that code?...
>
> There's an example in Sling's Loader class [1], look at the createFile()
> method.
>
> (there are also examples in Jackrabbit but I'm less familiar with that
> code).
>
> -Bertrand
>
> [1]
>
http://svn.eu.apache.org/repos/asf/incubator/sling/trunk/jcr/contentloader/s
rc/main/java/org/apache/sling/jcr/contentloader/internal/Loader.java
>


Mime
View raw message