You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by gn...@apache.org on 2014/03/05 16:08:31 UTC

[09/10] [KARAF-2805] Migrate shell, ssh, wrapper, kar, instance, features and bundle to the new API and switch the bin/shell script to use the new console

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java
----------------------------------------------------------------------
diff --git a/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java b/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java
index cb43813..94e4cf7 100644
--- a/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java
+++ b/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoNameCompleter.java
@@ -20,10 +20,12 @@ import java.util.List;
 
 import org.apache.karaf.features.FeaturesService;
 import org.apache.karaf.features.Repository;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
-import org.apache.karaf.shell.inject.Reference;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
 
 /**
  * {@link Completer} for Feature Repository URLs.
@@ -41,7 +43,7 @@ public class InstalledRepoNameCompleter implements Completer {
         this.featuresService = featuresService;
     }
 
-    public int complete(final String buffer, final int cursor, @SuppressWarnings("rawtypes") final List candidates) {
+    public int complete(Session session, final CommandLine commandLine, final List<String> candidates) {
         StringsCompleter delegate = new StringsCompleter();
         try {
             for (Repository repository : featuresService.listRepositories()) {
@@ -50,7 +52,7 @@ public class InstalledRepoNameCompleter implements Completer {
         } catch (Exception e) {
             // Ignore
         }
-        return delegate.complete(buffer, cursor, candidates);
+        return delegate.complete(session, commandLine, candidates);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java
----------------------------------------------------------------------
diff --git a/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java b/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java
index 9a80e12..7a760c2 100644
--- a/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java
+++ b/features/command/src/main/java/org/apache/karaf/features/command/completers/InstalledRepoUriCompleter.java
@@ -18,12 +18,14 @@ package org.apache.karaf.features.command.completers;
 
 import java.util.List;
 
-import org.apache.karaf.shell.console.completer.StringsCompleter;
-import org.apache.karaf.shell.console.Completer;
 import org.apache.karaf.features.FeaturesService;
 import org.apache.karaf.features.Repository;
-import org.apache.karaf.shell.inject.Reference;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
 
 /**
  * {@link Completer} for Feature Repository URLs.
@@ -42,7 +44,7 @@ public class InstalledRepoUriCompleter implements Completer {
         this.featuresService = featuresService;
     }
 
-    public int complete(final String buffer, final int cursor, @SuppressWarnings("rawtypes") final List candidates) {
+    public int complete(Session session, final CommandLine commandLine, final List<String> candidates) {
         StringsCompleter delegate = new StringsCompleter();
         try {
             for (Repository repository : featuresService.listRepositories()) {
@@ -51,7 +53,7 @@ public class InstalledRepoUriCompleter implements Completer {
         } catch (Exception e) {
             // Ignore
         }
-        return delegate.complete(buffer, cursor, candidates);
+        return delegate.complete(session, commandLine, candidates);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml
----------------------------------------------------------------------
diff --git a/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml b/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml
deleted file mode 100644
index 8053312..0000000
--- a/features/command/src/main/resources/OSGI-INF/blueprint/features-command.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
-    <!-- Commands -->
-
-    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.2.0"
-                    scan="org.apache.karaf.features.command.*" />
-
-</blueprint>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/pom.xml
----------------------------------------------------------------------
diff --git a/instance/command/pom.xml b/instance/command/pom.xml
index 2c75801..52058cd 100644
--- a/instance/command/pom.xml
+++ b/instance/command/pom.xml
@@ -68,7 +68,7 @@
 
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <artifactId>org.apache.karaf.shell.core</artifactId>
         </dependency>
 
         <dependency>
@@ -120,7 +120,8 @@
                              as Execute.java accesses the InstanceServiceImpl and jansi
                              (but only outside OSGi) -->
                         <Import-Package>
-                        	!org.apache.karaf.instance.core.internal,
+                        	!org.apache.karaf.shell.impl.action.command,
+                            !org.apache.karaf.instance.core.internal,
                             !org.fusesource.jansi,
                         	*
                         </Import-Package>
@@ -129,6 +130,7 @@
                             org.apache.karaf.instance.command,
                             org.apache.karaf.instance.command.completers
                         </Private-Package>
+                        <Karaf-Commands>org.apache.karaf.instance.command.*</Karaf-Commands>
                     </instructions>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeOptsCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeOptsCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeOptsCommand.java
index e2faee1..c526c07 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeOptsCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeOptsCommand.java
@@ -17,17 +17,17 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "opts-change", description = "Changes the Java options of an existing container instance.")
 @Service
 public class ChangeOptsCommand extends InstanceCommandSupport {
 
     @Argument(index = 0, name = "name", description="The name of the container instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String instance = null;
 
     @Argument(index = 1, name = "javaOpts", description = "The new Java options to set", required = true, multiValued = false)

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiRegistryPortCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiRegistryPortCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiRegistryPortCommand.java
index 148bc93..de5bfaf 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiRegistryPortCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiRegistryPortCommand.java
@@ -17,17 +17,17 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "rmi-registry-port-change", description = "Changes the RMI registry port (used by management layer) of an existing container instance.")
 @Service
 public class ChangeRmiRegistryPortCommand extends InstanceCommandSupport {
 
     @Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String instance = null;
 
     @Argument(index = 1, name = "port", description = "The new RMI registry port to set", required = true, multiValued = false)

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiServerPortCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiServerPortCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiServerPortCommand.java
index 3b6fdc4..0ac2cf7 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiServerPortCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeRmiServerPortCommand.java
@@ -17,17 +17,17 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "rmi-server-port-change", description = "Changes the RMI server port (used by management layer) of an existing instance.")
 @Service
 public class ChangeRmiServerPortCommand extends InstanceCommandSupport {
 
     @Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String instance = null;
 
     @Argument(index = 1, name = "port", description = "The new RMI server port to set", required = true, multiValued = false)

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeSshPortCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeSshPortCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeSshPortCommand.java
index 01df8ae..17ad26c 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeSshPortCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/ChangeSshPortCommand.java
@@ -17,17 +17,17 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "ssh-port-change", description = "Changes the secure shell port of an existing container instance.")
 @Service
 public class ChangeSshPortCommand extends InstanceCommandSupport {
 
     @Argument(index = 0, name = "name", description="The name of the container instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String instance = null;
 
     @Argument(index = 1, name = "port", description = "The new secure shell port to set", required = true, multiValued = false)

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java
index e5626e0..e4f28c5 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/CloneCommand.java
@@ -17,12 +17,12 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.instance.core.InstanceSettings;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 /**
  * Clone an existing instance.
@@ -50,7 +50,7 @@ public class CloneCommand extends InstanceCommandSupport {
     boolean verbose = false;
 
     @Argument(index = 0, name = "name", description = "The name of the source container instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     String name;
 
     @Argument(index = 1, name = "cloneName", description = "The name of the cloned container instance", required = true, multiValued = false)

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/ConnectCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/ConnectCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/ConnectCommand.java
index 294c348..c81a3eb 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/ConnectCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/ConnectCommand.java
@@ -21,11 +21,13 @@ package org.apache.karaf.instance.command;
 import java.util.List;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Session;
 
 @Command(scope = "instance", name = "connect", description = "Connects to an existing container instance.")
 @Service
@@ -38,12 +40,15 @@ public class ConnectCommand extends InstanceCommandSupport {
     private String password;
 
     @Argument(index = 0, name="name", description="The name of the container instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String instance = null;
 
     @Argument(index = 1, name = "command", description = "Optional command to execute", required = false, multiValued = true)
     private List<String> command;
 
+    @Reference
+    Session session;
+
     protected Object doExecute() throws Exception {
         String cmdStr = "";
         if (command != null) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java
index af3aebd..0dcc3ac 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/CreateCommand.java
@@ -20,12 +20,12 @@ import java.util.List;
 
 import org.apache.karaf.features.command.completers.AllFeatureCompleter;
 import org.apache.karaf.features.command.completers.InstalledRepoUriCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.instance.core.InstanceSettings;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 /**
  * Creates a new instance.
@@ -51,12 +51,12 @@ public class CreateCommand extends InstanceCommandSupport
     
     @Option(name = "-f", aliases = {"--feature"},
             description = "Initial features. This option can be specified multiple times to enable multiple initial features", required = false, multiValued = true)
-    @Completer(AllFeatureCompleter.class)
+    @Completion(AllFeatureCompleter.class)
     List<String> features;
     
     @Option(name = "-furl", aliases = {"--featureURL"}, 
             description = "Additional feature descriptor URLs. This option can be specified multiple times to add multiple URLs", required = false, multiValued = true)
-    @Completer(InstalledRepoUriCompleter.class)
+    @Completion(InstalledRepoUriCompleter.class)
     List<String> featureURLs;
 
     @Option(name = "-v", aliases = {"--verbose"}, description = "Display actions performed by the command (disabled by default)", required = false, multiValued = false)

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/DestroyCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/DestroyCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/DestroyCommand.java
index dbb1659..fb2964f 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/DestroyCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/DestroyCommand.java
@@ -17,10 +17,10 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 /**
  * Destroy an existing instance.
@@ -30,7 +30,7 @@ import org.apache.karaf.shell.inject.Service;
 public class DestroyCommand extends InstanceCommandSupport
 {
     @Argument(index = 0, name = "name", description= "The name of the container instance to destroy", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String instance = null;
 
     protected Object doExecute() throws Exception {

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java b/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
index b320b3c..3b0b535 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/InstanceCommandSupport.java
@@ -18,10 +18,10 @@ package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.core.Instance;
 import org.apache.karaf.instance.core.InstanceService;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.apache.karaf.shell.inject.Reference;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
 
-public abstract class InstanceCommandSupport extends OsgiCommandSupport {
+public abstract class InstanceCommandSupport implements Action {
 
     @Reference
     private InstanceService instanceService;
@@ -42,4 +42,10 @@ public abstract class InstanceCommandSupport extends OsgiCommandSupport {
         return i;
     }
 
+    @Override
+    public Object execute() throws Exception {
+        return doExecute();
+    }
+
+    protected abstract Object doExecute() throws Exception;
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java
index b15f8b1..368259a 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/ListCommand.java
@@ -17,10 +17,10 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.core.Instance;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.inject.Service;
 import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "list", description = "Lists all existing container instances.")
 @Service

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/RenameCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/RenameCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/RenameCommand.java
index 872d954..ef68400 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/RenameCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/RenameCommand.java
@@ -17,11 +17,11 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "rename", description = "Rename an existing container instance.")
 @Service
@@ -31,7 +31,7 @@ public class RenameCommand extends InstanceCommandSupport {
     boolean verbose = false;
 
     @Argument(index = 0, name = "name", description = "The name of the container instance to rename", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     String instance = null;
 
     @Argument(index = 1, name = "new-name", description = "The new name of the container instance", required = true, multiValued = false)

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java
index 9b6e464..8c52d5e 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/StartCommand.java
@@ -17,12 +17,12 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.commands.Option;
 import org.apache.karaf.instance.core.Instance;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "start", description = "Start an existing container instance.")
 @Service
@@ -38,7 +38,7 @@ public class StartCommand extends InstanceCommandSupport {
     private boolean wait;
 
     @Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String instance = null;
 
     static final String DEBUG_OPTS = " -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005";

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java
index 760dffb..82100e1 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/StatusCommand.java
@@ -18,18 +18,17 @@ package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
 import org.apache.karaf.instance.core.Instance;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "status", description = "Check the current status of an instance.")
 @Service
 public class StatusCommand extends InstanceCommandSupport {
 
     @Argument(index = 0, name = "name", description = "The name of the instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String name;
 
     protected Object doExecute() throws Exception {

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/StopCommand.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/StopCommand.java b/instance/command/src/main/java/org/apache/karaf/instance/command/StopCommand.java
index 4d540b2..6c8de10 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/StopCommand.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/StopCommand.java
@@ -17,17 +17,17 @@
 package org.apache.karaf.instance.command;
 
 import org.apache.karaf.instance.command.completers.InstanceCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "instance", name = "stop", description = "Stop an existing container instance.")
 @Service
 public class StopCommand extends InstanceCommandSupport {
 
     @Argument(index = 0, name = "name", description = "The name of the container instance", required = true, multiValued = false)
-    @Completer(InstanceCompleter.class)
+    @Completion(InstanceCompleter.class)
     private String instance = null;
 
     protected Object doExecute() throws Exception {

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java b/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java
index 5d8cc71..4468374 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/command/completers/InstanceCompleter.java
@@ -20,10 +20,12 @@ import java.util.List;
 
 import org.apache.karaf.instance.core.Instance;
 import org.apache.karaf.instance.core.InstanceService;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.inject.Reference;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
 
 /**
  * Displays a list of configured server instances for the instance commands.
@@ -39,12 +41,12 @@ public class InstanceCompleter implements Completer {
         this.instanceService = instanceService;
     }
 
-    public int complete(String buffer, int cursor, List candidates) {
+    public int complete(Session session, CommandLine commandLine, List<String> candidates) {
         StringsCompleter delegate = new StringsCompleter();
         for (Instance instance : instanceService.getInstances()) {
             delegate.getStrings().add(instance.getName());
         }
-        return delegate.complete(buffer, cursor, candidates);
+        return delegate.complete(session, commandLine, candidates);
     }
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java
----------------------------------------------------------------------
diff --git a/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java b/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java
index 1556cef..591873e 100644
--- a/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java
+++ b/instance/command/src/main/java/org/apache/karaf/instance/main/Execute.java
@@ -23,12 +23,23 @@ import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
 
-import org.apache.karaf.instance.command.*;
-import org.apache.karaf.shell.commands.Action;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.basic.DefaultActionPreparator;
+import org.apache.karaf.instance.command.ChangeOptsCommand;
+import org.apache.karaf.instance.command.ChangeRmiRegistryPortCommand;
+import org.apache.karaf.instance.command.ChangeRmiServerPortCommand;
 import org.apache.karaf.instance.command.ChangeSshPortCommand;
+import org.apache.karaf.instance.command.CloneCommand;
+import org.apache.karaf.instance.command.CreateCommand;
+import org.apache.karaf.instance.command.DestroyCommand;
+import org.apache.karaf.instance.command.InstanceCommandSupport;
+import org.apache.karaf.instance.command.ListCommand;
+import org.apache.karaf.instance.command.RenameCommand;
+import org.apache.karaf.instance.command.StartCommand;
+import org.apache.karaf.instance.command.StatusCommand;
+import org.apache.karaf.instance.command.StopCommand;
 import org.apache.karaf.instance.core.internal.InstanceServiceImpl;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.impl.action.command.DefaultActionPreparator;
 import org.fusesource.jansi.AnsiConsole;
 
 public class Execute {
@@ -136,7 +147,7 @@ public class Execute {
         InstanceServiceImpl instanceService = new InstanceServiceImpl();
         instanceService.setStorageLocation(storageFile);
         command.setInstanceService(instanceService);
-        command.execute(null);
+        command.execute();
     }
 
     private static void listCommands() {

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
----------------------------------------------------------------------
diff --git a/instance/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands b/instance/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
new file mode 100644
index 0000000..92245c7
--- /dev/null
+++ b/instance/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
@@ -0,0 +1,30 @@
+##---------------------------------------------------------------------------
+##  Licensed to the Apache Software Foundation (ASF) under one or more
+##  contributor license agreements.  See the NOTICE file distributed with
+##  this work for additional information regarding copyright ownership.
+##  The ASF licenses this file to You under the Apache License, Version 2.0
+##  (the "License"); you may not use this file except in compliance with
+##  the License.  You may obtain a copy of the License at
+##
+##     http://www.apache.org/licenses/LICENSE-2.0
+##
+##  Unless required by applicable law or agreed to in writing, software
+##  distributed under the License is distributed on an "AS IS" BASIS,
+##  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+##  See the License for the specific language governing permissions and
+##  limitations under the License.
+##---------------------------------------------------------------------------
+org.apache.karaf.instance.core.internal.InstanceServiceImpl
+org.apache.karaf.instance.command.ChangeOptsCommand
+org.apache.karaf.instance.command.ChangeRmiRegistryPortCommand
+org.apache.karaf.instance.command.ChangeRmiServerPortCommand
+org.apache.karaf.instance.command.ChangeSshPortCommand
+org.apache.karaf.instance.command.CloneCommand
+org.apache.karaf.instance.command.ConnectCommand
+org.apache.karaf.instance.command.CreateCommand
+org.apache.karaf.instance.command.DestroyCommand
+org.apache.karaf.instance.command.ListCommand
+org.apache.karaf.instance.command.RenameCommand
+org.apache.karaf.instance.command.StartCommand
+org.apache.karaf.instance.command.StatusCommand
+org.apache.karaf.instance.command.StopCommand

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml
----------------------------------------------------------------------
diff --git a/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml b/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml
deleted file mode 100644
index 4bb3520..0000000
--- a/instance/command/src/main/resources/OSGI-INF/blueprint/instance-command.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You under the Apache License, Version 2.0
-    (the "License"); you may not use this file except in compliance with
-    the License.  You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
-
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           default-activation="lazy">
-
-    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.2.0"
-                    scan="org.apache.karaf.instance.command.*" />
-
-</blueprint>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/core/pom.xml
----------------------------------------------------------------------
diff --git a/instance/core/pom.xml b/instance/core/pom.xml
index 80ae6b0..be13f18 100644
--- a/instance/core/pom.xml
+++ b/instance/core/pom.xml
@@ -59,7 +59,7 @@
 
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <artifactId>org.apache.karaf.shell.core</artifactId>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
----------------------------------------------------------------------
diff --git a/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java b/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
index 32326ba..ae03fd9 100644
--- a/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
+++ b/instance/core/src/main/java/org/apache/karaf/instance/core/internal/InstanceServiceImpl.java
@@ -94,6 +94,13 @@ public class InstanceServiceImpl implements InstanceService {
         Map<String, InstanceState> instances;
     }
 
+    public InstanceServiceImpl() {
+        String prop = System.getProperty("karaf.instances");
+        if (prop != null) {
+            storageLocation = new File(prop);
+        }
+    }
+
     public File getStorageLocation() {
         return storageLocation;
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/kar/command/pom.xml
----------------------------------------------------------------------
diff --git a/kar/command/pom.xml b/kar/command/pom.xml
index 1830ba8..67d18f5 100644
--- a/kar/command/pom.xml
+++ b/kar/command/pom.xml
@@ -50,7 +50,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <artifactId>org.apache.karaf.shell.core</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
@@ -89,6 +89,7 @@
                 <configuration>
                     <instructions>
                         <Export-Package>!*</Export-Package>
+                        <Karaf-Commands>org.apache.karaf.kar.command.*</Karaf-Commands>
                     </instructions>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
----------------------------------------------------------------------
diff --git a/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java b/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
index dbc34a6..a93706c 100644
--- a/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
+++ b/kar/command/src/main/java/org/apache/karaf/kar/command/CreateKarCommand.java
@@ -19,24 +19,31 @@ package org.apache.karaf.kar.command;
 import java.util.List;
 
 import org.apache.karaf.features.command.completers.InstalledRepoNameCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.kar.KarService;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "kar", name = "create", description = "Create a kar file for a list of feature repos")
 @Service
-public class CreateKarCommand extends KarCommandSupport {
+public class CreateKarCommand implements Action {
     
     @Argument(index = 0, name = "repoName", description = "Repository name. The kar will contain all features of the named repository by default", required = true, multiValued = false)
-    @Completer(InstalledRepoNameCompleter.class)
+    @Completion(InstalledRepoNameCompleter.class)
     private String repoName;
     
     @Argument(index = 1, name = "features", description = "Names of the features to include. If set then only these features will be added", required = false, multiValued = true)
     private List<String> features;
-    
-    public Object doExecute() throws Exception {
-        this.getKarService().create(repoName, features, System.out);
+
+    @Reference
+    private KarService karService;
+
+    @Override
+    public Object execute() throws Exception {
+        karService.create(repoName, features, System.out);
         return null;
     }
     

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/kar/command/src/main/java/org/apache/karaf/kar/command/InstallKarCommand.java
----------------------------------------------------------------------
diff --git a/kar/command/src/main/java/org/apache/karaf/kar/command/InstallKarCommand.java b/kar/command/src/main/java/org/apache/karaf/kar/command/InstallKarCommand.java
index 1053e74..806367a 100644
--- a/kar/command/src/main/java/org/apache/karaf/kar/command/InstallKarCommand.java
+++ b/kar/command/src/main/java/org/apache/karaf/kar/command/InstallKarCommand.java
@@ -16,21 +16,27 @@
  */
 package org.apache.karaf.kar.command;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.kar.KarService;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 import java.net.URI;
 
 @Command(scope = "kar", name = "install", description = "Installs a KAR file.")
 @Service
