private CredentialStore lookupStore(String type) {
ServiceTracker credentialStoreTracker = null;
try {
credentialStoreTracker = new ServiceTracker(bundleContext, bundleContext.createFilter(String.format(CREDENTIAL_STORE_FILTER, type)), null);
credentialStoreTracker.open();
return (CredentialStore) credentialStoreTracker.waitForService(10000);
} catch (InvalidSyntaxException e) {
LOGGER.error("Error looking up credential store.", e);
} catch (InterruptedException e) {
LOGGER.error("Timed out waiting for store.", e);