You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/04/01 20:59:19 UTC
git commit: [KARAF-2833] Make war and http independent of blueprint
Repository: karaf
Updated Branches:
refs/heads/master 073490033 -> e84ff7a49
[KARAF-2833] Make war and http independent of blueprint
Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/e84ff7a4
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/e84ff7a4
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/e84ff7a4
Branch: refs/heads/master
Commit: e84ff7a49eb87153c76e8bd42a28c81c10f5df8a
Parents: 0734900
Author: Guillaume Nodet <gn...@gmail.com>
Authored: Tue Apr 1 19:24:13 2014 +0200
Committer: Guillaume Nodet <gn...@gmail.com>
Committed: Tue Apr 1 19:24:13 2014 +0200
----------------------------------------------------------------------
http/core/pom.xml | 12 ++++-
.../http/core/internal/osgi/Activator.java | 40 ++++++++++++++
.../resources/OSGI-INF/blueprint/blueprint.xml | 40 --------------
web/core/pom.xml | 12 ++++-
.../karaf/web/internal/osgi/Activator.java | 55 ++++++++++++++++++++
.../resources/OSGI-INF/blueprint/web-core.xml | 51 ------------------
6 files changed, 117 insertions(+), 93 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/karaf/blob/e84ff7a4/http/core/pom.xml
----------------------------------------------------------------------
diff --git a/http/core/pom.xml b/http/core/pom.xml
index 1b53473..e09d764 100644
--- a/http/core/pom.xml
+++ b/http/core/pom.xml
@@ -53,6 +53,11 @@
<artifactId>${servlet.spec.artifactId}</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
@@ -81,8 +86,13 @@
org.apache.karaf.http.core
</Export-Package>
<Private-Package>
- org.apache.karaf.http.core.internal
+ org.apache.karaf.http.core.internal,
+ org.apache.karaf.http.core.internal.osgi,
+ org.apache.karaf.util.tracker
</Private-Package>
+ <Bundle-Activator>
+ org.apache.karaf.http.core.internal.osgi.Activator
+ </Bundle-Activator>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf/blob/e84ff7a4/http/core/src/main/java/org/apache/karaf/http/core/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/http/core/src/main/java/org/apache/karaf/http/core/internal/osgi/Activator.java b/http/core/src/main/java/org/apache/karaf/http/core/internal/osgi/Activator.java
new file mode 100644
index 0000000..a294229
--- /dev/null
+++ b/http/core/src/main/java/org/apache/karaf/http/core/internal/osgi/Activator.java
@@ -0,0 +1,40 @@
+/*
+ * 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.karaf.http.core.internal.osgi;
+
+import org.apache.karaf.http.core.ServletService;
+import org.apache.karaf.http.core.internal.HttpMBeanImpl;
+import org.apache.karaf.http.core.internal.ServletEventHandler;
+import org.apache.karaf.http.core.internal.ServletServiceImpl;
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.ops4j.pax.web.service.spi.ServletListener;
+
+public class Activator extends BaseActivator {
+
+ @Override
+ protected void doStart() throws Exception {
+ ServletEventHandler servletEventHandler = new ServletEventHandler();
+ register(ServletListener.class, servletEventHandler);
+
+ ServletServiceImpl servletService = new ServletServiceImpl(servletEventHandler);
+ register(ServletService.class, servletService);
+
+ HttpMBeanImpl httpMBean = new HttpMBeanImpl(servletService);
+ registerMBean(httpMBean, "type=http");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/e84ff7a4/http/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
----------------------------------------------------------------------
diff --git a/http/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/http/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 24b4cc3..0000000
--- a/http/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
-
- <ext:property-placeholder/>
-
- <bean id="servletEventHandler" class="org.apache.karaf.http.core.internal.ServletEventHandler"/>
-
- <service id="servletListener" interface="org.ops4j.pax.web.service.spi.ServletListener" ref="servletEventHandler"/>
-
- <bean id="servletService" class="org.apache.karaf.http.core.internal.ServletServiceImpl">
- <argument ref="servletEventHandler"/>
- </bean>
-
- <service interface="org.apache.karaf.http.core.ServletService" ref="servletService"/>
-
- <bean id="httpMBean" class="org.apache.karaf.http.core.internal.HttpMBeanImpl">
- <argument ref="servletService"/>
- </bean>
-
- <service ref="httpMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf:type=http,name=${karaf.name}"/>
- </service-properties>
- </service>
-
-</blueprint>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/karaf/blob/e84ff7a4/web/core/pom.xml
----------------------------------------------------------------------
diff --git a/web/core/pom.xml b/web/core/pom.xml
index 784743e..a6ec17e 100644
--- a/web/core/pom.xml
+++ b/web/core/pom.xml
@@ -55,6 +55,11 @@
<artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.karaf</groupId>
+ <artifactId>org.apache.karaf.util</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
@@ -85,8 +90,13 @@
</Export-Package>
<Private-Package>
org.apache.karaf.web.internal,
- org.apache.karaf.web.management.internal
+ org.apache.karaf.web.internal.osgi,
+ org.apache.karaf.web.management.internal,
+ org.apache.karaf.util.tracker
</Private-Package>
+ <Bundle-Activator>
+ org.apache.karaf.web.internal.osgi.Activator
+ </Bundle-Activator>
</instructions>
</configuration>
</plugin>
http://git-wip-us.apache.org/repos/asf/karaf/blob/e84ff7a4/web/core/src/main/java/org/apache/karaf/web/internal/osgi/Activator.java
----------------------------------------------------------------------
diff --git a/web/core/src/main/java/org/apache/karaf/web/internal/osgi/Activator.java b/web/core/src/main/java/org/apache/karaf/web/internal/osgi/Activator.java
new file mode 100644
index 0000000..e5bcfe1
--- /dev/null
+++ b/web/core/src/main/java/org/apache/karaf/web/internal/osgi/Activator.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.karaf.web.internal.osgi;
+
+import org.apache.karaf.util.tracker.BaseActivator;
+import org.apache.karaf.web.WebContainerService;
+import org.apache.karaf.web.internal.WebContainerServiceImpl;
+import org.apache.karaf.web.internal.WebEventHandler;
+import org.apache.karaf.web.management.internal.WebMBeanImpl;
+import org.ops4j.pax.web.service.spi.WarManager;
+import org.ops4j.pax.web.service.spi.WebListener;
+
+public class Activator extends BaseActivator {
+
+ @Override
+ protected void doOpen() throws Exception {
+ trackService(WarManager.class);
+ }
+
+ @Override
+ protected void doStart() throws Exception {
+ WarManager warManager = getTrackedService(WarManager.class);
+ if (warManager == null) {
+ return;
+ }
+
+ WebEventHandler webEventHandler = new WebEventHandler();
+ register(WebListener.class, webEventHandler);
+
+ WebContainerServiceImpl webContainerService = new WebContainerServiceImpl();
+ webContainerService.setBundleContext(bundleContext);
+ webContainerService.setWarManager(warManager);
+ webContainerService.setWebEventHandler(webEventHandler);
+ register(WebContainerService.class, webContainerService);
+
+ WebMBeanImpl webMBean = new WebMBeanImpl();
+ webMBean.setWebContainerService(webContainerService);
+ registerMBean(webMBean, "type=web");
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/karaf/blob/e84ff7a4/web/core/src/main/resources/OSGI-INF/blueprint/web-core.xml
----------------------------------------------------------------------
diff --git a/web/core/src/main/resources/OSGI-INF/blueprint/web-core.xml b/web/core/src/main/resources/OSGI-INF/blueprint/web-core.xml
deleted file mode 100644
index d034a64..0000000
--- a/web/core/src/main/resources/OSGI-INF/blueprint/web-core.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- 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.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
- xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">
-
- <ext:property-placeholder />
-
- <reference id="warManager" interface="org.ops4j.pax.web.service.spi.WarManager" />
-
- <bean id="webEventHandler" class="org.apache.karaf.web.internal.WebEventHandler" />
- <service id="webListener"
- interface="org.ops4j.pax.web.service.spi.WebListener"
- ref="webEventHandler" />
-
- <bean id="webContainerService" class="org.apache.karaf.web.internal.WebContainerServiceImpl">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- <property name="webEventHandler" ref="webEventHandler"/>
- <property name="warManager" ref="warManager"/>
- </bean>
-
- <service ref="webContainerService" interface="org.apache.karaf.web.WebContainerService"/>
-
- <bean id="webMBean" class="org.apache.karaf.web.management.internal.WebMBeanImpl">
- <property name="webContainerService" ref="webContainerService"/>
- </bean>
-
- <service ref="webMBean" auto-export="interfaces">
- <service-properties>
- <entry key="jmx.objectname" value="org.apache.karaf:type=web,name=${karaf.name}"/>
- </service-properties>
- </service>
-
-</blueprint>