View Javadoc

1   /*
2    * Copyright 2000-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services;
18  
19  //standard java stuff
20  import java.io.Reader;
21  
22  // jetspeed stuff
23  import org.apache.jetspeed.services.transformer.TransformerService;
24  
25  // turbine stuff
26  import org.apache.turbine.services.TurbineServices;
27  
28  
29  /***
30   * <P>This is a commodity static accessor class around the 
31   * <code>TransformerService</code></P>
32   * 
33   * @see org.apache.jetspeed.services.transformer.TransformerService
34   * @author <a href="mailto:mmari@ce.unipr.it">Marco Mari</a>
35   * @version $Id: Transformer.java,v 1.2 2004/02/23 04:00:57 jford Exp $ 
36   */
37  public class Transformer {
38   
39      /*** 
40       * Commodity method for getting a reference to the service
41       * singleton
42       */
43      private static TransformerService getService() 
44      {
45          return (TransformerService)TurbineServices
46                  .getInstance()
47                  .getService(TransformerService.SERVICE_NAME);     
48      }
49      
50      /***
51       * @see org.apache.jetspeed.services.transformer.TransformerService#findElement
52       */
53      public static String findElement(Reader htmlReader, String url, String element)  
54      {
55          return getService().findElement(htmlReader, url, element);
56      }
57  
58      /***
59       * @see org.apache.jetspeed.services.transformer.TransformerService#clipElements
60       */
61      public static String clipElements(Reader htmlReader, 
62                                         String url, 
63                                         String startElement, 
64                                         String stopElement)
65      {
66          return getService().clipElements(htmlReader, url, startElement, stopElement);
67      }
68  
69      /***
70       * @see org.apache.jetspeed.services.transformer.TransformerService#findElementNumber
71       */
72      public static String findElementNumber(Reader htmlReader, 
73                                              String url, 
74                                              String element, 
75                                              int    tagNumber)  
76      {
77          return getService().findElementNumber(htmlReader, url, element, tagNumber);
78      }
79  
80       /***
81       * @see org.apache.jetspeed.services.transformer.TransformerService#clipElementsNumber
82       */
83      public static String clipElementsNumber(Reader htmlReader, 
84                                               String url, 
85                                               String startElement, 
86                                               String stopElement,
87                                               int    tagNumber)
88      {
89          return getService().clipElementsNumber(htmlReader, 
90                                                  url, 
91                                                  startElement, 
92                                                  stopElement, 
93                                                  tagNumber);
94      }
95  }