Examples of SlingRepository


Examples of org.apache.sling.jcr.api.SlingRepository

            // redirect to the default workspace if directly addressing the
            // servlet
            // and if the default workspace name is not null (in which case we'd
            // need
            // to login to find out the actual workspace name, SLING-256)
            SlingRepository slingRepo = (SlingRepository) getRepository();
            if (slingRepo.getDefaultWorkspace() == null) {
                response.sendError(
                    HttpServletResponse.SC_NOT_FOUND,
                    "JCR workspace name required, please add it to the end of the URL"
                        + " (for the Jackrabbit embedded repository the default name is 'default') ");
            } else {
                String uri = request.getRequestURI();
                if (pinfo == null) {
                    uri += "/";
                }
                uri += slingRepo.getDefaultWorkspace();
                response.sendRedirect(uri);
            }
        }

        super.service(request, response);
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

        return config;
    }

    @org.junit.BeforeClass public static void setupRepository() throws Exception {
        RepositoryUtil.startRepository();
        final SlingRepository repository = RepositoryUtil.getRepository();
        session = repository.loginAdministrative(repository.getDefaultWorkspace());
        assertTrue(RepositoryUtil.registerNodeType(session, DistributingEventHandler.class.getResourceAsStream("/SLING-INF/nodetypes/event.cnd")));
    }
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

     * @return
     * @throws RepositoryException
     */
    protected Session createSession()
    throws RepositoryException {
        final SlingRepository repo = this.repository;
        if ( repo == null ) {
            throw new RepositoryException("Repository is currently not available.");
        }
        return repo.loginAdministrative(null);
    }
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

    @Override
    public Object addingService(ServiceReference reference) {
        Object service = context.getService(reference);
        if (service instanceof ContentRepository) {
            SlingRepository repository =
                    new SlingRepositoryImpl((ContentRepository) service);
            jcrRepositories.put(reference, context.registerService(
                    Repository.class.getName(),
                    repository, new Properties()));
            slingRepositories.put(reference, context.registerService(
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

            // redirect to the default workspace if directly addressing the
            // servlet
            // and if the default workspace name is not null (in which case we'd
            // need
            // to login to find out the actual workspace name, SLING-256)
            SlingRepository slingRepo = (SlingRepository) getRepository();
            if (slingRepo.getDefaultWorkspace() == null) {
                response.sendError(
                    HttpServletResponse.SC_NOT_FOUND,
                    "JCR workspace name required, please add it to the end of the URL"
                        + " (for the Jackrabbit embedded repository the default name is 'default') ");
            } else {
                String uri = request.getRequestURI();
                if (pinfo == null) {
                    uri += "/";
                }
                uri += slingRepo.getDefaultWorkspace();
                response.sendRedirect(uri);
            }

        } else {
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

        return config;
    }

    @org.junit.BeforeClass public static void setupRepository() throws Exception {
        RepositoryUtil.startRepository();
        final SlingRepository repository = RepositoryUtil.getRepository();
        session = repository.loginAdministrative(repository.getDefaultWorkspace());
        assertTrue(RepositoryUtil.registerNodeType(session, DistributingEventHandler.class.getResourceAsStream("/SLING-INF/nodetypes/event.cnd")));
        assertTrue(RepositoryUtil.registerNodeType(session, DistributingEventHandler.class.getResourceAsStream("/SLING-INF/nodetypes/folder.cnd")));
    }
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

    @Override
    public DavLocatorFactory getLocatorFactory() {
        if (locatorFactory == null) {

            // configured default workspace name
            SlingRepository slingRepo = (SlingRepository) getRepository();
            String workspace = slingRepo.getDefaultWorkspace();

            // no configuration, try to login and acquire the default name
            if (workspace == null || workspace.length() == 0) {
                Session tmp = null;
                try {
                    tmp = slingRepo.login();
                    workspace = tmp.getWorkspace().getName();
                } catch (Throwable t) {
                    // TODO: log !!
                    workspace = "default"; // fall back name
                } finally {
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

     * @return
     * @throws RepositoryException
     */
    protected Session createSession()
    throws RepositoryException {
        final SlingRepository repo = this.repository;
        if ( repo == null ) {
            throw new RepositoryException("Repository is currently not available.");
        }
        return repo.loginAdministrative(null);
    }
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

    @Override
    public Object addingService(ServiceReference reference) {
        Object service = context.getService(reference);
        if (service instanceof ContentRepository) {
            SlingRepository repository = new SlingRepositoryImpl(
                    (ContentRepository) service, executor);
            jcrRepositories.put(reference, context.registerService(
                    Repository.class.getName(),
                    repository, new Properties()));
            slingRepositories.put(reference, context.registerService(
View Full Code Here

Examples of org.apache.sling.jcr.api.SlingRepository

    @Override
    public Object addingService(ServiceReference reference) {
        Object service = context.getService(reference);
        if (service instanceof ContentRepository) {
            SlingRepository repository = new SlingRepositoryImpl(
                    (ContentRepository) service, executor, securityProvider);
            jcrRepositories.put(reference, context.registerService(
                    Repository.class.getName(),
                    repository, new Properties()));
            slingRepositories.put(reference, context.registerService(
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.