Switch from gshell to gogo
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@792445 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/gshell/gshell-osgi/pom.xml b/karaf/gshell/gshell-osgi/pom.xml
index 87dbe2b..4ef12eb 100644
--- a/karaf/gshell/gshell-osgi/pom.xml
+++ b/karaf/gshell/gshell-osgi/pom.xml
@@ -40,7 +40,7 @@
<dependencies>
<dependency>
<groupId>org.apache.felix.karaf.gshell</groupId>
- <artifactId>org.apache.felix.karaf.gshell.core</artifactId>
+ <artifactId>org.apache.felix.karaf.gshell.console</artifactId>
</dependency>
<dependency>
@@ -48,16 +48,6 @@
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
</dependency>
-
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-core</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.springframework.osgi</groupId>
- <artifactId>spring-osgi-extender</artifactId>
- </dependency>
</dependencies>
<build>
@@ -70,10 +60,9 @@
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Export-Package>${pom.artifactId}*;version=${project.version}</Export-Package>
<Import-Package>
- org.apache.geronimo.gshell.command,
- org.apache.geronimo.gshell.wisdom.command,
- org.apache.geronimo.gshell.wisdom.registry,
- org.apache.felix.karaf.gshell.core,
+ org.osgi.service.command,
+ org.apache.felix.gogo.commands,
+ org.apache.felix.karaf.gshell.console,
*
</Import-Package>
<Private-Package>!*</Private-Package>
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BlueprintListener.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BlueprintListener.java
index 7cb1666..b80c3d3 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BlueprintListener.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BlueprintListener.java
@@ -19,13 +19,13 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.BundleListener;
import org.osgi.service.blueprint.container.BlueprintEvent;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
/**
*
@@ -45,7 +45,7 @@
Waiting
}
- private static final Log LOG = LogFactory.getLog(BlueprintListener.class);
+ private static final Logger LOG = LoggerFactory.getLogger(BlueprintListener.class);
private final Map<Long, BlueprintState> states;
private BundleContext bundleContext;
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundleCommand.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundleCommand.java
index 019462e..436969e 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundleCommand.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundleCommand.java
@@ -16,9 +16,9 @@
*/
package org.apache.felix.karaf.gshell.osgi;
-import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.clp.Option;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Option;
+import org.apache.felix.gogo.commands.Argument;
import org.osgi.framework.Bundle;
public abstract class BundleCommand extends OsgiCommandSupport {
@@ -32,15 +32,15 @@
protected Object doExecute() throws Exception {
Bundle bundle = getBundleContext().getBundle(id);
if (bundle == null) {
- io.out.println("Bundle " + id + " not found");
- return Result.FAILURE;
+ System.out.println("Bundle " + id + " not found");
+ return null;
}
- if (!force && Util.isASystemBundle(getBundleContext(), bundle) && !Util.accessToSystemBundleIsAllowed(bundle.getBundleId(), io)) {
- return Result.FAILURE;
+ if (!force && Util.isASystemBundle(getBundleContext(), bundle) && !Util.accessToSystemBundleIsAllowed(bundle.getBundleId(), session)) {
+ return null;
} else {
doExecute(bundle);
- return Result.SUCCESS;
+ return null;
}
}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundleLevel.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundleLevel.java
index 1fe59f0..05aa0cb 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundleLevel.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundleLevel.java
@@ -16,7 +16,7 @@
*/
package org.apache.felix.karaf.gshell.osgi;
-import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.felix.gogo.commands.Argument;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.startlevel.StartLevel;
@@ -30,29 +30,29 @@
// Get package admin service.
ServiceReference ref = getBundleContext().getServiceReference(StartLevel.class.getName());
if (ref == null) {
- io.out.println("StartLevel service is unavailable.");
+ System.out.println("StartLevel service is unavailable.");
return;
}
StartLevel sl = getService(StartLevel.class, ref);
if (sl == null) {
- io.out.println("StartLevel service is unavailable.");
+ System.out.println("StartLevel service is unavailable.");
return;
}
if (level == null) {
- io.out.println("Level " + sl.getBundleStartLevel(bundle));
+ System.out.println("Level " + sl.getBundleStartLevel(bundle));
}
else if ((level < 50) && sl.getBundleStartLevel(bundle) > 50){
for (;;) {
StringBuffer sb = new StringBuffer();
- io.err.println("You are about to designate bundle as a system bundle. Do you want to continue (yes/no): ");
- io.err.flush();
+ System.err.println("You are about to designate bundle as a system bundle. Do you want to continue (yes/no): ");
+ System.err.flush();
for (;;) {
- int c = io.in.read();
+ int c = System.in.read();
if (c < 0) {
return;
}
- io.err.println((char) c);
+ System.err.println((char) c);
if (c == '\r' || c == '\n') {
break;
}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundlesCommand.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundlesCommand.java
index 0dd52bf..71bf3da 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundlesCommand.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/BundlesCommand.java
@@ -19,9 +19,9 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.clp.Option;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Option;
import org.osgi.framework.Bundle;
public abstract class BundlesCommand extends OsgiCommandSupport {
@@ -38,16 +38,16 @@
for (long id : ids) {
Bundle bundle = getBundleContext().getBundle(id);
if (bundle == null) {
- io.err.println("Bundle ID" + id + " is invalid");
+ System.err.println("Bundle ID" + id + " is invalid");
} else {
- if (force || !Util.isASystemBundle(getBundleContext(), bundle) || Util.accessToSystemBundleIsAllowed(bundle.getBundleId(), io)) {
+ if (force || !Util.isASystemBundle(getBundleContext(), bundle) || Util.accessToSystemBundleIsAllowed(bundle.getBundleId(), session)) {
bundles.add(bundle);
}
}
}
}
doExecute(bundles);
- return Result.SUCCESS;
+ return null;
}
protected abstract void doExecute(List<Bundle> bundles) throws Exception;
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Headers.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Headers.java
index 3b9b60a..adfb997 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Headers.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Headers.java
@@ -20,8 +20,8 @@
import java.util.Enumeration;
import java.util.List;
-import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Argument;
import org.osgi.framework.Bundle;
public class Headers extends OsgiCommandSupport {
@@ -37,7 +37,7 @@
printHeaders(bundle);
}
else {
- io.err.println("Bundle ID " + id + " is invalid.");
+ System.err.println("Bundle ID " + id + " is invalid.");
}
}
}
@@ -47,20 +47,20 @@
printHeaders(bundles[i]);
}
}
- return Result.SUCCESS;
+ return null;
}
protected void printHeaders(Bundle bundle) throws Exception {
String title = Util.getBundleName(bundle);
- io.out.println("\n" + title);
- io.out.println(Util.getUnderlineString(title));
+ System.out.println("\n" + title);
+ System.out.println(Util.getUnderlineString(title));
Dictionary dict = bundle.getHeaders();
Enumeration keys = dict.keys();
while (keys.hasMoreElements())
{
Object k = (String) keys.nextElement();
Object v = dict.get(k);
- io.out.println(k + " = " + Util.getValueString(v));
+ System.out.println(k + " = " + Util.getValueString(v));
}
}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/InstallBundle.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/InstallBundle.java
index 4cf58cd..1eedcf8 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/InstallBundle.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/InstallBundle.java
@@ -16,13 +16,13 @@
*/
package org.apache.felix.karaf.gshell.osgi;
-import java.io.PrintWriter;
+import java.io.PrintStream;
import java.util.ArrayList;
import java.util.List;
-import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.clp.Option;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Option;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -38,7 +38,7 @@
List<Bundle> bundles = new ArrayList<Bundle>();
StringBuffer sb = new StringBuffer();
for (String url : urls) {
- Bundle bundle = install(url, io.out, io.err);
+ Bundle bundle = install(url, System.out, System.err);
if (bundle != null) {
bundles.add(bundle);
if (sb.length() > 0) {
@@ -53,14 +53,14 @@
}
}
if (sb.toString().indexOf(',') > 0) {
- io.out.println("Bundle IDs: " + sb.toString());
+ System.out.println("Bundle IDs: " + sb.toString());
} else if (sb.length() > 0) {
- io.out.println("Bundle ID: " + sb.toString());
+ System.out.println("Bundle ID: " + sb.toString());
}
- return Result.SUCCESS;
+ return null;
}
- protected Bundle install(String location, PrintWriter out, PrintWriter err) {
+ protected Bundle install(String location, PrintStream out, PrintStream err) {
try {
return getBundleContext().installBundle(location, null);
} catch (IllegalStateException ex) {
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListBundles.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListBundles.java
index 5c69962..c9ca6f0 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListBundles.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListBundles.java
@@ -16,8 +16,8 @@
*/
package org.apache.felix.karaf.gshell.osgi;
-import org.apache.geronimo.gshell.clp.Option;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Option;
import org.osgi.framework.Bundle;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
@@ -52,7 +52,7 @@
sl = (StartLevel) getBundleContext().getService(ref);
}
if (sl == null) {
- io.out.println("StartLevel service is unavailable.");
+ System.out.println("StartLevel service is unavailable.");
}
ServiceReference pkgref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
@@ -60,7 +60,7 @@
if (pkgref != null) {
admin = (PackageAdmin) getBundleContext().getService(pkgref);
if (admin == null) {
- io.out.println("PackageAdmin service is unavailable.");
+ System.out.println("PackageAdmin service is unavailable.");
}
}
@@ -68,7 +68,7 @@
if (bundles != null) {
// Display active start level.
if (sl != null) {
- io.out.println("START LEVEL " + sl.getStartLevel());
+ System.out.println("START LEVEL " + sl.getStartLevel());
}
// Print column headers.
@@ -83,7 +83,7 @@
msg = " Update location";
}
String level = (sl == null) ? "" : " Level ";
- io.out.println(" ID State Blueprint " + level + msg);
+ System.out.println(" ID State Blueprint " + level + msg);
for (int i = 0; i < bundles.length; i++) {
// Get the bundle name or location.
String name = (String) bundles[i].getHeaders().get(Constants.BUNDLE_NAME);
@@ -122,7 +122,7 @@
while (id.length() < 4) {
id = " " + id;
}
- io.out.println("[" + id + "] ["
+ System.out.println("[" + id + "] ["
+ getStateString(bundles[i])
+ "] [" + getBlueprintStateString(bundles[i])
+ "] [" + level + "] " + name);
@@ -132,42 +132,42 @@
Bundle[] hosts = admin.getHosts(bundles[i]);
if (fragments != null) {
- io.out.print(" Fragments: ");
+ System.out.print(" Fragments: ");
int ii = 0;
for (Bundle fragment : fragments) {
ii++;
- io.out.print(fragment.getBundleId());
+ System.out.print(fragment.getBundleId());
if ((fragments.length > 1) && ii < (fragments.length)) {
- io.out.print(",");
+ System.out.print(",");
}
}
- io.out.println();
+ System.out.println();
}
if (hosts != null) {
- io.out.print(" Hosts: ");
+ System.out.print(" Hosts: ");
int ii = 0;
for (Bundle host : hosts) {
ii++;
- io.out.print(host.getBundleId());
+ System.out.print(host.getBundleId());
if ((hosts.length > 1) && ii < (hosts.length)) {
- io.out.print(",");
+ System.out.print(",");
}
}
- io.out.println();
+ System.out.println();
}
}
}
}
else {
- io.out.println("There are no installed bundles.");
+ System.out.println("There are no installed bundles.");
}
getBundleContext().ungetService(ref);
getBundleContext().ungetService(pkgref);
- return Result.SUCCESS;
+ return null;
}
public String getStateString(Bundle bundle)
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListServices.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListServices.java
index 8214de7..bf1d1ff 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListServices.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ListServices.java
@@ -18,12 +18,12 @@
import java.util.List;
-import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.geronimo.gshell.clp.Option;
-import org.apache.geronimo.gshell.command.Command;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Argument;
+import org.apache.felix.gogo.commands.Option;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.command.Function;
public class ListServices extends OsgiCommandSupport {
@@ -65,7 +65,7 @@
for (int ocIdx = 0;
!showAll && (ocIdx < objectClass.length);
ocIdx++) {
- if (objectClass[ocIdx].equals(Command.class.getName())) {
+ if (objectClass[ocIdx].equals(Function.class.getName())) {
print = false;
}
}
@@ -77,15 +77,15 @@
title = (inUse)
? title + " uses:"
: title + " provides:";
- io.out.println("");
- io.out.println(title);
- io.out.println(Util.getUnderlineString(title));
+ System.out.println("");
+ System.out.println(title);
+ System.out.println(Util.getUnderlineString(title));
}
if (showAll || print) {
// Print service separator if necessary.
if (needSeparator) {
- io.out.println("----");
+ System.out.println("----");
}
// Print service properties.
@@ -94,7 +94,7 @@
(keys != null) && (keyIdx < keys.length);
keyIdx++) {
Object v = refs[refIdx].getProperty(keys[keyIdx]);
- io.out.println(
+ System.out.println(
keys[keyIdx] + " = " + Util.getValueString(v));
}
@@ -102,7 +102,7 @@
}
}
} else {
- io.err.println("Bundle ID " + id + " is invalid.");
+ System.err.println("Bundle ID " + id + " is invalid.");
}
}
}
@@ -139,7 +139,7 @@
!showAll && (ocIdx < objectClass.length);
ocIdx++)
{
- if (objectClass[ocIdx].equals(Command.class.getName()))
+ if (objectClass[ocIdx].equals(Function.class.getName()))
{
print = false;
}
@@ -155,20 +155,20 @@
title = (inUse)
? title + " uses:"
: title + " provides:";
- io.out.println("\n" + title);
- io.out.println(Util.getUnderlineString(title));
+ System.out.println("\n" + title);
+ System.out.println(Util.getUnderlineString(title));
}
- io.out.println(Util.getValueString(objectClass));
+ System.out.println(Util.getValueString(objectClass));
}
}
}
}
else
{
- io.out.println("There are no registered services.");
+ System.out.println("There are no registered services.");
}
}
- return Result.SUCCESS;
+ return null;
}
}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/RefreshBundle.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/RefreshBundle.java
index 84e6cd1..cef9cac 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/RefreshBundle.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/RefreshBundle.java
@@ -16,8 +16,8 @@
*/
package org.apache.felix.karaf.gshell.osgi;
-import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Argument;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;
@@ -31,14 +31,14 @@
// Get package admin service.
ServiceReference ref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
if (ref == null) {
- io.out.println("PackageAdmin service is unavailable.");
- return Result.FAILURE;
+ System.out.println("PackageAdmin service is unavailable.");
+ return null;
}
try {
PackageAdmin pa = (PackageAdmin) getBundleContext().getService(ref);
if (pa == null) {
- io.out.println("PackageAdmin service is unavailable.");
- return Result.FAILURE;
+ System.out.println("PackageAdmin service is unavailable.");
+ return null;
}
if (id == null) {
pa.refreshPackages(null);
@@ -46,8 +46,8 @@
else {
Bundle bundle = getBundleContext().getBundle(id);
if (bundle == null) {
- io.out.println("Bundle " + id + " not found");
- return Result.FAILURE;
+ System.out.println("Bundle " + id + " not found");
+ return null;
}
pa.refreshPackages(new Bundle[] { bundle });
}
@@ -55,6 +55,6 @@
finally {
getBundleContext().ungetService(ref);
}
- return Result.SUCCESS;
+ return null;
}
}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ResolveBundle.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ResolveBundle.java
index 1af32e3..0abd965 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ResolveBundle.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/ResolveBundle.java
@@ -26,13 +26,13 @@
// Get package admin service.
ServiceReference ref = getBundleContext().getServiceReference(PackageAdmin.class.getName());
if (ref == null) {
- io.out.println("PackageAdmin service is unavailable.");
+ System.out.println("PackageAdmin service is unavailable.");
return;
}
try {
PackageAdmin pa = (PackageAdmin) getBundleContext().getService(ref);
if (pa == null) {
- io.out.println("PackageAdmin service is unavailable.");
+ System.out.println("PackageAdmin service is unavailable.");
return;
}
pa.resolveBundles(new Bundle[] { bundle });
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Shutdown.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Shutdown.java
index f73161a..3a2c3a9 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Shutdown.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Shutdown.java
@@ -16,7 +16,7 @@
*/
package org.apache.felix.karaf.gshell.osgi;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
import org.osgi.framework.Bundle;
/**
@@ -35,7 +35,7 @@
}
}
}.start();
- return Result.SUCCESS;
+ return null;
}
}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StartBundle.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StartBundle.java
index 28d931e..dff6282 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StartBundle.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StartBundle.java
@@ -18,7 +18,6 @@
import java.util.List;
-import org.apache.geronimo.gshell.clp.Option;
import org.osgi.framework.Bundle;
public class StartBundle extends BundlesCommand {
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StartLevel.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StartLevel.java
index f139815..2265500 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StartLevel.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StartLevel.java
@@ -16,8 +16,8 @@
*/
package org.apache.felix.karaf.gshell.osgi;
-import org.apache.geronimo.gshell.clp.Argument;
-import org.apache.felix.karaf.gshell.core.OsgiCommandSupport;
+import org.apache.felix.karaf.gshell.console.OsgiCommandSupport;
+import org.apache.felix.gogo.commands.Argument;
import org.osgi.framework.ServiceReference;
public class StartLevel extends OsgiCommandSupport {
@@ -29,18 +29,18 @@
// Get package admin service.
ServiceReference ref = getBundleContext().getServiceReference(org.osgi.service.startlevel.StartLevel.class.getName());
if (ref == null) {
- io.out.println("StartLevel service is unavailable.");
+ System.out.println("StartLevel service is unavailable.");
return null;
}
try {
org.osgi.service.startlevel.StartLevel sl = (org.osgi.service.startlevel.StartLevel) getBundleContext().getService(ref);
if (sl == null) {
- io.out.println("StartLevel service is unavailable.");
+ System.out.println("StartLevel service is unavailable.");
return null;
}
if (level == null) {
- io.out.println("Level " + sl.getStartLevel());
+ System.out.println("Level " + sl.getStartLevel());
}
else {
sl.setStartLevel(level);
@@ -49,7 +49,7 @@
finally {
getBundleContext().ungetService(ref);
}
- return Result.SUCCESS;
+ return null;
}
}
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StopBundle.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StopBundle.java
index 72addaa..4204f22 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StopBundle.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/StopBundle.java
@@ -18,7 +18,6 @@
import java.util.List;
-import org.apache.geronimo.gshell.clp.Option;
import org.osgi.framework.Bundle;
public class StopBundle extends BundlesCommand {
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/UpdateBundle.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/UpdateBundle.java
index 272459d..9a4afdb 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/UpdateBundle.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/UpdateBundle.java
@@ -19,7 +19,7 @@
import java.io.InputStream;
import java.net.URL;
-import org.apache.geronimo.gshell.clp.Argument;
+import org.apache.felix.gogo.commands.Argument;
import org.osgi.framework.Bundle;
public class UpdateBundle extends BundleCommand {
diff --git a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Util.java b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Util.java
index b43e720..e57579e 100644
--- a/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Util.java
+++ b/karaf/gshell/gshell-osgi/src/main/java/org/apache/felix/karaf/gshell/osgi/Util.java
@@ -20,12 +20,12 @@
import java.io.IOException;
-import org.apache.geronimo.gshell.io.IO;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceReference;
import org.osgi.service.startlevel.StartLevel;
+import org.osgi.service.command.CommandSession;
public class Util
{
@@ -139,21 +139,21 @@
* Ask the user to confirm the access to a system bundle
*
* @param bundleId
- * @param io
+ * @param session
* @return true if the user confirm
* @throws IOException
*/
- public static boolean accessToSystemBundleIsAllowed(long bundleId, IO io) throws IOException {
+ public static boolean accessToSystemBundleIsAllowed(long bundleId, CommandSession session) throws IOException {
for (;;) {
StringBuffer sb = new StringBuffer();
- io.err.print("You are about to access system bundle " + bundleId + ". Do you want to continue (yes/no): ");
- io.err.flush();
+ System.err.print("You are about to access system bundle " + bundleId + ". Do you want to continue (yes/no): ");
+ System.err.flush();
for (;;) {
- int c = io.in.read();
+ int c = session.getKeyboard().read();
if (c < 0) {
return false;
}
- io.err.print((char) c);
+ System.err.print((char) c);
if (c == '\r' || c == '\n') {
break;
}
diff --git a/karaf/gshell/gshell-osgi/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml b/karaf/gshell/gshell-osgi/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml
index e2cc24e..8dcc553 100644
--- a/karaf/gshell/gshell-osgi/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml
+++ b/karaf/gshell/gshell-osgi/src/main/resources/OSGI-INF/blueprint/gshell-osgi.xml
@@ -21,75 +21,48 @@
<command-bundle xmlns="http://felix.apache.org/karaf/xmlns/gshell/v1.0.0">
<command name="osgi/bundle-level">
- <action class="org.apache.felix.karaf.gshell.osgi.BundleLevel">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.BundleLevel"/>
</command>
<command name="osgi/headers">
- <action class="org.apache.felix.karaf.gshell.osgi.Headers">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.Headers"/>
</command>
<command name="osgi/install">
- <action class="org.apache.felix.karaf.gshell.osgi.InstallBundle">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.InstallBundle"/>
</command>
<command name="osgi/list">
<action class="org.apache.felix.karaf.gshell.osgi.ListBundles">
- <property name="bundleContext" ref="blueprintBundleContext"/>
<property name="blueprintListener" ref="blueprintListener"/>
</action>
</command>
<command name="osgi/ls">
- <action class="org.apache.felix.karaf.gshell.osgi.ListServices">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.ListServices"/>
</command>
<command name="osgi/refresh">
- <action class="org.apache.felix.karaf.gshell.osgi.RefreshBundle">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.RefreshBundle"/>
</command>
<command name="osgi/update">
- <action class="org.apache.felix.karaf.gshell.osgi.UpdateBundle">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.UpdateBundle"/>
</command>
<command name="osgi/resolve">
- <action class="org.apache.felix.karaf.gshell.osgi.ResolveBundle">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.ResolveBundle"/>
</command>
<command name="osgi/restart">
- <action class="org.apache.felix.karaf.gshell.osgi.RestartBundle">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.RestartBundle"/>
</command>
<command name="osgi/shutdown">
- <action class="org.apache.felix.karaf.gshell.osgi.Shutdown">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.Shutdown"/>
</command>
<command name="osgi/start">
- <action class="org.apache.felix.karaf.gshell.osgi.StartBundle">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.StartBundle"/>
</command>
<command name="osgi/start-level">
- <action class="org.apache.felix.karaf.gshell.osgi.StartLevel">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.StartLevel"/>
</command>
<command name="osgi/stop">
- <action class="org.apache.felix.karaf.gshell.osgi.StopBundle">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.StopBundle"/>
</command>
<command name="osgi/uninstall">
- <action class="org.apache.felix.karaf.gshell.osgi.UninstallBundle">
- <property name="bundleContext" ref="blueprintBundleContext"/>
- </action>
+ <action class="org.apache.felix.karaf.gshell.osgi.UninstallBundle"/>
</command>
</command-bundle>