blob: 93708aa24db6be5635c3e19b836e5c8c122c68d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
/*
* Created on Saturday, May 15 2010 17:07
*/
package com.jogamp.hungryharry;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlValue;
/**
* Hungry Harry's configuration.
* @author Michael Bien
*/
@XmlType(name = "")
@XmlRootElement(name = "config")
public class Config {
@XmlElement(required = true)
public final List<Feed> feed;
@XmlElement(required = true)
public final List<Template> template;
@XmlElement(required = true)
public final Planet planet;
public Config() {
feed = null;
template = new ArrayList<Template>();
planet = null;
}
@XmlType
public static class Feed {
@XmlAttribute
public final String name;
@XmlAttribute
public final String url;
public Feed() {
name = null;
url = null;
}
@Override
public String toString() {
return getClass().getName() + "[" + name + ", " + url+"]";
}
}
@XmlType
public static class Template {
@XmlAttribute
public final String keyword;
@XmlAttribute(name="idpattern")
public final String idpattern;
@XmlAttribute
public final String descriptionfilter;
@XmlValue
public final String text;
public Template() {
keyword = null;
text = null;
idpattern = null;
descriptionfilter = null;
}
@Override
public String toString() {
return getClass().getName() + "["+ keyword +"]";
}
}
@XmlType
public static class Planet {
@XmlAttribute
public final String title;
@XmlAttribute
public final String description;
@XmlAttribute
public final String author;
@XmlAttribute
public final String link;
@XmlAttribute
public final int maxEntries;
@XmlElement(name="feed")
public final List<PlanetFeed> feeds;
@XmlElement(name="template")
public final String templatePath;
@XmlElement(name="output")
public final String outputFolder;
public Planet() {
title = null;
description = null;
author = null;
link = null;
feeds = null;
templatePath = null;
outputFolder = null;
maxEntries = 0;
}
public String getLink() {
return link;
}
@XmlType
public static class PlanetFeed {
@XmlValue
public String type;
public String getSpecificType() {
return type;
}
public String getFeedType() {
if(type.contains("atom"))
return "atom";
if(type.contains("rss"))
return "rss";
return "";
}
public String getFileName() {
return type+".xml";
}
}
}
}
|