You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/11/21 12:20:30 UTC

tomee git commit: TOMEE-1451 BusCreated event

Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 80ec6f129 -> 833a503d1


TOMEE-1451 BusCreated event


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

Branch: refs/heads/tomee-1.7.x
Commit: 833a503d126cb9cf6ec5521fa350af7030f0bca7
Parents: 80ec6f1
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Fri Nov 21 12:20:05 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Fri Nov 21 12:20:05 2014 +0100

----------------------------------------------------------------------
 .../server/cxf/transport/event/BusCreated.java  | 33 ++++++++++++++++++++
 .../server/cxf/transport/util/CxfUtil.java      | 15 +++++----
 2 files changed, 42 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/833a503d/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/event/BusCreated.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/event/BusCreated.java b/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/event/BusCreated.java
new file mode 100644
index 0000000..95811f1
--- /dev/null
+++ b/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/event/BusCreated.java
@@ -0,0 +1,33 @@
+/*
+ *     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.server.cxf.transport.event;
+
+import org.apache.cxf.Bus;
+import org.apache.openejb.observer.Event;
+
+@Event
+public class BusCreated {
+    private final Bus bus;
+
+    public BusCreated(final Bus bus) {
+        this.bus = bus;
+    }
+
+    public Bus getBus() {
+        return bus;
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/833a503d/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java b/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
index 24e9b00..6d8001c 100644
--- a/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
+++ b/server/openejb-cxf-transport/src/main/java/org/apache/openejb/server/cxf/transport/util/CxfUtil.java
@@ -40,6 +40,7 @@ import org.apache.openejb.assembler.classic.util.ServiceConfiguration;
 import org.apache.openejb.assembler.classic.util.ServiceInfos;
 import org.apache.openejb.loader.SystemInstance;
 import org.apache.openejb.monitoring.LocalMBeanServer;
+import org.apache.openejb.server.cxf.transport.event.BusCreated;
 import org.apache.openejb.util.PropertiesHelper;
 
 import javax.management.MBeanServer;
@@ -231,19 +232,20 @@ public final class CxfUtil {
     }
 
     public static void configureBus() {
-        if (SystemInstance.get().getProperties().containsKey(BUS_CONFIGURED_FLAG)) { // jaxws and jaxrs for instance
+        final SystemInstance systemInstance = SystemInstance.get();
+        if (systemInstance.getProperties().containsKey(BUS_CONFIGURED_FLAG)) { // jaxws and jaxrs for instance
             return;
         }
 
         final Bus bus = getBus();
 
         // ensure cxf classes are loaded from container to avoid conflicts with app
-        if ("true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.cxf.CxfContainerClassLoader", "true"))) {
+        if ("true".equalsIgnoreCase(systemInstance.getProperty("openejb.cxf.CxfContainerClassLoader", "true"))) {
             bus.setExtension(new CxfContainerClassLoader(), ClassLoader.class);
         }
 
         // activate jmx, by default isEnabled() == false in InstrumentationManagerImpl
-        if ("true".equalsIgnoreCase(SystemInstance.get().getProperty("openejb.cxf.jmx", "true"))) {
+        if ("true".equalsIgnoreCase(systemInstance.getProperty("openejb.cxf.jmx", "true"))) {
             final InstrumentationManager mgr = bus.getExtension(InstrumentationManager.class);
             if (InstrumentationManagerImpl.class.isInstance(mgr)) {
                 bus.setExtension(LocalMBeanServer.get(), MBeanServer.class); // just to keep everything consistent
@@ -264,8 +266,8 @@ public final class CxfUtil {
             }
         }
 
-        final ServiceConfiguration configuration = new ServiceConfiguration(SystemInstance.get().getProperties(),
-            SystemInstance.get().getComponent(OpenEjbConfiguration.class).facilities.services);
+        final ServiceConfiguration configuration = new ServiceConfiguration(systemInstance.getProperties(),
+            systemInstance.getComponent(OpenEjbConfiguration.class).facilities.services);
 
         final CXFBusImpl busImpl = (CXFBusImpl) bus;
         final Collection<ServiceInfo> serviceInfos = configuration.getAvailableServices();
@@ -290,7 +292,8 @@ public final class CxfUtil {
 
         configureInterceptors(busImpl, BUS_PREFIX, serviceInfos, configuration.getProperties());
 
-        SystemInstance.get().getProperties().setProperty(BUS_CONFIGURED_FLAG, "true");
+        systemInstance.getProperties().setProperty(BUS_CONFIGURED_FLAG, "true");
+        systemInstance.fireEvent(new BusCreated(bus));
     }
 
     private static class ClientAwareBusHandler implements InvocationHandler {