osgi / bugzilla-archive

Archive of OSGi Alliance Specification Bugzilla bugs. The Specification Bugzilla system was decommissioned with the move to GitHub. The issues in this repository are imported from the Specification Bugzilla system for archival purposes.
0 stars 1 forks source link

[rfc 0134] Allow Service Components to only be created when a Configuration exists #139

Closed bjhargrave closed 15 years ago

bjhargrave commented 18 years ago

Original bug ID: BZ#144 From: @bjhargrave Reported version: R4

bjhargrave commented 18 years ago

Comment author: @bjhargrave

"John Wells" <jwells@ bea.com> Sent by: equinox-dev-bounces@ eclipse.org 2006-01-05 05:59 AM Please respond to Equinox development mailing list <equinox-dev@ eclipse.org>

To
"Equinox development mailing list" <equinox-dev@ eclipse.org>
cc

Subject
RE: Fw: [equinox-dev] Is there a "bug" in the DS specification?

Yes,

Your suggested solution would satisfy my requirement (and remove some confusing behavior, IMO).

Thanks.

John Wells (Aziz) jwells@ bea.comNOSPAM

-----Original Message----- From: equinox-dev-bounces@ eclipse.org [mailto:equinox-dev-bounces@ eclipse.org] On Behalf Of BJ Hargrave Sent: Thursday, January 05, 2006 12:00 AM To: Equinox development mailing list Subject: Re: Fw: [equinox-dev] Is there a "bug" in the DS specification?

No spec is perfect :-)

One of the design goals of DS was to utilize Configuration is present but to work without ConfigurationAdmin being present or without requiring a configuration to be set.

I suppose what it needed is some new attribute for the component declaration which says to only create an instance IF there is a Configuration( or Configurations). This would seem to satisfy your need.

If you thinks this would satisfy your need, I will open a feature request against the DS spec to consider adding this in the next release.

BJ Hargrave Senior Technical Staff Member, IBM OSGi Fellow and CTO of the OSGi Alliance hargrave@ us.ibm.com Office: +1 407 849 9117 Mobile: +1 386 848 3788

John Wells <jwells131313@ yahoo.com> Sent by: equinox-dev-bounces@ eclipse.org 2006-01-03 03:04 PM Please respond to Equinox development mailing list <equinox-dev@ eclipse.org>

To Equinox development mailing list <equinox-dev@ eclipse.org> cc

Subject Re: Fw: [equinox-dev] Is there a "bug" in the DS specification?

Component factories are fine, except that I sort of have to roll-my-own deployment then. It would be nicer to have this sort of deployment done

automagically for me. Anyway, thanks for the help.

John Wells (Aziz) jwells@ bea.comNOSPAM

Roy Paterson <rpatersn@ us.ibm.com> wrote:

The design intent was that all components get their configurations from CM if it is available. I encourage you to check out ComponentFactory - sounds like it is closer to what you want.

Roy


Roy Paterson IBM Pervasive Computing Austin, TX Phone: (512) 838-8898

John Wells <jwells131313@ yahoo.com> Sent by: equinox-dev-bounces@ eclipse.org 01/03/2006 01:59 PM

Please respond to Equinox development mailing list <equinox-dev@ eclipse.org>

To Equinox development mailing list <equinox-dev@ eclipse.org> cc

Subject Re: Fw: [equinox-dev] Is there a "bug" in the DS specification?

Thanks for the explanation. I still think it would be nice to have a mechanism whereby I can explictly tell the component that I want it to get its configuration from the CS, and thereby not have the strangeness of having a vestigial component in existence when there are zero instances of the Configuration. You gotta admit that having it revert to the "read-from-xml" file behaviour is unexpected.

John Wells (Aziz) jwells@ bea.comNOSPAM

Roy Paterson <rpatersn@ us.ibm.com> wrote:

Hello John,

This is a bit confusing but I don't think this is a "bug" in the DS specification. Unfortunately DS isn't set up to do exactly what you want, but I think it can come pretty close. The DS runtime behaves as follows :

1) A Component is enabled - DS checks to see if ConfigurationAdmin has a

Configuration (factory or not) for it's PID. 2) The Component does not have a Configuration - an instance of the Component is resolved with the properties from the XML and activated. (There is now 1 active instance)

... some time later

3) A Factory Configuration appears for the Component. DS deactivates and disposes of the XML-properties instance of the Component, and creates and activates a new instance with the properties from the Configuration. (There is now 1 active instance) 4) Another Configuration appears for the Component. DS creates and activates a new instance with the properties from the second Configuration. (There are now 2 active instances)

... some time later

5) All of the Configurations for the Component's component.id are deleted in CM. DS deactivates both of the active instances, and then creates and activates a new instance with the properties from the XML file. (There is now 1 active instance).

So basically it looks like DS does what you want, except it creates a vestigial instance even if there are no configurations. You might want to look at the ComponentFactory option, which behaves similarly but doesn't

automatically create new instances due to Configurations in ConfigAdmin.

However once you programmatically c reate the instances they can still be configured by ConfigAdmin.

Regards, Roy Paterson


Roy Paterson IBM Pervasive Computing Austin, TX Phone: (512) 838-8898

----- Forwarded by Roy Paterson/Austin/IBM on 01/03/2006 01:30 PM ----- Thomas Watson/Austin/IBM 01/03/2006 09:51 AM

To Roy Paterson/Austin/IBM@ IBMUS cc

Subject Fw: [equinox-dev] Is there a "bug" in the DS specification?

< FONT face=sans-serif size=2>Here is a message you may be able to answer.

Thomas Watson Pervasive Development Phone: 512-838-4533 Tie: 678-4533 tjwatson@ us.ibm.com

----- Forwarded by Thomas Watson/Austin/IBM on 01/03/2006 09:50 AM -----

John Wells <jwells131313@ yahoo.com> Sent by: equinox-dev-bounces@ eclipse.org 12/31/2005 10:33 AM

Please respond to Equinox development mailing list

To equinox-dev@ eclipse.org cc

Subject [equinox-dev] Is there a "bug" in the DS specification?

In section 117.2 of the specification it says (I paraphrase):

A. If there is no Configuration with a PID or FactoryPID then the component is deployed with properties from the xml file B. If there is a Configuration with a PID with the same name as the component then the properties are overridden with the properties from the Configuration

C. (This one I am copying directly from the specification)

Factory Configuration - If a factory PID exists, with zero or more Configurations, that is equal to the component name, then for each Configuration, a component configuration must be created that will obtain additional component properties from Configuration Admin. This is the ManagedServiceFactory situation.

What I don't understand is how to have a "factoryPID" configuration with

zero Configurations. In order to create a ManagedFactory cofiguration one must use ConfigurationAdmin.createFactoryConfiguration("component-name")

which will then create a configuration with a factoryPID and a generated

PID. This is a Configuration with a factoryPID, but there is one of them. Not zero. Which is unfor tunate, because I actually want the situation

where the components are created due to dynamic additions and subtractions from factory Configuration objects (Configuration objects with the factoryPID set).

However, it is impossible for DS to determine the difference between two

cases then.

  1. There is no Configuration object but I want a component to be created with the properties from the XML file
  2. There is no Configuration object but I wanted to create a Configuration with a matching FactoryPID later.

Since there is no way to tell the component which of the two situations I wanted, it seems like there is a problem. There seems to only be two ways to fix this:

  1. Somehow change the ConfigurationAdmin specification to allow for a Factory Configuration with zero subordinate configurations (doesn't seem

possible, given the mechanichs of the ConfigurationAdmin specification).

  1. Some sort of property on the component that tells it that it should be tied to the FactoryPID of a Configuration. (Obviously "factory" is out.

Perhaps something like "deployment-policy").

Am I misreading the specification? Is there some other way to read this

section? Can you DS experts help me out here? (What I actually want is

behavior BZ#2 up above - components that are tied to a Factory Configuration and which are created and destroyed dynamically).

John Wells (Aziz) jwells@ bea.comNOSPAM

(From my yahoo account, since I am on "vacation" reading specifications!!!) Yahoo! Shopping Find Great Deals on Holiday Gifts at Yahoo! Shopping


equinox-dev mailing list equinox-dev@ eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev


equinox-dev mailing list equinox-dev@ eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev Yahoo! for Good - Make a difference this year.


equinox-dev mailing list equinox-dev@ eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev


equinox-dev mailing list equinox-dev@ eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev

Yahoo! Photos Ring in the New Year with Photo Calendars. Add photos, events, holidays,

whatever.___ equinox-dev mailing list equinox-dev@ eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev


equinox-dev mailing list equinox-dev@ eclipse.org https://dev.eclipse.org/mailman/listinfo/equinox-dev

bjhargrave commented 17 years ago

Comment author: @bjhargrave

CPEG call:

We agreed that some small changes/improvements to DS are good.

BJ will collect up the minor enhancements suggested to DS into a single RFC and submit.

bjhargrave commented 16 years ago

Comment author: @bjhargrave

Created RFC 134 to address this request.

bjhargrave commented 16 years ago

Comment author: jeff.trent@oracle.com

The framework should permit extensions in the way of allowing for the hook/interception to a delegated service to optionally alter the instance that is is being injected into a service using DS.

I am not suggesting this is made part of the existing schema for the declaration itself.

Instead, my thought was the implementor of the DS compendium bundle either (a) checks the service registry for pre-existing providers of the actual injection service, or (b) is required to register its behavioral-type services (like di) so that another bundle extending the framework can hook it as it may see fit.

bjhargrave commented 16 years ago

Comment author: jeff.trent@oracle.com

Disregard comment 3 above. I was in the wrong window when I posted it. I moved this under Bug BZ#754.

bjhargrave commented 15 years ago

Comment author: @bjhargrave

RFC 134 contains this item.