Package javax.jcr

Examples of javax.jcr.Repository.login()


            Repository repository = JcrUtils.getRepository(uri);

            Context context = new ContextBase();
            CommandHelper.setRepository(context, repository, uri);
            try {
                Session session = repository.login();
                CommandHelper.setSession(context, session);
                CommandHelper.setCurrentNode(context, session.getRootNode());
            } catch (RepositoryException ignore) {
                // anonymous login not possible
            }
View Full Code Here


        Object cf = mcf.createConnectionFactory();
        assertTrue(cf instanceof JCARepositoryHandle);
        Repository repository = (Repository) cf;

        // Open a new session
        Session session = repository.login(JCR_SUPERUSER);
        assertTrue(session != null);
        assertTrue(session instanceof JCASessionHandle);

        // Logout session
        session.logout();
View Full Code Here

        Object cf = mcf.createConnectionFactory();
        assertTrue(cf instanceof JCARepositoryHandle);
        Repository repository = (Repository) cf;

        // Open a session
        Session session = repository.login(JCR_SUPERUSER);
        assertTrue(session instanceof XAResource);
        session.logout();
    }
   
    /**
 
View Full Code Here

     */
    public void testExceptionHandling() throws Exception {
        Object cf = mcf.createConnectionFactory();
        Repository repository = (Repository) cf;
        try {
            repository.login(JCR_SUPERUSER, "xxx");
        } catch (Exception e) {
            assertTrue(e instanceof NoSuchWorkspaceException);
        }
    }

View Full Code Here

public class LoginLogoutTest extends AbstractTest {

    public void runTest() throws RepositoryException {
        Repository repository = getRepository();
        for (int i = 0; i < 1000; i++) {
            Session session = repository.login();
            try {
                session.getRootNode();
            } finally {
                session.logout();
            }
View Full Code Here

     * @throws Exception
     *             if an error occurs
     */
    public static void main(String[] args) throws Exception {
        Repository repository = new TransientRepository();
        Session session = repository.login();
        try {
            String user = session.getUserID();
            String name = repository.getDescriptor(Repository.REP_NAME_DESC);
            System.out.println("Logged in as " + user + " to a " + name
                    + " repository.");
View Full Code Here

     * @throws Exception
     *             if an error occurs
     */
    public static void main(String[] args) throws Exception {
        Repository repository = new TransientRepository();
        Session session = repository.login(new SimpleCredentials("username",
                "password".toCharArray()));
        try {
            Node root = session.getRootNode();

            // Store content
View Full Code Here

        Repository repository = (Repository) service;
        Assert.assertEquals(
                "Jackrabbit",
                repository.getDescriptor(Repository.REP_NAME_DESC));

        Session session = repository.login();
        try {
            assertEquals("/", session.getRootNode().getPath());
        } finally {
            session.logout();
        }
View Full Code Here

        Credentials credentials = new SimpleCredentials(user, password
            .toCharArray());

        if (workspace == null) {
            session = repo.login(credentials);
        } else {
            session = repo.login(credentials, workspace);
        }
        CommandHelper.setSession(ctx, session);
        CommandHelper.setCurrentNode(ctx, session.getRootNode());
View Full Code Here

            .toCharArray());

        if (workspace == null) {
            session = repo.login(credentials);
        } else {
            session = repo.login(credentials, workspace);
        }
        CommandHelper.setSession(ctx, session);
        CommandHelper.setCurrentNode(ctx, session.getRootNode());
        return false;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.