roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r543978 [2/8] - in /roller/branches/roller_guice/apps/weblogger: src/java/org/apache/roller/weblogger/ src/java/org/apache/roller/weblogger/business/ src/java/org/apache/roller/weblogger/business/hibernate/ src/java/org/apache/roller/weblog...
Date Sun, 03 Jun 2007 20:18:33 GMT
Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/WeblogManager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/WeblogManager.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/WeblogManager.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/WeblogManager.java Sun Jun  3 13:18:24 2007
@@ -21,7 +21,7 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.pojos.WeblogEntryComment;
 import org.apache.roller.weblogger.pojos.WeblogHitCount;
 import org.apache.roller.weblogger.pojos.User;
@@ -42,23 +42,23 @@
     /**
      * Save weblog entry.
      */
-    public void saveWeblogEntry(WeblogEntry entry) throws RollerException;
+    public void saveWeblogEntry(WeblogEntry entry) throws WebloggerException;
        
     /**
      * Remove weblog entry.
      */
-    public void removeWeblogEntry(WeblogEntry entry) throws RollerException;    
+    public void removeWeblogEntry(WeblogEntry entry) throws WebloggerException;    
     
     /**
      * Get weblog entry by id.
      */
-    public WeblogEntry getWeblogEntry(String id) throws RollerException;
+    public WeblogEntry getWeblogEntry(String id) throws WebloggerException;
     
     /** 
      * Get weblog entry by anchor. 
      */
     public WeblogEntry getWeblogEntryByAnchor(Weblog website, String anchor) 
-            throws RollerException;
+            throws WebloggerException;
         
     /**
      * Get WeblogEntries by offset/length as list in reverse chronological order.
@@ -75,7 +75,7 @@
      * @param offset     Offset into results for paging
      * @param length     Max comments to return (or -1 for no limit)
      * @return List of WeblogEntryData objects in reverse chrono order.
-     * @throws RollerException
+     * @throws WebloggerException
      */
     public List getWeblogEntries(
             Weblog website,
@@ -91,7 +91,7 @@
             String      locale,             
             int         offset,
             int         range)
-            throws RollerException;
+            throws WebloggerException;
        
     /**
      * Get Weblog Entries grouped by day. This method returns a Map that
@@ -105,7 +105,7 @@
      * @param offset     Offset into results for paging
      * @param length     Max comments to return (or -1 for no limit)
      * @return Map of Lists, keyed by Date, and containing WeblogEntryData.
-     * @throws RollerException
+     * @throws WebloggerException
      */
     public Map getWeblogEntryObjectMap(
             Weblog website,
@@ -117,7 +117,7 @@
             String      locale,
             int         offset,
             int         range)
-            throws RollerException;
+            throws WebloggerException;
         
     /**
      * Get Weblog Entry date strings grouped by day. This method returns a Map
@@ -131,7 +131,7 @@
      * @param offset     Offset into results for paging
      * @param length     Max comments to return (or -1 for no limit)
      * @return Map of Lists, keyed by Date, and containing date strings.
-     * @throws RollerException
+     * @throws WebloggerException
      */
     public Map getWeblogEntryStringMap(
             Weblog website,
@@ -143,7 +143,7 @@
             String      locale,
             int         offset,
             int         range)
-            throws RollerException;    
+            throws WebloggerException;    
     
     /**
      * Get weblog entries with given category or, optionally, any sub-category
@@ -153,7 +153,7 @@
      * @return        List of weblog entries in category
      */
     public List getWeblogEntries(WeblogCategory cat, boolean subcats) 
-            throws RollerException; 
+            throws WebloggerException; 
     
     /** 
      * Get weblog enties ordered by descending number of comments.
@@ -170,7 +170,7 @@
             Date        endDate,
             int         offset, 
             int         length)
-            throws RollerException;
+            throws WebloggerException;
     
     /**
      * Get the WeblogEntry following, chronologically, the current entry.
@@ -179,7 +179,7 @@
      * @param catName The value of the requested Category Name
      */
     public WeblogEntry getNextEntry(WeblogEntry current, 
-            String catName, String locale) throws RollerException;    
+            String catName, String locale) throws WebloggerException;    
     
     /**
      * Get the WeblogEntry prior to, chronologically, the current entry.
@@ -188,7 +188,7 @@
      * @param catName The value of the requested Category Name.
      */
     public WeblogEntry getPreviousEntry(WeblogEntry current, 
-            String catName, String locale) throws RollerException;
+            String catName, String locale) throws WebloggerException;
       
     
     /**
@@ -196,36 +196,36 @@
      * @param max Maximum number to return.
      * @return Collection of WeblogEntryData objects.
      */
-    public List getWeblogEntriesPinnedToMain(Integer max) throws RollerException;
+    public List getWeblogEntriesPinnedToMain(Integer max) throws WebloggerException;
 
     /**
      * Remove attribute with given name from given WeblogEntryData
      * @param name Name of attribute to be removed
      */
     public void removeWeblogEntryAttribute(String name,WeblogEntry entry)
-            throws RollerException;
+            throws WebloggerException;
 
     /**
      * Remove tag with given name from given WeblogEntryData
      * @param name Name of tag to be removed
      */
     public void removeWeblogEntryTag(String name,WeblogEntry entry)
-            throws RollerException;
+            throws WebloggerException;
 
     /**
      * Save weblog category.
      */
-    public void saveWeblogCategory(WeblogCategory cat) throws RollerException;
+    public void saveWeblogCategory(WeblogCategory cat) throws WebloggerException;
     
     /**
      * Remove weblog category.
      */
-    public void removeWeblogCategory(WeblogCategory cat) throws RollerException;
+    public void removeWeblogCategory(WeblogCategory cat) throws WebloggerException;
         
     /**
      * Get category by id.
      */
-    public WeblogCategory getWeblogCategory(String id) throws RollerException;
+    public WeblogCategory getWeblogCategory(String id) throws WebloggerException;
     
     
     /**
@@ -234,20 +234,20 @@
      * This moves the src category itself and all children and associated entries.
      */
     public void moveWeblogCategory(WeblogCategory src, WeblogCategory dest)
-            throws RollerException;
+            throws WebloggerException;
     
     
     /**
      * Recategorize all entries with one category to another.
      */
     public void moveWeblogCategoryContents(WeblogCategory srcCat, WeblogCategory destCat) 
-            throws RollerException;
+            throws WebloggerException;
     
     /**
      * Get top level categories for a website.
      * @param website Website.
      */
-    public WeblogCategory getRootWeblogCategory(Weblog website) throws RollerException;
+    public WeblogCategory getRootWeblogCategory(Weblog website) throws WebloggerException;
     
     
     /**
@@ -256,30 +256,30 @@
      * @param categoryPath Path of WeblogCategory, relative to category root.
      */
     public WeblogCategory getWeblogCategoryByPath(Weblog website, 
-            String categoryPath) throws RollerException;
+            String categoryPath) throws WebloggerException;
     
     
     /** 
      * Get WebLogCategory objects for a website. 
      */
     public List getWeblogCategories(Weblog website, boolean includeRoot)
-            throws RollerException;
+            throws WebloggerException;
     
                
     /**
      * Save comment.
      */
