Search in sources :

Example 1 with Tracer

use of org.apache.sling.ide.eclipse.core.debug.impl.Tracer in project sling by apache.

the class PluginLoggerRegistrar method register.

/**
     * Registers a new tracer for the specified plugin
     * 
     * @param plugin the plugin to register for
     * @return the service registration
     */
public static ServiceRegistration<Logger> register(Plugin plugin) {
    Dictionary<String, Object> props = new Hashtable<>();
    props.put(DebugOptions.LISTENER_SYMBOLICNAME, plugin.getBundle().getSymbolicName());
    BundleContext ctx = plugin.getBundle().getBundleContext();
    // safe to downcast since we are registering the Tracer which implements Logger
    @SuppressWarnings("unchecked") ServiceRegistration<Logger> serviceRegistration = (ServiceRegistration<Logger>) ctx.registerService(new String[] { DebugOptionsListener.class.getName(), Logger.class.getName() }, new Tracer(plugin), props);
    return serviceRegistration;
}
Also used : Hashtable(java.util.Hashtable) Tracer(org.apache.sling.ide.eclipse.core.debug.impl.Tracer) Logger(org.apache.sling.ide.log.Logger) BundleContext(org.osgi.framework.BundleContext) ServiceRegistration(org.osgi.framework.ServiceRegistration)

Aggregations

Hashtable (java.util.Hashtable)1 Tracer (org.apache.sling.ide.eclipse.core.debug.impl.Tracer)1 Logger (org.apache.sling.ide.log.Logger)1 BundleContext (org.osgi.framework.BundleContext)1 ServiceRegistration (org.osgi.framework.ServiceRegistration)1