|
|||||||||||||||||||
| This license of Clover is provided to support the development of JBind only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| Config.java | 50% | 66,7% | 100% | 64,3% |
|
||||||||||||||
| 1 |
/* |
|
| 2 |
* JBind |
|
| 3 |
* |
|
| 4 |
* Copyright (c) by Stefan Wachter. All rights reserved. |
|
| 5 |
* |
|
| 6 |
* Usage, modification, and redistribution is subject to license terms that are |
|
| 7 |
* available at 'http://www.jbind.org'. The JBind license is like the |
|
| 8 |
* 'Apache Software License V 1.1'. |
|
| 9 |
*/ |
|
| 10 |
package org.jbind.xml; |
|
| 11 |
|
|
| 12 |
/** |
|
| 13 |
* Configuration of the XML package. Uses {@link Preferences} for storing the
|
|
| 14 |
* configuration information. The configuration can be managed using the main |
|
| 15 |
* method of this class. |
|
| 16 |
* <p> |
|
| 17 |
* The configuration information is divided into several branches: |
|
| 18 |
* <ul> |
|
| 19 |
* <li>schema compiler</li> |
|
| 20 |
* <li>validation</li> |
|
| 21 |
* </ul> |
|
| 22 |
* An example preferences file can be obtained by executing the command:<br> |
|
| 23 |
* <code>java org.jbind.xml.Config -reset -export config.xml</code>.<br> |
|
| 24 |
*/ |
|
| 25 |
public class Config {
|
|
| 26 |
|
|
| 27 |
public static final IConfig instance = createConfig(); |
|
| 28 |
|
|
| 29 | 3 |
private static IConfig createConfig() {
|
| 30 | 3 |
IConfig res = null; |
| 31 | 3 |
String configClassName = System.getProperty("JBindConfigClass");
|
| 32 | 3 |
if (null != configClassName) {
|
| 33 | 0 |
try {
|
| 34 | 0 |
res = (IConfig)Class.forName(configClassName).newInstance(); |
| 35 |
} catch (Exception e) {
|
|
| 36 | 0 |
e.printStackTrace(); |
| 37 |
} |
|
| 38 |
} |
|
| 39 | 3 |
if (null == res) {
|
| 40 | 3 |
res = PrefsConfig.instance; |
| 41 |
} |
|
| 42 | 3 |
return res; |
| 43 |
} |
|
| 44 |
|
|
| 45 |
} |
|
| 46 |
|
|
||||||||||