KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > struts > tiles > DefinitionsFactory


1 /*
2  * $Id: DefinitionsFactory.java 54929 2004-10-16 16:38:42Z germuska $
3  *
4  * Copyright 1999-2004 The Apache Software Foundation.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19
20 package org.apache.struts.tiles;
21
22 import java.io.Serializable JavaDoc;
23
24 import javax.servlet.ServletContext JavaDoc;
25 import javax.servlet.ServletRequest JavaDoc;
26
27 /**
28  * Tiles Definition factory.
29  * This interface replace old ComponentDefinitionsFactory.
30  * Main method getDefinition() is exactly the same. Initialization method change.
31  * This interface allows to retrieve a definition by its name, independently of
32  * the factory implementation.
33  * Object life cycle is as follow:
34  * <ul>
35  * <li>Constructor: create object</li>
36  * <li>setConfig: set config and initialize factory. After first call to this
37  * method, factory is operational.</li>
38  * <li>destroy: factory is being shutdown.</li>
39  * </ul>
40  * Implementation must be Serializable, in order to be compliant with web Container
41  * having this constraint (Weblogic 6.x).
42  */

43 public interface DefinitionsFactory extends Serializable JavaDoc
44 {
45
46    /**
47      * Get a definition by its name.
48      * @param name Name of requested definition.
49      * @param request Current servelet request
50      * @param servletContext current servlet context
51      * @throws DefinitionsFactoryException An error occur while getting definition.
52      * @throws NoSuchDefinitionException No definition found for specified name
53      * Implementation can throw more accurate exception as a subclass of this exception
54    */

55    public ComponentDefinition getDefinition(String JavaDoc name, ServletRequest JavaDoc request, ServletContext JavaDoc servletContext)
56      throws NoSuchDefinitionException,DefinitionsFactoryException;
57
58    /**
59     * Init definition factory.
60     * This method is called immediately after factory creation, and prior any call
61     * to setConfig().
62     *
63     * @param config Configuration object used to set factory configuration.
64     * @param servletContext Servlet Context passed to factory.
65     * @throws DefinitionsFactoryException An error occur during initialization.
66     */

67    public void init(DefinitionsFactoryConfig config, ServletContext JavaDoc servletContext)
68      throws DefinitionsFactoryException;
69
70     /**
71      * <p>Receive notification that the factory is being
72      * shut down.</p>
73      */

74     public void destroy();
75
76    /**
77     * Set factory configuration.
78     * This method is used to change factory configuration.
79     * This method is optional, and can send an exception if implementation
80     * doesn't allow change in configuration.
81     *
82     * @param config Configuration object used to set factory configuration.
83     * @param servletContext Servlet Context passed to factory.
84     * @throws DefinitionsFactoryException An error occur during initialization.
85     */

86    public void setConfig(DefinitionsFactoryConfig config, ServletContext JavaDoc servletContext)
87      throws DefinitionsFactoryException;
88
89    /**
90     * Get factory configuration.
91     * @return TilesConfig
92     */

93    public DefinitionsFactoryConfig getConfig();
94
95
96 }
97
Popular Tags