Created
May 22, 2017 20:43
-
-
Save dileeph/61e13152fe458efc83d993d3ad4b5355 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
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 " + policyService.getName() +" got bound at " + i); | |
}else if(policyService.verifyPolicy("abab")){ | |
System.out.println("Insurer B " + policyService.getName() +" got bound at " + i); | |
}else{ | |
System.out.println("There was another service provider" + policyService.getName()); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment