src/org/sonews/storage/impl/DrupalDatabase.java
author František Kučera <franta-hg@frantovo.cz>
Sun Oct 09 01:17:19 2011 +0200 (2011-10-09)
changeset 66 c04eae2c57df
parent 65 b58cab5be0f4
child 67 4653fc7609e7
permissions -rw-r--r--
Drupal: funkční logování.
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@66
    24
import java.util.logging.Logger;
franta-hg@64
    25
import org.sonews.feed.Subscription;
franta-hg@64
    26
import org.sonews.storage.Article;
franta-hg@64
    27
import org.sonews.storage.ArticleHead;
franta-hg@64
    28
import org.sonews.storage.Group;
franta-hg@64
    29
import org.sonews.storage.Storage;
franta-hg@64
    30
import org.sonews.storage.StorageBackendException;
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@66
    38
	
franta-hg@66
    39
	private static final Logger log = Logger.getLogger(DrupalDatabase.class.getName());
franta-hg@64
    40
franta-hg@64
    41
	/**
franta-hg@64
    42
	 * Rises the database: reconnect and recreate all prepared statements.
franta-hg@64
    43
	 * @throws java.lang.SQLException
franta-hg@64
    44
	 */
franta-hg@64
    45
	protected void arise() throws SQLException {
franta-hg@64
    46
	}
franta-hg@64
    47
franta-hg@64
    48
	@Override
franta-hg@64
    49
	public void addArticle(Article art) throws StorageBackendException {
franta-hg@66
    50
		log.log(Level.SEVERE, "TODO: addArticle {0}", new Object[]{art});
franta-hg@64
    51
	}
franta-hg@64
    52
franta-hg@64
    53
	@Override
franta-hg@64
    54
	public void addEvent(long timestamp, int type, long groupID) throws StorageBackendException {
franta-hg@66
    55
		log.log(Level.SEVERE, "TODO: addEvent {0} / {1} / {2}", new Object[]{timestamp, type, groupID});
franta-hg@64
    56
	}
franta-hg@64
    57
franta-hg@64
    58
	@Override
franta-hg@64
    59
	public void addGroup(String groupname, int flags) throws StorageBackendException {
franta-hg@66
    60
		log.log(Level.SEVERE, "TODO: addGroup {0} / {1}", new Object[]{groupname, flags});
franta-hg@64
    61
	}
franta-hg@64
    62
franta-hg@64
    63
	@Override
franta-hg@64
    64
	public int countArticles() throws StorageBackendException {
franta-hg@66
    65
		log.log(Level.SEVERE, "TODO: countArticles");
franta-hg@65
    66
		return 0;
franta-hg@64
    67
	}
franta-hg@64
    68
franta-hg@64
    69
	@Override
franta-hg@64
    70
	public int countGroups() throws StorageBackendException {
franta-hg@66
    71
		log.log(Level.SEVERE, "TODO: countGroups");
franta-hg@65
    72
		return 0;
franta-hg@64
    73
	}
franta-hg@64
    74
franta-hg@64
    75
	@Override
franta-hg@64
    76
	public void delete(String messageID) throws StorageBackendException {
franta-hg@66
    77
		log.log(Level.SEVERE, "TODO: delete {0}", new Object[]{messageID});
franta-hg@64
    78
	}
franta-hg@64
    79
franta-hg@64
    80
	@Override
franta-hg@64
    81
	public Article getArticle(String messageID) throws StorageBackendException {
franta-hg@66
    82
		log.log(Level.SEVERE, "TODO: getArticle {0}", new Object[]{messageID});
franta-hg@65
    83
		/** TODO: */
franta-hg@65
    84
		return null;
franta-hg@64
    85
	}
franta-hg@64
    86
franta-hg@64
    87
	@Override
franta-hg@64
    88
	public Article getArticle(long articleIndex, long groupID) throws StorageBackendException {
franta-hg@66
    89
		log.log(Level.SEVERE, "TODO: getArticle {0} / {1}", new Object[]{articleIndex, groupID});
franta-hg@65
    90
		/** TODO: */
franta-hg@65
    91
		return null;
franta-hg@64
    92
	}
franta-hg@64
    93
franta-hg@64
    94
	@Override
