@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String portStr = attributes.getValue(PORT_ATTR); Integer port = null; if (portStr == null) { port = DEFAULT_PORT; } else { try { port = Integer.valueOf(portStr); } catch (NumberFormatException ex) { addError("Port " + portStr + " in ConsolePlugin config is not a correct number"); } } LoggerContext lc = (LoggerContext) ec.getContext(); SocketAppender appender = new SocketAppender(); appender.setContext(lc); appender.setIncludeCallerData(true); appender.setRemoteHost("localhost"); appender.setPort(port.intValue()); appender.start(); Logger root = lc.getLogger(Logger.ROOT_LOGGER_NAME); root.addAppender(appender); addInfo("Sending LoggingEvents to the plugin using port " + port); }
@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(); } }
static public void setProperty(InterpretationContext ic, String key, String value, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperty(key, value); break; case CONTEXT: ic.getContext().putProperty(key, value); break; case SYSTEM: OptionHelper.setSystemProperty(ic, key, value); } }
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String portStr = attributes.getValue(PORT_ATTR); Integer port = null; if (portStr == null) { port = DEFAULT_PORT; } else { try { port = Integer.valueOf(portStr); } catch (NumberFormatException ex) { addError("Port " + portStr + " in ConsolePlugin config is not a correct number"); } } LoggerContext lc = (LoggerContext)ec.getContext(); SocketAppender appender = new SocketAppender(); appender.setContext(lc); appender.setIncludeCallerData(true); appender.setRemoteHost("localhost"); appender.setPort(port.intValue()); appender.start(); Logger root = lc.getLogger(Logger.ROOT_LOGGER_NAME); root.addAppender(appender); addInfo("Sending LoggingEvents to the plugin using port " + port); }
/** * Add all the properties found in the argument named 'props' to an * InterpretationContext. */ static public void setProperties(InterpretationContext ic, Properties props, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperties(props); break; case CONTEXT: ContextUtil cu = new ContextUtil(ic.getContext()); cu.addProperties(props); break; case SYSTEM: OptionHelper.setSystemProperties(ic, props); } }
@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(); } }
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); } }
static public void setProperty(InterpretationContext ic, String key, String value, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperty(key, value); break; case CONTEXT: ic.getContext().putProperty(key, value); break; case SYSTEM: OptionHelper.setSystemProperty(ic, key, value); } }
static public void setProperty(InterpretationContext ic, String key, String value, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperty(key, value); break; case CONTEXT: ic.getContext().putProperty(key, value); break; case SYSTEM: OptionHelper.setSystemProperty(ic, key, value); } }
/** * Instantiates an layout of the given class and sets its name. * */ public void begin(InterpretationContext ec, String name, Attributes attributes) { Integer i = (Integer) ec.getContext().getObject(KEY); if(i == null) { ec.getContext().putObject(KEY, 1); } else { ec.getContext().putObject(KEY, i+1); } }
static public void setProperty(InterpretationContext ic, String key, String value, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperty(key, value); break; case CONTEXT: ic.getContext().putProperty(key, value); break; case SYSTEM: OptionHelper.setSystemProperty(ic, key, value); } }
static public void setProperty(InterpretationContext ic, String key, String value, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperty(key, value); break; case CONTEXT: ic.getContext().putProperty(key, value); break; case SYSTEM: OptionHelper.setSystemProperty(ic, key, value); } }
static public void setProperty(InterpretationContext ic, String key, String value, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperty(key, value); break; case CONTEXT: ic.getContext().putProperty(key, value); break; case SYSTEM: OptionHelper.setSystemProperty(ic, key, value); } }
static public void setProperty(InterpretationContext ic, String key, String value, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperty(key, value); break; case CONTEXT: ic.getContext().putProperty(key, value); break; case SYSTEM: OptionHelper.setSystemProperty(ic, key, value); } }
/** * Instantiates an layout of the given class and sets its name. * */ public void begin(InterpretationContext ec, String name, Attributes attributes) { String str = "Hello "+attributes.getValue("name")+"."; ec.getContext().putProperty(PROPERTY_KEY, str); }
static public void setProperty(InterpretationContext ic, String key, String value, Scope scope) { switch (scope) { case LOCAL: ic.addSubstitutionProperty(key, value); break; case CONTEXT: ic.getContext().putProperty(key, value); break; case SYSTEM: OptionHelper.setSystemProperty(ic, key, value); } }
@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 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 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 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(); } }