KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > opensymphony > module > sitemesh > DecoratorMapper


1 /*
2  * Title: DecoratorMapper
3  * Description:
4  *
5  * This software is published under the terms of the OpenSymphony Software
6  * License version 1.1, of which a copy has been included with this
7  * distribution in the LICENSE.txt file.
8  */

9
10 package com.opensymphony.module.sitemesh;
11
12 import javax.servlet.http.HttpServletRequest JavaDoc;
13 import java.util.Properties JavaDoc;
14
15 /**
16  * The DecoratorMapper is responsible for determining which
17  * {@link com.opensymphony.module.sitemesh.Decorator} should be used for a
18  * {@link com.opensymphony.module.sitemesh.Page}.
19  *
20  * <p>Implementations of this are returned by the {@link com.opensymphony.module.sitemesh.Factory},
21  * and should be thread-safe.</p>
22  *
23  * @author <a HREF="mailto:joe@truemesh.com">Joe Walnes</a>
24  * @version $Revision: 1.2 $
25  */

26 public interface DecoratorMapper {
27     /**
28      * Initialize the mapper. This is always called before the other methods.
29      *
30      * @param config Config supplied by Servlet or Filter.
31      * @param properties Any initialization properties (specific to implementation).
32      * @exception java.lang.InstantiationException should be thrown if the implementation
33      * cannot be initialized properly.
34      */

35     void init(Config config, Properties JavaDoc properties, DecoratorMapper parent) throws InstantiationException JavaDoc;
36
37     /**
38      * Return appropriate {@link com.opensymphony.module.sitemesh.Decorator} for a certain Page.
39      *
40      * <p>The implementation can determine the result based on the actual request
41      * or the data of the parsed page. Typically this would call <code>getNamedDecorator()</code>
42      * which would delegate to a parent DecoratorMapper.</p>
43      *
44      */

45     Decorator getDecorator(HttpServletRequest JavaDoc request, Page page);
46
47     /** Return a {@link com.opensymphony.module.sitemesh.Decorator} with given name. */
48     Decorator getNamedDecorator(HttpServletRequest JavaDoc request, String JavaDoc name);
49 }
Popular Tags