franta-hg@64
    95
	public List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last) throws StorageBackendException {
franta-hg@66
    96
		log.log(Level.SEVERE, "TODO: getArticleHeads {0} / {1} / {2}", new Object[]{group, first, last});
franta-hg@65
    97
		/** TODO: */
franta-hg@65
    98
		return Collections.emptyList();
franta-hg@64
    99
	}
franta-hg@64
   100
franta-hg@64
   101
	@Override
franta-hg@64
   102
	public List<Pair<Long, String>> getArticleHeaders(Group group, long start, long end, String header, String pattern) throws StorageBackendException {
franta-hg@66
   103
		log.log(Level.SEVERE, "TODO: getArticleHeaders {0} / {1} / {2} / {3} / {4}", new Object[]{group, start, end, header, pattern});
franta-hg@65
   104
		/** TODO: */
franta-hg@65
   105
		return Collections.emptyList();
franta-hg@64
   106
	}
franta-hg@64
   107
franta-hg@64
   108
	@Override
franta-hg@64
   109
	public long getArticleIndex(Article art, Group group) throws StorageBackendException {
franta-hg@66
   110
		log.log(Level.SEVERE, "TODO: getArticleIndex {0} / {1}", new Object[]{art, group});
franta-hg@65
   111
		/** TODO: */
franta-hg@65
   112
		return 0;
franta-hg@64
   113
	}
franta-hg@64
   114
franta-hg@64
   115
	@Override
franta-hg@64
   116
	public List<Long> getArticleNumbers(long groupID) throws StorageBackendException {
franta-hg@66
   117
		log.log(Level.SEVERE, "TODO: getArticleNumbers {0}", new Object[]{groupID});
franta-hg@65
   118
		/** TODO: */
franta-hg@65
   119
		return Collections.emptyList();
franta-hg@64
   120
	}
franta-hg@64
   121
franta-hg@64
   122
	@Override
franta-hg@64
   123
	public String getConfigValue(String key) throws StorageBackendException {
franta-hg@66
   124
		log.log(Level.SEVERE, "TODO: getConfigValue {0}", new Object[]{key});
franta-hg@65
   125
		return null;
franta-hg@64
   126
	}
franta-hg@64
   127
franta-hg@64
   128
	@Override
franta-hg@64
   129
	public int getEventsCount(int eventType, long startTimestamp, long endTimestamp, Group group) throws StorageBackendException {
franta-hg@66
   130
		log.log(Level.SEVERE, "TODO: getEventsCount {0} / {1} / {2} / {3}", new Object[]{eventType, startTimestamp, endTimestamp, group});
franta-hg@65
   131
		return 0;
franta-hg@64
   132
	}
franta-hg@64
   133
franta-hg@64
   134
	@Override
franta-hg@64
   135
	public double getEventsPerHour(int key, long gid) throws StorageBackendException {
franta-hg@66
   136
		log.log(Level.SEVERE, "TODO: getEventsPerHour {0} / {1}", new Object[]{key, gid});
franta-hg@65
   137
		return 0;
franta-hg@64
   138
	}
franta-hg@64
   139
franta-hg@64
   140
	@Override
franta-hg@64
   141
	public int getFirstArticleNumber(Group group) throws StorageBackendException {
franta-hg@66
   142
		log.log(Level.SEVERE, "TODO: getFirstArticleNumber {0}", new Object[]{group});
franta-hg@65
   143
		/** TODO: */
franta-hg@65
   144
		return 0;
franta-hg@64
   145
	}
franta-hg@64
   146
franta-hg@64
   147
	@Override
franta-hg@64
   148
	public Group getGroup(String name) throws StorageBackendException {
franta-hg@66
   149
		log.log(Level.SEVERE, "TODO: getGroup {0}", new Object[]{name});
franta-hg@65
   150
		/** TODO: */
franta-hg@65
   151
		return null;
franta-hg@64
   152
	}
franta-hg@64
   153
franta-hg@64
   154
	@Override
franta-hg@64
   155
	public List<Group> getGroups() throws StorageBackendException {
franta-hg@66
   156
		log.log(Level.SEVERE, "TODO: getGroups");
franta-hg@65
   157
		/** TODO: */
franta-hg@65
   158
		return Collections.emptyList();
franta-hg@64
   159
	}
franta-hg@64
   160
franta-hg@64
   161
	@Override
franta-hg@64
   162
	public List<String> getGroupsForList(String listAddress) throws StorageBackendException {
franta-hg@66
   163
		log.log(Level.SEVERE, "TODO: getGroupsForList {0}", new Object[]{listAddress});
franta-hg@65
   164
		return Collections.emptyList();
franta-hg@64
   165
	}
