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