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