franta-hg@64
   166
franta-hg@64
   167
	@Override
franta-hg@64
   168
	public int getLastArticleNumber(Group group) throws StorageBackendException {
franta-hg@66
   169
		log.log(Level.SEVERE, "TODO: getLastArticleNumber {0}", new Object[]{group});
franta-hg@65
   170
		/** TODO: */
franta-hg@65
   171
		return 0;
franta-hg@64
   172
	}
franta-hg@64
   173
franta-hg@64
   174
	@Override
franta-hg@64
   175
	public List<String> getListsForGroup(String groupname) throws StorageBackendException {
franta-hg@66
   176
		log.log(Level.SEVERE, "TODO: getListsForGroup {0}", new Object[]{groupname});
franta-hg@65
   177
		return Collections.emptyList();
franta-hg@64
   178
	}
franta-hg@64
   179
franta-hg@64
   180
	@Override
franta-hg@64
   181
	public String getOldestArticle() throws StorageBackendException {
franta-hg@66
   182
		log.log(Level.SEVERE, "TODO: getOldestArticle");
franta-hg@65
   183
		return null;
franta-hg@64
   184
	}
franta-hg@64
   185
franta-hg@64
   186
	@Override
franta-hg@64
   187
	public int getPostingsCount(String groupname) throws StorageBackendException {
franta-hg@66
   188
		log.log(Level.SEVERE, "TODO: getPostingsCount {0}", new Object[]{groupname});
franta-hg@65
   189
		return 0;
franta-hg@64
   190
	}
franta-hg@64
   191
franta-hg@64
   192
	@Override
franta-hg@64
   193
	public List<Subscription> getSubscriptions(int type) throws StorageBackendException {
franta-hg@66
   194
		log.log(Level.SEVERE, "TODO: getSubscriptions {0}", new Object[]{type});
franta-hg@65
   195
		return Collections.emptyList();
franta-hg@64
   196
	}
franta-hg@64
   197
franta-hg@64
   198
	@Override
franta-hg@64
   199
	public boolean isArticleExisting(String messageID) throws StorageBackendException {
franta-hg@66
   200
		log.log(Level.SEVERE, "TODO: isArticleExisting {0}", new Object[]{messageID});
franta-hg@65
   201
		/** TODO: */
franta-hg@65
   202
		return false;
franta-hg@64
   203
	}
franta-hg@64
   204
franta-hg@64
   205
	@Override
franta-hg@64
   206
	public boolean isGroupExisting(String groupname) throws StorageBackendException {
franta-hg@66
   207
		log.log(Level.SEVERE, "TODO: isGroupExisting {0}", new Object[]{groupname});
franta-hg@65
   208
		/** TODO: */
franta-hg@65
   209
		return false;
franta-hg@64
   210
	}
franta-hg@64
   211
franta-hg@64
   212
	@Override
franta-hg@64
   213
	public void purgeGroup(Group group) throws StorageBackendException {
franta-hg@66
   214
		log.log(Level.SEVERE, "TODO: purgeGroup {0}", new Object[]{group});
franta-hg@64
   215
	}
franta-hg@64
   216
franta-hg@64
   217
	@Override
franta-hg@64
   218
	public void setConfigValue(String key, String value) throws StorageBackendException {
franta-hg@66
   219
		log.log(Level.SEVERE, "TODO: setConfigValue {0} = {1}", new Object[]{key, value});
franta-hg@64
   220
	}
franta-hg@64
   221
franta-hg@64
   222
	@Override
franta-hg@64
   223
	public boolean update(Article article) throws StorageBackendException {
franta-hg@66
   224
		log.log(Level.SEVERE, "TODO: update {0}", new Object[]{article});
franta-hg@65
   225
		throw new StorageBackendException("Not implemented yet.");
franta-hg@64
   226
	}
franta-hg@64
   227
franta-hg@64
   228
	@Override
franta-hg@64
   229
	public boolean update(Group group) throws StorageBackendException {
franta-hg@66
   230
		log.log(Level.SEVERE, "TODO: update {0}", new Object[]{group});
franta-hg@65
   231
		throw new StorageBackendException("Not implemented yet.");
franta-hg@64
   232
	}
franta-hg@63
   233
}