ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1466022 - in /ace/trunk: org.apache.ace.authentication.itest/ org.apache.ace.client.repository.itest/ org.apache.ace.client.rest.itest/ org.apache.ace.configurator.useradmin.itest/ org.apache.ace.deployment.itest/ org.apache.ace.http.itest...
Date Tue, 09 Apr 2013 13:31:03 GMT
Author: marrs
Date: Tue Apr  9 13:31:02 2013
New Revision: 1466022

URL: http://svn.apache.org/r1466022
Log:
ACE-333 Merged http projects.

Added:
    ace/trunk/org.apache.ace.http/
    ace/trunk/org.apache.ace.http/.classpath
    ace/trunk/org.apache.ace.http/.project
    ace/trunk/org.apache.ace.http/.settings/
    ace/trunk/org.apache.ace.http/.settings/org.eclipse.jdt.core.prefs
    ace/trunk/org.apache.ace.http/bnd.bnd
    ace/trunk/org.apache.ace.http/build.xml
    ace/trunk/org.apache.ace.http/listener.bnd
    ace/trunk/org.apache.ace.http/redirector.bnd
    ace/trunk/org.apache.ace.http/src/
    ace/trunk/org.apache.ace.http/src/org/
    ace/trunk/org.apache.ace.http/src/org/apache/
    ace/trunk/org.apache.ace.http/src/org/apache/ace/
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/Activator.java
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/HttpConstants.java
    ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/packageinfo
Removed:
    ace/trunk/org.apache.ace.http.redirector/
    ace/trunk/org.apache.ace.httplistener/
Modified:
    ace/trunk/org.apache.ace.authentication.itest/bnd.bnd
    ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd
    ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd
    ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd
    ace/trunk/org.apache.ace.deployment.itest/bnd.bnd
    ace/trunk/org.apache.ace.http.itest/bnd.bnd
    ace/trunk/org.apache.ace.log.itest/bnd.bnd
    ace/trunk/org.apache.ace.repository.itest/bnd.bnd
    ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd
    ace/trunk/run-client/client.bndrun
    ace/trunk/run-obr/obr.bndrun
    ace/trunk/run-server-allinone/server-allinone.bndrun
    ace/trunk/run-server/server.bndrun

Modified: ace/trunk/org.apache.ace.authentication.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.authentication.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.authentication.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.authentication.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -14,7 +14,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.ace.identification.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.identification.property;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.range.api;version=latest,\
 	org.apache.ace.obr.storage;version=latest
 -runfw: org.apache.felix.framework;version='[4,5)'
@@ -46,7 +46,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.ace.deployment.provider.api;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
 	org.apache.ace.identification.property;version=latest,\
 	org.apache.ace.log.api;version=latest,\

Modified: ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.client.repository.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -5,7 +5,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.log.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
@@ -35,7 +35,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.useradmin.filestore,\
 	org.apache.felix.log,\
 	org.apache.ace.test;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.authentication.api;version=latest,\
 	org.apache.ace.connectionfactory;version=latest,\
 	org.apache.ace.scheduler.impl;version=latest,\

Modified: ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.client.rest.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -11,7 +11,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.log.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
@@ -46,7 +46,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	com.sun.jersey.client,\
 	com.sun.jersey.core,\
 	org.apache.ace.test;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.authentication.api;version=latest,\
 	org.apache.ace.connectionfactory;version=latest,\
 	org.apache.ace.scheduler.impl;version=latest,\

Modified: ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.configurator.useradmin.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -5,7 +5,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.log.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
@@ -26,7 +26,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.useradmin.filestore,\
 	org.apache.felix.log,\
     org.apache.ace.test;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.deployment.provider.api;version=latest,\
 	org.apache.ace.authentication.api;version=latest,\
 	org.apache.ace.range.api;version=latest,\

