Package org.apache.uima.util.impl

Examples of org.apache.uima.util.impl.Settings_impl


      // load settings explicitly, ignoring system property
      System.setProperty("UimaExternalOverrides", "missing file")// Will fail if used
      in = new XMLInputSource(JUnitExtension.getFile("TextAnalysisEngineImplTest/AggregateWithExternalOverrides.xml"));
      desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in);
      Map<String,Object> additionalParams = new HashMap<String,Object>();
      Settings extSettings = new Settings_impl();
      FileInputStream fis = new FileInputStream(new File(resDir,"testExternalOverride2.settings"));
      extSettings.load(fis);
      fis.close();
      additionalParams.put(Resource.PARAM_EXTERNAL_OVERRIDE_SETTINGS, extSettings);
      UIMAFramework.produceAnalysisEngine(desc, additionalParams);
      System.clearProperty("UimaExternalOverrides");
     
View Full Code Here


      // load settings explicitly, ignoring system property
      System.setProperty("UimaExternalOverrides", "missing file")// Will fail if used
      in = new XMLInputSource(JUnitExtension.getFile("TextAnalysisEngineImplTest/AggregateWithExternalOverrides.xml"));
      desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in);
      Map<String,Object> additionalParams = new HashMap<String,Object>();
      Settings extSettings = new Settings_impl();
      FileInputStream fis = new FileInputStream(new File(resDir,"testExternalOverride2.settings"));
      extSettings.load(fis);
      fis.close();
      additionalParams.put(Resource.PARAM_EXTERNAL_OVERRIDE_SETTINGS, extSettings);
      UIMAFramework.produceAnalysisEngine(desc, additionalParams);
      System.clearProperty("UimaExternalOverrides");
     
View Full Code Here

                    (Settings) aAdditionalParams.get(Resource.PARAM_EXTERNAL_OVERRIDE_SETTINGS);
      if (externalOverrides != null) {
        mUimaContextAdmin.setExternalOverrides(externalOverrides);
      } else {
        if (mUimaContextAdmin.getExternalOverrides() == null) {
          externalOverrides = new Settings_impl();
          try {
            externalOverrides.loadSystemDefaults();
          } catch (ResourceConfigurationException e) {
            throw new ResourceInitializationException(ResourceInitializationException.ERROR_INITIALIZING_FROM_DESCRIPTOR,
                    new Object[] { name, metadata.getSourceUrlString() }, e);
View Full Code Here

      }
      String expected = "[]";
      Assert.assertEquals(expected, actual);
     
      // Test a stand-alone settings object
      Settings testSettings = new Settings_impl();
      String lines = "foo = ${bar} \n bar : [ok \n OK] \n bad = ${missing}";
      InputStream is;
      try {
        is = new ByteArrayInputStream(lines.getBytes("UTF-8"));
        testSettings.load(is);
        is.close();
        String val = testSettings.lookUp("foo");
        Assert.assertEquals("[ok,OK]", val);
        try {
          val = testSettings.lookUp("bad");
          Assert.fail("\"bad\" should create an error");
        } catch (ResourceConfigurationException e) {
          System.err.println("Expected exception: " + e.toString());
        }
      } catch (Exception e) {
View Full Code Here

      }
      String expected = "[]";
      Assert.assertEquals(expected, actual);
     
      // Test a stand-alone settings object
      Settings testSettings = new Settings_impl();
      String lines = "foo = ${bar} \n bar : [ok \n OK] \n bad = ${missing}";
      InputStream is;
      try {
        is = new ByteArrayInputStream(lines.getBytes("UTF-8"));
        testSettings.load(is);
        is.close();
        String val = testSettings.lookUp("foo");
        Assert.assertEquals("[ok,OK]", val);
        try {
          val = testSettings.lookUp("bad");
          Assert.fail("\"bad\" should create an error");
        } catch (ResourceConfigurationException e) {
          System.err.println("Expected exception: " + e.toString());
        }
      } catch (Exception e) {
View Full Code Here

      // load settings explicitly, ignoring system property
      System.setProperty("UimaExternalOverrides", "missing file")// Will fail if used
      in = new XMLInputSource(JUnitExtension.getFile("TextAnalysisEngineImplTest/AggregateWithExternalOverrides.xml"));
      desc = UIMAFramework.getXMLParser().parseAnalysisEngineDescription(in);
      Map<String,Object> additionalParams = new HashMap<String,Object>();
      Settings extSettings = new Settings_impl();
      FileInputStream fis = new FileInputStream(new File(resDir,"testExternalOverride2.settings"));
      extSettings.load(fis);
      fis.close();
      additionalParams.put(Resource.PARAM_EXTERNAL_OVERRIDE_SETTINGS, extSettings);
      UIMAFramework.produceAnalysisEngine(desc, additionalParams);
      System.clearProperty("UimaExternalOverrides");
     
View Full Code Here

                    (Settings) aAdditionalParams.get(Resource.PARAM_EXTERNAL_OVERRIDE_SETTINGS);
      if (externalOverrides != null) {
        mUimaContextAdmin.setExternalOverrides(externalOverrides);
      } else {
        if (mUimaContextAdmin.getExternalOverrides() == null) {
          externalOverrides = new Settings_impl();
          try {
            externalOverrides.loadSystemDefaults();
          } catch (ResourceConfigurationException e) {
            throw new ResourceInitializationException(ResourceInitializationException.ERROR_INITIALIZING_FROM_DESCRIPTOR,
                    new Object[] { name, metadata.getSourceUrlString() }, e);
View Full Code Here

TOP

Related Classes of org.apache.uima.util.impl.Settings_impl

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.