de.smartics.properties.spi.config.definition
Class PropertiesDefinitionContext

Package class diagram package PropertiesDefinitionContext
java.lang.Object
  extended by de.smartics.properties.spi.config.definition.PropertiesDefinitionContext
All Implemented Interfaces:
Serializable

@ThreadSafe
public final class PropertiesDefinitionContext
     
     
extends Object
implements Serializable

Contains information from the definition.xml that is contained in archives providing property information.

See Also:
Serialized Form

Field Summary
static Set<String> DEFAULT_TLDS
          The default top level domains to identify groups.
 
Constructor Summary
PropertiesDefinitionContext()
          Convenience constructor using the default TLDs and not registering any environments, nodes or groups.
PropertiesDefinitionContext(Set<String> environments, Set<String> nodes, Set<String> groups)
          Convenience constructor using the default TLDs and no explicit files.
PropertiesDefinitionContext(Set<String> environments, Set<String> nodes, Set<String> groups, Map<String,ConfigurationKey> files)
          Convenience constructor using the default TLDs.
PropertiesDefinitionContext(Set<String> tlds, Set<String> environments, Set<String> nodes, Set<String> groups)
          Convenience constructor without an explicit path to configuration key mapping.
PropertiesDefinitionContext(Set<String> tlds, Set<String> environments, Set<String> nodes, Set<String> groups, Map<String,ConfigurationKey> files)
          Default constructor.
 
Method Summary
 ConfigurationKey getKey(String path)
          Returns the configuration key associated with the given path.
 boolean isGroup(String token)
          Checks if the given token is a group.
 boolean isRegisteredEnvironment(String token)
          Checks if the given token is a registered environment.
 boolean isRegisteredGroup(String token)
          Checks if the given token is a registered group.
 boolean isRegisteredGroupTld(String token)
          Checks if the given string is a registered top level domain (tld) or contains only two letters.
 boolean isRegisteredNode(String token)
          Checks if the given token is a registered node.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_TLDS

public static final Set<String> DEFAULT_TLDS
The default top level domains to identify groups.
  1. biz
  2. com
  3. edu
  4. gov
  5. info
  6. net
  7. org

Constructor Detail

PropertiesDefinitionContext

public PropertiesDefinitionContext()
Convenience constructor using the default TLDs and not registering any environments, nodes or groups.


PropertiesDefinitionContext

public PropertiesDefinitionContext(Set<String> environments,
                                   Set<String> nodes,
                                   Set<String> groups)
Convenience constructor using the default TLDs and no explicit files.

Parameters:
environments - the collection of registered environment names.
nodes - the collection of registered node names.
groups - the collection of registered group names.

PropertiesDefinitionContext

public PropertiesDefinitionContext(Set<String> tlds,
                                   Set<String> environments,
                                   Set<String> nodes,
                                   Set<String> groups)
Convenience constructor without an explicit path to configuration key mapping.

Parameters:
tlds - the collection of top-level-domains (tlds).
environments - the collection of registered environment names.
nodes - the collection of registered node names.
groups - the collection of registered group names.

PropertiesDefinitionContext

public PropertiesDefinitionContext(Set<String> environments,
                                   Set<String> nodes,
                                   Set<String> groups,
                                   Map<String,ConfigurationKey> files)
Convenience constructor using the default TLDs.

Parameters:
environments - the collection of registered environment names.
nodes - the collection of registered node names.
groups - the collection of registered group names.
files - the mapping of properties file path names to a associated configuration key.

PropertiesDefinitionContext

public PropertiesDefinitionContext(Set<String> tlds,
                                   Set<String> environments,
                                   Set<String> nodes,
                                   Set<String> groups,
                                   Map<String,ConfigurationKey> files)
Default constructor.

Parameters:
tlds - the collection of top-level-domains (tlds).
environments - the collection of registered environment names.
nodes - the collection of registered node names.
groups - the collection of registered group names.
files - the mapping of properties file path names to a associated configuration key.
Method Detail

isRegisteredGroupTld

public boolean isRegisteredGroupTld(String token)
Checks if the given string is a registered top level domain (tld) or contains only two letters.

Parameters:
token - the token to check.
Returns:
true if the token is not null, is registered or contains exactly two letters, false otherwise.

isRegisteredEnvironment

public boolean isRegisteredEnvironment(String token)
Checks if the given token is a registered environment.

Parameters:
token - the token to check.
Returns:
true if the token is a registered environment, false otherwise.

isRegisteredNode

public boolean isRegisteredNode(String token)
Checks if the given token is a registered node.

Parameters:
token - the token to check.
Returns:
true if the token is a registered node, false otherwise.

isRegisteredGroup

public boolean isRegisteredGroup(String token)
Checks if the given token is a registered group.

Parameters:
token - the token to check.
Returns:
true if the token is a registered group, false otherwise.

getKey

@CheckForNull
public ConfigurationKey getKey(String path)
Returns the configuration key associated with the given path.

Parameters:
path - the path to fetch its configuration key. Note that a null value is allowed.
Returns:
the configuration key for the given path or null if no key is associated with it.

isGroup

public boolean isGroup(String token)
Checks if the given token is a group. It is a group if it is either registered explicitly or the token starts with a registered TLD or it starts with two letters and a dot.

Parameters:
token - the token to check.
Returns:
true if the token is a group, false otherwise.

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.