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:29 UTC

[07/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/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java
index 9961c3c..fa24169 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshTerminal.java
@@ -18,26 +18,18 @@
  */
 package org.apache.karaf.shell.ssh;
 
-import jline.TerminalSupport;
+import org.apache.karaf.shell.api.console.Terminal;
 import org.apache.sshd.server.Environment;
 
-public class SshTerminal extends TerminalSupport {
+public class SshTerminal implements Terminal {
 
     private Environment environment;
 
 
     public SshTerminal(Environment environment) {
-        super(true);
-        setAnsiSupported(true);
         this.environment = environment;
     }
 
-    public void init() throws Exception {
-    }
-
-    public void restore() throws Exception {
-    }
-
     @Override
     public int getWidth() {
         int width = 0;
@@ -46,7 +38,7 @@ public class SshTerminal extends TerminalSupport {
         } catch (Throwable t) {
             // Ignore
         }
-        return width > 0 ? width : super.getWidth();
+        return width > 0 ? width : 80;
     }
 
     @Override
@@ -57,7 +49,21 @@ public class SshTerminal extends TerminalSupport {
         } catch (Throwable t) {
             // Ignore
         }
-        return height > 0 ? height : super.getHeight();
+        return height > 0 ? height : 24;
+    }
+
+    @Override
+    public boolean isAnsiSupported() {
+        return true;
+    }
+
+    @Override
+    public boolean isEchoEnabled() {
+        return true;
     }
 
+    @Override
+    public void setEchoEnabled(boolean enabled) {
+        // TODO: how to disable echo over ssh ?
+    }
 }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/UserAuthFactoriesFactory.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/UserAuthFactoriesFactory.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/UserAuthFactoriesFactory.java
index ae49e61..94d71a3 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/UserAuthFactoriesFactory.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/UserAuthFactoriesFactory.java
@@ -23,8 +23,6 @@ import org.apache.sshd.server.UserAuth;
 import org.apache.sshd.server.auth.UserAuthKeyboardInteractive;
 import org.apache.sshd.server.auth.UserAuthPassword;
 import org.apache.sshd.server.auth.UserAuthPublicKey;
-import org.osgi.service.blueprint.container.ComponentDefinitionException;
-import org.osgi.service.blueprint.container.ReifiedType;
 
 import java.lang.reflect.ParameterizedType;
 import java.util.ArrayList;
@@ -34,7 +32,7 @@ import java.util.Set;
 
 /**
  * <p>A factory for user authentication factories to set on
- * {@link SshServer#setUserAuthFactories(java.util.List)} based on a
+ * {@link org.apache.sshd.SshServer#setUserAuthFactories(java.util.List)} based on a
  * comma-separated list of authentication methods.</p>
  *
  * <p>Currently, the following methods are supported:</p>
@@ -55,33 +53,6 @@ public class UserAuthFactoriesFactory {
     private Set<String> methodSet;
     private List<NamedFactory<UserAuth>> factories;
 
-    public static Converter getConverter() {
-        return new Converter();
-    }
-
-    /**
-     * This blueprint type converter silently converts instances of
-     * <code>Class X implements NameFactory</code>
-     * to the reified type <code>cNameFactory</code>
-     * and therefore helps blueprint to set the returned factories on
-     * {@link SshServerAction#setUserAuthFactories(List)} without complaining
-     * about type conversion errors.
-     */
-    public static class Converter implements org.osgi.service.blueprint.container.Converter {
-
-        public boolean canConvert(Object sourceObject, ReifiedType targetType) {
-            return NamedFactory.class.isAssignableFrom(sourceObject.getClass())
-                    && UserAuth.class.equals(((ParameterizedType) sourceObject.getClass().getGenericInterfaces()[0]).getActualTypeArguments()[0])
-                    && NamedFactory.class.equals(targetType.getRawClass())
-                    && UserAuth.class.equals(targetType.getActualTypeArgument(0).getRawClass());
-        }
-
-        public Object convert(Object sourceObject, ReifiedType targetType) throws Exception {
-            return sourceObject;
-        }
-
-    }
-
     public void setAuthMethods(String methods) {
         this.methodSet = new HashSet<String>();
         this.factories = new ArrayList<NamedFactory<UserAuth>>();
@@ -94,7 +65,7 @@ public class UserAuthFactoriesFactory {
             } else if (PUBLICKEY_METHOD.equals(am)) {
                 this.factories.add(new UserAuthPublicKey.Factory());
             } else {
-                throw new ComponentDefinitionException("Invalid authentication method " + am + " specified");
+                throw new IllegalArgumentException("Invalid authentication method " + am + " specified");
             }
             this.methodSet.add(am);
         }

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/util/SingleServiceTracker.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/util/SingleServiceTracker.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/util/SingleServiceTracker.java
new file mode 100644
index 0000000..c883dc0
--- /dev/null
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/util/SingleServiceTracker.java
@@ -0,0 +1,171 @@
+/*
+ * 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.ssh.util;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Filter;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+//This is from aries util
+public final class SingleServiceTracker<T> {
+    public static interface SingleServiceListener {
+        public void serviceFound();
+
+        public void serviceLost();
+
+        public void serviceReplaced();
+    }
+
+    private final BundleContext ctx;
+    private final String className;
+    private final AtomicReference<T> service = new AtomicReference<T>();
+    private final AtomicReference<ServiceReference> ref = new AtomicReference<ServiceReference>();
+    private final AtomicBoolean open = new AtomicBoolean(false);
+    private final SingleServiceListener serviceListener;
+    private String filterString;
+    private Filter filter;
+
+    private final ServiceListener listener = new ServiceListener() {
+        public void serviceChanged(ServiceEvent event) {
+            if (open.get()) {
+                if (event.getType() == ServiceEvent.UNREGISTERING) {
+                    ServiceReference deadRef = event.getServiceReference();
+                    if (deadRef.equals(ref.get())) {
+                        findMatchingReference(deadRef);
+                    }
+                } else if (event.getType() == ServiceEvent.REGISTERED && ref.get() == null) {
+                    findMatchingReference(null);
+                }
+            }
+        }
+    };
+
+    public SingleServiceTracker(BundleContext context, Class<T> clazz, SingleServiceListener sl) {
+        ctx = context;
+        this.className = clazz.getName();
+        serviceListener = sl;
+    }
+
+    public SingleServiceTracker(BundleContext context, Class<T> clazz, String filterString, SingleServiceListener sl) throws InvalidSyntaxException {
+        this(context, clazz, sl);
+        this.filterString = filterString;
+        if (filterString != null) filter = context.createFilter(filterString);
+    }
+
+    public T getService() {
+        return service.get();
+    }
+
+    public ServiceReference getServiceReference() {
+        return ref.get();
+    }
+
+    public void open() {
+        if (open.compareAndSet(false, true)) {
+            try {
+                String filterString = '(' + Constants.OBJECTCLASS + '=' + className + ')';
+                if (filter != null) filterString = "(&" + filterString + filter + ')';
+                ctx.addServiceListener(listener, filterString);
+                findMatchingReference(null);
+            } catch (InvalidSyntaxException e) {
+                // this can never happen. (famous last words :)
+            }
+        }
+    }
+
+    private void findMatchingReference(ServiceReference original) {
+        boolean clear = true;
+        ServiceReference ref = ctx.getServiceReference(className);
+        if (ref != null && (filter == null || filter.match(ref))) {
+            @SuppressWarnings("unchecked")
+            T service = (T) ctx.getService(ref);
+            if (service != null) {
+                clear = false;
+
+                // We do the unget out of the lock so we don't exit this class while holding a lock.
+                if (!!!update(original, ref, service)) {
+                    ctx.ungetService(ref);
+                }
+            }
+        } else if (original == null) {
+            clear = false;
+        }
+
+        if (clear) {
+            update(original, null, null);
+        }
+    }
+
+    private boolean update(ServiceReference deadRef, ServiceReference newRef, T service) {
+        boolean result = false;
+        int foundLostReplaced = -1;
+
+        // Make sure we don't try to get a lock on null
+        Object lock;
+
+        // we have to choose our lock.
+        if (newRef != null) lock = newRef;
+        else if (deadRef != null) lock = deadRef;
+        else lock = this;
+
+        // This lock is here to ensure that no two threads can set the ref and service
+        // at the same time.
+        synchronized (lock) {
+            if (open.get()) {
+                result = this.ref.compareAndSet(deadRef, newRef);
+                if (result) {
+                    this.service.set(service);
+
+                    if (deadRef == null && newRef != null) foundLostReplaced = 0;
+                    if (deadRef != null && newRef == null) foundLostReplaced = 1;
+                    if (deadRef != null && newRef != null) foundLostReplaced = 2;
+                }
+            }
+        }
+
+        if (serviceListener != null) {
+            if (foundLostReplaced == 0) serviceListener.serviceFound();
+            else if (foundLostReplaced == 1) serviceListener.serviceLost();
+            else if (foundLostReplaced == 2) serviceListener.serviceReplaced();
+        }
+
+        return result;
+    }
+
+    public void close() {
+        if (open.compareAndSet(true, false)) {
+            ctx.removeServiceListener(listener);
+
+            synchronized (this) {
+                ServiceReference deadRef = ref.getAndSet(null);
+                service.set(null);
+                if (deadRef != null) ctx.ungetService(deadRef);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/ssh/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/resources/META-INF/services/org/apache/karaf/shell/commands b/shell/ssh/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
new file mode 100644
index 0000000..44d0683
--- /dev/null
+++ b/shell/ssh/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
@@ -0,0 +1,17 @@
+##---------------------------------------------------------------------------
+##  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.shell.ssh.ActivatorNoOsgi

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml b/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml
deleted file mode 100644
index 7a58288..0000000
--- a/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml
+++ /dev/null
@@ -1,149 +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"
-           xmlns:bp="http://www.osgi.org/xmlns/blueprint/v1.0.0"
-           xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
-           xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
-           default-activation="lazy">
-
-    <type-converters>
-        <bean class="org.apache.karaf.shell.ssh.ShellFactoryImpl" factory-method="getConverter" />
-        <bean class="org.apache.karaf.shell.ssh.UserAuthFactoriesFactory" factory-method="getConverter" />
-    </type-converters>
-    
-    <reference id="consoleFactory" interface="org.apache.karaf.shell.console.factory.ConsoleFactory" />
-
-    <ext:property-placeholder placeholder-prefix="$[" placeholder-suffix="]">
-        <ext:default-properties>
-            <ext:property name="karaf.startRemoteShell" value="true" />
-        </ext:default-properties>
-    </ext:property-placeholder>
-
-    <cm:property-placeholder persistent-id="org.apache.karaf.shell" update-strategy="reload">
-        <cm:default-properties>
-            <cm:property name="sshPort" value="8101"/>
-            <cm:property name="sshHost" value="0.0.0.0"/>
-            <cm:property name="sshIdleTimeout" value="1800000"/>
-            <cm:property name="sshRealm" value="karaf"/>
-            <cm:property name="hostKey" value="$[karaf.base]/etc/host.key"/>
-            <cm:property name="authorizedKeys" value="$[karaf.base]/etc/authorized_keys"/>
-            <cm:property name="authMethods" value="keyboard-interactive,password,publickey"/>
-            <cm:property name="keySize" value="1024"/>
-            <cm:property name="algorithm" value="DSA"/>
-            <cm:property name="macs" value="hmac-sha1" />
-            <cm:property name="ciphers" value="aes256-ctr,aes192-ctr,aes128-ctr,arcfour256" />
-        </cm:default-properties>
-    </cm:property-placeholder>
-
-    <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
-        <command>
-            <action class="org.apache.karaf.shell.ssh.SshAction">
-                <property name="sshClientFactory" ref="sshClientFactory" />
-            </action>
-        </command>
-        <command>
-            <action class="org.apache.karaf.shell.ssh.SshServerAction">
-                <property name="sshServerId">
-                    <bp:idref component-id="sshServer"/>
-                </property>
-            </action>
-        </command>
-    </command-bundle>
-    
-    <bean id="sshClientFactory" class="org.apache.karaf.shell.ssh.SshClientFactory">
-        <argument ref="agentFactory" />
-        <argument value="$[user.home]/.sshkaraf/known_hosts"/>
-    </bean>
-
-    <bean id="userAuthFactoriesFactory" class="org.apache.karaf.shell.ssh.UserAuthFactoriesFactory">
-        <property name="authMethods" value="${authMethods}"/>
-    </bean>
-
-    <bean id="sshServer" class="org.apache.sshd.SshServer" factory-method="setUpDefaultServer" scope="prototype">
-        <property name="port" value="${sshPort}"/>
-        <property name="host" value="${sshHost}"/>
-        <property name="macFactories">
-            <bean class="org.apache.karaf.shell.ssh.SshUtils" factory-method="buildMacs">
-                <argument value="${macs}" />
-            </bean>
-        </property>
-        <property name="cipherFactories">
-            <bean class="org.apache.karaf.shell.ssh.SshUtils" factory-method="buildCiphers">
-                <argument value="${ciphers}" />
-            </bean>
-        </property>
-        <property name="shellFactory">
-            <bean class="org.apache.karaf.shell.ssh.ShellFactoryImpl">
-            	<argument ref="consoleFactory"/>
-            </bean>
-        </property>
-        <property name="commandFactory">
-            <bean class="org.apache.sshd.server.command.ScpCommandFactory">
-                <argument>
-                    <bean class="org.apache.karaf.shell.ssh.ShellCommandFactory">
-                        <property name="commandProcessor" ref="commandProcessor"/>
-                    </bean>
-                </argument>
-            </bean>
-        </property>
-        <property name="subsystemFactories">
-            <list>
-                <bean class="org.apache.sshd.server.sftp.SftpSubsystem.Factory"/>
-            </list>
-        </property>
-        <property name="keyPairProvider" ref="keyPairProvider"/>
-        <property name="passwordAuthenticator" ref="authenticator"/>
-        <property name="publickeyAuthenticator" ref="authenticator"/>
-        <property name="fileSystemFactory">
-            <bean class="org.apache.karaf.shell.ssh.KarafFileSystemFactory"/>
-        </property>
-        <property name="userAuthFactories">
-            <bean factory-ref="userAuthFactoriesFactory" factory-method="getFactories"/>
-        </property>
-        <property name="agentFactory" ref="agentFactory" />
-    </bean>
-
-    <bean id="agentFactory" class="org.apache.karaf.shell.ssh.KarafAgentFactory">
-        <property name="bundleContext" ref="blueprintBundleContext" />
-    </bean>
-    <reference-list id="commandSessions" interface="org.apache.felix.service.command.CommandSession" availability="optional" activation="eager">
-        <reference-listener ref="agentFactory" bind-method="registerCommandSession" unbind-method="unregisterCommandSession" />
-    </reference-list>
-
-    <bean id="keyPairProvider" class="org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider">
-        <property name="path" value="${hostKey}"/>
-        <property name="keySize" value="${keySize}"/>
-        <property name="algorithm" value="${algorithm}"/>
-    </bean>
-
-    <bean id="authenticator" class="org.apache.karaf.shell.ssh.KarafJaasAuthenticator">
-        <property name="realm" value="${sshRealm}"/>
-    </bean>
-
-    <bean id="sshServerFactory" class="org.apache.karaf.shell.ssh.SshServerFactory" init-method="start"
-          destroy-method="stop" activation="eager">
-        <argument ref="sshServer"/>
-        <property name="start" value="$[karaf.startRemoteShell]"/>
-        <property name="idleTimeout" value="${sshIdleTimeout}"/>
-    </bean>
-
-    <reference id="commandProcessor" interface="org.apache.felix.service.command.CommandProcessor"/>
-
-</blueprint>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/wrapper/command/pom.xml
----------------------------------------------------------------------
diff --git a/wrapper/command/pom.xml b/wrapper/command/pom.xml
index d70ff8c..a8d2fca 100644
--- a/wrapper/command/pom.xml
+++ b/wrapper/command/pom.xml
@@ -86,17 +86,11 @@
                             org.apache.karaf.wrapper,
                             javax.management,
                             javax.management.loading,
-                            org.apache.aries.blueprint,
-                            org.osgi.service.blueprint.container,
-                            org.osgi.service.blueprint.reflect,
-                            org.apache.felix.service.command,
-                            org.apache.karaf.shell.commands,
-                            org.apache.karaf.shell.console,
                             *
                         </Import-Package>
-                        <Private-Package>
-                            org.apache.karaf.wrapper.internal
-                        </Private-Package>
+                        <Karaf-Commands>
+                            org.apache.karaf.wrapper.commands
+                        </Karaf-Commands>
                     </instructions>
                 </configuration>
             </plugin>

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/wrapper/command/src/main/java/org/apache/karaf/wrapper/commands/Install.java
----------------------------------------------------------------------
diff --git a/wrapper/command/src/main/java/org/apache/karaf/wrapper/commands/Install.java b/wrapper/command/src/main/java/org/apache/karaf/wrapper/commands/Install.java
index 14c921a..346f6f1 100644
--- a/wrapper/command/src/main/java/org/apache/karaf/wrapper/commands/Install.java
+++ b/wrapper/command/src/main/java/org/apache/karaf/wrapper/commands/Install.java
@@ -18,21 +18,22 @@ package org.apache.karaf.wrapper.commands;
 
 import java.io.File;
 
-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.Reference;
-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.action.lifecycle.Reference;
+import org.apache.karaf.shell.api.action.lifecycle.Service;
 import org.apache.karaf.wrapper.WrapperService;
-import org.apache.karaf.wrapper.internal.WrapperServiceImpl;
-import org.fusesource.jansi.Ansi;
+
+import static org.apache.karaf.shell.support.ansi.SimpleAnsi.INTENSITY_BOLD;
+import static org.apache.karaf.shell.support.ansi.SimpleAnsi.INTENSITY_NORMAL;
 
 /**
  * Installs the Karaf instance as a service in your operating system.
  */
 @Command(scope = "wrapper", name = "install", description = "Install the container as a system service in the OS.")
 @Service
-public class Install extends AbstractAction {
+public class Install implements Action {
 
 	@Option(name = "-n", aliases = { "--name" }, description = "The service name that will be used when installing the service. (Default: karaf)", required = false, multiValued = false)
 	private String name = "karaf";
@@ -47,13 +48,10 @@ public class Install extends AbstractAction {
 	private String startType = "AUTO_START";
 
     @Reference
-	private WrapperService wrapperService = new WrapperServiceImpl();
-
-	public void setWrapperService(WrapperService wrapperService) {
-		this.wrapperService = wrapperService;
-	}
+	private WrapperService wrapperService;
 
-	protected Object doExecute() throws Exception {
+    @Override
+	public Object execute() throws Exception {
         File[] wrapperPaths = wrapperService.install(name, displayName, description, startType);
 
         String os = System.getProperty("os.name", "Unknown");
@@ -67,7 +65,7 @@ public class Install extends AbstractAction {
         System.out.println("");
         if (os.startsWith("Win")) {
             System.out.println("");
-            System.out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("MS Windows system detected:").a(Ansi.Attribute.RESET).toString());
+            System.out.println(INTENSITY_BOLD + "MS Windows system detected:" + INTENSITY_NORMAL);
             System.out.println("To install the service, run: ");
             System.out.println("  C:> " + serviceFile.getPath() + " install");
             System.out.println("");
@@ -82,7 +80,7 @@ public class Install extends AbstractAction {
             System.out.println("");
         } else if (os.startsWith("Mac OS X")) {
             System.out.println("");
-            System.out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("Mac OS X system detected:").a(Ansi.Attribute.RESET).toString());
+            System.out.println(INTENSITY_BOLD + "Mac OS X system detected:" + INTENSITY_NORMAL);
             System.out.println("to add bin/org.apache.karaf.KARAF as user service move this file into ~/Library/LaunchAgents/");  
             System.out.println("> mv bin/org.apache.karaf.KARAF.plist ~/Library/LaunchAgents/");
             System.out.println("");
@@ -110,7 +108,7 @@ public class Install extends AbstractAction {
 
             if (redhatRelease.exists()) {
                 System.out.println("");
-                System.out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("RedHat/Fedora/CentOS Linux system detected:").a(Ansi.Attribute.RESET).toString());
+                System.out.println(INTENSITY_BOLD + "RedHat/Fedora/CentOS Linux system detected:" + INTENSITY_NORMAL);
                 System.out.println("  To install the service:");
                 System.out.println("    $ ln -s " + serviceFile.getPath() + " /etc/init.d/");
                 System.out.println("    $ chkconfig " + serviceFile.getName() + " --add");
@@ -132,7 +130,7 @@ public class Install extends AbstractAction {
                 System.out.println("    $ rm /etc/init.d/" + serviceFile.getPath());
             } else if (debianVersion.exists()) {
                 System.out.println("");
-                System.out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("Ubuntu/Debian Linux system detected:").a(Ansi.Attribute.RESET).toString());
+                System.out.println(INTENSITY_BOLD + "Ubuntu/Debian Linux system detected:" + INTENSITY_NORMAL);
                 System.out.println("  To install the service:");
                 System.out.println("    $ ln -s " + serviceFile.getPath() + " /etc/init.d/");
                 System.out.println("");
@@ -152,7 +150,7 @@ public class Install extends AbstractAction {
                 System.out.println("    $ rm /etc/init.d/" + serviceFile.getName());
             } else {
 				System.out.println("");
-                System.out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("On Redhat/Fedora/CentOS Systems:").a(Ansi.Attribute.RESET).toString());
+                System.out.println(INTENSITY_BOLD + "On Redhat/Fedora/CentOS Systems:" + INTENSITY_NORMAL);
 				System.out.println("  To install the service:");
 				System.out.println("    $ ln -s "+serviceFile.getPath()+" /etc/init.d/");
 				System.out.println("    $ chkconfig "+serviceFile.getName()+" --add");
@@ -174,7 +172,7 @@ public class Install extends AbstractAction {
 				System.out.println("    $ rm /etc/init.d/"+serviceFile.getName());
 
 				System.out.println("");
-                System.out.println(Ansi.ansi().a(Ansi.Attribute.INTENSITY_BOLD).a("On Ubuntu/Debian Systems:").a(Ansi.Attribute.RESET).toString());
+                System.out.println(INTENSITY_BOLD + "On Ubuntu/Debian Systems:" + INTENSITY_NORMAL);
 				System.out.println("  To install the service:");
 				System.out.println("    $ ln -s "+serviceFile.getPath()+" /etc/init.d/");
 				System.out.println("");

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/wrapper/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
----------------------------------------------------------------------
diff --git a/wrapper/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands b/wrapper/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
index d89d5da..73b329d 100644
--- a/wrapper/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
+++ b/wrapper/command/src/main/resources/META-INF/services/org/apache/karaf/shell/commands
@@ -14,4 +14,5 @@
 ##  See the License for the specific language governing permissions and
 ##  limitations under the License.
 ##---------------------------------------------------------------------------
+org.apache.karaf.wrapper.internal.WrapperServiceImpl
 org.apache.karaf.wrapper.commands.Install
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/wrapper/command/src/main/resources/OSGI-INF/blueprint/wrapper-commands.xml
----------------------------------------------------------------------
diff --git a/wrapper/command/src/main/resources/OSGI-INF/blueprint/wrapper-commands.xml b/wrapper/command/src/main/resources/OSGI-INF/blueprint/wrapper-commands.xml
deleted file mode 100644
index f29e8a0..0000000
--- a/wrapper/command/src/main/resources/OSGI-INF/blueprint/wrapper-commands.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.wrapper.commands.*" />
-
-</blueprint>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/karaf/blob/2e2b9324/wrapper/core/pom.xml
----------------------------------------------------------------------
diff --git a/wrapper/core/pom.xml b/wrapper/core/pom.xml
index 982433a..f6f51d1 100644
--- a/wrapper/core/pom.xml
+++ b/wrapper/core/pom.xml
@@ -51,7 +51,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>tanukisoft</groupId>