aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Curtis2014-01-28 13:09:13 (EST)
committertware2014-02-04 14:01:08 (EST)
commite9659c7d7286b75e1406c807eaceac24e079575f (patch)
tree582db7f7e6f06e7eebc9445e993f00d0c5b656e7
parent1b165c9d5b2cfe2df95064879ed3a4611142e5bd (diff)
downloadeclipselink.runtime-e9659c7d7286b75e1406c807eaceac24e079575f.zip
eclipselink.runtime-e9659c7d7286b75e1406c807eaceac24e079575f.tar.gz
eclipselink.runtime-e9659c7d7286b75e1406c807eaceac24e079575f.tar.bz2
Fix for bug 407279. Add support transaction manager support for WebSphere Liberty server.
Signed-off-by: Rick Curtis <curtisr7@gmail.com>
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/config/TargetServer.java4
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/PropertiesHandler.java4
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/XMLSessionConfigProject_11_1_1.java8
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/model/platform/WebSphere_Liberty_Platform_Config.java19
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/platform/server/was/WebSphere_Liberty_Platform.java70
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereLibertyTransactionController.java27
-rw-r--r--foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/transaction/was/WebSphereTransactionController.java19
7 files changed, 142 insertions, 9 deletions
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 87e08c6..9d87b9b 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.
@@ -11,6 +11,7 @@
* 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
+ * Rick Curtis - Add support for WebSphere Liberty platform.
******************************************************************************/
package org.eclipse.persistence.internal.sessions;
@@ -545,6 +546,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..0d9e58e 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_Platform_Config;
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_Platform_Config.class));
// 242452 -- add metadata support for XMLLogin's DocumentPreservationPolicy
addDescriptor(buildDocumentPreservationPolicyConfigDescriptor());
@@ -170,7 +173,8 @@ public class XMLSessionConfigProject_11_1_1 extends XMLSessionConfigProject {
descriptor.getInheritancePolicy().addClassIndicator(WebLogic_9_PlatformConfig.class, "weblogic-9-platform");
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_7_0_PlatformConfig.class, "websphere-7-platform");
+ descriptor.getInheritancePolicy().addClassIndicator(WebSphere_Liberty_Platform_Config.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_Platform_Config.java b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/model/platform/WebSphere_Liberty_Platform_Config.java
new file mode 100644
index 0000000..e4afe34
--- /dev/null
+++ b/foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/factories/model/platform/WebSphere_Liberty_Platform_Config.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_Platform_Config extends ServerPlatformConfig {
+ public WebSphere_Liberty_Platform_Config() {
+ 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..993d67c
--- /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;
+ }
+ }
+} \ No newline at end of file
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..d422962
--- /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;
+ }
+} \ No newline at end of file
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..72fdc02 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,14 @@ 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 +60,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 +79,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);
}
}