Commit | Line | Data |
---|---|---|
73785268 NR |
1 | package be.nikiroo.gofetch.output; |
2 | ||
73785268 | 3 | import be.nikiroo.gofetch.data.Story; |
c715ea02 | 4 | import be.nikiroo.gofetch.support.BasicSupport; |
3e62b034 | 5 | import be.nikiroo.gofetch.support.Type; |
73785268 NR |
6 | |
7 | /** | |
8 | * Base class for output operations. | |
9 | * | |
10 | * @author niki | |
11 | */ | |
12 | public abstract class Output { | |
13 | /** | |
14 | * The type of source, can be NULL for no-type. | |
15 | */ | |
16 | protected Type type; | |
17 | ||
70b18499 NR |
18 | /** |
19 | * The gopher hostname to use. | |
20 | */ | |
21 | protected String hostname; | |
22 | ||
23 | /** | |
24 | * The sub directory and (pre-)selector to use for the resources. | |
25 | */ | |
26 | protected String preselector; | |
27 | ||
28 | /** | |
29 | * The Gopher port to use. | |
30 | */ | |
31 | protected int port; | |
32 | ||
73785268 NR |
33 | /** |
34 | * Create a new {@link Output} class for the given type (which can be NULL). | |
35 | * | |
36 | * @param type | |
37 | * the type or NULL for no type | |
70b18499 NR |
38 | * @param hostname |
39 | * the gopher hostname to use | |
40 | * @param preselector | |
41 | * the sub directory and (pre-)selector to use for the resources | |
42 | * @param port | |
43 | * the Gopher port to use | |
73785268 | 44 | */ |
70b18499 | 45 | public Output(Type type, String hostname, String preselector, int port) { |
73785268 | 46 | this.type = type; |
70b18499 NR |
47 | this.hostname = hostname; |
48 | this.preselector = preselector; | |
49 | this.port = port; | |
73785268 NR |
50 | } |
51 | ||
52 | /** | |
c715ea02 NR |
53 | * Get the header to use in the main index file (the one which will |
54 | * reference all the supported web sites <tt>index</tt> files). | |
73785268 NR |
55 | * |
56 | * @return the header | |
57 | */ | |
c715ea02 | 58 | abstract public String getMainIndexHeader(); |
73785268 NR |
59 | |
60 | /** | |
c715ea02 NR |
61 | * Get the footer to use in the index file (the one which will reference all |
62 | * the supported web sites <tt>index</tt> files). | |
73785268 NR |
63 | * |
64 | * @return the footer | |
65 | */ | |
c715ea02 NR |
66 | abstract public String getMainIndexFooter(); |
67 | ||
68 | /** | |
69 | * Get the header to use in the index file (the supported web site | |
70 | * <tt>index</tt> file this output is for). | |
71 | * | |
72 | * @param support | |
73 | * the supported web site | |
74 | * | |
75 | * @return the header | |
76 | */ | |
77 | abstract public String getIndexHeader(BasicSupport support); | |
78 | ||
79 | /** | |
80 | * Get the footer to use in the index file (the supported web site | |
81 | * <tt>index</tt> file this output is for). | |
82 | * | |
83 | * @param support | |
84 | * the supported web site | |
85 | * | |
86 | * @return the footer | |
87 | */ | |
88 | abstract public String getIndexFooter(BasicSupport support); | |
73785268 NR |
89 | |
90 | /** | |
5c056aad | 91 | * Export the header of a story (a <i>resume</i> mode). |
73785268 NR |
92 | * |
93 | * @param story | |
94 | * the story | |
95 | * | |
96 | * @return the resume | |
97 | */ | |
5c056aad | 98 | abstract public String exportHeader(Story story); |
73785268 NR |
99 | |
100 | /** | |
101 | * Export a full story with comments. | |
102 | * | |
103 | * @param story | |
104 | * the story | |
73785268 NR |
105 | * |
106 | * @return the story | |
107 | */ | |
5c056aad | 108 | abstract public String export(Story story); |
73785268 | 109 | } |