Package org.apache.uima.util

Examples of org.apache.uima.util.Logger


      String parameter)
      throws ResourceInitializationException {
   
    Object value = context.getConfigParameterValue(parameter);
   
    Logger logger = context.getLogger();
   
    if (logger.isLoggable(Level.INFO)) {
      logger.log(Level.INFO, parameter + " = " +
          (value != null ? value.toString() : "not set"));
    }
   
    return value;
  }
View Full Code Here


    Dictionary dictionary = null;

    if (dictionaryName != null) {

      Logger logger = context.getLogger();

      try {

        InputStream dictIn = AnnotatorUtil.getOptionalResourceAsStream(context,
            dictionaryName);

        if (dictIn == null) {
          String message = "The dictionary file " + dictionaryName
              + " does not exist!";

          if (logger.isLoggable(Level.WARNING)) {
            logger.log(Level.WARNING, message);
          }

          return null;
        }

        dictionary = new Dictionary(dictIn);

      } catch (IOException e) {
        // if this fails just print error message and continue
        String message = "IOException during dictionary reading, "
            + "running without dictionary: " + e.getMessage();

        if (logger.isLoggable(Level.WARNING)) {
          logger.log(Level.WARNING, message);
        }
      }

      return dictionary;
    } else
View Full Code Here

  private static Object getOptionalParameter(UimaContext context,
      String parameter) {
   
    Object value =  context.getConfigParameterValue(parameter);

    Logger logger = context.getLogger();
   
    if (logger.isLoggable(Level.INFO)) {
      logger.log(Level.INFO, parameter + " = " +
          (value != null ? value.toString() : "not set"));
    }
   
    return value;
  }
View Full Code Here

 
  Dictionary dictionary = null;

  if (dictionaryName != null) {

      Logger logger = context.getLogger();

      try {

    InputStream dictIn = CasConsumerUtil.getOptionalResourceAsStream(context,
      dictionaryName);

    if (dictIn == null) {
      String message = "The dictionary file " + dictionaryName +
      " does not exist!";

      if (logger.isLoggable(Level.WARNING)) {
          logger.log(Level.WARNING, message);
      }
     
      return null;
    }
   
    dictionary = new Dictionary(dictIn);

      } catch (IOException e) {
      // if this fails just print error message and continue
      String message = "IOException during dictionary reading, "
        + "running without dictionary: " + e.getMessage();
 
      if (logger.isLoggable(Level.WARNING)) {
          logger.log(Level.WARNING, message);
      }
      }

      return dictionary;
  } else
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.apache.uima.jcas.jcasgen_gen.IError#newError(int, java.lang.String)
     */
    public void newError(int severity, String message, Exception ex) {
      Logger log = UIMAFramework.getLogger();
      log.log(logLevels[severity], "JCasGen: " + message); //$NON-NLS-1$
      System.out.println(Messages.getString("MultiPageEditor.JCasGenErr") //$NON-NLS-1$
              + message);
      if (null != ex)
        ex.printStackTrace();
      if (IError.WARN < severity) {
View Full Code Here

      // declares any input or output sofas in its capabilities)
      mSofaAware = getProcessingResourceMetaData().isSofaAware();
     
      // Set Logger, to enable component-specific logging configuration
      UimaContextAdmin uimaContext = getUimaContextAdmin();
      Logger logger = UIMAFramework.getLogger(mFlowController.getClass());
      logger.setResourceManager(this.getResourceManager());
      uimaContext.setLogger(logger);     
     
      // initialize FlowController
      mFlowController.initialize(getFlowControllerContext());
View Full Code Here

    if (getContext().getConfigParameterValue("FinalCount") != null) {
      finalCount = ((Integer) getContext().getConfigParameterValue("FinalCount")).intValue();
    }

    // write log messages
    Logger logger = getContext().getLogger();
    logger.log(Level.CONFIG, "NAnnotator initialized");
  }
View Full Code Here

        resMgr = UIMAFramework.newDefaultResourceManager();
      }

      // get a Logger for this class and set its ResourceManager so that
      // UIMA extension ClassLoader is used to locate message digests.
      Logger logger = UIMAFramework.getLogger(this.getClass());
      logger.setResourceManager(resMgr);
     
      ConfigurationManager configMgr = null;
      if (aAdditionalParams != null) {
        configMgr = (ConfigurationManager)aAdditionalParams.get(PARAM_CONFIG_MANAGER);
      }
      if (configMgr == null) {
        configMgr = UIMAFramework.newConfigurationManager();
      }

      // create and initialize UIMAContext
      mUimaContextAdmin = UIMAFramework.newUimaContext(logger, resMgr, configMgr);

    } else {
      // configure logger of the UIMA context so that class-specific logging
      // levels and UIMA extension classLoader will work
      // get a Logger for this class and set its ResourceManager so that
      // UIMA extension ClassLoader is used to locate message digests.
      Logger logger = UIMAFramework.getLogger(this.getClass());
      logger.setResourceManager(mUimaContextAdmin.getResourceManager());
      mUimaContextAdmin.setLogger(logger);
    }

    // if this is a local resource (instantiated from a ResourceCreationSpecifier),
    // initialize the ResourceManager and UIMA Context.
