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