public void addUpdate(UserCredential userCredential) { configManager.updateXML( USER_CREDENTIALS_CONFIG, newAddUpdateUserCredentialsDocumentAlteration(userCredential)); if (userCredential.getServiceKey() != null) { usersWithServiceKey.add(userCredential.getUsername()); } }
public void addUpdate(WorkflowExecution workflowExecution) { String collection = workflowExecution.getCollection(); String filePath = collection + File.separator + EXECUTION_FOLDER + File.separator + workflowExecution.getId() + XML_EXTENSION; if (!workflowsExecutionsMap.containsKey(collection + workflowExecution.getId())) { oneXMLConfigPerCollectionManager.updateXML( collection, newAddWorkflowExcecutionIndexDocumentAlteration(workflowExecution)); } else { oneXMLConfigPerCollectionManager.updateXML( collection, newUpdateWorkflowExcecutionIndexDocumentAlteration(workflowExecution)); configManager.delete(filePath); } configManager.createXMLDocumentIfInexistent( filePath, newAddWorkflowExcecutionDocumentAlteration(workflowExecution)); }
public void remove(WorkflowExecution workflowExecution) { String collection = workflowExecution.getCollection(); if (!workflowsExecutionsMap.containsKey(collection + workflowExecution.getId())) { throw new WorkflowExecutionIndexRuntimeException_WorkflowExecutionNotFound( workflowExecution.getId(), collection); } String filePath = collection + File.separator + EXECUTION_FOLDER + File.separator + workflowExecution.getId() + XML_EXTENSION; oneXMLConfigPerCollectionManager.updateXML( collection, newRemoveWorkflowExcecutionIndexDocumentAlteration(workflowExecution)); configManager.delete(filePath); }
public WorkflowExecution getWorkflow(String collection, String id) { String correctedId = correctId(collection, id); if (!workflowsExecutionsMap.containsKey(collection + correctedId)) { throw new WorkflowExecutionIndexRuntimeException_WorkflowExecutionNotFound( correctedId, collection); } String filePath = collection + File.separator + EXECUTION_FOLDER + File.separator + correctedId + XML_EXTENSION; Document document = configManager.getXML(filePath).getDocument(); WorkflowExecution workflowExecution = newWorkflowExecutionReader(document).read(collection, correctedId, document); return workflowExecution; }
@Override public void initialize() { registerListener(configManager); Document document = configManager.getXML(USER_CREDENTIALS_CONFIG).getDocument(); UserCredentialsReader reader = newUserCredencialsReader(document); cache = Collections.unmodifiableMap(reader.readAll()); Runnable removedTimedOutTokens = new Runnable() { @Override public void run() { removedTimedOutTokens(); } }; this.backgroundThreadsManager.configure( BackgroundThreadConfiguration.repeatingAction( "removedTimedOutTokens", removedTimedOutTokens) .handlingExceptionWith(CONTINUE) .executedEvery(configuration.getTokenRemovalThreadDelayBetweenChecks())); }
void createEmptyUserCredentialsConfig() { Document document = new Document(); UserCredentialsWriter writer = new UserCredentialsWriter(document); writer.createEmptyUserCredentials(); configManager.add(USER_CREDENTIALS_CONFIG, document); }
@Override public void onConfigUpdated(String configPath) { Document document = configManager.getXML(USER_CREDENTIALS_CONFIG).getDocument(); UserCredentialsReader reader = newUserCredencialsReader(document); cache = Collections.unmodifiableMap(reader.readAll()); }
void registerListener(ConfigManager configManager) { if (!configManager.exist(USER_CREDENTIALS_CONFIG)) { createEmptyUserCredentialsConfig(); } configManager.registerListener(USER_CREDENTIALS_CONFIG, this); }
public void removeGroup(String codeGroup) { configManager.updateXML(USER_CREDENTIALS_CONFIG, newRemoveGroupDocumentAlteration(codeGroup)); }
public void removeUserCredentialFromCollection(UserCredential userCredential, String collection) { configManager.updateXML( USER_CREDENTIALS_CONFIG, newRemoveUserDocumentAlteration(userCredential, collection)); }
public void removeToken(String token) { configManager.updateXML(USER_CREDENTIALS_CONFIG, newRemoveTokenDocumentAlteration(token)); }
public void removeCollection(String collection) { configManager.updateXML( USER_CREDENTIALS_CONFIG, newRemoveCollectionDocumentAlteration(collection)); }