karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Amichai Rothman (JIRA)" <j...@apache.org>
Subject [jira] [Created] (KARAF-2508) make osgi:find-class a more useful command
Date Wed, 09 Oct 2013 08:52:42 GMT
Amichai Rothman created KARAF-2508:
--------------------------------------

             Summary: make osgi:find-class a more useful command
                 Key: KARAF-2508
                 URL: https://issues.apache.org/jira/browse/KARAF-2508
             Project: Karaf
          Issue Type: Improvement
          Components: karaf-shell
    Affects Versions: 2.3.3
            Reporter: Amichai Rothman
            Priority: Minor


I recently had to track down which bundle contains a certain class, and found the find-class
command wanting. A few simple improvements would make it much more useful:

1. Add an --exact/-e option which doesn't automatically add asterisks at both ends of the
string. In my case I was looking for the javax.jms.Connection class, and since the search
is only on the last part of the name, this returned all classes in all packages which have
the word Connection in their name, which added up to hundreds of results. with --exact I could
look for what I want exactly, or choose to add asterisks at one or both ends explicitly in
the search string if I wanted to.

2. Add a --local/-l option which adds BundleWiring.LISTRESOURCES_LOCAL to the listResources
method call bitmask. With the current implementation, it returns both bundles containing the
given class name and classes that import it from other bundles, which is useful in some cases.
But with the --local option it could show only the bundles that actually contain the class
(whether exported or not, unlike the exports command), which is far more useful in tracking
down some classloading issues.

3. Add the bundle ID (at least) on the beginning of every printed line. This makes it amenable
to grepping (without it a grep loses all bundle information, which is the whole point of using
this command).

4. As a somewhat more complex alternative to #3, it would be nice if you could specify a fully
qualified class name and not only the last part of the name. The command can split the search
string around periods, pass the last part to listResources, then internally grep/match the
full name. That would make it truly flexible in finding classes. Asterisks would have to be
treated accordingly.

I think adding these options (#1-#3 are trivial implementations), or at least some of them,
would make the command extremely useful when performing classloading diagnosis.




--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message