class CredentialManagerImpl implements CredentialManager,
		Observable<KeystoreChangedEvent> {

	@Override
	public List<URI> getServiceURIsForAllUsernameAndPasswordPairs()
			throws CMException {
		// Need to make sure we are initialized before we do anything else
		// as Credential Manager can be created but not initialized
		initialize();

		synchronized (keystore) {
			if (cachedServiceURIsList == null) {
				List<URI> serviceURIs = new ArrayList<>();
				for (String alias : getAliases(KEYSTORE)) {
					/*
					 * We are only interested in username/password entries here.
					 * Alias for such entries is constructed as
					 * "password#"<SERVICE_URI> where SERVICE_URI is the service
					 * this username/password pair is to be used for.
					 */
					if (!alias.startsWith("password#"))
						continue;
					String[] split = alias.split("#", 2);
					if (split.length != 2) {
						logger.warn("Invalid alias " + alias);
						continue;
					}
					String uriStr = split[1];
					URI uri = URI.create(uriStr);
					serviceURIs.add(uri);
				}
				cachedServiceURIsList = serviceURIs;
			}
			return cachedServiceURIsList;
		}
	}

	public  CredentialManagerImpl();

}