KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jpublish > component > Component


1 /*--
2
3  Copyright (C) 2001-2003 Aetrion LLC.
4  All rights reserved.
5  
6  Redistribution and use in source and binary forms, with or without
7  modification, are permitted provided that the following conditions
8  are met:
9  
10  1. Redistributions of source code must retain the above copyright
11     notice, this list of conditions, and the following disclaimer.
12  
13  2. Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions, and the disclaimer that follows
15     these conditions in the documentation and/or other materials
16     provided with the distribution.
17
18  3. The name "JPublish" must not be used to endorse or promote products
19     derived from this software without prior written permission. For
20     written permission, please contact info@aetrion.com.
21  
22  4. Products derived from this software may not be called "JPublish", nor
23     may "JPublish" appear in their name, without prior written permission
24     from Aetrion LLC (info@aetrion.com).
25  
26  In addition, the authors of this software request (but do not require)
27  that you include in the end-user documentation provided with the
28  redistribution and/or in the software itself an acknowledgement equivalent
29  to the following:
30      "This product includes software developed by
31       Aetrion LLC (http://www.aetrion.com/)."
32
33  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
34  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
35  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
36  DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
37  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
38  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
39  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41  STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
42  IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
43  POSSIBILITY OF SUCH DAMAGE.
44
45  For more information on JPublish, please see <http://www.jpublish.org/>.
46  
47  */

48
49 package org.jpublish.component;
50
51 import java.io.IOException JavaDoc;
52 import java.util.Map JavaDoc;
53
54 import com.anthonyeden.lib.config.Configuration;
55 import com.anthonyeden.lib.config.ConfigurationException;
56 import org.jpublish.RequestContext;
57 import org.jpublish.SiteContext;
58 import org.jpublish.repository.Repository;
59 import org.jpublish.view.ViewRenderException;
60 import org.jpublish.view.ViewRenderer;
61
62 /**
63  * Standard interface which must be implemented by all JPublish components.
64  *
65  * @author Anthony Eden
66  */

67 public interface Component {
68
69     /**
70      * Get the component's name.
71      *
72      * @return The name
73      */

74     public String JavaDoc getName();
75
76     /**
77      * Get a description of the component.
78      *
79      * @return The component description
80      */

81     public String JavaDoc getDescription();
82
83     /**
84      * Get a Map of component properties.
85      *
86      * @return A Map of properties
87      */

88     public Map JavaDoc getProperties();
89
90     /**
91      * Get the SiteContext.
92      *
93      * @return The SiteContext
94      */

95     public SiteContext getSiteContext();
96
97     /**
98      * Set the SiteContext.
99      *
100      * @param siteContext The SiteContext
101      */

102     public void setSiteContext(SiteContext siteContext);
103
104     /**
105      * Get the component's view repository.
106      *
107      * @return The view repository
108      */

109     public Repository getViewRepository();
110
111     /**
112      * Set the component's view repository.
113      *
114      * @param viewRepository The new view repository
115      */

116     public void setViewRepository(Repository viewRepository);
117
118     /**
119      * Get the component's view renderer. This method may return null which indicates that the component should use the
120      * default view renderer specified in the SiteContext.
121      *
122      * @return The view renderer
123      */

124     public ViewRenderer getViewRenderer();
125
126     /**
127      * Set the component's view renderer. Set the value to null to indicate that the component should use the default
128      * view renderer specified in the SiteContext.
129      *
130      * @param viewRenderer The new view renderer
131      */

132     public void setViewRenderer(ViewRenderer viewRenderer);
133
134     /**
135      * Load the component's configuration data.
136      *
137      * @param configuration The configuration data
138      * @throws ConfigurationException
139      */

140     public void loadConfiguration(Configuration configuration)
141             throws ConfigurationException;
142
143     /**
144      * Render the component for the specified path and return the result.
145      *
146      * @param path The request path
147      * @param context The context
148      * @return The rendered component
149      * @throws IOException
150      * @throws ViewRenderException
151      */

152     public String JavaDoc render(String JavaDoc path, RequestContext context)
153             throws IOException JavaDoc, ViewRenderException;
154
155 }
156
Popular Tags