Created
May 23, 2017 01:19
-
-
Save dileeph/6451f0222c35481f59a0443fdf6d1321 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Policy client class. | |
* @author Dileep Hareendran | |
* | |
*/ | |
public class PolicyServiceClient { | |
private Set<PolicyService> services = new HashSet<PolicyService>(); | |
/** | |
* Hook method called on activation of this service client. | |
* @param context BundleContext | |
*/ | |
public void activate(BundleContext context){ | |
System.out.println("activating " + context.getBundle().getSymbolicName()); | |
for(PolicyService service: services){ | |
System.out.println("Service" + service.getName() + " registered"); | |
} | |
} | |
/** | |
* Hook method called on deactivation of this service client. | |
* @param context BundleContext | |
*/ | |
public void deactivate(BundleContext context){ | |
System.out.println("deactivating " + context.getBundle().getSymbolicName()); | |
} | |
/** | |
* Called to inject a dependency service on service binding | |
* @param service PolicyService | |
*/ | |
public void addPolicyService(PolicyService service){ | |
services.add(service); | |
} | |
/** | |
* Called to unset a dependency service while unloading. | |
* @param service PolicyService | |
*/ | |
public void removePolicyService(PolicyService service){ | |
if(services.contains(service)){ | |
services.remove(service); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment