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