You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by ja...@apache.org on 2014/04/17 16:45:22 UTC

[1/3] git commit: KARAF-2917 - Command to display bundle id

Repository: karaf
Updated Branches:
  refs/heads/karaf-3.0.x 626e54cef -> 202ad3e69


KARAF-2917 - Command to display bundle id


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/84198aae
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/84198aae
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/84198aae

Branch: refs/heads/karaf-3.0.x
Commit: 84198aaeb5f48cf06a17b597907cd80b9cb72b21
Parents: 626e54c
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Wed Apr 16 20:42:55 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Thu Apr 17 11:26:50 2014 -0230

----------------------------------------------------------------------
 .../karaf/bundle/command/BundleCommand.java     |  2 +
 .../org/apache/karaf/bundle/command/Id.java     | 76 ++++++++++++++++++++
 .../bundle/core/internal/BundleServiceImpl.java |  3 +-
 3 files changed, 79 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/84198aae/bundle/command/src/main/java/org/apache/karaf/bundle/command/BundleCommand.java
----------------------------------------------------------------------
diff --git a/bundle/command/src/main/java/org/apache/karaf/bundle/command/BundleCommand.java b/bundle/command/src/main/java/org/apache/karaf/bundle/command/BundleCommand.java
index 78a4f2a..166b1b7 100644
--- a/bundle/command/src/main/java/org/apache/karaf/bundle/command/BundleCommand.java
+++ b/bundle/command/src/main/java/org/apache/karaf/bundle/command/BundleCommand.java
@@ -50,6 +50,8 @@ public abstract class BundleCommand extends OsgiCommandSupport {
             } else {
                 System.err.println("Access to system bundle " + id + " is discouraged. You may override with -f");
             }
