Source code: com/fm/transform/Transformer.java
1 /****************************************************************************
2 * Copyright (c) 2003 Andrew Duka | aduka@users.sourceforge.net
3 * All right reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 ****************************************************************************/
11 package com.fm.transform;
12
13 import com.fm.rss.rssChannel;
14 import com.fm.rss.rssItem;
15 import com.fm.rss.filter.RssItemFilter;
16
17 /**
18 * Abstract class, which defines common behavior for item transformators.
19 *
20 * <p>It is desirable to read channel items in various text formats, for
21 * example reading item's text from the UNIX CLI in the HTML format doesn't
22 * look pleasant. So item transformators transform the RSS channel items
23 * into appropriate text format (e.g. HTML, plain text, DocBook).</p>
24 *
25 * <p>Nevertheless the output format isn't required to be text, it also may
26 * be <code>fmTransofrmer</code> interface defines common behavior
27 * for all transformers.</p>
28 *
29 * @author Andrew Duka (Adnrew.Duka@oktet.ru)
30 */
31 public interface Transformer
32 {
33 /**
34 * Set specified RSS channel object as the source for further transformations
35 *
36 * @param ch
37 */
38 public void setSourceChannel(rssChannel ch);
39
40
41 /**
42 * Get value of the transformer's parameter
43 *
44 * @param param_name String with name of the parameter to get
45 *
46 * @return String with value of the parameter, if exists or
47 * null otherwise
48 */
49 public Object getParamValue(String param_name);
50
51 /**
52 * Set value of the transformer's parameter
53 *
54 * @param param_name String with name of the parameter to set
55 * @param value Value of the parameter
56 *
57 */
58 public void setParamValue(String param_name, Object value);
59
60 /**
61 * Transform prevously specified channel into output format
62 *
63 * @return Text representation of the channel
64 * @throws fmTransformException
65 */
66 public Object transform() throws fmTransformException;
67
68 /**
69 * Transform specified channel into output format
70 *
71 * @return Text representation of the channel
72 * @throws fmTransformException
73 */
74 public Object transform(rssChannel ch) throws fmTransformException;
75
76 /**
77 * Transform specified into into output format
78 *
79 * @return txt/html representation of the channel
80 * @throws fmTransformException
81 */
82 public Object transform(rssItem ch) throws fmTransformException;
83
84 /**
85 * Set item filter
86 *
87 * @param f RSS item filter
88 */
89 public void setItemFilter(RssItemFilter f);
90
91 /**
92 * Return current item filter
93 *
94 * @return RSS item filter
95 */
96 public RssItemFilter getItemFilter();
97
98
99
100
101
102 }