Coverage Report - org.apache.fulcrum.xslt.XSLTServiceFacade
 
Classes in this File Line Coverage Branch Coverage Complexity
XSLTServiceFacade
15%
3/19
N/A
1
 
 1  
 package org.apache.fulcrum.xslt;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *   http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import java.io.Reader;
 23  
 import java.io.Writer;
 24  
 import java.util.Map;
 25  
 
 26  
 import org.w3c.dom.Node;
 27  
 
 28  
 /**
 29  
  * This is a static accesor class for {@link XSLTService}.
 30  
  *
 31  
  * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
 32  
  * @author <a href="mailto:tv@apache.org">Thomas Vandahl</a>
 33  
  */
 34  0
 public class XSLTServiceFacade
 35  
 {
 36  
     private static XSLTService xsltService;
 37  
 
 38  
     /**
 39  
      * Utility method for accessing the service implementation
 40  
      *
 41  
      * @return a XSLTService implementation instance
 42  
      */
 43  
     protected static XSLTService getService()
 44  
     {
 45  2
         return xsltService;
 46  
     }
 47  
 
 48  
     /**
 49  
      * Static utility method to set the service instance to be used in the
 50  
      * facade
 51  
      *
 52  
      * @param xsltService
 53  
      *            the service instance
 54  
      */
 55  
     protected static void setService(XSLTService xsltService)
 56  
     {
 57  4
         XSLTServiceFacade.xsltService = xsltService;
 58  4
     }
 59  
 
 60  
     /**
 61  
      * Uses an xsl file to transform xml input from a reader and writes the
 62  
      * output to a writer.
 63  
      *
 64  
      * @param xslName The name of the file that contains the xsl stylesheet.
 65  
      * @param in The reader that passes the xml to be transformed
 66  
      * @param out The writer for the transformed output
 67  
      * @throws Exception the transformation failed
 68  
      */
 69  
     public static void transform(String xslName, Reader in, Writer out)
 70  
             throws Exception
 71  
     {
 72  0
         getService().transform(xslName, in, out);
 73  0
     }
 74  
 
 75  
     /**
 76  
      * Uses an xsl file to transform xml input from a reader and returns a
 77  
      * string containing the transformed output.
 78  
      *
 79  
      * @param xslName The name of the file that contains the xsl stylesheet.
 80  
      * @param in The reader that passes the xml to be transformed
 81  
      * @return the transformed output
 82  
      * @throws Exception the transformation failed
 83  
      */
 84  
     public static String transform(String xslName, Reader in) throws Exception
 85  
     {
 86  0
         return getService().transform(xslName, in);
 87  
     }
 88  
 
 89  
     /**
 90  
      * Uses an xsl file to transform xml input from a DOM note and writes the
 91  
      * output to a writer.
 92  
      *
 93  
      * @param xslName The name of the file that contains the xsl stylesheet.
 94  
      * @param in The DOM Node to be transformed
 95  
      * @param out The writer for the transformed output
 96  
      * @throws Exception the transformation failed
 97  
      */
 98  
     public void transform(String xslName, Node in, Writer out) throws Exception
 99  
     {
 100  0
         getService().transform(xslName, in, out);
 101  0
     }
 102  
 
 103  
     /**
 104  
      * Uses an xsl file to transform xml input from a DOM note and returns a
 105  
      * string containing the transformed output.
 106  
      *
 107  
      * @param xslName The name of the file that contains the xsl stylesheet.
 108  
      * @param in The DOM Node to be transformed
 109  
      * @return the transformed output
 110  
      * @throws Exception the transformation failed
 111  
      */
 112  
     public String transform(String xslName, Node in) throws Exception
 113  
     {
 114  0
         return getService().transform(xslName, in);
 115  
     }
 116  
 
 117  
     /**
 118  
      * Uses an xsl file to transform xml input from a reader and writes the
 119  
      * output to a writer.
 120  
      *
 121  
      * @param xslName The name of the file that contains the xsl stylesheet.
 122  
      * @param in The reader that passes the xml to be transformed
 123  
      * @param out The writer for the transformed output
 124  
      * @param params A set of parameters that will be forwarded to the XSLT
 125  
      * @throws Exception the transformation failed
 126  
      */
 127  
     void transform(String xslName, Reader in, Writer out, Map<?, ?> params) throws Exception
 128  
     {
 129  0
         getService().transform(xslName, in, out, params);
 130  0
     }
 131  
 
 132  
     /**
 133  
      * Uses an xsl file to transform xml input from a reader and returns a
 134  
      * string containing the transformed output.
 135  
      *
 136  
      * @param xslName The name of the file that contains the xsl stylesheet.
 137  
      * @param in The reader that passes the xml to be transformed
 138  
      * @param params A set of parameters that will be forwarded to the XSLT
 139  
      * @return the transformed output
 140  
      * @throws Exception the transformation failed
 141  
      */
 142  
     String transform(String xslName, Reader in, Map<?, ?> params) throws Exception
 143  
     {
 144  0
         return getService().transform(xslName, in, params);
 145  
     }
 146  
 
 147  
     /**
 148  
      * Uses an xsl file to transform xml input from a DOM note and writes the
 149  
      * output to a writer.
 150  
      *
 151  
      * @param xslName The name of the file that contains the xsl stylesheet.
 152  
      * @param in The DOM Node to be transformed
 153  
      * @param out The writer for the transformed output
 154  
      * @param params A set of parameters that will be forwarded to the XSLT
 155  
      * @throws Exception the transformation failed
 156  
      */
 157  
     void transform(String xslName, Node in, Writer out, Map<?, ?> params) throws Exception
 158  
     {
 159  0
         getService().transform(xslName, in, out, params);
 160  0
     }
 161  
 
 162  
     /**
 163  
      * Uses an xsl file to transform xml input from a DOM note and returns a
 164  
      * string containing the transformed output.
 165  
      *
 166  
      * @param xslName The name of the file that contains the xsl stylesheet.
 167  
      * @param in The DOM Node to be transformed
 168  
      * @param params A set of parameters that will be forwarded to the XSLT
 169  
      * @return the transformed output
 170  
      * @throws Exception the transformation failed
 171  
      */
 172  
     String transform(String xslName, Node in, Map<?, ?> params) throws Exception
 173  
     {
 174  0
         return getService().transform(xslName, in, params);
 175  
     }
 176  
 
 177  
     /**
 178  
      * Uses an xsl file without any xml input.
 179  
      *
 180  
      * @param xslName The name of the file that contains the xsl stylesheet.
 181  
      * @param params A set of parameters that will be forwarded to the XSLT
 182  
      * @return the transformed output
 183  
      * @throws Exception the transformation failed
 184  
      */
 185  
     public String transform(String xslName, Map<?, ?> params) throws Exception 
 186  
     {
 187  0
         return getService().transform(xslName, params);
 188  
     }
 189  
 
 190  
     /**
 191  
      * Uses an xsl file without any xml input.
 192  
      *
 193  
      * @param xslName The name of the file that contains the xsl stylesheet
 194  
      * @param out The writer for the transformed output.
 195  
      * @param params A set of parameters that will be forwarded to the XSLT
 196  
      * @throws Exception the transformation failed
 197  
      */    
 198  
     public void transform(String xslName, Writer out, Map<?, ?> params) throws Exception 
 199  
     {
 200  0
         getService().transform(xslName, out, params);
 201  0
     }
 202  
 }