You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Shai Amar <sh...@krynnlance.com> on 2011/08/11 10:48:50 UTC

iPOJO: How to use an alternate service when the current service is unavailable?

Hi all

I have the following situation:
I have 2 Log service implementations implementing *LogService* interface:

   1. *Console* log implementation
   2. *RotatingFile* log implementation

I want that a service SOME_SERVICE will use the *Console* log implementation
service as a default, and if it is unavailable, SOME_SERVICE will use the *
RotatingFile* log implementation service instead.

Is it possible to do that?
If it does, how can I do that?

-- 
Regards

Shai Amar

Technologies manager, Founder
Krynnlance
www.krynnlance.com
www.backapps.com

RE: Hard to debug component factory activation failures

Posted by Da...@L-3Com.com.
Okay, somehow I never noticed the ds.loglevel property, I set it to
debug and now get this:

INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency not satisfied:
gpioMasterPortA
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency not satisfied:
gpioMasterPortB
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency not satisfied:
gpioMasterPortC
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Not all dependencies
satisified, cannot activate
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency Manager:
Service gpioMasterPortC registered, activate component
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency not satisfied:
gpioMasterPortA
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency not satisfied:
gpioMasterPortB
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Not all dependencies
satisified, cannot activate
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency Manager:
Service gpioMasterPortB registered, activate component
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency not satisfied:
gpioMasterPortA
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Not all dependencies
satisified, cannot activate
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency Manager:
Service gpioMasterPortA registered, activate component

	As you can see, GPIOImpl does get the needed dependencies:
gpioMasterPortA-C, so the component factory becomes satisfied, but later
GPIOImpl states ports B and C are not satisfied, why would it no longer
be satisfied?

INFO    20110811 17:00:24 ID#14 - [x.GPIOFactory] Dependency Manager:
Service factory registered, activate component
INFO    20110811 17:00:24 ID#14 - [x.PhysicalLinks] Dependency Manager:
Service gpioFactory registered, activate component
INFO    20110811 17:00:24 ID#7  - Creating PhysicalLink of type x.GPIO
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency not satisfied:
gpioMasterPortB
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Dependency not satisfied:
gpioMasterPortC
INFO    20110811 17:00:24 ID#14 - [x.GPIOImpl] Not all dependencies
satisified, cannot activate
ERROR   20110811 17:00:24 ID#14 - [x.PhysicalLinks] The activate method
has thrown an exception
Caused by: org.apache.felix.log.LogException:
org.osgi.service.component.ComponentException: Failed activating
component
    at
org.apache.felix.scr.impl.manager.ComponentFactoryImpl.newInstance(Compo
nentFactoryImpl.java:120)

Also, the output of the scr command shows that all master ports are
still satisfied.

David Humeniuk


-----Original Message-----
From: David.Humeniuk@L-3Com.com [mailto:David.Humeniuk@L-3Com.com] 
Sent: Thursday, August 11, 2011 4:21 PM
To: users@felix.apache.org
Subject: Hard to debug component factory activation failures

When trying to create a new instance through a Declarative Services
component factory, the component may fail (throw a ComponentException).
When this happen in the Felix SCR, the exception is thrown only with the
message "Failed activating component".  Is there a way to get more
information like a stack trace that explains why the component failed to
activate?

Thanks,
David Humeniuk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Hard to debug component factory activation failures

Posted by Da...@L-3Com.com.
When trying to create a new instance through a Declarative Services
component factory, the component may fail (throw a ComponentException).
When this happen in the Felix SCR, the exception is thrown only with the
message "Failed activating component".  Is there a way to get more
information like a stack trace that explains why the component failed to
activate?

Thanks,
David Humeniuk

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

On 12.09.2011, at 16:17, Shai Amar wrote:

> About the dynamic-priority policy...
> 
> I know that iPOJO registers the service automatically, so, how can I set the
> service rank?
> 

Just declare and a set a service property named: service.ranking

Regards,

Clement

> 
> 
> Regards
> Shai Amar
> 
> On Thu, Aug 11, 2011 at 9:04 PM, Richard S. Hall <he...@ungoverned.org>wrote:
> 
>> On 8/11/11 2:28 PM, Shai Amar wrote:
>> 
>>> Hi Richard
>>> 
>>> I see. In other words, if I'll use the dynamic priority binding policy
>>> (instead of just set the service ranking) I'll get the current ranking of
>>> the service? Is that what you meant?
>>> 
>> 
>> No. A service depending has one of three binding policies associated with
>> it, which dictates how iPOJO manages it and the associated requiring
>> component instance:
>> 
>> 1. static - destroys component instance if dependent service goes away,
>>  so effectively the component instance never sees service dynamism.
>> 2. dynamic - if a dependent service goes away iPOJO swaps in a new one
>>  if available, so component instance actually sees service dynamism;
>>  however, the service dependency won't change unless the service goes
>>  away.
>> 3. dynamic-priority - if a higher ranked service appears it will
>>  replace any lower ranking service already injected into the
>>  component, so component instance sees dynamism if a service goes
>>  away AND if a higher ranking service appears.
>> 
>> By default the binding policy is dynamic, you'll need to set it to
>> dynamic-priority. Check here:
>> 
>>   http://felix.apache.org/site/**service-requirement-handler.**html<http://felix.apache.org/site/service-requirement-handler.html>
>> 
>> -> richard
>> 
>> 
>> 
>>> Regards
>>> Shai Amar
>>> 
>>> 
>>> 
>>> 
>>> On Thu, Aug 11, 2011 at 4:37 PM, Richard S. Hall<he...@ungoverned.org>**
>>> wrote:
>>> 
>>> You'll have to use dynamic priority binding policy for the dependency so
>>>> that you are automatically switched based on service ranking...if you
>>>> just
>>>> use dynamic binding policy for the dependency, then you'll just get the
>>>> highest ranking at the time of injection.
>>>> 
>>>> ->  richard
>>>> 
>>>> 
>>>> On 8/11/11 8:54 AM, Shai Amar wrote:
>>>> 
>>>> Thanks!
>>>>> It seems like an elegant solution. :)
>>>>> 
>>>>> Regards
>>>>> Shai Amar
>>>>> 
>>>>> On Thu, Aug 11, 2011 at 3:46 PM,<Da...@l-3com.com>   wrote:
>>>>> 
>>>>> I think you would want to utilize the service ranking:
>>>>> 
>>>>>> When registering a service object, a
>>>>>> bundle may optionally specify a
>>>>>> service.ranking number as one of
>>>>>> the service object's properties. If
>>>>>> multiple qualifying service interfaces
>>>>>> exist, a service with the highest
>>>>>> SERVICE_RANKING number, or
>>>>>> when equal to the lowest
>>>>>> SERVICE_ID, determines which service
>>>>>> object is returned by the Framework.
>>>>>> 
>>>>>> Make Aa the highest rank, Ab after that.  That way it will get the Aa
>>>>>> service if available, Ab if not.
>>>>>> 
>>>>>> David Humeniuk
>>>>>> 
>>>>>> 
>>>>>> -----Original Message-----
>>>>>> From: Shai Amar [mailto:shai.amar@krynnlance.****com<
>>>>>> shai.amar@krynnlance.com>
>>>>>> ]
>>>>>> Sent: Thursday, August 11, 2011 8:42 AM
>>>>>> To: users@felix.apache.org
>>>>>> Subject: Re: iPOJO: How to use an alternate service when the current
>>>>>> service is unavailable?
>>>>>> 
>>>>>> Hi David
>>>>>> 
>>>>>> Still the question remains.
>>>>>> The log service is an example.
>>>>>> 
>>>>>> If I have 2 service implementations Aa and Ab of interface A.
>>>>>> If I have a client that uses Aa and can use Ab. In case service Aa is
>>>>>> unavailable, is it possible via iPOJO to switch automatically to
>>>>>> service
>>>>>> Ab?
>>>>>> 
>>>>>> Regards
>>>>>> Shai Amar
>>>>>> 
>>>>>> On Thu, Aug 11, 2011 at 3:22 PM,<Da...@l-3com.com>   wrote:
>>>>>> 
>>>>>> Sounds like you should be using the LogReaderService for those
>>>>>> 
>>>>>>> implementations not the LogService.  You can use the Felix Log Service
>>>>>>> bundle to get a LogService implementation and Log Service APIs.
>>>>>>> 
>>>>>>> David Humeniuk
>>>>>>> 
>>>>>>> 
>>>>>>> -----Original Message-----
>>>>>>> From: Shai Amar [mailto:shai.amar@krynnlance.****com<
>>>>>>> shai.amar@krynnlance.com>
>>>>>>> ]
>>>>>>> Sent: Thursday, August 11, 2011 4:49 AM
>>>>>>> To: users@felix.apache.org
>>>>>>> Subject: iPOJO: How to use an alternate service when the current
>>>>>>> 
>>>>>>> service
>>>>>> 
>>>>>> is unavailable?
>>>>>>> 
>>>>>>> Hi all
>>>>>>> 
>>>>>>> I have the following situation:
>>>>>>> I have 2 Log service implementations implementing *LogService*
>>>>>>> interface:
>>>>>>> 
>>>>>>>   1. *Console* log implementation
>>>>>>>  2. *RotatingFile* log implementation
>>>>>>> 
>>>>>>> I want that a service SOME_SERVICE will use the *Console* log
>>>>>>> implementation
>>>>>>> service as a default, and if it is unavailable, SOME_SERVICE will use
>>>>>>> the *
>>>>>>> RotatingFile* log implementation service instead.
>>>>>>> 
>>>>>>> Is it possible to do that?
>>>>>>> If it does, how can I do that?
>>>>>>> 
>>>>>>> --
>>>>>>> Regards
>>>>>>> 
>>>>>>> Shai Amar
>>>>>>> 
>>>>>>> Technologies manager, Founder
>>>>>>> Krynnlance
>>>>>>> www.krynnlance.com
>>>>>>> www.backapps.com
>>>>>>> 
>>>>>>> ------------------------------****----------------------------**--**
>>>>>>> ---------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apac**he.org<http://apache.org>
>>>>>>> <us...@felix.apache.org>
>>>>>>>> 
>>>>>>> 
>>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> --
>>>>>> Regards
>>>>>> 
>>>>>> Shai Amar
>>>>>> 
>>>>>> Technologies manager, Founder
>>>>>> Krynnlance
>>>>>> www.krynnlance.com
>>>>>> www.backapps.com
>>>>>> 
>>>>>> ------------------------------****----------------------------**--**
>>>>>> ---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apac**he.org<http://apache.org>
>>>>>> <us...@felix.apache.org>
>>>>>>> 
>>>>>> 
>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> ------------------------------****----------------------------**
>>>> --**---------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apac**he.org<http://apache.org>
>>>> <us...@felix.apache.org>
>>>>> 
>>>> 
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>> 
>>>> 
>>>> 
>>> 
> 
> 
> -- 
> Regards
> 
> Shai Amar
> 
> Technologies manager, Founder
> Krynnlance
> www.krynnlance.com
> www.backapps.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by Shai Amar <sh...@krynnlance.com>.
About the dynamic-priority policy...

