Repository: incubator-tamaya-sandbox
Updated Branches:
  refs/heads/master 26038c433 -> ca485b2e7


TAMAYA-195: Updated docs.


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

Branch: refs/heads/master
Commit: ca485b2e770bd5c119cbdc3aff1520fe6ec79e2e
Parents: 52c572e
Author: anatole <anat...@apache.org>
Authored: Sun Feb 26 23:15:45 2017 +0100
Committer: anatole <anat...@apache.org>
Committed: Mon Feb 27 00:05:00 2017 +0100

----------------------------------------------------------------------
 .../hazelcast/HazelcastPropertySource.java      | 63 ++++++++++++++++++--
 1 file changed, 59 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/ca485b2e/hazelcast/src/main/java/org/apache/tamaya/hazelcast/HazelcastPropertySource.java
----------------------------------------------------------------------
diff --git 
a/hazelcast/src/main/java/org/apache/tamaya/hazelcast/HazelcastPropertySource.java
 
b/hazelcast/src/main/java/org/apache/tamaya/hazelcast/HazelcastPropertySource.java
index bce24fa..20d23f2 100644
--- 
a/hazelcast/src/main/java/org/apache/tamaya/hazelcast/HazelcastPropertySource.java
+++ 
b/hazelcast/src/main/java/org/apache/tamaya/hazelcast/HazelcastPropertySource.java
@@ -56,53 +56,108 @@ import java.util.logging.Logger;
  */
 public class HazelcastPropertySource extends BasePropertySource
 implements MutablePropertySource{
-
+    /** The logger. */
     private static final Logger LOG = 
Logger.getLogger(HazelcastPropertySource.class.getName());
+    /** The Hazelcast config map used. */
     private Map<String, String> configMap = new HashMap<>();
+    /** The hazelcast API instance. */
     private HazelcastInstance hazelcastInstance;
+    /** The hazelcast map reference ID used, by default {@code 
tamaya.configuration}. */
     private String mapReference = "tamaya.configuration";
+    /** Flag if this property source is read-only. */
     private boolean readOnly = false;
 
+    /**
+     * Creates a new instance, hereby using {@code "Hazelcast"} as property 
source name and
+     * a default hazelcast backend created by calling {@link 
Hazelcast#newHazelcastInstance()}.
+     */
     public HazelcastPropertySource(){
         super("Hazelcast");
         this.hazelcastInstance = Hazelcast.newHazelcastInstance();
     }
 
+    /**
+     * Creates a new instance, hereby using {@code "Hazelcast"} as property 
source name and the
+     * given hazelcast instance.
+     * @param hazelcastInstance the hazelcast instance, not null.
+     */
     public HazelcastPropertySource(HazelcastInstance hazelcastInstance){
         this("Hazelcast", hazelcastInstance);
     }
 
+    /**
+     * Creates a new instance, hereby using the given property source name and
+     * a default hazelcast backend created by calling {@link 
Hazelcast#newHazelcastInstance()}.
+     * @param name the property source name, not null.
+     */
     public HazelcastPropertySource(String name){
         super(name);
         this.hazelcastInstance = Hazelcast.newHazelcastInstance();
     }
 
+    /**
+     * Creates a new instance, hereby using the given property source name and
+     * a creating a new hazelcast backend using the given Hazelcast {@link 
Config}.
+     * @param config the hazelcast config, not null.
+     * @param name the property source name, not null.
+     */
     public HazelcastPropertySource(String name, Config config){
         super(name);
         this.hazelcastInstance = Hazelcast.newHazelcastInstance(config);
     }
 
+    /**
+     * Creates a new instance, hereby using the given property source name and 
the
+     * hazelcast instance.
+     * @param name
+     * @param hazelcastInstance
+     */
     public HazelcastPropertySource(String name, HazelcastInstance 
hazelcastInstance){
         super(name);
         this.hazelcastInstance = Objects.requireNonNull(hazelcastInstance);
     }
 
+    /**
+     * Setting the read-only flag for this instance.
+     * @param readOnly if true, the property source will not write back any 
changes to the
+     *                 hazelcast backend.
+     */
     public void setReadOnly(boolean readOnly){
         this.readOnly = readOnly;
     }
 
+    /**
+     * Flag to check if the property source is read-only.
+     * @return true, if the instance is read-only.
+     */
     public boolean isReadOnly(){
         return readOnly;
     }
 
+    /**
+     * Set the Hazelcast reference name for the Tamaya configuration Map.
+     * @param mapReference the map reference to be used, not null.
+     */
     public void setMapReference(String mapReference){
         this.mapReference = Objects.requireNonNull(mapReference);
     }
 
+    /**
+     * Get the Hazelcast reference name for the Tamaya configuration Map.
+     * @return the Hazelcast reference name for the Tamaya configuration Map, 
never null.
+     */
     public String getMapReference(){
         return mapReference;
     }
 
+    /**
+     * Get access to the hazelcast instance used.
+     * @return the hazelcast instance, not null.
+     */
+    public HazelcastInstance getHazelcastInstance() {
+        return hazelcastInstance;
+    }
+
     @Override
     public PropertyValue get(String key) {
         Config hcConfig = hazelcastInstance.getConfig();
@@ -127,6 +182,9 @@ implements MutablePropertySource{
         return true;
     }
 
+    /**
+     * Reloads the configuration map from Hazelcast completely.
+     */
     public void refresh() {
         IMap<String,String> config = hazelcastInstance.getMap(mapReference);
         Map<String, String> configMap = new HashMap<>(config);
@@ -175,7 +233,4 @@ implements MutablePropertySource{
                 "\n}";
     }
 
-    public HazelcastInstance getHazelcastInstance() {
-        return hazelcastInstance;
-    }
 }

Reply via email to