src/org/sonews/storage/impl/DrupalDatabase.java
author František Kučera <franta-hg@frantovo.cz>
Tue Oct 18 22:50:39 2011 +0200 (2011-10-18)
changeset 98 763472057819
parent 72 aae4b4688700
child 101 d54786065fa3
permissions -rw-r--r--
Drupal: XHTML XSL – odstranění přebytečných mezer (oprava).
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@68
    20
import java.sql.Connection;
franta-hg@68
    21
import java.sql.DriverManager;
franta-hg@68
    22
import java.sql.PreparedStatement;
franta-hg@68
    23
import java.sql.ResultSet;
franta-hg@68
    24
import java.sql.Statement;
franta-hg@68
    25
import java.util.ArrayList;
franta-hg@65
    26
import java.util.Collections;
franta-hg@64
    27
import java.util.List;
franta-hg@65
    28
import java.util.logging.Level;
franta-hg@66
    29
import java.util.logging.Logger;
franta-hg@68
    30
import org.sonews.config.Config;
franta-hg@64
    31
import org.sonews.feed.Subscription;
franta-hg@64
    32
import org.sonews.storage.Article;
franta-hg@64
    33
import org.sonews.storage.ArticleHead;
franta-hg@72
    34
import org.sonews.storage.DrupalArticle;
franta-hg@72
    35
import org.sonews.storage.DrupalMessage;
franta-hg@64
    36
import org.sonews.storage.Group;
franta-hg@64
    37
import org.sonews.storage.Storage;
franta-hg@64
    38
import org.sonews.storage.StorageBackendException;
franta-hg@64
    39
import org.sonews.util.Pair;
franta-hg@64
    40
franta-hg@63
    41
/**
franta-hg@63
    42
 *
franta-hg@63
    43
 * @author František Kučera (frantovo.cz)
franta-hg@63
    44
 */
franta-hg@64
    45
