|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| BootstrapLoaderFactory.java | 50% | 37,5% | 50% | 41,7% |
|
||||||||||||||
| 1 | /* | |
| 2 | * BootstrapLoaderFactory.java | |
| 3 | * | |
| 4 | * Created on 23. August 2004, 21:32 | |
| 5 | */ | |
| 6 | ||
| 7 | package org.jconfig.bootstrap; | |
| 8 | ||
| 9 | import org.jconfig.utils.*; | |
| 10 | import org.jconfig.error.*; | |
| 11 | /** | |
| 12 | * The BootstrapLoaderFactory will instantiate the | |
| 13 | * defined BootstrapLoader and return it. In order to determine | |
| 14 | * which loader should be used it will look for a system.property called | |
| 15 | * jconfig.bootstraploader. If not set then it will look for the same property | |
| 16 | * in a file called jconfig.properties. This | |
| 17 | * properties file must be in the classpath. The value for this property | |
| 18 | * must be the full qualified class name. | |
| 19 | * | |
| 20 | * @author Andreas Mecky andreasmecky@yahoo.de | |
| 21 | * @author Terry Dye terrydye@yahoo.com | |
| 22 | */ | |
| 23 | public class BootstrapLoaderFactory { | |
| 24 | ||
| 25 | /** | |
| 26 | * | |
| 27 | */ | |
| 28 | 0 | public BootstrapLoaderFactory() { |
| 29 | } | |
| 30 | ||
| 31 | /** | |
| 32 | * This method will return the implementation | |
| 33 | * of the BootstrapLoader that will be used | |
| 34 | * by the ConfigurationManager at startup to | |
| 35 | * load some configurations. | |
| 36 | */ | |
| 37 | 1 | public static BootstrapLoader getLoader() { |
| 38 | 1 | String val = ConfigurationUtils.getConfigProperty("jconfig.bootstraploader"); |
| 39 | 1 | if ( val == null ) { |
| 40 | 1 | return new DefaultBootstrapLoader(); |
| 41 | } | |
| 42 | else { | |
| 43 | 0 | try { |
| 44 | 0 | BootstrapLoader bl = (BootstrapLoader)Class.forName(val).newInstance(); |
| 45 | 0 | return bl; |
| 46 | } | |
| 47 | catch (Exception e) { | |
| 48 | 0 | ErrorReporter.getErrorHandler().reportError("Exception while trying to set the bootstrap loader:"+val,e); |
| 49 | 0 | return new DefaultBootstrapLoader(); |
| 50 | } | |
| 51 | } | |
| 52 | ||
| 53 | } | |
| 54 | ||
| 55 | } |
|
||||||||||