
org.jgrapes.util.events.ConfigurationUpdate Maven / Gradle / Ivy
/*
* JGrapes Event Driven Framework
* Copyright (C) 2017-2022 Michael N. Lipp
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
* for more details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program; if not, see .
*/
package org.jgrapes.util.events;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import org.jgrapes.core.Event;
import org.jgrapes.core.Manager;
import org.jgrapes.util.ConfigurationStore;
/**
* An event to indicate that configuration information has been
* updated.
*
* Configuration information provided by this event is organized
* by paths and associated key/value pairs. The path information
* should be used by components to select the information important
* to them. Often, a component simply matches the path from the event
* with its own path in the component hierarchy
* (see {@link Manager#componentPath()}). But paths can also be used
* to structure information in a way that is completely independent of
* the implementation's structure as the filtering is completely up
* to the component.
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public class ConfigurationUpdate extends Event {
@SuppressWarnings("PMD.UseConcurrentHashMap")
private final Map> structuredValues
= new HashMap<>();
private final Map> flattenedCache
= new ConcurrentHashMap<>();
/**
* Return all paths affected by this event.
*
* @return the paths
*/
@SuppressWarnings("PMD.ConfusingTernary")
public Set paths() {
synchronized (structuredValues) {
return new HashSet<>(structuredValues.keySet());
}
}
private Optional
© 2015 - 2025 Weber Informatics LLC | Privacy Policy