com.seventytwomiles.architecturerules.configuration
Class AbstractConfigurationFactory

java.lang.Object
  extended by com.seventytwomiles.architecturerules.configuration.AbstractConfigurationFactory
All Implemented Interfaces:
ConfigurationFactory
Direct Known Subclasses:
DigesterConfigurationFactory

public abstract class AbstractConfigurationFactory
extends Object
implements ConfigurationFactory

Abstract Factory that provides common functionality for ConfigurationFactory implementations.

Author:
mikenereson
See Also:
ConfigurationFactory

Field Summary
protected  boolean doCyclicDependencyTest
          Weather or not to check for cyclic dependencies.
protected  Collection<Rule> rules
          Set of Rules read from the configuration file
protected  List<SourceDirectory> sources
          Set of Source read from configuration file
protected  boolean throwExceptionWhenNoPackages
          Weather or not to throw exception when no packages are found for a given path.
 
Fields inherited from interface com.seventytwomiles.architecturerules.configuration.ConfigurationFactory
DEFAULT_CONFIGURATION_FILE_NAME, DEFAULT_CYCLICAL_DEPENDENCY_CONFIGURATION_VALUE, DEFAULT_NO_PACKAGES_CONFIGURATION_BOOLEAN_VALUE
 
Constructor Summary
AbstractConfigurationFactory()
           
 
Method Summary
 boolean doCyclicDependencyTest()
          Holds the value parsed from the XML configuration that indicates weather or not the cyclic dependency test should be run.
protected  String getConfigurationAsXml(String configurationFileName)
          Read Xml configuration file to String.
 Collection<Rule> getRules()
          Getter for property rules.
 List<SourceDirectory> getSources()
          Getter for property sources.
 boolean throwExceptionWhenNoPackages()
          Holds the value parsed from the XML configuration that indicates weather or not a NoPackagesFoundException should be thrown when no packages are found in any of the given source paths.
protected abstract  void validateConfiguration(String configuration)
          Validate the configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

rules

protected final Collection<Rule> rules

Set of Rules read from the configuration file


sources

protected final List<SourceDirectory> sources

Set of Source read from configuration file


throwExceptionWhenNoPackages

protected boolean throwExceptionWhenNoPackages

Weather or not to throw exception when no packages are found for a given path.


doCyclicDependencyTest

protected boolean doCyclicDependencyTest

Weather or not to check for cyclic dependencies.

Constructor Detail

AbstractConfigurationFactory

public AbstractConfigurationFactory()
Method Detail

getRules

public Collection<Rule> getRules()

Getter for property rules.

Specified by:
getRules in interface ConfigurationFactory
Returns:
Value for property rules.

getSources

public List<SourceDirectory> getSources()

Getter for property sources.

Specified by:
getSources in interface ConfigurationFactory
Returns:
Value for property sources.

doCyclicDependencyTest

public boolean doCyclicDependencyTest()
Description copied from interface: ConfigurationFactory

Holds the value parsed from the XML configuration that indicates weather or not the cyclic dependency test should be run.

Specified by:
doCyclicDependencyTest in interface ConfigurationFactory
Returns:
boolean true when <cyclicalDependency test="true"/>
See Also:
ConfigurationFactory.doCyclicDependencyTest()

throwExceptionWhenNoPackages

public boolean throwExceptionWhenNoPackages()
Description copied from interface: ConfigurationFactory

Holds the value parsed from the XML configuration that indicates weather or not a NoPackagesFoundException should be thrown when no packages are found in any of the given source paths.

Specified by:
throwExceptionWhenNoPackages in interface ConfigurationFactory
Returns:
boolean true when <sources no-packages="exception">
See Also:
ConfigurationFactory.throwExceptionWhenNoPackages()

getConfigurationAsXml

protected String getConfigurationAsXml(String configurationFileName)

Read Xml configuration file to String.

Parameters:
configurationFileName - String name of the XML file in the classpath to load and read OR the complete path to the file.
Returns:
String returns the contents of the configurationFile

validateConfiguration

protected abstract void validateConfiguration(String configuration)

Validate the configuration.

Parameters:
configuration - String xml content to validate
See Also:
"architecture-rules.dtd"


Copyright © 2007-2008. All Rights Reserved.