]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - java/SecondHop.java
1 import javax
.jcr
.Repository
;
2 import javax
.jcr
.Session
;
3 import javax
.jcr
.SimpleCredentials
;
5 import org
.apache
.jackrabbit
.core
.TransientRepository
;
8 * Second hop example. Stores, retrieves, and removes example content.
10 public class SecondHop
{
13 * The main entry point of the example application.
15 * @param args command line arguments (ignored)
16 * @throws Exception if an error occurs
18 public static void main(String
[] args
) throws Exception
{
19 Repository repository
= new TransientRepository();
20 Session session
= repository
.login(
21 new SimpleCredentials("username", "password".toCharArray()));
23 Node root
= session
.getRootNode();
26 Node hello
= root
.addNode("hello");
27 Node world
= hello
.addNode("world");
28 world
.setProperty("message", "Hello, World!");
32 Node node
= root
.getNode("hello/world");
33 System
.out
.println(node
.getPath());
34 System
.out
.println(node
.getProperty("message").getString());
37 root
.getNode("hello").remove();