Created
March 7, 2019 14:28
-
-
Save ani03sha/55685184ee56fbdff086f9b51a12ee4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.jcr.Node; | |
import javax.jcr.Repository; | |
import javax.jcr.RepositoryException; | |
import javax.jcr.Session; | |
import javax.jcr.SimpleCredentials; | |
import org.apache.jackrabbit.commons.JcrUtils; | |
public class GetCRXRepository { | |
public static void main(String[] args) { | |
try { | |
Repository repository = JcrUtils.getRepository("http://localhost:4502/crx/server"); | |
Session session = repository.login(new SimpleCredentials("admin", "admin".toCharArray())); | |
Node root = session.getRootNode(); | |
Node quark = root.addNode("quark"); | |
Node red = quark.addNode("red"); | |
red.setProperty("Title", "Red Quark"); | |
Node node = root.getNode("quark/red"); | |
System.out.println(node.getPath()); | |
System.out.println(node.getProperty("Title").getString()); | |
session.save(); | |
session.logout(); | |
} catch (RepositoryException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment