Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 247148 - [DS][osgi R4.2] implement changes to DS (RFC 134)
Summary: [DS][osgi R4.2] implement changes to DS (RFC 134)
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Compendium (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.5 M7   Edit
Assignee: Stoyan Boshev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 247355
  Show dependency tree
 
Reported: 2008-09-12 07:09 EDT by Stoyan Boshev CLA
Modified: 2009-04-27 10:46 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stoyan Boshev CLA 2008-09-12 07:09:48 EDT
DS has several updates described in RFC 134 which has to be implemented
Comment 1 Stoyan Boshev CLA 2008-12-03 08:27:57 EST
The current version of RFC 134 is already implemented. However I expect that this RFC will be updated by adding one or few more things. 
Comment 2 Simon Archer CLA 2009-01-20 09:24:19 EST
Am I to assume that RFC 134 is implemented in M4?
Comment 3 Stoyan Boshev CLA 2009-01-20 09:37:01 EST
(In reply to comment #2)
> Am I to assume that RFC 134 is implemented in M4?

Yes. The current version of the RFC is implemented in M4

Comment 4 Thomas Watson CLA 2009-01-20 09:42:29 EST
I think the RFC is pretty much final, and the spec writing is going to start soon.  Should we close this bug and mark the milestone M4.  We can open another bug if additional changes are needed.
Comment 5 BJ Hargrave CLA 2009-01-20 13:16:06 EST
(In reply to comment #4)
> I think the RFC is pretty much final

I still need to make some changes to the RFC based upon some open bugs in OSGi's bugzilla.
Comment 6 Jeff McAffer CLA 2009-01-29 23:26:10 EST
in i0128 (and before it seems)

the OSGi draft spec says
"The signature for the activate and deactivate methods is:
  p ro tec ted vo id <me thod-name>(<a rgumen t s> ) ;
<arguments> can be zero or more arguments.
For the activate method each argument must be of one of the following types:
&#9679; ComponentContext – the Component Context for the component
&#9679; BundleContext – the Bundle Context of the component's bundle
&#9679; Map – the Component Properties from ComponentContext.getProperties.

It seems however that a component with activate() or activate(Map) does not get activated.  I did not try BundleContext.  This is quite a blocker for the design of our Equinox book example.
Comment 7 Stoyan Boshev CLA 2009-01-30 03:44:33 EST
(In reply to comment #6)
> It seems however that a component with activate() or activate(Map) does not get
> activated.  I did not try BundleContext.  This is quite a blocker for the
> design of our Equinox book example.

In my tests this works fine.
Does your component has name space v1.1? Only components with name space v.1.1 can take advantage of the new features in DS spec.

If your name space is correct I would need a test example to reproduce the problem.
Comment 8 Simon Archer CLA 2009-01-31 00:22:32 EST
It seems that using the v1.1.0 schema fixed the problem that Jeff was having.  Thanks Stoyan.

So I've been trying to think of ways to reduce problems such as this. Here are some ideas that may or may not prove helpful.

1. The DS CommandProvider commands (list/component) could mention the
   schema for each <component>.

2. When an XML document is parsed and the SCR cannot find any DS components it
   issues the following warning in the console:

     WARNING 5 [SCR] No components were found while processing component 
     definition file bundleentry://5488661.6/OSGI-INF/component.xml

   Maybe this could be improved to mention the supported schemas that the
   SCR is looking for. As the message stands you really have to understand
   why no components were found.

3. When a schema is specified (or when the default is in force), it would be
   helpful if the SCR could complain when it sees XML that is compatible with
   a different version of the schema.  This sort of runtime checking could
   clearly be expensive, so maybe this is something that you do when the debug
   tracing is enabled.
Comment 9 Simon Archer CLA 2009-01-31 00:34:59 EST
OK, so it seems that the SCR already does a pretty good job of spotting attributes that do not conform with the specified schema.  This is what I was suggesting in 3. above. For example, when I tried to incorrectly use the <component> element's "activate" attribute from v1.1.0 with a v1.0.0 component I got these helpful messages:

ERROR 5 [SCR] Error occurred while processing start tag of XML 'bundleentry://5488661.6/OSGI-INF/component.xml' in bundle org.eclipse.soda.sat.tutorial.01.customer_1.0.0 [6]! The error is: The component is according to namespace v1.0.0 and must not have 'activate' tag set, at line 2

WARNING 5 [SCR] No components were found while processing component definition file bundleentry://5488661.6/OSGI-INF/component.xml


The only thing I noticed here was that this checking is only enforced when you specify the v1.0.0 schema, where as you do not get the errors when you omit the xmlns completely and rely on the default schema.
Comment 10 Stoyan Boshev CLA 2009-01-31 04:09:51 EST
(In reply to comment #8)
> 1. The DS CommandProvider commands (list/component) could mention the
>    schema for each <component>.
I agree we need to add this information. I would prefer to add it only to the "component" command - the schema version that is used by a component is a detail IMHO.

>  
> 2. When an XML document is parsed and the SCR cannot find any DS components it
>    issues the following warning in the console:
> 
>      WARNING 5 [SCR] No components were found while processing component 
>      definition file bundleentry://5488661.6/OSGI-INF/component.xml
> 
>    Maybe this could be improved to mention the supported schemas that the
>    SCR is looking for. As the message stands you really have to understand
>    why no components were found.
Now you receive ERROR message when there is something wrong with the a component. This error message precedes the warning message stating no components were found. I think there is no need to mention again the reason in the warning?

> 
> 3. When a schema is specified (or when the default is in force), it would be
>    helpful if the SCR could complain when it sees XML that is compatible with
>    a different version of the schema.  This sort of runtime checking could
>    clearly be expensive, so maybe this is something that you do when the debug
>    tracing is enabled.

Already done as you found out :)

Comment 11 Stoyan Boshev CLA 2009-01-31 04:18:02 EST
(In reply to comment #9)

> The only thing I noticed here was that this checking is only enforced when you
> specify the v1.0.0 schema, where as you do not get the errors when you omit the
> xmlns completely and rely on the default schema.

That's because I assume the default schema is already the new v1.1 :)
It is not mention yet in the DS spec - I have opened a bug to add this clarification (see https://www.osgi.org/members/bugzilla/show_bug.cgi?id=934)
Comment 12 Simon Archer CLA 2009-01-31 08:36:53 EST
Thank you Stoyan, that's wonderful. Get theses things sorted out now will really improve the usability of DS and the Equinox implementation.
Comment 13 Stoyan Boshev CLA 2009-04-27 10:46:58 EDT
All changes in RFC 134 are implemented in DS