I know that iPOJO registers the service automatically, so, how can I set the
service rank?



Regards
Shai Amar

On Thu, Aug 11, 2011 at 9:04 PM, Richard S. Hall <he...@ungoverned.org>wrote:

> On 8/11/11 2:28 PM, Shai Amar wrote:
>
>> Hi Richard
>>
>> I see. In other words, if I'll use the dynamic priority binding policy
>> (instead of just set the service ranking) I'll get the current ranking of
>> the service? Is that what you meant?
>>
>
> No. A service depending has one of three binding policies associated with
> it, which dictates how iPOJO manages it and the associated requiring
> component instance:
>
> 1. static - destroys component instance if dependent service goes away,
>   so effectively the component instance never sees service dynamism.
> 2. dynamic - if a dependent service goes away iPOJO swaps in a new one
>   if available, so component instance actually sees service dynamism;
>   however, the service dependency won't change unless the service goes
>   away.
> 3. dynamic-priority - if a higher ranked service appears it will
>   replace any lower ranking service already injected into the
>   component, so component instance sees dynamism if a service goes
>   away AND if a higher ranking service appears.
>
> By default the binding policy is dynamic, you'll need to set it to
> dynamic-priority. Check here:
>
>    http://felix.apache.org/site/**service-requirement-handler.**html<http://felix.apache.org/site/service-requirement-handler.html>
>
> -> richard
>
>
>
>> Regards
>> Shai Amar
>>
>>
>>
>>
>> On Thu, Aug 11, 2011 at 4:37 PM, Richard S. Hall<he...@ungoverned.org>**
>> wrote:
>>
>>  You'll have to use dynamic priority binding policy for the dependency so
>>> that you are automatically switched based on service ranking...if you
>>> just
>>> use dynamic binding policy for the dependency, then you'll just get the
>>> highest ranking at the time of injection.
>>>
>>> ->  richard
>>>
>>>
>>> On 8/11/11 8:54 AM, Shai Amar wrote:
>>>
>>>  Thanks!
>>>> It seems like an elegant solution. :)
>>>>
>>>> Regards
>>>> Shai Amar
>>>>
>>>> On Thu, Aug 11, 2011 at 3:46 PM,<Da...@l-3com.com>   wrote:
>>>>
>>>>  I think you would want to utilize the service ranking:
>>>>
>>>>> When registering a service object, a
>>>>> bundle may optionally specify a
>>>>> service.ranking number as one of
>>>>> the service object's properties. If
>>>>> multiple qualifying service interfaces
>>>>> exist, a service with the highest
>>>>> SERVICE_RANKING number, or
>>>>> when equal to the lowest
>>>>> SERVICE_ID, determines which service
>>>>> object is returned by the Framework.
>>>>>
>>>>> Make Aa the highest rank, Ab after that.  That way it will get the Aa
>>>>> service if available, Ab if not.
>>>>>
>>>>> David Humeniuk
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Shai Amar [mailto:shai.amar@krynnlance.****com<
>>>>> shai.amar@krynnlance.com>
>>>>> ]
>>>>> Sent: Thursday, August 11, 2011 8:42 AM
>>>>> To: users@felix.apache.org
>>>>> Subject: Re: iPOJO: How to use an alternate service when the current
>>>>> service is unavailable?
>>>>>
>>>>> Hi David
>>>>>
>>>>> Still the question remains.
>>>>> The log service is an example.
>>>>>
>>>>> If I have 2 service implementations Aa and Ab of interface A.
>>>>> If I have a client that uses Aa and can use Ab. In case service Aa is
>>>>> unavailable, is it possible via iPOJO to switch automatically to
>>>>> service
>>>>> Ab?
>>>>>
>>>>> Regards
>>>>> Shai Amar
>>>>>
>>>>> On Thu, Aug 11, 2011 at 3:22 PM,<Da...@l-3com.com>   wrote:
>>>>>
>>>>>  Sounds like you should be using the LogReaderService for those
>>>>>
>>>>>> implementations not the LogService.  You can use the Felix Log Service
>>>>>> bundle to get a LogService implementation and Log Service APIs.
>>>>>>
>>>>>> David Humeniuk
>>>>>>
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Shai Amar [mailto:shai.amar@krynnlance.****com<
>>>>>> shai.amar@krynnlance.com>
>>>>>> ]
>>>>>> Sent: Thursday, August 11, 2011 4:49 AM
>>>>>> To: users@felix.apache.org
>>>>>> Subject: iPOJO: How to use an alternate service when the current
>>>>>>
>>>>>>  service
>>>>>
>>>>>  is unavailable?
>>>>>>
>>>>>> Hi all
>>>>>>
>>>>>> I have the following situation:
>>>>>> I have 2 Log service implementations implementing *LogService*
>>>>>> interface:
>>>>>>
>>>>>>    1. *Console* log implementation
>>>>>>   2. *RotatingFile* log implementation
>>>>>>
>>>>>> I want that a service SOME_SERVICE will use the *Console* log
>>>>>> implementation
>>>>>> service as a default, and if it is unavailable, SOME_SERVICE will use
>>>>>> the *
>>>>>> RotatingFile* log implementation service instead.
>>>>>>
>>>>>> Is it possible to do that?
>>>>>> If it does, how can I do that?
>>>>>>
>>>>>> --
>>>>>> Regards
>>>>>>
>>>>>> Shai Amar
>>>>>>
>>>>>> Technologies manager, Founder
>>>>>> Krynnlance
>>>>>> www.krynnlance.com
>>>>>> www.backapps.com
>>>>>>
>>>>>> ------------------------------****----------------------------**--**
>>>>>> ---------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apac**he.org<http://apache.org>
>>>>>> <us...@felix.apache.org>
>>>>>> >
>>>>>>
>>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>  --
>>>>> Regards
>>>>>
>>>>> Shai Amar
>>>>>
>>>>> Technologies manager, Founder
>>>>> Krynnlance
>>>>> www.krynnlance.com
>>>>> www.backapps.com
>>>>>
>>>>> ------------------------------****----------------------------**--**
>>>>> ---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apac**he.org<http://apache.org>
>>>>> <us...@felix.apache.org>
>>>>> >
>>>>>
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>>
>>>>>
>>>>>  ------------------------------****----------------------------**
>>> --**---------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apac**he.org<http://apache.org>
>>> <us...@felix.apache.org>
>>> >
>>>
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>


