KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mmbase > util > transformers > ConfigurableReaderTransformer


1 /*
2
3 This software is OSI Certified Open Source Software.
4 OSI Certified is a certification mark of the Open Source Initiative.
5
6 The license (Mozilla version 1.0) can be read at the MMBase site.
7 See http://www.MMBase.org/license
8
9 */

10 package org.mmbase.util.transformers;
11
12 import java.util.Map JavaDoc;
13
14 /**
15  * Some Transformers implement more than one transformation. The instance can be configured.
16  *
17  * @author Michiel Meeuwissen
18  * @since MMBase-1.7
19  */

20 public abstract class ConfigurableReaderTransformer extends ReaderTransformer implements ConfigurableTransformer {
21
22     protected int to;
23
24     public ConfigurableReaderTransformer() {
25         super();
26     }
27
28     public ConfigurableReaderTransformer(int conf) {
29         super();
30         configure(conf);
31     }
32
33     public void configure(int t) {
34         //log.info("Setting config to " + t);
35
to = t;
36     }
37     abstract public Map JavaDoc transformers();
38     abstract public String JavaDoc getEncoding();
39
40     public String JavaDoc toString() {
41         try {
42             return getEncoding();
43         } catch (Exception JavaDoc e) {
44             return "UNCONFIGURED " + super.toString();
45         }
46     }
47 }
48
Popular Tags