+        } else {
+            System.err.println("Bundle " + id + " is not found");
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/karaf/blob/84198aae/bundle/core/src/main/java/org/apache/karaf/bundle/command/Id.java
----------------------------------------------------------------------
diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Id.java b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Id.java
new file mode 100644
index 0000000..1e346b3
--- /dev/null
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Id.java
@@ -0,0 +1,76 @@
+/*
+ * 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.bundle.command;
+
+import java.util.List;
+
+import org.apache.karaf.bundle.core.BundleService;
+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.support.ShellUtil;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+@Command(scope = "bundle", name = "id", description = "Gets the bundle ID.")
+@Service
+public class Id implements Action {
+
+    @Argument(index = 0, name = "name", description = "The bundle name, name/version, or location", required = true, multiValued = false)
+    String name;
+
+    @Reference
+    BundleService bundleService;
+
+    @Reference
+    BundleContext bundleContext;
+
+    public Object execute() throws Exception {
+        return doExecute(true);
+    }
+
+    protected Object doExecute(boolean force) throws Exception {
+        Bundle bundle = bundleService.getBundle(name, true);
+        
+        // if name or name/version were not successful, let's try searching by location
+        if (bundle == null) {
+            for (int i = 0; i < bundleContext.getBundles().length; i++) {
+                Bundle b = bundleContext.getBundles()[i];
+                if (name.equals(b.getLocation())) {
+                    bundle = b;
+                    break;
+                }
+            }
+        }
+        if (bundle != null) {            
+            if (force || !ShellUtil.isASystemBundle(bundleContext, bundle)) {                
+                return bundle.getBundleId();
+            } else {
+                System.err.println("Access to system bundle " + name + " is discouraged. You may override with -f");
+            }
+        } else {
+            System.err.println("Bundle " + name + " is not found");
+        }
+        return null;
+    }
+
+    public void setBundleService(BundleService bundleService) {
+        this.bundleService = bundleService;
+    }
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/84198aae/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java
----------------------------------------------------------------------
diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java
index f908a26..f1f3d5b 100644
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java
+++ b/bundle/core/src/main/java/org/apache/karaf/bundle/core/internal/BundleServiceImpl.java
@@ -71,8 +71,7 @@ public class BundleServiceImpl implements BundleService {
         List<String> ids = new ArrayList<String>(1);
         ids.add(id);
         List<Bundle> bundles = selectBundles(ids, defaultAllBundles);
-        if (bundles.isEmpty()) {
-            System.err.println("Bundle " + id + " is not found");
+        if (bundles.isEmpty()) {            
             return null;
         } else {
             return bundles.get(0);


[2/3] git commit: KARAF-2918 - Provide ability to set a banner prior to user login via ssh

Posted by ja...@apache.org.
KARAF-2918 - Provide ability to set a banner prior to user login via ssh


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/69ed05bd
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/69ed05bd
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/69ed05bd

Branch: refs/heads/karaf-3.0.x
Commit: 69ed05bd81d8f3f16ce2bf0a8586d49f4a2bef03
Parents: 84198aa
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Apr 17 11:54:03 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Thu Apr 17 11:54:03 2014 -0230

----------------------------------------------------------------------
 .../resources/resources/etc/org.apache.karaf.shell.cfg |  6 +++++-
 .../instance/resources/etc/org.apache.karaf.shell.cfg  |  6 +++++-
 .../org/apache/karaf/shell/ssh/SshServerAction.java    |  8 ++++++++
 .../org/apache/karaf/shell/ssh/SshServerFactory.java   | 13 +++++++++++++
 .../main/resources/OSGI-INF/blueprint/shell-ssh.xml    |  2 ++
 5 files changed, 33 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/69ed05bd/assemblies/features/framework/src/main/resources/resources/etc/org.apache.karaf.shell.cfg
----------------------------------------------------------------------
diff --git a/assemblies/features/framework/src/main/resources/resources/etc/org.apache.karaf.shell.cfg b/assemblies/features/framework/src/main/resources/resources/etc/org.apache.karaf.shell.cfg
index 30aebb6..5e33d01 100644
--- a/assemblies/features/framework/src/main/resources/resources/etc/org.apache.karaf.shell.cfg
+++ b/assemblies/features/framework/src/main/resources/resources/etc/org.apache.karaf.shell.cfg
@@ -61,6 +61,10 @@ hostKey = ${karaf.etc}/host.key
 #
 # algorithm = DSA
 
+# Specify an additional welcome banner to be displayed when a user logs into the server.
+#
+# welcomeBanner =
+
 #
 # Defines the completion mode on the Karaf shell console. The possible values are:
 # - GLOBAL: it's the same behavior as in previous Karaf releases. The completion displays all commands and all aliases
@@ -72,4 +76,4 @@ hostKey = ${karaf.etc}/host.key
 # This property define the default value when you use the Karaf shell console.
 # You can change the completion mode directly in the shell console, using shell:completion command.
 #
-completionMode = GLOBAL
\ No newline at end of file
+completionMode = GLOBAL

http://git-wip-us.apache.org/repos/asf/karaf/blob/69ed05bd/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg
----------------------------------------------------------------------
diff --git a/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg b/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg
index 077f5da..2f9380d 100644
--- a/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg
+++ b/instance/core/src/main/resources/org/apache/karaf/instance/resources/etc/org.apache.karaf.shell.cfg
@@ -61,6 +61,10 @@ hostKey = ${karaf.etc}/host.key
 #
 # algorithm = DSA
 
+# Specify an additional welcome banner to be displayed when a user logs into the server.
+#
+# welcomeBanner =
+
 #
 # Defines the completion mode on the Karaf shell console. The possible values are:
 # - GLOBAL: it's the same behavior as in previous Karaf releases. The completion displays all commands and all aliases
@@ -72,4 +76,4 @@ hostKey = ${karaf.etc}/host.key
 # This property define the default value when you use the Karaf shell console.
 # You can change the completion mode directly in the shell console, using shell:completion command.
 #
-completionMode = GLOBAL
\ No newline at end of file
+completionMode = GLOBAL

http://git-wip-us.apache.org/repos/asf/karaf/blob/69ed05bd/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerAction.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerAction.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerAction.java
index e92db70..02495f6 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerAction.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerAction.java
@@ -41,6 +41,9 @@ public class SshServerAction extends OsgiCommandSupport implements BlueprintCont
     @Option(name = "-i", aliases = { "--idle-timeout" }, description = "The session idle timeout (Default: 1800000ms)", required = false, multiValued = false)
     private long idleTimeout = 1800000;
 
+    @Option(name = "-w", aliases = { "--welcome-banner" }, description = "The welcome banner to display when logging in", required = false, multiValued = false)
+    private String welcomeBanner;
+
     private BlueprintContainer container;
 
     private String sshServerId;
@@ -65,6 +68,11 @@ public class SshServerAction extends OsgiCommandSupport implements BlueprintCont
         // idle timeout
         server.getProperties().put(SshServer.IDLE_TIMEOUT, new Long(idleTimeout).toString());
 
+        // welcome banner
+        if (welcomeBanner != null) {
+            server.getProperties().put(SshServer.WELCOME_BANNER, welcomeBanner);
+        } 
+
         // starting the SSHd server
         server.start();
 

http://git-wip-us.apache.org/repos/asf/karaf/blob/69ed05bd/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerFactory.java
----------------------------------------------------------------------
diff --git a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerFactory.java b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerFactory.java
index 4789669..6d4233e 100644
--- a/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerFactory.java
+++ b/shell/ssh/src/main/java/org/apache/karaf/shell/ssh/SshServerFactory.java
@@ -31,6 +31,8 @@ public class SshServerFactory {
 
     private SshServer server;
 
+    private String welcomeBanner;
+
     public SshServerFactory(SshServer server) {
         this.server = server;
     }
@@ -51,10 +53,21 @@ public class SshServerFactory {
         this.idleTimeout = idleTimeout;
     }
 
+    public String getWelcomeBanner() {
+        return welcomeBanner;
+    }
+
+    public void setWelcomeBanner(String welcomeBanner) {
+        this.welcomeBanner = welcomeBanner;
+    }
+    
     public void start() {
         if (start) {
             try {
                 server.getProperties().put(SshServer.IDLE_TIMEOUT, new Long(idleTimeout).toString());
+                if (getWelcomeBanner() != null && !getWelcomeBanner().isEmpty()) {
+                    server.getProperties().put(SshServer.WELCOME_BANNER, getWelcomeBanner());
+                }
                 server.start();
             } catch (Exception e) {
                 LOGGER.info("Error updating SSH server", e);

http://git-wip-us.apache.org/repos/asf/karaf/blob/69ed05bd/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
index 4b16181..b8b64ec 100644
--- a/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml
+++ b/shell/ssh/src/main/resources/OSGI-INF/blueprint/shell-ssh.xml
@@ -51,6 +51,7 @@
             <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:property name="welcomeBanner" value="" />
         </cm:default-properties>
     </cm:property-placeholder>
 
@@ -146,6 +147,7 @@
         <argument ref="sshServer"/>
         <property name="start" value="$[karaf.startRemoteShell]"/>
         <property name="idleTimeout" value="${sshIdleTimeout}"/>
+        <property name="welcomeBanner" value="${welcomeBanner}"/>
     </bean>
 
     <reference id="commandProcessor" interface="org.apache.felix.service.command.CommandProcessor">


[3/3] git commit: Fix up Id command after backport to 3.0.x

Posted by ja...@apache.org.
Fix up Id command after backport to 3.0.x


Project: http://git-wip-us.apache.org/repos/asf/karaf/repo
Commit: http://git-wip-us.apache.org/repos/asf/karaf/commit/202ad3e6
Tree: http://git-wip-us.apache.org/repos/asf/karaf/tree/202ad3e6
Diff: http://git-wip-us.apache.org/repos/asf/karaf/diff/202ad3e6

Branch: refs/heads/karaf-3.0.x
Commit: 202ad3e694172ad8111a043f3be03577a6f5d79d
Parents: 69ed05b
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Thu Apr 17 12:12:35 2014 -0230
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Thu Apr 17 12:12:35 2014 -0230

----------------------------------------------------------------------
 .../org/apache/karaf/bundle/command/Id.java     | 71 ++++++++++++++++++
 .../OSGI-INF/blueprint/shell-bundles.xml        |  6 ++
 .../src/main/resources/OSGI-INF/bundle.info     |  1 +
 .../org/apache/karaf/bundle/command/Id.java     | 76 --------------------
 4 files changed, 78 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/karaf/blob/202ad3e6/bundle/command/src/main/java/org/apache/karaf/bundle/command/Id.java
----------------------------------------------------------------------
diff --git a/bundle/command/src/main/java/org/apache/karaf/bundle/command/Id.java b/bundle/command/src/main/java/org/apache/karaf/bundle/command/Id.java
new file mode 100644
index 0000000..882d6df
--- /dev/null
+++ b/bundle/command/src/main/java/org/apache/karaf/bundle/command/Id.java
@@ -0,0 +1,71 @@
+/*
+ * 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.bundle.command;
+
+import java.util.List;
+
+import org.apache.karaf.bundle.core.BundleService;
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.apache.karaf.shell.util.ShellUtil;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+@Command(scope = "bundle", name = "id", description = "Gets the bundle ID.")
+public class Id extends OsgiCommandSupport {
+
+    @Argument(index = 0, name = "name", description = "The bundle name, name/version, or location", required = true, multiValued = false)
+    String name;
+
+    BundleService bundleService;
+
+    BundleContext bundleContext;
+
+    protected Object doExecute() throws Exception {
+        return doExecute(true);
+    }
+
+    protected Object doExecute(boolean force) throws Exception {
+        Bundle bundle = bundleService.getBundle(name, true);
+        
+        // if name or name/version were not successful, let's try searching by location
+        if (bundle == null) {
+            for (int i = 0; i < bundleContext.getBundles().length; i++) {
+                Bundle b = bundleContext.getBundles()[i];
+                if (name.equals(b.getLocation())) {
+                    bundle = b;
+                    break;
+                }
+            }
+        }
+        if (bundle != null) {            
+            if (force || !ShellUtil.isASystemBundle(bundleContext, bundle)) {                
+                return bundle.getBundleId();
+            } else {
+                System.err.println("Access to system bundle " + name + " is discouraged. You may override with -f");
+            }
+        } else {
+            System.err.println("Bundle " + name + " is not found");
+        }
+        return null;
+    }
+
+    public void setBundleService(BundleService bundleService) {
+        this.bundleService = bundleService;
+    }
+}

http://git-wip-us.apache.org/repos/asf/karaf/blob/202ad3e6/bundle/command/src/main/resources/OSGI-INF/blueprint/shell-bundles.xml
----------------------------------------------------------------------
diff --git a/bundle/command/src/main/resources/OSGI-INF/blueprint/shell-bundles.xml b/bundle/command/src/main/resources/OSGI-INF/blueprint/shell-bundles.xml
index bed5c0f..610e3c3 100644
--- a/bundle/command/src/main/resources/OSGI-INF/blueprint/shell-bundles.xml
+++ b/bundle/command/src/main/resources/OSGI-INF/blueprint/shell-bundles.xml
@@ -124,6 +124,12 @@
             </action> 
         </command>
         <command>
+            <action class="org.apache.karaf.bundle.command.Id">
+                <property name="bundleService" ref="bundleService"/>
+                <property name="bundleContext" ref="blueprintBundleContext" />
+            </action> 
+        </command>        
+        <command>
             <action class="org.apache.karaf.bundle.command.Watch" >
                 <property name="bundleWatcher" ref="bundleWatcher"/>
             </action>

http://git-wip-us.apache.org/repos/asf/karaf/blob/202ad3e6/bundle/command/src/main/resources/OSGI-INF/bundle.info
----------------------------------------------------------------------
diff --git a/bundle/command/src/main/resources/OSGI-INF/bundle.info b/bundle/command/src/main/resources/OSGI-INF/bundle.info
index af2c24f..860dcbd 100644
--- a/bundle/command/src/main/resources/OSGI-INF/bundle.info
+++ b/bundle/command/src/main/resources/OSGI-INF/bundle.info
@@ -15,6 +15,7 @@ The following commands are available:
 * bundle:classes - Displays a list of classes contained in the bundle
 * bundle:find-class - Locates a specified class in any deployed bundle
 * bundle:headers - Display OSGi headers of a given bundle.
+* bundle:id - Gets the bundle ID.
 * bundle:info - Display detailed information of a given bundle.
 * bundle:install - Install one or more bundles.
 * bundle:list - List all installed bundles.

http://git-wip-us.apache.org/repos/asf/karaf/blob/202ad3e6/bundle/core/src/main/java/org/apache/karaf/bundle/command/Id.java
----------------------------------------------------------------------
diff --git a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Id.java b/bundle/core/src/main/java/org/apache/karaf/bundle/command/Id.java
deleted file mode 100644
index 1e346b3..0000000
--- a/bundle/core/src/main/java/org/apache/karaf/bundle/command/Id.java
+++ /dev/null
@@ -1,76 +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.bundle.command;
-
-import java.util.List;
-
-import org.apache.karaf.bundle.core.BundleService;
-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.support.ShellUtil;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-@Command(scope = "bundle", name = "id", description = "Gets the bundle ID.")
-@Service
-public class Id implements Action {
-
-    @Argument(index = 0, name = "name", description = "The bundle name, name/version, or location", required = true, multiValued = false)
-    String name;
-
-    @Reference
-    BundleService bundleService;
-
-    @Reference
-    BundleContext bundleContext;
-
-    public Object execute() throws Exception {
-        return doExecute(true);
-    }
-
-    protected Object doExecute(boolean force) throws Exception {
-        Bundle bundle = bundleService.getBundle(name, true);
-        
-        // if name or name/version were not successful, let's try searching by location
-        if (bundle == null) {
-            for (int i = 0; i < bundleContext.getBundles().length; i++) {
-                Bundle b = bundleContext.getBundles()[i];
-                if (name.equals(b.getLocation())) {
-                    bundle = b;
-                    break;
-                }
-            }
-        }
-        if (bundle != null) {            
-            if (force || !ShellUtil.isASystemBundle(bundleContext, bundle)) {                
-                return bundle.getBundleId();
-            } else {
-                System.err.println("Access to system bundle " + name + " is discouraged. You may override with -f");
-            }
-        } else {
-            System.err.println("Bundle " + name + " is not found");
-        }
-        return null;
-    }
-
-    public void setBundleService(BundleService bundleService) {
-        this.bundleService = bundleService;
-    }
-}