-- 
Regards

Shai Amar

Technologies manager, Founder
Krynnlance
www.krynnlance.com
www.backapps.com

Re: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by "Richard S. Hall" <he...@ungoverned.org>.
On 8/11/11 2:28 PM, Shai Amar wrote:
> Hi Richard
>
> I see. In other words, if I'll use the dynamic priority binding policy
> (instead of just set the service ranking) I'll get the current ranking of
> the service? Is that what you meant?

No. A service depending has one of three binding policies associated 
with it, which dictates how iPOJO manages it and the associated 
requiring component instance:

 1. static - destroys component instance if dependent service goes away,
    so effectively the component instance never sees service dynamism.
 2. dynamic - if a dependent service goes away iPOJO swaps in a new one
    if available, so component instance actually sees service dynamism;
    however, the service dependency won't change unless the service goes
    away.
 3. dynamic-priority - if a higher ranked service appears it will
    replace any lower ranking service already injected into the
    component, so component instance sees dynamism if a service goes
    away AND if a higher ranking service appears.

By default the binding policy is dynamic, you'll need to set it to 
dynamic-priority. Check here:

     http://felix.apache.org/site/service-requirement-handler.html

-> richard


>
> Regards
> Shai Amar
>
>
>
>
> On Thu, Aug 11, 2011 at 4:37 PM, Richard S. Hall<he...@ungoverned.org>wrote:
>
>> You'll have to use dynamic priority binding policy for the dependency so
>> that you are automatically switched based on service ranking...if you just
>> use dynamic binding policy for the dependency, then you'll just get the
>> highest ranking at the time of injection.
>>
>> ->  richard
>>
>>
>> On 8/11/11 8:54 AM, Shai Amar wrote:
>>
>>> Thanks!
>>> It seems like an elegant solution. :)
>>>
>>> Regards
>>> Shai Amar
>>>
>>> On Thu, Aug 11, 2011 at 3:46 PM,<Da...@l-3com.com>   wrote:
>>>
>>>   I think you would want to utilize the service ranking:
>>>> When registering a service object, a
>>>> bundle may optionally specify a
>>>> service.ranking number as one of
>>>> the service object's properties. If
>>>> multiple qualifying service interfaces
>>>> exist, a service with the highest
>>>> SERVICE_RANKING number, or
>>>> when equal to the lowest
>>>> SERVICE_ID, determines which service
>>>> object is returned by the Framework.
>>>>
>>>> Make Aa the highest rank, Ab after that.  That way it will get the Aa
>>>> service if available, Ab if not.
>>>>
>>>> David Humeniuk
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Shai Amar [mailto:shai.amar@krynnlance.**com<sh...@krynnlance.com>
>>>> ]
>>>> Sent: Thursday, August 11, 2011 8:42 AM
>>>> To: users@felix.apache.org
>>>> Subject: Re: iPOJO: How to use an alternate service when the current
>>>> service is unavailable?
>>>>
>>>> Hi David
>>>>
>>>> Still the question remains.
>>>> The log service is an example.
>>>>
>>>> If I have 2 service implementations Aa and Ab of interface A.
>>>> If I have a client that uses Aa and can use Ab. In case service Aa is
>>>> unavailable, is it possible via iPOJO to switch automatically to service
>>>> Ab?
>>>>
>>>> Regards
>>>> Shai Amar
>>>>
>>>> On Thu, Aug 11, 2011 at 3:22 PM,<Da...@l-3com.com>   wrote:
>>>>
>>>>   Sounds like you should be using the LogReaderService for those
>>>>> implementations not the LogService.  You can use the Felix Log Service
>>>>> bundle to get a LogService implementation and Log Service APIs.
>>>>>
>>>>> David Humeniuk
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: Shai Amar [mailto:shai.amar@krynnlance.**com<sh...@krynnlance.com>
>>>>> ]
>>>>> Sent: Thursday, August 11, 2011 4:49 AM
>>>>> To: users@felix.apache.org
>>>>> Subject: iPOJO: How to use an alternate service when the current
>>>>>
>>>> service
>>>>
>>>>> is unavailable?
>>>>>
>>>>> Hi all
>>>>>
>>>>> I have the following situation:
>>>>> I have 2 Log service implementations implementing *LogService*
>>>>> interface:
>>>>>
>>>>>     1. *Console* log implementation
>>>>>    2. *RotatingFile* log implementation
>>>>>
>>>>> I want that a service SOME_SERVICE will use the *Console* log
>>>>> implementation
>>>>> service as a default, and if it is unavailable, SOME_SERVICE will use
>>>>> the *
>>>>> RotatingFile* log implementation service instead.
>>>>>
>>>>> Is it possible to do that?
>>>>> If it does, how can I do that?
>>>>>
>>>>> --
>>>>> Regards
>>>>>
>>>>> Shai Amar
>>>>>
>>>>> Technologies manager, Founder
>>>>> Krynnlance
>>>>> www.krynnlance.com
>>>>> www.backapps.com
>>>>>
>>>>> ------------------------------**------------------------------**
>>>>> ---------
>>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<us...@felix.apache.org>
>>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>>
>>>>>
>>>>>
>>>> --
>>>> Regards
>>>>
>>>> Shai Amar
>>>>
>>>> Technologies manager, Founder
>>>> Krynnlance
>>>> www.krynnlance.com
>>>> www.backapps.com
>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<us...@felix.apache.org>
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>
>> ------------------------------**------------------------------**---------
>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<us...@felix.apache.org>
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>

