*BJ:**
*
re: "demonstrate why more factory properties are necessary. "

*current spec is not "dynamic"**enough:**
*
1) for development/refactoring
* the @Component(factory = "factory") annotation takes only string
* this string has to be a *compile-time constant* in eclipse ide
* so you can not use construct like this @Component(factory =
SomeInterface.class)
* end result is that you must manually maintain parallel name space for
your factories

solution: I would put bind filter information into a *class-load-time
constant*

@Property(name = "custom-value")
static final String VALUE = SomeInterface.class.getName();



2) for flexible architecture
* ComponentFactory *is not type safe*,
* ComponentFactory does not carry underlying Component interfaces
information anywhere
* the work-around would be to go to low level api or reflection or etc.
- why?

solution: I would put interfaces information into the custom properties

3) for flexible architecture
* currently, there is no DS / osgi framework-provided *"factory manager"
facility*;
* in other words, you must somehow collect all the instances of
ComponentFactory into some third "factory manager" component
* the "factory manager" could get the ComponentFactory via bind like this:

@Reference( //
          cardinality = ReferenceCardinality.MULTIPLE, //
policy = ReferencePolicy.DYNAMIC //
)
protected void bind(final ComponentFactory s, final Map<String, Object>
props) {

* now "factory manager" must receive all appropriate factories injections,
* and should expose type-safe create(...) proxy calls to the underlying
ComponentFactory . |*newInstance
<http://www.osgi.org/javadoc/r4v42/org/osgi/service/component/ComponentFactory.html#newInstance%28java.util.Dictionary%29>*(java.util.Dictionary
 properties)|

solution: I would use bind props as primary bind filter, not
"target=(...)" ldap filter; no need to dance around what you can encode
into "component.factory"

* if I want to have different "factory managers" to produce different
overlapping sub-sets of ComponentFactory instances
then "component.factory" + "target=(...)" approach becomes unworkable

bottom line:

please take a look on my factory project:
https://github.com/carrot-garden/carrot-osgi/tree/master/carrot-osgi-scr-factory-ds

required api
https://github.com/carrot-garden/carrot-osgi/tree/master/carrot-osgi-scr-factory-ds/src/main/java/com/carrotgarden/osgi/factory/api

implementation
https://github.com/carrot-garden/carrot-osgi/tree/master/carrot-osgi-scr-factory-ds/src/main/java/com/carrotgarden/osgi/factory/impl

test case
https://github.com/carrot-garden/carrot-osgi/tree/master/carrot-osgi-scr-factory-ds/src/main/java/com/carrotgarden/osgi/factory/test

unit test
https://github.com/carrot-garden/carrot-osgi/blob/master/carrot-osgi-scr-factory-ds/src/test/java/com/carrotgarden/osgi/factory/TestFactory.java

it basically shows 15 classes too many than should be there to
accomplish simple task: "*type-safe DS ComponentFactory*"

thank you for your attention to this;

the basic difference between my questions and your answers is this
* I am asking for a minor change that I think would make
ComponentFactory more flexible/usable;
* you are answering that every specific example I produced so far could
be forced into existing bed of Procrustes;

may be I should start asking for more! :-)
how about if ComponentFactory is to expose underlying component
interfaces directly?

cheers,

Andrei.



-------- Original Message --------
Subject: Re: [osgi-dev] custom properties for a DS / ComponentFactory?
(was : 112.2.4 Factory Component: "The service properties of the
Component Factory service must not include the component properties")
From: BJ Hargrave <hargr...@us.ibm.com>
To: OSGi Developer Mail List <osgi-dev@mail.osgi.org>
Date: Thu 13 Sep 2012 03:53:35 PM CDT
> As we discussed in the bndtools list, there is a factory property that
> can be set (component.factory). You are asking for more than one
> factory property. I demonstrated your use case can be addressed with
> the existing factory property. Please demonstrate why more factory
> properties are necessary.
>
> -- 
>
> *BJ Hargrave*
> Senior Technical Staff Member, IBM
> OSGi Fellow and CTO of the _OSGi Alliance_ <http://www.osgi.org/>_
> __hargr...@us.ibm.com_ <mailto:hargr...@us.ibm.com>   
>
> office: +1 386 848 1781
> mobile: +1 386 848 3788
>
>
>
>
>
>
>
> From:        Andrei Pozolotin <andrei.pozolo...@gmail.com>
> To:        osgi-dev@mail.osgi.org,
> Date:        2012/09/13 11:49
> Subject:        [osgi-dev] custom properties for a DS /
> ComponentFactory? (was : 112.2.4 Factory Component: "The service
> properties of the Component Factory service must not include the
> component properties")
> Sent by:        osgi-dev-boun...@mail.osgi.org
>
> ------------------------------------------------------------------------
>
>
>
> Hello;
>
> I am curious to see if anyone else sees a value in custom properties
> for a DS / ComponentFactory?
>
> original question:
> *
> 112.2.4 Factory Component: "The service properties of the Component
> Factory service must not include the component properties"*
> _
> __https://groups.google.com/d/msg/bndtools-users/iYAjRU2p03I/d9PF9rmTNFsJ_
>
> thanks.
>
> Andrei.
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
> _______________________________________________
> OSGi Developer Mail List
> osgi-dev@mail.osgi.org
> https://mail.osgi.org/mailman/listinfo/osgi-dev

_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to