On 8/30/10 10:52, njmtql wrote:
Thank you for your repley.

I am sorry that i haven't clearly described my problem.

I think what i am confronted with is the first case you have mentioned. That
is i have a component (which provides a service) is one bundle with ipojo
and want obtain servral service objects (the number is unknow) of the
componnet. How can I do it ?

It is like the concept of "Factory", but it is not. Just add "strategy =
"SERVICE"" to the component's description, we can obtain a service factory.
But we can only obtain the same instance in the same bundle (different
instances between different bundles).

 From the document, i learned that the "strategy = "Instance"" looks like my
need. But i do not know how to obtain serveral service objects in the other
bundle.

The strategy just indicates what each request for a component will produce, e.g., "service" will be one instance per bundle, whereas "instance" will be one per requesting component. These do not impact how many components are created.

Creating instances of components must still be done explicitly, since iPOJO has no way of knowing how many instances you actually want. You can either create configured instances in your XML file or you can define another component that uses your desired component's factory service to programmatically create as many instances as you need.

iPOJO will not just create an arbitrary number of component instances. The strategies of one global service, one per bundle, or one per component instances are just common policies. When you need something different, you have to use factories directly or you could look into creating your own creation strategy.

-> richard



Richard S. Hall wrote:
   On 8/28/10 12:54, njm09 wrote:
Hi
      I am a beginner about osgi and felix. I found that ipojo is a good
thing which can facilitate the development of OSGI-SOA based framework.

      But i am confronted with a problem. How I can obtain several ipojo
instances in the same bundle?
It's not clear to me what you mean here.

Do you have a component defined in a bundle and you want to create
multiple instances of it?

Or do you have multiple components defined in a bundle from which you
want to create an instance of each?

If it is either, then both should be possible, you just need to use
<instance>  in your XML file for each instance you want to create.

->  richard

      I have had a try about the strategy="SERVICE" and
service="instance", but the result is passive.

      Thank you for your help!

Best Regards
Ni.
2010-08-29



njm09

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to