Re: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by Shai Amar <sh...@krynnlance.com>.
Hi Richard

I see. In other words, if I'll use the dynamic priority binding policy
(instead of just set the service ranking) I'll get the current ranking of
the service? Is that what you meant?

Regards
Shai Amar




On Thu, Aug 11, 2011 at 4:37 PM, Richard S. Hall <he...@ungoverned.org>wrote:

> You'll have to use dynamic priority binding policy for the dependency so
> that you are automatically switched based on service ranking...if you just
> use dynamic binding policy for the dependency, then you'll just get the
> highest ranking at the time of injection.
>
> -> richard
>
>
> On 8/11/11 8:54 AM, Shai Amar wrote:
>
>> Thanks!
>> It seems like an elegant solution. :)
>>
>> Regards
>> Shai Amar
>>
>> On Thu, Aug 11, 2011 at 3:46 PM,<Da...@l-3com.com>  wrote:
>>
>>  I think you would want to utilize the service ranking:
>>>
>>> When registering a service object, a
>>> bundle may optionally specify a
>>> service.ranking number as one of
>>> the service object's properties. If
>>> multiple qualifying service interfaces
>>> exist, a service with the highest
>>> SERVICE_RANKING number, or
>>> when equal to the lowest
>>> SERVICE_ID, determines which service
>>> object is returned by the Framework.
>>>
>>> Make Aa the highest rank, Ab after that.  That way it will get the Aa
>>> service if available, Ab if not.
>>>
>>> David Humeniuk
>>>
>>>
>>> -----Original Message-----
>>> From: Shai Amar [mailto:shai.amar@krynnlance.**com<sh...@krynnlance.com>
>>> ]
>>> Sent: Thursday, August 11, 2011 8:42 AM
>>> To: users@felix.apache.org
>>> Subject: Re: iPOJO: How to use an alternate service when the current
>>> service is unavailable?
>>>
>>> Hi David
>>>
>>> Still the question remains.
>>> The log service is an example.
>>>
>>> If I have 2 service implementations Aa and Ab of interface A.
>>> If I have a client that uses Aa and can use Ab. In case service Aa is
>>> unavailable, is it possible via iPOJO to switch automatically to service
>>> Ab?
>>>
>>> Regards
>>> Shai Amar
>>>
>>> On Thu, Aug 11, 2011 at 3:22 PM,<Da...@l-3com.com>  wrote:
>>>
>>>  Sounds like you should be using the LogReaderService for those
>>>> implementations not the LogService.  You can use the Felix Log Service
>>>> bundle to get a LogService implementation and Log Service APIs.
>>>>
>>>> David Humeniuk
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: Shai Amar [mailto:shai.amar@krynnlance.**com<sh...@krynnlance.com>
>>>> ]
>>>> Sent: Thursday, August 11, 2011 4:49 AM
>>>> To: users@felix.apache.org
>>>> Subject: iPOJO: How to use an alternate service when the current
>>>>
>>> service
>>>
>>>> is unavailable?
>>>>
>>>> Hi all
>>>>
>>>> I have the following situation:
>>>> I have 2 Log service implementations implementing *LogService*
>>>> interface:
>>>>
>>>>    1. *Console* log implementation
>>>>   2. *RotatingFile* log implementation
>>>>
>>>> I want that a service SOME_SERVICE will use the *Console* log
>>>> implementation
>>>> service as a default, and if it is unavailable, SOME_SERVICE will use
>>>> the *
>>>> RotatingFile* log implementation service instead.
>>>>
>>>> Is it possible to do that?
>>>> If it does, how can I do that?
>>>>
>>>> --
>>>> Regards
>>>>
>>>> Shai Amar
>>>>
>>>> Technologies manager, Founder
>>>> Krynnlance
>>>> www.krynnlance.com
>>>> www.backapps.com
>>>>
>>>> ------------------------------**------------------------------**
>>>> ---------
>>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<us...@felix.apache.org>
>>>> For additional commands, e-mail: users-help@felix.apache.org
>>>>
>>>>
>>>>
>>> --
>>> Regards
>>>
>>> Shai Amar
>>>
>>> Technologies manager, Founder
>>> Krynnlance
>>> www.krynnlance.com
>>> www.backapps.com
>>>
>>> ------------------------------**------------------------------**
>>> ---------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<us...@felix.apache.org>
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>>
>>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail: users-unsubscribe@felix.**apache.org<us...@felix.apache.org>
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Regards