Modified: ace/trunk/org.apache.ace.deployment.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.deployment.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.deployment.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -6,7 +6,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.log.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
@@ -30,7 +30,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.gogo.shell,\
 	org.apache.felix.dependencymanager.shell,\
 	org.apache.felix.deploymentadmin,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.authentication.api;version=latest,\
 	org.apache.ace.connectionfactory;version=latest,\
 	org.apache.ace.scheduler.impl;version=latest,\

Modified: ace/trunk/org.apache.ace.http.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.http.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.http.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -5,7 +5,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.log.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
@@ -21,7 +21,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.dependencymanager,\
 	org.apache.felix.configadmin,\
 	org.apache.ace.test;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.deployment.provider.api;version=latest
 Private-Package: org.apache.ace.it.http
 Bundle-Version: 1.0.0
\ No newline at end of file

Added: ace/trunk/org.apache.ace.http/.classpath
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/.classpath?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/.classpath (added)
+++ ace/trunk/org.apache.ace.http/.classpath Tue Apr  9 13:31:02 2013
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" output="bin_test" path="test"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: ace/trunk/org.apache.ace.http/.project
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/.project?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/.project (added)
+++ ace/trunk/org.apache.ace.http/.project Tue Apr  9 13:31:02 2013
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.apache.ace.http</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>bndtools.core.bndbuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>bndtools.core.bndnature</nature>
+	</natures>
+</projectDescription>

Added: ace/trunk/org.apache.ace.http/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/.settings/org.eclipse.jdt.core.prefs?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/.settings/org.eclipse.jdt.core.prefs (added)
+++ ace/trunk/org.apache.ace.http/.settings/org.eclipse.jdt.core.prefs Tue Apr  9 13:31:02
2013
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Added: ace/trunk/org.apache.ace.http/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/bnd.bnd?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/bnd.bnd (added)
+++ ace/trunk/org.apache.ace.http/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -0,0 +1,5 @@
+-buildpath: osgi.core,\
+	osgi.cmpn,\
+	org.apache.felix.dependencymanager,\
+	javax.servlet
+-sub: *.bnd
\ No newline at end of file

Added: ace/trunk/org.apache.ace.http/build.xml
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/build.xml?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/build.xml (added)
+++ ace/trunk/org.apache.ace.http/build.xml Tue Apr  9 13:31:02 2013
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="project" default="build">
+
+	<!-- -->
+
+	<import file="../cnf/build.xml" />
+</project>

Added: ace/trunk/org.apache.ace.http/listener.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/listener.bnd?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/listener.bnd (added)
+++ ace/trunk/org.apache.ace.http/listener.bnd Tue Apr  9 13:31:02 2013
@@ -0,0 +1,4 @@
+Private-Package: org.apache.ace.http.listener
+Bundle-Activator: org.apache.ace.http.listener.Activator
+Export-Package: org.apache.ace.http.listener.constants
+Bundle-Version: 1.0.0

Added: ace/trunk/org.apache.ace.http/redirector.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/redirector.bnd?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/redirector.bnd (added)
+++ ace/trunk/org.apache.ace.http/redirector.bnd Tue Apr  9 13:31:02 2013
@@ -0,0 +1,3 @@
+Private-Package: org.apache.ace.http.redirector
+Bundle-Activator: org.apache.ace.http.redirector.Activator
+Bundle-Version: 1.0.0

Added: ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/Activator.java?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/Activator.java (added)
+++ ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/Activator.java Tue Apr
 9 13:31:02 2013
@@ -0,0 +1,207 @@
+/*
+ * 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.ace.http.listener;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.Servlet;
+
+import org.apache.ace.http.listener.constants.HttpConstants;
+import org.apache.felix.dm.DependencyActivatorBase;
+import org.apache.felix.dm.DependencyManager;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.log.LogService;
+
+/**
+ * Service responsible for registrating Servlets at HttpServices.<p>
+ *
+ * When a Servlet is being added or removed, the callback methods in this class are being
+ * called via the DependencyManager. A Servlet is being added to all HttpServices currently
+ * available or removed from all available HttpServices.<p>
+ *
+ * In case a HttpService is being added or removed, other callback methods are being called
+ * via the DependencyManager. When a HttpService is added, all previously registered Servlets
+ * are being registered to this new HttpService. In case of removal, all Servlet endpoints
are
+ * being removed from the HttpService that is going to be removed.<p>
+ */
+public class Activator extends DependencyActivatorBase {
+
+    private volatile LogService m_log; // injected
+    private final Set<ServiceReference> m_httpServices = new HashSet<ServiceReference>();
+    private final Map<ServiceReference, String> m_servlets = new HashMap<ServiceReference,
String>();
+    private BundleContext m_context;
+
+    @Override
+    public synchronized void init(BundleContext context, DependencyManager manager) throws
Exception {
+        m_context = context;
+        manager.add(createComponent()
+            .setImplementation(this)
+            .add(createServiceDependency()
+                .setService(LogService.class)
+                .setRequired(false))
+            .add(createServiceDependency()
+                .setService(HttpService.class)
+                .setAutoConfig(false)
+                .setCallbacks("addHttpService", "removeHttpService"))
+            .add(createServiceDependency()
+                .setService(Servlet.class)
+                .setAutoConfig(false)
+                .setCallbacks("addServlet", "changeServlet", "removeServlet")));
+    }
+
+    /**
+     * Callback method used in case a Servlet is being added. This Servlet is being added
+     * to all available HttpServices under the endpoint configured via the Configurator.
+     *
+     * @param ref  reference to the Servlet
+     */
+    public synchronized void addServlet(ServiceReference ref) {
+        // register servlet to all HttpServices
+        String endpoint = (String)ref.getProperty(HttpConstants.ENDPOINT);
+        m_servlets.put(ref, endpoint);
+        Servlet servlet = (Servlet)m_context.getService(ref);
+        for (ServiceReference reference : m_httpServices) {
+            HttpService httpService = (HttpService) m_context.getService(reference);
+            try {
+                if ((httpService != null) && (endpoint != null) && (servlet
!= null)) {
+                    httpService.registerServlet(endpoint, servlet, null, null);
+                }
+                else {
+                    m_log.log(LogService.LOG_WARNING, "Unable to register servlet with endpoint
'" + endpoint + "'");
+                }
+            }
+            catch (Exception e) {
+                m_log.log(LogService.LOG_WARNING, "Already registered under existing endpoint",
e);
+            }
+        }
+    }
+
+    /**
+     * Callback method used in case a Servlet is being changed. This Servlet is removed
+     * and then added again. 
+     *
+     * @param ref  reference to the Servlet
+     */
+    public synchronized void changeServlet(ServiceReference ref) {
+        removeServlet(ref, m_servlets.get(ref));
+        addServlet(ref);
+    }
+
+    /**
+     * Callback method used in case a Servlet is being removed. This Servlet is being removed
+     * from all available HttpServices using the endpoint configured via the Configurator.
+     *
+     * @param ref  reference to the Servlet
+     */
+    public synchronized void removeServlet(ServiceReference ref) {
+        // remove servlet from all HttpServices
+        String endpoint = (String)ref.getProperty(HttpConstants.ENDPOINT);
+        removeServlet(ref, endpoint);
+    }
+
+    private void removeServlet(ServiceReference ref, String endpoint) {
+        m_servlets.remove(ref);
+        for (ServiceReference reference : m_httpServices) {
+            HttpService httpService = (HttpService) m_context.getService(reference);
+            if ((httpService != null) && (endpoint != null)) {
+                try {
+                    httpService.unregister(endpoint);
+                }
+                catch (Exception e) {
+                    m_log.log(LogService.LOG_WARNING, "Servlet cannot be unregistered, maybe
not registered under this endpoint", e);
+                }
+            }
+        }
+    }
+
+    /**
+     * Callback method used in case a HttpService is being added. To this Service all previously
+     * registered Servlet are added under the endpoints of the Servlets (which are configured
+     * via the Configurator).
+     *
+     * @param ref  reference to the Service
+     */
+    public synchronized void addHttpService(ServiceReference ref, HttpService httpService)
{
+        m_httpServices.add(ref);
+        // register all servlets to this new HttpService
+        for (ServiceReference reference : m_servlets.keySet()) {
+            Servlet servlet = (Servlet)m_context.getService(reference);
+            String endpoint = (String)reference.getProperty(HttpConstants.ENDPOINT);
+            if ((servlet != null) && (endpoint != null)) {
+                try {
+                    httpService.registerServlet(endpoint, servlet, null, null);
+                }
+                catch (Exception e) {
+                    m_log.log(LogService.LOG_WARNING, "Already registered under existing
endpoint", e);
+                }
+            }
+        }
+    }
+
+    /**
+     * Callback method used in case a HttpService is being removed. From this Service all
previously
+     * registered Servlet are removed using the endpoints of the Servlets (which are configured
+     * via the Configurator).
+     *
+     * @param ref  reference to the Service
+     */
+    public synchronized void removeHttpService(ServiceReference ref, HttpService httpService)
{
+        m_httpServices.remove(ref);
+        // remove references from the unregistered HttpService
+        unregisterEndpoints(httpService);
+    }
+
+    @Override
+    public synchronized void destroy(BundleContext context, DependencyManager arg1) throws
Exception {
+        for (ServiceReference httpRef : m_httpServices) {
+            HttpService httpService = (HttpService)m_context.getService(httpRef);
+            if (httpService != null) {
+                unregisterEndpoints(httpService);
+            }
+        }
+        m_httpServices.clear();
+        m_servlets.clear();
+        m_context = null;
+    }
+
+    /**
+     * Unregisters all Servlets (via their endpoints) from the HttpService being passed to
+     * this method.
+     *
+     * @param httpService  the HttpService that is being unregistered
+     */
+    private void unregisterEndpoints(HttpService httpService) {
+        for (ServiceReference reference : m_servlets.keySet()) {
+            String endpoint = (String)reference.getProperty(HttpConstants.ENDPOINT);
+            if (endpoint != null) {
+                try {
+                    httpService.unregister(endpoint);
+                }
+                catch (Exception e) {
+                    m_log.log(LogService.LOG_WARNING, "Servlet cannot be unregistered, maybe
not registered under this endpoint", e);
+                }
+            }
+        }
+    }
+}
\ No newline at end of file

Added: ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/HttpConstants.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/HttpConstants.java?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/HttpConstants.java
(added)
+++ ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/HttpConstants.java
Tue Apr  9 13:31:02 2013
@@ -0,0 +1,27 @@
+/*
+ * 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.ace.http.listener.constants;
+
+public interface HttpConstants
+{
+    /**
+     * Endpoint constant to be used by several Servlet bundles.
+     */
+    public static final String ENDPOINT = "org.apache.ace.server.servlet.endpoint";
+}
\ No newline at end of file

Added: ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/packageinfo
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/packageinfo?rev=1466022&view=auto
==============================================================================
--- ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/packageinfo (added)
+++ ace/trunk/org.apache.ace.http/src/org/apache/ace/http/listener/constants/packageinfo Tue
Apr  9 13:31:02 2013
@@ -0,0 +1 @@
+version 1.0
\ No newline at end of file

Modified: ace/trunk/org.apache.ace.log.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.log.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.log.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.log.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -5,7 +5,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.dependencymanager,\
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.log.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
@@ -31,7 +31,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.ace.discovery.property;version=latest,\
 	org.apache.ace.log.target.store.impl;version=latest,\
 	org.apache.ace.log.target;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.identification.api;version=latest,\
 	org.apache.ace.identification.property;version=latest,\
 	org.apache.ace.log.api;version=latest,\

Modified: ace/trunk/org.apache.ace.repository.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.repository.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.repository.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.repository.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -4,7 +4,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	osgi.cmpn,\
 	org.mockito.mockito-all,\
 	org.apache.ace.test;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.repository.api;version=latest,\
 	org.apache.ace.repository.impl;version=latest,\
 	org.apache.ace.repository.servlet;version=latest,\
@@ -20,7 +20,7 @@ Test-Cases: ${classes;CONCRETE;EXTENDS;o
 	org.apache.felix.http.jetty,\
 	org.apache.ace.deployment.provider.api;version=latest,\
 	org.apache.ace.authentication.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.test;version=latest,\
 	org.apache.ace.range.api;version=latest,\
 	org.apache.ace.repository.api;version=latest,\

Modified: ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd (original)
+++ ace/trunk/org.apache.ace.useradmin.ui.itest/bnd.bnd Tue Apr  9 13:31:02 2013
@@ -39,7 +39,7 @@ Private-Package: org.apache.ace.useradmi
 	org.apache.ace.verifier.ui;version=latest,\
 	org.apache.ace.verifier.impl;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.log.api;version=latest,\
 	org.apache.ace.log.server.servlet;version=latest,\
 	org.apache.ace.nodelauncher.amazon;version=latest,\

Modified: ace/trunk/run-client/client.bndrun
URL: http://svn.apache.org/viewvc/ace/trunk/run-client/client.bndrun?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/run-client/client.bndrun (original)
+++ ace/trunk/run-client/client.bndrun Tue Apr  9 13:31:02 2013
@@ -33,7 +33,7 @@
 	org.apache.ace.verifier.impl;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
 	org.apache.ace.discovery.property;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.log.server.task;version=latest,\
 	org.apache.ace.log.api;version=latest,\
 	org.apache.ace.nodelauncher.amazon;version=latest,\

Modified: ace/trunk/run-obr/obr.bndrun
URL: http://svn.apache.org/viewvc/ace/trunk/run-obr/obr.bndrun?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/run-obr/obr.bndrun (original)
+++ ace/trunk/run-obr/obr.bndrun Tue Apr  9 13:31:02 2013
@@ -11,7 +11,7 @@
 	org.apache.felix.http.jetty,\
 	org.apache.felix.useradmin,\
 	org.apache.felix.useradmin.filestore,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.configurator.impl;version=latest,\
 	org.apache.ace.obr.metadata;version=latest,\
 	org.apache.ace.obr.storage;version=latest,\

Modified: ace/trunk/run-server-allinone/server-allinone.bndrun
URL: http://svn.apache.org/viewvc/ace/trunk/run-server-allinone/server-allinone.bndrun?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/run-server-allinone/server-allinone.bndrun (original)
+++ ace/trunk/run-server-allinone/server-allinone.bndrun Tue Apr  9 13:31:02 2013
@@ -34,7 +34,7 @@
 	org.apache.ace.deployment.servlet;version=latest,\
 	org.apache.ace.deployment.streamgenerator;version=latest,\
 	org.apache.ace.discovery.api;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.log.api;version=latest,\
 	org.apache.ace.log.server.servlet;version=latest,\
 	org.apache.ace.log.server.store.api;version=latest,\

Modified: ace/trunk/run-server/server.bndrun
URL: http://svn.apache.org/viewvc/ace/trunk/run-server/server.bndrun?rev=1466022&r1=1466021&r2=1466022&view=diff
==============================================================================
--- ace/trunk/run-server/server.bndrun (original)
+++ ace/trunk/run-server/server.bndrun Tue Apr  9 13:31:02 2013
@@ -26,7 +26,7 @@
 	org.apache.ace.deployment.servlet;version=latest,\
 	org.apache.ace.deployment.streamgenerator;version=latest,\
 	org.apache.ace.verifier.impl;version=latest,\
-	org.apache.ace.httplistener;version=latest,\
+	org.apache.ace.http.listener;version=latest,\
 	org.apache.ace.log.server.servlet;version=latest,\
 	org.apache.ace.log.api;version=latest,\
 	org.apache.ace.range.api;version=latest,\



Mime
View raw message