com.effectiveosgi.rt.command.CommandProcessorTracker Maven / Gradle / Ivy
package com.effectiveosgi.rt.command;
import org.apache.felix.service.command.CommandProcessor;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
class CommandProcessorTracker extends ServiceTracker {
CommandProcessorTracker(BundleContext context) {
super(context, CommandProcessor.class, null);
}
@Override
public CommandArgsTracker addingService(ServiceReference reference) {
final CommandProcessor processor = context.getService(reference);
CommandArgsTracker argsTracker = new CommandArgsTracker(context, processor);
argsTracker.open();
return argsTracker;
}
@Override
public void removedService(ServiceReference reference, CommandArgsTracker tracker) {
tracker.close();
context.ungetService(reference);
}
}