Bug 217738 - [registry view] show OSGi service information
Summary: [registry view] show OSGi service information
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Jacek Pospychala CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, noteworthy
Depends on:
Blocks: 220110
  Show dependency tree
 
Reported: 2008-02-04 15:28 EST by Chris Aniszczyk CLA
Modified: 2009-03-06 14:31 EST (History)
6 users (show)

See Also:


Attachments
first shot (7.15 KB, patch)
2008-02-06 10:35 EST, Jacek Pospychala CLA
no flags Details | Diff
mylyn/context/zip (5.44 KB, application/octet-stream)
2008-02-06 10:36 EST, Jacek Pospychala CLA
no flags Details
screenshot (22.28 KB, image/png)
2008-02-06 10:37 EST, Jacek Pospychala CLA
no flags Details
Icons (1.22 KB, application/octet-stream)
2008-02-06 13:20 EST, Simon Archer CLA
no flags Details
patch v2 (13.69 KB, patch)
2008-02-06 19:06 EST, Jacek Pospychala CLA
no flags Details | Diff
mylyn/context/zip (9.82 KB, application/octet-stream)
2008-02-06 19:06 EST, Jacek Pospychala CLA
no flags Details
patch v3 (18.39 KB, patch)
2008-02-08 12:54 EST, Jacek Pospychala CLA
no flags Details | Diff
dynamic.joe (7.83 KB, multipart/x-zip)
2008-02-08 12:58 EST, Jacek Pospychala CLA
no flags Details
org.eclipse.pde.runtime.patch (22.47 KB, patch)
2008-02-12 19:59 EST, Chris Aniszczyk CLA
no flags Details | Diff
updated screenshot (17.96 KB, image/png)
2008-02-12 20:14 EST, Chris Aniszczyk CLA
no flags Details
patch (23.40 KB, patch)
2008-02-24 15:48 EST, Jacek Pospychala CLA
no flags Details | Diff
service-icon (357 bytes, multipart/x-zip)
2008-02-24 15:48 EST, Jacek Pospychala CLA
no flags Details
updated dynamic services test view (9.46 KB, multipart/x-zip)
2008-02-24 16:00 EST, Jacek Pospychala CLA
no flags Details
updated patch (23.37 KB, patch)
2008-03-17 17:31 EDT, Jacek Pospychala CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Aniszczyk CLA 2008-02-04 15:28:30 EST
In the plug-in registry view, it would be nice to show information about OSGi services being published and consumed.
Comment 1 Simon Archer CLA 2008-02-04 15:58:35 EST
+1
Comment 2 Chris Aniszczyk CLA 2008-02-04 16:01:31 EST
Simon, well isn't that a given ;)
Comment 3 Jacek Pospychala CLA 2008-02-04 17:44:06 EST
It'd be great if registry was flexible enough to plug into this services. For example:
-for HTTP service - show what servlets are registered
-for Log service - notify on log event arrival
-for UserAdmin service - allow browsing users
-for Preferences service - browse preferences
-etc. etc. for some other std. services

That would help service consumers test their solutions.

This way service implementer could see if he correctly consumes service.
It doesn't have happen in this bug, but would be good to consider this.
Comment 4 Simon Archer CLA 2008-02-05 10:08:15 EST
As a follow up to Jacek's comment 3, I would like to see the Configuration for a ManagedService, and the Configurations for a ManagedServiceFactory to be displayed too.  Clearly it would be useful to be able to see the properties for each Configuration.

But maybe this behavior needs to be in a view specific to ConfigurationAdmin... Back in the days of SMF there was a ConfigurationAdmin servlet that let you remotely manage Configurations.  The servlet would generate a page that allowed you to add a Configuration based on properties defined by the bundle's OSGi Metadata.xml.

I know that Dave Lavin wrote his own servlet that does much the same thing.  He wrote this when we moved from SMF to Equinox.  I mention this since we were talking recently of the possibility of this being supported by an Eclipse view and maybe finding a new home for the servlet outside of the Eclipse Technology/OHF project.
Comment 5 Jacek Pospychala CLA 2008-02-06 10:35:52 EST
Created attachment 89012 [details]
first shot

first shot at services.
Lists services registered by bundles.
We'd need some icons to represent a "Services" folder and a single "Service".
Now I'll be investigating certain services that could get first support.

