felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lksrules <lks.ru...@gmail.com>
Subject Dynamically referencing a Service using Felix annotations
Date Tue, 25 Sep 2012 18:26:44 GMT
I have created a interface . Which two different services are implementing .

Consider I have a interface named CheckReference and two different classes
CheckReferenceImpl1 and 
Check ReferencImpl2 .

@Service(value = CheckReference.class)
@Property(name = "domain", value = "ref1") 
public class CheckReferenceImpl1 implements CheckReference 

Also , 
@Service(value = CheckReference.class)
@Property(name = "domain", value = "ref2") 
public class CheckReferenceImpl2 implements CheckReference 

Now I want to dynamically load the implementation depending on my need using
@Reference annotation dynamically.
So , In a check condition 

public class LoadReference {
   CheckReference checkReference

   if(check) {
      // load checkReferencImpl1 
   } else {
      // load checkReferenceImpl2

Also I know that I can use target property to load specific implemenation.
But that is static way.
But in order to do this dynamically , Not able to relate from specifications
and tutorials how should I do this ??

View this message in context: http://apache-felix.18485.n6.nabble.com/Dynamically-referencing-a-Service-using-Felix-annotations-tp4999472.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.

View raw message