View Full Code Here

      super.initialize(aSpecifier, aAdditionalParams);
      ProcessingResourceMetaData md = (ProcessingResourceMetaData) mDescription.getMetaData();

      // Get logger for this class
      Logger logger = getLogger();
      logger.logrb(Level.CONFIG, CLASS_NAME.getName(), "initialize", LOG_RESOURCE_BUNDLE,
              "UIMA_analysis_engine_init_begin__CONFIG", md.getName());

      // Normalize language codes. Need to do this since a wide variety of
      // spellings are acceptable according to ISO.
      normalizeIsoLangCodes(md);

      // clone this metadata and assign a UUID if not already present
      ResourceMetaData mdCopy = (ResourceMetaData) md.clone();

      if (mdCopy.getUUID() == null) {
        mdCopy.setUUID(UUIDGenerator.generate());
      }
      setMetaData(mdCopy);

      // validate the AnalysisEngineDescription and throw a
      // ResourceInitializationException if there is a problem
      mDescription.validate(getResourceManager());

      // Read parameters from the aAdditionalParams map.
      if (aAdditionalParams == null) {
        aAdditionalParams = Collections.emptyMap();
      }
      // determine if verification mode is on
      mVerificationMode = aAdditionalParams.containsKey(PARAM_VERIFICATION_MODE);

      // determine if this component is Sofa-aware (based on whether it
      // declares any input or output sofas in its capabilities)
      mSofaAware = getAnalysisEngineMetaData().isSofaAware();

      initializeAnalysisComponent(aAdditionalParams);

      // Initialize ResultSpec based on output capabilities
      // TODO: should only do this for outermost AE
      resetResultSpecificationToDefault();

      logger.logrb(Level.CONFIG, CLASS_NAME.getName(), "initialize", LOG_RESOURCE_BUNDLE,
              "UIMA_analysis_engine_init_successful__CONFIG", md.getName());
      return true;
    } catch (ResourceConfigurationException e) {
      throw new ResourceInitializationException(
              ResourceInitializationException.ERROR_INITIALIZING_FROM_DESCRIPTOR, new Object[] {
View Full Code Here

                  annotatorClassName, mDescription.getSourceUrlString() }, e);
    }

    // Set Logger, to enable annotator-specific logging
    UimaContextAdmin uimaContext = getUimaContextAdmin();
    Logger logger = UIMAFramework.getLogger(annotatorClass);
    logger.setResourceManager(this.getResourceManager());
    uimaContext.setLogger(logger);

    // initialize AnalysisComponent
    try {
      mAnalysisComponent.initialize(getUimaContext());
View Full Code Here

TOP

Related Classes of org.apache.uima.util.Logger

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.