Dave, I'd be nice too see your servlet :)
Comment 6 Jacek Pospychala CLA 2008-02-06 10:36:03 EST
Created attachment 89013 [details]
mylyn/context/zip
Comment 7 Jacek Pospychala CLA 2008-02-06 10:37:13 EST
Created attachment 89014 [details]
screenshot
Comment 8 Chris Aniszczyk CLA 2008-02-06 10:40:51 EST
Cool stuff Jacek, let's just keep this bug open to show service information... nothing specific or fancy. Other bugs should be open to show more specific information about particular services, like the http service.
Comment 9 Simon Archer CLA 2008-02-06 13:19:51 EST
In addition to "registered services" (which in the screenshot are displayed as "Services"), it would be useful to see "services in use".

Some thought needs to go into how to describe these services.  In the distant past OSGi referred to these as "Exported Services" and "Imported Services", but these terms are no longer used.  Other possible terms might be "Registered Services" and "Acquired Services".  The OSGi APIs will lead you to "Services In Use", which is good, if a little wordy.

In my SAT tooling I have four icons that are used to decorate a bundle that:

- Acquires a service.
- Registers a service.
- Acquires and registers a service.
- Neither acquires a service nor register a service.
Comment 10 Simon Archer CLA 2008-02-06 13:20:37 EST
Created attachment 89037 [details]
Icons
Comment 11 Jacek Pospychala CLA 2008-02-06 13:34:40 EST
(In reply to comment #10)

wow icons!

Simon,
The code so far shows all service references using:

bundleContext.getAllServiceReferences(null, null)

grouped by bundles which have registered them. I'm not sure why some items are displayed multiple times and whether it's good to keep as is, or should I make them display only once.

I see there's also ServiceReference#getUsingBundles(), which would probably do what you want.

btw, what's SAT, can we really use these icons?
Comment 12 Simon Archer CLA 2008-02-06 15:24:03 EST
SAT is an OSGi toolkit that is part of the Eclipse Technology OHF project.  SAT started life at OTI back in 2001... it was built as an enabling framework to make it quick and easy to build OSGi service-oriented applications composed of many fine-grained bundles.  I am the sole committer for the code, but it really is the result of the experience of many people attempting to build real-world applications, mostly in the embedded space.

Those icons are actually part of SAT's tooling, and while they were created by me, they are based on some old SMF icons.  At the time of their creation SAT was not part of Eclipse, but it is now.  SMF, of course, is what became Equinox, minus the SMF tooling.  Nevertheless, I don't think the icons fit so well with the other artwork of the view... you should probably stick with the "plug-in" theme, but add some decorators to show that the bundle exports/imports a service.  My intention was for the icons to be food-for-thought.

For more on SAT, see the web-hosted doc:

http://www.vanderleiindustries.com/sat/help/topic/org.eclipse.soda.sat.plugin.doc/books/book.html

Downloads are available from Eclipse.org's OHF page, or from the SAT blog, http://eclipse-sat.blogspot.com/.

Comment 13 Simon Archer CLA 2008-02-06 15:35:18 EST
>The code so far shows all service references using:
>
>bundleContext.getAllServiceReferences(null, null)

You should compare the results of this API with that of getServiceReferences(String, String).  The getAllServiceReferences is a more general query that
handles some special cases, which you might not care about, so please read the javadoc and compare the results.

>grouped by bundles which have registered them. I'm not sure why some
>items are displayed multiple times and whether it's good to keep as
>is, or should I make them display only once.

I would imagine that pruning duplicates would be the right thing to do, especially if they really are the same ServiceReference.  By "same", I mean "identical", of course.

>I see there's also ServiceReference#getUsingBundles(), which would
>probably do what you want.

Yes, that's the API you want to use.  You might find it helpful to compare what you see in the view with what the console's "bundle <id>" command shows you... this will word-wrap horribly, but you get the idea.

osgi> bundle 0
System Bundle [0]
  Id=0, Status=ACTIVE      
  Registered Services
    {org.eclipse.osgi.service.runnable.StartupMonitor}={service.ranking=-2147483648, service.id=1}
    {org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2}
    {org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3}
    {org.eclipse.osgi.framework.log.FrameworkLog}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.adaptor.EclipseLog, service.vendor=Eclipse.org, service.id=4}
    {org.eclipse.osgi.framework.log.FrameworkLog}={service.ranking=-2147483648, performance=true, service.pid=46org.eclipse.core.runtime.adaptor.EclipseLog, service.vendor=Eclipse.org, service.id=5}
    {javax.xml.parsers.SAXParserFactory}={service.id=6}
    {javax.xml.parsers.DocumentBuilderFactory}={service.id=7}
    {org.eclipse.osgi.service.datalocation.Location}={type=osgi.user.area, service.id=8}
    {org.eclipse.osgi.service.datalocation.Location}={type=osgi.instance.area, service.id=9}
    {org.eclipse.osgi.service.datalocation.Location}={type=osgi.configuration.area, service.id=10}
    {org.eclipse.osgi.service.datalocation.Location}={type=osgi.install.area, service.id=11}
    {org.eclipse.osgi.service.urlconversion.URLConverter}={protocol=[bundleentry,bundleresource], service.id=12}
    {org.eclipse.osgi.service.environment.EnvironmentInfo}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.EclipseEnvironmentInfo, service.vendor=Eclipse.org, service.id=13}
    {org.eclipse.osgi.service.resolver.PlatformAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.internal.baseadaptor.StateManager, service.vendor=Eclipse.org, service.id=14}
    {org.eclipse.osgi.service.pluginconversion.PluginConverter}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.PluginConverterImpl, service.vendor=Eclipse.org, service.id=15}
    {org.eclipse.osgi.framework.console.CommandProvider}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.EclipseCommandProvider, service.vendor=Eclipse.org, service.id=16}
    {org.eclipse.osgi.service.localization.BundleLocalization}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.BundleLocalizationImpl, service.vendor=Eclipse.org, service.id=17}
    {org.eclipse.osgi.internal.provisional.verifier.CertificateVerifierFactory}={service.id=18}
    {org.eclipse.osgi.internal.provisional.verifier.CertificateTrustAuthority}={service.ranking=-2147483648, osgi.certificate.trust.authority=org.eclipse.osgi, service.id=19}
    {org.eclipse.osgi.framework.console.CommandProvider}={service.ranking=2147483647, service.id=20}
  Services in use:
    {org.eclipse.osgi.framework.console.CommandProvider}={service.ranking=2147483647, service.pid=0.org.eclipse.core.runtime.internal.adaptor.EclipseCommandProvider, service.vendor=Eclipse.org, service.id=16}
    {org.eclipse.osgi.framework.console.CommandProvider}={service.ranking=2147483647, service.id=20}
    {org.osgi.service.startlevel.StartLevel}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.StartLevelManager, service.vendor=Eclipse.org, service.id=3}
    {org.osgi.service.packageadmin.PackageAdmin}={service.ranking=2147483647, service.pid=0.org.eclipse.osgi.framework.internal.core.PackageAdminImpl, service.vendor=Eclipse.org, service.id=2}
Comment 14 Jacek Pospychala CLA 2008-02-06 19:06:46 EST
Created attachment 89093 [details]
patch v2

Simon, thanks for all the hints!

I've checked the getAllServiceReferences(String,String) vs. getServiceReferences(String,String) and getAllServiceReferences(String,String) is better here, because it doesn't do any filtering whereas the other method filters all services that are not assignable to bundle (in this case PDERuntime bundle).

I have also split services into registered and those in use. If a service is both registered and used by bundle it appears on both lists with special icon. I've used three of your icons (imported, exported, imported-exported) to identify services that are used by bundle, registered by bundle, or both.

The thing that needs some work now is ServiceListener to update viewer contents on dynamic changes.
Patch assumes, icons from zip are in icons/ directory.
Comment 15 Jacek Pospychala CLA 2008-02-06 19:06:50 EST
Created attachment 89094 [details]
mylyn/context/zip
Comment 16 Jacek Pospychala CLA 2008-02-08 12:54:09 EST
Created attachment 89282 [details]
patch v3

patch updated to support dynamically adding/removing services on base of framework.ServiceListener.

It's ready for review.

As soon as it's commited, I'll create new bugs to address additional functionality discussed above.
Comment 17 Jacek Pospychala CLA 2008-02-08 12:58:00 EST
Created attachment 89284 [details]
dynamic.joe

here's a simple view to simulate dynamic services. Has two buttons "Register service" and "Unregister servce". Good for testing :)
Comment 18 Chris Aniszczyk CLA 2008-02-12 19:59:46 EST
Created attachment 89579 [details]
org.eclipse.pde.runtime.patch

Here is an updated patch with some cleanup.
Comment 19 Chris Aniszczyk CLA 2008-02-12 20:10:05 EST
Things TODO:

- Is this really the best way to present services? Basically by bundle and whether it uses or registers them? Simon?
- We should have an option to 'Show Service Content Only' similar to what we do with Extension Content
- I don't like how we circumvented RegistryBrowserContentProvider.createAdapter(Object, int) ie., is there a way we can do this similar to how we create the other adapters?
- I think we need better icons, but I can take care of that with a gfx request
Comment 20 Chris Aniszczyk CLA 2008-02-12 20:14:49 EST
Created attachment 89580 [details]
updated screenshot

Here is how it looks right now.

Any comments Simon and other OSGi enthusiasts?
Comment 21 Chris Aniszczyk CLA 2008-02-12 20:15:19 EST
cc'ng Tom as I hear he has an opinion on OSGi services ;)
Comment 22 Simon Archer CLA 2008-02-12 22:00:57 EST
>> Is this really the best way to present services? Basically by bundle
>> and whether it uses or registers them?

Yes, I think this is at least one way that people want to see them.  Another way is to simply list all the services, and then under each one list the bundles that register/uses them.  Remember, a single service can be registered by multiple bundles.

The bundles-service relationship can be looked at either way, and I think being able to observe a running system from both points of view is valuable.

Looking at the latest screen shot I find the icons to be confusing.  Assuming the following icons:

[p] = plugin
[e] = exported service
[i] = imported service
[b] = both, exported and imported service

I see...

[p]  org.eclipse.equinox.registry
  [e] Registered Services
    [b] org.eclipse.core.runtime.IExtensionRegistry
    [e] org.ecllipse.osgi.framework.console.CommandProvider
  [i] Used Services
    [b] org.eclipse.core.runtime.IExtensionRegistry
    [i] org.eclipse.osgi.service.datalocation.Location
    [i] org.osgi.service.packageadmin.PackageAdmin


I think the use o the [b] icon is too confusing.  I think what it's saying in this example is that the bundle org.eclipse.equinox.registry BOTH exports and imports the org.eclipse.core.runtime.IExtensionRegistry service.

To have the icons [e] and [i] against the services makes no sense to me, since services don't export or import anything, rather they are exported or imported by bundles.  So, if you're going to have [e] and [i] icons they should be used to decorate bundles, not services.

I agree that the icons are not ideal.  I attached them as food-for-thought until better icons could be acquired.  The view currently has a "plugin" theme, so maybe the new icons should continue in that direction.  It looks like we're going to need a "service" icon; I think I remember the SMF tooling had a "hand" icon to indicate a service.  The orange blob/circle icon represented a bundle.


Comment 23 Jacek Pospychala CLA 2008-02-13 08:57:16 EST
thanks Chris, adding id to label is really good idea.

(In reply to comment #19)
> Things TODO:
> 
> - Is this really the best way to present services? Basically by bundle and
> whether it uses or registers them? Simon?
> - We should have an option to 'Show Service Content Only' similar to what we do
> with Extension Content

yes, then "Show Service Content Only" could work as Simon described.

> - I don't like how we circumvented
> RegistryBrowserContentProvider.createAdapter(Object, int) ie., is there a way
> we can do this similar to how we create the other adapters?

It'd be possible to calculate the type inside adapter, but would require more information: the containing bundle and type of folder (Exported/Imported).
And if we're going to have only one icon for all services, then we can remove type at all.
I'll revise this when I'll be implementing "Show Service Content Only".

(In reply to comment #22)
> I think the use o the [b] icon is too confusing.  I think what it's saying in
> this example is that the bundle org.eclipse.equinox.registry BOTH exports and
> imports the org.eclipse.core.runtime.IExtensionRegistry service.
> 
> To have the icons [e] and [i] against the services makes no sense to me, since
> services don't export or import anything, rather they are exported or imported
> by bundles.  So, if you're going to have [e] and [i] icons they should be used
> to decorate bundles, not services.

my intent was to distinct services that are self-consumed (ImportedAndExported) from those only imported/exported. The other way is to make all services have the same icon.
Comment 24 Thomas Watson CLA 2008-02-13 11:28:37 EST
I agree with simon about the icons comments

The blob/circle is used to denote a bundle and probably should not be used for a service icon.  Peter Kriens likes to use a simple triangle to represent a service.

This is supposed to be a triangle, but looks more like a house :)

             /-|
  --------->/  |<--------
 registers  \  |  binds/uses
             \-|
              ^
              |
              |
            Disconvers

Could we have |> represent using a service and <| represent registering a service?
Comment 25 Jacek Pospychala CLA 2008-02-13 12:41:13 EST
(In reply to comment #24)
> This is supposed to be a triangle, but looks more like a house :)

Tom, you're talented ascii-artist :)
to round corners you can use chars like: `'.,
:)

              ,-.
   --------->/  |<--------
  registers  \  |  binds/uses
              `-'
               ^
               |
               |
             Disconvers
Comment 26 Chris Aniszczyk CLA 2008-02-13 12:52:44 EST
Ok, I will file a graphics request and see what the guys come up with.

For now, ignore the gfx and just worry about the other issues :)
Comment 27 Jacek Pospychala CLA 2008-02-24 15:48:12 EST
Created attachment 90585 [details]
patch

I updated patch to use one icon for all services and improved dynamic service changes handling.

Unfortunately to my knowledge there's no way to be notified by Framework about bundles that dynamically register to services (=register a ServiceListener).
So "Used services" folder is not refreshed.

I removed imported-exported gif. Instead I'll attach a temporary service.gif.
Comment 28 Jacek Pospychala CLA 2008-02-24 15:48:51 EST
Created attachment 90586 [details]
service-icon

temporary icon representing a single service.
Comment 29 Jacek Pospychala CLA 2008-02-24 15:51:51 EST
(In reply to comment #23)
> I'll revise this when I'll be implementing "Show Service Content Only".

I created a separate bug 220110 (nice number) to track this, as it adds a couple new issues with handling dynamic changes.
Comment 30 Jacek Pospychala CLA 2008-02-24 16:00:46 EST
Created attachment 90588 [details]
updated dynamic services test view

view allows: register service, unregister service - pressing these buttons you should see services appearing and disappearing under dynamic.joe bundle node in registry view. "listen to service" (listens to first service registered by view), "unget service" - after pressing these bttns nothing happens, you still have to refresh. 
for testing open "dynamic.joe" view.
Comment 31 Jacek Pospychala CLA 2008-02-27 13:23:59 EST
 (In reply to comment #27)
> Created an attachment (id=90585)
> patch

this patch is dying for your love Chris :)
Comment 32 Chris Aniszczyk CLA 2008-02-27 14:39:03 EST
It will go into M6, but will have to wait until I get back from vacation.
Comment 33 Chris Aniszczyk CLA 2008-03-17 17:08:55 EDT
can I get an updated patch Jacek?
Comment 34 Jacek Pospychala CLA 2008-03-17 17:31:03 EDT
Created attachment 92746 [details]
updated patch

sure,
patch updated against HEAD.
it requires "service.gif" icon in icons/obj16, or you'll see red boxes.
Comment 35 Chris Aniszczyk CLA 2008-03-23 17:00:00 EDT
too risky for M6 atm with the p2 work going on... will make it one of the first things I do in M7. Hopefully by then the icons should appear.
Comment 36 Curtis Windatt CLA 2008-04-22 15:26:26 EDT
*ping zx*

Not much time left in M7 for this, if it's a risky change can it be put off until 3.5?
Comment 37 Jacek Pospychala CLA 2008-04-22 15:40:35 EDT
(In reply to comment #36)

Jacek wants it in 3.4!
Comment 38 Chris Aniszczyk CLA 2008-04-24 04:55:26 EDT
What Jacek desires is what Jacek gets ;)

> 20080424

I did some UI polish on the contribution and reused some icons from SAT. I use the typical Java interface icon for the actual service which should suffice.

Jacek, do you have time for bug 220110? As this would make the feature more useful.
Comment 39 Chris Aniszczyk CLA 2008-04-24 04:57:07 EDT
btw Jacek, context help will be needed for this and I will attack you when M7 ships... actually attack everyone to update the help, joy :)

Thanks again for the contribution!
Comment 40 Jacek Pospychala CLA 2008-04-24 05:21:35 EDT
oh my! :)

yes, I'll do context help.