Package javax.jcr

Examples of javax.jcr.Repository


            Logger logger = Logger.getRootLogger();
            logger.addAppender(new ConsoleAppender(new PatternLayout("%p %m%n")));
            logger.setLevel(Level.WARN);

            String uri = command.getOptionValue("cli");
            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
            }

            new JcrClient(context).runInteractive();

            try {
                CommandHelper.getSession(context).logout();
            } catch (CommandException ignore) {
                // already logged out
            }
        } else {
            message("Welcome to Apache Jackrabbit!");
            message("-------------------------------");

            File repository =
                new File(command.getOptionValue("repo", "jackrabbit"));
            message("Using repository directory " + repository);
            repository.mkdirs();
            File tmp = new File(repository, "tmp");
            tmp.mkdir();
            File log = new File(repository, "log");
            log.mkdir();
View Full Code Here


            RepositoryFactory factory = iterator.next();
            log.append(newline);
            log.append("    ");
            log.append(factory.getClass().getName());
            try {
                Repository repository = factory.getRepository(parameters);
                if (repository != null) {
                    // We found the requested repository! Return it
                    // and just ignore the error message being built.
                    return repository;
                } else {
View Full Code Here

        return null;
    }

    @Override
    public SlingRepository newSlingRepository() {
        Repository repository = MockJcr.newRepository();
        return new MockSlingRepository(repository);
    }
View Full Code Here

            this.skm.init(repository);
            if (!contentSyncRoot.exists()) {
              throw new IllegalArgumentException("contentSyncRoot does not exist: "+contentSyncRoot);
            }

            Repository jcrRepo = RepositoryUtils.getRepository(repo.getRepositoryInfo());
            Credentials credentials = RepositoryUtils.getCredentials(repo.getRepositoryInfo());
           
            session = jcrRepo.login(credentials);

            RepositoryAddress address = RepositoryUtils.getRepositoryAddress(repo.getRepositoryInfo());

            fs = fsLocator.getFileSystem(address, contentSyncRoot, session);
       
View Full Code Here

    private VltSerializationDataBuilder builder;

    public static void main(String[] args) throws RepositoryException, URISyntaxException, IOException {
        RepositoryAddress address = new RepositoryAddress("http://localhost:8080/server/root");
        Repository repo = new RepositoryProvider().getRepository(address);
        Session session = repo.login(new SimpleCredentials("admin", "admin".toCharArray()));

        VaultFileSystem fs = Mounter.mount(null, null, address, "/", session);

        String[] attempts = new String[] { "/rep:policy", "/var" };
View Full Code Here

            Session session = null;
            String url = repositoryInfo.getUrl() + webDavUrlLocation;
            try {
                RepositoryAddress address = new RepositoryAddress(url);
                Repository repository;
                synchronized (SYNC) {
                    repository = REGISTERED_REPOSITORIES.get(address);

                    if (repository == null) {
                        Set<String> supportedSchemes = FACTORY.getSupportedSchemes();
                        if (!supportedSchemes.contains(address.getURI().getScheme())) {
                            throw new IllegalArgumentException("Unable to create a a repository for "
                                    + address.getURI()
                                    + ", since the scheme is unsupported. Only schemes '" + supportedSchemes
                                    + "' are supported");
                        }

                        // SLING-3739: ensure that a well-known ClassLoader is used
                        ClassLoader old = Thread.currentThread().getContextClassLoader();
                        Thread.currentThread().setContextClassLoader(Repository.class.getClassLoader());
                        try {
                            repository = FACTORY.createRepository(address);
                        } finally {
                            Thread.currentThread().setContextClassLoader(old);
                        }
                        REGISTERED_REPOSITORIES.put(address, repository);
                    }
                }

                session = repository.login(new SimpleCredentials(repositoryInfo.getUsername(), repositoryInfo
                        .getPassword().toCharArray()));
                return address;
            } catch (URISyntaxException e) {
                throw new RuntimeException(e);
            } catch (RepositoryException e) {
View Full Code Here

    @Before
    public void setUp() throws Exception {
        executor = Executors.newSingleThreadExecutor();
        final Oak oak = new Oak(new SegmentNodeStore());
        this.whiteboard = oak.getWhiteboard();
        final Repository repository = new Jcr(oak).createRepository();
        this.slingRepository = new RepositoryWrapper(repository);

        session = this.slingRepository.loginAdministrative(null);

        ResourceResolver resolver = mock(ResourceResolver.class);
View Full Code Here

    public void stop() {
        throw new UnsupportedOperationException("RepositoryManager.stop()");
    }

    public DataStoreGarbageCollector createDataStoreGarbageCollector() throws RepositoryException {
        final Repository base = this.getRepository();
        if (base instanceof RepositoryManager) {
            return ((RepositoryManager) base).createDataStoreGarbageCollector();
        }

        return null;
View Full Code Here

     * {@link #bindRepository(ServiceReference)} to actually control the
     * registration process by retrieving the repository and calling the
     * {@link #bindRepository(String, Repository)} method.
     */
    private void bindRepositoryInternal(String name, ServiceReference reference) {
        Repository repository = (Repository) this.getComponentContext().getBundleContext().getService(
            reference);
        Object data = this.bindRepository(name, repository);
        if (data != null) {
            this.registeredRepositories.put(name, data);
        }
View Full Code Here

            workspace = this.getDefaultWorkspace();
        }

        try {
            log.debug("login: Logging in to workspace '" + workspace + "'");
            final Repository repository = this.getRepository();
            if (this.getRepository() == null) {
                throw new RepositoryException("Sling Repository not ready");
            }

            Session session = repository.login(credentials, workspace);
            return this.getNamespaceAwareSession(session);

        } catch (RuntimeException re) {
            // SLING-702: Jackrabbit throws IllegalStateException if the
            // repository has already been shut down ...
View Full Code Here

TOP

Related Classes of javax.jcr.Repository

Copyright © 2018 www.massapicom. 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.