Skip to content

Commit

Permalink
[KARAF-6208] Register CommandProcessor service in Karaf shell
Browse files Browse the repository at this point in the history
  • Loading branch information
jbonofre committed Apr 7, 2019
1 parent 9cf8588 commit 91f2082
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
import org.osgi.service.component.runtime.ServiceComponentRuntime;
import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;

@Component
@Component(
name = "ServiceComponentRuntimeBundleStateService"
)
public class ScrBundleStateService implements BundleStateService {

@Reference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.concurrent.CopyOnWriteArraySet;

import org.apache.felix.gogo.runtime.threadio.ThreadIOImpl;
import org.apache.felix.service.command.CommandProcessor;
import org.apache.karaf.shell.api.console.CommandLoggingFilter;
import org.apache.karaf.shell.api.console.SessionFactory;
import org.apache.karaf.shell.impl.action.command.ManagerImpl;
Expand All @@ -46,6 +47,7 @@ public class Activator implements BundleActivator {

private SessionFactoryImpl sessionFactory;
private ServiceRegistration<SessionFactory> sessionFactoryRegistration;
private ServiceRegistration<CommandProcessor> commandProcessorRegistration;

private CommandExtender actionExtender;

Expand Down Expand Up @@ -106,6 +108,7 @@ public void removedService(ServiceReference<CommandLoggingFilter> reference, Com
sessionFactory.register(new ManagerImpl(sessionFactory, sessionFactory));

sessionFactoryRegistration = context.registerService(SessionFactory.class, sessionFactory, null);
commandProcessorRegistration = context.registerService(CommandProcessor.class, sessionFactory.getCommandProcessor(), null);

actionExtender = new CommandExtender(sessionFactory);
actionExtender.start(context);
Expand All @@ -130,6 +133,7 @@ public void removedService(ServiceReference<CommandLoggingFilter> reference, Com
@Override
public void stop(BundleContext context) throws Exception {
filterTracker.close();
commandProcessorRegistration.unregister();
sessionFactoryRegistration.unregister();
if (localConsoleManager != null) {
localConsoleManager.stop();
Expand Down

0 comments on commit 91f2082

Please sign in to comment.