Coverage Report - org.apache.fulcrum.template.velocity.VelocityService
 
Classes in this File Line Coverage Branch Coverage Complexity
VelocityService
N/A
N/A
1
 
 1  
 package org.apache.fulcrum.template.velocity;
 2  
 
 3  
 
 4  
 /*
 5  
  * Licensed to the Apache Software Foundation (ASF) under one
 6  
  * or more contributor license agreements.  See the NOTICE file
 7  
  * distributed with this work for additional information
 8  
  * regarding copyright ownership.  The ASF licenses this file
 9  
  * to you under the Apache License, Version 2.0 (the
 10  
  * "License"); you may not use this file except in compliance
 11  
  * with the License.  You may obtain a copy of the License at
 12  
  *
 13  
  *   http://www.apache.org/licenses/LICENSE-2.0
 14  
  *
 15  
  * Unless required by applicable law or agreed to in writing,
 16  
  * software distributed under the License is distributed on an
 17  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 18  
  * KIND, either express or implied.  See the License for the
 19  
  * specific language governing permissions and limitations
 20  
  * under the License.
 21  
  */
 22  
 
 23  
 
 24  
 import java.io.OutputStream;
 25  
 import java.io.Writer;
 26  
 
 27  
 import org.apache.fulcrum.template.TemplateException;
 28  
 import org.apache.velocity.app.event.EventCartridge;
 29  
 import org.apache.velocity.context.Context;
 30  
 
 31  
 /**
 32  
  * The Turbine service interface to
 33  
  * <a href="http://velocity.apache.org/engine/">Velocity</a>.
 34  
  *
 35  
  * @author <a href="mailto:jmcnally@collab.net">John D. McNally</a>
 36  
  * @author <a href="mailto:mbryson@mont.mindspring.com">Dave Bryson</a>
 37  
  * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
 38  
  * @author <a href="mailto:dlr@finemaltcoding.com">Daniel Rall</a>
 39  
  * @version $Id: VelocityService.java 615226 2008-01-25 14:09:01Z seade $
 40  
  */
 41  
 public interface VelocityService
 42  
 {
 43  
     String ROLE = VelocityService.class.getName();
 44  
 
 45  
     /**
 46  
      * Process the request and fill in the template using the values
 47  
      * set in <code>context</code>.
 48  
      *
 49  
      * @param context A context to use when evaluating the specified
 50  
      * template.
 51  
      * @param filename The file name of the template.
 52  
      * @return The processed template.
 53  
      * @exception Exception, a generic exception.
 54  
      */
 55  
     public String handleRequest(Context context, String filename)
 56  
         throws TemplateException;
 57  
 
 58  
     /**
 59  
      * Process the request and fill in the template using the values
 60  
      * set in <code>context</code>.
 61  
      *
 62  
      * @param context A context to use when evaluating the specified
 63  
      * template.
 64  
      * @param filename The file name of the template.
 65  
      * @param charset The character set to use when writing the result.
 66  
      * @param encoding The encoding to use when merging context and
 67  
      * template.
 68  
      * @return The processed template.
 69  
      * @exception Exception, a generic exception.
 70  
      */
 71  
     public String handleRequest(Context context, String template,
 72  
                                 String charset, String encoding)
 73  
         throws TemplateException;
 74  
 
 75  
     /**
 76  
      * Process the request and fill in the template using the values
 77  
      * set in <code>context</code>.
 78  
      *
 79  
      * @param context A context to use when evaluating the specified
 80  
      * template.
 81  
      * @param filename The file name of the template.
 82  
      * @param out The stream to which we will write the processed
 83  
      * template as a String.
 84  
      * @throws ServiceException Any exception trown while processing will be
 85  
      *         wrapped into a ServiceException and rethrown.
 86  
      */
 87  
     public void handleRequest(Context context, String filename,
 88  
                               OutputStream out)
 89  
         throws TemplateException;
 90  
 
 91  
     /**
 92  
      * Process the request and fill in the template using the values
 93  
      * set in <code>context</code>.
 94  
      *
 95  
      * @param context A context to use when evaluating the specified
 96  
      * template.
 97  
      * @param filename The file name of the template.
 98  
      * @param out The stream to which we will write the processed
 99  
      * template as a String.
 100  
      * @param charset The character set to use when writing the result.
 101  
      * @param encoding The encoding to use when merging context and
 102  
      * template.
 103  
      * @throws ServiceException Any exception trown while processing will be
 104  
      *         wrapped into a ServiceException and rethrown.
 105  
      */
 106  
     public void handleRequest(Context context, String filename,
 107  
                               OutputStream out, String charset,
 108  
                               String encoding)
 109  
         throws TemplateException;
 110  
 
 111  
     /**
 112  
      * Process the request and fill in the template using the values
 113  
      * set in <code>context</code>.
 114  
      *
 115  
      * @param context A context to use when evaluating the specified
 116  
      * template.
 117  
      * @param filename The file name of the template.
 118  
      * @param writer The writer to which we will write the processed template.
 119  
      * @throws ServiceException Any exception trown while processing will be
 120  
      *         wrapped into a ServiceException and rethrown.
 121  
      */
 122  
     public void handleRequest(Context context, String filename,
 123  
                               Writer writer)
 124  
         throws TemplateException;
 125  
 
 126  
     /**
 127  
      * Process the request and fill in the template using the values
 128  
      * set in <code>context</code>.
 129  
      *
 130  
      * @param context A context to use when evaluating the specified
 131  
      * template.
 132  
      * @param filename The file name of the template.
 133  
      * @param writer The writer to which we will write the processed template.
 134  
      * @param encoding The encoding to use when merging context and
 135  
      * template.
 136  
      * @throws ServiceException Any exception trown while processing will be
 137  
      *         wrapped into a ServiceException and rethrown.
 138  
      */
 139  
     public void handleRequest(Context context, String filename,
 140  
                               Writer writer, String encoding)
 141  
         throws TemplateException;
 142  
 
 143  
     /**
 144  
      * Returns the populated event cartridge or null if it has not been populated
 145  
      */
 146  
     public EventCartridge getEventCartridge();
 147  
 
 148  
     /**
 149  
      * By default, this is true if there is configured event cartridges.
 150  
      * You can disable EC processing if you first disable it and then call
 151  
      * handleRequest.
 152  
      */
 153  
     public void setEventCartridgeEnabled(boolean value);
 154  
 }