KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > generation > AbstractGenerator


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.generation;
17
18 import org.apache.avalon.framework.parameters.Parameters;
19 import org.apache.cocoon.ProcessingException;
20 import org.apache.cocoon.environment.SourceResolver;
21 import org.apache.cocoon.xml.AbstractXMLProducer;
22 import org.xml.sax.SAXException JavaDoc;
23
24 import java.io.IOException JavaDoc;
25 import java.util.Map JavaDoc;
26
27 /**
28  * An abstract class that can be used to implement an own generator.
29  * If you need other components, use the {@link ServiceableGenerator}
30  * instead.
31  *
32  * @author <a HREF="mailto:pier@apache.org">Pierpaolo Fumagalli</a>
33  * (Apache Software Foundation)
34  * @version CVS $Id: AbstractGenerator.java 30932 2004-07-29 17:35:38Z vgritsenko $
35  */

36 public abstract class AbstractGenerator
37     extends AbstractXMLProducer
38     implements Generator {
39
40     /** The current <code>SourceResolver</code>. */
41     protected SourceResolver resolver;
42     /** The current <code>Map</code> objectModel. */
43     protected Map JavaDoc objectModel;
44     /** The current <code>Parameters</code>. */
45     protected Parameters parameters;
46     /** The source URI associated with the request or <b>null</b>. */
47     protected String JavaDoc source;
48
49     /**
50      * Set the <code>SourceResolver</code>, object model <code>Map</code>,
51      * the source and sitemap <code>Parameters</code> used to process the request.
52      */

53     public void setup(SourceResolver resolver, Map JavaDoc objectModel, String JavaDoc src, Parameters par)
54         throws ProcessingException, SAXException JavaDoc, IOException JavaDoc {
55         this.resolver=resolver;
56         this.objectModel=objectModel;
57         this.source=src;
58         this.parameters=par;
59     }
60
61     /**
62      * Recycle the generator by removing references
63      */

64     public void recycle() {
65         super.recycle();
66         this.resolver = null;
67         this.objectModel = null;
68         this.source = null;
69         this.parameters = null;
70     }
71
72 }
73
Popular Tags