Created
May 1, 2017 20:37
-
-
Save dileeph/a43635b6d1d607b736e7f85b3e043885 to your computer and use it in GitHub Desktop.
osgi client activator
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
public void start(BundleContext context) throws Exception { | |
System.out.println("start simple policy client"); | |
ServiceReference[] serviceReferences = context.getServiceReferences(PolicyService.class.getName(), "(Insurer=*)"); | |
if(serviceReferences != null && serviceReferences.length > 0){ | |
for(int i =0; i < serviceReferences.length; i++){ | |
PolicyService policyService = (PolicyService)context.getService(serviceReferences[i]); | |
System.out.println("Trying to find the services"); | |
if(policyService.verifyPolicy("1212")){ | |
System.out.println("Insurer A got bound at " + i); | |
}else if(policyService.verifyPolicy("abab")){ | |
System.out.println("Insurer B got bound at " + i); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment