You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jf...@apache.org on 2018/10/17 01:10:07 UTC

tomee git commit: Merge branch 'issues/TOMEE-2249_eclipselink-npe' into tomee-7.0.x

Repository: tomee
Updated Branches:
  refs/heads/master 027a0975f -> aae3eb867


Merge branch 'issues/TOMEE-2249_eclipselink-npe' into tomee-7.0.x


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/aae3eb86
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/aae3eb86
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/aae3eb86

Branch: refs/heads/master
Commit: aae3eb867b559259e68b294cb176cf97c587cb59
Parents: 027a097
Author: Jonathan S. Fisher <ex...@gmail.com>
Authored: Tue Oct 16 20:00:12 2018 -0500
Committer: Jonathan S. Fisher <ex...@gmail.com>
Committed: Tue Oct 16 20:09:18 2018 -0500

----------------------------------------------------------------------
 .../MBeanOpenEJBRuntimeServices.java            | 26 ++++++++++++
 .../MBeanOpenEJBRuntimeServicesMBean.java       | 22 ++++++++++
 .../eclipselink/OpenEJBRuntimeServices.java     | 42 ++++++++++++++++++++
 .../eclipselink/OpenEJBServerPlatform.java      | 13 +++++-
 4 files changed, 101 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/aae3eb86/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/MBeanOpenEJBRuntimeServices.java
----------------------------------------------------------------------
diff --git a/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/MBeanOpenEJBRuntimeServices.java b/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/MBeanOpenEJBRuntimeServices.java
new file mode 100644
index 0000000..5e3d967
--- /dev/null
+++ b/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/MBeanOpenEJBRuntimeServices.java
@@ -0,0 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jpa.integration.eclipselink;
+
+import org.eclipse.persistence.internal.sessions.AbstractSession;
+import org.eclipse.persistence.sessions.Session;
+
+public class MBeanOpenEJBRuntimeServices extends OpenEJBRuntimeServices implements MBeanOpenEJBRuntimeServicesMBean {
+    public MBeanOpenEJBRuntimeServices(Session session) {
+        super((AbstractSession) session);
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/aae3eb86/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/MBeanOpenEJBRuntimeServicesMBean.java
----------------------------------------------------------------------
diff --git a/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/MBeanOpenEJBRuntimeServicesMBean.java b/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/MBeanOpenEJBRuntimeServicesMBean.java
new file mode 100644
index 0000000..4e229fa
--- /dev/null
+++ b/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/MBeanOpenEJBRuntimeServicesMBean.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jpa.integration.eclipselink;
+
+import org.eclipse.persistence.services.mbean.MBeanRuntimeServicesMBean;
+
+public interface MBeanOpenEJBRuntimeServicesMBean extends MBeanRuntimeServicesMBean {
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/aae3eb86/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBRuntimeServices.java
----------------------------------------------------------------------
diff --git a/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBRuntimeServices.java b/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBRuntimeServices.java
new file mode 100644
index 0000000..82b82a2
--- /dev/null
+++ b/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBRuntimeServices.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.openejb.jpa.integration.eclipselink;
+
+import java.util.Locale;
+
+import org.eclipse.persistence.internal.sessions.AbstractSession;
+import org.eclipse.persistence.services.RuntimeServices;
+
+public class OpenEJBRuntimeServices extends RuntimeServices {
+
+    static {
+        PLATFORM_NAME = "OpenEJB";
+    }
+
+    public OpenEJBRuntimeServices() {
+        super();
+    }
+
+    public OpenEJBRuntimeServices(AbstractSession session) {
+        super();
+        this.session = session;
+        this.updateDeploymentTimeData();
+    }
+
+    public OpenEJBRuntimeServices(Locale locale) {
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/aae3eb86/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBServerPlatform.java
----------------------------------------------------------------------
diff --git a/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBServerPlatform.java b/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBServerPlatform.java
index ea074c6..bca85fc 100644
--- a/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBServerPlatform.java
+++ b/container/openejb-jpa-integration/src/main/java/org/apache/openejb/jpa/integration/eclipselink/OpenEJBServerPlatform.java
@@ -17,6 +17,7 @@
 package org.apache.openejb.jpa.integration.eclipselink;
 
 import org.apache.geronimo.transaction.manager.TransactionImpl;
+import org.eclipse.persistence.platform.server.JMXEnabledPlatform;
 import org.eclipse.persistence.platform.server.JMXServerPlatformBase;
 import org.eclipse.persistence.sessions.DatabaseSession;
 import org.eclipse.persistence.transaction.AbstractSynchronizationListener;
@@ -26,13 +27,14 @@ import javax.management.MBeanServer;
 import javax.transaction.Synchronization;
 import javax.transaction.TransactionManager;
 
-public class OpenEJBServerPlatform extends JMXServerPlatformBase {
+public class OpenEJBServerPlatform extends JMXServerPlatformBase implements JMXEnabledPlatform {
     public OpenEJBServerPlatform(final DatabaseSession newDatabaseSession) {
         super(newDatabaseSession);
         try {
             mBeanServer = MBeanServer.class.cast(
                 OpenEJBServerPlatform.class.getClassLoader().loadClass("org.apache.openejb.monitoring.LocalMBeanServer")
                     .getMethod("get").invoke(null));
+            this.prepareServerSpecificServicesMBean();
         } catch (final Exception e) {
             // no-op
         }
@@ -44,9 +46,16 @@ public class OpenEJBServerPlatform extends JMXServerPlatformBase {
     }
 
     @Override
-    public Class getExternalTransactionControllerClass() {
+    public Class<?> getExternalTransactionControllerClass() {
         return OpenEJBJTATransactionController.class;
     }
+    
+    @Override
+    public void prepareServerSpecificServicesMBean() {
+        if (isRuntimeServicesEnabledDefault() && getDatabaseSession() != null && shouldRegisterRuntimeBean) {
+            this.setRuntimeServicesMBean(new MBeanOpenEJBRuntimeServices(getDatabaseSession()));
+        }
+    }
 
     public static class OpenEJBJTATransactionController extends JTATransactionController {
         @Override