Java 类ch.qos.logback.core.joran.event.SaxEvent 实例源码

项目:bartleby    文件:EventPlayer.java   
public void play(List<SaxEvent> aSaxEventList) {
  eventList = aSaxEventList;
  SaxEvent se;
  for(currentIndex = 0; currentIndex < eventList.size(); currentIndex++) {
    se = eventList.get(currentIndex);

    if(se instanceof StartEvent) {
      interpreter.startElement((StartEvent) se);
      // invoke fireInPlay after startElement processing
      interpreter.getInterpretationContext().fireInPlay(se);
    }
    if(se instanceof BodyEvent) {
      // invoke fireInPlay before  characters processing
      interpreter.getInterpretationContext().fireInPlay(se);
      interpreter.characters((BodyEvent) se);
    }
    if(se instanceof EndEvent) {
      // invoke fireInPlay before endElement processing
      interpreter.getInterpretationContext().fireInPlay(se);
      interpreter.endElement((EndEvent) se);
    }

  }
}
项目:bartleby    文件:IncludeAction.java   
private void trimHeadAndTail(SaxEventRecorder recorder) {
  // Let's remove the two <included> events before
  // adding the events to the player.

  List<SaxEvent> saxEventList = recorder.saxEventList;

  if (saxEventList.size() == 0) {
    return;
  }

  SaxEvent first = saxEventList.get(0);
  if (first != null && first.qName.equalsIgnoreCase(INCLUDED_TAG)) {
    saxEventList.remove(0);
  }

  SaxEvent last = saxEventList.get(recorder.saxEventList.size() - 1);
  if (last != null && last.qName.equalsIgnoreCase(INCLUDED_TAG)) {
    saxEventList.remove(recorder.saxEventList.size() - 1);
  }
}
项目:bartleby    文件:ReconfigureOnChangeFilter.java   
private void performXMLConfiguration(LoggerContext lc) {
  JoranConfigurator jc = new JoranConfigurator();
  jc.setContext(context);
  StatusUtil statusUtil = new StatusUtil(context);
  List<SaxEvent> eventList = jc.recallSafeConfiguration();
  URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(context);
  lc.reset();
  long threshold = System.currentTimeMillis();
  try {
    jc.doConfigure(mainConfigurationURL);
    if (statusUtil.hasXMLParsingErrors(threshold)) {
      fallbackConfiguration(lc, eventList, mainURL);
    }
  } catch (JoranException e) {
    fallbackConfiguration(lc, eventList, mainURL);
  }
}
项目:bartleby    文件:ReconfigureOnChangeFilter.java   
private void fallbackConfiguration(LoggerContext lc, List<SaxEvent> eventList, URL mainURL) {
  JoranConfigurator joranConfigurator = new JoranConfigurator();
  joranConfigurator.setContext(context);
  if (eventList != null) {
    addWarn("Falling back to previously registered safe configuration.");
    try {
      lc.reset();
      joranConfigurator.informContextOfURLUsedForConfiguration(context, mainURL);
      joranConfigurator.doConfigure(eventList);
      addInfo("Re-registering previous fallback configuration once more as a fallback configuration point");
      joranConfigurator.registerSafeConfiguration();
    } catch (JoranException e) {
      addError("Unexpected exception thrown by a configuration considered safe.", e);
    }
  } else {
    addWarn("No previous configuration to fall back on.");
  }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileAction.java   
@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);
}
项目:spring-boot-concourse    文件:SpringProfileAction.java   
@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);
}
项目:bartleby    文件:GenericConfigurator.java   
public void doConfigure(final List<SaxEvent> eventList)
        throws JoranException {
  buildInterpreter();
  // disallow simultaneous configurations of the same context
  synchronized (context.getConfigurationLock()) {
    interpreter.getEventPlayer().play(eventList);
  }
}
项目:bartleby    文件:IfAction.java   
public void setThenSaxEventList(List<SaxEvent> thenSaxEventList) {
  IfState state = stack.firstElement();
  if(state.active) {
    state.thenSaxEventList = thenSaxEventList;
  } else {
    throw new IllegalStateException("setThenSaxEventList() invoked on inactive IfAction");
  }
}
项目:bartleby    文件:IfAction.java   
public void setElseSaxEventList(List<SaxEvent> elseSaxEventList) {
  IfState state = stack.firstElement();
  if(state.active) {
    state.elseSaxEventList = elseSaxEventList;
  } else {
    throw new IllegalStateException("setElseSaxEventList() invoked on inactive IfAction");
  }

}
项目:bartleby    文件:FruitFactoryAction.java   
@Override
public void end(InterpretationContext ec, String name) throws ActionException {
  ec.removeInPlayListener(this);

  Object o = ec.peekObject();
  if(o instanceof FruitShell) {
    FruitShell fs = (FruitShell) o;
    FruitFactory fruitFactory = new FruitFactory();
    fruitFactory.setEventList(new ArrayList<SaxEvent>(seList));
    fs.setFruitFactory(fruitFactory);
  }
}
项目:bartleby    文件:FruitConfigurator.java   
@Override
final public void doConfigure(final List<SaxEvent> eventList)
    throws JoranException {
  buildInterpreter();
  interpreter.getInterpretationContext().pushObject(ff);
  EventPlayer player = new EventPlayer(interpreter);
  player.play(eventList);
}
项目:contestparser    文件:SpringProfileAction.java   
@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);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:SpringProfileAction.java   
@Override
public void inPlay(SaxEvent event) {
    this.events.add(event);
}
项目:spring-boot-concourse    文件:SpringProfileAction.java   
@Override
public void inPlay(SaxEvent event) {
    this.events.add(event);
}
项目:bartleby    文件:GenericConfigurator.java   
/**
 * Recall the event list previously registered as a safe point.
 */
