Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 95885781e -> ced3463f9


Added additional Javadocs (need still more).


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

Branch: refs/heads/master
Commit: ced3463f935aaa21048678b88746b755d156d04f
Parents: 9588578
Author: anatole <anat...@apache.org>
Authored: Sat Jan 3 13:24:34 2015 +0100
Committer: anatole <anat...@apache.org>
Committed: Sat Jan 3 13:24:34 2015 +0100

----------------------------------------------------------------------
 .../core/PathBasedPropertySourceProvider.java   | 20 +++++++--
 .../core/ResourcePropertySourceProvider.java    |  4 ++
 .../tamaya/core/formats/PropertiesFormat.java   |  8 +++-
 .../core/formats/PropertiesXmlFormat.java       | 11 ++++-
 .../internal/DefaultConfigurationContext.java   | 44 ++++++++++++++++----
 .../core/internal/PropertyConverterManager.java | 11 +++--
 6 files changed, 79 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ced3463f/core/src/main/java/org/apache/tamaya/core/PathBasedPropertySourceProvider.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/tamaya/core/PathBasedPropertySourceProvider.java
 
b/core/src/main/java/org/apache/tamaya/core/PathBasedPropertySourceProvider.java
index 53d6760..fc04c3b 100644
--- 
a/core/src/main/java/org/apache/tamaya/core/PathBasedPropertySourceProvider.java
+++ 
b/core/src/main/java/org/apache/tamaya/core/PathBasedPropertySourceProvider.java
@@ -32,23 +32,37 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
- * Implementation of a PropertySourceProvider that reads configuration from 
some given resource paths
- * and using the goven formats.
+ * Implementation of a {@link PropertySourceProvider} that reads configuration 
from some given resource paths
+ * and using the given formats.
  */
 public class PathBasedPropertySourceProvider implements PropertySourceProvider 
{
-
+    /** The lohgger. */
     private static final Logger LOG = 
Logger.getLogger(PathBasedPropertySourceProvider.class.getName());
 
     private String baseName;
+    /** The config formats tried. */
     private List<ConfigurationFormat> configFormats = new ArrayList<>();
+    /** The paths tpo be evaluated. */
     private List<String> paths = new ArrayList<>();
 
+    /**
+     * Creates a new instance.
+     * @param baseName the base name of the configuration, used for creating 
PropertySource child names.
+     * @param formats the formats to be used, not null, not empty.
+     * @param paths the paths to be resolved, not null, not empty.
+     */
     public PathBasedPropertySourceProvider(String baseName, 
List<ConfigurationFormat> formats, String... paths) {
         this.baseName = Objects.requireNonNull(baseName);
         this.configFormats.addAll(Objects.requireNonNull(formats));
         this.paths.addAll(Arrays.asList(Objects.requireNonNull(paths)));
     }
 
+    /**
+     * Creates a new instance.
+     * @param baseName the base name of the configuration, used for creating 
PropertySource child names.
+     * @param format the format to be used.
+     * @param paths the paths to be resolved, not null, not empty.
+     */
     public PathBasedPropertySourceProvider(String baseName, 
ConfigurationFormat format, String... paths) {
         this.baseName = Objects.requireNonNull(baseName);
         this.configFormats.add(Objects.requireNonNull(format));

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ced3463f/core/src/main/java/org/apache/tamaya/core/ResourcePropertySourceProvider.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/tamaya/core/ResourcePropertySourceProvider.java 
b/core/src/main/java/org/apache/tamaya/core/ResourcePropertySourceProvider.java
index 978ab9a..48e9790 100644
--- 
a/core/src/main/java/org/apache/tamaya/core/ResourcePropertySourceProvider.java
+++ 
b/core/src/main/java/org/apache/tamaya/core/ResourcePropertySourceProvider.java
@@ -30,6 +30,10 @@ import java.util.List;
 import java.util.Objects;
 import java.util.logging.Logger;
 
+/**
+ * Implementation of a {@link org.apache.tamaya.spi.PropertySourceProvider} 
that is based on a single resource
+ * and a number of formats.
+ */
 public class ResourcePropertySourceProvider implements PropertySourceProvider {
 
     private static final Logger LOG = 
Logger.getLogger(ResourcePropertySourceProvider.class.getName());

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ced3463f/core/src/main/java/org/apache/tamaya/core/formats/PropertiesFormat.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/tamaya/core/formats/PropertiesFormat.java 
b/core/src/main/java/org/apache/tamaya/core/formats/PropertiesFormat.java
index 6ca4f3d..4a06b3c 100644
--- a/core/src/main/java/org/apache/tamaya/core/formats/PropertiesFormat.java
+++ b/core/src/main/java/org/apache/tamaya/core/formats/PropertiesFormat.java
@@ -33,10 +33,14 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 /**
- * Implementation of a configuration format for -properties files.
+ * Implementation of a {@link 
org.apache.tamaya.core.formats.ConfigurationFormat} for -properties files.
+ *
+ * @see java.util.Properties#load(java.io.InputStream)
  */
 public class PropertiesFormat implements ConfigurationFormat {
-
+    /**
+     * The logger.
+     */
     private final static Logger LOG = 
Logger.getLogger(PropertiesFormat.class.getName());
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ced3463f/core/src/main/java/org/apache/tamaya/core/formats/PropertiesXmlFormat.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/tamaya/core/formats/PropertiesXmlFormat.java 
b/core/src/main/java/org/apache/tamaya/core/formats/PropertiesXmlFormat.java
index 98e26f3..81fcd73 100644
--- a/core/src/main/java/org/apache/tamaya/core/formats/PropertiesXmlFormat.java
+++ b/core/src/main/java/org/apache/tamaya/core/formats/PropertiesXmlFormat.java
@@ -32,9 +32,16 @@ import java.util.Properties;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-
+/**
+ * Implementation of a {@link 
org.apache.tamaya.core.formats.ConfigurationFormat} for xml property
+ * files.
+ *
+ * @see java.util.Properties#loadFromXML(java.io.InputStream)
+ */
 public class PropertiesXmlFormat implements ConfigurationFormat {
-
+    /**
+     * The logger.
+     */
     private final static Logger LOG = 
Logger.getLogger(PropertiesXmlFormat.class.getName());
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ced3463f/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
 
b/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
index 08e55a7..995f2dd 100644
--- 
a/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
+++ 
b/core/src/main/java/org/apache/tamaya/core/internal/DefaultConfigurationContext.java
@@ -33,20 +33,40 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.StampedLock;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
  * Default Implementation of a simple ConfigurationContext.
  */
 public class DefaultConfigurationContext implements ConfigurationContext {
-
+    /** The logger. */
+    private static final Logger LOG = 
Logger.getLogger(DefaultConfigurationContext.class.getName());
+    /**
+     * Cubcomponent handling {@link org.apache.tamaya.spi.PropertyConverter} 
instances.
+     */
     private PropertyConverterManager propertyConverterManager = new 
PropertyConverterManager();
-
+    /**
+     * The current list of loaded {@link org.apache.tamaya.spi.PropertySource} 
instances.
+     */
     private List<PropertySource> propertySources = new ArrayList<>();
+    /**
+     * The current list of loaded {@link 
org.apache.tamaya.spi.PropertySourceProvider} instances.
+     */
     private List<PropertySourceProvider> propertySourceProviders = new 
ArrayList<>();
+    /**
+     * The current list of loaded {@link org.apache.tamaya.spi.PropertyFilter} 
instances.
+     */
     private List<PropertyFilter> propertyFilters = new ArrayList<>();
-    private boolean loaded = false;
-
+    /**
+     * Lock for internal synchronization.
+     */
     private StampedLock propertySourceLock = new StampedLock();
+    /**
+     * Loaded flag.
+     * TODO replace flag with check on sources load size.
+     */
+    private boolean loaded = false;
 
 
     @Override
@@ -66,9 +86,9 @@ public class DefaultConfigurationContext implements 
ConfigurationContext {
     /**
      * Order property source reversely, the most important come first.
      *
-     * @param source1
-     * @param source2
-     * @return
+     * @param source1 the first PropertySource
+     * @param source2 the second PropertySource
+     * @return the comparison result.
      */
     private int comparePropertySources(PropertySource source1, PropertySource 
source2) {
         if (source1.getOrdinal() < source2.getOrdinal()) {
@@ -80,6 +100,13 @@ public class DefaultConfigurationContext implements 
ConfigurationContext {
         }
     }
 
+    /**
+     * Compare 2 filters for ordering the filter chain.
+     *
+     * @param filter1 the first filter
+     * @param filter2 the second filter
+     * @return the comparison result
+     */
     private int comparePropertyFilters(PropertyFilter filter1, PropertyFilter 
filter2) {
         Priority prio1 = filter1.getClass().getAnnotation(Priority.class);
         Priority prio2 = filter2.getClass().getAnnotation(Priority.class);
@@ -107,13 +134,12 @@ public class DefaultConfigurationContext implements 
ConfigurationContext {
                         try {
                             
this.propertySources.addAll(prov.getPropertySources());
                         } catch (Exception e) {
-                            //X TODO Log!
+                            LOG.log(Level.SEVERE, "Failed to load 
PropertySources from Provider: " + prov, e);
                         }
                     }
                     Collections.sort(this.propertySources, 
this::comparePropertySources);
                     
this.propertyFilters.addAll(ServiceContext.getInstance().getServices(PropertyFilter.class));
                     Collections.sort(this.propertyFilters, 
this::comparePropertyFilters);
-                    loaded = true;
                 }
             } finally {
                 writeLock.unlock();

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/ced3463f/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
----------------------------------------------------------------------
diff --git 
a/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
 
b/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
index 4f8118b..88e68e3 100644
--- 
a/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
+++ 
b/core/src/main/java/org/apache/tamaya/core/internal/PropertyConverterManager.java
@@ -36,16 +36,21 @@ import java.util.Objects;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.StampedLock;
+import java.util.logging.Logger;
 
 import org.apache.tamaya.ConfigException;
 import org.apache.tamaya.spi.PropertyConverter;
 
 /**
  * Manager that deals with {@link org.apache.tamaya.spi.PropertyConverter} 
instances.
+ * This class is thread-safe.
  */
 public class PropertyConverterManager {
-
+    /** The logger used. */
+    private static final Logger LOG = 
Logger.getLogger(PropertyConverterManager.class.getName());
+    /** The registered converters. */
     private Map<Class<?>, List<PropertyConverter<?>>> converters = new 
ConcurrentHashMap<>();
+    /** The lock used. */
     private StampedLock lock = new StampedLock();
 
     /**
@@ -210,7 +215,7 @@ public class PropertyConverterManager {
                     }
                 };
             } catch (Exception e) {
-                //X ignore, TODO log finest
+                LOG.finest(() -> "Failed to construct instance of type: " + 
targetType.getName()+": " + e);
             }
         }
         return converter;
@@ -230,7 +235,7 @@ public class PropertyConverterManager {
                 m = type.getDeclaredMethod(name, String.class);
                 return m;
             } catch (Exception e) {
-                //X ignore, TODO log finest
+                LOG.finest(() -> "No such factory method found on type: " + 
type.getName()+", methodName: " + name);
             }
         }
         return null;

Reply via email to