Shai Amar

Technologies manager, Founder
Krynnlance
www.krynnlance.com
www.backapps.com

Re: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by "Richard S. Hall" <he...@ungoverned.org>.
You'll have to use dynamic priority binding policy for the dependency so 
that you are automatically switched based on service ranking...if you 
just use dynamic binding policy for the dependency, then you'll just get 
the highest ranking at the time of injection.

-> richard

On 8/11/11 8:54 AM, Shai Amar wrote:
> Thanks!
> It seems like an elegant solution. :)
>
> Regards
> Shai Amar
>
> On Thu, Aug 11, 2011 at 3:46 PM,<Da...@l-3com.com>  wrote:
>
>> I think you would want to utilize the service ranking:
>>
>> When registering a service object, a
>> bundle may optionally specify a
>> service.ranking number as one of
>> the service object's properties. If
>> multiple qualifying service interfaces
>> exist, a service with the highest
>> SERVICE_RANKING number, or
>> when equal to the lowest
>> SERVICE_ID, determines which service
>> object is returned by the Framework.
>>
>> Make Aa the highest rank, Ab after that.  That way it will get the Aa
>> service if available, Ab if not.
>>
>> David Humeniuk
>>
>>
>> -----Original Message-----
>> From: Shai Amar [mailto:shai.amar@krynnlance.com]
>> Sent: Thursday, August 11, 2011 8:42 AM
>> To: users@felix.apache.org
>> Subject: Re: iPOJO: How to use an alternate service when the current
>> service is unavailable?
>>
>> Hi David
>>
>> Still the question remains.
>> The log service is an example.
>>
>> If I have 2 service implementations Aa and Ab of interface A.
>> If I have a client that uses Aa and can use Ab. In case service Aa is
>> unavailable, is it possible via iPOJO to switch automatically to service
>> Ab?
>>
>> Regards
>> Shai Amar
>>
>> On Thu, Aug 11, 2011 at 3:22 PM,<Da...@l-3com.com>  wrote:
>>
>>> Sounds like you should be using the LogReaderService for those
>>> implementations not the LogService.  You can use the Felix Log Service
>>> bundle to get a LogService implementation and Log Service APIs.
>>>
>>> David Humeniuk
>>>
>>>
>>> -----Original Message-----
>>> From: Shai Amar [mailto:shai.amar@krynnlance.com]
>>> Sent: Thursday, August 11, 2011 4:49 AM
>>> To: users@felix.apache.org
>>> Subject: iPOJO: How to use an alternate service when the current
>> service
>>> is unavailable?
>>>
>>> Hi all
>>>
>>> I have the following situation:
>>> I have 2 Log service implementations implementing *LogService*
>>> interface:
>>>
>>>     1. *Console* log implementation
>>>    2. *RotatingFile* log implementation
>>>
>>> I want that a service SOME_SERVICE will use the *Console* log
>>> implementation
>>> service as a default, and if it is unavailable, SOME_SERVICE will use
>>> the *
>>> RotatingFile* log implementation service instead.
>>>
>>> Is it possible to do that?
>>> If it does, how can I do that?
>>>
>>> --
>>> Regards
>>>
>>> Shai Amar
>>>
>>> Technologies manager, Founder
>>> Krynnlance
>>> www.krynnlance.com
>>> www.backapps.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>>
>>
>> --
>> Regards
>>
>> Shai Amar
>>
>> Technologies manager, Founder
>> Krynnlance
>> www.krynnlance.com
>> www.backapps.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by Shai Amar <sh...@krynnlance.com>.
Thanks!
It seems like an elegant solution. :)