-    public void saveComment(WeblogEntryComment comment) throws RollerException;
+    public void saveComment(WeblogEntryComment comment) throws WebloggerException;
     
     /**
      * Remove comment.
      */
-    public void removeComment(WeblogEntryComment comment) throws RollerException;
+    public void removeComment(WeblogEntryComment comment) throws WebloggerException;
    
     /**
      * Get comment by id.
      */
-    public WeblogEntryComment getComment(String id) throws RollerException;
+    public WeblogEntryComment getComment(String id) throws WebloggerException;
        
     /**
      * Generic comments query method.
@@ -303,7 +303,7 @@
             int             offset,
             int             length
             
-            ) throws RollerException;
+            ) throws WebloggerException;
 
     /**
      * Deletes comments that match paramters.
@@ -322,31 +322,31 @@
             Date            endDate,
             String          status
             
-            ) throws RollerException;
+            ) throws WebloggerException;
         
     /**
      * Create unique anchor for weblog entry.
      */
-    public String createAnchor(WeblogEntry data) throws RollerException;    
+    public String createAnchor(WeblogEntry data) throws WebloggerException;    
     
     /**
      * Check for duplicate category name.
      */
     public boolean isDuplicateWeblogCategoryName(WeblogCategory data)
-            throws RollerException;  
+            throws WebloggerException;  
     
     /**
      * Check if weblog category is in use.
      */
     public boolean isWeblogCategoryInUse(WeblogCategory data)
-            throws RollerException;    
+            throws WebloggerException;    
     
     
     /**
      * Apply comment default settings from website to all of website's entries.
      */
     public void applyCommentDefaultsToEntries(Weblog website) 
-        throws RollerException;
+        throws WebloggerException;
     
     /**
      * Release all resources held by manager.
@@ -359,10 +359,10 @@
      * @param startDate     Date or null of the most recent time a tag was used.
      * @param limit         Max TagStats to return (or -1 for no limit)
      * @return
-     * @throws RollerException
+     * @throws WebloggerException
      */
     public List getPopularTags(Weblog website, Date startDate, int limit)
-            throws RollerException;
+            throws WebloggerException;
     
     /**
      * Get list of TagStat. There's no offset/length params just a limit.
@@ -371,10 +371,10 @@
      * @param startsWith    Prefix for tags to be returned (null or a string of length > 0)
      * @param limit         Max TagStats to return (or -1 for no limit)
      * @return
-     * @throws RollerException
+     * @throws WebloggerException
      */
     public List getTags(Weblog website, String sortBy, String startsWith, int limit)
-            throws RollerException;    
+            throws WebloggerException;    
     
     /**
      * Does the specified tag combination exist?  Optionally confined to a specific weblog.
@@ -387,10 +387,10 @@
      * @param tags The List of tags to check for.
      * @param weblog The weblog to confine the check to.
      * @return True if tags exist, false otherwise.
-     * @throws RollerException If there is any problem doing the operation.
+     * @throws WebloggerException If there is any problem doing the operation.
      */
     public boolean getTagComboExists(List tags, Weblog weblog) 
-        throws RollerException;
+        throws WebloggerException;
     
     /**
      * This method maintains the tag aggregate table up-to-date with total counts. More
@@ -401,10 +401,10 @@
      * @param name      The tag name
      * @param website   The website to used when updating the stats.
      * @param amount    The amount to increment the tag count (it can be positive or negative).
-     * @throws RollerException
+     * @throws WebloggerException
      */
     public void updateTagCount(String name, Weblog website, int amount)
-        throws RollerException;
+        throws WebloggerException;
     
     
     /**
@@ -412,9 +412,9 @@
      *
      * @param id The HitCountData id.
      * @return The HitCountData object, or null if it wasn't found.
-     * @throws RollerException If there was a problem with the backend.
+     * @throws WebloggerException If there was a problem with the backend.
      */
-    public WeblogHitCount getHitCount(String id) throws RollerException;
+    public WeblogHitCount getHitCount(String id) throws WebloggerException;
     
     
     /**
@@ -422,10 +422,10 @@
      *
      * @param weblog The WebsiteData that you want the hit count for.
      * @return The HitCountData object, or null if it wasn't found.
-     * @throws RollerException If there was a problem with the backend.
+     * @throws WebloggerException If there was a problem with the backend.
      */
     public WeblogHitCount getHitCountByWeblog(Weblog weblog)
-        throws RollerException;
+        throws WebloggerException;
     
     
     /**
@@ -441,28 +441,28 @@
      * @param offset What index in the results to begin from.
      * @param length The number of results to return.
      * @return The list of HitCountData objects ranked by hit count, descending.
-     * @throws RollerException If there was a problem with the backend.
+     * @throws WebloggerException If there was a problem with the backend.
      */
     public List getHotWeblogs(int sinceDays, int offset, int length)
-        throws RollerException;
+        throws WebloggerException;
     
     
     /**
      * Save a HitCountData object.
      *
      * @param hitCount The HitCountData object to save.
-     * @throws RollerException If there was a problem with the backend.
+     * @throws WebloggerException If there was a problem with the backend.
      */
-    public void saveHitCount(WeblogHitCount hitCount) throws RollerException;
+    public void saveHitCount(WeblogHitCount hitCount) throws WebloggerException;
     
     
     /**
      * Remove a HitCountData object.
      *
      * @param hitCount The HitCountData object to remove.
-     * @throws RollerException If there was a problem with the backend.
+     * @throws WebloggerException If there was a problem with the backend.
      */
-    public void removeHitCount(WeblogHitCount hitCount) throws RollerException;
+    public void removeHitCount(WeblogHitCount hitCount) throws WebloggerException;
     
     
     /**
@@ -473,51 +473,51 @@
      *
      * @param weblog The WebsiteData object to increment the count for.
      * @param amount How much to increment by.
-     * @throws RollerException If there was a problem with the backend.
+     * @throws WebloggerException If there was a problem with the backend.
      */
     public void incrementHitCount(Weblog weblog, int amount)
-        throws RollerException;
+        throws WebloggerException;
     
     
     /**
      * Reset the hit counts for all weblogs.  This sets the counts back to 0.
      *
-     * @throws RollerException If there was a problem with the backend.
+     * @throws WebloggerException If there was a problem with the backend.
      */
-    public void resetAllHitCounts() throws RollerException;
+    public void resetAllHitCounts() throws WebloggerException;
     
     
     /**
      * Reset the hit counts for a single weblog.  This sets the count to 0.
      *
      * @param weblog The WebsiteData object to reset the count for.
-     * @throws RollerException If there was a problem with the backend.
+     * @throws WebloggerException If there was a problem with the backend.
      */
-    public void resetHitCount(Weblog weblog) throws RollerException;
+    public void resetHitCount(Weblog weblog) throws WebloggerException;
 
     
     /**
      * Get site-wide comment count 
      */
-    public long getCommentCount() throws RollerException;
+    public long getCommentCount() throws WebloggerException;
 
     
     /**
      * Get weblog comment count 
      */    
-    public long getCommentCount(Weblog websiteData) throws RollerException;
+    public long getCommentCount(Weblog websiteData) throws WebloggerException;
 
     
     /**
      * Get site-wide entry count 
      */    
