private void verifyAndPop(InterpretationContext ic) { Object o = ic.peekObject(); Assert.state(o != null, "Unexpected null object on stack"); Assert.isInstanceOf(SpringProfileAction.class, o, "logback stack error"); Assert.state(o == this, "ProfileAction different than current one on stack"); ic.popObject(); }
public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != root) { addWarn("The object on the top the of the stack is not the root logger"); addWarn("It is: " + o); } else { ec.popObject(); } }
public void end(InterpretationContext ec, String e) { if (inError) { return; } Object o = ec.peekObject(); if (o != logger) { addWarn("The object on the top the of the stack is not " + logger + " pushed earlier"); addWarn("It is: " + o); } else { ec.popObject(); } }
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()); }
@Override public void end(InterpretationContext ic, String name) throws ActionException { ic.removeInPlayListener(this); Object o = ic.peekObject(); if (o instanceof SiftingAppender) { SiftingAppender sa = (SiftingAppender) o; Map<String, String> propertyMap = ic.getCopyOfPropertyMap(); AppenderFactoryUsingJoran appenderFactory = new AppenderFactoryUsingJoran(seList, sa.getDiscriminatorKey(), propertyMap); sa.setAppenderFactory(appenderFactory); } }
@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(); } }
@Override public void end(InterpretationContext ec, String name) throws ActionException { if (inError) { return; } Object o = ec.peekObject(); if (o != lcl) { addWarn("The object on the top the of the stack is not the LoggerContextListener pushed earlier."); } else { if (lcl instanceof LifeCycle) { ((LifeCycle) lcl).start(); addInfo("Starting LoggerContextListener"); } ((LoggerContext) context).addListener(lcl); ec.popObject(); } }
boolean weAreActive(InterpretationContext ic) { Object o = ic.peekObject(); if(!(o instanceof IfAction)) return false; IfAction ifAction = (IfAction) o; return ifAction.isActive(); }
public void end(InterpretationContext ec, String name) { if (inError) { return; } Object o = ec.peekObject(); if (o != root) { addWarn("The object on the top the of the stack is not the root logger"); addWarn("It is: " + o); } else { ec.popObject(); } }
public void end(InterpretationContext ec, String e) { if (inError) { return; } Object o = ec.peekObject(); if (o != logger) { addWarn("The object on the top the of the stack is not "+logger+" pushed earlier"); addWarn("It is: " + o); } else { ec.popObject(); } }
@Override public void end(InterpretationContext ic, String name) throws ActionException { if(!weAreActive(ic)) return; ThenActionState state = stateStack.pop(); if (state.isRegistered) { ic.removeInPlayListener(state); Object o = ic.peekObject(); if (o instanceof IfAction) { IfAction ifAction = (IfAction) o; removeFirstAndLastFromList(state.eventList); registerEventList(ifAction, state.eventList); } else { throw new IllegalStateException("Missing IfAction on top of stack"); } } }
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()); }
public void end(InterpretationContext ec, String e) { if (inError) { return; } if (statusListener instanceof LifeCycle) { ((LifeCycle) statusListener).start(); } Object o = ec.peekObject(); if (o != statusListener) { addWarn("The object at the of the stack is not the statusListener pushed earlier."); } else { ec.popObject(); } } }
@Override public void end(InterpretationContext ic, String name) throws ActionException { ic.removeInPlayListener(this); Object o = ic.peekObject(); if (o instanceof SiftingAppender) { SiftingAppender sa = (SiftingAppender) o; Map<String, String> propertyMap = ic.getCopyOfPropertyMap(); AppenderFactoryUsingJoran appenderFactory = new AppenderFactoryUsingJoran(seList, sa .getDiscriminatorKey(), propertyMap); sa.setAppenderFactory(appenderFactory); } }
public void begin( InterpretationContext ec, String localName, Attributes attributes) { String name = attributes.getValue(NAME_ATTRIBUTE); String value = attributes.getValue(VALUE_ATTRIBUTE); if (name == null) { inError = true; addError(NO_NAME); return; } if (value == null) { inError = true; addError(NO_VALUE); return; } // remove both leading and trailing spaces value = value.trim(); Object o = ec.peekObject(); PropertySetter propSetter = new PropertySetter(o); propSetter.setContext(context); value = ec.subst(value); // allow for variable substitution for name as well name = ec.subst(name); //getLogger().debug( // "In ParamAction setting parameter [{}] to value [{}].", name, value); propSetter.setProperty(name, value); }
/** * 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(); } } }
@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(); } }
@Override public void end(InterpretationContext ec, String name) throws ActionException { if (inError) { return; } Object o = ec.peekObject(); if (o != lcl) { addWarn("The object on the top the of the stack is not the LoggerContextListener pushed earlier."); } else { if (lcl instanceof LifeCycle) { ((LifeCycle) lcl).start(); addInfo("Starting LoggerContextListener"); } ((LoggerContext) context).addListener(lcl); ec.popObject(); } }
/** * 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); } } } }
public boolean isApplicable(ElementPath elementPath, Attributes attributes, InterpretationContext ic) { String nestedElementTagName = elementPath.peekLast(); // calling ic.peekObject with an empty stack will throw an exception if (ic.isEmpty()) { return false; } Object o = ic.peekObject(); PropertySetter parentBean = new PropertySetter(o); parentBean.setContext(context); AggregationType aggregationType = parentBean .computeAggregationType(nestedElementTagName); switch (aggregationType) { case NOT_FOUND: case AS_BASIC_PROPERTY: case AS_BASIC_PROPERTY_COLLECTION: return false; // we only push action data if NestComponentIA is applicable case AS_COMPLEX_PROPERTY_COLLECTION: case AS_COMPLEX_PROPERTY: IADataForComplexProperty ad = new IADataForComplexProperty(parentBean, aggregationType, nestedElementTagName); actionDataStack.push(ad); return true; default: addError("PropertySetter.computeAggregationType returned " + aggregationType); return false; } }