tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anat...@apache.org
Subject [01/10] incubator-tamaya git commit: Added AutorConfigure annotations/support to overall injection API (was previosuly in SE only), so we have only one injection API overall.
Date Fri, 18 Dec 2015 01:45:29 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 5fa2934af -> 642796ba3


Added AutorConfigure annotations/support to overall injection API (was previosuly in SE only),
so we have only one injection API overall.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/commit/53738369
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/tree/53738369
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya/diff/53738369

Branch: refs/heads/master
Commit: 53738369de7aa41046653c8e58743bf33a43eda7
Parents: 5fa2934
Author: anatole <anatole@apache.org>
Authored: Wed Dec 16 08:35:41 2015 +0100
Committer: anatole <anatole@apache.org>
Committed: Wed Dec 16 08:35:41 2015 +0100

----------------------------------------------------------------------
 README.md                                       |  2 +-
 .../tamaya/inject/api/ConfigAutoInject.java     | 36 ++++++++++++++++++++
 .../org/apache/tamaya/inject/api/NoConfig.java  | 36 ++++++++++++++++++++
 .../apache/tamaya/inject/ConfigAutoInject.java  | 36 --------------------
 .../java/org/apache/tamaya/inject/NoConfig.java | 36 --------------------
 .../inject/internal/ConfiguredTypeImpl.java     |  4 +--
 .../internal/DefaultConfigurationInjector.java  |  2 +-
 .../java/annottext/AnnotatedConfigBean.java     |  3 +-
 src/site/asciidoc/extensions/mod_events.adoc    | 22 ++++++++++++
 9 files changed, 99 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index f9b4b77..70727a3 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@ There are at least two main usage scenarios for Tamaya, which are synergetic:
   basic Tamaya core implementation). As a result all applications/modules in your company
follow the same configuration
   policy, which makes it much more simpler to move people between your teams. Similarly additional
tooling functionality
   can help you to manage configuration on application as well as on enterprise level, e.g.
providing command line or
-  REST support to access the supported configuration entries, types and values, configuration
validation and more.
+  REST support to access the supported configuration entries, types and values, configuration
configModel and more.
 - If you are writing an application, application component or library you can support configuration
using Tamaya by
   adding it as an optional dependency. If done so your users/customers can use Tamaya to
connect their current enterprise
   configuration infrastructure transparently to your code. As an example you can use Tamaya
to read your default

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/ConfigAutoInject.java
----------------------------------------------------------------------
diff --git a/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/ConfigAutoInject.java
b/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/ConfigAutoInject.java
new file mode 100644
index 0000000..1ed659e
--- /dev/null
+++ b/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/ConfigAutoInject.java
@@ -0,0 +1,36 @@
+/*
+ * 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.inject.api;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to control injection of a configured bean. The configuration keys
+ * to be resolved are basically determined by the {@link Config}
+ * annotation(s). When this annotation is added the injection systems tries to inject all
+ * fields found, also including fields not annotated with {@code @ConfigProperty}.
+ * Fields not to be injected ccan be annotated with {@code @NoConfig} to exclude them
+ * being eleceted for injection.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE })
+public @interface ConfigAutoInject {}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/NoConfig.java
----------------------------------------------------------------------
diff --git a/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/NoConfig.java
b/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/NoConfig.java
new file mode 100644
index 0000000..c5234d3
--- /dev/null
+++ b/modules/injection-api/src/main/java/org/apache/tamaya/inject/api/NoConfig.java
@@ -0,0 +1,36 @@
+/*
+ * 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.inject.api;
+
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * This is a small marker annotations to inform Tamaya that the annotated element should
never be injected with
+ * configured data. This is useful because by default Tamaya tries to lookup and inject configuration
also by
+ * using property or method names without annotations. With that annotation none of these
will be happen.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD })
+public @interface NoConfig {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/modules/injection/src/main/java/org/apache/tamaya/inject/ConfigAutoInject.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/ConfigAutoInject.java
b/modules/injection/src/main/java/org/apache/tamaya/inject/ConfigAutoInject.java
deleted file mode 100644
index fa08ac4..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/ConfigAutoInject.java
+++ /dev/null
@@ -1,36 +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.inject;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to control injection of a configured bean. The configuration keys
- * to be resolved are basically determined by the {@link Config}
- * annotation(s). When this annotation is added the injection systems tries to inject all
- * fields found, also including fields not annotated with {@code @ConfigProperty}.
- * Fields not to be injected ccan be annotated with {@code @NoConfig} to exclude them
- * being eleceted for injection.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE })
-public @interface ConfigAutoInject {}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java b/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java
deleted file mode 100644
index 76d2c5e..0000000
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/NoConfig.java
+++ /dev/null
@@ -1,36 +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.inject;
-
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * This is a small marker annotations to inform Tamaya that the annotated element should
never be injected with
- * configured data. This is useful because by default Tamaya tries to lookup and inject configuration
also by
- * using property or method names without annotations. With that annotation none of these
will be happen.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD })
-public @interface NoConfig {
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredTypeImpl.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredTypeImpl.java
b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredTypeImpl.java
index 0c22e1c..1e82462 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredTypeImpl.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/ConfiguredTypeImpl.java
@@ -27,8 +27,8 @@ import java.util.logging.Logger;
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.Configuration;
 import org.apache.tamaya.ConfigurationProvider;
-import org.apache.tamaya.inject.ConfigAutoInject;
-import org.apache.tamaya.inject.NoConfig;
+import org.apache.tamaya.inject.api.ConfigAutoInject;
+import org.apache.tamaya.inject.api.NoConfig;
 import org.apache.tamaya.inject.api.Config;
 import org.apache.tamaya.inject.api.ConfigDefaultSections;
 import org.apache.tamaya.inject.spi.ConfiguredField;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
index db0baa7..2630552 100644
--- a/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
+++ b/modules/injection/src/main/java/org/apache/tamaya/inject/internal/DefaultConfigurationInjector.java
@@ -32,7 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
 import org.apache.tamaya.inject.api.ConfiguredItemSupplier;
-import org.apache.tamaya.inject.NoConfig;
+import org.apache.tamaya.inject.api.NoConfig;
 import org.apache.tamaya.inject.api.Config;
 import org.apache.tamaya.inject.api.ConfigDefaultSections;
 import org.apache.tamaya.inject.spi.ConfiguredType;

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java
----------------------------------------------------------------------
diff --git a/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java b/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java
index dc65dad..4cd4baf 100644
--- a/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java
+++ b/modules/injection/src/test/java/annottext/AnnotatedConfigBean.java
@@ -19,8 +19,7 @@
 package annottext;
 
 import org.apache.tamaya.inject.api.DynamicValue;
-import org.apache.tamaya.inject.api.LoadPolicy;
-import org.apache.tamaya.inject.NoConfig;
+import org.apache.tamaya.inject.api.NoConfig;
 import org.apache.tamaya.inject.api.Config;
 import org.apache.tamaya.inject.api.ConfigDefault;
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/53738369/src/site/asciidoc/extensions/mod_events.adoc
----------------------------------------------------------------------
diff --git a/src/site/asciidoc/extensions/mod_events.adoc b/src/site/asciidoc/extensions/mod_events.adoc
index d725fe0..237b47c 100644
--- a/src/site/asciidoc/extensions/mod_events.adoc
+++ b/src/site/asciidoc/extensions/mod_events.adoc
@@ -296,6 +296,28 @@ Configuration frozenConfig = FrozenConfiguration.of(ConfigurationProvider.getCon
 PropertySource frozenSource = FrozenPropertySource.of(ConfigurationProvider.getConfiguration());
 --------------------------------------------------
 
+=== Observing and publishing configuration changes
+
+The event module allows to register and publish listeners for acting on configuration changes,
e.g. of paramters with a
+private section name. The main entry point for this feature is the +ConfigurationObserver+
singleton:
+
+[source,java]
+.ConfigurationObserver
+--------------------------------------------------
+public class ConfigurationObserver {
+
+    private ConfigurationObserver() {}
+
+    public static <T> void addObservedKeys(Collection<String> keys);
+    public static <T> void addObservedKeys(String... keys);
+    public static <T> void removeObservedKeys(Collection<String> keys);
+    public static <T> void removeObservedKeys(String... keys);
+    public static Set<String> getObservedKeys();
+--------------------------------------------------
+
+This singleton allows to register keys on which listeners may listen to. Hereby, when changes
have been identified
+that are observed, a +ConfigurationChange+ event is published on the event bus.
+
 
 === SPIs
 


Mime
View raw message