[21/50] [abbrv] incubator-tamaya-extensions git commit: Simplified events module, adapted documentation as well. Removed model dependency from events, since events is the more general module here.
Simplified events module, adapted documentation as well. Removed model dependency from events, since events is the more general module here. Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/commit/384b09eb Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/tree/384b09eb Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/diff/384b09eb Branch: refs/heads/master Commit: 384b09eb8cc3dca3d4699a4353b4f6a420904623 Parents: c87ace0 Author: anatole Authored: Wed Dec 16 08:37:17 2015 +0100 Committer: Oliver B. Fischer Committed: Tue Sep 27 00:18:31 2016 +0200 -- .../tamaya/events/ChangeNotification.java | 66 - .../org/apache/tamaya/events/ChangeType.java| 28 ++ .../org/apache/tamaya/events/ConfigEvent.java | 58 .../tamaya/events/ConfigEventListener.java | 5 +- .../tamaya/events/ConfigEventManager.java | 112 ++-- .../apache/tamaya/events/ConfigListener.java| 31 --- .../tamaya/events/ConfigurationChange.java | 222 +++ .../events/ConfigurationChangeBuilder.java | 272 +++ .../events/ConfigurationContextChange.java | 208 ++ .../ConfigurationContextChangeBuilder.java | 173 .../tamaya/events/ConfigurationObserver.java| 107 .../tamaya/events/PropertySourceChange.java | 242 + .../events/PropertySourceChangeBuilder.java | 258 ++ .../apache/tamaya/events/delta/ChangeType.java | 28 -- .../events/delta/ConfigurationChange.java | 216 --- .../delta/ConfigurationChangeBuilder.java | 262 -- .../delta/ConfigurationContextChange.java | 192 - .../ConfigurationContextChangeBuilder.java | 159 --- .../events/delta/PropertySourceChange.java | 236 .../delta/PropertySourceChangeBuilder.java | 258 -- .../folderobserver/FileChangeListener.java | 3 +- .../ObservingPropertySourceProvider.java| 8 +- .../internal/DefaultConfigChangeObserver.java | 107 .../internal/DefaultConfigEventManagerSpi.java | 162 --- .../internal/DefaultConfigObserverSpi.java | 158 --- ...faultConfigurationContextChangeListener.java | 57 ++-- .../events/internal/LoggingConfigListener.java | 14 +- .../org/apache/tamaya/events/package-info.java | 3 +- .../tamaya/events/spi/BaseConfigEvent.java | 69 + .../events/spi/ConfigEventManagerSpi.java | 83 +- .../tamaya/events/spi/ConfigObserverSpi.java| 71 - ...org.apache.tamaya.events.ConfigEventListener | 2 +- ...g.apache.tamaya.events.spi.ConfigObserverSpi | 2 +- .../events/ChangeableGlobalPropertySource.java | 62 + .../ChangeableThreadLocalPropertySource.java| 57 .../tamaya/events/ConfigEventManagerTest.java | 25 +- .../org/apache/tamaya/events/SimpleEvent.java | 13 + .../events/delta/ConfigurationChangeTest.java | 4 +- .../delta/ConfigurationContextChangeTest.java | 9 +- .../events/delta/PropertySourceChangeTest.java | 5 +- .../DefaultConfigEventManagerSpiTest.java | 19 +- 41 files changed, 2151 insertions(+), 1915 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/384b09eb/src/main/java/org/apache/tamaya/events/ChangeNotification.java -- diff --git a/src/main/java/org/apache/tamaya/events/ChangeNotification.java b/src/main/java/org/apache/tamaya/events/ChangeNotification.java deleted file mode 100644 index 73a4fa9..000 --- a/src/main/java/org/apache/tamaya/events/ChangeNotification.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.events; - -import java.beans.PropertyChangeEvent; -import java.util.Collection; - - -/** - * Event that contains a set curren
[21/50] [abbrv] incubator-tamaya-extensions git commit: Simplified events module, adapted documentation as well. Removed model dependency from events, since events is the more general module here.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya-extensions/blob/384b09eb/src/main/java/org/apache/tamaya/events/delta/ConfigurationChangeBuilder.java -- diff --git a/src/main/java/org/apache/tamaya/events/delta/ConfigurationChangeBuilder.java b/src/main/java/org/apache/tamaya/events/delta/ConfigurationChangeBuilder.java deleted file mode 100644 index ff5e26b..000 --- a/src/main/java/org/apache/tamaya/events/delta/ConfigurationChangeBuilder.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.tamaya.events.delta; - -import org.apache.tamaya.Configuration; - -import java.beans.PropertyChangeEvent; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.SortedMap; -import java.util.TreeMap; - -/** - * Models a set current changes applied to a {@link org.apache.tamaya.spi.PropertySource}. Consumers of these events - * can observing changes to property sources and - * - * Check if their current configuration instance ({@link org.apache.tamaya.spi.ConfigurationContext} - * contains the changed {@link org.apache.tamaya.spi.PropertySource} (Note: the reference tova property source is never affected by a - * change, its only the data of the property source). - * If so corresponding action may be taken, such as reevaluating the configuration values (depending on - * the update policy) or reevaluating the complete {@link org.apache.tamaya.Configuration} to create a change - * event on configuration level. - * - */ -public final class ConfigurationChangeBuilder { -/** - * The recorded changes. - */ -final SortedMap delta = new TreeMap<>(); -/** - * The underlying configuration/provider. - */ -Configuration source; -/** - * The version configured, or null, for generating a default. - */ -String version; -/** - * The optional timestamp in millis of this epoch. - */ -Long timestamp; - -/** - * Constructor. - * - * @param configuration the underlying configuration, not null. - */ -private ConfigurationChangeBuilder(Configuration configuration) { -this.source = Objects.requireNonNull(configuration); -} - -/** - * Creates a new instance current this builder. - * - * @param configuration the configuration changed, not null. - * @return the builder for chaining. - */ -public static ConfigurationChangeBuilder of(Configuration configuration) { -return new ConfigurationChangeBuilder(configuration); -} - -/** - * Compares the two property config/configurations and creates a collection current all changes - * that must be appied to render {@code map1} into {@code map2}. - * - * @param map1 the source map, not null. - * @param map2 the target map, not null. - * @return a collection current change events, never null. - */ -public static Collection compare(Configuration map1, Configuration map2) { -List changes = new ArrayList<>(); -for (Map.Entry en : map1.getProperties().entrySet()) { -String val = map2.get(en.getKey()); -if (val == null) { -changes.add(new PropertyChangeEvent(map1, en.getKey(), null, en.getValue())); -} else if (!val.equals(en.getValue())) { -changes.add(new PropertyChangeEvent(map1, en.getKey(), val, en.getValue())); -} -} -for (Map.Entry en : map2.getProperties().entrySet()) { -String val = map1.get(en.getKey()); -if (val == null) { -changes.add(new PropertyChangeEvent(map1, en.getKey(), null, en.getValue())); -} else if (!val.equals(en.getValue())) { -changes.add(new PropertyChangeEvent(map1, en.getKey(), val, en.getValue())); -} -} -return changes; -} - -/* - * Apply a version/UUID to the set being built. - * @param version the version to apply, or null, to let the system generate a version for you. - * @return