public class DrupalDatabase implements Storage {
franta-hg@67
    46
franta-hg@66
    47
	private static final Logger log = Logger.getLogger(DrupalDatabase.class.getName());
franta-hg@70
    48
	public static final String CHARSET = "UTF-8";
franta-hg@68
    49
	public static final String CRLF = "\r\n";
franta-hg@68
    50
	protected Connection conn = null;
franta-hg@70
    51
	// TODO: správná doména
franta-hg@72
    52
	private String myDomain = "nntp.i1984.cz";
franta-hg@68
    53
franta-hg@68
    54
	public DrupalDatabase() throws StorageBackendException {
franta-hg@68
    55
		connectDatabase();
franta-hg@68
    56
	}
franta-hg@68
    57
franta-hg@68
    58
	private void connectDatabase() throws StorageBackendException {
franta-hg@68
    59
		try {
franta-hg@68
    60
			// Load database driver
franta-hg@68
    61
			String driverClass = Config.inst().get(Config.LEVEL_FILE, Config.STORAGE_DBMSDRIVER, "java.lang.Object");
franta-hg@68
    62
			Class.forName(driverClass);
franta-hg@68
    63
franta-hg@68
    64
			// Establish database connection
franta-hg@68
    65
			String url = Config.inst().get(Config.LEVEL_FILE, Config.STORAGE_DATABASE, "<not specified>");
franta-hg@68
    66
			String username = Config.inst().get(Config.LEVEL_FILE, Config.STORAGE_USER, "root");
franta-hg@68
    67
			String password = Config.inst().get(Config.LEVEL_FILE, Config.STORAGE_PASSWORD, "");
franta-hg@68
    68
			conn = DriverManager.getConnection(url, username, password);
franta-hg@68
    69
franta-hg@68
    70
			conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
franta-hg@68
    71
			if (conn.getTransactionIsolation() != Connection.TRANSACTION_SERIALIZABLE) {
franta-hg@68
    72
				log.warning("Database is NOT fully serializable!");
franta-hg@68
    73
			}
franta-hg@68
    74
		} catch (Exception e) {
franta-hg@68
    75
			throw new StorageBackendException(e);
franta-hg@68
    76
		}
franta-hg@68
    77
	}
franta-hg@68
    78
franta-hg@68
    79
	protected static void close(Connection connection, Statement statement, ResultSet resultSet) {
franta-hg@68
    80
		if (resultSet != null) {
franta-hg@68
    81
			try {
franta-hg@68
    82
				resultSet.close();
franta-hg@68
    83
			} catch (Exception e) {
franta-hg@68
    84
			}
franta-hg@68
    85
		}
franta-hg@68
    86
		if (statement != null) {
franta-hg@68
    87
			try {
franta-hg@68
    88
				statement.close();
franta-hg@68
    89
			} catch (Exception e) {
franta-hg@68
    90
			}
franta-hg@68
    91
		}
franta-hg@68
    92
		if (connection != null) {
franta-hg@68
    93
			try {
franta-hg@68
    94
				connection.close();
franta-hg@68
    95
			} catch (Exception e) {
franta-hg@68
    96
			}
franta-hg@68
    97
		}
franta-hg@68
    98
	}
franta-hg@64
    99
franta-hg@64
   100
	/**
franta-hg@68
   101
	 * 
franta-hg@70
   102
	 * @param messageID &lt;{0}-{1}-{2}@domain.tld&gt; where {0} is nntp_id and {1} is group_id and {2} is group_name
franta-hg@68
   103
	 * @return array where [0] = nntp_id and [1] = group_id and [2] = group_name or returns null if messageID is invalid
franta-hg@64
   104
	 */
franta-hg@68
   105
	private static String[] parseMessageID(String messageID) {
franta-hg@70
   106
		if (messageID.matches("<[0-9]+\\-[0-9]+\\-[a-z0-9\\.]+@.+>")) {
franta-hg@70
   107
			return messageID.substring(1).split("@")[0].split("\\-");
franta-hg@68
   108
		} else {
franta-hg@68
   109
			return null;
franta-hg@68
   110
		}
franta-hg@68
   111
	}
franta-hg@68
   112
franta-hg@68
   113
	private static Long parseArticleID(String messageID) {
franta-hg@68
   114
		String[] localPart = parseMessageID(messageID);
franta-hg@68
   115
		if (localPart == null) {
franta-hg@68
   116
			return null;
franta-hg@68
   117
		} else {
franta-hg@68
   118
			return Long.parseLong(localPart[0]);
franta-hg@68
   119
		}
franta-hg@68
   120
	}
franta-hg@68
   121
franta-hg@68
   122
	private static Long parseGroupID(String messageID) {
franta-hg@68
   123
		String[] localPart = parseMessageID(messageID);
franta-hg@68
   124
		if (localPart == null) {
franta-hg@68
   125
			return null;
franta-hg@68
   126
		} else {
franta-hg@68
   127
			return Long.parseLong(localPart[1]);
franta-hg@72
   128
			// If needed:
franta-hg@72
   129
			// parseGroupName() will be same as this method, just with:
franta-hg@72
   130
			// return localPart[2];
franta-hg@68
   131
		}
franta-hg@68
   132
	}
franta-hg@68
   133
franta-hg@64
   134
	@Override
franta-hg@67
   135
	public List<Group> getGroups() throws StorageBackendException {
franta-hg@68
   136
		PreparedStatement ps = null;
franta-hg@68
   137
		ResultSet rs = null;
franta-hg@68
   138
		try {
franta-hg@68
   139
			ps = conn.prepareStatement("SELECT * FROM nntp_group");
franta-hg@68
   140
			rs = ps.executeQuery();
franta-hg@68
   141
			List<Group> skupiny = new ArrayList<Group>();
franta-hg@68
   142
franta-hg@68
   143
			while (rs.next()) {
franta-hg@68
   144
				skupiny.add(new Group(rs.getString("name"), rs.getInt("id"), Group.READONLY));
franta-hg@68
   145
			}
franta-hg@68
   146
franta-hg@68
   147
			return skupiny;
franta-hg@68
   148
		} catch (Exception e) {
franta-hg@68
   149
			throw new StorageBackendException(e);
franta-hg@68
   150
		} finally {
franta-hg@68
   151
			close(null, ps, rs);
franta-hg@68
   152
		}
franta-hg@64
   153
	}
franta-hg@64
   154
franta-hg@64
   155
	@Override
franta-hg@67
   156
	public Group getGroup(String name) throws StorageBackendException {
franta-hg@68
   157
		PreparedStatement ps = null;
franta-hg@68
   158
		ResultSet rs = null;
franta-hg@68
   159
		try {
franta-hg@68
   160
			ps = conn.prepareStatement("SELECT * FROM nntp_group WHERE name = ?");
franta-hg@68
   161
			ps.setString(1, name);
franta-hg@68
   162
			rs = ps.executeQuery();
franta-hg@68
   163
franta-hg@68
   164
			while (rs.next()) {
franta-hg@68
   165
				return new Group(rs.getString("name"), rs.getInt("id"), Group.READONLY);
franta-hg@68
   166
			}
franta-hg@68
   167
franta-hg@68
   168
			return null;
franta-hg@68
   169
		} catch (Exception e) {
franta-hg@68
   170
			throw new StorageBackendException(e);
franta-hg@68
   171
		} finally {
franta-hg@68
   172
			close(null, ps, rs);
franta-hg@68
   173
		}
franta-hg@64
   174
	}
franta-hg@64
   175
franta-hg@64
   176
	@Override
franta-hg@67
   177
	public boolean isGroupExisting(String groupname) throws StorageBackendException {
franta-hg@68
   178
		return getGroup(groupname) != null;
franta-hg@64
   179
	}
franta-hg@64
   180
franta-hg@64
   181
	@Override
franta-hg@64
   182
	public Article getArticle(String messageID) throws StorageBackendException {
franta-hg@68
   183
		Long articleID = parseArticleID(messageID);
franta-hg@68
   184
		Long groupID = parseGroupID(messageID);
franta-hg@68
   185
franta-hg@68
   186
		if (articleID == null || groupID == null) {
franta-hg@68
   187
			log.log(Level.SEVERE, "Invalid messageID: {0}", new Object[]{messageID});
franta-hg@68
   188
			return null;
franta-hg@68
   189
		} else {
franta-hg@68
   190
			return getArticle(articleID, groupID);
franta-hg@68
   191
		}
franta-hg@64
   192
	}
franta-hg@64
   193
franta-hg@64
   194
	@Override
franta-hg@68
   195
	public Article getArticle(long articleID, long groupID) throws StorageBackendException {
franta-hg@68
   196
		PreparedStatement ps = null;
franta-hg@68
   197
		ResultSet rs = null;
franta-hg@68
   198
		try {
franta-hg@68
   199
			ps = conn.prepareStatement("SELECT * FROM nntp_article WHERE id = ? AND group_id = ?");
franta-hg@68
   200
			ps.setLong(1, articleID);
franta-hg@68
   201
			ps.setLong(2, groupID);
franta-hg@68
   202
			rs = ps.executeQuery();
franta-hg@68
   203
franta-hg@68
   204
			if (rs.next()) {
franta-hg@72
   205
				DrupalMessage m = new DrupalMessage(rs, myDomain, true);
franta-hg@72
   206
				return new DrupalArticle(m);
franta-hg@68
   207
			} else {
franta-hg@68
   208
				return null;
franta-hg@68
   209
			}
franta-hg@68
   210
		} catch (Exception e) {
franta-hg@68
   211
			throw new StorageBackendException(e);
franta-hg@68
   212
		} finally {
franta-hg@68
   213
			close(null, ps, rs);
franta-hg@68
   214
		}
franta-hg@64
   215
	}
franta-hg@64
   216
franta-hg@64
   217
	@Override
franta-hg@64
   218
	public List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last) throws StorageBackendException {
franta-hg@68
   219
		PreparedStatement ps = null;
franta-hg@68
   220
		ResultSet rs = null;
franta-hg@68
   221
		try {
franta-hg@70
   222
			ps = conn.prepareStatement("SELECT * FROM nntp_article WHERE group_id = ? AND id >= ? AND id <= ? ORDER BY id");
franta-hg@68
   223
			ps.setLong(1, group.getInternalID());
franta-hg@68
   224
			ps.setLong(2, first);
franta-hg@68
   225
			ps.setLong(3, last);
franta-hg@68
   226
			rs = ps.executeQuery();
franta-hg@68
   227
franta-hg@68
   228
			List<Pair<Long, ArticleHead>> heads = new ArrayList<Pair<Long, ArticleHead>>();
franta-hg@68
   229
franta-hg@68
   230
			while (rs.next()) {
franta-hg@72
   231
				DrupalMessage m = new DrupalMessage(rs, myDomain, false);
franta-hg@72
   232
				String headers = m.getHeaders();
franta-hg@68
   233
				heads.add(new Pair<Long, ArticleHead>(rs.getLong("id"), new ArticleHead(headers)));
franta-hg@68
   234
			}
franta-hg@68
   235
franta-hg@68
   236
			return heads;
franta-hg@68
   237
		} catch (Exception e) {
franta-hg@68
   238
			throw new StorageBackendException(e);
franta-hg@68
   239
		} finally {
franta-hg@68
   240
			close(null, ps, rs);
franta-hg@68
   241
		}
franta-hg@64
   242
	}
