Class ShutdownHandlerTag

  • All Implemented Interfaces:
    org.apache.commons.jelly.Tag

    public class ShutdownHandlerTag
    extends org.apache.commons.jelly.TagSupport

    A tag handler class that defines a shutdown script for a BeanProvider .

    This tag can appear in the body of a BeanTag. In its body an arbitrary number of tags derived from InvocationTag can be placed defining a set of operations to be performed when shutting down the corresponding singleton bean. All theses operations are added to a ChainedInvocation object, which will then become the shutdown handler of the singleton BeanProvider created by the hosting bean tag.

    Using this tag is an alternative to the shutdownMethod attribute supported by BeanTag. With the attribute only a single, parameter-less method can be specified to be invoked on shutdown of the bean. This tag in contrast supports much more complex shutdown scripts: all tags producing Invokable objects can be used. However, care must be taken with the dependencies used by the shutdown script. Because the owning BeanStore may already been partly destroyed when the shutdown script is invoked, access to other beans living in the same bean store is not permitted. It is possible to invoke arbitrary methods on the bean managed by the BeanProvider (this bean is also the default target of the invocation, so all method invocations or property access operations per default have this object as target), set or query properties on it, or making use of script-local variables.

    This tag does not define any attributes. In its body the InvocationTag objects can be placed that make up the shutdown script.

    Version:
    $Id: ShutdownHandlerTag.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Field Summary

      • Fields inherited from class org.apache.commons.jelly.TagSupport

        body, context, hasTrimmed, parent, shouldTrim
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void doTag​(org.apache.commons.jelly.XMLOutput output)
      Executes this tag.
      protected void process()
      Performs the actual processing of this tag.
      protected void processBeforeBody()
      Performs some processing of this tag before the body is evaluated.
      • Methods inherited from class org.apache.commons.jelly.TagSupport

        findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, findAncestorWithClass, getBody, getBodyText, getBodyText, getContext, getParent, invokeBody, isEscapeText, isTrim, setBody, setContext, setEscapeText, setParent, setTrim, trimBody
    • Constructor Detail

      • ShutdownHandlerTag

        public ShutdownHandlerTag()
    • Method Detail

      • doTag

        public void doTag​(org.apache.commons.jelly.XMLOutput output)
                   throws org.apache.commons.jelly.JellyTagException
        Executes this tag. This implementation delegates to the processBeforeBody() and process() methods.
        Parameters:
        output - the output object
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is used incorrectly
      • processBeforeBody

        protected void processBeforeBody()
                                  throws org.apache.commons.jelly.JellyTagException
        Performs some processing of this tag before the body is evaluated.
        Throws:
        org.apache.commons.jelly.JellyTagException - if the tag is used incorrectly
      • process

        protected void process()
                        throws org.apache.commons.jelly.JellyTagException
        Performs the actual processing of this tag. This method is called by doTag() after the body has been evaluated.
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs