コード例 #1
0
ファイル: Config.java プロジェクト: deuxksy/deuxksy
 static {
   DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
   builder.setFile(new File("config.xml"));
   try {
     CONFIG = builder.getConfiguration(true);
   } catch (ConfigurationException exception) {
     LOG.error(exception);
   }
 }
コード例 #2
0
  private HierarchicalConfiguration setUpConfiguration(
      boolean auto, boolean autoIP, List<String> names) {
    DefaultConfigurationBuilder configuration = new DefaultConfigurationBuilder();

    configuration.addProperty("autodetect", auto);
    configuration.addProperty("autodetectIP", autoIP);
    for (String name : names) {
      configuration.addProperty("domainnames.domainname", name);
    }
    return configuration;
  }
コード例 #3
0
  @BeforeClass
  public static void initFiles() throws FileNotFoundException, ConfigurationException {
    fXml = new File(rootDir, "tableStatus.xml");
    fTxt = new File(rootDir, "tableStatus.tex");

    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
    config = builder.getConfiguration(false);
    config.setProperty(UtilsDocumentation.keyBaseLatexDir, "target");

    translations = JaxbUtil.loadJAXB("data/xml/dummyTranslations.xml", Translations.class);
  }
コード例 #4
0
ファイル: ProjectConfigTest.java プロジェクト: jelycom/pss
  @Test
  public void testPropertiesConfiguration() {
    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
    try {
      System.out.println(builder.getConfigurationBasePath());
      System.out.println(
          FileSystem.getDefaultFileSystem().getFileName("pss-settings.properties").toString());
      URL locate =
          ConfigurationUtils.locate(
              "E:/study/jelyworkspace/jelypss/pss-core/target/test-classes/conf",
              "pss-settings.properties");
      builder.load(locate);
      Configuration config = builder.getConfiguration();
      config.setProperty("1123", "asdf");

    } catch (ConfigurationException e) {
      e.printStackTrace();
    }
  }
コード例 #5
0
  public CombinedConfiguration loadConfig() throws ConfigurationException {

    if (combinedConfig == null) {
      combinedConfig = new FileSystemResource(DEFAULT_COMBINED_CONFIG);
    }

    CombinedConfiguration config = null;
    try {
      DefaultConfigurationBuilder builder =
          new DefaultConfigurationBuilder(combinedConfig.getFile());
      boolean load = true;
      config = builder.getConfiguration(load);
      config.setExpressionEngine(new XPathExpressionEngine());
    } catch (org.apache.commons.configuration.ConfigurationException e) {
      throw new ConfigurationException(e.getMessage(), e);
    } catch (IOException e) {
      throw new ConfigurationException(e.getMessage(), e);
    }
    return config;
  }
コード例 #6
0
  private HierarchicalConfiguration createConfig(
      Class<?> matcherClass, Class<?> mailetClass, int count) throws ConfigurationException {
    StringBuilder sb = new StringBuilder();
    sb.append("<processor state=\"" + Mail.DEFAULT + "\">");
    sb.append("<mailet match=\"")
        .append(matcherClass.getName())
        .append("=")
        .append(count)
        .append("\"")
        .append(" class=\"")
        .append(mailetClass.getName())
        .append("\">");
    sb.append("<state>test</state>");
    sb.append("</mailet>");

    sb.append("</processor>");

    DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
    builder.load(new ByteArrayInputStream(sb.toString().getBytes()));
    return builder;
  }