de.smartics.properties.impl.config.domain.key.envapp
Class AbstractPropertiesDefinitionContext

Package class diagram package AbstractPropertiesDefinitionContext
java.lang.Object
  extended by de.smartics.properties.impl.config.domain.key.envapp.AbstractPropertiesDefinitionContext
All Implemented Interfaces:
PropertiesDefinitionContext, Serializable
Direct Known Subclasses:
EnvAppPropertiesDefinitionContext, TenantUserPropertiesDefinitionContext

@ThreadSafe
public abstract class AbstractPropertiesDefinitionContext
     
     
extends Object
implements PropertiesDefinitionContext

Contains information from the definition.xml that is contained in archives providing property information, based on environment and application.

See Also:
Serialized Form

Field Summary
static Set<String> DEFAULT_TLDS
          The default top level domains to identify groups.
 
Constructor Summary
AbstractPropertiesDefinitionContext()
          Convenience constructor using the default TLDs and not registering any environments, nodes or groups.
AbstractPropertiesDefinitionContext(Set<String> environments, Set<String> nodes, Set<String> groups)
          Convenience constructor using the default TLDs and no explicit files.
AbstractPropertiesDefinitionContext(Set<String> environments, Set<String> nodes, Set<String> groups, PropertyResourceMatchers matchers)
          Convenience constructor using the default TLDs.
AbstractPropertiesDefinitionContext(Set<String> tlds, Set<String> environments, Set<String> nodes, Set<String> groups)
          Convenience constructor without an explicit path to configuration key mapping.
AbstractPropertiesDefinitionContext(Set<String> tlds, Set<String> environments, Set<String> nodes, Set<String> groups, PropertyResourceMatchers matchers)
          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

AbstractPropertiesDefinitionContext

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


AbstractPropertiesDefinitionContext

public AbstractPropertiesDefinitionContext(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.

AbstractPropertiesDefinitionContext

public AbstractPropertiesDefinitionContext(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.

AbstractPropertiesDefinitionContext

public AbstractPropertiesDefinitionContext(Set<String> environments,
                                           Set<String> nodes,
                                           Set<String> groups,
                                           PropertyResourceMatchers matchers)
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.
matchers - the matcher of properties file path names to a associated configuration key.

AbstractPropertiesDefinitionContext

public AbstractPropertiesDefinitionContext(Set<String> tlds,
                                           Set<String> environments,
                                           Set<String> nodes,
                                           Set<String> groups,
                                           PropertyResourceMatchers matchers)
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.
matchers - the matcher of properties file path names to a associated configuration key.
Method Detail

isRegisteredGroupTld

public final 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 final 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 final 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 final 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 final ConfigurationKey<?> getKey(String path)
Returns the configuration key associated with the given path.

Specified by:
getKey in interface PropertiesDefinitionContext
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 final 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.