KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > taglib > Tag


1 /*
2  * Copyright 1999-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 package org.apache.cocoon.taglib;
17
18 import java.io.IOException JavaDoc;
19 import java.util.Map JavaDoc;
20
21 import org.apache.avalon.framework.component.Component;
22 import org.apache.avalon.framework.parameters.Parameters;
23 import org.apache.cocoon.environment.SourceResolver;
24
25 import org.xml.sax.Attributes JavaDoc;
26 import org.xml.sax.SAXException JavaDoc;
27
28 /**
29  * The Tag implementation works like a JSP Tag but generate SAX output
30  * instead of writing to a OutputStream. The equivalent to the JSPEngine
31  * is implemented as a Transformer.
32  *
33  * @see org.apache.cocoon.transformation.TagTransformer
34  *
35  * @author <a HREF="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
36  * @version CVS $Id: Tag.java 46206 2004-09-16 20:06:28Z vgritsenko $
37  */

38 public interface Tag extends Component {
39
40     String JavaDoc ROLE = Tag.class.getName();
41
42     /**
43      * Evaluate body content
44      * Valid return value for doStartTag.
45      */

46     int EVAL_BODY = 0;
47
48     /**
49      * Skip body evaluation.
50      * Valid return value for doStartTag.
51      */

52     int SKIP_BODY = 1;
53
54     /**
55      * Continue evaluating the page.
56      * Valid return value for doEndTag.
57      */

58     int EVAL_PAGE = 2;
59
60     /**
61      * Process the end tag for this instance.
62      *
63      * @return EVAL_PAGE
64      * @throws SAXException
65      */

66     int doEndTag(String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc qName) throws SAXException JavaDoc;
67
68     /**
69      * Process the start tag for this instance.
70      * <p>
71      * The doStartTag method assumes that parent have been set.
72      * It also assumes that any properties exposed as
73      * attributes have been set too. When this method is invoked, the body
74      * has not yet been evaluated.
75      *
76      * @return EVAL_BODY or SKIP_BODY.
77      */

78     int doStartTag(String JavaDoc namespaceURI, String JavaDoc localName, String JavaDoc qName, Attributes JavaDoc atts) throws SAXException JavaDoc;
79
80     /**
81      * Get the parent (closest enclosing tag handler) for this tag handler.
82      *
83      * @return the current parent or null if none.
84      */

85     Tag getParent();
86
87     /**
88      * Set the <code>SourceResolver</code>, objectModel <code>Map</code>
89      * and sitemap <code>Parameters</code> used to process the request.
90      */

91     void setup(SourceResolver resolver, Map JavaDoc objectModel, Parameters parameters) throws SAXException JavaDoc, IOException JavaDoc;
92
93     /**
94      * Set the parent (closest enclosing tag handler) of this tag handler.
95      * Invoked by the implementation object prior to doStartTag().
96      *
97      * @param parent The parent tag or null.
98      */

99     void setParent(Tag parent);
100 }
101
Popular Tags