franta-hg@64
   243
franta-hg@64
   244
	@Override
franta-hg@68
   245
	public long getArticleIndex(Article article, Group group) throws StorageBackendException {
franta-hg@68
   246
		Long id = parseArticleID(article.getMessageID());
franta-hg@68
   247
		if (id == null) {
franta-hg@68
   248
			throw new StorageBackendException("Invalid messageID: " + article.getMessageID());
franta-hg@68
   249
		} else {
franta-hg@68
   250
			return id;
franta-hg@68
   251
		}
franta-hg@64
   252
	}
franta-hg@64
   253
franta-hg@64
   254
	@Override
franta-hg@64
   255
	public List<Long> getArticleNumbers(long groupID) throws StorageBackendException {
franta-hg@68
   256
		PreparedStatement ps = null;
franta-hg@68
   257
		ResultSet rs = null;
franta-hg@68
   258
		try {
franta-hg@68
   259
			ps = conn.prepareStatement("SELECT id FROM nntp_article WHERE group_id = ?");
franta-hg@68
   260
			ps.setLong(1, groupID);
franta-hg@68
   261
			rs = ps.executeQuery();
franta-hg@68
   262
			List<Long> articleNumbers = new ArrayList<Long>();
franta-hg@68
   263
			while (rs.next()) {
franta-hg@68
   264
				articleNumbers.add(rs.getLong(1));
franta-hg@68
   265
			}
franta-hg@68
   266
			return articleNumbers;
franta-hg@68
   267
		} catch (Exception e) {
franta-hg@68
   268
			throw new StorageBackendException(e);
franta-hg@68
   269
		} finally {
franta-hg@68
   270
			close(null, ps, rs);
franta-hg@68
   271
		}
franta-hg@64
   272
	}
