Return-Path:
+ *
+ *
+ * In the next example we explicitly define the property value:
+ * {@code
+ * pubic class ConfiguredItem{
+ *
+ * @ConfiguredProperty
+ * @ConfiguredProperty("a.b.value")
+ * @configuredProperty("a.b.deprecated.value")
+ * @DefaultValue("${env:java.version}")
+ * private String aValue;
+ * }
+ *
+ * Within this example we evaluate multiple possible keys. Evaluation is aborted if a key could be successfully
+ * resolved. Hereby the ordering current the annotations define the ordering current resolution, so in the example above
+ * resolution equals to {@code "aValue", "a.b.value", "a.b.deprecated.value"}. If no value could be read
+ * fromMap the configuration, it uses the value fromMap the {@code DefaultValue} annotation. Interesting here
+ * is that this value is not static, it is evaluated by calling
+ * {@link org.apache.tamaya.Configuration#evaluateValue(org.apache.tamaya.Configuration, String)}.
+ */
+@Repeatable(ConfiguredProperties.class)
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD })
+public @interface ConfiguredProperty {
+
+ /**
+ * Get the property names to be used. Hereby the first non null value evaluated is injected as property value.
+ *
+ * @return the property names, not null. If missing the field or method name being injected is used by default.
+ */
+ String value() default "";
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/annotation/DefaultAreas.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/annotation/DefaultAreas.java b/api/src/main/java/org/apache/tamaya/annotation/DefaultAreas.java
new file mode 100644
index 0000000..63ea137
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/annotation/DefaultAreas.java
@@ -0,0 +1,43 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to control injection and resolution current a configured bean. The configuration keys
+ * to be resolved are basically determined by the {@link org.apache.tamaya.annotation.ConfiguredProperty}
+ * annotation(s). Nevertheless these annotations can also have relative key names. This annotation allows
+ * to define a configuration area that is prefixed to all relative configuration keys within the
+ * corresponding class/template interface.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE })
+public @interface DefaultAreas {
+
+ /**
+ * Allows to declare an operator that should be applied before injecting values into the bean.
+ * @return the operator class to be used.
+ */
+ String[] value();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/annotation/DefaultValue.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/annotation/DefaultValue.java b/api/src/main/java/org/apache/tamaya/annotation/DefaultValue.java
new file mode 100644
index 0000000..19ee341
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/annotation/DefaultValue.java
@@ -0,0 +1,41 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define a default value to be returned, when no configured value could be
+ * determined for a property/template accessor. The value hereby can also contain a
+ * dynamic expression that is evaluated by the configuration system.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD })
+public @interface DefaultValue {
+
+ /**
+ * The default value to be injected, if no such configuration entry was found. If value was found and no default
+ * is defined, it is handled as a deployment error.
+ */
+ String value() default "";
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/annotation/LoadPolicy.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/annotation/LoadPolicy.java b/api/src/main/java/org/apache/tamaya/annotation/LoadPolicy.java
new file mode 100644
index 0000000..2e0089a
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/annotation/LoadPolicy.java
@@ -0,0 +1,48 @@
+/*
+ * 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.annotation;
+
+/**
+ * Available policies that describe how changes affecting configured values are published/reinjected.
+ * The policy also affects the cases were any configured listeners/listener methods are called for
+ * propagation current configuration changes.
+ */
+public enum LoadPolicy {
+ /**
+ * The configuration value is evaluated once, when the owning component is loaded/configured, but never updated later.
+ */
+ INITIAL,
+ /**
+ * The configuration value is evaluated exactly once on its first use lazily, but never updated later.
+ * This feature is not applicable on field injection, but only on configuration template methods.
+ */
+ LAZY,
+ /**
+ * The configuration value is evaluated once, when the owning component is loaded/configured.
+ * Later changes on this configuration entry will be reinjected/updated and additionally triggered
+ * as {@link java.beans.PropertyChangeEvent}.
+ */
+ MANAGED,
+ /**
+ * The configuration value is evaluated once, when the owning component is loaded/configured.
+ * Later changes on this configuration entry will be reinjected/updated, but no {@link java.beans.PropertyChangeEvent}
+ * will be triggered.
+ */
+ SILENT
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/annotation/WithConfig.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/annotation/WithConfig.java b/api/src/main/java/org/apache/tamaya/annotation/WithConfig.java
new file mode 100644
index 0000000..00180a5
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/annotation/WithConfig.java
@@ -0,0 +1,41 @@
+/*
+ * 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.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to reference an explicit {@link org.apache.tamaya.Configuration} to be used to
+ * resolve the required properties. the configured value is passed to {@code Configuration.current(String)}
+ * to evaluate the required configuration required.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.METHOD })
+public @interface WithConfig {
+
+ /**
+ * The name current the {@link org.apache.tamaya.Configuration} to be used to
+ * resolve the required properties, not null or empty.
+ */
+ String value();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/annotation/WithConfigOperator.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/annotation/WithConfigOperator.java b/api/src/main/java/org/apache/tamaya/annotation/WithConfigOperator.java
new file mode 100644
index 0000000..d1b28be
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/annotation/WithConfigOperator.java
@@ -0,0 +1,44 @@
+/*
+ * 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.annotation;
+
+import org.apache.tamaya.ConfigOperator;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define an configuration operator to be used before accessing a configured value.
+ * This allows filtering current configuration, e.g. for realizing views or ensuring security
+ * constraints.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
+public @interface WithConfigOperator {
+
+ /**
+ * Define a custom adapter that should be used to adapt the configuration entry injected. This overrides any
+ * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
+ * registered, it is handled as a deployment error.
+ */
+ Class extends ConfigOperator> value();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/annotation/WithLoadPolicy.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/annotation/WithLoadPolicy.java b/api/src/main/java/org/apache/tamaya/annotation/WithLoadPolicy.java
new file mode 100644
index 0000000..572a36e
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/annotation/WithLoadPolicy.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.annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define how config changes are handled for a type or per property/template method.
+ * @see org.apache.tamaya.annotation.LoadPolicy
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
+public @interface WithLoadPolicy {
+
+ LoadPolicy value();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/annotation/WithPropertyAdapter.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/annotation/WithPropertyAdapter.java b/api/src/main/java/org/apache/tamaya/annotation/WithPropertyAdapter.java
new file mode 100644
index 0000000..4001742
--- /dev/null
+++ b/api/src/main/java/org/apache/tamaya/annotation/WithPropertyAdapter.java
@@ -0,0 +1,44 @@
+/*
+ * 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.annotation;
+
+import org.apache.tamaya.PropertyAdapter;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotation to define a type adapter to be used before injecting a configured value.
+ * This will override any other adapter for performing the type conversion before
+ * injecting the field value.
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.FIELD, ElementType.METHOD })
+public @interface WithPropertyAdapter {
+
+ /**
+ * Define a custom adapter that should be used to adapt the configuration entry injected. This overrides any
+ * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
+ * registered, it is handled as a deployment error.
+ */
+ Class extends PropertyAdapter> value();
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/ConfigChangeListener.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/ConfigChangeListener.java b/api/src/main/java/org/apache/tamaya/mapping/ConfigChangeListener.java
deleted file mode 100644
index 44bc55c..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/ConfigChangeListener.java
+++ /dev/null
@@ -1,37 +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.mapping;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to annotate a method on a class to be informed on config changes.
- * The exact behaviour, when configuration change events are sent can be configured
- * on each configured property/method by adding the {@link org.apache.tamaya.mapping.WithLoadPolicy}
- * annotation. By default listeners are only informed about changes that are affecting configured
- * values current the containing class/instance.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.METHOD })
-public @interface ConfigChangeListener {
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/ConfiguredProperties.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/ConfiguredProperties.java b/api/src/main/java/org/apache/tamaya/mapping/ConfiguredProperties.java
deleted file mode 100644
index 90346b1..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/ConfiguredProperties.java
+++ /dev/null
@@ -1,41 +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.mapping;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation container to enable injection current multiple {@link org.apache.tamaya.mapping.ConfiguredProperty}
- * annotations. Hereby the ordering current annotations imply the defaulting. The first value that
- * could be resolved successfully in the chain current annotations will be used.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD })
-public @interface ConfiguredProperties {
-
- /**
- * Get the different configuration keys to be looked up, in order current precedence. The first non null value
- * found will be used.
- */
- ConfiguredProperty[] value() default {};
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/ConfiguredProperty.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/ConfiguredProperty.java b/api/src/main/java/org/apache/tamaya/mapping/ConfiguredProperty.java
deleted file mode 100644
index 069210b..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/ConfiguredProperty.java
+++ /dev/null
@@ -1,79 +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.mapping;
-
-import java.lang.annotation.*;
-
-/**
- * Annotation to enable injection current a configured property or define the returned data for
- * a configuration template method. Hereby this annotation can be used in multiple ways and combined
- * with other annotations such as {@link org.apache.tamaya.mapping.DefaultValue},
- * {@link org.apache.tamaya.mapping.WithLoadPolicy}, {@link org.apache.tamaya.mapping.WithConfig},
- * {@link org.apache.tamaya.mapping.WithConfigOperator}, {@link org.apache.tamaya.mapping.WithPropertyAdapter}.
- *
- * Below the most simple variant current a configured class is given:
- * {@code
- * pubic class ConfiguredItem{
- *
- * @ConfiguredProperty
- * private String aValue;
- * }
- * When this class is configured, e.g. by passing it to {@link org.apache.tamaya.Configuration#configure(Object)},
- * the following is happening:
- *
- *
- *
- * In the next example we explicitly define the property value:
- * {@code
- * pubic class ConfiguredItem{
- *
- * @ConfiguredProperty
- * @ConfiguredProperty("a.b.value")
- * @configuredProperty("a.b.deprecated.value")
- * @DefaultValue("${env:java.version}")
- * private String aValue;
- * }
- *
- * Within this example we evaluate multiple possible keys. Evaluation is aborted if a key could be successfully
- * resolved. Hereby the ordering current the annotations define the ordering current resolution, so in the example above
- * resolution equals to {@code "aValue", "a.b.value", "a.b.deprecated.value"}. If no value could be read
- * fromMap the configuration, it uses the value fromMap the {@code DefaultValue} annotation. Interesting here
- * is that this value is not static, it is evaluated by calling
- * {@link org.apache.tamaya.Configuration#evaluateValue(org.apache.tamaya.Configuration, String)}.
- */
-@Repeatable(ConfiguredProperties.class)
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD })
-public @interface ConfiguredProperty {
-
- /**
- * Get the property names to be used. Hereby the first non null value evaluated is injected as property value.
- *
- * @return the property names, not null. If missing the field or method name being injected is used by default.
- */
- String value() default "";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/DefaultAreas.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/DefaultAreas.java b/api/src/main/java/org/apache/tamaya/mapping/DefaultAreas.java
deleted file mode 100644
index fa79941..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/DefaultAreas.java
+++ /dev/null
@@ -1,43 +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.mapping;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to control injection and resolution current a configured bean. The configuration keys
- * to be resolved are basically determined by the {@link org.apache.tamaya.mapping.ConfiguredProperty}
- * annotation(s). Nevertheless these annotations can also have relative key names. This annotation allows
- * to define a configuration area that is prefixed to all relative configuration keys within the
- * corresponding class/template interface.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE })
-public @interface DefaultAreas {
-
- /**
- * Allows to declare an operator that should be applied before injecting values into the bean.
- * @return the operator class to be used.
- */
- String[] value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/DefaultValue.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/DefaultValue.java b/api/src/main/java/org/apache/tamaya/mapping/DefaultValue.java
deleted file mode 100644
index aa923ae..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/DefaultValue.java
+++ /dev/null
@@ -1,41 +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.mapping;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define a default value to be returned, when no configured value could be
- * determined for a property/template accessor. The value hereby can also contain a
- * dynamic expression that is evaluated by the configuration system.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD })
-public @interface DefaultValue {
-
- /**
- * The default value to be injected, if no such configuration entry was found. If value was found and no default
- * is defined, it is handled as a deployment error.
- */
- String value() default "";
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/LoadPolicy.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/LoadPolicy.java b/api/src/main/java/org/apache/tamaya/mapping/LoadPolicy.java
deleted file mode 100644
index 71eb2ec..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/LoadPolicy.java
+++ /dev/null
@@ -1,48 +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.mapping;
-
-/**
- * Available policies that describe how changes affecting configured values are published/reinjected.
- * The policy also affects the cases were any configured listeners/listener methods are called for
- * propagation current configuration changes.
- */
-public enum LoadPolicy {
- /**
- * The configuration value is evaluated once, when the owning component is loaded/configured, but never updated later.
- */
- INITIAL,
- /**
- * The configuration value is evaluated exactly once on its first use lazily, but never updated later.
- * This feature is not applicable on field injection, but only on configuration template methods.
- */
- LAZY,
- /**
- * The configuration value is evaluated once, when the owning component is loaded/configured.
- * Later changes on this configuration entry will be reinjected/updated and additionally triggered
- * as {@link java.beans.PropertyChangeEvent}.
- */
- MANAGED,
- /**
- * The configuration value is evaluated once, when the owning component is loaded/configured.
- * Later changes on this configuration entry will be reinjected/updated, but no {@link java.beans.PropertyChangeEvent}
- * will be triggered.
- */
- SILENT
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/WithConfig.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/WithConfig.java b/api/src/main/java/org/apache/tamaya/mapping/WithConfig.java
deleted file mode 100644
index ce139df..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/WithConfig.java
+++ /dev/null
@@ -1,41 +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.mapping;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to reference an explicit {@link org.apache.tamaya.Configuration} to be used to
- * resolve the required properties. the configured value is passed to {@code Configuration.current(String)}
- * to evaluate the required configuration required.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.TYPE, ElementType.FIELD, ElementType.METHOD })
-public @interface WithConfig {
-
- /**
- * The name current the {@link org.apache.tamaya.Configuration} to be used to
- * resolve the required properties, not null or empty.
- */
- String value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/WithConfigOperator.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/WithConfigOperator.java b/api/src/main/java/org/apache/tamaya/mapping/WithConfigOperator.java
deleted file mode 100644
index b001780..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/WithConfigOperator.java
+++ /dev/null
@@ -1,44 +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.mapping;
-
-import org.apache.tamaya.ConfigOperator;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define an configuration operator to be used before accessing a configured value.
- * This allows filtering current configuration, e.g. for realizing views or ensuring security
- * constraints.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
-public @interface WithConfigOperator {
-
- /**
- * Define a custom adapter that should be used to adapt the configuration entry injected. This overrides any
- * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
- * registered, it is handled as a deployment error.
- */
- Class extends ConfigOperator> value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/WithLoadPolicy.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/WithLoadPolicy.java b/api/src/main/java/org/apache/tamaya/mapping/WithLoadPolicy.java
deleted file mode 100644
index f76a8ce..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/WithLoadPolicy.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.mapping;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define how config changes are handled for a type or per property/template method.
- * @see org.apache.tamaya.mapping.LoadPolicy
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD, ElementType.TYPE })
-public @interface WithLoadPolicy {
-
- LoadPolicy value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/mapping/WithPropertyAdapter.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/mapping/WithPropertyAdapter.java b/api/src/main/java/org/apache/tamaya/mapping/WithPropertyAdapter.java
deleted file mode 100644
index d5d0e5a..0000000
--- a/api/src/main/java/org/apache/tamaya/mapping/WithPropertyAdapter.java
+++ /dev/null
@@ -1,44 +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.mapping;
-
-import org.apache.tamaya.PropertyAdapter;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation to define a type adapter to be used before injecting a configured value.
- * This will override any other adapter for performing the type conversion before
- * injecting the field value.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target(value = { ElementType.FIELD, ElementType.METHOD })
-public @interface WithPropertyAdapter {
-
- /**
- * Define a custom adapter that should be used to adapt the configuration entry injected. This overrides any
- * general org.apache.tamaya.core.internal registered. If no adapter is defined (default) and no corresponding adapter is
- * registered, it is handled as a deployment error.
- */
- Class extends PropertyAdapter> value();
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/spi/PropertyAdaptersSingletonSpi.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertyAdaptersSingletonSpi.java b/api/src/main/java/org/apache/tamaya/spi/PropertyAdaptersSingletonSpi.java
index 72b7bd1..edc5ed9 100644
--- a/api/src/main/java/org/apache/tamaya/spi/PropertyAdaptersSingletonSpi.java
+++ b/api/src/main/java/org/apache/tamaya/spi/PropertyAdaptersSingletonSpi.java
@@ -19,7 +19,7 @@
package org.apache.tamaya.spi;
import org.apache.tamaya.PropertyAdapter;
-import org.apache.tamaya.mapping.WithPropertyAdapter;
+import org.apache.tamaya.annotation.WithPropertyAdapter;
/**
* SPI that is used by the {@link org.apache.tamaya.PropertyAdapters} singleton as delegation instance.
http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/api/src/main/java/org/apache/tamaya/spi/PropertyProviderBuilderSpi.java
----------------------------------------------------------------------
diff --git a/api/src/main/java/org/apache/tamaya/spi/PropertyProviderBuilderSpi.java b/api/src/main/java/org/apache/tamaya/spi/PropertyProviderBuilderSpi.java
index 4c1a844..a64a1c9 100644
--- a/api/src/main/java/org/apache/tamaya/spi/PropertyProviderBuilderSpi.java
+++ b/api/src/main/java/org/apache/tamaya/spi/PropertyProviderBuilderSpi.java
@@ -110,7 +110,7 @@ public interface PropertyProviderBuilderSpi {
/**
* Creates a new {@link org.apache.tamaya.PropertyProvider} containing all property maps given, hereby using the given AggregationPolicy.
*
- * @param policy the mapping to be used, not null.
+ * @param policy the annotation to be used, not null.
* @param propertyMaps the maps to be included, not null.
* @return the aggregated instance containing all given maps.
*/
@@ -194,4 +194,13 @@ public interface PropertyProviderBuilderSpi {
* @return the new delegating instance.
*/
PropertyProvider replacing(MetaInfo metaInfo, PropertyProvider mainMap, Map
- * Level mapping inspired by {@link org.slf4j.bridge.SLF4JBridgeHandler}: + * Level annotation inspired by {@link org.slf4j.bridge.SLF4JBridgeHandler}: *
* *http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/5c36d32d/core/src/main/java/org/apache/tamaya/core/internal/properties/BuildablePropertyProvider.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/tamaya/core/internal/properties/BuildablePropertyProvider.java b/core/src/main/java/org/apache/tamaya/core/internal/properties/BuildablePropertyProvider.java new file mode 100644 index 0000000..6a35545 --- /dev/null +++ b/core/src/main/java/org/apache/tamaya/core/internal/properties/BuildablePropertyProvider.java @@ -0,0 +1,48 @@ +package org.apache.tamaya.core.internal.properties; + +import org.apache.tamaya.MetaInfo; +import org.apache.tamaya.PropertyProvider; + +import java.util.Map; +import java.util.Objects; +import java.util.Optional; + +/** + * Created by Anatole on 07.12.2014. + */ +class BuildablePropertyProvider implements PropertyProvider { + + private MetaInfo metaInfo; + private PropertyProvider baseProvider; + + public BuildablePropertyProvider(MetaInfo metaInfo, PropertyProvider baseProvider) { + this.metaInfo = Objects.requireNonNull(metaInfo); + this.baseProvider = Objects.requireNonNull(baseProvider); + } + + @Override + public Optionalget(String key) { + return this.baseProvider.get(key); + } + + @Override + public boolean containsKey(String key) { + return this.baseProvider.containsKey(key); + } + + @Override + public Map toMap() { + return this.baseProvider.toMap(); + } + + @Override + public MetaInfo getMetaInfo() { + return this.metaInfo; + } + + @Override + public String toString(){ + return "BuildablePropertyProvider -> " + getMetaInfo().toString(); + } + +}