src/org/sonews/storage/impl/DrupalDatabase.java
changeset 66 c04eae2c57df
parent 65 b58cab5be0f4
child 67 4653fc7609e7
     1.1 --- a/src/org/sonews/storage/impl/DrupalDatabase.java	Sun Oct 09 01:02:53 2011 +0200
     1.2 +++ b/src/org/sonews/storage/impl/DrupalDatabase.java	Sun Oct 09 01:17:19 2011 +0200
     1.3 @@ -21,13 +21,13 @@
     1.4  import java.util.Collections;
     1.5  import java.util.List;
     1.6  import java.util.logging.Level;
     1.7 +import java.util.logging.Logger;
     1.8  import org.sonews.feed.Subscription;
     1.9  import org.sonews.storage.Article;
    1.10  import org.sonews.storage.ArticleHead;
    1.11  import org.sonews.storage.Group;
    1.12  import org.sonews.storage.Storage;
    1.13  import org.sonews.storage.StorageBackendException;
    1.14 -import org.sonews.util.Log;
    1.15  import org.sonews.util.Pair;
    1.16  
    1.17  /**
    1.18 @@ -35,6 +35,8 @@
    1.19   * @author František Kučera (frantovo.cz)
    1.20   */
    1.21  public class DrupalDatabase implements Storage {
    1.22 +	
    1.23 +	private static final Logger log = Logger.getLogger(DrupalDatabase.class.getName());
    1.24  
    1.25  	/**
    1.26  	 * Rises the database: reconnect and recreate all prepared statements.
    1.27 @@ -45,187 +47,187 @@
    1.28  
    1.29  	@Override
    1.30  	public void addArticle(Article art) throws StorageBackendException {
    1.31 -		Log.get().log(Level.SEVERE, "TODO: addArticle {0}", new Object[]{art});
    1.32 +		log.log(Level.SEVERE, "TODO: addArticle {0}", new Object[]{art});
    1.33  	}
    1.34  
    1.35  	@Override
    1.36  	public void addEvent(long timestamp, int type, long groupID) throws StorageBackendException {
    1.37 -		Log.get().log(Level.SEVERE, "TODO: addEvent {0} / {1} / {2}", new Object[]{timestamp, type, groupID});
    1.38 +		log.log(Level.SEVERE, "TODO: addEvent {0} / {1} / {2}", new Object[]{timestamp, type, groupID});
    1.39  	}
    1.40  
    1.41  	@Override
    1.42  	public void addGroup(String groupname, int flags) throws StorageBackendException {
    1.43 -		Log.get().log(Level.SEVERE, "TODO: addGroup {0} / {1}", new Object[]{groupname, flags});
    1.44 +		log.log(Level.SEVERE, "TODO: addGroup {0} / {1}", new Object[]{groupname, flags});
    1.45  	}
    1.46  
    1.47  	@Override
    1.48  	public int countArticles() throws StorageBackendException {
    1.49 -		Log.get().log(Level.SEVERE, "TODO: countArticles");
    1.50 +		log.log(Level.SEVERE, "TODO: countArticles");
    1.51  		return 0;
    1.52  	}
    1.53  
    1.54  	@Override
    1.55  	public int countGroups() throws StorageBackendException {
    1.56 -		Log.get().log(Level.SEVERE, "TODO: countGroups");
    1.57 +		log.log(Level.SEVERE, "TODO: countGroups");
    1.58  		return 0;
    1.59  	}
    1.60  
    1.61  	@Override
    1.62  	public void delete(String messageID) throws StorageBackendException {
    1.63 -		Log.get().log(Level.SEVERE, "TODO: delete {0}", new Object[]{messageID});
    1.64 +		log.log(Level.SEVERE, "TODO: delete {0}", new Object[]{messageID});
    1.65  	}
    1.66  
    1.67  	@Override
    1.68  	public Article getArticle(String messageID) throws StorageBackendException {
    1.69 -		Log.get().log(Level.SEVERE, "TODO: getArticle {0}", new Object[]{messageID});
    1.70 +		log.log(Level.SEVERE, "TODO: getArticle {0}", new Object[]{messageID});
    1.71  		/** TODO: */
    1.72  		return null;
    1.73  	}
    1.74  
    1.75  	@Override
    1.76  	public Article getArticle(long articleIndex, long groupID) throws StorageBackendException {
    1.77 -		Log.get().log(Level.SEVERE, "TODO: getArticle {0} / {1}", new Object[]{articleIndex, groupID});
    1.78 +		log.log(Level.SEVERE, "TODO: getArticle {0} / {1}", new Object[]{articleIndex, groupID});
    1.79  		/** TODO: */
    1.80  		return null;
    1.81  	}
    1.82  
    1.83  	@Override
    1.84  	public List<Pair<Long, ArticleHead>> getArticleHeads(Group group, long first, long last) throws StorageBackendException {
    1.85 -		Log.get().log(Level.SEVERE, "TODO: getArticleHeads {0} / {1} / {2}", new Object[]{group, first, last});
    1.86 +		log.log(Level.SEVERE, "TODO: getArticleHeads {0} / {1} / {2}", new Object[]{group, first, last});
    1.87  		/** TODO: */
    1.88  		return Collections.emptyList();
    1.89  	}
    1.90  
    1.91  	@Override
    1.92  	public List<Pair<Long, String>> getArticleHeaders(Group group, long start, long end, String header, String pattern) throws StorageBackendException {
    1.93 -		Log.get().log(Level.SEVERE, "TODO: getArticleHeaders {0} / {1} / {2} / {3} / {4}", new Object[]{group, start, end, header, pattern});
    1.94 +		log.log(Level.SEVERE, "TODO: getArticleHeaders {0} / {1} / {2} / {3} / {4}", new Object[]{group, start, end, header, pattern});
    1.95  		/** TODO: */
    1.96  		return Collections.emptyList();
    1.97  	}
    1.98  
    1.99  	@Override
   1.100  	public long getArticleIndex(Article art, Group group) throws StorageBackendException {
   1.101 -		Log.get().log(Level.SEVERE, "TODO: getArticleIndex {0} / {1}", new Object[]{art, group});
   1.102 +		log.log(Level.SEVERE, "TODO: getArticleIndex {0} / {1}", new Object[]{art, group});
   1.103  		/** TODO: */
   1.104  		return 0;
   1.105  	}
   1.106  
   1.107  	@Override
   1.108  	public List<Long> getArticleNumbers(long groupID) throws StorageBackendException {
   1.109 -		Log.get().log(Level.SEVERE, "TODO: getArticleNumbers {0}", new Object[]{groupID});
   1.110 +		log.log(Level.SEVERE, "TODO: getArticleNumbers {0}", new Object[]{groupID});
   1.111  		/** TODO: */
   1.112  		return Collections.emptyList();
   1.113  	}
   1.114  
   1.115  	@Override
   1.116  	public String getConfigValue(String key) throws StorageBackendException {
   1.117 -		Log.get().log(Level.SEVERE, "TODO: getConfigValue {0}", new Object[]{key});
   1.118 +		log.log(Level.SEVERE, "TODO: getConfigValue {0}", new Object[]{key});
   1.119  		return null;
   1.120  	}
   1.121  
   1.122  	@Override
   1.123  	public int getEventsCount(int eventType, long startTimestamp, long endTimestamp, Group group) throws StorageBackendException {
   1.124 -		Log.get().log(Level.SEVERE, "TODO: getEventsCount {0} / {1} / {2} / {3}", new Object[]{eventType, startTimestamp, endTimestamp, group});
   1.125 +		log.log(Level.SEVERE, "TODO: getEventsCount {0} / {1} / {2} / {3}", new Object[]{eventType, startTimestamp, endTimestamp, group});
   1.126  		return 0;
   1.127  	}
   1.128  
   1.129  	@Override
   1.130  	public double getEventsPerHour(int key, long gid) throws StorageBackendException {
   1.131 -		Log.get().log(Level.SEVERE, "TODO: getEventsPerHour {0} / {1}", new Object[]{key, gid});
   1.132 +		log.log(Level.SEVERE, "TODO: getEventsPerHour {0} / {1}", new Object[]{key, gid});
   1.133  		return 0;
   1.134  	}
   1.135  
   1.136  	@Override
   1.137  	public int getFirstArticleNumber(Group group) throws StorageBackendException {
   1.138 -		Log.get().log(Level.SEVERE, "TODO: getFirstArticleNumber {0}", new Object[]{group});
   1.139 +		log.log(Level.SEVERE, "TODO: getFirstArticleNumber {0}", new Object[]{group});
   1.140  		/** TODO: */
   1.141  		return 0;
   1.142  	}
   1.143  
   1.144  	@Override
   1.145  	public Group getGroup(String name) throws StorageBackendException {
   1.146 -		Log.get().log(Level.SEVERE, "TODO: getGroup {0}", new Object[]{name});
   1.147 +		log.log(Level.SEVERE, "TODO: getGroup {0}", new Object[]{name});
   1.148  		/** TODO: */
   1.149  		return null;
   1.150  	}
   1.151  
   1.152  	@Override
   1.153  	public List<Group> getGroups() throws StorageBackendException {
   1.154 -		Log.get().log(Level.SEVERE, "TODO: getGroups");
   1.155 +		log.log(Level.SEVERE, "TODO: getGroups");
   1.156  		/** TODO: */
   1.157  		return Collections.emptyList();
   1.158  	}
   1.159  
   1.160  	@Override
   1.161  	public List<String> getGroupsForList(String listAddress) throws StorageBackendException {
   1.162 -		Log.get().log(Level.SEVERE, "TODO: getGroupsForList {0}", new Object[]{listAddress});
   1.163 +		log.log(Level.SEVERE, "TODO: getGroupsForList {0}", new Object[]{listAddress});
   1.164  		return Collections.emptyList();
   1.165  	}
   1.166  
   1.167  	@Override
   1.168  	public int getLastArticleNumber(Group group) throws StorageBackendException {
   1.169 -		Log.get().log(Level.SEVERE, "TODO: getLastArticleNumber {0}", new Object[]{group});
   1.170 +		log.log(Level.SEVERE, "TODO: getLastArticleNumber {0}", new Object[]{group});
   1.171  		/** TODO: */
   1.172  		return 0;
   1.173  	}
   1.174  
   1.175  	@Override
   1.176  	public List<String> getListsForGroup(String groupname) throws StorageBackendException {
   1.177 -		Log.get().log(Level.SEVERE, "TODO: getListsForGroup {0}", new Object[]{groupname});
   1.178 +		log.log(Level.SEVERE, "TODO: getListsForGroup {0}", new Object[]{groupname});
   1.179  		return Collections.emptyList();
   1.180  	}
   1.181  
   1.182  	@Override
   1.183  	public String getOldestArticle() throws StorageBackendException {
   1.184 -		Log.get().log(Level.SEVERE, "TODO: getOldestArticle");
   1.185 +		log.log(Level.SEVERE, "TODO: getOldestArticle");
   1.186  		return null;
   1.187  	}
   1.188  
   1.189  	@Override
   1.190  	public int getPostingsCount(String groupname) throws StorageBackendException {
   1.191 -		Log.get().log(Level.SEVERE, "TODO: getPostingsCount {0}", new Object[]{groupname});
   1.192 +		log.log(Level.SEVERE, "TODO: getPostingsCount {0}", new Object[]{groupname});
   1.193  		return 0;
   1.194  	}
   1.195  
   1.196  	@Override
   1.197  	public List<Subscription> getSubscriptions(int type) throws StorageBackendException {
   1.198 -		Log.get().log(Level.SEVERE, "TODO: getSubscriptions {0}", new Object[]{type});
   1.199 +		log.log(Level.SEVERE, "TODO: getSubscriptions {0}", new Object[]{type});
   1.200  		return Collections.emptyList();
   1.201  	}
   1.202  
   1.203  	@Override
   1.204  	public boolean isArticleExisting(String messageID) throws StorageBackendException {
   1.205 -		Log.get().log(Level.SEVERE, "TODO: isArticleExisting {0}", new Object[]{messageID});
   1.206 +		log.log(Level.SEVERE, "TODO: isArticleExisting {0}", new Object[]{messageID});
   1.207  		/** TODO: */
   1.208  		return false;
   1.209  	}
   1.210  
   1.211  	@Override
   1.212  	public boolean isGroupExisting(String groupname) throws StorageBackendException {
   1.213 -		Log.get().log(Level.SEVERE, "TODO: isGroupExisting {0}", new Object[]{groupname});
   1.214 +		log.log(Level.SEVERE, "TODO: isGroupExisting {0}", new Object[]{groupname});
   1.215  		/** TODO: */
   1.216  		return false;
   1.217  	}
   1.218  
   1.219  	@Override
   1.220  	public void purgeGroup(Group group) throws StorageBackendException {
   1.221 -		Log.get().log(Level.SEVERE, "TODO: purgeGroup {0}", new Object[]{group});
   1.222 +		log.log(Level.SEVERE, "TODO: purgeGroup {0}", new Object[]{group});
   1.223  	}
   1.224  
   1.225  	@Override
   1.226  	public void setConfigValue(String key, String value) throws StorageBackendException {
   1.227 -		Log.get().log(Level.SEVERE, "TODO: setConfigValue {0} = {1}", new Object[]{key, value});
   1.228 +		log.log(Level.SEVERE, "TODO: setConfigValue {0} = {1}", new Object[]{key, value});
   1.229  	}
   1.230  
   1.231  	@Override
   1.232  	public boolean update(Article article) throws StorageBackendException {
   1.233 -		Log.get().log(Level.SEVERE, "TODO: update {0}", new Object[]{article});
   1.234 +		log.log(Level.SEVERE, "TODO: update {0}", new Object[]{article});
   1.235  		throw new StorageBackendException("Not implemented yet.");
   1.236  	}
   1.237  
   1.238  	@Override
   1.239  	public boolean update(Group group) throws StorageBackendException {
   1.240 -		Log.get().log(Level.SEVERE, "TODO: update {0}", new Object[]{group});
   1.241 +		log.log(Level.SEVERE, "TODO: update {0}", new Object[]{group});
   1.242  		throw new StorageBackendException("Not implemented yet.");
   1.243  	}
   1.244  }