@Override public void end(InterpretationContext ic, String name) throws ActionException { if (!ic.isEmpty() && (ic.peekObject() instanceof ConditionalIncludeAction.State)) { ConditionalIncludeAction.State state = (ConditionalIncludeAction.State)ic.popObject(); URL url = state.getUrl(); if (url != null) { addInfo("Path found [" + url.toString() + "]"); try { processInclude(ic, url); } catch (JoranException e) { addError("Failed to process include [" + url.toString() + "]", e); } } else { addInfo("No paths found from includes"); } } }
/** * Creates a {@link SaxEventRecorder} based on the input stream * @return the newly created recorder */ @Override protected SaxEventRecorder createRecorder(InputStream in, URL url) { return new SaxEventRecorder(getContext()); } }
public FindIncludeAction() { setEventOffset(EVENT_OFFSET); }
@Before public void setUp() throws Exception { FileTestUtil.makeTestOutputDir(); HashMap<ElementSelector, Action> rulesMap = new HashMap<ElementSelector, Action>(); rulesMap.put(new ElementSelector("x"), new NOPAction()); rulesMap.put(new ElementSelector("x/include"), new IncludeAction()); rulesMap.put(new ElementSelector("x/findInclude"), new FindIncludeAction()); rulesMap.put(new ElementSelector("x/findInclude/include"), new ConditionalIncludeAction()); stackAction = new StackAction(); rulesMap.put(new ElementSelector("x/stack"), stackAction); tc = new TrivialConfigurator(rulesMap); tc.setContext(context); }
@SuppressWarnings("deprecation") @Override public void addInstanceRules(RuleStore rs) { // parent rules already added super.addInstanceRules(rs); rs.addRule(new ElementSelector("configuration"), new ConfigurationAction()); rs.addRule(new ElementSelector("configuration/contextName"), new ContextNameAction()); rs.addRule(new ElementSelector("configuration/contextListener"), new LoggerContextListenerAction()); rs.addRule(new ElementSelector("configuration/appender/sift"), new SiftAction()); rs.addRule(new ElementSelector("configuration/appender/sift/*"), new NOPAction()); rs.addRule(new ElementSelector("configuration/logger"), new LoggerAction()); rs.addRule(new ElementSelector("configuration/logger/level"), new LevelAction()); rs.addRule(new ElementSelector("configuration/root"), new RootLoggerAction()); rs.addRule(new ElementSelector("configuration/root/level"), new LevelAction()); rs.addRule(new ElementSelector("configuration/logger/appender-ref"), new AppenderRefAction<ILoggingEvent>()); rs.addRule(new ElementSelector("configuration/root/appender-ref"), new AppenderRefAction<ILoggingEvent>()); rs.addRule(new ElementSelector("configuration/include"), new IncludeAction()); rs.addRule(new ElementSelector("configuration/includes"), new FindIncludeAction()); rs.addRule(new ElementSelector("configuration/includes/include"), new ConditionalIncludeAction()); rs.addRule(new ElementSelector("configuration/receiver"), new ReceiverAction()); }