Class LogEventAdapter
java.lang.Object
org.apache.felix.eventadmin.impl.adapter.AbstractAdapter
org.apache.felix.eventadmin.impl.adapter.LogEventAdapter
- All Implemented Interfaces:
java.util.EventListener,org.osgi.framework.ServiceListener
public class LogEventAdapter extends AbstractAdapter implements org.osgi.framework.ServiceListener
This class registers itself as a listener for
LogReaderService services
with the framework and subsequently, a LogListener callback with any
currently available 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
-
Constructor Summary
Constructors Constructor Description LogEventAdapter(org.osgi.framework.BundleContext context, org.osgi.service.event.EventAdmin admin)The constructor of the adapter. -
Method Summary
Modifier and Type Method Description voiddestroy(org.osgi.framework.BundleContext context)voidserviceChanged(org.osgi.framework.ServiceEvent event)Once aLogReaderServiceregister event is received this method registers aLogListenerwith the received service that assembles and posts any log event via theEventAdminas specified in 113.6.6 OSGi R4 compendium.
-
Constructor Details
-
LogEventAdapter
public LogEventAdapter(org.osgi.framework.BundleContext context, org.osgi.service.event.EventAdmin admin)The constructor of the adapter. This will register the adapter with the given context as a listener forLogReaderServiceservices and subsequently, aLogListenercallback with any currently availableLogReaderService. Any received log event is then posted via the given EventAdmin.- Parameters:
context- The bundle context with which to register as a listener.admin- TheEventAdminto use for posting events.
-
-
Method Details
-
destroy
public void destroy(org.osgi.framework.BundleContext context)- Specified by:
destroyin classAbstractAdapter
-
serviceChanged
public void serviceChanged(org.osgi.framework.ServiceEvent event)Once aLogReaderServiceregister event is received this method registers aLogListenerwith the received service that assembles and posts any log event via theEventAdminas specified in 113.6.6 OSGi R4 compendium.- Specified by:
serviceChangedin interfaceorg.osgi.framework.ServiceListener- Parameters:
event- The event to adapt.
-