public List<SaxEvent> recallSafeConfiguration() {
  return (List<SaxEvent>) context.getObject(SAFE_JORAN_CONFIGURATION);
}
项目:bartleby    文件:EventPlayer.java   
public void addEventsDynamically(List<SaxEvent> eventList, int offset) {
  this.eventList.addAll(currentIndex+offset, eventList);
}
项目:bartleby    文件:InterpretationContext.java   
void fireInPlay(SaxEvent event) {
  for (InPlayListener ipl : listenerList) {
    ipl.inPlay(event);
  }
}
项目:bartleby    文件:ThenAction.java   
@Override
void registerEventList(IfAction ifAction, List<SaxEvent> eventList) {
 ifAction.setThenSaxEventList(eventList);
}
项目:bartleby    文件:IfAction.java   
@Override
public void end(InterpretationContext ic, String name) throws ActionException {

  IfState state = stack.pop();
  if(!state.active) {
    return;
  }


  Object o = ic.peekObject();
  if (o == null) {
    throw new IllegalStateException("Unexpected null object on stack");
  }
  if (!(o instanceof IfAction)) {
    throw new IllegalStateException("Unexpected object of type ["
        + o.getClass() + "] on stack");
  }

  if (o != this) {
    throw new IllegalStateException(
        "IfAction different then current one on stack");
  }
  ic.popObject();

  if (state.boolResult == null) {
    addError("Failed to determine \"if then else\" result");
    return;
  }

  Interpreter interpreter = ic.getJoranInterpreter();
  List<SaxEvent> listToPlay = state.thenSaxEventList;
  if (!state.boolResult) {
    listToPlay = state.elseSaxEventList;
  }

  // if boolResult==false & missing else,  listToPlay may be null
  if(listToPlay != null) {
    // insert past this event
    interpreter.getEventPlayer().addEventsDynamically(listToPlay, 1);
  }

}
项目:bartleby    文件:ThenOrElseActionBase.java   
void removeFirstAndLastFromList(List<SaxEvent> eventList) {
  eventList.remove(0);
  eventList.remove(eventList.size() - 1);
}
项目:bartleby    文件:ThenOrElseActionBase.java   
public void inPlay(SaxEvent event) {
  eventList.add(event);
}
项目:bartleby    文件:ElseAction.java   
@Override
void registerEventList(IfAction ifAction, List<SaxEvent> eventList) {
 ifAction.setElseSaxEventList(eventList);

}
项目:bartleby    文件:AbstractAppenderFactoryUsingJoran.java   
protected AbstractAppenderFactoryUsingJoran(List<SaxEvent> eventList, String key, Map<String, String> parentPropertyMap) {
  this.eventList = removeSiftElement(eventList);
  this.key = key;
  this.parentPropertyMap = parentPropertyMap;

}
项目:bartleby    文件:AbstractAppenderFactoryUsingJoran.java   
List<SaxEvent> removeSiftElement(List<SaxEvent> eventList) {
  return eventList.subList(1, eventList.size() - 1);
}
项目:bartleby    文件:AbstractAppenderFactoryUsingJoran.java   
public List<SaxEvent> getEventList() {
  return eventList;
}
项目:bartleby    文件:SiftingJoranConfiguratorBase.java   
public void doConfigure(final List<SaxEvent> eventList) throws JoranException {
  super.doConfigure(eventList);
}
项目:bartleby    文件:FruitFactoryAction.java   
public void inPlay(SaxEvent event) {
  seList.add(event);
}
项目:bartleby    文件:FruitFactoryAction.java   
public List<SaxEvent> getSeList() {
  return seList;
}
项目:bartleby    文件:FruitFactory.java   
public void setEventList(List<SaxEvent> eventList) {
  this.eventList = eventList;
}
项目:bartleby    文件:SiftAction.java   
@Override
public void begin(InterpretationContext ic, String name, Attributes attributes)
    throws ActionException {
  seList = new ArrayList<SaxEvent>();
  ic.addInPlayListener(this);
}
项目:bartleby    文件:SiftAction.java   
public void inPlay(SaxEvent event) {
  seList.add(event);
}
项目:bartleby    文件:SiftAction.java   
public List<SaxEvent> getSeList() {
  return seList;
}
项目:bartleby    文件:AppenderFactoryUsingJoran.java   
AppenderFactoryUsingJoran(List<SaxEvent> eventList, String key, Map<String, String> parentPropertyMap) {
  super(eventList, key, parentPropertyMap);
}
项目:bartleby    文件:SiftAction.java   
@Override
public void begin(InterpretationContext ic, String name, Attributes attributes)
    throws ActionException {
  seList = new ArrayList<SaxEvent>();
  ic.addInPlayListener(this);
}
项目:bartleby    文件:SiftAction.java   
@Override
public void inPlay(SaxEvent event) {
  seList.add(event);
}
项目:bartleby    文件:SiftAction.java   
public List<SaxEvent> getSeList() {
  return seList;
}
项目:bartleby    文件:AppenderFactoryUsingJoran.java   
AppenderFactoryUsingJoran(List<SaxEvent> eventList, String key, Map<String, String> parentPropertyMap) {
  super(eventList, key, parentPropertyMap);
}
项目:contestparser    文件:SpringProfileAction.java   
@Override
public void inPlay(SaxEvent event) {
    this.events.add(event);
}
项目:logback-access-spring-boot-starter    文件:LogbackAccessJoranConfigurator.java   
/** {@inheritDoc} */
@Override
public void inPlay(SaxEvent event) {
    events.add(event);
}
项目:bartleby    文件:EventPlayer.java   
/**
 * Return a copy of the current event list in the player.
 * @return
 * @since 0.9.20
 */
public List<SaxEvent> getCopyOfPlayerEventList() {
  return new ArrayList<SaxEvent>(eventList);
}