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/17 12:09:49 UTC

tomee git commit: missing fiels + adding appcontext in ExtensionProviderRegistration

Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 3c20f2fea -> 50c7e4677


missing fiels + adding appcontext in ExtensionProviderRegistration


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

Branch: refs/heads/tomee-1.7.x
Commit: 50c7e4677199827d19cf9775a978c30f3b21ee4e
Parents: 3c20f2f
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Mon Nov 17 12:09:33 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Mon Nov 17 12:09:33 2014 +0100

----------------------------------------------------------------------
 .../server/cxf/rs/CxfRsHttpListener.java        |  3 +-
 .../rs/event/ExtensionProviderRegistration.java | 48 +++++++++++++++++
 .../server/cxf/rs/event/ServerCreated.java      | 55 ++++++++++++++++++++
 .../server/cxf/rs/event/ServerDestroyed.java    | 38 ++++++++++++++
 4 files changed, 143 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/50c7e467/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
index ad1d427..ee3b489 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CxfRsHttpListener.java
@@ -794,7 +794,8 @@ public class CxfRsHttpListener implements RsHttpListener {
             addMandatoryProviders(providers);
         }
 
-        SystemInstance.get().fireEvent(new ExtensionProviderRegistration(providers));
+        SystemInstance.get().fireEvent(new ExtensionProviderRegistration(
+                AppFinder.findAppContextOrWeb(Thread.currentThread().getContextClassLoader(), AppFinder.AppContextTransformer.INSTANCE), providers));
 
         LOGGER.info("Using providers:");
         for (final Object provider : providers) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/50c7e467/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ExtensionProviderRegistration.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ExtensionProviderRegistration.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ExtensionProviderRegistration.java
new file mode 100644
index 0000000..cfae25c
--- /dev/null
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ExtensionProviderRegistration.java
@@ -0,0 +1,48 @@
+/*
+ *     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.rs.event;
+
+import org.apache.openejb.AppContext;
+import org.apache.openejb.observer.Event;
+
+import java.util.List;
+
+// using list reference to be able to get updates in CxfrsHttpListener automatically
+// this event can allow to add/remove/resort providers
+@Event
+public class ExtensionProviderRegistration {
+    private final List<Object> providers;
+    private final AppContext appContext;
+
+    public ExtensionProviderRegistration(final AppContext ctx, final List<Object> existings) {
+        this.appContext = ctx;
+        this.providers = existings;
+    }
+
+    public AppContext getAppContext() {
+        return appContext;
+    }
+
+    public List<Object> getProviders() {
+        return providers;
+    }
+
+    @Override
+    public String toString() {
+        return "ExtensionProviderRegistration{}";
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/50c7e467/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ServerCreated.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ServerCreated.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ServerCreated.java
new file mode 100644
index 0000000..b35d78f
--- /dev/null
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ServerCreated.java
@@ -0,0 +1,55 @@
+/*
+ *     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.rs.event;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.openejb.AppContext;
+import org.apache.openejb.core.WebContext;
+import org.apache.openejb.observer.Event;
+
+@Event
+public class ServerCreated {
+    private final Server server;
+    private final AppContext appContext;
+    private final WebContext webContext;
+
+    public ServerCreated(final Server server, final AppContext appContext, final WebContext webContext) {
+        this.server = server;
+        this.appContext = appContext;
+        this.webContext = webContext;
+    }
+
+    public Server getServer() {
+        return server;
+    }
+
+    public AppContext getAppContext() {
+        return appContext;
+    }
+
+    public WebContext getWebContext() {
+        return webContext;
+    }
+
+    @Override
+    public String toString() {
+        return "ServerCreated{" +
+                "appContext=" + appContext.getId() +
+                ", webContext=" + webContext.getHost() + '/' + webContext.getId() +
+                '}';
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/50c7e467/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ServerDestroyed.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ServerDestroyed.java b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ServerDestroyed.java
new file mode 100644
index 0000000..bc3eadc
--- /dev/null
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/event/ServerDestroyed.java
@@ -0,0 +1,38 @@
+/*
+ *     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.rs.event;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.openejb.observer.Event;
+
+@Event
+public class ServerDestroyed {
+    private final Server server;
+
+    public ServerDestroyed(final Server server) {
+        this.server = server;
+    }
+
+    public Server getServer() {
+        return server;
+    }
+
+    @Override
+    public String toString() {
+        return "ServerCreated{}";
+    }
+}