KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fulcrum > velocity > VelocityService


1 package org.apache.fulcrum.velocity;
2
3 /* ====================================================================
4  * The Apache Software License, Version 1.1
5  *
6  * Copyright (c) 2001 The Apache Software Foundation. All rights
7  * reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in
18  * the documentation and/or other materials provided with the
19  * distribution.
20  *
21  * 3. The end-user documentation included with the redistribution,
22  * if any, must include the following acknowledgment:
23  * "This product includes software developed by the
24  * Apache Software Foundation (http://www.apache.org/)."
25  * Alternately, this acknowledgment may appear in the software itself,
26  * if and wherever such third-party acknowledgments normally appear.
27  *
28  * 4. The names "Apache" and "Apache Software Foundation" and
29  * "Apache Turbine" must not be used to endorse or promote products
30  * derived from this software without prior written permission. For
31  * written permission, please contact apache@apache.org.
32  *
33  * 5. Products derived from this software may not be called "Apache",
34  * "Apache Turbine", nor may "Apache" appear in their name, without
35  * prior written permission of the Apache Software Foundation.
36  *
37  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48  * SUCH DAMAGE.
49  * ====================================================================
50  *
51  * This software consists of voluntary contributions made by many
52  * individuals on behalf of the Apache Software Foundation. For more
53  * information on the Apache Software Foundation, please see
54  * <http://www.apache.org/>.
55  */

56
57 import java.io.OutputStream JavaDoc;
58 import java.io.Writer JavaDoc;
59
60 import org.apache.fulcrum.Service;
61 import org.apache.fulcrum.ServiceException;
62 import org.apache.velocity.app.event.EventCartridge;
63 import org.apache.velocity.context.Context;
64
65 /**
66  * The Turbine service interface to
67  * <a HREF="http://jakarta.apache.org/velocity/">Velocity</a>.
68  *
69  * @author <a HREF="mailto:jmcnally@collab.net">John D. McNally</a>
70  * @author <a HREF="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
71  * @author <a HREF="mailto:jvanzyl@apache.org">Jason van Zyl</a>
72  * @author <a HREF="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
73  * @version $Id: VelocityService.java,v 1.1 2004/11/12 10:25:47 epugh Exp $
74  */

75 public interface VelocityService extends Service
76 {
77     public static final String JavaDoc SERVICE_NAME = "VelocityService";
78
79     /**
80      * Process the request and fill in the template using the values
81      * set in <code>context</code>.
82      *
83      * @param context A context to use when evaluating the specified
84      * template.
85      * @param filename The file name of the template.
86      * @return The processed template.
87      * @exception Exception, a generic exception.
88      */

89     public String JavaDoc handleRequest(Context context, String JavaDoc filename)
90         throws Exception JavaDoc;
91
92     /**
93      * Process the request and fill in the template using the values
94      * set in <code>context</code>.
95      *
96      * @param context A context to use when evaluating the specified
97      * template.
98      * @param filename The file name of the template.
99      * @param charset The character set to use when writing the result.
100      * @param encoding The encoding to use when merging context and
101      * template.
102      * @return The processed template.
103      * @exception Exception, a generic exception.
104      */

105     public String JavaDoc handleRequest(Context context, String JavaDoc template,
106                                 String JavaDoc charset, String JavaDoc encoding)
107         throws Exception JavaDoc;
108
109     /**
110      * Process the request and fill in the template using the values
111      * set in <code>context</code>.
112      *
113      * @param context A context to use when evaluating the specified
114      * template.
115      * @param filename The file name of the template.
116      * @param out The stream to which we will write the processed
117      * template as a String.
118      * @throws ServiceException Any exception trown while processing will be
119      * wrapped into a ServiceException and rethrown.
120      */

121     public void handleRequest(Context context, String JavaDoc filename,
122                               OutputStream JavaDoc out)
123         throws ServiceException;
124
125     /**
126      * Process the request and fill in the template using the values
127      * set in <code>context</code>.
128      *
129      * @param context A context to use when evaluating the specified
130      * template.
131      * @param filename The file name of the template.
132      * @param out The stream to which we will write the processed
133      * template as a String.
134      * @param charset The character set to use when writing the result.
135      * @param encoding The encoding to use when merging context and
136      * template.
137      * @throws ServiceException Any exception trown while processing will be
138      * wrapped into a ServiceException and rethrown.
139      */

140     public void handleRequest(Context context, String JavaDoc filename,
141                               OutputStream JavaDoc out, String JavaDoc charset,
142                               String JavaDoc encoding)
143         throws ServiceException;
144
145     /**
146      * Process the request and fill in the template using the values
147      * set in <code>context</code>.
148      *
149      * @param context A context to use when evaluating the specified
150      * template.
151      * @param filename The file name of the template.
152      * @param writer The writer to which we will write the processed template.
153      * @throws ServiceException Any exception trown while processing will be
154      * wrapped into a ServiceException and rethrown.
155      */

156     public void handleRequest(Context context, String JavaDoc filename,
157                               Writer JavaDoc writer)
158         throws ServiceException;
159
160     /**
161      * Process the request and fill in the template using the values
162      * set in <code>context</code>.
163      *
164      * @param context A context to use when evaluating the specified
165      * template.
166      * @param filename The file name of the template.
167      * @param writer The writer to which we will write the processed template.
168      * @param encoding The encoding to use when merging context and
169      * template.
170      * @throws ServiceException Any exception trown while processing will be
171      * wrapped into a ServiceException and rethrown.
172      */

173     public void handleRequest(Context context, String JavaDoc filename,
174                               Writer JavaDoc writer, String JavaDoc encoding)
175         throws ServiceException;
176
177     /**
178      * Returns the populated event cartridge or null if it has not been populated
179      */

180     public EventCartridge getEventCartridge();
181
182     /**
183      * By default, this is true if there is configured event cartridges.
184      * You can disable EC processing if you first disable it and then call
185      * handleRequest.
186      */

187     public void setEventCartridgeEnabled(boolean value);
188 }
189
Popular Tags