@Override public Set<CredentialStore<?>> getStoresForCredentialStorage(final IdentityContext context, Class<? extends CredentialStorage> storageClass) { IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition()); Map<IdentityStoreConfiguration, IdentityStore<?>> storesConfig = this.stores.get(identityConfiguration); Set<CredentialStore<?>> credentialStores = new HashSet<CredentialStore<?>>(); if (storesConfig != null) { for (IdentityStoreConfiguration storeConfig : storesConfig.keySet()) { if (storeConfig.supportsCredential()) { for (Class<? extends CredentialHandler> credentialHandler : storeConfig.getCredentialHandlers()) { SupportsCredentials supportedCredentials = credentialHandler.getAnnotation(SupportsCredentials.class); if (supportedCredentials != null) { if (supportedCredentials.credentialStorage().equals(storageClass)) { CredentialStore<?> credentialStore = (CredentialStore<?>) getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig); credentialStores.add(credentialStore); } } } } } } return credentialStores; }
@Override public Set<CredentialStore<?>> getStoresForCredentialStorage(final IdentityContext context, Class<? extends CredentialStorage> storageClass) { IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition()); Map<IdentityStoreConfiguration, IdentityStore<?>> storesConfig = this.stores.get(identityConfiguration); Set<CredentialStore<?>> credentialStores = new HashSet<CredentialStore<?>>(); if (storesConfig != null) { for (IdentityStoreConfiguration storeConfig : storesConfig.keySet()) { if (storeConfig.supportsCredential()) { for (Class<? extends CredentialHandler> credentialHandler : storeConfig.getCredentialHandlers()) { SupportsCredentials supportedCredentials = credentialHandler.getAnnotation(SupportsCredentials.class); if (supportedCredentials != null) { if (supportedCredentials.credentialStorage().equals(storageClass)) { CredentialStore<?> credentialStore = (CredentialStore<?>) getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig); credentialStores.add(credentialStore); } } } } } } return credentialStores; }
@Override public Set<IdentityStore<?>> getStoresForIdentityQuery(final IdentityContext context, final Class<? extends IdentityType> identityType) { IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition()); Map<Class<? extends IdentityType>, Set<IdentityStoreConfiguration>> cachedStoresForType = this.identityQueryStoresCache.get(context.getPartition().getName()); if (cachedStoresForType != null) { Set<IdentityStoreConfiguration> storeConfigs = cachedStoresForType.get(identityType); if (storeConfigs != null) { Set<IdentityStore<?>> identityStores = new HashSet<IdentityStore<?>>(); for (IdentityStoreConfiguration storeConfig : storeConfigs) { identityStores.add(getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig)); } return identityStores; } } Set<IdentityStore<?>> identityStores = new HashSet<IdentityStore<?>>(); Set<IdentityStoreConfiguration> identityStoresConfig = new HashSet<IdentityStoreConfiguration>(); cachedStoresForType = new HashMap<Class<? extends IdentityType>, Set<IdentityStoreConfiguration>>(); cachedStoresForType.put(identityType, identityStoresConfig); for (IdentityStoreConfiguration storeConfig : identityConfiguration.getStoreConfiguration()) { if (storeConfig.supportsType(identityType, read)) { identityStores.add(getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig)); identityStoresConfig.add(storeConfig); } } if (identityStores.isEmpty()) { throw MESSAGES.attributedTypeUnsupportedOperation(identityType, read, identityType, read); } this.identityQueryStoresCache.put(context.getPartition().getName(), cachedStoresForType); return identityStores; }
@Override public Set<IdentityStore<?>> getStoresForIdentityQuery(final IdentityContext context, final Class<? extends IdentityType> identityType) { IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition()); Map<Class<? extends IdentityType>, Set<IdentityStoreConfiguration>> cachedStoresForType = this.identityQueryStoresCache.get(context.getPartition().getName()); if (cachedStoresForType != null) { Set<IdentityStoreConfiguration> storeConfigs = cachedStoresForType.get(identityType); if (storeConfigs != null) { Set<IdentityStore<?>> identityStores = new HashSet<IdentityStore<?>>(); for (IdentityStoreConfiguration storeConfig : storeConfigs) { identityStores.add(getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig)); } return identityStores; } } Set<IdentityStore<?>> identityStores = new HashSet<IdentityStore<?>>(); Set<IdentityStoreConfiguration> identityStoresConfig = new HashSet<IdentityStoreConfiguration>(); cachedStoresForType = new HashMap<Class<? extends IdentityType>, Set<IdentityStoreConfiguration>>(); cachedStoresForType.put(identityType, identityStoresConfig); for (IdentityStoreConfiguration storeConfig : identityConfiguration.getStoreConfiguration()) { if (storeConfig.supportsType(identityType, read)) { identityStores.add(getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig)); identityStoresConfig.add(storeConfig); } } if (identityStores.isEmpty()) { throw MESSAGES.attributedTypeUnsupportedOperation(identityType, read, identityType, read); } this.identityQueryStoresCache.put(context.getPartition().getName(), cachedStoresForType); return identityStores; }
@Override public <T extends IdentityStore<?>> T getStoreForIdentityOperation(IdentityContext context, Class<T> storeType, Class<? extends AttributedType> type, IdentityOperation operation) { checkSupportedTypes(context.getPartition(), type); IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition()); T identityStore = lookupStore(context, identityConfiguration, type, operation); if (identityStore == null) { throw MESSAGES.attributedTypeUnsupportedOperation(type, operation, type, operation); } return identityStore; }
@Override public <T extends IdentityStore<?>> T getStoreForIdentityOperation(IdentityContext context, Class<T> storeType, Class<? extends AttributedType> type, IdentityOperation operation) { checkSupportedTypes(context.getPartition(), type); IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition()); T identityStore = lookupStore(context, identityConfiguration, type, operation); if (identityStore == null) { throw MESSAGES.attributedTypeUnsupportedOperation(type, operation, type, operation); } return identityStore; }
IdentityConfiguration config = getConfigurationForPartition(context, partition);
IdentityConfiguration config = getConfigurationForPartition(context, partition);
@Override public <T extends CredentialStore<?>> T getStoreForCredentialOperation(IdentityContext context, Class<?> credentialClass) { T store = null; IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition());
@Override public <T extends CredentialStore<?>> T getStoreForCredentialOperation(IdentityContext context, Class<?> credentialClass) { T store = null; IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition());
IdentityConfiguration config = getConfigurationForPartition(context, partitions.iterator().next()); IdentityConfiguration config = getConfigurationForPartition(context, partition);
IdentityConfiguration config = getConfigurationForPartition(context, partitions.iterator().next()); IdentityConfiguration config = getConfigurationForPartition(context, partition);
@Override public PermissionStore getStoreForPermissionOperation(IdentityContext context) { IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition()); if (identityConfiguration == null) { for (IdentityConfiguration configuration : this.configuration.getConfigurations()) { for (IdentityStoreConfiguration storeConfig : configuration.getStoreConfiguration()) { if (storeConfig.supportsPermissions()) { return (PermissionStore) getIdentityStoreAndInitializeContext(context, configuration, storeConfig); } } } } else { for (IdentityStoreConfiguration storeConfig : identityConfiguration.getStoreConfiguration()) { if (storeConfig.supportsPermissions()) { return (PermissionStore) getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig); } } } return null; }
@Override public PermissionStore getStoreForPermissionOperation(IdentityContext context) { IdentityConfiguration identityConfiguration = getConfigurationForPartition(context, context.getPartition()); if (identityConfiguration == null) { for (IdentityConfiguration configuration : this.configuration.getConfigurations()) { for (IdentityStoreConfiguration storeConfig : configuration.getStoreConfiguration()) { if (storeConfig.supportsPermissions()) { return (PermissionStore) getIdentityStoreAndInitializeContext(context, configuration, storeConfig); } } } } else { for (IdentityStoreConfiguration storeConfig : identityConfiguration.getStoreConfiguration()) { if (storeConfig.supportsPermissions()) { return (PermissionStore) getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig); } } } return null; }