Coverage Report - com.sourceforge.jpatterns.core.JPConstants
 
Classes in this File Line Coverage Branch Coverage Complexity
JPConstants
80% 
100% 
0
 
 1  
 package com.sourceforge.jpatterns.core;
 2  
 
 3  
 import org.apache.log4j.Logger;
 4  
 
 5  
 import java.util.regex.Pattern;
 6  
 
 7  
 /**
 8  
  * This class contains the global constants which are usefull for the development of the JPatterns
 9  
  *
 10  
  * $Author:: zmicer             $<br/>
 11  
  * $Rev:: 67                    $<br/> * $Date:: 2007-08-28 21:37:07 #$<br/>
 12  
  * $Date:: 2007-08-28 21:37:07 #$<br/>
 13  
  */
 14  0
 public class JPConstants
 15  
 {
 16  
     /**
 17  
      * Logger instance.
 18  
      */
 19  5
     final public static Logger LOG = Logger.getLogger(JPConstants.class);
 20  
 
 21  
     /**
 22  
      * This *compiled* pattern represents the mask for the configuration files which should be used by the JPatterns to initialize
 23  
      * the patterns stuff.
 24  
      * <br/>
 25  
      * This patterns excludes the names of the files are used by the framework for the initializing the framework itself.
 26  
      */
 27  5
     final public static Pattern PATTERN =
 28  
         Pattern.compile(".*jpatterns.*(?<!^jpatterns_framework)(?<!^jpatterns_framework_custom)\\.xml");
 29  
 
 30  
     /**
 31  
      * This interface stores the constants related to the configuration of all the XML configuration files might be used at the JPatterns
 32  
      */
 33  
     public interface XMLConfigFilesConstants
 34  
     {
 35  
         /**
 36  
          * This is the file name where the JPatterns configuration would be stored (the idea is when JPattern would have the patterns
 37  
          * implemented, then another functionality would be forced to use these patterns as base - e.g. initially implementations of
 38  
          * JPatterns base interfaces are taken from the properties file, but when "factory" pattern would be implemented we would be
 39  
          * able to use the xml for the storing implementations defined per interfaces etc.)
 40  
          * <br/>
 41  
          * The customer specific configuration file can not be the same name with this provided below. It is reserved one.
 42  
          * When for the XML configuration files for the JPatterns this name would be simply excluded.
 43  
          * (<strong>jpatterns_framework_custom</strong> and <strong>jpatterns_framework</strong>)
 44  
          */
 45  
         String DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME = "jpatterns_framework.xml";
 46  
 
 47  
         /**
 48  
          * The JVM param is used for the obtaining the overriden configuration for the framework default configuration (is used for
 49  
          * the wramework itself)
 50  
          */
 51  
         String DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME_JVM_PARAM = DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME;
 52  
 
 53  
         /**
 54  
          * The key is used for the obtaining the configuration for the default framework xml file.
 55  
          */
 56  
         String DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME_PROPS_PARAM = "jpatterns.configuration.xml.default.framework.file";
 57  
 
 58  
         /**
 59  
          * Please review the Java Docs to the {@link JPConstants.XMLConfigFilesConstants#DEFAULT_XML_FRAMEWORK_CONFIG_FILE_NAME}.
 60  
          * <br/>
 61  
          * The file with such name allows to override/extend the configuration is written and this default file.
 62  
          */
 63  
         String CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME = "jpatterns_framework_custom.xml";
 64  
 
 65  
         /**
 66  
          * The JVM param is used for the obtaining the overriden configuration for the custom framework xml file.
 67  
          */
 68  
         String CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME_JVM_PARAM = CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME;
 69  
 
 70  
         /**
 71  
          * The key is used for the obtaining the overriden configuration for the custom framework xml file.
 72  
          */
 73  
         String CUSTOM_XML_FRAMEWORK_CONFIG_FILE_NAME_PROPS_PARAM = "jpatterns.configuration.xml.custom.framework.file";
 74  
 
 75  
         /**
 76  
          * The JVM param is used for the obtaining the path to the directory where the overriden XML customer specific configuration
 77  
          * should be seached
 78  
          */
 79  
         String CUSTOM_XML_CONSUMER_CONFIG_DIR_NAME_JVM_PARAM = "jpatterns.configuration.xml.custom.consumer.config.dir";
 80  
 
 81  
         /**
 82  
          * The JVM param is used for the obtaining the path to the directory where the default XML customer specific configuration
 83  
          * should be seached
 84  
          */
 85  
         String DEFAULT_XML_CONSUMER_CONFIG_DIR_NAME_JVM_PARAM = "jpatterns.configuration.xml.default.consumer.config.dir";
 86  
 
 87  
         /**
 88  
          * The key for the properties settings defining the directory where to find all the jpatterns configuration.
 89  
          */
 90  
         String CUSTOM_XML_CONSUMER_CONFIG_DIR_NAME_PROPS_PARAM = CUSTOM_XML_CONSUMER_CONFIG_DIR_NAME_JVM_PARAM;
 91  
 
 92  
         /**
 93  
          * The key for the properties settings defining the directory where to find default consumer jpatterns configuration.
 94  
          */
 95  
         String DEFAULT_XML_CONSUMER_CONFIG_DIR_NAME_PROPS_PARAM = DEFAULT_XML_CONSUMER_CONFIG_DIR_NAME_JVM_PARAM;
 96  
     }
 97  
 
 98  
     /**
 99  
      * This interface stores the constants related to the configuration of all the properties based configuration files
 100  
      */
 101  
     public interface PropertiesConfigFilesConstants
 102  
     {
 103  
         /**
 104  
          * PROPERTIES_EXTENSION
 105  
          */
 106  
         String PROPERTIES_EXTENSION = ".properties";
 107  
 
 108  
         /**
 109  
          * DEFAULT_PROPERTIES_BASE_NAME
 110  
          */
 111  
         String DEFAULT_PROPERTIES_BASE_NAME = "jpatterns";
 112  
 
 113  
         /**
 114  
          * The name of the default jpatterns properties file - these properties are necessary to setup configuration only for the
 115  
          * JPatterns core files - when factory pattern would be implemented the configuration would be taken from the xml file with
 116  
          * the name <code>DEFAULT_XML_CONFIG_FILE_NAME</code>
 117  
          */
 118  
         String DEFAULT_PROPERTIES_FILE_NAME = DEFAULT_PROPERTIES_BASE_NAME + PROPERTIES_EXTENSION;
 119  
 
 120  
         /**
 121  
          * It is possible to override the name to the default properties file using the JVM parameter
 122  
          */
 123  
         String DEFAULT_PROPERTIES_FILE_NAME_JVM_PARAM = DEFAULT_PROPERTIES_FILE_NAME;
 124  
 
 125  
         /**
 126  
          * CUSTOM_PROPERTIES_BASE_NAME
 127  
          */
 128  
         String CUSTOM_PROPERTIES_BASE_NAME = "jpatterns_custom";
 129  
 
 130  
         /**
 131  
          * The name of the file where the custom properties woduld be stored - it would allow the developers using JPatterns,
 132  
          * to override the default settings would be stored at the Jar file.
 133  
          */
 134  
         String CUSTOM_PROPERTIES_FILE_NAME = CUSTOM_PROPERTIES_BASE_NAME + PROPERTIES_EXTENSION;
 135  
 
 136  
         /**
 137  
          * It is possible to override the name to the custom properties file using the JVM parameter
 138  
          */
 139  
         String CUSTOM_PROPERTIES_FILE_NAME_JVM_PARAM = CUSTOM_PROPERTIES_FILE_NAME;
 140  
     }
 141  
 
 142  
     /**
 143  
      * Defines the logging categories to be used by the JPatterns core
 144  
      */
 145  15
     public enum LoggingCategory
 146  
     {
 147  
         /**
 148  
          * All the debug messages related to the Factory pattern
 149  
          */
 150  5
         FACTORY,
 151  
 
 152  
         /**
 153  
          * All the messages related to the obtaining patterns from the JPatterns consumer/framework configuration
 154  
          */
 155  5
         OBTAIN_PATTERNS
 156  
     }
 157  
 
 158  
     /**
 159  
      * This enumeration defines the possible categories for the configuration JPatterns engine would use for the obtain the patterns implementations
 160  
      * (for nowe it is just consumer but in the future when some different providers appear - it could be extended or made even dynamical)
 161  
      * <br/>
 162  
      * todo [zmicer]: review the above mentioned. It is logged as the 4 item of the release 1.1 requirements.
 163  
      */
 164  15
     public enum EngineConfigCaregory
 165  
     {
 166  
         /**
 167  
          * Framework configuration
 168  
          */
 169  5
         FRAMEWORK,
 170  
         /**
 171  
          * Consumer configuration
 172  
          */
 173  5
         CONSUMER
 174  
     }
 175  
 
 176  
     /**
 177  
      * This interface stores the names of the config elements which are the part of the FrameworkConfig
 178  
      */
 179  0
     public interface FrameworkConfigEntities
 180  
     {
 181  
         /**
 182  
          * Defines the name of the factory woul dbe used for the factory core settings
 183  
          */
 184  
         String FACTORY_JPATTERNS_CORE = "JPatternsCore";
 185  
         /**
 186  
          * Defines the item with the configuration for the plugins
 187  
          */
 188  
         String ITEM_JPATTERNS_PLUGIN = "JPatternsPlugins";
 189  
     }
 190  
 
 191  
     /**
 192  
      * The default scope name constant.
 193  
      */
 194  
     public static final String DEFAULT_SCOPE_NAME = "DEFAULT_SCOPE";
 195  
 
 196  
     /**
 197  
      * default priority to be used with the not prioritized JPatternsConfig child elements
 198  
      */
 199  
     public static final int DEFAULT_PRIORITY = -1;
 200  
 
 201  
     /**
 202  
      * Prioritized priority prefix.
 203  
      */
 204  
     public static final String PRIORITIZED_PRIOTITY_PREFIX = "PRIORITIZED_PRIORITY_";    
 205  
 }
 206