Examples of SessionImpl


Examples of org.apache.jackrabbit.core.SessionImpl

     * @param isDeep
     */
    protected void writeLockProperties(NodeImpl node, String lockOwner, boolean isDeep) throws RepositoryException {
        boolean success = false;

        SessionImpl editingSession = (SessionImpl) node.getSession();
        WorkspaceImpl wsp = (WorkspaceImpl) editingSession.getWorkspace();
        UpdatableItemStateManager stateMgr = wsp.getItemStateManager();

        synchronized (stateMgr) {
            if (stateMgr.inEditMode()) {
                throw new RepositoryException("Unable to write lock properties.");
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

     * @throws RepositoryException
     */
    protected void removeLockProperties(NodeImpl node) throws RepositoryException {
        boolean success = false;

        SessionImpl editingSession = (SessionImpl) node.getSession();
        WorkspaceImpl wsp = (WorkspaceImpl) editingSession.getWorkspace();
        UpdatableItemStateManager stateMgr = wsp.getItemStateManager();

        synchronized (stateMgr) {
            try {
                // add properties to content
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

        }
        super.cleanUp();
    }

    private Set<Principal> getAnonymousPrincipals() throws RepositoryException {
        SessionImpl s = ((SessionImpl) getHelper().getRepository().login(new SimpleCredentials(SecurityConstants.ANONYMOUS_ID, "".toCharArray())));
        try {
            return new HashSet<Principal>(s.getSubject().getPrincipals());
        } finally {
            s.logout();
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

     * @return internal version history
     * @throws RepositoryException if the internal version history is not available
     */
    protected InternalVersionHistory getInternalVersionHistory()
            throws RepositoryException {
        SessionImpl session = sessionContext.getSessionImpl();
        InternalVersionHistory history =
                session.getInternalVersionManager().getVersionHistory((NodeId) id);
        if (history == null) {
            throw new InvalidItemStateException(id + ": the item does not exist anymore");
        }
        return history;
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

    /**
     * @see javax.jcr.version.VersionHistory#getRootVersion()
     */
    public javax.jcr.version.Version getRootVersion() throws RepositoryException {
        SessionImpl session = sessionContext.getSessionImpl();
        return (Version) session.getNodeById(
                getInternalVersionHistory().getRootVersion().getId());
    }
View Full Code Here

Examples of org.apache.jackrabbit.core.SessionImpl

     * @see VersionHistory#getAllLinearVersions()
     */
    @SuppressWarnings("deprecation")
    public VersionIterator getAllLinearVersions() throws RepositoryException {
        // get base version. this can certainly be optimized
        SessionImpl session = sessionContext.getSessionImpl();
        InternalVersionHistory vh = getInternalVersionHistory();
        Node vn = session.getNodeById(vh.getVersionableId());
        InternalVersion base = ((VersionImpl) vn.getBaseVersion()).getInternalVersion();

        return new VersionIteratorImpl(getSession(), vh.getRootVersion(), base);
    }
View Full Code Here

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

            throws AccessControlException {
        return login(userId, TEST_PUB_ID);
    }

    protected Session login(String userId, String pubId) throws AccessControlException {
        Session session = new SessionImpl(null, true, getManager(), getLogger());
        getRequest().setAttribute(Session.class.getName(), session);
       
        DefaultAccessController ac = getAccessController(session, pubId);
        AccreditableManager acMgr = ac.getAccreditableManager();
        User user = acMgr.getUserManager().getUser(userId);

        if (user == null) {
            throw new AccessControlException("The user [" + userId + "] does not exist!");
        }

        ac.setupIdentity(getRequest());

        org.apache.cocoon.environment.Session cocoonSession = getRequest().getSession();
        Identity identity = (Identity) cocoonSession.getAttribute(Identity.class.getName());

        if (!identity.contains(user)) {
            User oldUser = identity.getUser();
            if (oldUser != null) {
                if (getLogger().isDebugEnabled()) {
                    getLogger().debug("Removing user [" + oldUser + "] from identity.");
                }
                identity.removeIdentifiable(oldUser);
            }
            identity.addIdentifiable(user);
        }

        ac.authorize(getRequest());

        Accreditable[] accrs = identity.getAccreditables();
        for (int i = 0; i < accrs.length; i++) {
            getLogger().info("Accreditable: " + accrs[i]);
        }

        session.setIdentity(identity);
        return session;
    }
View Full Code Here

Examples of org.apache.qpid.proton.engine.impl.SessionImpl

        return null;
    }

    public AmqpSession createSession() {
        assertExecuting();
        SessionImpl session = connection.session();
        session.open();
        pumpOut();
        return new AmqpSession(this, session);
    }
View Full Code Here

Examples of org.apache.stanbol.ontologymanager.multiplexer.clerezza.impl.SessionImpl

         * before creating a new one.
         */
        if (sessionsByID.containsKey(sessionID)) throw new DuplicateSessionIDException(sessionID.toString());
        checkSessionLimit();
        IRI ns = IRI.create(getDefaultNamespace() + getID() + "/");
        Session session = new SessionImpl(sessionID, ns, ontologyProvider);

        // Have the ontology provider listen to ontology events
        if (ontologyProvider instanceof OntologyCollectorListener) session
                .addOntologyCollectorListener((OntologyCollectorListener) ontologyProvider);
        if (ontologyProvider instanceof SessionListener) session
                .addSessionListener((SessionListener) ontologyProvider);

        Multiplexer multiplexer = ontologyProvider.getOntologyNetworkDescriptor();
        session.addOntologyCollectorListener(multiplexer);
        session.addSessionListener(multiplexer);

        ConnectivityPolicy policy;
        try {
            policy = ConnectivityPolicy.valueOf(connectivityPolicyString);
        } catch (IllegalArgumentException e) {
            log.warn("The value {}", connectivityPolicyString);
            log.warn(" -- configured as default ConnectivityPolicy does not match any value of the Enumeration!");
            log.warn(" -- Setting the default policy as defined by the {}.", ConnectivityPolicy.class);
            policy = ConnectivityPolicy.valueOf(_CONNECTIVITY_POLICY_DEFAULT);
        }
        session.setConnectivityPolicy(policy);

        addSession(session);
        fireSessionCreated(session);
        return session;
    }
View Full Code Here

Examples of org.apache.zookeeper.server.SessionTrackerImpl.SessionImpl

        ZooKeeperServer zks = setupSessionTracker();

        latch = new CountDownLatch(1);
        zks.sessionTracker.addSession(sessionId, sessionTimeout);
        SessionTrackerImpl sessionTrackerImpl = (SessionTrackerImpl) zks.sessionTracker;
        SessionImpl sessionImpl = sessionTrackerImpl.sessionsById
                .get(sessionId);
        Assert.assertNotNull("Sessionid:" + sessionId
                + " doesn't exists in sessiontracker", sessionImpl);

        // verify the session existence
        Object sessionOwner = new Object();
        sessionTrackerImpl.checkSession(sessionId, sessionOwner);

        // waiting for the session expiry
        latch.await(sessionTimeout * 2, TimeUnit.MILLISECONDS);

        // Simulating FinalRequestProcessor logic: create session request has
        // delayed and now reaches FinalRequestProcessor. Here the leader zk
        // will do sessionTracker.addSession(id, timeout)
        sessionTrackerImpl.addSession(sessionId, sessionTimeout);
        try {
            sessionTrackerImpl.checkSession(sessionId, sessionOwner);
            Assert.fail("Should throw session expiry exception "
                    + "as the session has expired and closed");
        } catch (KeeperException.SessionExpiredException e) {
            // expected behaviour
        }
        Assert.assertTrue("Session didn't expired", sessionImpl.isClosing());
        Assert.assertFalse("Session didn't expired", sessionTrackerImpl
                .touchSession(sessionId, sessionTimeout));
        Assert.assertEquals(
                "Duplicate session expiry request has been generated", 1,
                firstProcessor.getCountOfCloseSessionReq());
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.