当前位置: 首页>>代码示例>>Java>>正文


Java InterpretationContext类代码示例

本文整理汇总了Java中ch.qos.logback.core.joran.spi.InterpretationContext的典型用法代码示例。如果您正苦于以下问题:Java InterpretationContext类的具体用法?Java InterpretationContext怎么用?Java InterpretationContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InterpretationContext类属于ch.qos.logback.core.joran.spi包,在下文中一共展示了InterpretationContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
@Override
public void begin(InterpretationContext ec, String name, Attributes attributes) {

  // See LBCLASSIC-225 (the system property is looked up first. Thus, it overrides
  // the equivalent property in the config file. This reversal of scope priority is justified
  // by the use case: the admin trying to chase rogue config file
  String debugAttrib = System.getProperty(DEBUG_SYSTEM_PROPERTY_KEY);
  if (debugAttrib == null) {
    debugAttrib =  attributes.getValue(INTERNAL_DEBUG_ATTR);
  }

  if (OptionHelper.isEmpty(debugAttrib) || debugAttrib.equals("false") || debugAttrib.equals("null")) {
    addInfo(INTERNAL_DEBUG_ATTR + " attribute not set");
  } else {
    OnConsoleStatusListener.addNewInstanceToContext(context);
  }

  new ContextUtil(context).addHostNameAsProperty();

  // the context is appender attachable, so it is pushed on top of the stack
  ec.pushObject(getContext());
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:23,代码来源:ConfigurationAction.java

示例2: getInputURL

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
URL getInputURL(InterpretationContext ec, Attributes attributes) {
  String fileAttribute = attributes.getValue(FILE_ATTR);
  String urlAttribute = attributes.getValue(URL_ATTR);
  String resourceAttribute = attributes.getValue(RESOURCE_ATTR);

  if (!OptionHelper.isEmpty(fileAttribute)) {
    this.attributeInUse = ec.subst(fileAttribute);
    return filePathAsURL(attributeInUse);
  }

  if (!OptionHelper.isEmpty(urlAttribute)) {
    this.attributeInUse = ec.subst(urlAttribute);
    return attributeToURL(attributeInUse);
  }

  if (!OptionHelper.isEmpty(resourceAttribute)) {
    this.attributeInUse = ec.subst(resourceAttribute);
    return resourceAsURL(attributeInUse);
  }
  // given previous checkAttributes() check we cannot reach this line
  throw new IllegalStateException("A URL stream should have been returned");

}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:24,代码来源:IncludeAction.java

示例3: end

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
/**
 * Once the children elements are also parsed, now is the time to activate the
 * shutdown hook options.
 */
@Override
public void end(InterpretationContext ic, String name) throws ActionException {
  if (inError) {
    return;
  }
    
  Object o = ic.peekObject();
  if (o != hook) {
    addWarn("The object at the of the stack is not the hook pushed earlier.");
  } else {
    ic.popObject();
      
    Thread hookThread = new Thread(hook, "Logback shutdown hook [" + context.getName() + "]");
        
    context.putObject(CoreConstants.SHUTDOWN_HOOK_THREAD, hookThread);
    Runtime.getRuntime().addShutdownHook(hookThread);      
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:23,代码来源:ShutdownHookAction.java

示例4: end

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
/**
 * Now property definer is initialized by all properties and we can put
 * property value to context
 */
public void end(InterpretationContext ec, String name) {
  if (inError) {
    return;
  }

  Object o = ec.peekObject();

  if (o != definer) {
    addWarn("The object at the of the stack is not the property definer for property named ["
        + propertyName + "] pushed earlier.");
  } else {
    addInfo("Popping property definer for property named [" + propertyName
        + "] from the object stack");
    ec.popObject();
    // let's put defined property and value to context but only if it is
    // not null
    String propertyValue = definer.getPropertyValue();
    if(propertyValue != null) {
      ActionUtil.setProperty(ec, propertyName, propertyValue, scope);
    }
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:27,代码来源:DefinePropertyAction.java

示例5: end

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
/**
 * Once the children elements are also parsed, now is the time to activate the
 * appender options.
 */
public void end(InterpretationContext ec, String name) {
  if (inError) {
    return;
  }

  if (appender instanceof LifeCycle) {
    ((LifeCycle) appender).start();
  }

  Object o = ec.peekObject();

  if (o != appender) {
    addWarn("The object at the of the stack is not the appender named ["
        + appender.getName() + "] pushed earlier.");
  } else {
    ec.popObject();
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:23,代码来源:AppenderAction.java

示例6: end

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
@Override
public void end(InterpretationContext ec, String name) throws ActionException {
  if (inError) {
    return;
  }

  Object o = ec.peekObject();

  if (o != fruitShell) {
    addWarn(
      "The object at the of the stack is not the fruitShell named ["
      + fruitShell.getName() + "] pushed earlier.");
  } else {
    addInfo(
      "Popping fruitSHell named [" + fruitShell.getName()
      + "] from the object stack");
    ec.popObject();
    FruitContext fruitContext = (FruitContext) ec.getContext();
    fruitContext.addFruitShell(fruitShell);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:22,代码来源:FruitShellAction.java

示例7: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException {
  
  String exType = attributes.getValue(EXCEPTION_TYPE);
  type = RUNTIME_EDXCEPTION;
  if("ActionException".equals(exType)) {
    type = ACTION_EXCEPTION;
  }
  
  switch(type) {
  case ACTION_EXCEPTION: 
    throw new ActionException();
  default:
    throw new IllegalStateException("bad begin");
  }
 
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:17,代码来源:BadBeginAction.java

示例8: fetchInteger

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
/**
 * Pop the Integer object at the top of the stack. This code illustrates usage
 * of Joran's error handling paradigm.
 */
int fetchInteger(InterpretationContext ic) {
  int result = 0;

  try {
    Object o1 = ic.popObject();

    if (o1 instanceof Integer) {
      result = ((Integer) o1).intValue();
    } else {
      String errMsg = "Object [" + o1
          + "] currently at the top of the stack is not an integer.";
      ic.addError(errMsg);
      throw new IllegalArgumentException(errMsg);
    }
  } catch (EmptyStackException ese) {
    ic.addError("Expecting an integer on the execution stack.");
    throw ese;
  }
  return result;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:25,代码来源:MultiplyAction.java

示例9: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
public void begin(InterpretationContext ic, String name, Attributes attributes) {
  String valueStr = attributes.getValue(VALUE_ATR);

  if (OptionHelper.isEmpty(valueStr)) {
    ic.addError("The literal action requires a value attribute");
    return;
  }

  try {
    Integer i = Integer.valueOf(valueStr);
    ic.pushObject(i);
  } catch (NumberFormatException nfe) {
    ic.addError("The value [" + valueStr
        + "] could not be converted to an Integer", nfe);
    throw nfe;
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:18,代码来源:LiteralAction.java

示例10: fetchInteger

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
/**
 * Pop the Integer object at the top of the stack.
 * This code also  illustrates usage of Joran's error handling paradigm. 
 */
int fetchInteger(InterpretationContext ic) {
  int result = 0;

  try {
    // Pop the object at the top of the interpretation context's stack.
    Object o1 = ic.popObject();

    if (o1 instanceof Integer) {
      result = ((Integer) o1).intValue();
    } else {
      String errMsg =
        "Object [" + o1
        + "] currently at the top of the stack is not an integer.";
      ic.addError(errMsg);
      throw new IllegalArgumentException(errMsg);
    }
  } catch (EmptyStackException ese) {
    ic.addError(("Expecting an integer on the execution stack."));
    throw ese;
  }
  return result;
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:27,代码来源:AddAction.java

示例11: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
public void begin(InterpretationContext ec, String name, Attributes attributes) {
  Object o = ec.peekObject();

  if (!(o instanceof Logger)) {
    inError = true;
    addError("For element <level>, could not find a logger at the top of execution stack.");
    return;
  }

  Logger l = (Logger) o;

  String loggerName = l.getName();

  String levelStr = ec.subst(attributes.getValue(ActionConst.VALUE_ATTR));
  //addInfo("Encapsulating logger name is [" + loggerName
  //    + "], level value is  [" + levelStr + "].");

  if (ActionConst.INHERITED.equalsIgnoreCase(levelStr) || ActionConst.NULL.equalsIgnoreCase(levelStr)) {
    l.setLevel(null);
  } else {
    l.setLevel(Level.toLevel(levelStr, Level.DEBUG));
  }

  addInfo(loggerName + " level set to " + l.getLevel());
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:26,代码来源:LevelAction.java

示例12: end

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
@Override
public void end(InterpretationContext ic, String name)
    throws ActionException {
  
  if (inError) return;
  
  ic.getContext().register(receiver);
  receiver.start();
  
  Object o = ic.peekObject();
  if (o != receiver) {
    addWarn("The object at the of the stack is not the remote " +
    		"pushed earlier.");
  } else {
    ic.popObject();
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:18,代码来源:ReceiverAction.java

示例13: processScanAttrib

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
void processScanAttrib(InterpretationContext ic, Attributes attributes) {
  String scanAttrib = ic.subst(attributes.getValue(SCAN_ATTR));
  if (!OptionHelper.isEmpty(scanAttrib)
          && !"false".equalsIgnoreCase(scanAttrib)) {
    ReconfigureOnChangeFilter rocf = new ReconfigureOnChangeFilter();
    rocf.setContext(context);
    String scanPeriodAttrib = ic.subst(attributes.getValue(SCAN_PERIOD_ATTR));
    if (!OptionHelper.isEmpty(scanPeriodAttrib)) {
      try {
        Duration duration = Duration.valueOf(scanPeriodAttrib);
        rocf.setRefreshPeriod(duration.getMilliseconds());
        addInfo("Setting ReconfigureOnChangeFilter scanning period to "
                + duration);
      } catch (NumberFormatException nfe) {
        addError("Error while converting [" + scanAttrib + "] to long", nfe);
      }
    }
    rocf.start();
    LoggerContext lc = (LoggerContext) context;
    addInfo("Adding ReconfigureOnChangeFilter as a turbo filter");
    lc.addTurboFilter(rocf);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:24,代码来源:ConfigurationAction.java

示例14: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
@Override
public void begin(InterpretationContext ic, String elementName, Attributes attributes)
		throws ActionException {
	String name = attributes.getValue(NAME_ATTRIBUTE);
	String source = attributes.getValue(SOURCE_ATTRIBUTE);
	Scope scope = ActionUtil.stringToScope(attributes.getValue(SCOPE_ATTRIBUTE));
	String defaultValue = attributes.getValue(DEFAULT_VALUE_ATTRIBUTE);
	if (OptionHelper.isEmpty(name) || OptionHelper.isEmpty(source)) {
		addError(
				"The \"name\" and \"source\" attributes of <springProperty> must be set");
	}
	ActionUtil.setProperty(ic, name, getValue(source, defaultValue), scope);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:SpringPropertyAction.java

示例15: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入依赖的package包/类
@Override
public void begin(InterpretationContext ic, String name, Attributes attributes)
		throws ActionException {
	this.depth++;
	if (this.depth != 1) {
		return;
	}
	ic.pushObject(this);
	this.acceptsProfile = acceptsProfiles(ic, attributes);
	this.events = new ArrayList<SaxEvent>();
	ic.addInPlayListener(this);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:SpringProfileAction.java


注:本文中的ch.qos.logback.core.joran.spi.InterpretationContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。