Author: jeff.yuchang
Date: 2009-06-02 01:39:20 -0400 (Tue, 02 Jun 2009)
New Revision: 4969
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java
Log:
* JBMP-2172, the StandardTransaction is not required.
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java 2009-06-01
23:26:44 UTC (rev 4968)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java 2009-06-02
05:39:20 UTC (rev 4969)
@@ -34,10 +34,8 @@
import org.jboss.identity.idm.common.p3p.P3PConstants;
import org.jboss.identity.idm.impl.api.SimpleAttribute;
import org.jbpm.api.JbpmException;
-import org.jbpm.api.env.Environment;
import org.jbpm.api.identity.Group;
import org.jbpm.api.identity.User;
-import org.jbpm.pvm.internal.tx.StandardTransaction;
/**
* @author Tom Baeyens
@@ -49,10 +47,6 @@
public JBossIdmIdentitySessionImpl(IdentitySession identitySession) {
this.identitySession = identitySession;
-
- StandardTransaction transaction =
Environment.getFromCurrent(StandardTransaction.class);
- IdentitySessionResource identitySessionResource = new
IdentitySessionResource(identitySession);
- transaction.enlistResource(identitySessionResource);
}
public String createUser(String userName, String givenName, String familyName, String
businessEmail) {
Modified:
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java
===================================================================
---
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java 2009-06-01
23:26:44 UTC (rev 4968)
+++
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/descriptor/JbossIdmIdentitySessionDescriptor.java 2009-06-02
05:39:20 UTC (rev 4969)
@@ -21,11 +21,15 @@
*/
package org.jbpm.pvm.internal.wire.descriptor;
+import org.jboss.identity.idm.api.IdentitySession;
import org.jboss.identity.idm.api.IdentitySessionFactory;
import org.jboss.identity.idm.common.exception.IdentityException;
import org.jbpm.api.JbpmException;
import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.identity.impl.IdentitySessionResource;
import org.jbpm.pvm.internal.identity.impl.JBossIdmIdentitySessionImpl;
+import org.jbpm.pvm.internal.tx.JtaTransaction;
+import org.jbpm.pvm.internal.tx.StandardTransaction;
import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.WireDefinition;
@@ -40,9 +44,19 @@
protected String realmName;
public Object construct(WireContext wireContext) {
+
IdentitySessionFactory identitySessionFactory =
Environment.getFromCurrent(IdentitySessionFactory.class);
try {
- return new
JBossIdmIdentitySessionImpl(identitySessionFactory.createIdentitySession(realmName));
+ IdentitySession identitySession =
identitySessionFactory.createIdentitySession(realmName);
+
+ Environment environment = Environment.getCurrent();
+ StandardTransaction transaction = environment.get(StandardTransaction.class);
+ if (transaction != null) {
+ IdentitySessionResource identitySessionResource = new
IdentitySessionResource(identitySession);
+ transaction.enlistResource(identitySessionResource);
+ }
+
+ return new JBossIdmIdentitySessionImpl(identitySession);
} catch (IdentityException e) {
throw new JbpmException("couldn't create the identity session for realm
[" + realmName + "]");
}
Show replies by date