franta-hg@64
   273
franta-hg@64
   274
	@Override
franta-hg@67
   275
	public int getFirstArticleNumber(Group group) throws StorageBackendException {
franta-hg@68
   276
		PreparedStatement ps = null;
franta-hg@68
   277
		ResultSet rs = null;
franta-hg@68
   278
		try {
franta-hg@68
   279
			ps = conn.prepareStatement("SELECT min(id) FROM nntp_article WHERE group_id = ?");
franta-hg@68
   280
			ps.setLong(1, group.getInternalID());
franta-hg@68
   281
			rs = ps.executeQuery();
franta-hg@68
   282
			rs.next();
franta-hg@68
   283
			return rs.getInt(1);
franta-hg@68
   284
		} catch (Exception e) {
franta-hg@68
   285
			throw new StorageBackendException(e);
franta-hg@68
   286
		} finally {
franta-hg@68
   287
			close(null, ps, rs);
franta-hg@68
   288
		}
franta-hg@67
   289
	}
franta-hg@67
   290
franta-hg@67
   291
	@Override
franta-hg@67
   292
	public int getLastArticleNumber(Group group) throws StorageBackendException {
franta-hg@68
   293
		PreparedStatement ps = null;
franta-hg@68
   294
		ResultSet rs = null;
franta-hg@68
   295
		try {
franta-hg@68
   296
			ps = conn.prepareStatement("SELECT max(id) FROM nntp_article WHERE group_id = ?");
franta-hg@68
   297
			ps.setLong(1, group.getInternalID());
franta-hg@68
   298
			rs = ps.executeQuery();
franta-hg@68
   299
			rs.next();
franta-hg@68
   300
			return rs.getInt(1);
franta-hg@68
   301
		} catch (Exception e) {
franta-hg@68
   302
			throw new StorageBackendException(e);
franta-hg@68
   303
		} finally {
franta-hg@68
   304
			close(null, ps, rs);
franta-hg@68
   305
		}
franta-hg@67
   306
	}
