Package com.clarkparsia.empire.config

Examples of com.clarkparsia.empire.config.EmpireConfiguration


        else {
          aGeneralConfig.put(aChild.getNodeName(), aChild.getTextContent());
        }
      }

      EmpireConfiguration aConfig = new EmpireConfiguration(aGeneralConfig, aUnitConfig);
      aConfig.setAnnotationProvider(aProvider);

      return aConfig;
    }
    catch (ParserConfigurationException e) {
      throw new IOException(e);
View Full Code Here


   * Create a new DefaultEmpireModule
   */
  public DefaultEmpireModule() {
    mConfig = readConfiguration();
    if (mConfig == null) {
      mConfig = new EmpireConfiguration();
    }
  }
View Full Code Here

    }
    catch (FileNotFoundException e) {
      LOGGER.error("Count not find config file: " + e.getMessage());
    }

    EmpireConfiguration aConfig = null;

    if (aConfigStream == null) {
      LOGGER.warn("No configuration found or specified, Empire may not start or function correctly.");
      return null;
    }
View Full Code Here

    for (Object aOrigKey : Collections2.filter(aProps.keySet(), new UnitFilterPredicate())) {
      aGeneralConfig.put(aOrigKey.toString(), aProps.getProperty(aOrigKey.toString()));
    }

    EmpireConfiguration aConfig = new EmpireConfiguration(aGeneralConfig, aUnitConfig);

    if (aGeneralConfig.containsKey(KEY_ANNOTATION_PROVIDER)) {
      try {
        @SuppressWarnings("unchecked")
        Class<EmpireAnnotationProvider> aClass = (Class<EmpireAnnotationProvider>) BeanReflectUtil.loadClass(aGeneralConfig.get(KEY_ANNOTATION_PROVIDER));

        aConfig.setAnnotationProvider(aClass);
      }
      catch (ClassNotFoundException e) {
        LOGGER.warn("Annotation provider implementation '{}' cannot be found, please check your classpath.", aGeneralConfig.get(KEY_ANNOTATION_PROVIDER));
      }
      catch (ClassCastException e) {
View Full Code Here

         "1.files = foo, bar, baz\n";
  }

  @Test
  public void testReader() throws IOException, EmpireException {
    EmpireConfiguration aConfig = mReader.read(new StringReader(getConfigFile()));

    assertTrue(aConfig != null);

    assertTrue(aConfig.getAnnotationProvider() != null);
    assertEquals(aConfig.getAnnotationProvider(), PropertiesAnnotationProvider.class);

    assertTrue(aConfig.hasUnit("context1"));
    assertTrue(aConfig.hasUnit("context2"));
    assertFalse(aConfig.hasUnit("context3"));

    assertEquals(aConfig.get("foo"), "bar");
    assertEquals(aConfig.get("baz"), "biz");
    assertTrue(aConfig.get("cheese") == null);

    assertEquals(aConfig.getUnitConfig("context1").get("factory"),"com.clarkparsia.empire.sesame.RepositoryDataSourceFactory");
    assertEquals(aConfig.getUnitConfig("context1").get("url"), "http://localhost:8080/openrdf-sesame/");
    assertEquals(aConfig.getUnitConfig("context1").get("repo"), "mem-rdf-db");

    assertEquals(aConfig.getUnitConfig("context2").get("factory"), "jena-test");
    assertEquals(aConfig.getUnitConfig("context2").get("files"), "foo, bar, baz");
  }
View Full Code Here

    aGeneralConfig.put("b", "bar");
    aGeneralConfig.put("c", "baz");

    aUnitsConfig.put("unit1", aUnit);

    EmpireConfiguration aConfig = new EmpireConfiguration(aGeneralConfig, aUnitsConfig);

    aConfig.setAnnotationProvider(EmpireAnnotationProvider.class);

    assertEquals(aConfig.getAnnotationProvider(), EmpireAnnotationProvider.class);

    assertEquals(aConfig.get("a"), aGeneralConfig.get("a"));
    assertEquals(aConfig.get("b"), aGeneralConfig.get("b"));
    assertTrue(aConfig.get("d") == null);

    assertTrue(aConfig.hasUnit("unit1"));
    assertFalse(aConfig.hasUnit("not a unit"));

    assertEquals(aConfig.getUnitConfig("unit1"), aUnit);
    assertTrue(aConfig.getUnitConfig("asdf") == null);
   
    // TODO: test binding installation
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.empire.config.EmpireConfiguration

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.