You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Todor Boev <ri...@gmail.com> on 2018/11/13 09:30:53 UTC

Bundle inspection command for gogo

Hello,

Can we add a "bundle" command to gogo that will list a readable summary for
a target bundle?
Calling BundleContext.getBundle() and looking at the raw object print is
almost useless.

Also is there any reason this was not done until now?

Regards,
Todor

Re: Bundle inspection command for gogo

Posted by Karl Pauls <ka...@gmail.com>.
On Tue, Nov 13, 2018 at 1:56 PM Todor Boev <ri...@gmail.com> wrote:
>
> Yes I know of this output.
> As I said it is nearly useless compared to the equinox "bundle Id" and
> "services filter" methods.
> What I really want is to dump all bundle wires, all exported services, all
> bound services.
> In a nice list.
> So I guess someone has to implement Neil's suggestion.

Patches are welcome :-)

regards,

Karl


> On Tue, Nov 13, 2018 at 12:44 PM Derek Baum <de...@baums.org.uk> wrote:
>
> > There is an inspect(Object) method in
> > org.apache.felix.gogo.runtime.CommandSessionImpl, which is used when no
> > more specific formatter is found.
> >
> > It uses reflection to invoke all public no-args methods on the target
> > object and formats each using the LINE level.
> >
> > For example, see that the value for Bundle uses LINE format, so resembles
> > the output of the lb command (which also uses LINE format):
> >
> > g! bundle 0
> > Location             System Bundle
> > State                32
> > BundleContext        org.apache.felix.framework.BundleContextImpl@f572ebb
> > BundleId             0
> > SymbolicName         org.apache.felix.framework
> > RegisteredServices   [Resolver, PackageAdmin, StartLevel]
> > ServicesInUse        [StartLevel]
> > Version              5.6.10
> > PersistentState      32
> > Bundle                   0|Active     |    0|org.apache.felix.framework
> > (5.6.10)
> > Revisions            [org.apache.felix.framework [0](R 0)]
> > LastModified         0
> > Headers              [Export-Package=org.osgi.dto; version="1.0.0",
> > org.osgi.framework; version="1.8.0",
> > -- snip --
> >
> > --
> > Derek
> >
> > > On 13 Nov 2018, at 09:48, Neil Bartlett <nj...@gmail.com> wrote:
> > >
> > > There is already a bundle command which returns a Bundle object. The
> > > problem is the formatting of that object, which is controlled by
> > > the org.apache.felix.service.command.Converter service.
> > >
> > > The implementation class org.apache.felix.gogo.shell.Converters (from the
> > > shell bundle) implements a format method for Bundle objects at the LINE
> > and
> > > PART detail levels, which is why the output of the lb command doesn't
> > look
> > > terrible. It seems to lack an implementation for the INSPECT level
> > however.
> > >
> > > Regards,
> > > Neil
> > >
> > > On Tue, Nov 13, 2018 at 9:38 AM Todor Boev <ri...@gmail.com> wrote:
> > >
> > >> Hello,
> > >>
> > >> Can we add a "bundle" command to gogo that will list a readable summary
> > for
> > >> a target bundle?
> > >> Calling BundleContext.getBundle() and looking at the raw object print is
> > >> almost useless.
> > >>
> > >> Also is there any reason this was not done until now?
> > >>
> > >> Regards,
> > >> Todor
> > >>
> >
> >



-- 
Karl Pauls
karlpauls@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Bundle inspection command for gogo

Posted by Todor Boev <ri...@gmail.com>.
Yes I know of this output.
As I said it is nearly useless compared to the equinox "bundle Id" and
"services filter" methods.
What I really want is to dump all bundle wires, all exported services, all
bound services.
In a nice list.
So I guess someone has to implement Neil's suggestion.

On Tue, Nov 13, 2018 at 12:44 PM Derek Baum <de...@baums.org.uk> wrote:

> There is an inspect(Object) method in
> org.apache.felix.gogo.runtime.CommandSessionImpl, which is used when no
> more specific formatter is found.
>
> It uses reflection to invoke all public no-args methods on the target
> object and formats each using the LINE level.
>
> For example, see that the value for Bundle uses LINE format, so resembles
> the output of the lb command (which also uses LINE format):
>
> g! bundle 0
> Location             System Bundle
> State                32
> BundleContext        org.apache.felix.framework.BundleContextImpl@f572ebb
> BundleId             0
> SymbolicName         org.apache.felix.framework
> RegisteredServices   [Resolver, PackageAdmin, StartLevel]
> ServicesInUse        [StartLevel]
> Version              5.6.10
> PersistentState      32
> Bundle                   0|Active     |    0|org.apache.felix.framework
> (5.6.10)
> Revisions            [org.apache.felix.framework [0](R 0)]
> LastModified         0
> Headers              [Export-Package=org.osgi.dto; version="1.0.0",
> org.osgi.framework; version="1.8.0",
> -- snip --
>
> --
> Derek
>
> > On 13 Nov 2018, at 09:48, Neil Bartlett <nj...@gmail.com> wrote:
> >
> > There is already a bundle command which returns a Bundle object. The
> > problem is the formatting of that object, which is controlled by
> > the org.apache.felix.service.command.Converter service.
> >
> > The implementation class org.apache.felix.gogo.shell.Converters (from the
> > shell bundle) implements a format method for Bundle objects at the LINE
> and
> > PART detail levels, which is why the output of the lb command doesn't
> look
> > terrible. It seems to lack an implementation for the INSPECT level
> however.
> >
> > Regards,
> > Neil
> >
> > On Tue, Nov 13, 2018 at 9:38 AM Todor Boev <ri...@gmail.com> wrote:
> >
> >> Hello,
> >>
> >> Can we add a "bundle" command to gogo that will list a readable summary
> for
> >> a target bundle?
> >> Calling BundleContext.getBundle() and looking at the raw object print is
> >> almost useless.
> >>
> >> Also is there any reason this was not done until now?
> >>
> >> Regards,
> >> Todor
> >>
>
>

Re: Bundle inspection command for gogo

Posted by Derek Baum <de...@baums.org.uk>.
There is an inspect(Object) method in org.apache.felix.gogo.runtime.CommandSessionImpl, which is used when no more specific formatter is found.

It uses reflection to invoke all public no-args methods on the target object and formats each using the LINE level.

For example, see that the value for Bundle uses LINE format, so resembles the output of the lb command (which also uses LINE format):

g! bundle 0
Location             System Bundle
State                32
BundleContext        org.apache.felix.framework.BundleContextImpl@f572ebb
BundleId             0
SymbolicName         org.apache.felix.framework
RegisteredServices   [Resolver, PackageAdmin, StartLevel]
ServicesInUse        [StartLevel]
Version              5.6.10
PersistentState      32
Bundle                   0|Active     |    0|org.apache.felix.framework (5.6.10)
Revisions            [org.apache.felix.framework [0](R 0)]
LastModified         0
Headers              [Export-Package=org.osgi.dto; version="1.0.0", org.osgi.framework; version="1.8.0",
-- snip --

--
Derek

> On 13 Nov 2018, at 09:48, Neil Bartlett <nj...@gmail.com> wrote:
> 
> There is already a bundle command which returns a Bundle object. The
> problem is the formatting of that object, which is controlled by
> the org.apache.felix.service.command.Converter service.
> 
> The implementation class org.apache.felix.gogo.shell.Converters (from the
> shell bundle) implements a format method for Bundle objects at the LINE and
> PART detail levels, which is why the output of the lb command doesn't look
> terrible. It seems to lack an implementation for the INSPECT level however.
> 
> Regards,
> Neil
> 
> On Tue, Nov 13, 2018 at 9:38 AM Todor Boev <ri...@gmail.com> wrote:
> 
>> Hello,
>> 
>> Can we add a "bundle" command to gogo that will list a readable summary for
>> a target bundle?
>> Calling BundleContext.getBundle() and looking at the raw object print is
>> almost useless.
>> 
>> Also is there any reason this was not done until now?
>> 
>> Regards,
>> Todor
>> 


Re: Bundle inspection command for gogo

Posted by Neil Bartlett <nj...@gmail.com>.
There is already a bundle command which returns a Bundle object. The
problem is the formatting of that object, which is controlled by
the org.apache.felix.service.command.Converter service.

The implementation class org.apache.felix.gogo.shell.Converters (from the
shell bundle) implements a format method for Bundle objects at the LINE and
PART detail levels, which is why the output of the lb command doesn't look
terrible. It seems to lack an implementation for the INSPECT level however.

Regards,
Neil

On Tue, Nov 13, 2018 at 9:38 AM Todor Boev <ri...@gmail.com> wrote:

> Hello,
>
> Can we add a "bundle" command to gogo that will list a readable summary for
> a target bundle?
> Calling BundleContext.getBundle() and looking at the raw object print is
> almost useless.
>
> Also is there any reason this was not done until now?
>
> Regards,
> Todor
>