void flushPartitions() { flush(PARTITIONS_FILE_NAME, getPartitions()); }
@Override public <P extends Partition> List<P> get(IdentityContext identityContext, Class<P> partitionClass) { List<P> result = new ArrayList<P>(); for (FilePartition filePartition : this.fileDataSource.getPartitions().values()) { Partition partition = filePartition.getEntry(); if (Partition.class.equals(partitionClass) || partitionClass.equals(partition.getClass())) { result.add((P) cloneAttributedType(identityContext, partition)); } } return result; }
@Override public <P extends Partition> List<P> get(IdentityContext identityContext, Class<P> partitionClass) { List<P> result = new ArrayList<P>(); for (FilePartition filePartition : this.fileDataSource.getPartitions().values()) { Partition partition = filePartition.getEntry(); if (Partition.class.equals(partitionClass) || partitionClass.equals(partition.getClass())) { result.add((P) cloneAttributedType(identityContext, partition)); } } return result; }
private FilePartition resolve(Class<? extends Partition> type, String name) throws IdentityManagementException { for (FilePartition filePartition : this.fileDataSource.getPartitions().values()) { Partition storedPartition = filePartition.getEntry(); if (storedPartition.getClass().equals(type) && storedPartition.getName().equals(name)) { return filePartition; } } throw MESSAGES.partitionNotFoundWithName(type, name); }
private FilePartition resolve(Class<? extends Partition> type, String name) throws IdentityManagementException { for (FilePartition filePartition : this.fileDataSource.getPartitions().values()) { Partition storedPartition = filePartition.getEntry(); if (storedPartition.getClass().equals(type) && storedPartition.getName().equals(name)) { return filePartition; } } throw MESSAGES.partitionNotFoundWithName(type, name); }
@Override public <P extends Partition> P lookupById(final IdentityContext context, final Class<P> partitionClass, final String id) { FilePartition filePartition = this.fileDataSource.getPartitions().get(id); if (filePartition != null && partitionClass.isInstance(filePartition.getEntry())) { return (P) cloneAttributedType(context, filePartition.getEntry()); } return null; }
@Override public <P extends Partition> P lookupById(final IdentityContext context, final Class<P> partitionClass, final String id) { FilePartition filePartition = this.fileDataSource.getPartitions().get(id); if (filePartition != null && partitionClass.isInstance(filePartition.getEntry())) { return (P) cloneAttributedType(context, filePartition.getEntry()); } return null; }
private List<FileCredentialStorage> getCredentials(Account account, Class<? extends CredentialStorage> storageType) { Partition partition = account.getPartition(); FilePartition filePartition = resolve(partition.getClass(), partition.getName()); Map<String, List<FileCredentialStorage>> agentCredentials = filePartition.getCredentials().get(account.getId()); if (agentCredentials == null) { agentCredentials = new ConcurrentHashMap<String, List<FileCredentialStorage>>(); this.fileDataSource.getPartitions().get(partition.getId()).getCredentials().put(account.getId(), agentCredentials); } List<FileCredentialStorage> credentials = agentCredentials.get(storageType.getName()); if (credentials == null) { credentials = Collections.synchronizedList(new ArrayList<FileCredentialStorage>()); } agentCredentials.put(storageType.getName(), credentials); return credentials; }
void flushCredentials(FilePartition partition) { FilePartition filePartition = getPartitions().get(partition.getId()); flush(filePartition, CREDENTIALS_FILE_NAME, filePartition.getCredentials()); }
void flushPermissions(FilePartition partition) { FilePartition filePartition = getPartitions().get(partition.getId()); flush(filePartition, PERMISSIONS_FILE_NAME, filePartition.getPermissions()); }
@Override public void remove(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); this.fileDataSource.getPartitions().remove(filePartition.getId()); this.fileDataSource.flushPartitions(); }
@Override public void remove(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); this.fileDataSource.getPartitions().remove(filePartition.getId()); this.fileDataSource.flushPartitions(); }
void flushPermissions(FilePartition partition) { FilePartition filePartition = getPartitions().get(partition.getId()); flush(filePartition, PERMISSIONS_FILE_NAME, filePartition.getPermissions()); }
void flushCredentials(FilePartition partition) { FilePartition filePartition = getPartitions().get(partition.getId()); flush(filePartition, CREDENTIALS_FILE_NAME, filePartition.getCredentials()); }
void flushPartitions(FilePartition partition) { initPartition(partition.getId()); flush(PARTITIONS_FILE_NAME, getPartitions()); }
void flushPartitions(FilePartition partition) { initPartition(partition.getId()); flush(PARTITIONS_FILE_NAME, getPartitions()); }
@Override public void update(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); this.fileDataSource.getPartitions().put(partition.getId(), new FilePartition(cloneAttributedType(identityContext, partition), filePartition.getConfigurationName())); this.fileDataSource.flushPartitions(); }
@Override public void update(IdentityContext identityContext, Partition partition) { FilePartition filePartition = resolve(partition.getClass(), partition.getName()); this.fileDataSource.getPartitions().put(partition.getId(), new FilePartition(cloneAttributedType(identityContext, partition), filePartition.getConfigurationName())); this.fileDataSource.flushPartitions(); }
@Override public void add(IdentityContext identityContext, Partition partition, String configurationName) { partition.setId(identityContext.getIdGenerator().generate()); FilePartition filePartition = new FilePartition(cloneAttributedType(identityContext, partition), configurationName); this.fileDataSource.getPartitions().put(filePartition.getId(), filePartition); this.fileDataSource.flushPartitions(filePartition); }
@Override public void add(IdentityContext identityContext, Partition partition, String configurationName) { partition.setId(identityContext.getIdGenerator().generate()); FilePartition filePartition = new FilePartition(cloneAttributedType(identityContext, partition), configurationName); this.fileDataSource.getPartitions().put(filePartition.getId(), filePartition); this.fileDataSource.flushPartitions(filePartition); }