Package se.unlogic.standardutils.settings

Examples of se.unlogic.standardutils.settings.XMLSettingNode


      //DOMConfigurator.configure(logurl);
      //DOMConfigurator.configure("conf/log4j.xml");

    log.info(VERSION + " starting...");

    XMLSettingNode configFile;

    try {
      log.debug("Parsing config file..." + configFilePath);
      configFile = new XMLSettingNode(configFilePath);

    } catch (Exception e) {

      log.fatal("Unable to open config file " + configFilePath + ", aborting startup!");
      System.out.println("Unable to open config file " + configFilePath + ", aborting startup!");
      return;
    }

    List<Integer> ports = configFile.getIntegers("/Config/System/Port");

    if (ports.isEmpty()) {

      log.debug("No ports found in config file " + configFilePath + ", using default port 53");
      ports.add(new Integer(53));
    }

    List<InetAddress> addresses = new ArrayList<InetAddress>();
    List<String> addressStrings = configFile.getStrings("/Config/System/Address");

    if (addressStrings == null || addressStrings.isEmpty()) {

      log.debug("No addresses found in config, listening on all addresses (0.0.0.0)");
      addresses.add(Address.getByAddress("0.0.0.0"));

    } else {

      for (String addressString : addressStrings) {

        try {

          addresses.add(Address.getByAddress(addressString));

        } catch (UnknownHostException e) {

          log.error("Invalid address " + addressString + " specified in config file, skipping address " + e);
        }
      }

      if (addresses.isEmpty()) {

        log.fatal("None of the " + addressStrings.size() + " addresses specified in the config file are valid, aborting startup!\n" + "Correct the addresses or remove them from the config file if you want to listen on all interfaces.");
            return;
      }
    }

    Integer tcpThreadPoolSize = configFile.getInteger("/Config/System/TCPThreadPoolSize");

    if (tcpThreadPoolSize != null) {

      log.debug("Setting TCP thread pool size to " + tcpThreadPoolSize);
      this.tcpThreadPoolSize = tcpThreadPoolSize;
    }

    Integer tcpThreadPoolShutdownTimeout = configFile.getInteger("/Config/System/TCPThreadPoolShutdownTimeout");

    if (tcpThreadPoolShutdownTimeout != null) {

      log.debug("Setting TCP thread pool shutdown timeout to " + tcpThreadPoolSize + " seconds");
      this.tcpThreadPoolShutdownTimeout = tcpThreadPoolShutdownTimeout;
    }

    Integer udpThreadPoolSize = configFile.getInteger("/Config/System/UDPThreadPoolSize");

    if (udpThreadPoolSize != null) {

      log.debug("Setting UDP thread pool size to " + udpThreadPoolSize);
      this.udpThreadPoolSize = udpThreadPoolSize;
    }

    Integer udpThreadPoolShutdownTimeout = configFile.getInteger("/Config/System/UDPThreadPoolShutdownTimeout");

    if (udpThreadPoolShutdownTimeout != null) {

      log.debug("Setting UDP thread pool shutdown timeout to " + udpThreadPoolSize + " seconds");
      this.udpThreadPoolShutdownTimeout = udpThreadPoolShutdownTimeout;
    }

    this.remotePassword = configFile.getString("/Config/System/RemoteManagementPassword");

    log.debug("Remote management password set to " + remotePassword);

    this.remotePort = configFile.getInteger("/Config/System/RemoteManagementPort");

    log.debug("Remote management port set to " + remotePort);

    Integer axfrTimeout = configFile.getInteger("/Config/System/AXFRTimeout");

    if (axfrTimeout != null) {

      log.debug("Setting AXFR timeout to " + axfrTimeout);
      this.axfrTimeout = axfrTimeout;
    }

    // TODO TSIG stuff

    List<XMLSettingNode> zoneProviderElements = configFile.getSettings("/Config/ZoneProviders/ZoneProvider");

    for (XMLSettingNode settingNode : zoneProviderElements) {

      String name = settingNode.getString("Name");
View Full Code Here


   * @throws IOException
   * @throws ParserConfigurationException
   */
  public static Set<String> getVariableReferenses(File file) throws SAXException, IOException, ParserConfigurationException {

    XMLSettingNode settingNode = new XMLSettingNode(file);

    List<String> tags = settingNode.getStrings("//@*[contains(.,'$')]");

    if(tags == null){
     
      return null;
    }
View Full Code Here

   * @throws IOException
   * @throws ParserConfigurationException
   */
  public static List<String> getDeclaredVariables(File file) throws SAXException, IOException, ParserConfigurationException {

    XMLSettingNode settingNode = new XMLSettingNode(file);

    return settingNode.getStrings("//variable/@name");
  }
View Full Code Here

      System.out.println("Usage EagleManagerClient config host command");
      System.out.println("Valid commands are: reload, shutdown");
      return;
    }

    XMLSettingNode configFile;

    try {
      configFile = new XMLSettingNode(args[0]);

    } catch (Exception e) {

      System.out.println("Unable to open config file " + args[0] + "!");
      return;
    }

    String password = configFile.getString("/Config/System/RemoteManagementPassword");

    if(password == null){

      System.out.println("No remote management password found in config!");
      return;
    }

    Integer port = configFile.getInteger("/Config/System/RemoteManagementPort");

    if(port == null){

      System.out.println("No remote management port found in config!");
      return;
View Full Code Here

   * @throws IOException
   * @throws ParserConfigurationException
   */
  public static Set<String> getVariableReferenses(File file) throws SAXException, IOException, ParserConfigurationException {

    XMLSettingNode settingNode = new XMLSettingNode(file);

    List<String> tags = settingNode.getStrings("//@*[contains(.,'$')]");

    if(tags == null){
     
      return null;
    }
View Full Code Here

   * @throws IOException
   * @throws ParserConfigurationException
   */
  public static List<String> getDeclaredVariables(File file) throws SAXException, IOException, ParserConfigurationException {

    XMLSettingNode settingNode = new XMLSettingNode(file);

    return settingNode.getStrings("//variable/@name");
  }
View Full Code Here

      //DOMConfigurator.configure(logurl);
      //DOMConfigurator.configure("conf/log4j.xml");

    log.info(VERSION + " starting...");

    XMLSettingNode configFile;

    try {
      log.debug("Parsing config file..." + configFilePath);
      configFile = new XMLSettingNode(configFilePath);

    } catch (Exception e) {

      log.fatal("Unable to open config file " + configFilePath + ", aborting startup!");
      System.out.println("Unable to open config file " + configFilePath + ", aborting startup!");
      return;
    }

    List<Integer> ports = configFile.getIntegers("/Config/System/Port");

    if (ports.isEmpty()) {

      log.debug("No ports found in config file " + configFilePath + ", using default port 53");
      ports.add(new Integer(53));
    }

    List<InetAddress> addresses = new ArrayList<InetAddress>();
    List<String> addressStrings = configFile.getStrings("/Config/System/Address");

    if (addressStrings == null || addressStrings.isEmpty()) {

      log.debug("No addresses found in config, listening on all addresses (0.0.0.0)");
      addresses.add(Address.getByAddress("0.0.0.0"));

    } else {

      for (String addressString : addressStrings) {

        try {

          addresses.add(Address.getByAddress(addressString));

        } catch (UnknownHostException e) {

          log.error("Invalid address " + addressString + " specified in config file, skipping address " + e);
        }
      }

      if (addresses.isEmpty()) {

        log.fatal("None of the " + addressStrings.size() + " addresses specified in the config file are valid, aborting startup!\n" + "Correct the addresses or remove them from the config file if you want to listen on all interfaces.");
            return;
      }
    }

    Integer tcpThreadPoolSize = configFile.getInteger("/Config/System/TCPThreadPoolSize");

    if (tcpThreadPoolSize != null) {

      log.debug("Setting TCP thread pool size to " + tcpThreadPoolSize);
      this.tcpThreadPoolSize = tcpThreadPoolSize;
    }

    Integer tcpThreadPoolShutdownTimeout = configFile.getInteger("/Config/System/TCPThreadPoolShutdownTimeout");

    if (tcpThreadPoolShutdownTimeout != null) {

      log.debug("Setting TCP thread pool shutdown timeout to " + tcpThreadPoolSize + " seconds");
      this.tcpThreadPoolShutdownTimeout = tcpThreadPoolShutdownTimeout;
    }

    Integer udpThreadPoolSize = configFile.getInteger("/Config/System/UDPThreadPoolSize");

    if (udpThreadPoolSize != null) {

      log.debug("Setting UDP thread pool size to " + udpThreadPoolSize);
      this.udpThreadPoolSize = udpThreadPoolSize;
    }

    Integer udpThreadPoolShutdownTimeout = configFile.getInteger("/Config/System/UDPThreadPoolShutdownTimeout");

    if (udpThreadPoolShutdownTimeout != null) {

      log.debug("Setting UDP thread pool shutdown timeout to " + udpThreadPoolSize + " seconds");
      this.udpThreadPoolShutdownTimeout = udpThreadPoolShutdownTimeout;
    }

    this.remotePassword = configFile.getString("/Config/System/RemoteManagementPassword");

    log.debug("Remote management password set to " + remotePassword);

    this.remotePort = configFile.getInteger("/Config/System/RemoteManagementPort");

    log.debug("Remote management port set to " + remotePort);

    Integer axfrTimeout = configFile.getInteger("/Config/System/AXFRTimeout");

    if (axfrTimeout != null) {

      log.debug("Setting AXFR timeout to " + axfrTimeout);
      this.axfrTimeout = axfrTimeout;
    }

    // TODO TSIG stuff

    List<XMLSettingNode> zoneProviderElements = configFile.getSettings("/Config/ZoneProviders/ZoneProvider");

    for (XMLSettingNode settingNode : zoneProviderElements) {

      String name = settingNode.getString("Name");
View Full Code Here

      System.out.println("Usage EagleManagerClient config host command");
      System.out.println("Valid commands are: reload, shutdown");
      return;
    }

    XMLSettingNode configFile;

    try {
      configFile = new XMLSettingNode(args[0]);

    } catch (Exception e) {

      System.out.println("Unable to open config file " + args[0] + "!");
      return;
    }

    String password = configFile.getString("/Config/System/RemoteManagementPassword");

    if(password == null){

      System.out.println("No remote management password found in config!");
      return;
    }

    Integer port = configFile.getInteger("/Config/System/RemoteManagementPort");

    if(port == null){

      System.out.println("No remote management port found in config!");
      return;
View Full Code Here

TOP

Related Classes of se.unlogic.standardutils.settings.XMLSettingNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.