Package de.mnl.osgi.osgi2jul
Class ForwardingManager
- java.lang.Object
-
- de.mnl.osgi.coreutils.ServiceResolver
-
- de.mnl.osgi.osgi2jul.ForwardingManager
-
- All Implemented Interfaces:
AutoCloseable
,BundleActivator
public class ForwardingManager extends de.mnl.osgi.coreutils.ServiceResolver
This class provides the activator for this service. It registers (respectively unregisters) theLogWriter
as LogListener for for all log reader services and forwards any already existing log entries to it.
-
-
Constructor Summary
Constructors Constructor Description ForwardingManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure()
Open the log service tracker.protected void
onDissolving()
protected void
onRebound(String dependency)
protected void
onResolved()
void
publish(LogEntry entry, LogRecord record)
Send the record to all handlers.void
stop(BundleContext context)
-
Methods inherited from class de.mnl.osgi.coreutils.ServiceResolver
addDependency, addDependency, addDependency, addDependency, addOptionalDependency, addOptionalDependency, addOptionalDependency, addOptionalDependency, close, get, get, isOpen, isResolved, open, optional, optional, setOnDissolving, setOnRebound, setOnResolved, start, with, with
-
-
-
-
Constructor Detail
-
ForwardingManager
public ForwardingManager()
-
-
Method Detail
-
configure
public void configure()
Open the log service tracker. The tracker is customized to attach aLogWriter
to all registered log reader services (and detach it on un-registration, of course). Already existing log entries are forwarded to theLogWriter
as well. No provisions have been taken to avoid the duplicate output that can occur if a message is logged between registering theLogWriter
and forwarding stored log entries.- Overrides:
configure
in classde.mnl.osgi.coreutils.ServiceResolver
-
onResolved
protected void onResolved()
- Overrides:
onResolved
in classde.mnl.osgi.coreutils.ServiceResolver
-
onRebound
protected void onRebound(String dependency)
- Overrides:
onRebound
in classde.mnl.osgi.coreutils.ServiceResolver
-
onDissolving
protected void onDissolving()
- Overrides:
onDissolving
in classde.mnl.osgi.coreutils.ServiceResolver
-
stop
public void stop(BundleContext context) throws Exception
- Specified by:
stop
in interfaceBundleActivator
- Overrides:
stop
in classde.mnl.osgi.coreutils.ServiceResolver
- Throws:
Exception
-
-