I just spent a minute creating a patch for the old shell to register a
command to bridge to Gogo, it is attached. This is just a quick and
dirty example.
So, if you really need to use some old shell commands within Gogo, just
apply this patch to the source of the old shell and deploy it and
activate it. Then you should be able to run old commands like this:
bridge ps -s
The "bridge" command is a Gogo command, everything else is passed to the
shell service.
-> richard
On 11/22/10 9:34, Richard S. Hall wrote:
On 11/22/10 3:46, Felix Meschberger wrote:
Hi,
There are currently no scr commands for the gogo shell. This is
currently just a planned feature ...
It's actually pretty easy to convert commands from the old shell to
Gogo...I converted all the built-in commands and never ran into an
issue (once we got the approach figured out).
We could also create a single bundle that created a bridge from the
old shell commands to Gogo too, for those holdovers.
-> richard
Regards
Felix
Am Montag, den 22.11.2010, 16:28 +0800 schrieb Harry chen:
Hi,
I am getting start to learn about OSGI with Felix. As I know in Felix
Distribution 2.0, I can use "scr list, scr enable" to start a component
define by Declarative Service, "scr info" to get the detail of
specific component.
But when it changed to gogo shell in Felix Distribution 3.0. Is
there any
command can describle component information in gogo shell? Or did i
miss some bundle which is necessary. Thank you.
Sincerely
Roger Chen
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
Index: src/main/java/org/apache/felix/shell/impl/Activator.java
===================================================================
--- src/main/java/org/apache/felix/shell/impl/Activator.java (revision
1023911)
+++ src/main/java/org/apache/felix/shell/impl/Activator.java (working copy)
@@ -20,8 +20,10 @@
import java.io.PrintStream;
import java.security.*;
+import java.util.Hashtable;
import org.apache.felix.shell.Command;
+import org.apache.felix.shell.gogo.GogoBridge;
import org.osgi.framework.*;
import org.osgi.util.tracker.ServiceTracker;
@@ -156,6 +158,14 @@
context.registerService(
org.apache.felix.shell.Command.class.getName(),
new VersionCommandImpl(m_context), null);
+
+ // Register Gogo bridge command service.
+ Hashtable props = new Hashtable();
+ props.put("osgi.command.scope", "felix");
+ props.put("osgi.command.function", new String[] { "bridge" });
+ context.registerService(
+ GogoBridge.class.getName(),
+ new GogoBridge(m_shell), props);
}
public void stop(BundleContext context)
Index: src/main/java/org/apache/felix/shell/gogo/GogoBridge.java
===================================================================
--- src/main/java/org/apache/felix/shell/gogo/GogoBridge.java (revision 0)
+++ src/main/java/org/apache/felix/shell/gogo/GogoBridge.java (revision 0)
@@ -0,0 +1,45 @@
+/*
+ * 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.felix.shell.gogo;
+
+import org.apache.felix.shell.ShellService;
+
+public class GogoBridge
+{
+ private final ShellService m_shell;
+
+ public GogoBridge(ShellService shell)
+ {
+ m_shell = shell;
+ }
+
+ public void bridge(Object[] objs) throws Exception
+ {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < objs.length; i++)
+ {
+ if (i != 0)
+ {
+ sb.append(" ");
+ }
+ sb.append(objs[i].toString());
+ }
+ m_shell.executeCommand(sb.toString(), System.out, System.err);
+ }
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]