de.smartics.properties.api.core.domain
Class PropertiesContext

Package class diagram package PropertiesContext
java.lang.Object
  extended by de.smartics.properties.api.core.domain.PropertiesContext
All Implemented Interfaces:
Serializable

@ThreadSafe
public final class PropertiesContext
     
     
extends Object
implements Serializable

Defines the configuration for smartics properties configuration.

A context provides information for all its properties. Not all properties of an application may refer to the same context.

Implementation Notes:
For testing purposes please refer to help.de.smartics.properties.core.PropertiesContextBuilder.
See Also:
Serialized Form

Nested Class Summary
static class PropertiesContext.Builder
          The builder of PropertiesContext.
 
Field Summary
static String BOOT_PROPERTIES_HOME
          The path to the folder within "META-INF/smartics-properties" where boot properties resources are located.
static String DECLARATION_FILE
          The default location of the properties declaration configuration file.
static String DECLARATION_FILE_NAME
          The name of the properties configuration file that provides information for declarations.
static String DEFINITION_FILE
          The default location of the properties definition configuration file.
static String DEFINITION_FILE_NAME
          The name of the properties configuration file that provides information for definitions.
static String META_INF_HOME
          The path to the folder within META-INF where properties resources are located.
static String META_INF_PROPERTY_SET_REPORT
          The location of the property set reports within the META-INF folder.
 
Method Summary
static PropertiesContext createEmptyContext()
          Creates an empty context.
 String createMetaInfPath(PropertyDescriptor descriptor)
          Returns the URL to the XML report in the META-INF directory of the given descriptor.
 String createMetaInfPath(PropertyDescriptor descriptor, Locale locale)
          Returns the URL to the XML report in the META-INF directory of the given descriptor.
 String createMetaInfPathPropertySet(PropertyDescriptor descriptor)
          Returns the URL to the property set XML report in the META-INF directory of the given descriptor.
 String createMetaInfPathPropertySet(PropertyDescriptor descriptor, Locale locale)
          Returns the URL to the property set XML report in the META-INF directory of the given descriptor.
 String createReportUrl(PropertyDescriptor descriptor)
          Returns the URL to the report documentation for the given descriptor.
 String createReportUrl(String target)
          Returns the URL to the relative target.
 String getHomePageUrl()
          Returns the URL to the home page of the project.
 List<Locale> getLocales()
          Returns the list of supported locales.
 String getPropertiesReportIndexUrl()
          Returns the URL to the index document of smartics properties reports.
 String getPropertiesReportUrl()
          Returns the URL to the root directory of smartics properties reports.
 boolean hasAliases()
          Checks whether any aliases are registered.
 String resolve(String alias)
          Resolves the alias to the target it points to.
 String toString()
          Returns the string representation of the object.
 void traverseAliases(AliasTraverser traverser)
          Traverses the registered aliases.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

META_INF_HOME

public static final String META_INF_HOME
The path to the folder within META-INF where properties resources are located.

The value of this constant is "META-INF/smartics-properties".

Constant Field Value:
"META-INF/smartics-properties"

BOOT_PROPERTIES_HOME

public static final String BOOT_PROPERTIES_HOME
The path to the folder within "META-INF/smartics-properties" where boot properties resources are located.

The value of this constant is "META-INF/smartics-properties/boot".

Constant Field Value:
"META-INF/smartics-properties/boot"

DECLARATION_FILE_NAME

public static final String DECLARATION_FILE_NAME
The name of the properties configuration file that provides information for declarations. This file provides information in archives that provide property meta data (descriptors).

The value of this constant is "declaration.xml".

Constant Field Value:
"declaration.xml"

DEFINITION_FILE_NAME

public static final String DEFINITION_FILE_NAME
The name of the properties configuration file that provides information for definitions. This file provides information in archives that provide property values.

The value of this constant is "definition.xml".

Constant Field Value:
"definition.xml"

DECLARATION_FILE

public static final String DECLARATION_FILE
The default location of the properties declaration configuration file.

The value of this constant is "META-INF/smartics-properties/declaration.xml".

Constant Field Value:
"META-INF/smartics-properties/declaration.xml"

