Package org.apache.lenya.cms.repository

Examples of org.apache.lenya.cms.repository.Session


import org.apache.lenya.cms.site.SiteStructure;

public class IndexUpdaterTest extends AbstractAccessControlTest {

    public void testIndexUpdater() throws Exception {
        Session session = login("lenya");

        Publication pub = getPublication(session, "test");
        SiteStructure site = pub.getArea("authoring").getSite();
       
        SiteNode sourceNode = site.getNode("/tutorial");
View Full Code Here


            // pubs/{pubId}/content/{area}/sitetree.xml
            String[] steps = uri.split("/");
            String pubId = steps[steps.length - 4];
            String areaName = steps[steps.length - 2];
            try {
                Session session = RepositoryUtil.createSession(this.manager, null, false);
                DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
                Area area = factory.getPublication(pubId).getArea(areaName);
                SiteTreeImpl tree = new SiteTreeImpl(this.manager, area, getLogger());
                int treeRev = tree.getRevision();
                int rcmlRev = tree.getRevision(tree.getRepositoryNode());
View Full Code Here

        super.act(redirector, resolver, objectModel, src, parameters);

        try {
            Request request = ObjectModelHelper.getRequest(objectModel);
            Identity identity = (Identity) request.getSession().getAttribute(Identity.class.getName());
            Session session = RepositoryUtil.createSession(this.manager, identity, true);
           
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            String url = ServletHelper.getWebappURI(request);
            if (factory.isDocument(url)) {
                Node node = factory.getFromURL(url).getRepositoryNode();
View Full Code Here

        Request request = ContextHelper.getRequest(this.context);
        String webappUri = ServletHelper.getWebappURI(request);
        URLInformation info = new URLInformation(webappUri);
        String pubId = null;
        try {
            Session session = RepositoryUtil.getSession(this.manager, request);
            DocumentFactory factory = DocumentUtil.createDocumentFactory(this.manager, session);
            String pubIdCandidate = info.getPublicationId();
            if (pubIdCandidate != null && factory.existsPublication(pubIdCandidate)) {
                pubId = pubIdCandidate;
            }
View Full Code Here

        // UUID
        start = end + 1;
        uuid = location.substring(start);

        Session session;
        try {
            session = RepositoryUtil.getSession(this.manager, request);
        } catch (RepositoryException e1) {
            throw new RuntimeException(e1);
        }
View Full Code Here

            }

            resolver = (UsecaseResolver) this.manager.lookup(UsecaseResolver.ROLE);
            usecase = resolver.resolve(webappUrl, usecaseName);

            Session testSession = getTestSession();
            if (testSession != null) {
                usecase.setTestSession(testSession);
            }

            usecase.getParameterNames(); // initialize usecase parameters to enable overriding
View Full Code Here

        return (Part) getParameter(name);
    }

    protected DocumentFactory getDocumentFactory() {
        DocumentFactory factory = (DocumentFactory) getParameter(PARAMETER_FACTORY);
        Session session = getSession();
        if (factory == null || factory.getSession() != session) {
            factory = DocumentUtil.createDocumentFactory(this.manager, session);
            setParameter(PARAMETER_FACTORY, factory);
        }
        return factory;
View Full Code Here

    /**
     * @see org.apache.avalon.framework.activity.Initializable#initialize()
     */
    public final void initialize() throws Exception {
        Request request = ContextHelper.getRequest(this.context);
        Session session = RepositoryUtil.getSession(this.manager, request);
        setSession(session);
        setParameter(PARAMETER_STATE_MACHINE, new StateMachine(MODEL));
    }
View Full Code Here

    public void testConcurrentModification() throws Exception {
       
        String pubId = "test";
        String area = "authoring";
       
        Session lenyaSession = login("lenya");
        DocumentFactory lenyaFactory = DocumentUtil.createDocumentFactory(getManager(), lenyaSession);
        Publication lenyaPub = lenyaFactory.getPublication(pubId);
       
        SiteStructure lenyaSite = lenyaPub.getArea(area).getSite();
        lenyaSite.getRepositoryNode().lock();
       
        Session aliceSession = login("alice");
        DocumentFactory aliceFactory = DocumentUtil.createDocumentFactory(getManager(), aliceSession);
        Publication alicePub = aliceFactory.getPublication(pubId);
       
        SiteStructure aliceSite = alicePub.getArea(area).getSite();
        aliceSite.getRepositoryNode().lock();
       
        SiteNode lenyaNode = lenyaSite.getNodes()[1];
        lenyaNode.setVisible(!lenyaNode.isVisible());
        lenyaSession.commit();
       
        SiteNode aliceNode = aliceSite.getNodes()[2];
        aliceNode.setVisible(!aliceNode.isVisible());
        try {
            aliceSession.commit();
            assertTrue("No exception raised", false);
        }
        catch (Exception ignore) {
        }
       
View Full Code Here

    /**
     * @see org.apache.lenya.cms.site.SiteStructure#getRepositoryNode()
     */
    public org.apache.lenya.cms.repository.Node getRepositoryNode() {
        if (this.repositoryNode == null) {
            Session session = this.getPublication().getFactory().getSession();
            NodeFactory factory = null;
            try {
                factory = (NodeFactory) manager.lookup(NodeFactory.ROLE);
                this.repositoryNode = (org.apache.lenya.cms.repository.Node)
                    session.getRepositoryItem(factory, this.sourceUri);
            } catch (Exception e) {
                throw new RuntimeException("Creating repository node failed: ", e);
            } finally {
                if (factory != null) {
                    manager.release(factory);
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.repository.Session

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.