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:32:34 UTC

[karaf] branch master 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 master
in repository https://gitbox.apache.org/repos/asf/karaf.git


The following commit(s) were added to refs/heads/master by this push:
     new 91f2082  [KARAF-6208] Register CommandProcessor service in Karaf shell
     new be15d97  Merge pull request #803 from jbonofre/KARAF-6208
91f2082 is described below

commit 91f2082b66ad2d6ce5f3731912c5117ef10f248c
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/scr/state/ScrBundleStateService.java   | 4 +++-
 .../main/java/org/apache/karaf/shell/impl/console/osgi/Activator.java | 4 ++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/scr/state/src/main/java/org/apache/karaf/scr/state/ScrBundleStateService.java b/scr/state/src/main/java/org/apache/karaf/scr/state/ScrBundleStateService.java
index 8d4b1b7..3a72307 100644
--- a/scr/state/src/main/java/org/apache/karaf/scr/state/ScrBundleStateService.java
+++ b/scr/state/src/main/java/org/apache/karaf/scr/state/ScrBundleStateService.java
@@ -30,7 +30,9 @@ import org.osgi.service.component.annotations.Reference;
 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
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();