franta-hg@67
   307
franta-hg@67
   308
	@Override
franta-hg@67
   309
	public boolean isArticleExisting(String messageID) throws StorageBackendException {
franta-hg@68
   310
		Long articleID = parseArticleID(messageID);
franta-hg@68
   311
		Long groupID = parseGroupID(messageID);
franta-hg@68
   312
franta-hg@68
   313
		if (articleID == null || groupID == null) {
franta-hg@68
   314
			return false;
franta-hg@68
   315
		} else {
franta-hg@68
   316
			PreparedStatement ps = null;
franta-hg@68
   317
			ResultSet rs = null;
franta-hg@68
   318
			try {
franta-hg@68
   319
				ps = conn.prepareStatement("SELECT count(*) FROM nntp_article WHERE id = ? AND group_id = ?");
franta-hg@68
   320
				ps.setLong(1, articleID);
franta-hg@68
   321
				ps.setLong(2, groupID);
franta-hg@68
   322
				rs = ps.executeQuery();
franta-hg@68
   323
franta-hg@68
   324
				rs.next();
franta-hg@68
   325
				return rs.getInt(1) == 1;
franta-hg@68
   326
			} catch (Exception e) {
franta-hg@68
   327
				throw new StorageBackendException(e);
franta-hg@68
   328
			} finally {
franta-hg@68
   329
				close(null, ps, rs);
franta-hg@68
   330
			}
franta-hg@68
   331
		}
franta-hg@67
   332
	}
franta-hg@67
   333
franta-hg@67
   334
	@Override
franta-hg@67
   335
	public int countArticles() throws StorageBackendException {
franta-hg@69
   336
		PreparedStatement ps = null;
franta-hg@69
   337
		ResultSet rs = null;
franta-hg@69
   338
		try {
franta-hg@69
   339
			ps = conn.prepareStatement("SELECT count(*) FROM nntp_article");
franta-hg@69
   340
			rs = ps.executeQuery();
franta-hg@69
   341
			rs.next();
franta-hg@69
   342
			return rs.getInt(1);
franta-hg@69
   343
		} catch (Exception e) {
franta-hg@69
   344
			throw new StorageBackendException(e);
franta-hg@69
   345
		} finally {
franta-hg@69
   346
			close(null, ps, rs);
franta-hg@69
   347
		}
franta-hg@67
   348
	}
franta-hg@67
   349
franta-hg@67
   350
	@Override
