| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sourceforge.jpatterns.core.configuration.JPConfiguratorImpl
public class JPConfiguratorImpl
The default implementation of the IJPConfiguration interface.
 
 The instance we need to use is configured at the
 properties file, so there is a way for the developer to override this implementation by the custom one.
 
 Be noticed the consumer custom dir could be rather complicated: use the
 System.getProperty(PATH_SEPARATOR_KEY) to specify the complicated pathes. it could be provided using JVM parameter (first
 priority) and props key/value (the second priority). Please review the following constants to be involved into it:
 com.sourceforge.jpatterns.core.JPConstants.XMLConfigFilesConstants.CUSTOM_XML_CONSUMER_CONFIG_DIR_NAME_JVM_PARAM
 com.sourceforge.jpatterns.core.JPConstants.XMLConfigFilesConstants.CUSTOM_XML_CONSUMER_CONFIG_DIR_NAME_PROPS_PARAM
 
 Please review the following Java Docs to understand the concepts of overriding:
 com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_FRAMEWORK_XML
 com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_CONSUMER_XML
 todo: [zmicer] add the possibility to set the values for the custom framework/consumer configuration at the properties file.
 
 note [zmicer]: please review the class members - there are lots of them, they are necessary for the storing the information we may be
 intersted in the future - so we would be able easily to extend the interface with another method.
 todo [zmicer]: please reconsider the interface IJPConfigurator methods - seems to be some of them are not necessary.
 note [zmicer]: check if it is possible to make the reload of the JPatterns configuration on the flight? It could be really necessary for
 the building some web services related functionality (when the configuration is specified and provided by the web service, and we need
 to shedule the reloading).
 $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 | LOGLogger instance. | 
| Constructor Summary | |
|---|---|
| JPConfiguratorImpl()Default public constructor to allow this functionality to be consructed using the factory and IoC. | |
| Method Summary | |
|---|---|
|  boolean | customJPatternsConsumerConfigurationPresents() | 
|  boolean | customJPatternsFrameworkConfigurationPresents() | 
|  boolean | defaultJPatternsConsumerConfigurationPresents() | 
|  boolean | defaultJPatternsFrameworkConfigurationPresents() | 
|  JPatternsConfigsBean | getJPatternsConsumerConfiguration() | 
|  String | getJPatternsConsumerConfigurationDirName()The first priority takes the JVM parameter, then - the properties file value. | 
|  List<File> | getJPatternsConsumerConfigurationFiles() | 
|  String | getJPatternsConsumerCustomConfigurationDirName()The first priority takes the JVM parameter, then - the properties file value. | 
|  List<File> | getJPatternsConsumerCustomConfigurationFiles() | 
|  JPatternsConfigsBean | getJPatternsFrameworkConfiguration() | 
|  String | getJPatternsFrameworkConfigurationFileName() | 
|  String | getJPatternsFrameworkCustomConfigurationFileName() | 
| protected  void | initConfiguration()Init xml configuration. | 
| protected  void | initConsumerConfiguration()Init (obtain, merge etc.) the consumer based configuration. | 
| protected  void | initFrameworkConfiguration()Init the framework configuration. | 
| protected  void | mergeConsumerConfigurations()Perform the merging of the consumer configurations. | 
| protected  void | mergeFrameworkConfigurations()Perform the merging of the framework configurations. | 
| protected  JPatternsConfigBean | obtainJPatternsConfig(String name)Obtain the JPatternsConfigusing the provided file name (it could be: 1. just file name without passes,
 2. the full file name 3. relative name)The following order for obtaining this JPatternsConfigclass is used:
 
 Using the classloaders
 Trying to open the file with the provided name usingFile | 
| protected  List<com.sourceforge.jpatterns.schema.JPatternsConfig> | obtainJPatternsConfigs(List<File> files)Obtain the List of JPatternsConfigobjects by the List of the File objects specified. | 
| protected static void | setUseOnlyCustomFrameworkConfigIfPresent(Boolean value)Set the value for the property useOnlyCustomFrameworkConfigIfPresent | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
public static final org.apache.log4j.Logger LOG
| Constructor Detail | 
|---|
public JPConfiguratorImpl()
| Method Detail | 
|---|
protected void initConfiguration()
protected void initFrameworkConfiguration()
protected void mergeFrameworkConfigurations()
com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_FRAMEWORK_XML is true -
 the custom configuration is used as the merged one.
 4. in the case the property is not defined - we consider its value is false
 com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_FRAMEWORK_XML
 5. in the case both configurations present and the value of the property
 com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_FRAMEWORK_XML is
 false - configurations are merged using the implementation of the JPatternsConfigBeansBuilder.
protected void initConsumerConfiguration()
System.getProperty(PATH_SEPARATOR_KEY) to specify the complicated pathes.
 todo [zmicer]: implement the opportunity to set the directory where the default JPatterns consumer configuration to obtain