DEFINITION_FILE

public static final String DEFINITION_FILE
The default location of the properties definition configuration file.

The value of this constant is "META-INF/smartics-properties/definition.xml".

Constant Field Value:
"META-INF/smartics-properties/definition.xml"

META_INF_PROPERTY_SET_REPORT

public static final String META_INF_PROPERTY_SET_REPORT
The location of the property set reports within the META-INF folder.

The value of this constant is "META-INF/smartics-properties/property-set-report/".

Constant Field Value:
"META-INF/smartics-properties/property-set-report/"
Method Detail

createEmptyContext

public static PropertiesContext createEmptyContext()
Creates an empty context.

Returns:
an empty context.

getHomePageUrl

@CheckForNull
public String getHomePageUrl()
Returns the URL to the home page of the project.

Returns:
the URL to the home page of the project. May be null.

getPropertiesReportUrl

@CheckForNull
public String getPropertiesReportUrl()
Returns the URL to the root directory of smartics properties reports.

Returns:
the URL to the root directory of smartics properties reports. May be null.

getPropertiesReportIndexUrl

@CheckForNull
public String getPropertiesReportIndexUrl()
Returns the URL to the index document of smartics properties reports.

Returns:
the URL to the index document of smartics properties reports. May be null.

getLocales

public List<Locale> getLocales()
Returns the list of supported locales. The list contains locales the context provides localized information for.

Returns:
the list of supported locales.

createReportUrl

public String createReportUrl(String target)
                       throws IllegalArgumentException
Returns the URL to the relative target.

Parameters:
target - the relative URL.
Returns:
the absolute URL to the report or null if no root URL is provided by the context.
Throws:
IllegalArgumentException - of target is blank.

createReportUrl

public String createReportUrl(PropertyDescriptor descriptor)
Returns the URL to the report documentation for the given descriptor.

Parameters:
descriptor - the properties descriptor whose report documentation URL is requested.
Returns:
the absolute URL to the report.

createMetaInfPath

public String createMetaInfPath(PropertyDescriptor descriptor)
Returns the URL to the XML report in the META-INF directory of the given descriptor.

Parameters:
descriptor - the properties descriptor whose XML report URL is requested.
Returns:
the class loader root rooted path.

createMetaInfPath

public String createMetaInfPath(PropertyDescriptor descriptor,
                                Locale locale)
Returns the URL to the XML report in the META-INF directory of the given descriptor.

Parameters:
descriptor - the properties descriptor whose XML report URL is requested.
locale - the locale to determine the comments.
Returns:
the class loader root rooted path.

createMetaInfPathPropertySet

public String createMetaInfPathPropertySet(PropertyDescriptor descriptor)
Returns the URL to the property set XML report in the META-INF directory of the given descriptor.

Parameters:
descriptor - the properties descriptor whose property set XML report URL is requested.
Returns:
the class loader root rooted path.

createMetaInfPathPropertySet

public String createMetaInfPathPropertySet(PropertyDescriptor descriptor,
                                           Locale locale)
Returns the URL to the property set XML report in the META-INF directory of the given descriptor.

Parameters:
descriptor - the properties descriptor whose property set XML report URL is requested.
locale - the locale to determine the comments.
Returns:
the class loader root rooted path.

resolve

public String resolve(String alias)
               throws de.smartics.util.lang.BlankArgumentException,
                      UnknownAliasException
Resolves the alias to the target it points to.

Parameters:
alias - the alias whose physical resource is requested.
Returns:
the target the alias points to.
Throws:
de.smartics.util.lang.BlankArgumentException - if alias is blank.
UnknownAliasException - if the alias is not known.

traverseAliases

public void traverseAliases(AliasTraverser traverser)
                     throws NullPointerException
Traverses the registered aliases.

Parameters:
traverser - the traverser to use.
Throws:
NullPointerException - if traverser is null.

hasAliases

public boolean hasAliases()
Checks whether any aliases are registered.

Returns:
true if at least one alias is registered, false otherwise.

toString

public String toString()
Returns the string representation of the object.

Overrides:
toString in class Object
Returns:
the string representation of the object.


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