Regards
Shai Amar

On Thu, Aug 11, 2011 at 3:46 PM, <Da...@l-3com.com> wrote:

> I think you would want to utilize the service ranking:
>
> When registering a service object, a
> bundle may optionally specify a
> service.ranking number as one of
> the service object's properties. If
> multiple qualifying service interfaces
> exist, a service with the highest
> SERVICE_RANKING number, or
> when equal to the lowest
> SERVICE_ID, determines which service
> object is returned by the Framework.
>
> Make Aa the highest rank, Ab after that.  That way it will get the Aa
> service if available, Ab if not.
>
> David Humeniuk
>
>
> -----Original Message-----
> From: Shai Amar [mailto:shai.amar@krynnlance.com]
> Sent: Thursday, August 11, 2011 8:42 AM
> To: users@felix.apache.org
> Subject: Re: iPOJO: How to use an alternate service when the current
> service is unavailable?
>
> Hi David
>
> Still the question remains.
> The log service is an example.
>
> If I have 2 service implementations Aa and Ab of interface A.
> If I have a client that uses Aa and can use Ab. In case service Aa is
> unavailable, is it possible via iPOJO to switch automatically to service
> Ab?
>
> Regards
> Shai Amar
>
> On Thu, Aug 11, 2011 at 3:22 PM, <Da...@l-3com.com> wrote:
>
> > Sounds like you should be using the LogReaderService for those
> > implementations not the LogService.  You can use the Felix Log Service
> > bundle to get a LogService implementation and Log Service APIs.
> >
> > David Humeniuk
> >
> >
> > -----Original Message-----
> > From: Shai Amar [mailto:shai.amar@krynnlance.com]
> > Sent: Thursday, August 11, 2011 4:49 AM
> > To: users@felix.apache.org
> > Subject: iPOJO: How to use an alternate service when the current
> service
> > is unavailable?
> >
> > Hi all
> >
> > I have the following situation:
> > I have 2 Log service implementations implementing *LogService*
> > interface:
> >
> >    1. *Console* log implementation
> >   2. *RotatingFile* log implementation
> >
> > I want that a service SOME_SERVICE will use the *Console* log
> > implementation
> > service as a default, and if it is unavailable, SOME_SERVICE will use
> > the *
> > RotatingFile* log implementation service instead.
> >
> > Is it possible to do that?
> > If it does, how can I do that?
> >
> > --
> > Regards
> >
> > Shai Amar
> >
> > Technologies manager, Founder
> > Krynnlance
> > www.krynnlance.com
> > www.backapps.com
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> > For additional commands, e-mail: users-help@felix.apache.org
> >
> >
>
>
> --
> Regards
>
> Shai Amar
>
> Technologies manager, Founder
> Krynnlance
> www.krynnlance.com
> www.backapps.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Regards

Shai Amar

Technologies manager, Founder
Krynnlance
www.krynnlance.com
www.backapps.com

RE: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by Da...@L-3Com.com.
I think you would want to utilize the service ranking:

