com.sourceforge.jpatterns.core.configuration.model
Class JPatternsConfigBeansBuilderImpl

java.lang.Object
  extended by com.sourceforge.jpatterns.core.configuration.model.JPatternsConfigBeansBuilderImpl
All Implemented Interfaces:
IJPatternsConfigBeansBuilder

public class JPatternsConfigBeansBuilderImpl
extends Object
implements IJPatternsConfigBeansBuilder

Default, "native" implementation of the appropriate interface. $Author:: zmicer $
$Rev:: 67 $
* $Date:: 2007-08-28 21:37:07 #$
$Date:: 2007-08-28 21:37:07 #$


Field Summary
static org.apache.log4j.Logger LOG
          Logger instance.
 
Constructor Summary
JPatternsConfigBeansBuilderImpl()
           
 
Method Summary
 JPatternsConfigBean build(com.sourceforge.jpatterns.schema.JPatternsConfig config)
          Build the JPatternsConfigBaseBean using the provided JPatternsConfig object.
 JPatternsConfigsBean build(List<JPatternsConfigBaseBean> beans)
          Build as JPatternsConfigsBean using the List of JPatternsConfigBean objects
Please be noticed this method could be used for the prioritized building.
protected  com.sourceforge.jpatterns.schema.CastorNameScopePriorityType choiceOrMergeCastorNameScopePriorityTypes(com.sourceforge.jpatterns.schema.CastorNameScopePriorityType castor1, com.sourceforge.jpatterns.schema.CastorNameScopePriorityType castor2)
          Choice one of the given CastorNameScopePriorityType castor objects or perform the merging if it is necessary.
protected  void fill(JPatternsConfigBaseBean initialBaseBean, List<com.sourceforge.jpatterns.schema.CastorSectionType> sections)
          Please review the Java Docs to the method fill todo [zmicer]: adjust Java Doc todo [zmicer]: think if this method could be moved to interface of the builder too
protected static boolean getOverrideNotDependingOnPriority()
           
protected static String getOverridingDepth()
           
protected static void setOverrideNotDependingOnPriority(boolean value)
          Set the OverrideNotDependingOnPriority static field with the new value.
protected static void setOverridingDepth(String depth)
          Set the overriding depth.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.log4j.Logger LOG
Logger instance.

Constructor Detail

JPatternsConfigBeansBuilderImpl

public JPatternsConfigBeansBuilderImpl()
Method Detail

build

public JPatternsConfigBean build(com.sourceforge.jpatterns.schema.JPatternsConfig config)
Description copied from interface: IJPatternsConfigBeansBuilder
Build the JPatternsConfigBaseBean using the provided JPatternsConfig object.
Please review the JavaDocs to get the info about the algorithm the concrete implementation uses.

Specified by:
build in interface IJPatternsConfigBeansBuilder
Parameters:
config - JPatternsConfig castor object. Not normalized castor config object should be passed here\ (CastorUtils.validateAndNormalizeScopesPriorities(com.sourceforge.jpatterns.schema.JPatternsConfig)). Can not be null (otherwise IllegalArgumentException would appear).
Returns:
JPatternsConfigBean castor object built using the provided JPatternsConfig castor root object.
See Also:

 The algorithm is used here as follows:
 Sections filling:
 1. the List of "section based" objects is formed
- in the case the section has not explicit scope - the default one from the root castor object or the {@link com.sourceforge.jpatterns.core.JPConstants.DEFAULT_SCOPE_NAME} is set. 2. all the "section based" objects are put to the map - in the case {@link com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.XML_CONFIG_OVERRIDING_DEPTH} property equals to com.sourceforge.jpatterns.core.configuration.PropertiesProvider.OverridingDepths.OVERRIDING_LEVEL_ITEM then in the case of two identical sections (scopes, section name and priority), they would be merged to the one by joining the appropriate business items. If there are identical business items (scopes, name and priority) - the com.sourceforge.jpatterns.core.configuration.exceptions.JPInitializationException exception would appear - in the case {@link com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.XML_CONFIG_OVERRIDING_DEPTH} property equals to com.sourceforge.jpatterns.core.configuration.PropertiesProvider.OverridingDepths.OVERRIDING_LEVEL_SECTION then in the case of two identical sections (scopes, section name and priority) com.sourceforge.jpatterns.core.configuration.exceptions.JPConfigException exception would appear - in the case of the identical pathes but different priorities they would be taken into consideration (in this case com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.XML_CONFIG_CUSTOM_OVERRIDES_NOT_DEPENDING_ON_PRIORITY would be considered too).

Business items filling: todo [zmicer]: <>

note [zmicer]: please be noticed the Section with the certain scope is allowed to store the business items with different scopes


build

public JPatternsConfigsBean build(List<JPatternsConfigBaseBean> beans)
Description copied from interface: IJPatternsConfigBeansBuilder
Build as JPatternsConfigsBean using the List of JPatternsConfigBean objects
Please be noticed this method could be used for the prioritized building. In this case one of the beans is passed here should have been already prioritized (it should have been created using the CastorUtils.makePrioritized(com.sourceforge.jpatterns.schema.JPatternsConfig) method)

Specified by:
build in interface IJPatternsConfigBeansBuilder
Parameters:
beans - the List of JPatternsConfigBean objects, Can not be null (otherwise IllegalArgumentException would appear). Should be built using normalized configs.
Returns:
the built JPatternsConfigsBean, in the case of empty beans just initial version of this bean would returned.
See Also:
IJPatternsConfigBeansBuilder.build(com.sourceforge.jpatterns.schema.JPatternsConfig)

fill

protected void fill(JPatternsConfigBaseBean initialBaseBean,
                    List<com.sourceforge.jpatterns.schema.CastorSectionType> sections)
Please review the Java Docs to the method fill todo [zmicer]: adjust Java Doc todo [zmicer]: think if this method could be moved to interface of the builder too

Parameters:
initialBaseBean - the initial bean to fill. Can not be null (otherwise IllegalArgumentException would appear).
sections - the List of the CastorSectionType objects. They should be normalized in the sense of scopes and priorities(for details study CastorUtils.validateAndNormalizeScopesPriorities(JPatternsConfig)). Can not be null (otherwise IllegalArgumentException would appear).

choiceOrMergeCastorNameScopePriorityTypes

protected com.sourceforge.jpatterns.schema.CastorNameScopePriorityType choiceOrMergeCastorNameScopePriorityTypes(com.sourceforge.jpatterns.schema.CastorNameScopePriorityType castor1,
                                                                                                                 com.sourceforge.jpatterns.schema.CastorNameScopePriorityType castor2)
Choice one of the given CastorNameScopePriorityType castor objects or perform the merging if it is necessary. Please review the comments to the main fill method to understand how it works (depending on the mentioned properties etc.)
These objects should have the equal pathes to be passed here (scope, name) - otherwise the IllegalArgumentException appear

Parameters:
castor1 - the first object, Can not be null (otherwise IllegalArgumentException would appear).
castor2 - the second object, Can not be null (otherwise IllegalArgumentException would appear).
Returns:
the object is more prioritized here

setOverridingDepth

protected static void setOverridingDepth(String depth)
Set the overriding depth. This method is necessary for the unit testing.

Parameters:
depth - the value we ned to set, Can not be null (otherwise IllegalArgumentException would appear).

getOverridingDepth

protected static String getOverridingDepth()
Returns:
overriding depth

setOverrideNotDependingOnPriority

protected static void setOverrideNotDependingOnPriority(boolean value)
Set the OverrideNotDependingOnPriority static field with the new value. This method is necessary for unit testing.

Parameters:
value - new boolean value

getOverrideNotDependingOnPriority

protected static boolean getOverrideNotDependingOnPriority()
Returns:
the value of OverrideNotDependingOnPriority


Copyright © 2007 jzmicer.team. All Rights Reserved.