franta-hg@63
|
1 |
/*
|
franta-hg@63
|
2 |
* SONEWS News Server
|
franta-hg@63
|
3 |
* see AUTHORS for the list of contributors
|
franta-hg@63
|
4 |
*
|
franta-hg@63
|
5 |
* This program is free software: you can redistribute it and/or modify
|
franta-hg@63
|
6 |
* it under the terms of the GNU General Public License as published by
|
franta-hg@63
|
7 |
* the Free Software Foundation, either version 3 of the License, or
|
franta-hg@63
|
8 |
* (at your option) any later version.
|
franta-hg@63
|
9 |
*
|
franta-hg@63
|
10 |
* This program is distributed in the hope that it will be useful,
|
franta-hg@63
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
franta-hg@63
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
franta-hg@63
|
13 |
* GNU General Public License for more details.
|
franta-hg@63
|
14 |
*
|
franta-hg@63
|
15 |
* You should have received a copy of the GNU General Public License
|
franta-hg@63
|
16 |
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
franta-hg@63
|
17 |
*/
|
franta-hg@63
|
18 |
package org.sonews.storage.impl;
|
franta-hg@63
|
19 |
|
franta-hg@64
|
20 |
import java.sql.SQLException;
|
franta-hg@65
|
21 |
import java.util.Collections;
|
franta-hg@64
|
22 |
import java.util.List;
|
franta-hg@65
|
23 |
import java.util.logging.Level;
|
franta-hg@64
|
24 |
import org.sonews.feed.Subscription;
|
franta-hg@64
|
25 |
import org.sonews.storage.Article;
|
franta-hg@64
|
26 |
import org.sonews.storage.ArticleHead;
|
franta-hg@64
|
27 |
import org.sonews.storage.Group;
|
franta-hg@64
|
28 |
import org.sonews.storage.Storage;
|
franta-hg@64
|
29 |
import org.sonews.storage.StorageBackendException;
|
franta-hg@65
|
30 |
import org.sonews.util.Log;
|
franta-hg@64
|
31 |
import org.sonews.util.Pair;
|
franta-hg@64
|
32 |
|
franta-hg@63
|
33 |
/**
|
franta-hg@63
|
34 |
*
|
franta-hg@63
|
35 |
* @author František Kučera (frantovo.cz)
|
franta-hg@63
|
36 |
*/
|
franta-hg@64
|
37 |
public class DrupalDatabase implements Storage {
|
franta-hg@64
|
38 |
|
franta-hg@64
|
39 |
/**
|
franta-hg@64
|
40 |
* Rises the database: reconnect and recreate all prepared statements.
|
franta-hg@64
|
41 |
* @throws java.lang.SQLException
|
franta-hg@64
|
42 |
*/
|
franta-hg@64
|
43 |
protected void arise() throws SQLException {
|
franta-hg@64
|
44 |
}
|
franta-hg@64
|
45 |
|
franta-hg@64
|
46 |
@Override
|
franta-hg@64
|
47 |
public void addArticle(Article art) throws StorageBackendException {
|
franta-hg@65
|
48 |
Log.get().log(Level.SEVERE, "TODO: addArticle {0}", new Object[]{art});
|
franta-hg@64
|
49 |
}
|
franta-hg@64
|
50 |
|
franta-hg@64
|
51 |
@Override
|
franta-hg@64
|
52 |
public void addEvent(long timestamp, int type, long groupID) throws StorageBackendException {
|
franta-hg@65
|
53 |
Log.get().log(Level.SEVERE, "TODO: addEvent {0} / {1} / {2}", new Object[]{timestamp, type, groupID});
|
franta-hg@64
|
54 |
}
|
franta-hg@64
|
55 |
|
franta-hg@64
|
56 |
@Override
|
franta-hg@64
|
57 |
public void addGroup(String groupname, int flags) throws StorageBackendException {
|
franta-hg@65
|
58 |
Log.get().log(Level.SEVERE, "TODO: addGroup {0} / {1}", new Object[]{groupname, flags});
|
franta-hg@64
|
59 |
}
|
franta-hg@64
|
60 |
|
franta-hg@64
|
61 |
@Override
|
franta-hg@64
|
62 |
public int countArticles() throws StorageBackendException {
|
franta-hg@65
|
63 |
Log.get().log(Level.SEVERE, "TODO: countArticles");
|
franta-hg@65
|
64 |
return 0;
|
franta-hg@64
|
65 |
}
|
franta-hg@64
|
66 |
|
franta-hg@64
|
67 |
@Override
|
franta-hg@64
|
68 |
public int countGroups() throws StorageBackendException {
|
franta-hg@65
|
69 |
Log.get().log(Level.SEVERE, "TODO: countGroups");
|
franta-hg@65
|
70 |
return 0;
|
franta-hg@64
|
71 |
}
|
franta-hg@64
|
72 |
|
franta-hg@64
|
73 |
@Override
|
franta-hg@64
|
74 |
public void delete(String messageID) throws StorageBackendException {
|
franta-hg@65
|
75 |
Log.get().log(Level.SEVERE, "TODO: delete {0}", new Object[]{messageID});
|
franta-hg@64
|
76 |
}
|
franta-hg@64
|
77 |
|
franta-hg@64
|
78 |
@Override
|
franta-hg@64
|
79 |
public Article getArticle(String messageID) throws StorageBackendException {
|
franta-hg@65
|
80 |
Log.get().log(Level.SEVERE, "TODO: getArticle {0}", new Object[]{messageID});
|
franta-hg@65
|
81 |
/** TODO: */
|
franta-hg@65
|
82 |
return null;
|
franta-hg@64
|
83 |
}
|
franta-hg@64
|
84 |
|
franta-hg@64
|
85 |
@Override
|
franta-hg@64
|
86 |
public Article getArticle(long articleIndex, long groupID) throws StorageBackendException {
|
franta-hg@65
|
87 |
Log.get().log(Level.SEVERE, "TODO: getArticle {0} / {1}", new Object[]{articleIndex, groupID});
|
franta-hg@65
|
88 |
/** TODO: */
|
franta-hg@65
|
89 |
return null;
|
franta-hg@64
|
90 |
}
|
franta-hg@64
|
91 |
|
franta-hg@64
|
92 |
@Override
|
franta-hg@64
|
93 |
public List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last) throws StorageBackendException {
|
franta-hg@65
|
94 |
Log.get().log(Level.SEVERE, "TODO: getArticleHeads {0} / {1} / {2}", new Object[]{group, first, last});
|
franta-hg@65
|
95 |
/** TODO: */
|
franta-hg@65
|
96 |
return Collections.emptyList();
|
franta-hg@64
|
97 |
}
|
franta-hg@64
|
98 |
|
franta-hg@64
|
99 |
@Override
|
franta-hg@64
|
100 |
public List<Pair<Long, String>> getArticleHeaders(Group group, long start, long end, String header, String pattern) throws StorageBackendException {
|
franta-hg@65
|
101 |
Log.get().log(Level.SEVERE, "TODO: getArticleHeaders {0} / {1} / {2} / {3} / {4}", new Object[]{group, start, end, header, pattern});
|
franta-hg@65
|
102 |
/** TODO: */
|
franta-hg@65
|
103 |
return Collections.emptyList();
|
franta-hg@64
|
104 |
}
|
franta-hg@64
|
105 |
|
franta-hg@64
|
106 |
@Override
|
franta-hg@64
|
107 |
public long getArticleIndex(Article art, Group group) throws StorageBackendException {
|
franta-hg@65
|
108 |
Log.get().log(Level.SEVERE, "TODO: getArticleIndex {0} / {1}", new Object[]{art, group});
|
franta-hg@65
|
109 |
/** TODO: */
|
franta-hg@65
|
110 |
return 0;
|
franta-hg@64
|
111 |
}
|
franta-hg@64
|
112 |
|
franta-hg@64
|
113 |
@Override
|
franta-hg@64
|
114 |
public List<Long> getArticleNumbers(long groupID) throws StorageBackendException {
|
franta-hg@65
|
115 |
Log.get().log(Level.SEVERE, "TODO: getArticleNumbers {0}", new Object[]{groupID});
|
franta-hg@65
|
116 |
/** TODO: */
|
franta-hg@65
|
117 |
return Collections.emptyList();
|
franta-hg@64
|
118 |
}
|
franta-hg@64
|
119 |
|
franta-hg@64
|
120 |
@Override
|
franta-hg@64
|
121 |
public String getConfigValue(String key) throws StorageBackendException {
|
franta-hg@65
|
122 |
Log.get().log(Level.SEVERE, "TODO: getConfigValue {0}", new Object[]{key});
|
franta-hg@65
|
123 |
return null;
|
franta-hg@64
|
124 |
}
|
franta-hg@64
|
125 |
|
franta-hg@64
|
126 |
@Override
|
franta-hg@64
|
127 |
public int getEventsCount(int eventType, long startTimestamp, long endTimestamp, Group group) throws StorageBackendException {
|
franta-hg@65
|
128 |
Log.get().log(Level.SEVERE, "TODO: getEventsCount {0} / {1} / {2} / {3}", new Object[]{eventType, startTimestamp, endTimestamp, group});
|
franta-hg@65
|
129 |
return 0;
|
franta-hg@64
|
130 |
}
|
franta-hg@64
|
131 |
|
franta-hg@64
|
132 |
@Override
|
franta-hg@64
|
133 |
public double getEventsPerHour(int key, long gid) throws StorageBackendException {
|
franta-hg@65
|
134 |
Log.get().log(Level.SEVERE, "TODO: getEventsPerHour {0} / {1}", new Object[]{key, gid});
|
franta-hg@65
|
135 |
return 0;
|
franta-hg@64
|
136 |
}
|
franta-hg@64
|
137 |
|
franta-hg@64
|
138 |
@Override
|
franta-hg@64
|
139 |
public int getFirstArticleNumber(Group group) throws StorageBackendException {
|
franta-hg@65
|
140 |
Log.get().log(Level.SEVERE, "TODO: getFirstArticleNumber {0}", new Object[]{group});
|
franta-hg@65
|
141 |
/** TODO: */
|
franta-hg@65
|
142 |
return 0;
|
franta-hg@64
|
143 |
}
|
franta-hg@64
|
144 |
|
franta-hg@64
|
145 |
@Override
|
franta-hg@64
|
146 |
public Group getGroup(String name) throws StorageBackendException {
|
franta-hg@65
|
147 |
Log.get().log(Level.SEVERE, "TODO: getGroup {0}", new Object[]{name});
|
franta-hg@65
|
148 |
/** TODO: */
|
franta-hg@65
|
149 |
return null;
|
franta-hg@64
|
150 |
}
|
franta-hg@64
|
151 |
|
franta-hg@64
|
152 |
@Override
|
franta-hg@64
|
153 |
public List<Group> getGroups() throws StorageBackendException {
|
franta-hg@65
|
154 |
Log.get().log(Level.SEVERE, "TODO: getGroups");
|
franta-hg@65
|
155 |
/** TODO: */
|
franta-hg@65
|
156 |
return Collections.emptyList();
|
franta-hg@64
|
157 |
}
|
franta-hg@64
|
158 |
|
franta-hg@64
|
159 |
@Override
|
franta-hg@64
|
160 |
public List<String> getGroupsForList(String listAddress) throws StorageBackendException {
|
franta-hg@65
|
161 |
Log.get().log(Level.SEVERE, "TODO: getGroupsForList {0}", new Object[]{listAddress});
|
franta-hg@65
|
162 |
return Collections.emptyList();
|
franta-hg@64
|
163 |
}
|
franta-hg@64
|
164 |
|
franta-hg@64
|
165 |
@Override
|
franta-hg@64
|
166 |
public int getLastArticleNumber(Group group) throws StorageBackendException {
|
franta-hg@65
|
167 |
Log.get().log(Level.SEVERE, "TODO: getLastArticleNumber {0}", new Object[]{group});
|
franta-hg@65
|
168 |
/** TODO: */
|
franta-hg@65
|
169 |
return 0;
|
franta-hg@64
|
170 |
}
|
franta-hg@64
|
171 |
|
franta-hg@64
|
172 |
@Override
|
franta-hg@64
|
173 |
public List<String> getListsForGroup(String groupname) throws StorageBackendException {
|
franta-hg@65
|
174 |
Log.get().log(Level.SEVERE, "TODO: getListsForGroup {0}", new Object[]{groupname});
|
franta-hg@65
|
175 |
return Collections.emptyList();
|
franta-hg@64
|
176 |
}
|
franta-hg@64
|
177 |
|
franta-hg@64
|
178 |
@Override
|
franta-hg@64
|
179 |
public String getOldestArticle() throws StorageBackendException {
|
franta-hg@65
|
180 |
Log.get().log(Level.SEVERE, "TODO: getOldestArticle");
|
franta-hg@65
|
181 |
return null;
|
franta-hg@64
|
182 |
}
|
franta-hg@64
|
183 |
|
franta-hg@64
|
184 |
@Override
|
franta-hg@64
|
185 |
public int getPostingsCount(String groupname) throws StorageBackendException {
|
franta-hg@65
|
186 |
Log.get().log(Level.SEVERE, "TODO: getPostingsCount {0}", new Object[]{groupname});
|
franta-hg@65
|
187 |
return 0;
|
franta-hg@64
|
188 |
}
|
franta-hg@64
|
189 |
|
franta-hg@64
|
190 |
@Override
|
franta-hg@64
|
191 |
public List<Subscription> getSubscriptions(int type) throws StorageBackendException {
|
franta-hg@65
|
192 |
Log.get().log(Level.SEVERE, "TODO: getSubscriptions {0}", new Object[]{type});
|
franta-hg@65
|
193 |
return Collections.emptyList();
|
franta-hg@64
|
194 |
}
|
franta-hg@64
|
195 |
|
franta-hg@64
|
196 |
@Override
|
franta-hg@64
|
197 |
public boolean isArticleExisting(String messageID) throws StorageBackendException {
|
franta-hg@65
|
198 |
Log.get().log(Level.SEVERE, "TODO: isArticleExisting {0}", new Object[]{messageID});
|
franta-hg@65
|
199 |
/** TODO: */
|
franta-hg@65
|
200 |
return false;
|
franta-hg@64
|
201 |
}
|
franta-hg@64
|
202 |
|
franta-hg@64
|
203 |
@Override
|
franta-hg@64
|
204 |
public boolean isGroupExisting(String groupname) throws StorageBackendException {
|
franta-hg@65
|
205 |
Log.get().log(Level.SEVERE, "TODO: isGroupExisting {0}", new Object[]{groupname});
|
franta-hg@65
|
206 |
/** TODO: */
|
franta-hg@65
|
207 |
return false;
|
franta-hg@64
|
208 |
}
|
franta-hg@64
|
209 |
|
franta-hg@64
|
210 |
@Override
|
franta-hg@64
|
211 |
public void purgeGroup(Group group) throws StorageBackendException {
|
franta-hg@65
|
212 |
Log.get().log(Level.SEVERE, "TODO: purgeGroup {0}", new Object[]{group});
|
franta-hg@64
|
213 |
}
|
franta-hg@64
|
214 |
|
franta-hg@64
|
215 |
@Override
|
franta-hg@64
|
216 |
public void setConfigValue(String key, String value) throws StorageBackendException {
|
franta-hg@65
|
217 |
Log.get().log(Level.SEVERE, "TODO: setConfigValue {0} = {1}", new Object[]{key, value});
|
franta-hg@64
|
218 |
}
|
franta-hg@64
|
219 |
|
franta-hg@64
|
220 |
@Override
|
franta-hg@64
|
221 |
public boolean update(Article article) throws StorageBackendException {
|
franta-hg@65
|
222 |
Log.get().log(Level.SEVERE, "TODO: update {0}", new Object[]{article});
|
franta-hg@65
|
223 |
throw new StorageBackendException("Not implemented yet.");
|
franta-hg@64
|
224 |
}
|
franta-hg@64
|
225 |
|
franta-hg@64
|
226 |
@Override
|
franta-hg@64
|
227 |
public boolean update(Group group) throws StorageBackendException {
|
franta-hg@65
|
228 |
Log.get().log(Level.SEVERE, "TODO: update {0}", new Object[]{group});
|
franta-hg@65
|
229 |
throw new StorageBackendException("Not implemented yet.");
|
franta-hg@64
|
230 |
}
|
franta-hg@63
|
231 |
}
|