Drupal: funkční logování.
1.1 --- a/src/org/sonews/Main.java Sun Oct 09 01:02:53 2011 +0200
1.2 +++ b/src/org/sonews/Main.java Sun Oct 09 01:17:19 2011 +0200
1.3 @@ -44,7 +44,7 @@
1.4 public final class Main {
1.5
1.6 /** Version information of the sonews daemon */
1.7 - public static final String VERSION = "sonews/1.1.0";
1.8 + public static final String VERSION = "sonews/1.1.0~Drupal";
1.9
1.10 /** The server's startup date */
1.11 public static final Date STARTDATE = new Date();
2.1 --- a/src/org/sonews/storage/impl/DrupalDatabase.java Sun Oct 09 01:02:53 2011 +0200
2.2 +++ b/src/org/sonews/storage/impl/DrupalDatabase.java Sun Oct 09 01:17:19 2011 +0200
2.3 @@ -21,13 +21,13 @@
2.4 import java.util.Collections;
2.5 import java.util.List;
2.6 import java.util.logging.Level;
2.7 +import java.util.logging.Logger;
2.8 import org.sonews.feed.Subscription;
2.9 import org.sonews.storage.Article;
2.10 import org.sonews.storage.ArticleHead;
2.11 import org.sonews.storage.Group;
2.12 import org.sonews.storage.Storage;
2.13 import org.sonews.storage.StorageBackendException;
2.14 -import org.sonews.util.Log;
2.15 import org.sonews.util.Pair;
2.16
2.17 /**
2.18 @@ -35,6 +35,8 @@
2.19 * @author František Kučera (frantovo.cz)
2.20 */
2.21 public class DrupalDatabase implements Storage {
2.22 +
2.23 + private static final Logger log = Logger.getLogger(DrupalDatabase.class.getName());
2.24
2.25 /**
2.26 * Rises the database: reconnect and recreate all prepared statements.
2.27 @@ -45,187 +47,187 @@
2.28
2.29 @Override
2.30 public void addArticle(Article art) throws StorageBackendException {
2.31 - Log.get().log(Level.SEVERE, "TODO: addArticle {0}", new Object[]{art});
2.32 + log.log(Level.SEVERE, "TODO: addArticle {0}", new Object[]{art});
2.33 }
2.34
2.35 @Override
2.36 public void addEvent(long timestamp, int type, long groupID) throws StorageBackendException {
2.37 - Log.get().log(Level.SEVERE, "TODO: addEvent {0} / {1} / {2}", new Object[]{timestamp, type, groupID});
2.38 + log.log(Level.SEVERE, "TODO: addEvent {0} / {1} / {2}", new Object[]{timestamp, type, groupID});
2.39 }
2.40
2.41 @Override
2.42 public void addGroup(String groupname, int flags) throws StorageBackendException {
2.43 - Log.get().log(Level.SEVERE, "TODO: addGroup {0} / {1}", new Object[]{groupname, flags});
2.44 + log.log(Level.SEVERE, "TODO: addGroup {0} / {1}", new Object[]{groupname, flags});
2.45 }
2.46
2.47 @Override
2.48 public int countArticles() throws StorageBackendException {
2.49 - Log.get().log(Level.SEVERE, "TODO: countArticles");
2.50 + log.log(Level.SEVERE, "TODO: countArticles");
2.51 return 0;
2.52 }
2.53
2.54 @Override
2.55 public int countGroups() throws StorageBackendException {
2.56 - Log.get().log(Level.SEVERE, "TODO: countGroups");
2.57 + log.log(Level.SEVERE, "TODO: countGroups");
2.58 return 0;
2.59 }
2.60
2.61 @Override
2.62 public void delete(String messageID) throws StorageBackendException {
2.63 - Log.get().log(Level.SEVERE, "TODO: delete {0}", new Object[]{messageID});
2.64 + log.log(Level.SEVERE, "TODO: delete {0}", new Object[]{messageID});
2.65 }
2.66
2.67 @Override
2.68 public Article getArticle(String messageID) throws StorageBackendException {
2.69 - Log.get().log(Level.SEVERE, "TODO: getArticle {0}", new Object[]{messageID});
2.70 + log.log(Level.SEVERE, "TODO: getArticle {0}", new Object[]{messageID});
2.71 /** TODO: */
2.72 return null;
2.73 }
2.74
2.75 @Override
2.76 public Article getArticle(long articleIndex, long groupID) throws StorageBackendException {
2.77 - Log.get().log(Level.SEVERE, "TODO: getArticle {0} / {1}", new Object[]{articleIndex, groupID});
2.78 + log.log(Level.SEVERE, "TODO: getArticle {0} / {1}", new Object[]{articleIndex, groupID});
2.79 /** TODO: */
2.80 return null;
2.81 }
2.82
2.83 @Override
2.84 public List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last) throws StorageBackendException {
2.85 - Log.get().log(Level.SEVERE, "TODO: getArticleHeads {0} / {1} / {2}", new Object[]{group, first, last});
2.86 + log.log(Level.SEVERE, "TODO: getArticleHeads {0} / {1} / {2}", new Object[]{group, first, last});
2.87 /** TODO: */
2.88 return Collections.emptyList();
2.89 }
2.90
2.91 @Override
2.92 public List<Pair<Long, String>> getArticleHeaders(Group group, long start, long end, String header, String pattern) throws StorageBackendException {
2.93 - Log.get().log(Level.SEVERE, "TODO: getArticleHeaders {0} / {1} / {2} / {3} / {4}", new Object[]{group, start, end, header, pattern});
2.94 + log.log(Level.SEVERE, "TODO: getArticleHeaders {0} / {1} / {2} / {3} / {4}", new Object[]{group, start, end, header, pattern});
2.95 /** TODO: */
2.96 return Collections.emptyList();
2.97 }
2.98
2.99 @Override
2.100 public long getArticleIndex(Article art, Group group) throws StorageBackendException {
2.101 - Log.get().log(Level.SEVERE, "TODO: getArticleIndex {0} / {1}", new Object[]{art, group});
2.102 + log.log(Level.SEVERE, "TODO: getArticleIndex {0} / {1}", new Object[]{art, group});
2.103 /** TODO: */
2.104 return 0;
2.105 }
2.106
2.107 @Override
2.108 public List<Long> getArticleNumbers(long groupID) throws StorageBackendException {
2.109 - Log.get().log(Level.SEVERE, "TODO: getArticleNumbers {0}", new Object[]{groupID});
2.110 + log.log(Level.SEVERE, "TODO: getArticleNumbers {0}", new Object[]{groupID});
2.111 /** TODO: */
2.112 return Collections.emptyList();
2.113 }
2.114
2.115 @Override
2.116 public String getConfigValue(String key) throws StorageBackendException {
2.117 - Log.get().log(Level.SEVERE, "TODO: getConfigValue {0}", new Object[]{key});
2.118 + log.log(Level.SEVERE, "TODO: getConfigValue {0}", new Object[]{key});
2.119 return null;
2.120 }
2.121
2.122 @Override
2.123 public int getEventsCount(int eventType, long startTimestamp, long endTimestamp, Group group) throws StorageBackendException {
2.124 - Log.get().log(Level.SEVERE, "TODO: getEventsCount {0} / {1} / {2} / {3}", new Object[]{eventType, startTimestamp, endTimestamp, group});
2.125 + log.log(Level.SEVERE, "TODO: getEventsCount {0} / {1} / {2} / {3}", new Object[]{eventType, startTimestamp, endTimestamp, group});
2.126 return 0;
2.127 }
2.128
2.129 @Override
2.130 public double getEventsPerHour(int key, long gid) throws StorageBackendException {
2.131 - Log.get().log(Level.SEVERE, "TODO: getEventsPerHour {0} / {1}", new Object[]{key, gid});
2.132 + log.log(Level.SEVERE, "TODO: getEventsPerHour {0} / {1}", new Object[]{key, gid});
2.133 return 0;
2.134 }
2.135
2.136 @Override
2.137 public int getFirstArticleNumber(Group group) throws StorageBackendException {
2.138 - Log.get().log(Level.SEVERE, "TODO: getFirstArticleNumber {0}", new Object[]{group});
2.139 + log.log(Level.SEVERE, "TODO: getFirstArticleNumber {0}", new Object[]{group});
2.140 /** TODO: */
2.141 return 0;
2.142 }
2.143
2.144 @Override
2.145 public Group getGroup(String name) throws StorageBackendException {
2.146 - Log.get().log(Level.SEVERE, "TODO: getGroup {0}", new Object[]{name});
2.147 + log.log(Level.SEVERE, "TODO: getGroup {0}", new Object[]{name});
2.148 /** TODO: */
2.149 return null;
2.150 }
2.151
2.152 @Override
2.153 public List<Group> getGroups() throws StorageBackendException {
2.154 - Log.get().log(Level.SEVERE, "TODO: getGroups");
2.155 + log.log(Level.SEVERE, "TODO: getGroups");
2.156 /** TODO: */
2.157 return Collections.emptyList();
2.158 }
2.159
2.160 @Override
2.161 public List<String> getGroupsForList(String listAddress) throws StorageBackendException {
2.162 - Log.get().log(Level.SEVERE, "TODO: getGroupsForList {0}", new Object[]{listAddress});
2.163 + log.log(Level.SEVERE, "TODO: getGroupsForList {0}", new Object[]{listAddress});
2.164 return Collections.emptyList();
2.165 }
2.166
2.167 @Override
2.168 public int getLastArticleNumber(Group group) throws StorageBackendException {
2.169 - Log.get().log(Level.SEVERE, "TODO: getLastArticleNumber {0}", new Object[]{group});
2.170 + log.log(Level.SEVERE, "TODO: getLastArticleNumber {0}", new Object[]{group});
2.171 /** TODO: */
2.172 return 0;
2.173 }
2.174
2.175 @Override
2.176 public List<String> getListsForGroup(String groupname) throws StorageBackendException {
2.177 - Log.get().log(Level.SEVERE, "TODO: getListsForGroup {0}", new Object[]{groupname});
2.178 + log.log(Level.SEVERE, "TODO: getListsForGroup {0}", new Object[]{groupname});
2.179 return Collections.emptyList();
2.180 }
2.181
2.182 @Override
2.183 public String getOldestArticle() throws StorageBackendException {
2.184 - Log.get().log(Level.SEVERE, "TODO: getOldestArticle");
2.185 + log.log(Level.SEVERE, "TODO: getOldestArticle");
2.186 return null;
2.187 }
2.188
2.189 @Override
2.190 public int getPostingsCount(String groupname) throws StorageBackendException {
2.191 - Log.get().log(Level.SEVERE, "TODO: getPostingsCount {0}", new Object[]{groupname});
2.192 + log.log(Level.SEVERE, "TODO: getPostingsCount {0}", new Object[]{groupname});
2.193 return 0;
2.194 }
2.195
2.196 @Override
2.197 public List<Subscription> getSubscriptions(int type) throws StorageBackendException {
2.198 - Log.get().log(Level.SEVERE, "TODO: getSubscriptions {0}", new Object[]{type});
2.199 + log.log(Level.SEVERE, "TODO: getSubscriptions {0}", new Object[]{type});
2.200 return Collections.emptyList();
2.201 }
2.202
2.203 @Override
2.204 public boolean isArticleExisting(String messageID) throws StorageBackendException {
2.205 - Log.get().log(Level.SEVERE, "TODO: isArticleExisting {0}", new Object[]{messageID});
2.206 + log.log(Level.SEVERE, "TODO: isArticleExisting {0}", new Object[]{messageID});
2.207 /** TODO: */
2.208 return false;
2.209 }
2.210
2.211 @Override
2.212 public boolean isGroupExisting(String groupname) throws StorageBackendException {
2.213 - Log.get().log(Level.SEVERE, "TODO: isGroupExisting {0}", new Object[]{groupname});
2.214 + log.log(Level.SEVERE, "TODO: isGroupExisting {0}", new Object[]{groupname});
2.215 /** TODO: */
2.216 return false;
2.217 }
2.218
2.219 @Override
2.220 public void purgeGroup(Group group) throws StorageBackendException {
2.221 - Log.get().log(Level.SEVERE, "TODO: purgeGroup {0}", new Object[]{group});
2.222 + log.log(Level.SEVERE, "TODO: purgeGroup {0}", new Object[]{group});
2.223 }
2.224
2.225 @Override
2.226 public void setConfigValue(String key, String value) throws StorageBackendException {
2.227 - Log.get().log(Level.SEVERE, "TODO: setConfigValue {0} = {1}", new Object[]{key, value});
2.228 + log.log(Level.SEVERE, "TODO: setConfigValue {0} = {1}", new Object[]{key, value});
2.229 }
2.230
2.231 @Override
2.232 public boolean update(Article article) throws StorageBackendException {
2.233 - Log.get().log(Level.SEVERE, "TODO: update {0}", new Object[]{article});
2.234 + log.log(Level.SEVERE, "TODO: update {0}", new Object[]{article});
2.235 throw new StorageBackendException("Not implemented yet.");
2.236 }
2.237
2.238 @Override
2.239 public boolean update(Group group) throws StorageBackendException {
2.240 - Log.get().log(Level.SEVERE, "TODO: update {0}", new Object[]{group});
2.241 + log.log(Level.SEVERE, "TODO: update {0}", new Object[]{group});
2.242 throw new StorageBackendException("Not implemented yet.");
2.243 }
2.244 }