You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2019/04/08 05:41:23 UTC

[karaf] branch karaf-4.2.x updated: [KARAF-6208] Register CommandProcessor service in Karaf shell

This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch karaf-4.2.x
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/karaf-4.2.x by this push:
     new a4ea885  [KARAF-6208] Register CommandProcessor service in Karaf shell
a4ea885 is described below

commit a4ea885066486e27b13767593f4409cb43eb6a75
Author: Jean-Baptiste Onofré <jb...@apache.org>
AuthorDate: Fri Apr 5 18:49:18 2019 +0200

    [KARAF-6208] Register CommandProcessor service in Karaf shell
---
 .../main/java/org/apache/karaf/shell/impl/console/osgi/Activator.java | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/Activator.java b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/Activator.java
index 84c1e05..b3a5c5c 100644
--- a/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/Activator.java
+++ b/shell/core/src/main/java/org/apache/karaf/shell/impl/console/osgi/Activator.java
@@ -22,6 +22,7 @@ import java.io.Closeable;
 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;
@@ -46,6 +47,7 @@ public class Activator implements BundleActivator {
 
     private SessionFactoryImpl sessionFactory;
     private ServiceRegistration<SessionFactory> sessionFactoryRegistration;
+    private ServiceRegistration<CommandProcessor> commandProcessorRegistration;
 
     private CommandExtender actionExtender;
 
@@ -106,6 +108,7 @@ public class Activator implements BundleActivator {
         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);
@@ -130,6 +133,7 @@ public class Activator implements BundleActivator {
     @Override
     public void stop(BundleContext context) throws Exception {
         filterTracker.close();
+        commandProcessorRegistration.unregister();
         sessionFactoryRegistration.unregister();
         if (localConsoleManager != null) {
             localConsoleManager.stop();