Source code: com/sitemesh/DecoratorMapper.java
1 package com.sitemesh;
2
3 import java.util.Properties;
4 import javax.servlet.Config;
5 import javax.servlet.http.HttpServletRequest;
6
7 /**
8 * The DecoratorMapper is resposible for determining which
9 * {@link com.sitemesh.Decorator} should be used for a
10 * {@link com.sitemesh.Page} .
11 *
12 * Implementations of this are returned by {@link com.sitemesh.Factory} .
13 *
14 * All implementations of this should be thread safe.
15 *
16 * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a>
17 * @version $Revision: 1.8 $
18 */
19 public interface DecoratorMapper {
20 /**
21 * @directed
22 * @label locates
23 */
24 /*#Decorator lnkDecorator;*/
25
26 /**
27 * Initialize the mapper. This is always called before the other method.
28 *
29 * @param config Config supplied by Servlet or Filter.
30 * @param properties Any initialization properties (specific to implementation).
31 * @exception java.lang.InstantionException should be thrown if the implementation
32 * cannot be initialized properly.
33 */
34 void init(Config config, Properties properties) throws InstantiationException;
35
36 /**
37 * Return appropriate Decorator for a certain Page.
38 * The implementation can determine the result based on the actual request
39 * or the data of the parsed page.
40 */
41 Decorator getDecorator(HttpServletRequest request, Page page);
42
43 }