View Javadoc

1   /*
2    * Copyright 2002,2004 The Apache Software Foundation.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.commons.jelly;
18  
19  /***
20   * <p><code>Tag</code> represents a Jelly custom tag.
21   * A Tag is only ever used by a single thread so that Tag developers do not
22   * need to concern themselves with mutli-threading issues when writing a Tag.
23   * A Tag is created per custom tag in a script, per invocation.
24   * So there is no need to worry about pooling errors like those caused
25   * in JSP 1.x.(</p>
26   *
27   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
28   * @version $Revision: 155420 $
29   */
30  public interface Tag {
31  
32      /***
33       * @return the parent of this tag
34       */
35      public Tag getParent();
36  
37      /***
38       * Sets the parent of this tag
39       */
40      public void setParent(Tag parent);
41  
42      /***
43       * @return the body of the tag
44       */
45      public Script getBody();
46  
47      /***
48       * Sets the body of the tag
49       */
50      public void setBody(Script body);
51  
52      /***
53       * Gets the context in which the tag will be run
54       */
55      public JellyContext getContext();
56  
57      /***
58       * Sets the context in which the tag will be run
59       */
60      public void setContext(JellyContext context) throws JellyTagException;
61  
62      /***
63       * Evaluates this tag after all the tags properties have been initialized.
64       */
65      public void doTag(XMLOutput output) throws MissingAttributeException, JellyTagException;
66  
67      /***
68       * A helper method to invoke this tags body
69       */
70      public void invokeBody(XMLOutput output) throws JellyTagException;
71  
72  }