diff --git a/eventadmin/bridge.configuration/pom.xml b/eventadmin/bridge.configuration/pom.xml index 094213ee4f..6ae2346009 100644 --- a/eventadmin/bridge.configuration/pom.xml +++ b/eventadmin/bridge.configuration/pom.xml @@ -20,7 +20,7 @@ org.apache.felix felix-parent - 4 + 9 ../../pom/pom.xml 4.0.0 @@ -39,14 +39,14 @@ - 6 + 7 org.osgi - org.osgi.core - 5.0.0 + osgi.core + 7.0.0 provided @@ -68,7 +68,7 @@ org.apache.felix maven-bundle-plugin - 3.2.0 + 6.0.0 true diff --git a/eventadmin/bridge.upnp/pom.xml b/eventadmin/bridge.upnp/pom.xml index 5f3f8d8542..7ec4e343f0 100644 --- a/eventadmin/bridge.upnp/pom.xml +++ b/eventadmin/bridge.upnp/pom.xml @@ -19,8 +19,8 @@ org.apache.felix - felix - 1.0.4 + felix-parent + 9 ../../pom/pom.xml 4.0.0 diff --git a/eventadmin/bridge.useradmin/pom.xml b/eventadmin/bridge.useradmin/pom.xml index 6d2446fb45..1ba1cd0c61 100644 --- a/eventadmin/bridge.useradmin/pom.xml +++ b/eventadmin/bridge.useradmin/pom.xml @@ -19,8 +19,8 @@ org.apache.felix - felix - 1.0.4 + felix-parent + 9 ../../pom/pom.xml 4.0.0 diff --git a/eventadmin/bridge.wireadmin/pom.xml b/eventadmin/bridge.wireadmin/pom.xml index 9e43b04015..f5677a5cf5 100644 --- a/eventadmin/bridge.wireadmin/pom.xml +++ b/eventadmin/bridge.wireadmin/pom.xml @@ -19,8 +19,8 @@ org.apache.felix - felix - 1.0.4 + felix-parent + 9 ../../pom/pom.xml 4.0.0 diff --git a/eventadmin/impl/pom.xml b/eventadmin/impl/pom.xml index d90614cf80..e4be41c859 100644 --- a/eventadmin/impl/pom.xml +++ b/eventadmin/impl/pom.xml @@ -20,7 +20,7 @@ org.apache.felix felix-parent - 7 + 9 ../../pom/pom.xml 4.0.0 @@ -53,7 +53,7 @@ org.osgi osgi.core - 6.0.0 + 7.0.0 provided @@ -71,7 +71,7 @@ org.osgi org.osgi.service.log - 1.3.0 + 1.4.0 provided @@ -96,38 +96,38 @@ org.slf4j slf4j-simple - 1.7.5 + 1.7.36 test org.ops4j.pax.exam pax-exam-container-forked - 4.13.1 + 4.13.4 test org.ops4j.pax.exam pax-exam-junit4 - 4.13.1 + 4.13.4 test org.ops4j.pax.exam pax-exam-link-mvn - 4.13.1 + 4.13.4 test org.ops4j.pax.url pax-url-aether - 2.6.2 + 2.6.14 test org.ops4j.pax.url pax-url-wrap - 2.6.2 + 2.6.14 test @@ -139,7 +139,7 @@ org.apache.felix org.apache.felix.framework - 6.0.3 + 7.0.5 test @@ -153,7 +153,7 @@ org.apache.felix maven-bundle-plugin - 4.2.1 + 6.0.0 true @@ -180,10 +180,10 @@ --> org.osgi.service.metatype;version="[1.1,2)";resolution:=optional, - - org.osgi.service.log;version="[1.3,2)";resolution:=optional, + + org.osgi.service.log;version="[1.3,2)";resolution:=optional, * diff --git a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java index 25b21fc275..aa31dd3d93 100644 --- a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java +++ b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/Configuration.java @@ -25,11 +25,6 @@ import java.util.Hashtable; import java.util.StringTokenizer; -import org.apache.felix.eventadmin.impl.adapter.AbstractAdapter; -import org.apache.felix.eventadmin.impl.adapter.BundleEventAdapter; -import org.apache.felix.eventadmin.impl.adapter.FrameworkEventAdapter; -import org.apache.felix.eventadmin.impl.adapter.LogEventAdapter; -import org.apache.felix.eventadmin.impl.adapter.ServiceEventAdapter; import org.apache.felix.eventadmin.impl.handler.EventAdminImpl; import org.apache.felix.eventadmin.impl.security.SecureEventAdminFactory; import org.apache.felix.eventadmin.impl.tasks.DefaultThreadPool; @@ -172,9 +167,6 @@ public class Configuration // The registration of the mbean private volatile ServiceRegistration m_mbeanreg; - // all adapters - private AbstractAdapter[] m_adapters; - private ServiceRegistration m_managedServiceReg; // the access control context @@ -431,9 +423,6 @@ private void startOrUpdate() m_requireTopic, m_ignoreTopics); - // Finally, adapt the outside events to our kind of events as per spec - adaptEvents(m_admin); - // register the admin wrapped in a service factory (SecureEventAdminFactory) // that hands-out the m_admin object wrapped in a decorator that checks // appropriated permissions of each calling bundle @@ -463,14 +452,6 @@ public void destroy() { synchronized ( this ) { - if ( m_adapters != null ) - { - for(int i=0;iFelix Project Team - */ -public abstract class AbstractAdapter -{ - private volatile EventAdmin m_admin; - - /** - * The constructor of the adapter. - * - * @param admin The {@code EventAdmin} to use for posting events. - */ - public AbstractAdapter(final EventAdmin admin) - { - if (null == admin) - { - throw new NullPointerException("EventAdmin must not be null"); - } - - m_admin = admin; - } - - protected EventAdmin getEventAdmin() - { - return m_admin; - } - - public abstract void destroy(final BundleContext bundleContext); -} diff --git a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/BundleEventAdapter.java b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/BundleEventAdapter.java deleted file mode 100644 index 0a5f380b0c..0000000000 --- a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/BundleEventAdapter.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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.felix.eventadmin.impl.adapter; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.BundleListener; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventConstants; - -/** - * This class registers itself as a listener for bundle events and posts them via - * the EventAdmin as specified in 113.6.4 OSGi R4 compendium. - * - * @author Felix Project Team - */ -public class BundleEventAdapter extends AbstractAdapter implements BundleListener -{ - /** - * The constructor of the adapter. This will register the adapter with the given - * context as a {@code BundleListener} and subsequently, will post received - * events via the given EventAdmin. - * - * @param context The bundle context with which to register as a listener. - * @param admin The {@code EventAdmin} to use for posting events. - */ - public BundleEventAdapter(final BundleContext context, final EventAdmin admin) - { - super(admin); - context.addBundleListener(this); - } - - @Override - public void destroy(BundleContext context) { - context.removeBundleListener(this); - } - - /** - * Once a bundle event is received this method assembles and posts an event via - * the {@code EventAdmin} as specified in 113.6.4 OSGi R4 compendium. - * - * @param event The event to adapt. - */ - @Override - public void bundleChanged(final BundleEvent event) - { - final Dictionary properties = new Hashtable(); - - properties.put(EventConstants.EVENT, event); - - properties.put("bundle.id", event.getBundle().getBundleId()); - - final String symbolicName = event.getBundle().getSymbolicName(); - - if (null != symbolicName) - { - properties.put(EventConstants.BUNDLE_SYMBOLICNAME, - symbolicName); - } - - properties.put("bundle", event.getBundle()); - - final StringBuilder topic = new StringBuilder(BundleEvent.class - .getName().replace('.', '/')).append('/'); - - switch (event.getType()) - { - case BundleEvent.INSTALLED: - topic.append("INSTALLED"); - break; - case BundleEvent.STARTED: - topic.append("STARTED"); - break; - case BundleEvent.STOPPED: - topic.append("STOPPED"); - break; - case BundleEvent.UPDATED: - topic.append("UPDATED"); - break; - case BundleEvent.UNINSTALLED: - topic.append("UNINSTALLED"); - break; - case BundleEvent.RESOLVED: - topic.append("RESOLVED"); - break; - case BundleEvent.UNRESOLVED: - topic.append("UNRESOLVED"); - break; - default: - return; // IGNORE EVENT - } - - try { - getEventAdmin().postEvent(new Event(topic.toString(), properties)); - } catch (IllegalStateException e) { - // This is o.k. - indicates that we are stopped. - } - } -} diff --git a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/FrameworkEventAdapter.java b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/FrameworkEventAdapter.java deleted file mode 100644 index 5edfe0cf68..0000000000 --- a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/FrameworkEventAdapter.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * 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.felix.eventadmin.impl.adapter; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkEvent; -import org.osgi.framework.FrameworkListener; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventConstants; - -/** - * This class registers itself as a listener for framework events and posts them via - * the EventAdmin as specified in 113.6.3 OSGi R4 compendium. - * - * @author Felix Project Team - */ -public class FrameworkEventAdapter extends AbstractAdapter implements FrameworkListener -{ - /** - * The constructor of the adapter. This will register the adapter with the - * given context as a {@code FrameworkListener} and subsequently, will - * post received events via the given EventAdmin. - * - * @param context The bundle context with which to register as a listener. - * @param admin The {@code EventAdmin} to use for posting events. - */ - public FrameworkEventAdapter(final BundleContext context, final EventAdmin admin) - { - super(admin); - - context.addFrameworkListener(this); - } - - @Override - public void destroy(BundleContext context) { - context.removeFrameworkListener(this); - } - - /** - * Once a framework event is received this method assembles and posts an event - * via the {@code EventAdmin} as specified in 113.6.3 OSGi R4 compendium. - * - * @param event The event to adapt. - */ - @Override - public void frameworkEvent(final FrameworkEvent event) - { - final Dictionary properties = new Hashtable<>(); - - properties.put(EventConstants.EVENT, event); - - final Bundle bundle = event.getBundle(); - - if (null != bundle) - { - properties.put("bundle.id", bundle.getBundleId()); - - final String symbolicName = bundle.getSymbolicName(); - - if (null != symbolicName) - { - properties.put(EventConstants.BUNDLE_SYMBOLICNAME, - symbolicName); - } - - properties.put("bundle", bundle); - } - - final Throwable thrown = event.getThrowable(); - - if (null != thrown) - { - properties.put(EventConstants.EXCEPTION_CLASS, - thrown.getClass().getName()); - - final String message = thrown.getMessage(); - - if (null != message) - { - properties.put(EventConstants.EXCEPTION_MESSAGE, - message); - } - - properties.put(EventConstants.EXCEPTION, thrown); - } - - final StringBuilder topic = new StringBuilder( - FrameworkEvent.class.getName().replace('.', '/')) - .append('/'); - - switch (event.getType()) - { - case FrameworkEvent.STARTED: - topic.append("STARTED"); - break; - case FrameworkEvent.ERROR: - topic.append("ERROR"); - break; - case FrameworkEvent.PACKAGES_REFRESHED: - topic.append("PACKAGES_REFRESHED"); - break; - case FrameworkEvent.STARTLEVEL_CHANGED: - topic.append("STARTLEVEL_CHANGED"); - break; - case FrameworkEvent.WARNING: - topic.append("WARNING"); - break; - case FrameworkEvent.INFO: - topic.append("INFO"); - break; - default: - return; // IGNORE EVENT - } - - try { - getEventAdmin().postEvent(new Event(topic.toString(), properties)); - } catch(IllegalStateException e) { - // This is o.k. - indicates that we are stopped. - } - } -} diff --git a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java deleted file mode 100644 index 8a11a937ee..0000000000 --- a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/LogEventAdapter.java +++ /dev/null @@ -1,254 +0,0 @@ -/* - * 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.felix.eventadmin.impl.adapter; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceEvent; -import org.osgi.framework.ServiceListener; -import org.osgi.framework.ServiceReference; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventConstants; - -/** - * This class registers itself as a listener for {@code LogReaderService} services - * with the framework and subsequently, a {@code LogListener} callback with any - * currently available {@code LogReaderService}. Any received log event is then - * posted via the EventAdmin as specified in 113.6.6 OSGi R4 compendium. - * Note that this class does not create a hard dependency on the org.osgi.service.log - * packages. The adaption only takes place if it is present or once it becomes - * available hence, combined with a DynamicImport-Package no hard dependency is - * needed. - * - * @author Felix Project Team - */ -public class LogEventAdapter extends AbstractAdapter implements ServiceListener -{ - // The internal lock for this object used instead synchronized(this) - private final Object m_lock = new Object(); - - private BundleContext m_context; - - // A singleton instance of the used log listener that is the adapter - private Object m_logListener; - - /** - * The constructor of the adapter. This will register the adapter with the - * given context as a listener for {@code LogReaderService} services and - * subsequently, a {@code LogListener} callback with any currently available - * {@code LogReaderService}. Any received log event is then posted via the given - * EventAdmin. - * - * @param context The bundle context with which to register as a listener. - * @param admin The {@code EventAdmin} to use for posting events. - */ - public LogEventAdapter(final BundleContext context, final EventAdmin admin) - { - super(admin); - m_context = context; - - try - { - m_context.addServiceListener(this, "(" + Constants.OBJECTCLASS - + "=org.osgi.service.log.LogReaderService)"); - - final ServiceReference[] refs; - - refs = m_context.getServiceReferences( - "org.osgi.service.log.LogReaderService", null); - - if (null != refs) - { - for (int i = 0; i < refs.length; i++) - { - final org.osgi.service.log.LogReaderService logReader = - (org.osgi.service.log.LogReaderService) m_context - .getService(refs[i]); - - if (null != logReader) - { - logReader.addLogListener((org.osgi.service.log.LogListener) - getLogListener()); - } - } - } - } catch (InvalidSyntaxException e) - { - // This never happens - } - } - - @Override - public void destroy(BundleContext context) { - context.removeServiceListener(this); - } - - /** - * Once a {@code LogReaderService} register event is received this method - * registers a {@code LogListener} with the received service that assembles - * and posts any log event via the {@code EventAdmin} as specified in - * 113.6.6 OSGi R4 compendium. - * - * @param event The event to adapt. - */ - @Override - public void serviceChanged(final ServiceEvent event) - { - if (ServiceEvent.REGISTERED == event.getType()) - { - final org.osgi.service.log.LogReaderService logReader = - (org.osgi.service.log.LogReaderService) m_context - .getService(event.getServiceReference()); - - if (null != logReader) - { - logReader.addLogListener((org.osgi.service.log.LogListener) - getLogListener()); - } - } - } - - /* - * Constructs a LogListener that assembles and posts any log event via the - * EventAdmin as specified in 113.6.6 OSGi R4 compendium. Note that great - * care is taken to not create a hard dependency on the org.osgi.service.log - * package. - */ - private Object getLogListener() - { - synchronized (m_lock) - { - if (null != m_logListener) - { - return m_logListener; - } - - m_logListener = new org.osgi.service.log.LogListener() - { - @Override - public void logged(final org.osgi.service.log.LogEntry entry) - { - // This is where the assembly as specified in 133.6.6 OSGi R4 - // compendium is taking place (i.e., the log entry is adapted to - // an event and posted via the EventAdmin) - - final Dictionary properties = new Hashtable(); - - final Bundle bundle = entry.getBundle(); - - if (null != bundle) - { - properties.put("bundle.id", bundle.getBundleId()); - - final String symbolicName = bundle.getSymbolicName(); - if (null != symbolicName) - { - properties.put(EventConstants.BUNDLE_SYMBOLICNAME, - symbolicName); - } - - properties.put("bundle", bundle); - } - - properties.put("log.level", entry.getLevel()); - - properties.put(EventConstants.MESSAGE, - (entry.getMessage()) != null ? entry.getMessage() : "" ); - - properties.put(EventConstants.TIMESTAMP, entry.getTime()); - - properties.put("log.entry", entry); - - final Throwable exception = entry.getException(); - - if (null != exception) - { - properties.put(EventConstants.EXCEPTION_CLASS, - exception.getClass().getName()); - - final String message = exception.getMessage(); - - if (null != message) - { - properties.put(EventConstants.EXCEPTION_MESSAGE, - message); - } - - properties.put(EventConstants.EXCEPTION, exception); - } - - final ServiceReference service = entry.getServiceReference(); - - if (null != service) - { - properties.put(EventConstants.SERVICE, service); - properties.put(EventConstants.SERVICE_ID, service.getProperty(EventConstants.SERVICE_ID)); - properties.put( - EventConstants.SERVICE_OBJECTCLASS, - service.getProperty(Constants.OBJECTCLASS)); - - final Object pid = service.getProperty(EventConstants.SERVICE_PID); - if (null != pid) - { - properties.put(EventConstants.SERVICE_PID, pid); - } - - } - - final StringBuilder topic = new StringBuilder( - org.osgi.service.log.LogEntry.class.getName().replace( - '.', '/')).append('/'); - - switch (entry.getLevel()) - { - case org.osgi.service.log.LogService.LOG_ERROR: - topic.append("LOG_ERROR"); - break; - case org.osgi.service.log.LogService.LOG_WARNING: - topic.append("LOG_WARNING"); - break; - case org.osgi.service.log.LogService.LOG_INFO: - topic.append("LOG_INFO"); - break; - case org.osgi.service.log.LogService.LOG_DEBUG: - topic.append("LOG_DEBUG"); - break; - default: - topic.append("LOG_OTHER"); - break; - } - - try { - getEventAdmin().postEvent(new Event(topic.toString(), properties)); - } catch(IllegalStateException e) { - // This is o.k. - indicates that we are stopped. - } - } - }; - - return m_logListener; - } - } -} diff --git a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/ServiceEventAdapter.java b/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/ServiceEventAdapter.java deleted file mode 100644 index 3dfff931f4..0000000000 --- a/eventadmin/impl/src/main/java/org/apache/felix/eventadmin/impl/adapter/ServiceEventAdapter.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.felix.eventadmin.impl.adapter; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceEvent; -import org.osgi.framework.ServiceListener; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; -import org.osgi.service.event.EventConstants; - -/** - * This class registers itself as a listener for service events and posts them via - * the EventAdmin as specified in 113.6.5 OSGi R4 compendium. - * - * @author Felix Project Team - */ -public class ServiceEventAdapter extends AbstractAdapter implements ServiceListener -{ - /** - * The constructor of the adapter. This will register the adapter with the - * given context as a {@code ServiceListener} and subsequently, will - * post received events via the given EventAdmin. - * - * @param context The bundle context with which to register as a listener. - * @param admin The {@code EventAdmin} to use for posting events. - */ - public ServiceEventAdapter(final BundleContext context, final EventAdmin admin) - { - super(admin); - - context.addServiceListener(this); - } - - @Override - public void destroy(BundleContext context) { - context.removeServiceListener(this); - } - - /** - * Once a Service event is received this method assembles and posts an event - * via the {@code EventAdmin} as specified in 113.6.5 OSGi R4 compendium. - * - * @param event The event to adapt. - */ - @Override - public void serviceChanged(final ServiceEvent event) - { - final Dictionary properties = new Hashtable(); - - properties.put(EventConstants.EVENT, event); - - properties.put(EventConstants.SERVICE, event.getServiceReference()); - - properties.put(EventConstants.SERVICE_ID, - event.getServiceReference().getProperty(EventConstants.SERVICE_ID)); - - properties.put(EventConstants.SERVICE_OBJECTCLASS, - event.getServiceReference().getProperty(Constants.OBJECTCLASS)); - - final Object pid = event.getServiceReference().getProperty( - EventConstants.SERVICE_PID); - if (null != pid) - { - properties.put(EventConstants.SERVICE_PID, pid); - } - - final StringBuilder topic = new StringBuilder(ServiceEvent.class - .getName().replace('.', '/')).append('/'); - - switch (event.getType()) - { - case ServiceEvent.REGISTERED: - topic.append("REGISTERED"); - break; - case ServiceEvent.MODIFIED: - topic.append("MODIFIED"); - break; - case ServiceEvent.UNREGISTERING: - topic.append("UNREGISTERING"); - break; - default: - return; // IGNORE - } - - try { - getEventAdmin().postEvent(new Event(topic.toString(), properties)); - } catch(IllegalStateException e) { - // This is o.k. - indicates that we are stopped. - } - } -} diff --git a/eventadmin/pom.xml b/eventadmin/pom.xml index 22655c65d7..601e3d2a7c 100644 --- a/eventadmin/pom.xml +++ b/eventadmin/pom.xml @@ -23,8 +23,8 @@ org.apache.felix - felix - 1.0.4 + felix-parent + 9 ../pom/pom.xml