KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > contineo > core > config > BackupConfigurator


1 /*
2  * Created on 18.08.2004
3  */

4 package org.contineo.core.config;
5
6 import org.contineo.core.XMLBean;
7
8 /**
9  * @author Michael Scholz
10  */

11 public class BackupConfigurator {
12
13     private XMLBean xml;
14     
15     /**
16      *
17      */

18     public BackupConfigurator() {
19         ClassLoader JavaDoc loader = Thread.currentThread().getContextClassLoader();
20         xml = new XMLBean(loader.getResource("backup.xml"));
21     }
22
23     public boolean isEnabled() {
24         String JavaDoc enabled = xml.getText(xml.getChild("enabled"));
25         Boolean JavaDoc result = Boolean.valueOf(enabled);
26         return result.booleanValue();
27     }
28     
29     public void setEnabled(boolean enabled) {
30         xml.setText(xml.getChild("enabled"), (Boolean.valueOf(enabled)).toString());
31     }
32     
33     public String JavaDoc getBackupClass() {
34         return xml.getAttributeValue(xml.getChild("class"), "name");
35     }
36     
37     public String JavaDoc getLocation() {
38         return xml.getAttributeValue(xml.getChild("location"), "value");
39     }
40     
41     public void setLocation(String JavaDoc location) {
42         xml.setAttributeValue(xml.getChild("location"), "value", location);
43     }
44     
45     public String JavaDoc getProtocolFile() {
46         return xml.getAttributeValue(xml.getChild("protocol"), "file");
47     }
48     
49     public boolean write() {
50         return xml.writeXMLDoc();
51     }
52 }
53
Popular Tags