@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); } }
@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); } }
addError("Could not create an Appender of type [" + className + "].", oops); throw new ActionException(oops);
addError("Could not create an PropertyDefiner of type [" + className + "].", oops); throw new ActionException(oops);
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); } }
public void end(InterpretationContext ec, String name) throws ActionException { switch(type) { case ACTION_EXCEPTION: throw new ActionException(); default: throw new IllegalStateException("bad end"); } } }
/** * Instantiates an layout of the given class and sets its name. * */ public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { //System.out.println("IncAction Begin called"); beginCount++; String val = attributes.getValue("increment"); if(!"1".equals(val)) { errorCount++; throw new ActionException(); } }
public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String exType = attributes.getValue(EXCEPTION_TYPE); type = RUNTIME_EDXCEPTION; if("ActionException".equals(exType)) { type = ACTION_EXCEPTION; } switch(type) { case ACTION_EXCEPTION: throw new ActionException(); default: throw new IllegalStateException("bad begin"); } }
@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); } }
/** * 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)) { className = DefaultShutdownHook.class.getName(); addInfo("Assuming className [" + className + "]"); } 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); } }
@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); } }
@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); } }
@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); } }
@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); } }
@Override public void begin(InterpretationContext ec, String name, Attributes attributes) throws ActionException { String className = attributes.getValue(CLASS_ATTRIBUTE); // We are just beginning, reset variables auditAppender = null; inError = false; try { addInfo("About to instantiate appender of type ["+className+"]"); auditAppender = (AuditAppender) OptionHelper.instantiateByClassName( className, ch.qos.logback.audit.client.AuditAppender.class, context); auditAppender.setContext(context); String appenderName = attributes.getValue(NAME_ATTRIBUTE); if (OptionHelper.isEmpty(appenderName)) { addWarn( "No appender name given for appender of type " + className + "]."); } else { auditAppender.setName(appenderName); addInfo("Naming appender as [" + appenderName + "]"); } //getLogger().debug("Pushing appender on to the object stack."); ec.pushObject(auditAppender); } catch (Exception oops) { inError = true; addError( "Could not create an Appender of type ["+className+"].", oops); throw new ActionException(oops); } }
/** * 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); } }
/** * 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); } }
inError = true; addError("Could not create a shutdown hook of type [" + className + "].", e); throw new ActionException(e);
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); ec.pushObject(statusListener); } catch (Exception e) { inError = true; addError( "Could not create an StatusListener of type ["+className+"].", e); throw new ActionException(e); } }
/** * 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); } }