Package org.picketlink.identity.federation.web.servlets

Examples of org.picketlink.identity.federation.web.servlets.IDPServlet$SessionHolder


            TransactionSynchronizationManager.bindResource(getSessionFactory(), new SessionHolder(session));
        }
    }
   
    public void sessionStop() {
        SessionHolder sessionHolder = (SessionHolder) TransactionSynchronizationManager.unbindResource(getSessionFactory());
  SessionFactoryUtils.closeSession(sessionHolder.getSession());
    }
View Full Code Here


                participate = true;
            }
            else {
                logger.debug("Opening single Hibernate Session in OpenSessionInViewFilter");
                session = getSession(sessionFactory);
                TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session));
            }
        }
        else {
            // deferred close mode
            if (SessionFactoryUtils.isDeferredCloseActive(sessionFactory)) {
View Full Code Here

      participate = true;
    }
    else {
      logger.debug("Opening Hibernate Session in OpenSessionInViewFilter");
      Session session = openSession(sessionFactory);
      TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session));
    }

    try {
      filterChain.doFilter(request, response);
    }

    finally {
      if (!participate) {
        SessionHolder sessionHolder =
            (SessionHolder) TransactionSynchronizationManager.unbindResource(sessionFactory);
        logger.debug("Closing Hibernate Session in OpenSessionInViewFilter");
        SessionFactoryUtils.closeSession(sessionHolder.getSession());
      }
    }
  }
View Full Code Here

      request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
    }
    else {
      logger.debug("Opening Hibernate Session in OpenSessionInViewInterceptor");
      Session session = openSession();
      TransactionSynchronizationManager.bindResource(getSessionFactory(), new SessionHolder(session));
    }
  }
View Full Code Here

      else {
        request.removeAttribute(participateAttributeName, WebRequest.SCOPE_REQUEST);
      }
    }
    else {
      SessionHolder sessionHolder =
          (SessionHolder) TransactionSynchronizationManager.unbindResource(getSessionFactory());
      logger.debug("Closing Hibernate Session in OpenSessionInViewInterceptor");
      SessionFactoryUtils.closeSession(sessionHolder.getSession());
    }
  }
View Full Code Here

  private SessionFactory sessionFactory;

  @Test(expectedExceptions = IllegalTransactionStateException.class)
  public void testTransactionless() {
    Session session = sessionFactory.openSession();
    TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session));
    try {
      assert bookDao.all().isEmpty();
    } finally {
      TransactionSynchronizationManager.unbindResource(sessionFactory);
      SessionFactoryUtils.closeSession(session);
View Full Code Here

    session.getScope().put(PERSISTENCE_CONTEXT_ATTRIBUTE, hibernateSession);
  }

  private void bind(Session session) {
    Object sessionHolder = (hibernate3Present ?
        new org.springframework.orm.hibernate3.SessionHolder(session) : new SessionHolder(session));
    TransactionSynchronizationManager.bindResource(sessionFactory, sessionHolder);
  }
View Full Code Here

                .getResource(this.sessionFactory);

        if (value instanceof Session) {
            return (Session) value;
        } else if (value instanceof SessionHolder) {
            SessionHolder sessionHolder = (SessionHolder) value;
            Session session = sessionHolder.getSession();

            if (TransactionSynchronizationManager.isSynchronizationActive()
                    && !sessionHolder.isSynchronizedWithTransaction()) {
                TransactionSynchronizationManager
                        .registerSynchronization(new SpringSessionSynchronization(
                                sessionHolder, this.sessionFactory));
                sessionHolder.setSynchronizedWithTransaction(true);

                // Switch to FlushMode.AUTO, as we have to assume a thread-bound Session
                // with FlushMode.MANUAL, which needs to allow flushing within the transaction.
                FlushMode flushMode = session.getFlushMode();

                if (FlushMode.isManualFlushMode(flushMode)
                        && !TransactionSynchronizationManager
                                .isCurrentTransactionReadOnly()) {
                    session.setFlushMode(FlushMode.AUTO);
                    sessionHolder.setPreviousFlushMode(flushMode);
                }
            }

            return session;
        } else {
View Full Code Here

    SessionFactory sf = getSessionFactory();
    if (!TransactionSynchronizationManager.hasResource(sf)) {
      // New Session to be bound for the current method's scope...
      Session session = openSession();
      try {
        TransactionSynchronizationManager.bindResource(sf, new SessionHolder(session));
        return invocation.proceed();
      }
      finally {
        SessionFactoryUtils.closeSession(session);
        TransactionSynchronizationManager.unbindResource(sf);
View Full Code Here

      request.setAttribute(getParticipateAttributeName(), newCount, WebRequest.SCOPE_REQUEST);
    }
    else {
      logger.debug("Opening Hibernate Session in OpenSessionInViewInterceptor");
      Session session = openSession();
      SessionHolder sessionHolder = new SessionHolder(session);
      TransactionSynchronizationManager.bindResource(getSessionFactory(), sessionHolder);

      AsyncRequestInterceptor asyncRequestInterceptor =
          new AsyncRequestInterceptor(getSessionFactory(), sessionHolder);
      asyncManager.registerCallableInterceptor(participateAttributeName, asyncRequestInterceptor);
View Full Code Here

TOP

Related Classes of org.picketlink.identity.federation.web.servlets.IDPServlet$SessionHolder

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.