The gogo ‘bundle’ command, is not a specific command, it is actually a direct 
call to the BundleContext.getBundle() method.

You can determine this using the ‘type’ command:

g! type -t bundle
Bundle org.apache.felix.framework.BundleContextImpl.getBundle()
Bundle org.apache.felix.framework.BundleContextImpl.getBundle(long)
Bundle org.apache.felix.framework.BundleContextImpl.getBundle(String)


All the methods are registered as commands by the gogo shell startup:
(gogo startup actually executes the gosh_profile script embedded within the 
togo.shell bundle)

# add methods on BundleContext object as commands
addcommand context ${.context}


You mentioned that you are not using the gogo.shell bundle as you do not want 
interactive input:
You can also achieve this by setting the System property -Dgogo.args=—no 
interactive

—
Derek






On 6 Mar 2014, at 10:16, Dan <[email protected]> wrote:

> Unfortunately, when I come to execute the first command on a deployment 
> machine, I get:
> 
> org.apache.felix.gogo.runtime.CommandNotFoundException: Command not found: 
> bundle
> 
> In production, the application runs without org.apache.felix.gogo.shell, and 
> with my own bundle which looks like this:
> 
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> ByteArrayOutputStream err = new ByteArrayOutputStream();
> commandSession = commandProcessor.createSession(System.in, new 
> PrintStream(out), new PrintStream(err));
> 
> and calls 
> 
> private synchronized String executeCommand(String command) throws Exception {
>       out.reset();
>       err.reset();
>       Object result = commandSession.execute(command);
>       String reply = out.toString() + err.toString();
>       return reply;
> }
> 
> when commands are received from the server.
> 
> Is there anything in this setup that would lead to the above error? 
> (Something I'm missing from the gogo.shell bundle, for example?)
> 
> On 6 Mar 2014, at 09:39, Dan wrote:
> 
>> g! addcommand runtime ((bundle 0) loadClass java.lang.Runtime)
>> g! addcommand rt (runtime:getRuntime)
>> g! rt:maxMemory
>> 1256456192
>> 
>> Thanks for the help, Dan.
>> 
>> On 6 Mar 2014, at 09:15, Daniel McGreal wrote:
>> 
>>> Success, thank you.
>>> Going to try and reach the runtime now, unless someone can provide a hint?
>>> 
>>> I wish to call Runtime.maxMemory() for example
>>> 
>>> 
>>> On 5 Mar 2014, at 17:06, Richard S. Hall wrote:
>>> 
>>>> g! addcommand system ((bundle 0) loadClass java.lang.System)
>>> 
>> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to