On 6/24/11 20:23, [email protected] wrote:
I have the following bundle activator which implements both
FrameworkListener and BundleListener,
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.FrameworkListener;
public class ListenerActivator implements BundleActivator,
FrameworkListener, BundleListener
{
private int invoked = 0;
public void start(BundleContext bundleContext) throws Exception
{
// Add the listeners
System.out.println("Adding listeners");
bundleContext.addFrameworkListener(this);
bundleContext.addBundleListener(this);
}
public void stop(BundleContext bundleContext) throws Exception
{
// Remove the listeners
System.out.println("Removing listeners " + invoked);
bundleContext.removeFrameworkListener(this);
bundleContext.removeBundleListener(this);
}
public void frameworkEvent(FrameworkEvent event)
{
System.out.println("\tFrameworkEvent(type=" + event.getType() +
",bundle=" + event.getBundle() +
",source=" + event.getSource() +
",throwable=" + event.getThrowable() + ")");
invoked++;
}
public void bundleChanged(BundleEvent event)
{
System.out.println("\tBundleEvent(type=" + event.getType() +
",bundle=" + event.getBundle() +
",source=" + event.getSource() + ")");
invoked++;
}
}
However, when I run this in karaf the System.out.println calls within
the start/stop methods work but the ones within frameworkEvent and
bundleChanged do not. I know they are being invoked because the stop
method displays an integer value larger than zero. Why isn't
System.out working?
I'm guessing someone is grabbing stdout and setting it to something
else, perhaps for logging.
-> richard
-John
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]