franta-hg@67
   351
	public int countGroups() throws StorageBackendException {
franta-hg@69
   352
		PreparedStatement ps = null;
franta-hg@69
   353
		ResultSet rs = null;
franta-hg@69
   354
		try {
franta-hg@69
   355
			ps = conn.prepareStatement("SELECT count(*) FROM nntp_group");
franta-hg@69
   356
			rs = ps.executeQuery();
franta-hg@69
   357
			rs.next();
franta-hg@69
   358
			return rs.getInt(1);
franta-hg@69
   359
		} catch (Exception e) {
franta-hg@69
   360
			throw new StorageBackendException(e);
franta-hg@69
   361
		} finally {
franta-hg@69
   362
			close(null, ps, rs);
franta-hg@69
   363
		}
franta-hg@67
   364
	}
franta-hg@67
   365
franta-hg@67
   366
	@Override
franta-hg@72
   367
	public int getPostingsCount(String groupname) throws StorageBackendException {
franta-hg@72
   368
		PreparedStatement ps = null;
franta-hg@72
   369
		ResultSet rs = null;
franta-hg@72
   370
		try {
franta-hg@72
   371
			ps = conn.prepareStatement("SELECT count(*) FROM nntp_article WHERE group_name = ?");
franta-hg@72
   372
			ps.setString(1, groupname);
franta-hg@72
   373
			rs = ps.executeQuery();
franta-hg@72
   374
			rs.next();
franta-hg@72
   375
			return rs.getInt(1);
franta-hg@72
   376
		} catch (Exception e) {
franta-hg@72
   377
			throw new StorageBackendException(e);
franta-hg@72
   378
		} finally {
franta-hg@72
   379
			close(null, ps, rs);
franta-hg@72
   380
		}
franta-hg@72
   381
	}
franta-hg@72
   382
franta-hg@72
   383
	@Override
franta-hg@72
   384
	public List<Pair<Long, String>> getArticleHeaders(Group group, long start, long end, String header, String pattern) throws StorageBackendException {
franta-hg@72
   385
		log.log(Level.SEVERE, "TODO: getArticleHeaders {0} / {1} / {2} / {3} / {4}", new Object[]{group, start, end, header, pattern});
franta-hg@72
   386
		/** TODO: */
franta-hg@72
   387
		return Collections.emptyList();
franta-hg@72
   388
	}
franta-hg@72
   389
franta-hg@72
   390
	@Override
franta-hg@72
   391
	public void addArticle(Article art) throws StorageBackendException {
franta-hg@72
   392
		log.log(Level.SEVERE, "TODO: addArticle {0}", new Object[]{art});
franta-hg@72
   393
	}
franta-hg@72
   394
franta-hg@72
   395
	@Override
franta-hg@72
   396
	public void addEvent(long timestamp, int type, long groupID) throws StorageBackendException {
franta-hg@72
   397
		log.log(Level.SEVERE, "TODO: addEvent {0} / {1} / {2}", new Object[]{timestamp, type, groupID});
franta-hg@72
   398
	}
franta-hg@72
   399
franta-hg@72
   400
	@Override
franta-hg@72
   401
	public void addGroup(String groupname, int flags) throws StorageBackendException {
franta-hg@72
   402
		log.log(Level.SEVERE, "TODO: addGroup {0} / {1}", new Object[]{groupname, flags});
franta-hg@72
   403
	}
franta-hg@72
   404
franta-hg@72
   405
	@Override
franta-hg@67
   406
	public void delete(String messageID) throws StorageBackendException {
franta-hg@67
   407
		log.log(Level.SEVERE, "TODO: delete {0}", new Object[]{messageID});
franta-hg@67
   408
	}
franta-hg@67
   409
franta-hg@67
   410
	@Override
franta-hg@64
   411
	public String getConfigValue(String key) throws StorageBackendException {
franta-hg@69
   412
		//log.log(Level.SEVERE, "TODO: getConfigValue {0}", new Object[]{key});
franta-hg@65
   413
		return null;
franta-hg@64
   414
	}
