public <T extends IdentityStore<?>> T lookupStore(IdentityContext context, IdentityConfiguration configuration, Class<? extends AttributedType> type, IdentityOperation operation) { for (IdentityStoreConfiguration storeConfig : configuration.getStoreConfiguration()) { if (storeConfig.supportsType(type, operation)) { return getIdentityStoreAndInitializeContext(context, configuration, storeConfig); } } return null; }
public <T extends IdentityStore<?>> T lookupStore(IdentityContext context, IdentityConfiguration configuration, Class<? extends AttributedType> type, IdentityOperation operation) { for (IdentityStoreConfiguration storeConfig : configuration.getStoreConfiguration()) { if (storeConfig.supportsType(type, operation)) { return getIdentityStoreAndInitializeContext(context, configuration, storeConfig); } } return null; }
@Override public <T extends AttributeStore<?>> T getStoreForAttributeOperation(IdentityContext context) { IdentityConfiguration attributeManagementConfig = this.configuration.getAttributeManagementConfig(); if (attributeManagementConfig != null) { Map<IdentityStoreConfiguration, IdentityStore<?>> configStores = stores.get(attributeManagementConfig); for (IdentityStoreConfiguration cfg : configStores.keySet()) { if (cfg.supportsAttribute()) { T store = getIdentityStoreAndInitializeContext(context, attributeManagementConfig, cfg); if (!AttributeStore.class.isInstance(store)) { throw MESSAGES.storeUnexpectedType(store.getClass(), AttributeStore.class); } return store; } } } return null; }
@Override public <T extends AttributeStore<?>> T getStoreForAttributeOperation(IdentityContext context) { IdentityConfiguration attributeManagementConfig = this.configuration.getAttributeManagementConfig(); if (attributeManagementConfig != null) { Map<IdentityStoreConfiguration, IdentityStore<?>> configStores = stores.get(attributeManagementConfig); for (IdentityStoreConfiguration cfg : configStores.keySet()) { if (cfg.supportsAttribute()) { T store = getIdentityStoreAndInitializeContext(context, attributeManagementConfig, cfg); if (!AttributeStore.class.isInstance(store)) { throw MESSAGES.storeUnexpectedType(store.getClass(), AttributeStore.class); } return store; } } } return null; }
@Override public <T extends PartitionStore<?>> T getStoreForPartitionOperation(IdentityContext context, Class<? extends Partition> partitionClass) { IdentityConfiguration partitionManagementConfig = this.configuration.getPartitionManagementConfig(); Map<IdentityStoreConfiguration, IdentityStore<?>> configStores = stores.get(partitionManagementConfig); for (IdentityStoreConfiguration cfg : configStores.keySet()) { if (cfg.supportsType(partitionClass, create)) { T store = getIdentityStoreAndInitializeContext(context, partitionManagementConfig, cfg); if (!PartitionStore.class.isInstance(store)) { throw MESSAGES.storeUnexpectedType(store.getClass(), PartitionStore.class); } return store; } } throw MESSAGES.storeNotFound(PartitionStore.class, partitionClass); }
@Override public <T extends PartitionStore<?>> T getStoreForPartitionOperation(IdentityContext context, Class<? extends Partition> partitionClass) { IdentityConfiguration partitionManagementConfig = this.configuration.getPartitionManagementConfig(); Map<IdentityStoreConfiguration, IdentityStore<?>> configStores = stores.get(partitionManagementConfig); for (IdentityStoreConfiguration cfg : configStores.keySet()) { if (cfg.supportsType(partitionClass, create)) { T store = getIdentityStoreAndInitializeContext(context, partitionManagementConfig, cfg); if (!PartitionStore.class.isInstance(store)) { throw MESSAGES.storeUnexpectedType(store.getClass(), PartitionStore.class); } return store; } } throw MESSAGES.storeNotFound(PartitionStore.class, partitionClass); }
@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 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; }
for (IdentityStoreConfiguration storeConfig : config.getStoreConfiguration()) { if (storeConfig.supportsType(relationshipClass, create) || Relationship.class.equals(relationshipClass)) { identityStores.add(getIdentityStoreAndInitializeContext(context, config, storeConfig)); for (IdentityStoreConfiguration storeConfig : config.getStoreConfiguration()) { if (storeConfig.supportsType(relationshipClass, create) || Relationship.class.equals(relationshipClass)) { identityStores.add(getIdentityStoreAndInitializeContext(context, config, storeConfig));
for (IdentityStoreConfiguration storeConfig : config.getStoreConfiguration()) { if (storeConfig.supportsType(relationshipClass, create) || Relationship.class.equals(relationshipClass)) { identityStores.add(getIdentityStoreAndInitializeContext(context, config, storeConfig)); for (IdentityStoreConfiguration storeConfig : config.getStoreConfiguration()) { if (storeConfig.supportsType(relationshipClass, create) || Relationship.class.equals(relationshipClass)) { identityStores.add(getIdentityStoreAndInitializeContext(context, config, storeConfig));
return getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig); for (Class<?> cls : handlerClass.getAnnotation(SupportsCredentials.class).credentialClass()) { if (cls.isAssignableFrom(credentialClass)) { IdentityStore<?> identityStore = getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig);
return getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig); for (Class<?> cls : handlerClass.getAnnotation(SupportsCredentials.class).credentialClass()) { if (cls.isAssignableFrom(credentialClass)) { IdentityStore<?> identityStore = getIdentityStoreAndInitializeContext(context, identityConfiguration, storeConfig);
for (IdentityStoreConfiguration storeConfig : config.getStoreConfiguration()) { if (storeConfig.supportsType(relationshipClass, operation)) { store = getIdentityStoreAndInitializeContext(context, config, storeConfig); for (IdentityStoreConfiguration storeConfig : config.getStoreConfiguration()) { if (storeConfig.supportsType(relationshipClass, operation)) { store = getIdentityStoreAndInitializeContext(context, config, storeConfig); store = getIdentityStoreAndInitializeContext(context, cfg, storeConfig);
for (IdentityStoreConfiguration storeConfig : config.getStoreConfiguration()) { if (storeConfig.supportsType(relationshipClass, operation)) { store = getIdentityStoreAndInitializeContext(context, config, storeConfig); for (IdentityStoreConfiguration storeConfig : config.getStoreConfiguration()) { if (storeConfig.supportsType(relationshipClass, operation)) { store = getIdentityStoreAndInitializeContext(context, config, storeConfig); store = getIdentityStoreAndInitializeContext(context, cfg, storeConfig);