|
Lines 32-43
Link Here
|
| 32 |
|
32 |
|
| 33 |
/** |
33 |
/** |
| 34 |
* Sample usage: <br> |
34 |
* Sample usage: <br> |
| 35 |
* ConfigUpgrade upgrade = ConfigUpgrade.getInstance("<AC HOME>\\config\\serviceconfig.xml"); <br> |
35 |
* ConfigUpgrade upgrade = ConfigUpgrade.getInstance(); <br> |
| 36 |
* upgrade.parseDocument(); |
36 |
* upgrade.parseDocument("<AC HOME>\\config\\serviceconfig.xml"); |
| 37 |
* |
37 |
* |
| 38 |
* @author Joel Cayne |
38 |
* @author Joel Cayne |
| 39 |
* @version February 29, 2008 |
39 |
* @version March 3, 2008 |
| 40 |
* @since February 29, 2008 |
40 |
* @since February 29, 2008 |
|
|
41 |
* @provisional |
| 41 |
* |
42 |
* |
| 42 |
*/ |
43 |
*/ |
| 43 |
public class ConfigUpgrade { |
44 |
public class ConfigUpgrade { |
|
Lines 50-70
Link Here
|
| 50 |
|
51 |
|
| 51 |
/** |
52 |
/** |
| 52 |
* The method called to acquire a reference of the singleton ConfigUpgrade. |
53 |
* The method called to acquire a reference of the singleton ConfigUpgrade. |
| 53 |
* @param filename The path to the serviceconfig.xml to retrieve an existing configuration from. |
|
|
| 54 |
* @return An instance of ConfigUpgrade. |
54 |
* @return An instance of ConfigUpgrade. |
| 55 |
*/ |
55 |
*/ |
| 56 |
public static ConfigUpgrade getInstance(String filename) { |
56 |
public static ConfigUpgrade getInstance() { |
| 57 |
if(instance == null) { |
57 |
if(instance == null) { |
| 58 |
instance = new ConfigUpgrade(filename); |
58 |
instance = new ConfigUpgrade(); |
| 59 |
} |
59 |
} |
| 60 |
return instance; |
60 |
return instance; |
| 61 |
} |
61 |
} |
| 62 |
|
62 |
|
|
|
63 |
private ConfigUpgrade() { |
| 64 |
} |
| 65 |
|
| 63 |
/** |
66 |
/** |
| 64 |
* Provides for upgrading an existing Agent Controller installation. |
67 |
* Provides for upgrading an existing Agent Controller installation. Parses the serviceconfig.xml and obtains the user provided values. |
| 65 |
* @param filename The path to the serviceconfig.xml to retrieve an existing configuration from. |
68 |
* @param filename The path to the serviceconfig.xml to retrieve an existing configuration from. |
|
|
69 |
* @return The properties hash with the user entered values. |
| 66 |
*/ |
70 |
*/ |
| 67 |
private ConfigUpgrade(String filename) { |
71 |
public Properties parseDocument(String filename) { |
| 68 |
try { |
72 |
try { |
| 69 |
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(filename)); |
73 |
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(filename)); |
| 70 |
configFile = new ConfigFile(filename); |
74 |
configFile = new ConfigFile(filename); |
|
Lines 76-88
Link Here
|
| 76 |
} catch (ParserConfigurationException e) { |
80 |
} catch (ParserConfigurationException e) { |
| 77 |
Logger.err(e.getMessage()); |
81 |
Logger.err(e.getMessage()); |
| 78 |
} |
82 |
} |
| 79 |
} |
83 |
|
| 80 |
|
|
|
| 81 |
/** |
| 82 |
* Parses the serviceconfig.xml and obtains the user provided values. |
| 83 |
* @return The properties hash with the user entered values. |
| 84 |
*/ |
| 85 |
public Properties parseDocument() { |
| 86 |
properties.put(Constants.JAVA_PATH, configFile.getValue(Constants.JAVA_PATH)); |
84 |
properties.put(Constants.JAVA_PATH, configFile.getValue(Constants.JAVA_PATH)); |
| 87 |
addElement(SecurityEnabled.TAG); |
85 |
addElement(SecurityEnabled.TAG); |
| 88 |
addElement(UserDefinition.TAG); |
86 |
addElement(UserDefinition.TAG); |