01: /*
02: * Title: DecoratorMapper
03: * Description:
04: *
05: * This software is published under the terms of the OpenSymphony Software
06: * License version 1.1, of which a copy has been included with this
07: * distribution in the LICENSE.txt file.
08: */
09:
10: package com.opensymphony.module.sitemesh;
11:
12: import javax.servlet.http.HttpServletRequest;
13: import java.util.Properties;
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 properties,
36: DecoratorMapper parent) throws InstantiationException;
37:
38: /**
39: * Return appropriate {@link com.opensymphony.module.sitemesh.Decorator} for a certain Page.
40: *
41: * <p>The implementation can determine the result based on the actual request
42: * or the data of the parsed page. Typically this would call <code>getNamedDecorator()</code>
43: * which would delegate to a parent DecoratorMapper.</p>
44: *
45: */
46: Decorator getDecorator(HttpServletRequest request, Page page);
47:
48: /** Return a {@link com.opensymphony.module.sitemesh.Decorator} with given name. */
49: Decorator getNamedDecorator(HttpServletRequest request, String name);
50: }
|