-public class InstallKarCommand extends KarCommandSupport {
-    
+public class InstallKarCommand implements Action {
+
     @Argument(index = 0, name = "url", description = "The URL of the KAR file to install.", required = true, multiValued = false)
     private String url;
-    
-    public Object doExecute() throws Exception {
-        this.getKarService().install(new URI(url));
+
+    @Reference
+    private KarService karService;
+
+    public Object execute() throws Exception {
+        karService.install(new URI(url));
         return null;
     }
     

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/kar/command/src/main/java/org/apache/karaf/kar/command/KarCommandSupport.java
----------------------------------------------------------------------
diff --git a/kar/command/src/main/java/org/apache/karaf/kar/command/KarCommandSupport.java b/kar/command/src/main/java/org/apache/karaf/kar/command/KarCommandSupport.java
deleted file mode 100644
index 3af6622..0000000
--- a/kar/command/src/main/java/org/apache/karaf/kar/command/KarCommandSupport.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.kar.command;
-
-import org.apache.karaf.kar.KarService;
-import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.apache.karaf.shell.inject.Reference;
-
-public abstract class KarCommandSupport extends OsgiCommandSupport {
-
-    @Reference
-    private KarService karService;
-    
-    public KarService getKarService() {
-        return this.karService;
-    }
-    
-    public void setKarService(KarService karService) {
-        this.karService = karService;
-    }
-    
-    public abstract Object doExecute() throws Exception;
-
-}

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/kar/command/src/main/java/org/apache/karaf/kar/command/ListKarCommand.java
----------------------------------------------------------------------
diff --git a/kar/command/src/main/java/org/apache/karaf/kar/command/ListKarCommand.java b/kar/command/src/main/java/org/apache/karaf/kar/command/ListKarCommand.java
index e1b59bb..853a743 100644
--- a/kar/command/src/main/java/org/apache/karaf/kar/command/ListKarCommand.java
+++ b/kar/command/src/main/java/org/apache/karaf/kar/command/ListKarCommand.java
@@ -16,24 +16,31 @@
  */
 package org.apache.karaf.kar.command;
 
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.kar.KarService;
 import org.apache.karaf.shell.table.ShellTable;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "kar", name = "list", description = "List the installed KAR files.")
 @Service
-public class ListKarCommand extends KarCommandSupport {
+public class ListKarCommand implements Action {
 
     @Option(name = "--no-format", description = "Disable table rendered output", required = false, multiValued = false)
     boolean noFormat;
-    
-    public Object doExecute() throws Exception {
+
+    @Reference
+    private KarService karService;
+
+    @Override
+    public Object execute() throws Exception {
 
         ShellTable table = new ShellTable();
         table.column("KAR Name");
 
-        for (String karName : this.getKarService().list()) {
+        for (String karName : karService.list()) {
             table.addRow().addContent(karName);
         }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
----------------------------------------------------------------------
diff --git a/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java b/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
index ce5664d..506bdb3 100644
--- a/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
+++ b/kar/command/src/main/java/org/apache/karaf/kar/command/UninstallKarCommand.java
@@ -16,22 +16,29 @@
  */
 package org.apache.karaf.kar.command;
 
+import org.apache.karaf.kar.KarService;
 import org.apache.karaf.kar.command.completers.KarCompleter;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Completer;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "kar", name = "uninstall", description = "Uninstall a KAR file.")
 @Service
-public class UninstallKarCommand extends KarCommandSupport {
+public class UninstallKarCommand implements Action {
 
     @Argument(index = 0, name = "name", description = "The name of the KAR file to uninstall.", required = true, multiValued = false)
-    @Completer(KarCompleter.class)
+    @Completion(KarCompleter.class)
     private String name;
 
-    public Object doExecute() throws Exception {
-        this.getKarService().uninstall(name);
+    @Reference
+    private KarService karService;
+
+    @Override
+    public Object execute() throws Exception {
+        karService.uninstall(name);
         return null;
     }
     

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/kar/command/src/main/java/org/apache/karaf/kar/command/completers/KarCompleter.java
----------------------------------------------------------------------
diff --git a/kar/command/src/main/java/org/apache/karaf/kar/command/completers/KarCompleter.java b/kar/command/src/main/java/org/apache/karaf/kar/command/completers/KarCompleter.java
index 460a21b..539cfaf 100644
--- a/kar/command/src/main/java/org/apache/karaf/kar/command/completers/KarCompleter.java
+++ b/kar/command/src/main/java/org/apache/karaf/kar/command/completers/KarCompleter.java
@@ -16,14 +16,16 @@
  */
 package org.apache.karaf.kar.command.completers;
 
-import org.apache.karaf.kar.KarService;
-import org.apache.karaf.shell.console.Completer;
-import org.apache.karaf.shell.console.completer.StringsCompleter;
-import org.apache.karaf.shell.inject.Reference;
-import org.apache.karaf.shell.inject.Service;
-
 import java.util.List;
 
+import org.apache.karaf.kar.KarService;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.CommandLine;
+import org.apache.karaf.shell.api.console.Completer;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
+
 /**
  * Completer on all installed KAR files.
  */
@@ -33,7 +35,7 @@ public class KarCompleter implements Completer {
     @Reference
     private KarService karService;
     
-    public int complete(String buffer, int cursor, @SuppressWarnings("rawtypes") List candidates) {
+    public int complete(Session session, CommandLine commandLine, List<String> candidates) {
         StringsCompleter delegate = new StringsCompleter();
         try {
             for (String karName : karService.list()) {
@@ -42,15 +44,7 @@ public class KarCompleter implements Completer {
         } catch (Exception e) {
             // ignore
         }
-        return delegate.complete(buffer, cursor, candidates);
-    }
-    
-    public void setKarService(KarService karService) {
-        this.karService = karService;
-    }
-    
-    public KarService getKarService() {
-        return this.karService;
+        return delegate.complete(session, commandLine, candidates);
     }
     
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml
----------------------------------------------------------------------
diff --git a/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml b/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml
deleted file mode 100644
index 53d56d7..0000000
--- a/kar/command/src/main/resources/OSGI-INF/blueprint/kar-command.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-        Licensed to the Apache Software Foundation (ASF) under one or more
-        contributor license agreements. See the NOTICE file distributed with
-        this work for additional information regarding copyright ownership.
-        The ASF licenses this file to You under the Apache License, Version
-        2.0 (the "License"); you may not use this file except in compliance
-        with the License. You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0 Unless required by
-        applicable law or agreed to in writing, software distributed under the
-        License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
-        CONDITIONS OF ANY KIND, either express or implied. See the License for
-        the specific language governing permissions and limitations under the
-        License.
-    -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" default-activation="lazy">
-
-    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.2.0"
-                    scan="org.apache.karaf.kar.command.*" />
-
-</blueprint>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/pom.xml
----------------------------------------------------------------------
diff --git a/shell/commands/pom.xml b/shell/commands/pom.xml
index 15fb8c7..6609cd5 100644
--- a/shell/commands/pom.xml
+++ b/shell/commands/pom.xml
@@ -40,7 +40,7 @@
     <dependencies>
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
-            <artifactId>org.apache.karaf.shell.console</artifactId>
+            <artifactId>org.apache.karaf.shell.core</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.karaf.shell</groupId>
@@ -113,6 +113,9 @@
                             org.apache.karaf.util;-split-package:=merge-first,
                             org.apache.karaf.shell.commands.impl*
                         </Private-Package>
+                        <Karaf-Commands>
+                            org.apache.karaf.shell.commands.impl
+                        </Karaf-Commands>
                     </instructions>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/InfoProvider.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/InfoProvider.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/InfoProvider.java
new file mode 100644
index 0000000..a69f824
--- /dev/null
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/InfoProvider.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.shell.commands;
+
+import java.util.Properties;
+
+/**
+ * A bundle can publish a service with this interface to offer some informations for the shell:info command
+ */
+public interface InfoProvider {
+
+    public String getName();
+
+    public Properties getProperties();
+
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java
index 298c98d..21db405 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/AliasAction.java
@@ -16,19 +16,25 @@
  */
 package org.apache.karaf.shell.commands.impl;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "shell", name = "alias", description = "Create an alias to a command")
 @Service
-public class AliasAction extends AbstractAction {
+public class AliasAction implements Action {
 
     @Argument(index = 0, name = "command", description = "The command to alias, e.g. 'ldn = { log:display -n $args }'", required = true, multiValued = false)
     private String alias;
 
-    protected Object doExecute() throws Exception {
+    @Reference
+    private Session session;
+
+    @Override
+    public Object execute() throws Exception {
         session.execute(alias);
         return null;
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CatAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CatAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CatAction.java
index 18ca32b..41ec0a6 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CatAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CatAction.java
@@ -28,18 +28,22 @@ import java.net.MalformedURLException;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Concatenate and print files and/or URLs.
  */
 @Command(scope = "shell", name = "cat", description = "Displays the content of a file or URL.")
 @Service
-public class CatAction extends AbstractAction {
+public class CatAction implements Action {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Option(name = "-n", aliases = {}, description = "Number the output lines, starting at 1.", required = false, multiValued = false)
     private boolean displayLineNumbers;
@@ -50,7 +54,8 @@ public class CatAction extends AbstractAction {
     @Argument(index = 0, name = "paths or urls", description = "A list of file paths or urls to display separated by whitespace (use - for STDIN)", required = false, multiValued = true)
     private List<String> paths;
 
-    protected Object doExecute() throws Exception {
+    @Override
+    public Object execute() throws Exception {
         if (stdin) {
             paths = Collections.singletonList("-");
         }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ClearAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ClearAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ClearAction.java
index ac660eb..805ec25 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ClearAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ClearAction.java
@@ -16,23 +16,24 @@
  */
 package org.apache.karaf.shell.commands.impl;
 
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 /**
  * A command to clear the console buffer
  */
 @Command(scope = "shell", name = "clear", description = "Clears the console buffer.")
 @Service
-public class ClearAction extends AbstractAction {
+public class ClearAction implements Action {
 
-	protected Object doExecute() throws Exception {
+    @Override
+    public Object execute() throws Exception {
 		System.out.print("\33[2J");
 		System.out.flush();
 		System.out.print("\33[1;1H");
 		System.out.flush();
-		return null;
-	}	
+        return null;
+	}
 
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java
index 2639039..614d2b1 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/CompletionAction.java
@@ -16,36 +16,38 @@
  */
 package org.apache.karaf.shell.commands.impl;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.console.SessionProperties;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Completion;
+import org.apache.karaf.shell.api.console.Session;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.support.completers.StringsCompleter;
 
 /**
  * Command to change the completion mode while using the shell console.
  */
 @Command(scope = "shell", name = "completion", description = "Display or change the completion mode on the current console session.")
 @Service
-public class CompletionAction extends AbstractAction {
+public class CompletionAction implements Action {
 
     @Argument(index = 0, name = "mode", description = "The completion mode to set. The valid completion modes are: global, first, subshell.", required = false, multiValued = false)
+    @Completion(value = StringsCompleter.class, values = { "global", "first", "subshell" })
     String mode;
 
-    protected Object doExecute() throws Exception {
-        if (mode == null) {
-            System.out.println(session.get(SessionProperties.COMPLETION_MODE));
-            return null;
-        }
+    @Reference
+    Session session;
 
-        if (!mode.equalsIgnoreCase("global") && !mode.equalsIgnoreCase("first") && !mode.equalsIgnoreCase("subshell")) {
+    @Override
+    public Object execute() throws Exception {
+        if (mode == null) {
+            System.out.println(session.get(Session.COMPLETION_MODE));
+        } else if (!mode.equalsIgnoreCase("global") && !mode.equalsIgnoreCase("first") && !mode.equalsIgnoreCase("subshell")) {
             System.err.println("The completion mode is not correct. The valid modes are: global, first, subshell. See documentation for details.");
-            return null;
+        } else {
+            session.put(Session.COMPLETION_MODE, mode.toLowerCase());
         }
-
-        mode = mode.toUpperCase();
-
-        session.put(SessionProperties.COMPLETION_MODE, mode);
         return null;
     }
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java
index e448fd7..c201ab0 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/DateAction.java
@@ -16,11 +16,11 @@
  */
 package org.apache.karaf.shell.commands.impl;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
@@ -28,7 +28,7 @@ import java.util.Date;
 
 @Command(scope = "shell", name = "date", description = "Display the current time in the given FORMAT")
 @Service
-public class DateAction extends AbstractAction {
+public class DateAction implements Action {
 
     @Option(name = "-d", aliases = { "--date" }, description = "Display time described, not now", multiValued = false, required = false)
     private String date;
@@ -36,7 +36,8 @@ public class DateAction extends AbstractAction {
     @Argument(index = 0, name = "format", description = "Output format", multiValued = false, required = false)
     private String format;
 
-    protected Object doExecute() throws Exception {
+    @Override
+    public Object execute() throws Exception {
         Date d;
         if (date == null || date.equalsIgnoreCase("now")) {
             d = new Date();

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EachAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EachAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EachAction.java
index a115939..0de344e 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EachAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EachAction.java
@@ -19,18 +19,20 @@ package org.apache.karaf.shell.commands.impl;
 import java.util.Collection;
 import java.util.Collections;
 
-import org.apache.felix.service.command.Function;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.apache.karaf.shell.api.console.Function;
+import org.apache.karaf.shell.api.console.Session;
 
 /**
  * Execute a closure on a list of arguments.
  */
 @Command(scope = "shell", name = "each", description = "Execute a closure on a list of arguments.")
 @Service
-public class EachAction extends AbstractAction {
+public class EachAction implements Action {
 
     @Argument(name = "values", index = 0, multiValued = false, required = true, description = "The collection of arguments to iterate on")
     Collection<Object> values;
@@ -38,8 +40,11 @@ public class EachAction extends AbstractAction {
     @Argument(name = "function", index = 1, multiValued = false, required = true, description = "The function to execute")
     Function function;
 
+    @Reference
+    Session session;
+
     @Override
-    protected Object doExecute() throws Exception {
+    public Object execute() throws Exception {
         for (Object v : values) {
             function.execute(session, Collections.singletonList(v));
         }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EchoAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EchoAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EchoAction.java
index 4eda5d3..433e2a9 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EchoAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EchoAction.java
@@ -18,15 +18,15 @@ package org.apache.karaf.shell.commands.impl;
 
 import java.util.List;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 
 @Command(scope = "shell", name = "echo", description="Echoes or prints arguments to STDOUT.")
 @Service
-public class EchoAction extends AbstractAction
+public class EchoAction implements Action
 {
     @Option(name = "-n", aliases = {}, description = "Do not print the trailing newline character", required = false, multiValued = false)
     private boolean noTrailingNewline = false;
@@ -34,7 +34,8 @@ public class EchoAction extends AbstractAction
     @Argument(index = 0, name = "arguments", description="Arguments to display separated by whitespaces", required = false, multiValued = true)
     private List<String> args;
 
-    protected Object doExecute() throws Exception {
+    @Override
+    public Object execute() throws Exception {
         if (args != null) {
             boolean first = true;
             for (String arg : args) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java
index dc2d90c..77b9a09 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/EditAction.java
@@ -27,19 +27,20 @@ import java.net.URLConnection;
 import java.util.UUID;
 import java.util.regex.Pattern;
 
-import jline.Terminal;
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Reference;
-import org.apache.karaf.shell.inject.Service;
+import jline.TerminalSupport;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.console.Terminal;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.apache.karaf.util.StreamUtils;
 import org.jledit.ConsoleEditor;
 import org.jledit.EditorFactory;
 
 @Command(scope = "shell", name = "edit", description = "Calls a text editor.")
 @Service
-public class EditAction extends AbstractAction {
+public class EditAction implements Action {
 
     private final Pattern URL_PATTERN = Pattern.compile("[^: ]+:[^ ]+");
 
@@ -49,8 +50,11 @@ public class EditAction extends AbstractAction {
     @Reference
     private EditorFactory editorFactory;
 
+    @Reference
+    Terminal terminal;
+
     @Override
-    protected Object doExecute() throws Exception {
+    public Object execute() throws Exception {
         URLConnection connection = null;
         InputStream is = null;
         OutputStream os = null;
@@ -137,6 +141,7 @@ public class EditAction extends AbstractAction {
         if (os != null) {
             StreamUtils.close(os);
         }
+
         return null;
     }
 
@@ -146,13 +151,22 @@ public class EditAction extends AbstractAction {
      * @return
      * @throws Exception
      */
-    private Terminal getTerminal() throws Exception {
-        Object terminalObject = session.get(".jline.terminal");
-        if (terminalObject instanceof Terminal) {
-            return (Terminal) terminalObject;
+    private jline.Terminal getTerminal() throws Exception {
+        try {
+            return (jline.Terminal) terminal.getClass().getMethod("getTerminal").invoke(terminal);
+        } catch (Throwable t) {
+            return new TerminalSupport(true) {
+                @Override
+                public int getWidth() {
+                    return terminal.getWidth();
+                }
 
+                @Override
+                public int getHeight() {
+                    return terminal.getHeight();
+                }
+            };
         }
-        throw new IllegalStateException("Could not get Terminal from CommandSession.");
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ExecuteAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ExecuteAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ExecuteAction.java
index 677f3de..0afe73d 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ExecuteAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/ExecuteAction.java
@@ -18,23 +18,28 @@ package org.apache.karaf.shell.commands.impl;
 
 import java.util.List;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.apache.karaf.util.process.PumpStreamHandler;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Execute system processes.
  */
 @Command(scope = "shell", name = "exec", description = "Executes system processes.")
 @Service
-public class ExecuteAction extends AbstractAction {
+public class ExecuteAction implements Action {
+
+    private final Logger log = LoggerFactory.getLogger(getClass());
 
     @Argument(index = 0, name = "command", description = "Execution command with arguments", required = true, multiValued = true)
     private List<String> args;
 
-    protected Object doExecute() throws Exception {
+    @Override
+    public Object execute() throws Exception {
         ProcessBuilder builder = new ProcessBuilder(args);
 
         PumpStreamHandler handler = new PumpStreamHandler(System.in, System.out, System.err, "Command" + args.toString());

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java
index 8ed0f76..573714e 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/GrepAction.java
@@ -26,17 +26,17 @@ import java.util.List;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.fusesource.jansi.Ansi;
 
 
 @Command(scope = "shell", name="grep", description="Prints lines matching the given pattern.", detailedDescription="classpath:grep.txt")
 @Service
-public class GrepAction extends AbstractAction {
+public class GrepAction implements Action {
 
     public static enum ColorOption {
         never,
@@ -82,8 +82,8 @@ public class GrepAction extends AbstractAction {
     @Option(name = "-C", aliases = { "--context" }, description = "Print NUM lines of output context.  Places a line containing -- between contiguous groups of matches.", required = false, multiValued = false)
     private int context = 0;
 
-
-    protected Object doExecute() throws Exception {
+    @Override
+    public Object execute() throws Exception {
         if (after < 0) {
             after = context;
         }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HeadAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HeadAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HeadAction.java
index 9a05935..ad144d4 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HeadAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HeadAction.java
@@ -25,25 +25,30 @@ import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.List;
 
-import org.apache.karaf.shell.commands.Argument;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Argument;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 @Command(scope = "shell", name = "head", description = "Displays the first lines of a file.")
 @Service
-public class HeadAction extends AbstractAction {
+public class HeadAction implements Action {
 
     private static final int DEFAULT_NUMBER_OF_LINES = 10;
 
+    private final Logger log = LoggerFactory.getLogger(getClass());
+
     @Option(name = "-n", aliases = {}, description = "The number of lines to display, starting at 1.", required = false, multiValued = false)
     private int numberOfLines;
 
     @Argument(index = 0, name = "paths or urls", description = "A list of file paths or urls to display separated by whitespaces.", required = false, multiValued = true)
     private List<String> paths;
 
-    protected Object doExecute() throws Exception {
+    @Override
+    public Object execute() throws Exception {
         //If no paths provided assume standar input
         if (paths == null || paths.size() == 0) {
             if (log.isDebugEnabled()) {

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java
----------------------------------------------------------------------
diff --git a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java
index 6c7dae6..09ddeb1 100644
--- a/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java
+++ b/shell/commands/src/main/java/org/apache/karaf/shell/commands/impl/HistoryAction.java
@@ -16,11 +16,12 @@
  */
 package org.apache.karaf.shell.commands.impl;
 
-import jline.console.history.History;
-import org.apache.karaf.shell.commands.Command;
-import org.apache.karaf.shell.commands.Option;
-import org.apache.karaf.shell.console.AbstractAction;
-import org.apache.karaf.shell.inject.Service;
+import org.apache.karaf.shell.api.action.Action;
+import org.apache.karaf.shell.api.action.Command;
+import org.apache.karaf.shell.api.action.Option;
+import org.apache.karaf.shell.api.console.History;
+import org.apache.karaf.shell.api.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.fusesource.jansi.Ansi;
 
 /**
@@ -28,28 +29,29 @@ import org.fusesource.jansi.Ansi;
  */
 @Command(scope = "shell", name="history", description="Prints command history.")
 @Service
-public class HistoryAction extends AbstractAction {
+public class HistoryAction implements Action {
 
     @Option(name = "-c", aliases = { "--clear" }, description = "Clears the shell command history.", required = false, multiValued = false)
     private boolean clear;
-    
-    @Override
-    protected Object doExecute() throws Exception {
-        History history = (History) session.get(".jline.history");       
 
+    @Reference
+    History history;
+
+    @Override
+    public Object execute() throws Exception {
         if (history != null && clear) {
             history.clear();
         }
-        
-        for (History.Entry element : history) {
+        for (int index = history.first(); index <= history.last(); index++) {
             System.out.println(
                     Ansi.ansi()
                         .a("  ")
-                        .a(Ansi.Attribute.INTENSITY_BOLD).render("%3d", element.index()).a(Ansi.Attribute.INTENSITY_BOLD_OFF)
+                        .a(Ansi.Attribute.INTENSITY_BOLD).render("%3d", index).a(Ansi.Attribute.INTENSITY_BOLD_OFF)
                         .a("  ")
-                        .a(element.value())
+                        .a(history.get(index))
                         .toString());
         }
         return null;
     }
+
 }