Package rocket.logging.util

Examples of rocket.logging.util.LoggingPropertyReader


   * @return The appropriate implementation
   *
   * TODO ROCKET When upgrading from GWT 1.5 reapply changes
   */
  protected LoggerOptimiser getLoggerOptimiser(final JProgram program, final PropertyOracle propertyOracle, final TreeLogger logger) {
    final LoggingPropertyReader reader = new LoggingPropertyReader() {

      @Override
      protected String getPropertyValue() {
        try {
          return propertyOracle.getPropertyValue(logger, this.getPropertyName());
        } catch (final BadPropertyValueException badPropertyValueException) {
          throw new RuntimeException(badPropertyValueException);
        }
      }

      @Override
      protected void throwInvalidPropertyValue(final String propertyValue) {
        throw new RuntimeException("Invalid " + this.getPropertyName() + " value of \"" + propertyValue + "\" encountered.");
      }

      @Override
      protected Object handleDisableLoggingValue() {
        final NoneLoggingFactoryGetLoggerOptimiser none = new NoneLoggingFactoryGetLoggerOptimiser();
        none.setProgram(program);
        none.setGetLogger(program.getLoggerFactoryGetLogger());

        return none;
      }

      @Override
      protected Object handleEnableLoggingValue() {
        final LoggingLevelByNameAssigner loggingFactory = new LoggingLevelByNameAssigner();
        loggingFactory.setProgram(program);
        loggingFactory.setGetLogger(program.getLoggerFactoryGetLogger());

        loggingFactory.setLoggingFactoryConfig(this.createPropertiesFileLoggingConfig());

        return loggingFactory;
      }
    };

    return (LoggerOptimiser) reader.readProperty();
  }
View Full Code Here


   * permutation is including or excluding logging statements.
   *
   * @return A LoggingFactoryConfig
   */
  protected LoggingFactoryConfig getLoggingFactoryConfig() {
    final LoggingPropertyReader reader = new LoggingPropertyReader() {
      @Override
      protected String getPropertyValue() {
        return LoggerFactoryGenerator.this.getGeneratorContext().getProperty(this.getPropertyName());
      }

      @Override
      protected void throwInvalidPropertyValue(final String propertyValue) {
        throw new RuntimeException("Invalid " + this.getPropertyName() + " value of \"" + propertyValue + "\" encountered.");
      }

      @Override
      protected Object handleDisableLoggingValue() {
        return createNoneLoggingFactoryConfig();
      }

      protected NoneLoggingFactoryConfig createNoneLoggingFactoryConfig() {
        return new NoneLoggingFactoryConfig();
      }

      protected Object handleEnableLoggingValue() {
        return this.createPropertiesFileLoggingConfig();
      }
    };

    return (LoggingFactoryConfig) reader.readProperty();
  }
View Full Code Here

TOP

Related Classes of rocket.logging.util.LoggingPropertyReader

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.