diff options
author | Thomas Watson | 2013-04-16 02:04:02 +0000 |
---|---|---|
committer | Thomas Watson | 2013-04-16 02:04:02 +0000 |
commit | 10810299db2df4e1de61c5d8065779cd88de20a0 (patch) | |
tree | 812da264997db0325c368add70a16b231fd4e5b6 /bundles/org.eclipse.equinox.console | |
parent | a157cf99b0e02ce6c26087587d1f67914ce925eb (diff) | |
parent | 473476ae4d875fc06e90c7fadc0436427e8b55a5 (diff) | |
download | rt.equinox.bundles-10810299db2df4e1de61c5d8065779cd88de20a0.tar.gz rt.equinox.bundles-10810299db2df4e1de61c5d8065779cd88de20a0.tar.xz rt.equinox.bundles-10810299db2df4e1de61c5d8065779cd88de20a0.zip |
Merge branch 'master' into twatson/container
Diffstat (limited to 'bundles/org.eclipse.equinox.console')
6 files changed, 37 insertions, 19 deletions
diff --git a/bundles/org.eclipse.equinox.console/forceQualifierUpdate.txt b/bundles/org.eclipse.equinox.console/forceQualifierUpdate.txt new file mode 100644 index 000000000..56f1032a8 --- /dev/null +++ b/bundles/org.eclipse.equinox.console/forceQualifierUpdate.txt @@ -0,0 +1,2 @@ +# To force a version qualifier update add the bug here +Bug 403352 - Update all parent versions to match our build stream diff --git a/bundles/org.eclipse.equinox.console/pom.xml b/bundles/org.eclipse.equinox.console/pom.xml index 235efdbca..04f72a28f 100644 --- a/bundles/org.eclipse.equinox.console/pom.xml +++ b/bundles/org.eclipse.equinox.console/pom.xml @@ -9,14 +9,12 @@ Contributors: Igor Fedorenko - initial implementation --> - -<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <artifactId>rt.equinox.bundles</artifactId> <groupId>org.eclipse.equinox.bundles</groupId> - <version>3.8.0-SNAPSHOT</version> + <version>4.3.0-SNAPSHOT</version> <relativePath>../../</relativePath> </parent> <groupId>org.eclipse.equinox</groupId> diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CommandProviderAdapter.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CommandProviderAdapter.java index f78483525..d6a7ebef4 100755 --- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CommandProviderAdapter.java +++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CommandProviderAdapter.java @@ -16,6 +16,7 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; +import org.apache.felix.service.command.CommandSession; import org.eclipse.osgi.framework.console.CommandProvider; /** @@ -36,14 +37,14 @@ public class CommandProviderAdapter { this.commands = commands; } - public Object main(Object[] args) throws Exception { + public Object main(CommandSession commandSession, Object[] args) throws Exception { try { // first argument is the command Method command = findCommand("_" + args[0]); ArrayList<Object> argList = new ArrayList<Object>(); for (int i = 1; i < args.length; i++) argList.add(args[i]); - return command.invoke(commandProvider, new CustomCommandInterpreter(argList)); + return command.invoke(commandProvider, new CustomCommandInterpreter(commandSession, argList)); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof Exception) throw (Exception) e.getTargetException(); @@ -60,7 +61,7 @@ public class CommandProviderAdapter { } // TODO Felix gogo seems to search for _main - public Object _main(Object[] args) throws Exception { - return main(args); + public Object _main(CommandSession commandSession, Object[] args) throws Exception { + return main(commandSession, args); } } diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java index c401e361b..5feaeb436 100755 --- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java +++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/command/adapter/CustomCommandInterpreter.java @@ -11,10 +11,20 @@ *******************************************************************************/ package org.eclipse.equinox.console.command.adapter; -import java.io.*; -import java.lang.reflect.*; +import java.io.IOException; +import java.io.InputStream; +import java.io.PrintStream; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; import java.net.URL; -import java.util.*; +import java.util.Arrays; +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.Iterator; +import java.util.List; + +import org.apache.felix.service.command.CommandSession; import org.eclipse.osgi.framework.console.CommandInterpreter; import org.osgi.framework.Bundle; @@ -29,6 +39,7 @@ public class CustomCommandInterpreter implements CommandInterpreter { private String tab = "\t"; //$NON-NLS-1$ private String newline = "\r\n"; //$NON-NLS-1$ private final Iterator<Object> arguments; + private final CommandSession commandSession; /** * The maximum number of lines to print without user prompt. * 0 means no user prompt is required, the window is scrollable. @@ -38,12 +49,19 @@ public class CustomCommandInterpreter implements CommandInterpreter { /** The number of lines printed without user prompt.*/ protected int currentLineCount; - public CustomCommandInterpreter(List<Object> args) { + public CustomCommandInterpreter(CommandSession commandSession, List<Object> args) { + this.commandSession = commandSession; arguments = args.iterator(); } public Object execute(String cmd) { - return null; + try { + return commandSession.execute(cmd); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new RuntimeException(e); + } } public String nextArgument() { diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java index af44c5747..b89fba195 100755 --- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java +++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/EquinoxCommandProvider.java @@ -1093,7 +1093,6 @@ public class EquinoxCommandProvider implements SynchronousBundleListener { public void close() throws Exception { if (confirmStop()) { context.getBundle(0).stop(); - System.exit(0); } } diff --git a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/HelpCommand.java b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/HelpCommand.java index 6a4461f3c..ddd59e509 100755 --- a/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/HelpCommand.java +++ b/bundles/org.eclipse.equinox.console/src/org/eclipse/equinox/console/commands/HelpCommand.java @@ -18,8 +18,6 @@ import java.util.HashSet; import java.util.Hashtable; import java.util.Set; -import org.apache.felix.service.command.CommandProcessor; -import org.apache.felix.service.command.CommandSession; import org.eclipse.equinox.console.command.adapter.CustomCommandInterpreter; import org.eclipse.osgi.framework.console.CommandInterpreter; import org.eclipse.osgi.framework.console.CommandProvider; @@ -29,6 +27,8 @@ import org.osgi.framework.Constants; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTracker; import org.osgi.util.tracker.ServiceTrackerCustomizer; +import org.apache.felix.service.command.CommandProcessor; +import org.apache.felix.service.command.CommandSession; /** * This class provides help for the legacy equinox commands, which are adapted to Gogo commands. @@ -116,7 +116,7 @@ public class HelpCommand { } if (command != null) { - printLegacyCommandHelp(command); + printLegacyCommandHelp(session, command); printGogoCommandHelp(session, command); return; } @@ -158,7 +158,7 @@ public class HelpCommand { } } - private void printLegacyCommandHelp(String command) { + private void printLegacyCommandHelp(final CommandSession session, String command) { for (CommandProvider provider : legacyCommandProviders) { Method[] methods = provider.getClass().getMethods(); for (Method method : methods) { @@ -168,7 +168,7 @@ public class HelpCommand { Method helpMethod = provider.getClass().getMethod("_help", CommandInterpreter.class); ArrayList<Object> argsList = new ArrayList<Object>(); argsList.add(command); - retval = helpMethod.invoke(provider, new CustomCommandInterpreter(argsList)); + retval = helpMethod.invoke(provider, new CustomCommandInterpreter(session, argsList)); } catch (Exception e) { System.out.println(provider.getHelp()); break; |