1 17 package org.columba.core.config; 18 19 import java.io.File ; 20 21 import org.columba.core.xml.XmlElement; 22 23 public class OptionsXmlConfig extends DefaultXmlConfig { 24 25 private GuiItem guiItem; 26 27 private static final String OPTIONS_PROXY = "/options/proxy"; 29 private static final String OPTIONS_GUI = "/options/gui"; 31 private static final String HTTP_PROXYHOST = "http.proxyHost"; 33 private static final String HTTP_PROXYPORT = "http.proxyPort"; 35 private static final String PROXY_HOST = "host"; 37 private static final String PROXY_PORT = "port"; 39 40 public OptionsXmlConfig(final File file) { 41 super(file); 42 } 43 44 @Override 45 public boolean load() { 46 final boolean result = super.load(); 47 48 49 final XmlElement proxy = getRoot().getElement(OPTIONS_PROXY); 50 if ((proxy != null) && (System.getProperty(HTTP_PROXYHOST) != null)) { 51 System.setProperty(HTTP_PROXYHOST, proxy.getAttribute(PROXY_HOST)); 52 System.setProperty(HTTP_PROXYPORT, proxy.getAttribute(PROXY_PORT)); 53 } 54 55 return result; 56 } 57 58 public GuiItem getGuiItem() { 59 if (guiItem == null) { 60 guiItem = new GuiItem(getRoot().getElement(OPTIONS_GUI)); 61 } 62 63 return guiItem; 64 } 65 } 66 | Popular Tags |