When registering a service object, a
bundle may optionally specify a
service.ranking number as one of
the service object's properties. If
multiple qualifying service interfaces
exist, a service with the highest
SERVICE_RANKING number, or
when equal to the lowest
SERVICE_ID, determines which service
object is returned by the Framework.

Make Aa the highest rank, Ab after that.  That way it will get the Aa
service if available, Ab if not.

David Humeniuk


-----Original Message-----
From: Shai Amar [mailto:shai.amar@krynnlance.com] 
Sent: Thursday, August 11, 2011 8:42 AM
To: users@felix.apache.org
Subject: Re: iPOJO: How to use an alternate service when the current
service is unavailable?

Hi David

Still the question remains.
The log service is an example.

If I have 2 service implementations Aa and Ab of interface A.
If I have a client that uses Aa and can use Ab. In case service Aa is
unavailable, is it possible via iPOJO to switch automatically to service
Ab?

Regards
Shai Amar

On Thu, Aug 11, 2011 at 3:22 PM, <Da...@l-3com.com> wrote:

> Sounds like you should be using the LogReaderService for those
> implementations not the LogService.  You can use the Felix Log Service
> bundle to get a LogService implementation and Log Service APIs.
>
> David Humeniuk
>
>
> -----Original Message-----
> From: Shai Amar [mailto:shai.amar@krynnlance.com]
> Sent: Thursday, August 11, 2011 4:49 AM
> To: users@felix.apache.org
> Subject: iPOJO: How to use an alternate service when the current
service
> is unavailable?
>
> Hi all
>
> I have the following situation:
> I have 2 Log service implementations implementing *LogService*
> interface:
>
>    1. *Console* log implementation
>   2. *RotatingFile* log implementation
>
> I want that a service SOME_SERVICE will use the *Console* log
> implementation
> service as a default, and if it is unavailable, SOME_SERVICE will use
> the *
> RotatingFile* log implementation service instead.
>
> Is it possible to do that?
> If it does, how can I do that?
>
> --
> Regards
>
> Shai Amar
>
> Technologies manager, Founder
> Krynnlance
> www.krynnlance.com
> www.backapps.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Regards

Shai Amar

Technologies manager, Founder
Krynnlance
www.krynnlance.com
www.backapps.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by Shai Amar <sh...@krynnlance.com>.
Hi David

Still the question remains.
The log service is an example.

If I have 2 service implementations Aa and Ab of interface A.
If I have a client that uses Aa and can use Ab. In case service Aa is
unavailable, is it possible via iPOJO to switch automatically to service Ab?

Regards
Shai Amar

On Thu, Aug 11, 2011 at 3:22 PM, <Da...@l-3com.com> wrote:

> Sounds like you should be using the LogReaderService for those
> implementations not the LogService.  You can use the Felix Log Service
> bundle to get a LogService implementation and Log Service APIs.
>
> David Humeniuk
>
>
> -----Original Message-----
> From: Shai Amar [mailto:shai.amar@krynnlance.com]
> Sent: Thursday, August 11, 2011 4:49 AM
> To: users@felix.apache.org
> Subject: iPOJO: How to use an alternate service when the current service
> is unavailable?
>
> Hi all
>
> I have the following situation:
> I have 2 Log service implementations implementing *LogService*
> interface:
>
>    1. *Console* log implementation
>   2. *RotatingFile* log implementation
>
> I want that a service SOME_SERVICE will use the *Console* log
> implementation
> service as a default, and if it is unavailable, SOME_SERVICE will use
> the *
> RotatingFile* log implementation service instead.
>
> Is it possible to do that?
> If it does, how can I do that?
>
> --
> Regards
>
> Shai Amar
>
> Technologies manager, Founder
> Krynnlance
> www.krynnlance.com
> www.backapps.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
Regards

Shai Amar

Technologies manager, Founder
Krynnlance
www.krynnlance.com
www.backapps.com

RE: iPOJO: How to use an alternate service when the current service is unavailable?

Posted by Da...@L-3Com.com.
Sounds like you should be using the LogReaderService for those
implementations not the LogService.  You can use the Felix Log Service
bundle to get a LogService implementation and Log Service APIs.

David Humeniuk


-----Original Message-----
From: Shai Amar [mailto:shai.amar@krynnlance.com] 
Sent: Thursday, August 11, 2011 4:49 AM
To: users@felix.apache.org
Subject: iPOJO: How to use an alternate service when the current service
is unavailable?

Hi all

I have the following situation:
I have 2 Log service implementations implementing *LogService*
interface:

   1. *Console* log implementation
   2. *RotatingFile* log implementation

I want that a service SOME_SERVICE will use the *Console* log
implementation
service as a default, and if it is unavailable, SOME_SERVICE will use
the *
RotatingFile* log implementation service instead.

Is it possible to do that?
If it does, how can I do that?

-- 
Regards

Shai Amar

Technologies manager, Founder
Krynnlance
www.krynnlance.com
www.backapps.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org