Limit to 67 chars, fix content for LWN (still WIP)
[gofetch.git] / src / be / nikiroo / gofetch / output / Output.java
CommitLineData
73785268
NR
1package be.nikiroo.gofetch.output;
2
3import java.util.List;
4
5import be.nikiroo.gofetch.data.Comment;
6import be.nikiroo.gofetch.data.Story;
7import be.nikiroo.gofetch.support.BasicSupport.Type;
8
9/**
10 * Base class for output operations.
11 *
12 * @author niki
13 */
14public abstract class Output {
15 /**
16 * The type of source, can be NULL for no-type.
17 */
18 protected Type type;
19
70b18499
NR
20 /**
21 * The gopher hostname to use.
22 */
23 protected String hostname;
24
25 /**
26 * The sub directory and (pre-)selector to use for the resources.
27 */
28 protected String preselector;
29
30 /**
31 * The Gopher port to use.
32 */
33 protected int port;
34
73785268
NR
35 /**
36 * Create a new {@link Output} class for the given type (which can be NULL).
37 *
38 * @param type
39 * the type or NULL for no type
70b18499
NR
40 * @param hostname
41 * the gopher hostname to use
42 * @param preselector
43 * the sub directory and (pre-)selector to use for the resources
44 * @param port
45 * the Gopher port to use
73785268 46 */
70b18499 47 public Output(Type type, String hostname, String preselector, int port) {
73785268 48 this.type = type;
70b18499
NR
49 this.hostname = hostname;
50 this.preselector = preselector;
51 this.port = port;
73785268
NR
52 }
53
54 /**
55 * Get the header to use in the index file.
56 *
57 * @return the header
58 */
59 abstract public String getIndexHeader();
60
61 /**
62 * Get the footer to use in the index file.
63 *
64 * @return the footer
65 */
66 abstract public String getIndexFooter();
67
68 /**
69 * Export a story (in resume mode).
70 *
71 * @param story
72 * the story
73 *
74 * @return the resume
75 */
76 abstract public String export(Story story);
77
78 /**
79 * Export a full story with comments.
80 *
81 * @param story
82 * the story
83 * @param comments
84 * the comments
85 *
86 * @return the story
87 */
88 abstract public String export(Story story, List<Comment> comments);
89}