1 4 package org.contineo.core.config; 5 6 import org.contineo.core.XMLBean; 7 8 11 public class BackupConfigurator { 12 13 private XMLBean xml; 14 15 18 public BackupConfigurator() { 19 ClassLoader loader = Thread.currentThread().getContextClassLoader(); 20 xml = new XMLBean(loader.getResource("backup.xml")); 21 } 22 23 public boolean isEnabled() { 24 String enabled = xml.getText(xml.getChild("enabled")); 25 Boolean 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 getBackupClass() { 34 return xml.getAttributeValue(xml.getChild("class"), "name"); 35 } 36 37 public String getLocation() { 38 return xml.getAttributeValue(xml.getChild("location"), "value"); 39 } 40 41 public void setLocation(String location) { 42 xml.setAttributeValue(xml.getChild("location"), "value", location); 43 } 44 45 public String getProtocolFile() { 46 return xml.getAttributeValue(xml.getChild("protocol"), "file"); 47 } 48 49 public boolean write() { 50 return xml.writeXMLDoc(); 51 } 52 } 53 | Popular Tags |