Package org.springmodules.jcr.jackrabbit.support

Examples of org.springmodules.jcr.jackrabbit.support.UserTxSessionHolder


    protected Object doGetTransaction() throws TransactionException {
        JcrTransactionObject txObject = new JcrTransactionObject();

        if (TransactionSynchronizationManager.hasResource(getSessionFactory())) {
            UserTxSessionHolder sessionHolder = (UserTxSessionHolder) TransactionSynchronizationManager.getResource(getSessionFactory());
            if (logger.isDebugEnabled()) {
                logger.debug("Found thread-bound session [" + sessionHolder.getSession() + "] for JCR transaction");
            }
            txObject.setSessionHolder(sessionHolder, false);
        }

        return txObject;
View Full Code Here


                    throw new IllegalArgumentException("transactions are not supported by your Jcr Repository");

                if (logger.isDebugEnabled()) {
                    logger.debug("Opened new session [" + newSession + "] for JCR transaction");
                }
                txObject.setSessionHolder(new UserTxSessionHolder(newSession), true);
            }

            UserTxSessionHolder sessionHolder = txObject.getSessionHolder();

            sessionHolder.setSynchronizedWithTransaction(true);
            session = (XASession)sessionHolder.getSession();

            /*
             * We have no notion of flushing inside a JCR session
             *
            if (transactionDefinition.isReadOnly() && txObject.isNewSessionHolder()) {
                sessionHolder.setReadOnly(true);
            }

            if (!transactionDefinition.isReadOnly() && !txObject.isNewSessionHolder()) {
                if (sessionHolder.isReadOnly()) {
                    sessionHolder.setReadOnly(false);
                }
            }
            */

            // start the transaction
            sessionHolder.getTransaction().begin();

            // Register transaction timeout.
            if (transactionDefinition.getTimeout() != TransactionDefinition.TIMEOUT_DEFAULT) {
                txObject.getSessionHolder().setTimeoutInSeconds(transactionDefinition.getTimeout());
            }
View Full Code Here

    xaResControl.replay();
    final SessionHolderProviderManager providerManager = new ListSessionHolderProviderManager();

    PlatformTransactionManager tm = new LocalTransactionManager(sf);
    TransactionTemplate tt = new TransactionTemplate(tm);
    UserTxSessionHolder uTx = new UserTxSessionHolder(session);
    TransactionSynchronizationManager.bindResource(sf, uTx);

    assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));

    tt.execute(new TransactionCallbackWithoutResult() {
View Full Code Here

    sessionControl.replay();
    xaResControl.replay();

    PlatformTransactionManager tm = new LocalTransactionManager(sf);
    TransactionTemplate tt = new TransactionTemplate(tm);
    UserTxSessionHolder uTx = new UserTxSessionHolder(session);
    TransactionSynchronizationManager.bindResource(sf, uTx);

    assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
    uTx.setRollbackOnly();

    try {
      tt.execute(new TransactionCallbackWithoutResult() {
        protected void doInTransactionWithoutResult(TransactionStatus status) {
          assertTrue("Has thread session", TransactionSynchronizationManager.hasResource(sf));
View Full Code Here

TOP

Related Classes of org.springmodules.jcr.jackrabbit.support.UserTxSessionHolder

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.