Package javax.jcr

Examples of javax.jcr.Repository.login()


public class VersioningTest {
   
    public static void main(String[] args) throws Exception {
        //RepositoryConfig config = RepositoryConfig.create(new FileInputStream(new File("C:/tmp/repository.xml")), "C:/tmp/repository");
        Repository repository = new TransientRepository();//RepositoryImpl.create(config);
        Session session = repository.login( new SimpleCredentials("username", "password".toCharArray()) );
        try {
           
            String nodeName = "" + System.currentTimeMillis();
           
            Node rootNode = session.getRootNode();
View Full Code Here


   {
      super.setUp();

      Repository repository = repositoryService.getRepository("db2");
      Credentials credentials = new CredentialsImpl("admin", "admin".toCharArray());
      sessionWS = (SessionImpl)repository.login(credentials, "ws");
      sessionWS1 = (SessionImpl)repository.login(credentials, "ws1");
     
      repository = repositoryService.getRepository("db2");
      credentials = new CredentialsImpl("mary", "exo".toCharArray());
      sessionMaryWS = (SessionImpl)repository.login(credentials, "ws");
View Full Code Here

      super.setUp();

      Repository repository = repositoryService.getRepository("db2");
      Credentials credentials = new CredentialsImpl("admin", "admin".toCharArray());
      sessionWS = (SessionImpl)repository.login(credentials, "ws");
      sessionWS1 = (SessionImpl)repository.login(credentials, "ws1");
     
      repository = repositoryService.getRepository("db2");
      credentials = new CredentialsImpl("mary", "exo".toCharArray());
      sessionMaryWS = (SessionImpl)repository.login(credentials, "ws");
      sessionMaryWS1 = (SessionImpl)repository.login(credentials, "ws1");
View Full Code Here

      sessionWS = (SessionImpl)repository.login(credentials, "ws");
      sessionWS1 = (SessionImpl)repository.login(credentials, "ws1");
     
      repository = repositoryService.getRepository("db2");
      credentials = new CredentialsImpl("mary", "exo".toCharArray());
      sessionMaryWS = (SessionImpl)repository.login(credentials, "ws");
      sessionMaryWS1 = (SessionImpl)repository.login(credentials, "ws1");
     
      // add node with only read permission for mary
      NodeImpl node = (NodeImpl)sessionWS1.getRootNode().addNode("MARY-ReadOnly");
      node.addMixin("exo:privilegeable");
View Full Code Here

      sessionWS1 = (SessionImpl)repository.login(credentials, "ws1");
     
      repository = repositoryService.getRepository("db2");
      credentials = new CredentialsImpl("mary", "exo".toCharArray());
      sessionMaryWS = (SessionImpl)repository.login(credentials, "ws");
      sessionMaryWS1 = (SessionImpl)repository.login(credentials, "ws1");
     
      // add node with only read permission for mary
      NodeImpl node = (NodeImpl)sessionWS1.getRootNode().addNode("MARY-ReadOnly");
      node.addMixin("exo:privilegeable");
      node.addMixin("exo:owneable");
View Full Code Here

    }

    public Session login(RepositoryAddress mountpoint) throws RepositoryException {
        Repository rep = repProvider.getRepository(mountpoint);
        Credentials creds = credsProvider.getCredentials(mountpoint);
        Session s = rep.login(creds);
        // hack to store credentials
        credsProvider.storeCredentials(mountpoint, creds);
        return s;
    }
View Full Code Here

        }
        try {
            Credentials srcCreds = src.getCredentials();
            String wsp = src.getWorkspace();
            if (wsp == null) {
                return srcRepo.login(srcCreds);
            } else {
                return srcRepo.login(srcCreds, wsp);
            }
        } catch (RepositoryException e) {
            log.error("Error while logging in src repository {}: {}", src, e.toString());
View Full Code Here

            Credentials srcCreds = src.getCredentials();
            String wsp = src.getWorkspace();
            if (wsp == null) {
                return srcRepo.login(srcCreds);
            } else {
                return srcRepo.login(srcCreds, wsp);
            }
        } catch (RepositoryException e) {
            log.error("Error while logging in src repository {}: {}", src, e.toString());
            throw e;
        }
View Full Code Here

            try {
                Credentials dstCreds = dst.getCredentials();
                if (dstCreds == null && credentialsProvider != null) {
                    dstCreds = credentialsProvider.getCredentials(src);
                }
                dstSession = dstRepo.login(dstCreds, dst.getWorkspace());
            } catch (RepositoryException e) {
                log.error("Error while logging in dst repository {}: {}", dst, e.toString());
                return;
            }
            copy(srcSession, src.getPath(), dstSession, dst.getPath(), recursive);
View Full Code Here

        if (Boolean.getBoolean("jackrabbit.test.integration")
                && isLitmusAvailable(litmus)) {
            final Repository repository = JcrUtils.getRepository(
                    "jcr-jackrabbit://" + Text.escapePath(dir.getCanonicalPath()));
            Session session = repository.login(); // for the TransientRepository
            try {
                SocketConnector connector = new SocketConnector();
                connector.setHost("localhost");
                connector.setPort(Integer.getInteger("litmus.port", 0));
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.