Author: bdaw
Date: 2010-02-23 04:11:54 -0500 (Tue, 23 Feb 2010)
New Revision: 1813
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Config.java
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
Log:
- JTA config switch
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Config.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Config.java 2010-02-22
23:32:56 UTC (rev 1812)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/Config.java 2010-02-23
09:11:54 UTC (rev 1813)
@@ -50,7 +50,9 @@
private boolean ignoreMappedMembershipType = true;
+ private boolean useJTA = false;
+
public Config()
{
}
@@ -271,4 +273,14 @@
{
this.ignoreMappedMembershipType = ignoreMappedMembershipType;
}
+
+ public boolean isUseJTA()
+ {
+ return useJTA;
+ }
+
+ public void setUseJTA(boolean useJTA)
+ {
+ this.useJTA = useJTA;
+ }
}
Modified:
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java
===================================================================
---
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2010-02-22
23:32:56 UTC (rev 1812)
+++
portal/trunk/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java 2010-02-23
09:11:54 UTC (rev 1813)
@@ -30,6 +30,8 @@
import org.exoplatform.services.organization.BaseOrganizationService;
import org.picocontainer.Startable;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
import java.util.LinkedList;
import java.util.concurrent.atomic.AtomicInteger;
@@ -136,7 +138,15 @@
{
try
{
- idmService_.getIdentitySession().beginTransaction();
+ if (configuration.isUseJTA())
+ {
+ UserTransaction tx = (UserTransaction)new
InitialContext().lookup("java:comp/UserTransaction");
+ tx.begin();
+ }
+ else
+ {
+ idmService_.getIdentitySession().beginTransaction();
+ }
}
catch (Exception e)
{
@@ -148,7 +158,15 @@
{
try
{
- idmService_.getIdentitySession().getTransaction().commit();
+ if (configuration.isUseJTA())
+ {
+ UserTransaction tx = (UserTransaction)new
InitialContext().lookup("java:comp/UserTransaction");
+ tx.commit();
+ }
+ else
+ {
+ idmService_.getIdentitySession().getTransaction().commit();
+ }
}
catch (Exception e)
{
Modified:
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml
===================================================================
---
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2010-02-22
23:32:56 UTC (rev 1812)
+++
portal/trunk/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml 2010-02-23
09:11:54 UTC (rev 1813)
@@ -173,6 +173,10 @@
<field name="ignoreMappedMembershipType">
<boolean>false</boolean>
</field>
+ <!-- If 'true' will use JTA UserTransaction. If 'false' will
use IDM transaction API -->
+ <field name="useJTA">
+ <boolean>false</boolean>
+ </field>
</object>
</object-param>
</init-params>