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


Java InterpretationContext.pushObject方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: begin

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

  IfState state = new IfState();
  boolean emptyStack = stack.isEmpty();
  stack.push(state);

  if(!emptyStack) {
    return;
  }
  
  ic.pushObject(this);
  if(!EnvUtil.isJaninoAvailable()) {
     addError(MISSING_JANINO_MSG);
     addError(MISSING_JANINO_SEE);
     return;
   }

  state.active = true;
  Condition condition = null;
  String conditionAttribute = attributes.getValue(CONDITION_ATTR);


  if (!OptionHelper.isEmpty(conditionAttribute)) {
    conditionAttribute = OptionHelper.substVars(conditionAttribute, ic, context);
    PropertyEvalScriptBuilder pesb = new PropertyEvalScriptBuilder(ic);
    pesb.setContext(context);
    try {
      condition = pesb.build(conditionAttribute);
    } catch (Exception e) {
      addError("Failed to parse condition ["+conditionAttribute+"]", e);
    }
   
    if(condition!=null) {
      state.boolResult = condition.evaluate();
    }
    
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:41,代码来源:IfAction.java

示例5: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException {
  inError = false;
  String className = attributes.getValue(CLASS_ATTRIBUTE);
  if (OptionHelper.isEmpty(className)) {
    addError("Missing class name for statusListener. Near ["
            + name + "] line " + getLineNumber(ec));
    inError = true;
    return;
  }

  try {
    statusListener = (StatusListener) OptionHelper.instantiateByClassName(
            className, StatusListener.class, context);
    ec.getContext().getStatusManager().add(statusListener);
    if (statusListener instanceof ContextAware) {
      ((ContextAware) statusListener).setContext(context);
    }
    addInfo("Added status listener of type [" + className + "]");
    ec.pushObject(statusListener);
  } catch (Exception e) {
    inError = true;
    addError(
            "Could not create an StatusListener of type [" + className + "].", e);
    throw new ActionException(e);
  }

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

示例6: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
 * Instantiates a shutdown hook of the given class and sets its name.
 * 
 * The hook thus generated is placed in the {@link InterpretationContext}'s
 * shutdown hook bag.
 */
@Override
public void begin(InterpretationContext ic, String name, Attributes attributes) throws ActionException {    
  hook = null;
  inError = false;
  
  String className = attributes.getValue(CLASS_ATTRIBUTE);
  if (OptionHelper.isEmpty(className)) {
    addError("Missing class name for shutdown hook. Near [" + name
        + "] line " + getLineNumber(ic));
    inError = true;
    return;
  }
    
  try {
    addInfo("About to instantiate shutdown hook of type [" + className + "]");

    hook = (ShutdownHookBase) OptionHelper.instantiateByClassName(className,
        ShutdownHookBase.class, context);
    hook.setContext(context);
        
    ic.pushObject(hook);
  }catch (Exception e) {
    inError = true;
    addError("Could not create a shutdown hook of type [" + className + "].", e);
    throw new ActionException(e);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:34,代码来源:ShutdownHookAction.java

示例7: begin

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

  inError = false;
  
  try {
    ec.pushObject(context);
  } catch (Exception oops) {
    inError = true;
    addError(
      "Could not push context", oops);
    throw new ActionException(oops);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:16,代码来源:FruitContextAction.java

示例8: begin

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

  // We are just beginning, reset variables
  fruitShell = new FruitShell();
  inError = false;
  
  try {


    fruitShell.setContext(context);

    String shellName = attributes.getValue(NAME_ATTRIBUTE);

    if (OptionHelper.isEmpty(shellName)) {
      addWarn(
        "No appender name given for fruitShell].");
    } else {
      fruitShell.setName(shellName);
      addInfo("FruitShell named as [" + shellName + "]");
    }

    ec.pushObject(fruitShell);
  } catch (Exception oops) {
    inError = true;
    addError(
      "Could not create an FruitShell", oops);
    throw new ActionException(oops);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:32,代码来源:FruitShellAction.java

示例9: begin

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

  LoggerContext loggerContext = (LoggerContext) this.context;
  root = loggerContext.getLogger(Logger.ROOT_LOGGER_NAME);

  String levelStr =  ec.subst(attributes.getValue(ActionConst.LEVEL_ATTRIBUTE));
  if (!OptionHelper.isEmpty(levelStr)) {
    Level level = Level.toLevel(levelStr);
    addInfo("Setting level of ROOT logger to " + level);
    root.setLevel(level);
  }
  ec.pushObject(root);
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:15,代码来源:RootLoggerAction.java

示例10: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
@Override
public void begin(InterpretationContext ic, String name,
    Attributes attributes) throws ActionException {
  
  String className = attributes.getValue(CLASS_ATTRIBUTE);
  if (OptionHelper.isEmpty(className)) {
    addError("Missing class name for receiver. Near [" + name
        + "] line " + getLineNumber(ic));
    inError = true;
    return;
  }

  try {
    addInfo("About to instantiate receiver of type [" + className + "]");

    receiver = (ReceiverBase) OptionHelper.instantiateByClassName(
        className, ReceiverBase.class, context);
    receiver.setContext(context);
    
    ic.pushObject(receiver);
  }
  catch (Exception ex) {
    inError = true;
    addError("Could not create a receiver of type [" + className + "].", ex);
    throw new ActionException(ex);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:28,代码来源:ReceiverAction.java

示例11: begin

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

  // See LOGBACK-527 (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 = getSystemProperty(DEBUG_SYSTEM_PROPERTY_KEY);
  if (debugAttrib == null) {
    debugAttrib = ic.subst(attributes.getValue(INTERNAL_DEBUG_ATTR));
  }

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

  processScanAttrib(ic, attributes);

  ContextUtil contextUtil = new ContextUtil(context);
  contextUtil.addHostNameAsProperty();

  if(EnvUtil.isGroovyAvailable()) {
    LoggerContext lc = (LoggerContext) context;
    contextUtil.addGroovyPackages(lc.getFrameworkPackages());
  }

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

示例12: begin

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

  inError = false;

  String className = attributes.getValue(CLASS_ATTRIBUTE);
  if (OptionHelper.isEmpty(className)) {
    addError("Mandatory \"" + CLASS_ATTRIBUTE
            + "\" attribute not set for <loggerContextListener> element");
    inError = true;
    return;
  }

  try {
    lcl = (LoggerContextListener) OptionHelper.instantiateByClassName(
            className, LoggerContextListener.class, context);

    if(lcl instanceof ContextAware) {
      ((ContextAware) lcl).setContext(context);
    }

    ec.pushObject(lcl);
    addInfo("Adding LoggerContextListener of type [" + className
            + "] to the object stack");

  } catch (Exception oops) {
    inError = true;
    addError("Could not create LoggerContextListener of type " + className + "].", oops);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:32,代码来源:LoggerContextListenerAction.java

示例13: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
 * Instantiates an evaluator of the given class and sets its name.
 */
public void begin(InterpretationContext ec, String name, Attributes attributes) {
  // Let us forget about previous errors (in this instance)
  inError = false;
  evaluator = null;

  String className = attributes.getValue(CLASS_ATTRIBUTE);
  if (OptionHelper.isEmpty(className)) {
    className = defaultClassName();
    addInfo("Assuming default evaluator class [" + className + "]");
  }

  if (OptionHelper.isEmpty(className)) {
    className = defaultClassName();
    inError = true;
    addError("Mandatory \"" + CLASS_ATTRIBUTE
        + "\" attribute not set for <evaluator>");
    return;
  }

  String evaluatorName = attributes.getValue(Action.NAME_ATTRIBUTE);
  if (OptionHelper.isEmpty(evaluatorName)) {
    inError = true;
    addError("Mandatory \"" + NAME_ATTRIBUTE
        + "\" attribute not set for <evaluator>");
    return;
  }
  try {
    evaluator = (EventEvaluator<?>) OptionHelper.instantiateByClassName(
        className, ch.qos.logback.core.boolex.EventEvaluator.class, context);

    evaluator.setContext(this.context);
    evaluator.setName(evaluatorName);

    ec.pushObject(evaluator);
    addInfo("Adding evaluator named [" + evaluatorName
        + "] to the object stack");

  } catch (Exception oops) {
    inError = true;
    addError("Could not create evaluator of type " + className + "].", oops);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:46,代码来源:AbstractEventEvaluatorAction.java

示例14: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
public void begin(InterpretationContext ec, String localName,
    Attributes attributes) {
  // LogLog.debug("in NestComponentIA begin method");
  // get the action data object pushed in isApplicable() method call
  IADataForComplexProperty actionData = (IADataForComplexProperty) actionDataStack
      .peek();

  String className = attributes.getValue(CLASS_ATTRIBUTE);
  // perform variable name substitution
  className = ec.subst(className);

  Class<?> componentClass = null;
  try {

    if (!OptionHelper.isEmpty(className)) {
      componentClass = Loader.loadClass(className, context);
    } else {
      // guess class name via implicit rules
      PropertySetter parentBean = actionData.parentBean;
      componentClass = parentBean.getClassNameViaImplicitRules(actionData
          .getComplexPropertyName(), actionData.getAggregationType(), ec
          .getDefaultNestedComponentRegistry());
    }

    if (componentClass == null) {
      actionData.inError = true;
      String errMsg = "Could not find an appropriate class for property ["
          + localName + "]";
      addError(errMsg);
      return;
    }

    if (OptionHelper.isEmpty(className)) {
      addInfo("Assuming default type [" + componentClass.getName()
          + "] for [" + localName + "] property");
    }

    actionData.setNestedComplexProperty(componentClass.newInstance());

    // pass along the repository
    if (actionData.getNestedComplexProperty() instanceof ContextAware) {
      ((ContextAware) actionData.getNestedComplexProperty())
          .setContext(this.context);
    }
    //addInfo("Pushing component [" + localName
    //    + "] on top of the object stack.");
    ec.pushObject(actionData.getNestedComplexProperty());

  } catch (Exception oops) {
    actionData.inError = true;
    String msg = "Could not create component [" + localName + "] of type ["
        + className + "]";
    addError(msg, oops);
  }

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

示例15: begin

import ch.qos.logback.core.joran.spi.InterpretationContext; //导入方法依赖的package包/类
/**
 * Instantiates an appender of the given class and sets its name.
 * 
 * The appender thus generated is placed in the {@link InterpretationContext}'s
 * appender bag.
 */
@SuppressWarnings("unchecked")
public void begin(InterpretationContext ec, String localName,
    Attributes attributes) throws ActionException {
  // We are just beginning, reset variables
  appender = null;
  inError = false;

  String className = attributes.getValue(CLASS_ATTRIBUTE);
  if (OptionHelper.isEmpty(className)) {
    addError("Missing class name for appender. Near [" + localName
        + "] line " + getLineNumber(ec));
    inError = true;
    return;
  }

  try {
    addInfo("About to instantiate appender of type [" + className + "]");

    appender = (Appender<E>) OptionHelper.instantiateByClassName(className,
        ch.qos.logback.core.Appender.class, context);

    appender.setContext(context);

    String appenderName = ec.subst(attributes.getValue(NAME_ATTRIBUTE));

    if (OptionHelper.isEmpty(appenderName)) {
      addWarn("No appender name given for appender of type " + className
          + "].");
    } else {
      appender.setName(appenderName);
      addInfo("Naming appender as [" + appenderName + "]");
    }

    // The execution context contains a bag which contains the appenders
    // created thus far.
    HashMap<String, Appender<E>> appenderBag = (HashMap<String, Appender<E>>) ec.getObjectMap().get(
        ActionConst.APPENDER_BAG);

    // add the appender just created to the appender bag.
    appenderBag.put(appenderName, appender);

    ec.pushObject(appender);
  } catch (Exception oops) {
    inError = true;
    addError("Could not create an Appender of type [" + className + "].",
        oops);
    throw new ActionException(oops);
  }
}
 
开发者ID:cscfa,项目名称:bartleby,代码行数:56,代码来源:AppenderAction.java


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