Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 239160 Details for
Bug 407279
WebSphereTransactionController does not handle JTA on WebSphere 8.5
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Adding TransactionManager support for WebSphere Liberty.
407279.websphere.patch (text/plain), 17.17 KB, created by
Rick Curtis
on 2014-01-20 18:00:12 EST
(
hide
)
Description:
Adding TransactionManager support for WebSphere Liberty.
Filename:
MIME Type:
Creator:
Rick Curtis
Created:
2014-01-20 18:00:12 EST
Size:
17.17 KB
patch
obsolete
>diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/config/TargetServer.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/config/TargetServer.java >index a1b7269..e04123c 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/config/TargetServer.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/config/TargetServer.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved. >+ * Copyright (c) 1998, 2014 Oracle, IBM Corporation and/or its affiliates. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 > * which accompanies this distribution. >@@ -9,6 +9,7 @@ > * > * Contributors: > * Oracle - initial API and implementation from Oracle TopLink >+ * Rick Curtis - Add WebSphere Liberty target server. > ******************************************************************************/ > package org.eclipse.persistence.config; > >@@ -32,6 +33,7 @@ public class TargetServer { > public static final String WebSphere = "WebSphere"; > public static final String WebSphere_6_1 = "WebSphere_6_1"; > public static final String WebSphere_7 = "WebSphere_7"; >+ public static final String WebSphere_Liberty = "WebSphere_Liberty"; > public static final String WebLogic = "WebLogic"; > public static final String WebLogic_9 = "WebLogic_9"; > public static final String WebLogic_10 = "WebLogic_10"; >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/PropertiesHandler.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/PropertiesHandler.java >index 90e0b50..a1b67b2 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/PropertiesHandler.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/PropertiesHandler.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved. >+ * Copyright (c) 1998, 2014 Oracle, IBM Corporation and/or its affiliates. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 > * which accompanies this distribution. >@@ -10,7 +10,8 @@ > * Contributors: > * Oracle - initial API and implementation from Oracle TopLink > * Gordon Yorke - VM managed entity detachment >- * Eduard Bartsch, SAP - Fix for Bug 351186 - ConcurrentModificationException Exception in PropertiesHandler >+ * Eduard Bartsch, SAP - Fix for Bug 351186 - ConcurrentModificationException Exception in PropertiesHandler >+ * Rick Curtis - Add support for WebSphere Liberty platform. > ******************************************************************************/ > package org.eclipse.persistence.internal.sessions; > >@@ -557,6 +558,7 @@ public class PropertiesHandler { > {TargetServer.WebSphere, pcg + "was.WebSpherePlatform"}, > {TargetServer.WebSphere_6_1, pcg + "was.WebSphere_6_1_Platform"}, > {TargetServer.WebSphere_7, pcg + "was.WebSphere_7_Platform"}, >+ {TargetServer.WebSphere_Liberty, pcg + "was.WebSphere_Liberty_Platform"}, > {TargetServer.WebLogic, pcg + "wls.WebLogicPlatform"}, > {TargetServer.WebLogic_9, pcg + "wls.WebLogic_9_Platform"}, > {TargetServer.WebLogic_10, pcg + "wls.WebLogic_10_Platform"}, >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigProject_11_1_1.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigProject_11_1_1.java >index 7970930..ac94ad6 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigProject_11_1_1.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigProject_11_1_1.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved. >+ * Copyright (c) 1998, 2014 Oracle, IBM Corporation and/or its affiliates. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 > * which accompanies this distribution. >@@ -9,6 +9,7 @@ > * > * Contributors: > * Oracle - initial API and implementation from Oracle TopLink >+ * Rick Curtis -- Add support for WebSphere Liberty > ******************************************************************************/ > package org.eclipse.persistence.internal.sessions.factories; > >@@ -39,6 +40,7 @@ import org.eclipse.persistence.internal.sessions.factories.model.platform.WebLog > import org.eclipse.persistence.internal.sessions.factories.model.platform.WebLogic_9_PlatformConfig; > import org.eclipse.persistence.internal.sessions.factories.model.platform.WebSphere_6_1_PlatformConfig; > import org.eclipse.persistence.internal.sessions.factories.model.platform.WebSphere_7_0_PlatformConfig; >+import org.eclipse.persistence.internal.sessions.factories.model.platform.WebSphere_Liberty_PlatformConfig; > import org.eclipse.persistence.internal.sessions.factories.model.transport.Oc4jJGroupsTransportManagerConfig; > import org.eclipse.persistence.internal.sessions.factories.model.transport.TransportManagerConfig; > >@@ -62,6 +64,7 @@ public class XMLSessionConfigProject_11_1_1 extends XMLSessionConfigProject { > addDescriptor(buildServerPlatformConfigDescriptorFor(WebLogic_10_PlatformConfig.class)); > addDescriptor(buildServerPlatformConfigDescriptorFor(WebSphere_6_1_PlatformConfig.class)); > addDescriptor(buildServerPlatformConfigDescriptorFor(WebSphere_7_0_PlatformConfig.class)); >+ addDescriptor(buildServerPlatformConfigDescriptorFor(WebSphere_Liberty_PlatformConfig.class)); > > // 242452 -- add metadata support for XMLLogin's DocumentPreservationPolicy > addDescriptor(buildDocumentPreservationPolicyConfigDescriptor()); >@@ -171,6 +174,7 @@ public class XMLSessionConfigProject_11_1_1 extends XMLSessionConfigProject { > descriptor.getInheritancePolicy().addClassIndicator(WebLogic_10_PlatformConfig.class, "weblogic-10-platform"); > descriptor.getInheritancePolicy().addClassIndicator(WebSphere_6_1_PlatformConfig.class, "websphere-61-platform"); > descriptor.getInheritancePolicy().addClassIndicator(WebSphere_7_0_PlatformConfig.class, "websphere-7-platform"); >+ descriptor.getInheritancePolicy().addClassIndicator(WebSphere_Liberty_PlatformConfig.class, "websphere-liberty-platform"); > return descriptor; > } > >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/model/platform/WebSphere_Liberty_PlatformConfig.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/model/platform/WebSphere_Liberty_PlatformConfig.java >new file mode 100644 >index 0000000..e99c562 >--- /dev/null >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/model/platform/WebSphere_Liberty_PlatformConfig.java >@@ -0,0 +1,19 @@ >+/******************************************************************************* >+ * Copyright (c) 2014 IBM Corporation. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 >+ * which accompanies this distribution. >+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html >+ * and the Eclipse Distribution License is available at >+ * http://www.eclipse.org/org/documents/edl-v10.php. >+ * >+ * Contributors: >+ * Rick Curtis - Add support for WebSphere Liberty. >+ ******************************************************************************/ >+package org.eclipse.persistence.internal.sessions.factories.model.platform; >+ >+public class WebSphere_Liberty_PlatformConfig extends ServerPlatformConfig { >+ public WebSphere_Liberty_PlatformConfig() { >+ super("org.eclipse.persistence.platform.server.was.WebSphere_Liberty_Platform"); >+ } >+} >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/platform/server/was/WebSphere_Liberty_Platform.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/platform/server/was/WebSphere_Liberty_Platform.java >new file mode 100644 >index 0000000..470deab >--- /dev/null >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/platform/server/was/WebSphere_Liberty_Platform.java >@@ -0,0 +1,70 @@ >+/******************************************************************************* >+ * Copyright (c) 2014 IBM Corporation. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 >+ * which accompanies this distribution. >+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html >+ * and the Eclipse Distribution License is available at >+ * http://www.eclipse.org/org/documents/edl-v10.php. >+ * >+ * Contributors: >+ * Rick Curtis - Add support for WebSphere Liberty. >+ ******************************************************************************/ >+package org.eclipse.persistence.platform.server.was; >+ >+import java.sql.Connection; >+ >+import org.eclipse.persistence.logging.SessionLog; >+import org.eclipse.persistence.sessions.DatabaseSession; >+import org.eclipse.persistence.transaction.was.WebSphereLibertyTransactionController; >+ >+/** >+ * PUBLIC: >+ * >+ * This is the concrete subclass responsible for representing WebSphere-specific server behavior. >+ * >+ * This platform has: >+ * <ul> >+ * <li>WebSphereLibertyTransactionController (JTA integration). >+ * </ul> >+ */ >+public class WebSphere_Liberty_Platform extends WebSphere_7_Platform { >+ /** >+ * INTERNAL: Default Constructor: All behavior for the default constructor is inherited >+ */ >+ public WebSphere_Liberty_Platform(DatabaseSession newDatabaseSession) { >+ super(newDatabaseSession); >+ } >+ >+ /** >+ * INTERNAL: getExternalTransactionControllerClass(): Answer the class of external transaction >+ * controller to use for WebSphere Liberty. This is read-only. >+ * >+ * @return Class externalTransactionControllerClass >+ * >+ * @see org.eclipse.persistence.transaction.JTATransactionController >+ * @see ServerPlatformBase.isJTAEnabled() >+ * @see ServerPlatformBase.disableJTA() >+ * @see ServerPlatformBase.initializeExternalTransactionController() >+ */ >+ public Class getExternalTransactionControllerClass() { >+ if (externalTransactionControllerClass == null) { >+ externalTransactionControllerClass = WebSphereLibertyTransactionController.class; >+ } >+ return externalTransactionControllerClass; >+ } >+ >+ /** >+ * This method overrides functionality exposed in the base WebSpherePlatform as Liberty doesn't >+ * provide the same support. >+ */ >+ @Override >+ public Connection unwrapConnection(Connection connection) { >+ try { >+ return connection.getMetaData().getConnection(); >+ } catch (java.sql.SQLException e) { >+ getAbstractSession().log(SessionLog.WARNING, SessionLog.CONNECTION, "cannot_unwrap_connection", e); >+ return connection; >+ } >+ } >+} >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereLibertyTransactionController.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereLibertyTransactionController.java >new file mode 100644 >index 0000000..9da9d4e >--- /dev/null >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereLibertyTransactionController.java >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2014 IBM Corporation. All rights reserved. >+ * This program and the accompanying materials are made available under the >+ * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 >+ * which accompanies this distribution. >+ * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html >+ * and the Eclipse Distribution License is available at >+ * http://www.eclipse.org/org/documents/edl-v10.php. >+ * >+ * Contributors: >+ * Rick Curtis - Initial implementation. >+ ******************************************************************************/ >+package org.eclipse.persistence.transaction.was; >+ >+public class WebSphereLibertyTransactionController extends WebSphereTransactionController { >+ // Class and method to execute to obtain the TransactionManager >+ protected final static String TX_MANAGER_FACTORY_CLASS = "com.ibm.tx.jta.TransactionManagerFactory"; >+ protected final static String TX_MANAGER_FACTORY_METHOD = "getTransactionManager"; >+ >+ protected String getTxManagerFactoryClass() { >+ return this.TX_MANAGER_FACTORY_CLASS; >+ } >+ >+ protected String getTxManagerFactoryMethod() { >+ return TX_MANAGER_FACTORY_METHOD; >+ } >+} >diff --git a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereTransactionController.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereTransactionController.java >index a283bea..e63c99c 100644 >--- a/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereTransactionController.java >+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereTransactionController.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 1998, 2013 Oracle and/or its affiliates. All rights reserved. >+ * Copyright (c) 1998, 2014 Oracle, IBM Corporation and/or its affiliates. All rights reserved. > * This program and the accompanying materials are made available under the > * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0 > * which accompanies this distribution. >@@ -9,6 +9,7 @@ > * > * Contributors: > * Oracle - initial API and implementation from Oracle TopLink >+ * Rick Curtis -- Refactor to facilitate adding WebSphereLibertyTransactionController. > ******************************************************************************/ > package org.eclipse.persistence.transaction.was; > >@@ -43,6 +44,13 @@ public class WebSphereTransactionController extends JTATransactionController { > super(); > } > >+ protected String getTxManagerFactoryClass() { >+ return TX_MANAGER_FACTORY_CLASS; >+ } >+ >+ protected String getTxManagerFactoryMethod() { >+ return TX_MANAGER_FACTORY_METHOD; >+ } > /** > * INTERNAL: > * Obtain and return the JTA TransactionManager on this platform. >@@ -51,8 +59,8 @@ public class WebSphereTransactionController extends JTATransactionController { > protected TransactionManager acquireTransactionManager() throws Exception { > if (PrivilegedAccessHelper.shouldUsePrivilegedAccess()){ > try{ >- Class clazz = (Class) AccessController.doPrivileged(new PrivilegedClassForName(TX_MANAGER_FACTORY_CLASS)); >- Method method = AccessController.doPrivileged(new PrivilegedGetMethod(clazz, TX_MANAGER_FACTORY_METHOD, null, false)); >+ Class clazz = (Class) AccessController.doPrivileged(new PrivilegedClassForName(getTxManagerFactoryClass())); >+ Method method = AccessController.doPrivileged(new PrivilegedGetMethod(clazz, getTxManagerFactoryMethod(), null, false)); > return (TransactionManager) AccessController.doPrivileged(new PrivilegedMethodInvoker(method, null, null)); > }catch (PrivilegedActionException ex){ > if (ex.getCause() instanceof ClassNotFoundException){ >@@ -70,8 +78,8 @@ public class WebSphereTransactionController extends JTATransactionController { > throw (RuntimeException) ex.getCause(); > } > }else{ >- Class clazz = PrivilegedAccessHelper.getClassForName(TX_MANAGER_FACTORY_CLASS); >- Method method = PrivilegedAccessHelper.getMethod(clazz, TX_MANAGER_FACTORY_METHOD, null, false); >+ Class clazz = PrivilegedAccessHelper.getClassForName(getTxManagerFactoryClass()); >+ Method method = PrivilegedAccessHelper.getMethod(clazz, getTxManagerFactoryMethod(), null, false); > return (TransactionManager)PrivilegedAccessHelper.invokeMethod(method, null, null); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 407279
:
239160
|
239478