IdentityStoreInvocationContext resolveInvocationContext(String id, IdentityStoreInvocationContext invocationCtx) { RepositoryIdentityStoreSessionImpl repoSession = (RepositoryIdentityStoreSessionImpl)invocationCtx.getIdentityStoreSession(); IdentityStoreSession targetSession = repoSession.getIdentityStoreSession(id); return new SimpleIdentityStoreInvocationContext(targetSession, invocationCtx.getRealmId()); }
protected Session getHibernateSession(IdentityStoreInvocationContext ctx) throws IdentityException { try { return ((Session)ctx.getIdentityStoreSession().getSessionContext()); } catch (Exception e) { throw new IdentityException("Cannot obtain Hibernate Session", e); } }
public HibernateRealm getRealm(Session hibernateSession, IdentityStoreInvocationContext ctx) throws IdentityException if (ctx.getRealmId() == null) createCriteria(HibernateRealm.class).add(Restrictions.eq("name", ctx.getRealmId())).uniqueResult(); HibernateRealm newRealm = new HibernateRealm(ctx.getRealmId()); hibernateSession.persist(newRealm); return newRealm;
public Transaction getTransaction() { return new SimpleTransactionImpl(sessionContext.resolveStoreInvocationContext().getIdentityStoreSession()); }
IdentityStoreInvocationContext resolveInvocationContext(String id, IdentityStoreInvocationContext invocationCtx) { RepositoryIdentityStoreSessionImpl repoSession = (RepositoryIdentityStoreSessionImpl)invocationCtx.getIdentityStoreSession(); IdentityStoreSession targetSession = repoSession.getIdentityStoreSession(id); return new SimpleIdentityStoreInvocationContext(targetSession, invocationCtx.getRealmId()); }
public void clear() throws IdentityException { sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().clear(); }
public void save() throws IdentityException { sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().save(); }
public void close() throws IdentityException { sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().close(); }
public boolean isOpen() { return sessionContext.resolveStoreInvocationContext().getIdentityStoreSession().isOpen(); }
public Transaction beginTransaction() { Transaction transaction = new SimpleTransactionImpl(sessionContext.resolveStoreInvocationContext().getIdentityStoreSession()); transaction.start(); return transaction; }