-    public long getEntryCount() throws RollerException;
+    public long getEntryCount() throws WebloggerException;
 
     
     /**
      * Get weblog entry count 
      */    
-    public long getEntryCount(Weblog websiteData) throws RollerException;
+    public long getEntryCount(Weblog websiteData) throws WebloggerException;
     
 }
 

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateAutoPingManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateAutoPingManagerImpl.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateAutoPingManagerImpl.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateAutoPingManagerImpl.java Sun Jun  3 13:18:24 2007
@@ -18,10 +18,11 @@
 
 package org.apache.roller.weblogger.business.hibernate; 
 
-import org.hibernate.Criteria; 
-import org.hibernate.HibernateException; 
-import org.hibernate.Session; 
-import org.hibernate.criterion.Expression; 
+import org.hibernate.Criteria;
+import org.hibernate.HibernateException;
+import org.hibernate.Session;
+import org.hibernate.criterion.Expression;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.pojos.AutoPing;
 import org.apache.roller.weblogger.pojos.PingTarget;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
@@ -61,23 +62,23 @@
     }
     
     
-    public AutoPing getAutoPing(String id) throws RollerException {
+    public AutoPing getAutoPing(String id) throws WebloggerException {
         return (AutoPing) strategy.load(id, AutoPing.class);
     }
     
     
-    public void saveAutoPing(AutoPing autoPing) throws RollerException {
+    public void saveAutoPing(AutoPing autoPing) throws WebloggerException {
         strategy.store(autoPing);
     }
     
     
-    public void removeAutoPing(AutoPing autoPing)  throws RollerException {
+    public void removeAutoPing(AutoPing autoPing)  throws WebloggerException {
         //TODO: first remove all related category restrictions (category restrictions are not yet implemented)
         strategy.remove(autoPing);
     }
     
     
-    public void removeAutoPing(PingTarget pingTarget, Weblog website) throws RollerException {
+    public void removeAutoPing(PingTarget pingTarget, Weblog website) throws WebloggerException {
         try {
             Session session = strategy.getSession();
             Criteria criteria = session.createCriteria(AutoPing.class);
@@ -91,12 +92,12 @@
             // This should have at most one element, but we remove them all regardless.
             this.removeAutoPings(matches);
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
     
-    public void removeAutoPings(Collection autopings) throws RollerException {
+    public void removeAutoPings(Collection autopings) throws WebloggerException {
         
         // just go through the list and remove each auto ping
         Iterator pings = autopings.iterator();
@@ -106,19 +107,19 @@
     }
     
     
-    public void removeAllAutoPings() throws RollerException {
+    public void removeAllAutoPings() throws WebloggerException {
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(AutoPing.class);
             List allAutoPings = criteria.list();
             this.removeAutoPings(allAutoPings);
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
     
-    public void queueApplicableAutoPings(WeblogEntry changedWeblogEntry) throws RollerException {
+    public void queueApplicableAutoPings(WeblogEntry changedWeblogEntry) throws WebloggerException {
         if (PingConfig.getSuspendPingProcessing()) {
             if (log.isDebugEnabled()) log.debug("Ping processing is suspended.  No auto pings will be queued.");
             return;
@@ -134,7 +135,7 @@
     }
     
     
-    public List getAutoPingsByWebsite(Weblog website) throws RollerException {
+    public List getAutoPingsByWebsite(Weblog website) throws WebloggerException {
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(AutoPing.class);
@@ -143,12 +144,12 @@
             criteria.add(Expression.eq("website", website));
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
     
-    public List getAutoPingsByTarget(PingTarget pingTarget) throws RollerException {
+    public List getAutoPingsByTarget(PingTarget pingTarget) throws WebloggerException {
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(AutoPing.class);
@@ -157,12 +158,12 @@
             criteria.add(Expression.eq("pingTarget", pingTarget));
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
     
-    public List getApplicableAutoPings(WeblogEntry changedWeblogEntry) throws RollerException {
+    public List getApplicableAutoPings(WeblogEntry changedWeblogEntry) throws WebloggerException {
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(AutoPing.class);
@@ -171,12 +172,12 @@
             criteria.add(Expression.eq("website", changedWeblogEntry.getWebsite()));
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
     
-    public List getCategoryRestrictions(AutoPing autoPing) throws RollerException {
+    public List getCategoryRestrictions(AutoPing autoPing) throws WebloggerException {
         return Collections.EMPTY_LIST;
     }
     

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateBookmarkManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateBookmarkManagerImpl.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateBookmarkManagerImpl.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateBookmarkManagerImpl.java Sun Jun  3 13:18:24 2007
@@ -23,12 +23,11 @@
 import org.hibernate.HibernateException;
 import org.hibernate.Session;
 import org.hibernate.criterion.Expression;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.pojos.WeblogBookmark;
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
 import org.apache.roller.weblogger.pojos.Weblog;
 import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -36,8 +35,7 @@
 import org.jdom.Element;
 import org.jdom.input.SAXBuilder;
 import org.apache.roller.weblogger.business.BookmarkManager;
-import org.apache.roller.weblogger.business.RollerFactory;
-import org.apache.roller.weblogger.util.Utilities;
+import org.apache.roller.weblogger.business.Roller;
 
 
 /**
@@ -50,28 +48,30 @@
     private static Log log = LogFactory.getLog(HibernateBookmarkManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     
     /**
      * @param pstrategy
      * @param roller
      */
-    public HibernateBookmarkManagerImpl(HibernatePersistenceStrategy strat) {
-        log.debug("Instantiating Hibernate Bookmark Manager");
-        
+    @com.google.inject.Inject    
+    public HibernateBookmarkManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
+        this.roller = roller;
         this.strategy = strat;
+        log.debug("Instantiating Hibernate Bookmark Manager");
     }
     
     
-    public void saveBookmark(WeblogBookmark bookmark) throws RollerException {
+    public void saveBookmark(WeblogBookmark bookmark) throws WebloggerException {
         this.strategy.store(bookmark);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(bookmark.getWebsite());
+        roller.getUserManager().saveWebsite(bookmark.getWebsite());
     }
     
     
-    public WeblogBookmark getBookmark(String id) throws RollerException {
+    public WeblogBookmark getBookmark(String id) throws WebloggerException {
         WeblogBookmark bd = (WeblogBookmark)
         strategy.load(id,WeblogBookmark.class);
         // TODO: huh?  why do we do this?
@@ -80,37 +80,36 @@
     }
     
     
-    public void removeBookmark(WeblogBookmark bookmark) throws RollerException {
+    public void removeBookmark(WeblogBookmark bookmark) throws WebloggerException {
         //Remove the bookmark from its parent folder
         bookmark.getFolder().getBookmarks().remove(bookmark);
         //Now remove it from database
         this.strategy.remove(bookmark);
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager()
-                .saveWebsite(bookmark.getWebsite());
+        roller.getUserManager().saveWebsite(bookmark.getWebsite());
     }
     
     
-    public void saveFolder(WeblogBookmarkFolder folder) throws RollerException {
+    public void saveFolder(WeblogBookmarkFolder folder) throws WebloggerException {
         
         WeblogBookmarkFolder existingFolder = getFolder(folder.getId());        
         if(existingFolder == null && isDuplicateFolderName(folder)) {
-            throw new RollerException("Duplicate folder name");
+            throw new WebloggerException("Duplicate folder name");
         }
         
         this.strategy.store(folder);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(folder.getWebsite());
+        roller.getUserManager().saveWebsite(folder.getWebsite());
     }
     
     
-    public void removeFolder(WeblogBookmarkFolder folder) throws RollerException {
+    public void removeFolder(WeblogBookmarkFolder folder) throws WebloggerException {
         
         this.strategy.remove(folder);
         
         // update weblog last modified date.  date updated by saveWebsite()
-        RollerFactory.getRoller().getUserManager().saveWebsite(folder.getWebsite());
+        roller.getUserManager().saveWebsite(folder.getWebsite());
     }
     
     
@@ -118,11 +117,11 @@
 
     WeblogBookmarkFolder destFolder
 )
-            throws RollerException {
+            throws WebloggerException {
         
         // TODO: this check should be made before calling this method?
         if (destFolder.descendentOf(srcFolder)) {
-            throw new RollerException(
+            throw new WebloggerException(
                     "ERROR cannot move parent folder into it's own child");
         }
         
@@ -145,13 +144,13 @@
     /**
      * Retrieve folder and lazy-load it's sub-folders and bookmarks.
      */
-    public WeblogBookmarkFolder getFolder(String id) throws RollerException {
+    public WeblogBookmarkFolder getFolder(String id) throws WebloggerException {
         return (WeblogBookmarkFolder)strategy.load(id,WeblogBookmarkFolder.class);
     }
     
     
     public void importBookmarks(Weblog website, String folderName, String opml)
-            throws RollerException {
+            throws WebloggerException {
         
         String msg = "importBookmarks";
         try {
@@ -176,7 +175,7 @@
             }
             
         } catch (Exception ex) {
-            throw new RollerException(ex);
+            throw new WebloggerException(ex);
         }
     }
     
@@ -185,7 +184,7 @@
     private void importOpmlElement(
             
             Weblog website, Element elem,WeblogBookmarkFolder parent)
-            throws RollerException {
+            throws WebloggerException {
         String text = elem.getAttributeValue("text");
         String title = elem.getAttributeValue("title");
         String desc = elem.getAttributeValue("description");
@@ -238,7 +237,7 @@
     
     
     public WeblogBookmarkFolder getFolder(Weblog website, String path)
-            throws RollerException {
+            throws WebloggerException {
         
         if (path == null || path.trim().equals("/")) {
             return getRootFolder(website);
@@ -267,7 +266,7 @@
      *      org.apache.roller.weblogger.pojos.FolderData, boolean)
      */
     public List getBookmarks(WeblogBookmarkFolder folder, boolean subfolders)
-            throws RollerException {
+            throws WebloggerException {
         
         try {
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
@@ -287,15 +286,15 @@
             return criteria.list();
             
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
     
-    public WeblogBookmarkFolder getRootFolder(Weblog website) throws RollerException {
+    public WeblogBookmarkFolder getRootFolder(Weblog website) throws WebloggerException {
         
         if (website == null)
-            throw new RollerException("website is null");
+            throw new WebloggerException("website is null");
         
         try {
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
@@ -308,13 +307,13 @@
             return (WeblogBookmarkFolder) criteria.uniqueResult();
             
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
-    public List getAllFolders(Weblog website) throws RollerException {
+    public List getAllFolders(Weblog website) throws WebloggerException {
         if (website == null)
-            throw new RollerException("Website is null");
+            throw new WebloggerException("Website is null");
         
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
@@ -322,7 +321,7 @@
             criteria.add(Expression.eq("website", website));
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
         
     }
@@ -331,7 +330,7 @@
     /**
      * make sure the given folder doesn't already exist.
      */
-    private boolean isDuplicateFolderName(WeblogBookmarkFolder folder) throws RollerException {
+    private boolean isDuplicateFolderName(WeblogBookmarkFolder folder) throws WebloggerException {
         
         // ensure that no sibling categories share the same name
         WeblogBookmarkFolder parent = folder.getParent();

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateConnectionProvider.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateConnectionProvider.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateConnectionProvider.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateConnectionProvider.java Sun Jun  3 13:18:24 2007
@@ -5,7 +5,7 @@
 import java.util.Properties;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.DatabaseProvider;
 import org.hibernate.HibernateException;
 import org.hibernate.connection.ConnectionProvider;
@@ -19,21 +19,14 @@
  */
 public class HibernateConnectionProvider implements ConnectionProvider {
     private static Log log = LogFactory.getLog(HibernateConnectionProvider.class);
+    private DatabaseProvider databaseProvider = null;
     
     /** No-op: we get our configuration from Roller's DatabaseProvider */
-    public void configure(Properties properties) throws HibernateException {
-        // no-op
-    }
+    public void configure(Properties properties) throws HibernateException {}
 
     /** Get connecetion from Roller's Database provider */
     public Connection getConnection() throws SQLException {
-        try {
-            return DatabaseProvider.getDatabaseProvider().getConnection();
-        } catch (RollerException ex) {
-            // The DatabaseProvider should have been constructed long before 
-            // we get to this point, so this should never ever happen
-            throw new RuntimeException("ERROR getting database provider", ex);
-        }
+        return DatabaseProvider.getDatabaseProvider().getConnection();
     }
 
     /** Close connection by calling connection.close() */

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateModule.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateModule.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateModule.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateModule.java Sun Jun  3 13:18:24 2007
@@ -21,12 +21,14 @@
 import com.google.inject.Binder;
 import com.google.inject.Module;
 import org.apache.roller.weblogger.business.BookmarkManager;
+import org.apache.roller.weblogger.business.DatabaseProvider;
 import org.apache.roller.weblogger.business.FileManager;
 import org.apache.roller.weblogger.business.FileManagerImpl;
 import org.apache.roller.weblogger.business.PluginManager;
 import org.apache.roller.weblogger.business.PluginManagerImpl;
 import org.apache.roller.weblogger.business.PropertiesManager;
 import org.apache.roller.weblogger.business.Roller;
+import org.apache.roller.weblogger.business.RollerDatabaseProvider;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogManager;
 import org.apache.roller.weblogger.business.pings.AutoPingManager;
@@ -49,7 +51,11 @@
 
     public void configure(Binder binder) {
         
-        binder.bind(Roller.class).to(HibernateRollerImpl.class);
+        binder.bind(Roller.class).to(              HibernateRollerImpl.class);
+        
+        binder.bind(DatabaseProvider.class).to(    RollerDatabaseProvider.class);
+        
+        //binder.bind(HibernatePersistenceStrategy.class).to(RollerHibernateAutoPingManagerImpl.class);
         
         binder.bind(AutoPingManager.class).to(     HibernateAutoPingManagerImpl.class);   
         binder.bind(BookmarkManager.class).to(     HibernateBookmarkManagerImpl.class);  

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePersistenceStrategy.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePersistenceStrategy.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePersistenceStrategy.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePersistenceStrategy.java Sun Jun  3 13:18:24 2007
@@ -22,12 +22,12 @@
 import java.util.Properties;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
 import org.hibernate.HibernateException;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.Transaction;
 import org.hibernate.cfg.Configuration;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.config.RollerConfig;
 import org.hibernate.cfg.Environment;
 import org.xml.sax.EntityResolver;
@@ -43,13 +43,10 @@
  */
 @com.google.inject.Singleton
 public class HibernatePersistenceStrategy {
-    
-    static final long serialVersionUID = 2561090040518169098L;
+    private static Log log = LogFactory.getLog(HibernatePersistenceStrategy.class);
     
     protected static SessionFactory sessionFactory = null;
     
-    private static Log log = LogFactory.getLog(HibernatePersistenceStrategy.class);
-    
     /** No-op so XML parser doesn't hit the network looking for Hibernate DTDs */
     private EntityResolver noOpEntityResolver = new EntityResolver() {
         public InputSource resolveEntity(String publicId, String systemId) {
@@ -63,15 +60,16 @@
      * 'hibernate.dialect' - the classname of the Hibernate dialect to be used,
      * 'hibernate.connectionProvider - the classname of Roller's connnection provider impl.
      */
-    public HibernatePersistenceStrategy() throws RollerException {
+    protected HibernatePersistenceStrategy() throws WebloggerException {        
         String dialect =  
             RollerConfig.getProperty("hibernate.dialect");
         String connectionProvider = 
-            RollerConfig.getProperty("hibernate.connectionProvider");
-        String configuration = 
-            RollerConfig.getProperty("hibernate.configuration");
-        
-        // Read Hibernate config file specified by Roller config
+            RollerConfig.getProperty("hibernate.connectionProvider");        
+        String configuration = "hibernate.cfg.xml";
+        init(dialect, connectionProvider, configuration);
+    }   
+    
+    protected void init(String dialect, String connectionProvider, String configuration) {
         Configuration config = new Configuration();
         config.configure(configuration);
 
@@ -104,7 +102,7 @@
     }
     
     
-    public void flush() throws RollerException {
+    public void flush() throws WebloggerException {
         
         Session session = getSession();
         try {
@@ -121,7 +119,7 @@
             release();
             
             // wrap and rethrow so caller knows something bad happened
-            throw new RollerException(t);
+            throw new WebloggerException(t);
         }
     }
     
@@ -172,10 +170,10 @@
     /**
      * Retrieve object.  We return null if the object is not found.
      */
-    public Object load(String id, Class clazz) throws RollerException {
+    public Object load(String id, Class clazz) throws WebloggerException {
         
         if(id == null || clazz == null) {
-            throw new RollerException("Cannot load objects when value is null");
+            throw new WebloggerException("Cannot load objects when value is null");
         }
         
         return (Object) getSession().get(clazz, id);

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingQueueManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingQueueManagerImpl.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingQueueManagerImpl.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingQueueManagerImpl.java Sun Jun  3 13:18:24 2007
@@ -26,7 +26,7 @@
 import org.hibernate.criterion.Order;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.pojos.AutoPing;
 import org.apache.roller.weblogger.pojos.PingQueueEntry;
 import java.sql.Timestamp;
@@ -48,29 +48,30 @@
     private HibernatePersistenceStrategy strategy = null;
     
     
+    @com.google.inject.Inject    
     public HibernatePingQueueManagerImpl(HibernatePersistenceStrategy strat) {
         this.strategy = strat;
     }
     
     
-    public PingQueueEntry getQueueEntry(String id) throws RollerException {
+    public PingQueueEntry getQueueEntry(String id) throws WebloggerException {
         return (PingQueueEntry) strategy.load(id, PingQueueEntry.class);
     }
     
     
-    public void saveQueueEntry(PingQueueEntry pingQueueEntry) throws RollerException {
+    public void saveQueueEntry(PingQueueEntry pingQueueEntry) throws WebloggerException {
         log.debug("Storing ping queue entry: " + pingQueueEntry);
         strategy.store(pingQueueEntry);
     }
     
     
-    public void removeQueueEntry(PingQueueEntry pingQueueEntry) throws RollerException {
+    public void removeQueueEntry(PingQueueEntry pingQueueEntry) throws WebloggerException {
         log.debug("Removing ping queue entry: " + pingQueueEntry);
         strategy.remove(pingQueueEntry);
     }
     
     
-    public void addQueueEntry(AutoPing autoPing) throws RollerException {
+    public void addQueueEntry(AutoPing autoPing) throws WebloggerException {
         log.debug("Creating new ping queue entry for auto ping configuration: " + autoPing);
         
         // First check if there is an existing ping queue entry for the same target and website
@@ -86,7 +87,7 @@
     }
     
     
-    public List getAllQueueEntries() throws RollerException {
+    public List getAllQueueEntries() throws WebloggerException {
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingQueueEntry.class);
@@ -94,13 +95,13 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException("ERROR retrieving queue entries.", e);
+            throw new WebloggerException("ERROR retrieving queue entries.", e);
         }
     }
     
     
     // private helper to determine if an has already been queued for the same website and ping target.
-    private boolean isAlreadyQueued(AutoPing autoPing) throws RollerException {
+    private boolean isAlreadyQueued(AutoPing autoPing) throws WebloggerException {
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingQueueEntry.class);
@@ -108,7 +109,7 @@
             criteria.add(Expression.eq("website", autoPing.getWebsite()));
             return !criteria.list().isEmpty();
         } catch (HibernateException e) {
-            throw new RollerException("ERROR determining if preexisting queue entry is present.",e);
+            throw new WebloggerException("ERROR determining if preexisting queue entry is present.",e);
         }
     }
     

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingTargetManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingTargetManagerImpl.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingTargetManagerImpl.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePingTargetManagerImpl.java Sun Jun  3 13:18:24 2007
@@ -27,7 +27,7 @@
 import org.hibernate.Session;
 import org.hibernate.criterion.Expression;
 import org.hibernate.criterion.Order;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.pojos.PingTarget;
 import org.apache.roller.weblogger.pojos.Weblog;
 import java.util.Iterator;
@@ -35,9 +35,9 @@
 import java.util.Collection;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.roller.weblogger.business.Roller;
 import org.apache.roller.weblogger.business.pings.AutoPingManager;
 import org.apache.roller.weblogger.business.pings.PingTargetManager;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.pojos.AutoPing;
 import org.apache.roller.weblogger.pojos.PingQueueEntry;
 
@@ -54,14 +54,17 @@
     private static Log log = LogFactory.getLog(HibernatePingTargetManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     
-    public HibernatePingTargetManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject    
+    public HibernatePingTargetManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
+        this.roller = roller;
         this.strategy = strat;
     }
     
     
-    public void removePingTarget(PingTarget pingTarget) throws RollerException {
+    public void removePingTarget(PingTarget pingTarget) throws WebloggerException {
         // remove contents and then target
         this.removePingTargetContents(pingTarget);
         this.strategy.remove(pingTarget);
@@ -73,7 +76,7 @@
      * reference the given ping target.
      */
     private void removePingTargetContents(PingTarget ping) 
-            throws RollerException {
+            throws WebloggerException {
         
         Session session = this.strategy.getSession();
         
@@ -87,7 +90,7 @@
         }
         
         // Remove the website's auto ping configurations
-        AutoPingManager autoPingMgr = RollerFactory.getRoller().getAutopingManager();
+        AutoPingManager autoPingMgr = roller.getAutopingManager();
         List autopings = autoPingMgr.getAutoPingsByTarget(ping);
         Iterator it = autopings.iterator();
         while(it.hasNext()) {
@@ -99,7 +102,7 @@
     /**
      * @see org.apache.roller.weblogger.model.PingTargetManager#removeAllCustomPingTargets()
      */
-    public void removeAllCustomPingTargets() throws RollerException {
+    public void removeAllCustomPingTargets() throws WebloggerException {
         
         try {
             Session session = strategy.getSession();
@@ -108,13 +111,13 @@
             List allCustomTargets = criteria.list();
             removeTargets(allCustomTargets);
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
     
     // Private helper to remove a collection of targets.
-    private void removeTargets(Collection customTargets) throws RollerException {
+    private void removeTargets(Collection customTargets) throws WebloggerException {
         
         // just go through the list and remove each auto ping
         Iterator targets = customTargets.iterator();
@@ -124,17 +127,17 @@
     }
     
     
-    public void savePingTarget(PingTarget pingTarget) throws RollerException {
+    public void savePingTarget(PingTarget pingTarget) throws WebloggerException {
         strategy.store(pingTarget);
     }
     
     
-    public PingTarget getPingTarget(String id) throws RollerException {
+    public PingTarget getPingTarget(String id) throws WebloggerException {
         return (PingTarget) strategy.load(id, PingTarget.class);
     }
 
     
-    public boolean isNameUnique(PingTarget pingTarget) throws RollerException {
+    public boolean isNameUnique(PingTarget pingTarget) throws WebloggerException {
         String name = pingTarget.getName();
         if (name == null || name.trim().length() == 0) return false;
         
@@ -163,7 +166,7 @@
     }
     
     
-    public boolean isUrlWellFormed(PingTarget pingTarget) throws RollerException {
+    public boolean isUrlWellFormed(PingTarget pingTarget) throws WebloggerException {
         String url = pingTarget.getPingUrl();
         if (url == null || url.trim().length() == 0) return false;
         try {
@@ -178,7 +181,7 @@
     }
     
     
-    public boolean isHostnameKnown(PingTarget pingTarget) throws RollerException {
+    public boolean isHostnameKnown(PingTarget pingTarget) throws WebloggerException {
         String url = pingTarget.getPingUrl();
         if (url == null || url.trim().length() == 0) return false;
         try {
@@ -198,7 +201,7 @@
     /**
      * @see org.apache.roller.weblogger.model.PingTargetManager#getCommonPingTargets()
      */
-    public List getCommonPingTargets() throws RollerException {
+    public List getCommonPingTargets() throws WebloggerException {
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingTarget.class);
@@ -206,7 +209,7 @@
             criteria.addOrder(Order.asc("name"));
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
         
     }
@@ -215,7 +218,7 @@
     /**
      * @see org.apache.roller.weblogger.model.PingTargetManager#getCustomPingTargets(org.apache.roller.weblogger.pojos.WebsiteData)
      */
-    public List getCustomPingTargets(Weblog website) throws RollerException {
+    public List getCustomPingTargets(Weblog website) throws WebloggerException {
         try {
             Session session = ((HibernatePersistenceStrategy) strategy).getSession();
             Criteria criteria = session.createCriteria(PingTarget.class);
@@ -223,7 +226,7 @@
             criteria.addOrder(Order.asc("name"));
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePropertiesManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePropertiesManagerImpl.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePropertiesManagerImpl.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernatePropertiesManagerImpl.java Sun Jun  3 13:18:24 2007
@@ -27,7 +27,7 @@
 import org.hibernate.Session;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.config.RollerRuntimeConfig;
 import org.apache.roller.weblogger.config.runtime.ConfigDef;
 import org.apache.roller.weblogger.config.runtime.DisplayGroup;
@@ -35,13 +35,12 @@
 import org.apache.roller.weblogger.config.runtime.RuntimeConfigDefs;
 import org.apache.roller.weblogger.business.PropertiesManager;
 import org.apache.roller.weblogger.business.Roller;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.pojos.RuntimeConfigProperty;
 
 
 /**
  * Hibernate implementation of the PropertiesManager.
- */
+ */ 
 public class HibernatePropertiesManagerImpl implements PropertiesManager {
     
     public static final long serialVersionUID = -4326713177137796936L;
@@ -49,15 +48,17 @@
     private static Log log = LogFactory.getLog(HibernatePropertiesManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     
     /** 
      * Creates a new instance of HibernatePropertiesManagerImpl
      */
-    public HibernatePropertiesManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject
+    public HibernatePropertiesManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
         
         log.debug("Instantiating Hibernate Properties Manager");
-        
+        this.roller = roller;        
         this.strategy = strat;
         
         // TODO: and new method initialize(props)
@@ -68,11 +69,11 @@
     /** 
      * Retrieve a single property by name.
      */
-    public RuntimeConfigProperty getProperty(String name) throws RollerException {
+    public RuntimeConfigProperty getProperty(String name) throws WebloggerException {
         try {
             return (RuntimeConfigProperty) strategy.load(name, RuntimeConfigProperty.class);
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
@@ -85,7 +86,7 @@
      * uses the property name as the key and the RuntimeConfigProperty object
      * as the value.
      */
-    public Map getProperties() throws RollerException {
+    public Map getProperties() throws WebloggerException {
         
         HashMap props = new HashMap();
         
@@ -107,7 +108,7 @@
                 props.put(prop.getName(), prop);
             }
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
         
         return props;
@@ -117,7 +118,7 @@
     /**
      * Save a single property.
      */
-    public void saveProperty(RuntimeConfigProperty property) throws RollerException {
+    public void saveProperty(RuntimeConfigProperty property) throws WebloggerException {
         
         this.strategy.store(property);
     }
@@ -126,7 +127,7 @@
     /**
      * Save all properties.
      */
-    public void saveProperties(Map properties) throws RollerException {
+    public void saveProperties(Map properties) throws WebloggerException {
         
         // just go through the list and saveProperties each property
         Iterator props = properties.values().iterator();

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRefererManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRefererManagerImpl.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRefererManagerImpl.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRefererManagerImpl.java Sun Jun  3 13:18:24 2007
@@ -35,7 +35,7 @@
 import org.hibernate.criterion.Junction;
 import org.hibernate.criterion.Order;
 import org.hibernate.type.Type;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.config.RollerRuntimeConfig;
 import org.apache.roller.weblogger.business.referrers.RefererManager;
 import org.apache.roller.weblogger.pojos.WeblogReferrer;
@@ -46,7 +46,6 @@
 import org.hibernate.engine.SessionFactoryImplementor;
 import org.hibernate.dialect.Dialect;
 import org.apache.roller.weblogger.business.Roller;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogManager;
 import org.apache.roller.weblogger.pojos.StatCount;
@@ -68,21 +67,25 @@
     protected static final String TOTALHITS = "totalHits";
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
+
     private Date mRefDate = new Date();
     
         
-    public HibernateRefererManagerImpl(HibernatePersistenceStrategy strat) {
+    @com.google.inject.Inject    
+    public HibernateRefererManagerImpl(Roller roller, HibernatePersistenceStrategy strat) {
         
         log.debug("Instantiating Hibernate Referer Manager");
         
-        strategy = strat;
+        this.strategy = strat;
+        this.roller = roller;
     }
     
-    public void saveReferer(WeblogReferrer referer) throws RollerException {
+    public void saveReferer(WeblogReferrer referer) throws WebloggerException {
         strategy.store(referer);
     }
         
-    public void removeReferer(WeblogReferrer referer) throws RollerException {
+    public void removeReferer(WeblogReferrer referer) throws WebloggerException {
         strategy.remove(referer);
     }
         
@@ -91,7 +94,7 @@
      *
      * TODO: do we really need dialect specific queries?
      */
-    public void clearReferrers() throws RollerException {
+    public void clearReferrers() throws WebloggerException {
         
         if (log.isDebugEnabled()) {
             log.debug("clearReferrers");
@@ -121,7 +124,7 @@
      *
      * TODO: do we really need dialect specific queries?
      */
-    public void clearReferrers(Weblog website) throws RollerException {
+    public void clearReferrers(Weblog website) throws WebloggerException {
         
         if (log.isDebugEnabled()) {
             log.debug("clearReferrers");
@@ -148,7 +151,7 @@
     /**
      * Apply ignoreWord/spam filters to all referers in system.
      */
-    public void applyRefererFilters() throws RollerException {
+    public void applyRefererFilters() throws WebloggerException {
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -174,16 +177,16 @@
             }
 
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
         
     /**
      * Apply ignoreWord/spam filters to all referers in website.
      */
-    public void applyRefererFilters(Weblog website) throws RollerException {
+    public void applyRefererFilters(Weblog website) throws WebloggerException {
         
-        if (null == website) throw new RollerException("website is null");
+        if (null == website) throw new WebloggerException("website is null");
         if (null == website.getBlacklist()) return;
         
         try {
@@ -207,7 +210,7 @@
             }
             
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }   
     
@@ -215,7 +218,7 @@
      * Use Hibernate directly because Roller's Query API does too much allocation.
      */
     protected List getExistingReferers(Weblog website, String dateString,
-            String permalink) throws RollerException {
+            String permalink) throws WebloggerException {
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -227,7 +230,7 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
         
@@ -235,7 +238,7 @@
      * Use Hibernate directly because Roller's Query API does too much allocation.
      */
     protected List getMatchingReferers(Weblog website, String requestUrl,
-            String refererUrl) throws RollerException {
+            String refererUrl) throws WebloggerException {
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -247,7 +250,7 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
        
@@ -255,7 +258,7 @@
      * Returns hot weblogs as StatCount objects, in descending order by today's hits.
      */
     public List getHotWeblogs(int sinceDays, int offset, int length)
-        throws RollerException {
+        throws WebloggerException {
         // TODO: ATLAS getDaysPopularWebsites DONE TESTED
         String msg = "Getting hot weblogs";
         ArrayList result = new ArrayList();
@@ -303,7 +306,7 @@
             
         } catch (Throwable pe) {
             log.error(msg, pe);
-            throw new RollerException(msg, pe);
+            throw new WebloggerException(msg, pe);
         }
     }
     
@@ -311,7 +314,7 @@
     /**
      * Use raw SQL because Hibernate can't handle the query.
      */
-    protected int getHits(Weblog website, String type) throws RollerException {
+    protected int getHits(Weblog website, String type) throws WebloggerException {
         int hits = 0;
         if (log.isDebugEnabled()) {
             log.debug("getHits: " + website.getName());
@@ -334,7 +337,7 @@
             q.setParameters(args, types);
             results = q.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
         Object[] resultsArray = (Object[]) results.get(0);
         
@@ -356,9 +359,9 @@
     /**
      * @see org.apache.roller.weblogger.pojos.RefererManager#getReferers(java.lang.String)
      */
-    public List getReferers(Weblog website) throws RollerException {
+    public List getReferers(Weblog website) throws WebloggerException {
         if (website==null )
-            throw new RollerException("website is null");
+            throw new WebloggerException("website is null");
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -368,16 +371,16 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
         
     /**
      * @see org.apache.roller.weblogger.pojos.RefererManager#getTodaysReferers(String)
      */
-    public List getTodaysReferers(Weblog website) throws RollerException {
+    public List getTodaysReferers(Weblog website) throws WebloggerException {
         if (website==null )
-            throw new RollerException("website is null");
+            throw new WebloggerException("website is null");
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -388,7 +391,7 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
        
@@ -399,12 +402,12 @@
      * org.apache.roller.weblogger.pojos.WebsiteData, java.lang.String)
      */
     public List getReferersToDate(Weblog website, String date)
-            throws RollerException {
+            throws WebloggerException {
         if (website==null )
-            throw new RollerException("website is null");
+            throw new WebloggerException("website is null");
         
         if (date==null )
-            throw new RollerException("Date is null");
+            throw new WebloggerException("Date is null");
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -416,7 +419,7 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
         
@@ -424,9 +427,9 @@
      * @see org.apache.roller.weblogger.pojos.RefererManager#getReferersToEntry(
      * java.lang.String, java.lang.String)
      */
-    public List getReferersToEntry(String entryid) throws RollerException {
+    public List getReferersToEntry(String entryid) throws WebloggerException {
         if (null == entryid)
-            throw new RollerException("entryid is null");
+            throw new WebloggerException("entryid is null");
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -441,7 +444,7 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
         
@@ -449,7 +452,7 @@
      * Query for collection of referers.
      */
     protected List getReferersToWebsite(Weblog website, String refererUrl)
-            throws RollerException {
+            throws WebloggerException {
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -459,7 +462,7 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
         
@@ -470,7 +473,7 @@
                                             String requestUrl,
                                             String title,
                                             String excerpt)
-            throws RollerException {
+            throws WebloggerException {
         
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -489,22 +492,22 @@
             
             return criteria.list();
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
         
-    public int getDayHits(Weblog website) throws RollerException {
+    public int getDayHits(Weblog website) throws WebloggerException {
         return getHits(website, DAYHITS);
     }
         
-    public int getTotalHits(Weblog website) throws RollerException {
+    public int getTotalHits(Weblog website) throws WebloggerException {
         return getHits(website, TOTALHITS);
     }
         
     /**
      * @see org.apache.roller.weblogger.pojos.RefererManager#retrieveReferer(java.lang.String)
      */
-    public WeblogReferrer getReferer(String id) throws RollerException {
+    public WeblogReferrer getReferer(String id) throws WebloggerException {
         return (WeblogReferrer)strategy.load(id,WeblogReferrer.class);
     }
     
@@ -527,16 +530,16 @@
         
         // lookup the weblog now
         try {
-            UserManager userMgr = RollerFactory.getRoller().getUserManager();
+            UserManager userMgr = roller.getUserManager();
             weblog = userMgr.getWebsiteByHandle(weblogHandle);
             if (weblog == null) return;
             
             // now lookup weblog entry if possible
             if (entryAnchor != null) {
-                WeblogManager weblogMgr = RollerFactory.getRoller().getWeblogManager();
+                WeblogManager weblogMgr = roller.getWeblogManager();
                 entry = weblogMgr.getWeblogEntryByAnchor(weblog, entryAnchor);
             }
-        } catch (RollerException re) {
+        } catch (WebloggerException re) {
             // problem looking up website, gotta bail
             log.error("Error looking up website object", re);
             return;
@@ -629,8 +632,7 @@
                     // Launch thread to extract referer linkback
                     
                     try {
-                        Roller mRoller = RollerFactory.getRoller();
-                        mRoller.getThreadManager().executeInBackground(
+                        roller.getThreadManager().executeInBackground(
                                 new LinkbackExtractorRunnable(ref));
                     } catch (InterruptedException e) {
                         log.warn("Interrupted during linkback extraction",e);
@@ -639,7 +641,7 @@
                     saveReferer(ref);
                 }
             }
-        } catch (RollerException pe) {
+        } catch (WebloggerException pe) {
             log.error(pe);
         } catch (NullPointerException npe) {
             log.error(npe);

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateRollerImpl.java Sun Jun  3 13:18:24 2007
@@ -20,7 +20,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.RollerImpl;
 import org.apache.roller.weblogger.business.BookmarkManager;
 import org.apache.roller.weblogger.business.FileManager;
@@ -30,6 +30,7 @@
 import org.apache.roller.weblogger.business.pings.PingTargetManager;
 import org.apache.roller.weblogger.business.PropertiesManager;
 import org.apache.roller.weblogger.business.referrers.RefererManager;
+import org.apache.roller.weblogger.business.referrers.ReferrerQueueManager;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogManager;
 import org.apache.roller.weblogger.business.runnable.ThreadManager;
@@ -41,7 +42,6 @@
  * A Hibernate specific implementation of the Roller business layer.
  */
 public class HibernateRollerImpl extends RollerImpl {    
-    static final long serialVersionUID = 5256135928578074652L;
     private static Log mLogger = LogFactory.getLog(HibernateRollerImpl.class);    
     
     // a persistence utility class
@@ -50,19 +50,20 @@
     @com.google.inject.Inject
     public HibernateRollerImpl(
         HibernatePersistenceStrategy strategy,
-        AutoPingManager   autoPingManager,
-        BookmarkManager   bookmarkManager,
-        FileManager       fileManager,
-        IndexManager      indexManager,
-        PingQueueManager  pingQueueManager,
-        PingTargetManager pingTargetManager,
-        PluginManager     pluginManager,
-        PropertiesManager propertiesManager,
-        RefererManager    refererManager,
-        ThemeManager      themeManager,
-        ThreadManager     threadManager,
-        UserManager       userManager,
-        WeblogManager     weblogManager) throws RollerException {
+        AutoPingManager      autoPingManager,
+        BookmarkManager      bookmarkManager,
+        FileManager          fileManager,
+        IndexManager         indexManager,
+        PingQueueManager     pingQueueManager,
+        PingTargetManager    pingTargetManager,
+        PluginManager        pluginManager,
+        PropertiesManager    propertiesManager,
+        RefererManager       refererManager,
+        ReferrerQueueManager refererQueueManager,
+        ThemeManager         themeManager,
+        ThreadManager        threadManager,
+        UserManager          userManager,
+        WeblogManager        weblogManager) throws WebloggerException {
         
         super(
             autoPingManager,
@@ -74,6 +75,7 @@
             pluginManager,
             propertiesManager,
             refererManager,
+            refererQueueManager,
             themeManager,
             threadManager,
             userManager,
@@ -81,7 +83,7 @@
         this.strategy = strategy;
     }
         
-    public void flush() throws RollerException {
+    public void flush() throws WebloggerException {
         this.strategy.flush();
     }    
 }

Modified: roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateThreadManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateThreadManagerImpl.java?view=diff&rev=543978&r1=543977&r2=543978
==============================================================================
--- roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateThreadManagerImpl.java (original)
+++ roller/branches/roller_guice/apps/weblogger/src/java/org/apache/roller/weblogger/business/hibernate/HibernateThreadManagerImpl.java Sun Jun  3 13:18:24 2007
@@ -21,10 +21,10 @@
 import java.util.Date;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
+import org.apache.roller.weblogger.WebloggerException;
+import org.apache.roller.weblogger.business.Roller;
 import org.apache.roller.weblogger.business.runnable.ThreadManagerImpl;
 import org.apache.roller.weblogger.business.runnable.RollerTask;
-import org.apache.roller.weblogger.business.RollerFactory;
 import org.apache.roller.weblogger.pojos.TaskLock;
 import org.hibernate.Criteria;
 import org.hibernate.HibernateException;
@@ -44,13 +44,15 @@
     private static Log log = LogFactory.getLog(HibernateThreadManagerImpl.class);
     
     private HibernatePersistenceStrategy strategy = null;
+    private Roller roller;
     
     
+    @com.google.inject.Inject    
     public HibernateThreadManagerImpl(HibernatePersistenceStrategy strat) {
         super();
         
         log.debug("Instantiating Hibernate Thread Manager");
-        
+        this.roller = roller;        
         this.strategy = strat;
     }
     
@@ -75,10 +77,10 @@
                 
                 // save it and flush
                 this.saveTaskLock(taskLock);
-                RollerFactory.getRoller().flush();
+                roller.flush();
             }
             
-        } catch (RollerException ex) {
+        } catch (WebloggerException ex) {
             log.warn("Error getting or inserting TaskLock", ex);
             return false;
         }
@@ -105,7 +107,7 @@
             int result = query.executeUpdate();
             
             // this may not be needed
-            RollerFactory.getRoller().flush();
+            roller.flush();
             
             if(result == 1) {
                 return true;
@@ -134,7 +136,7 @@
                 return false;
             }
             
-        } catch (RollerException ex) {
+        } catch (WebloggerException ex) {
             log.warn("Error getting TaskLock", ex);
             return false;
         }
@@ -151,7 +153,7 @@
             int result = query.executeUpdate();
             
             // this may not be needed
-            RollerFactory.getRoller().flush();
+            roller.flush();
             
             if(result == 1) {
                 return true;
@@ -166,7 +168,7 @@
     }
     
     
-    private TaskLock getTaskLockByName(String name) throws RollerException {
+    private TaskLock getTaskLockByName(String name) throws WebloggerException {
         
         // do lookup
         try {
@@ -178,12 +180,12 @@
             
             return taskLock;
         } catch (HibernateException e) {
-            throw new RollerException(e);
+            throw new WebloggerException(e);
         }
     }
     
     
-    private void saveTaskLock(TaskLock data) throws RollerException {
+    private void saveTaskLock(TaskLock data) throws WebloggerException {
         this.strategy.store(data);
     }
     



Mime
View raw message