protected void mergeConsumerConfigurations()
com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_CONSUMER_XML is true -
 the custom configuration is used as the merged one.
 4. in the case the property is not defined - we consider its value is false
 com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_CONSUMER_XML
 5. in the case both configurations present and the value of the property
 com.sourceforge.jpatterns.core.configuration.PropertiesProvider.JPProperties.USE_ONLY_CUSTOM_CONSUMER_XML is
 false - configurations are merged using the implementation of the JPatternsConfigBeansBuilder.
protected List<com.sourceforge.jpatterns.schema.JPatternsConfig> obtainJPatternsConfigs(List<File> files)
JPatternsConfig objects by the List of the File objects specified.
files - the List of the File objects Can not be null (otherwise IllegalArgumentException would appear).
protected JPatternsConfigBean obtainJPatternsConfig(String name)
JPatternsConfig using the provided file name (it could be: 1. just file name without passes,
 2. the full file name 3. relative name)
 JPatternsConfig class is used:
 File
name - the name of the file to be obtain. Can not be null (otherwise IllegalArgumentException would appear).
JPatternsConfig woth the settings we need for the further working.public String getJPatternsFrameworkConfigurationFileName()
getJPatternsFrameworkConfigurationFileName in interface IJPConfigurator
      The way this name is obtained:
      1. In the case JVM parameter is specified - it is returns. Please be noticed the JVM parameter could specify both file name and
      full pathed file name
 todo [zmicer]: check if this item is fully supported here.
      2. Then the properties based value is checked.
      JPConstants.XMLConfigFilesConstants.DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME_PROPS_PARAM
      3. Then the default name {@link JPConstants.XMLConfigFilesConstants.DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME} is returned.public String getJPatternsFrameworkCustomConfigurationFileName()
getJPatternsFrameworkCustomConfigurationFileName in interface IJPConfigurator
 Take an attention at this above method: getJPatternsFrameworkConfigurationFileNamepublic List<File> getJPatternsConsumerConfigurationFiles()
getJPatternsConsumerConfigurationFiles in interface IJPConfiguratorIJPConfigurator.getJPatternsConsumerConfigurationFiles()public List<File> getJPatternsConsumerCustomConfigurationFiles()
getJPatternsConsumerCustomConfigurationFiles in interface IJPConfiguratorIJPConfigurator.getJPatternsConsumerCustomConfigurationFiles()public String getJPatternsConsumerCustomConfigurationDirName()
com.zmicer.utils.ClassPathUtils#getClassPathes() for it. Also
 com.zmicer.utils.FileUtils#findFilesByREInClassPath(java.util.List, java.util.regex.Pattern) 
 could help in providing the info.
public String getJPatternsConsumerConfigurationDirName()
com.zmicer.utils.ClassPathUtils#getClassPathes() for it. Also
 com.zmicer.utils.FileUtils#findFilesByREInClassPath(java.util.List, java.util.regex.Pattern) 
 could help in providing the info.
public boolean defaultJPatternsFrameworkConfigurationPresents()
defaultJPatternsFrameworkConfigurationPresents in interface IJPConfiguratorIJPConfigurator.defaultJPatternsFrameworkConfigurationPresents()public boolean customJPatternsFrameworkConfigurationPresents()
customJPatternsFrameworkConfigurationPresents in interface IJPConfiguratorcom.sourceforge.jpatterns.core.JPConstants.XMLConfigFilesConstants.CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME_JVM_PARAM
 or this file with the name
 com.sourceforge.jpatterns.core.JPConstants.XMLConfigFilesConstants.CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME exists)IJPConfigurator.customJPatternsConsumerConfigurationPresents()public boolean defaultJPatternsConsumerConfigurationPresents()
defaultJPatternsConsumerConfigurationPresents in interface IJPConfiguratorIJPConfigurator.defaultJPatternsConsumerConfigurationPresents()public boolean customJPatternsConsumerConfigurationPresents()
customJPatternsConsumerConfigurationPresents in interface IJPConfiguratorcom.sourceforge.jpatterns.core.JPConstants.XMLConfigFilesConstants.CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME_JVM_PARAM
 or this file with the name
 com.sourceforge.jpatterns.core.JPConstants.XMLConfigFilesConstants.CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME exists)IJPConfigurator.customJPatternsConsumerConfigurationPresents()public JPatternsConfigsBean getJPatternsFrameworkConfiguration()
getJPatternsFrameworkConfiguration in interface IJPConfiguratorIJPConfigurator.getJPatternsFrameworkConfiguration()public JPatternsConfigsBean getJPatternsConsumerConfiguration()
getJPatternsConsumerConfiguration in interface IJPConfiguratorIJPConfigurator.getJPatternsConsumerConfiguration()protected static void setUseOnlyCustomFrameworkConfigIfPresent(Boolean value)
value - the value to be set to this property. Could be null - it means that the property is not defined at all.| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||