franta-hg@64
   415
franta-hg@64
   416
	@Override
franta-hg@72
   417
	public void setConfigValue(String key, String value) throws StorageBackendException {
franta-hg@72
   418
		log.log(Level.SEVERE, "TODO: setConfigValue {0} = {1}", new Object[]{key, value});
franta-hg@72
   419
	}
franta-hg@72
   420
franta-hg@72
   421
	@Override
franta-hg@64
   422
	public int getEventsCount(int eventType, long startTimestamp, long endTimestamp, Group group) throws StorageBackendException {
franta-hg@66
   423
		log.log(Level.SEVERE, "TODO: getEventsCount {0} / {1} / {2} / {3}", new Object[]{eventType, startTimestamp, endTimestamp, group});
franta-hg@65
   424
		return 0;
franta-hg@64
   425
	}
franta-hg@64
   426
franta-hg@64
   427
	@Override
franta-hg@64
   428
	public double getEventsPerHour(int key, long gid) throws StorageBackendException {
franta-hg@66
   429
		log.log(Level.SEVERE, "TODO: getEventsPerHour {0} / {1}", new Object[]{key, gid});
franta-hg@65
   430
		return 0;
franta-hg@64
   431
	}
franta-hg@64
   432
franta-hg@64
   433
	@Override
franta-hg@64
   434
	public List<String> getGroupsForList(String listAddress) throws StorageBackendException {
franta-hg@66
   435
		log.log(Level.SEVERE, "TODO: getGroupsForList {0}", new Object[]{listAddress});
franta-hg@65
   436
		return Collections.emptyList();
franta-hg@64
   437
	}
franta-hg@64
   438
franta-hg@64
   439
	@Override
franta-hg@64
   440
	public List<String> getListsForGroup(String groupname) throws StorageBackendException {
franta-hg@66
   441
		log.log(Level.SEVERE, "TODO: getListsForGroup {0}", new Object[]{groupname});
franta-hg@65
   442
		return Collections.emptyList();
franta-hg@64
   443
	}
franta-hg@64
   444
franta-hg@64
   445
	@Override
franta-hg@64
   446
	public String getOldestArticle() throws StorageBackendException {
franta-hg@66
   447
		log.log(Level.SEVERE, "TODO: getOldestArticle");
franta-hg@65
   448
		return null;
franta-hg@64
   449
	}
franta-hg@64
   450
franta-hg@64
   451
	@Override
franta-hg@64
   452
	public List<Subscription> getSubscriptions(int type) throws StorageBackendException {
franta-hg@66
   453
		log.log(Level.SEVERE, "TODO: getSubscriptions {0}", new Object[]{type});
franta-hg@65
   454
		return Collections.emptyList();
franta-hg@64
   455
	}
franta-hg@64
   456
franta-hg@64
   457
	@Override
franta-hg@64
   458
	public void purgeGroup(Group group) throws StorageBackendException {
franta-hg@66
   459
		log.log(Level.SEVERE, "TODO: purgeGroup {0}", new Object[]{group});
franta-hg@64
   460
	}
franta-hg@64
   461
franta-hg@64
   462
	@Override
franta-hg@64
   463
	public boolean update(Article article) throws StorageBackendException {
franta-hg@66
   464
		log.log(Level.SEVERE, "TODO: update {0}", new Object[]{article});
franta-hg@65
   465
		throw new StorageBackendException("Not implemented yet.");
franta-hg@64
   466
	}
franta-hg@64
   467
franta-hg@64
   468
	@Override
franta-hg@64
   469
	public boolean update(Group group) throws StorageBackendException {
franta-hg@66
   470
		log.log(Level.SEVERE, "TODO: update {0}", new Object[]{group});
franta-hg@65
   471
		throw new StorageBackendException("Not implemented yet.");
franta-hg@64
   472
	}
franta-hg@63
   473
}