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