Author: agilliland
Date: Wed Apr 19 12:22:08 2006
New Revision: 395361

URL: http://svn.apache.org/viewcvs?rev=395361&view=rev
Log:
manager method name refactorings for PingQueueManager.

storeXXX() -> saveXXX()
retrieveXXX() -> getXXX()
createXXX() -> addXXX() (or is removed)

plus:
removed method removeQueueEntriesByPingTarget()
removed method removeQueueEntriesByWebsite()
removed method dropQueue()


Modified:
    
incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java
    
incubator/roller/branches/roller-newbackend/src/org/roller/model/PingQueueManager.java
    
incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueProcessor.java

Modified: 
incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java?rev=395361&r1=395360&r2=395361&view=diff
==============================================================================
--- 
incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java
 (original)
+++ 
incubator/roller/branches/roller-newbackend/src/org/roller/business/hibernate/HibernatePingQueueManagerImpl.java
 Wed Apr 19 12:22:08 2006
@@ -18,12 +18,8 @@
 import org.roller.RollerException;
 import org.roller.pojos.AutoPingData;
 import org.roller.pojos.PingQueueEntryData;
-import org.roller.pojos.WebsiteData;
-import org.roller.pojos.PingTargetData;
 import java.sql.Timestamp;
-import java.util.Iterator;
 import java.util.List;
-import java.util.Collection;
 import org.roller.model.PingQueueManager;
 
 
@@ -44,12 +40,12 @@
     }
     
     
-    public PingQueueEntryData retrieveQueueEntry(String id) throws 
RollerException {
+    public PingQueueEntryData getQueueEntry(String id) throws RollerException {
         return (PingQueueEntryData) strategy.load(id, 
PingQueueEntryData.class);
     }
     
     
-    public void storeQueueEntry(PingQueueEntryData pingQueueEntry) throws 
RollerException {
+    public void saveQueueEntry(PingQueueEntryData pingQueueEntry) throws 
RollerException {
         log.debug("Storing ping queue entry: " + pingQueueEntry);
         strategy.store(pingQueueEntry);
     }
@@ -61,38 +57,6 @@
     }
     
     
-    public void removeQueueEntriesByPingTarget(PingTargetData pingTarget) 
throws RollerException {
-        
-        try {
-            log.debug("Removing all ping queue entries for ping target " + 
pingTarget);
-            
-            Session session = strategy.getSession();
-            Criteria criteria = 
session.createCriteria(PingQueueEntryData.class);
-            criteria.add(Expression.eq("pingTarget", pingTarget));
-            List queueEntries = criteria.list();
-            removeEntries(queueEntries);
-        } catch (HibernateException e) {
-            throw new RollerException("ERROR removing queue entries for ping 
target " + pingTarget, e);
-        }
-    }
-    
-    
-    public void removeQueueEntriesByWebsite(WebsiteData website) throws 
RollerException {
-        
-        try {
-            log.debug("Removing all ping queue entries for website " + 
website);
-            
-            Session session = ((HibernatePersistenceStrategy) 
strategy).getSession();
-            Criteria criteria = 
session.createCriteria(PingQueueEntryData.class);
-            criteria.add(Expression.eq("website", website));
-            List queueEntries = criteria.list();
-            removeEntries(queueEntries);
-        } catch (HibernateException e) {
-            throw new RollerException("ERROR removing queue entries for 
website " + website, e);
-        }
-    }
-    
-    
     public void addQueueEntry(AutoPingData autoPing) throws RollerException {
         log.debug("Creating new ping queue entry for auto ping configuration: 
" + autoPing);
         
@@ -105,14 +69,7 @@
         Timestamp now = new Timestamp(System.currentTimeMillis());
         PingQueueEntryData pingQueueEntry =
                 new PingQueueEntryData(null, now, autoPing.getPingTarget(), 
autoPing.getWebsite(), 0);
-        this.storeQueueEntry(pingQueueEntry);
-    }
-    
-    
-    public void dropQueue() throws RollerException {
-        log.info("NOTICE Dropping all ping queue entries.");
-        List queueEntries = getAllQueueEntries();
-        removeEntries(queueEntries);
+        this.saveQueueEntry(pingQueueEntry);
     }
     
     
@@ -139,17 +96,6 @@
             return !criteria.list().isEmpty();
         } catch (HibernateException e) {
             throw new RollerException("ERROR determining if preexisting queue 
entry is present.",e);
-        }
-    }
-    
-    
-    // Private helper to remove a collection of queue entries
-    private void removeEntries(Collection queueEntries) throws RollerException 
{
-        
-        // just go through the list and remove each auto ping
-        Iterator entries = queueEntries.iterator();
-        while (entries.hasNext()) {
-            this.strategy.remove((PingQueueEntryData) entries.next());
         }
     }
     

Modified: 
incubator/roller/branches/roller-newbackend/src/org/roller/model/PingQueueManager.java
URL: 
http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/model/PingQueueManager.java?rev=395361&r1=395360&r2=395361&view=diff
==============================================================================
--- 
incubator/roller/branches/roller-newbackend/src/org/roller/model/PingQueueManager.java
 (original)
+++ 
incubator/roller/branches/roller-newbackend/src/org/roller/model/PingQueueManager.java
 Wed Apr 19 12:22:08 2006
@@ -8,13 +8,10 @@
 
 package org.roller.model;
 
-import java.io.Serializable;
 import java.util.List;
 import org.roller.RollerException;
 import org.roller.pojos.AutoPingData;
 import org.roller.pojos.PingQueueEntryData;
-import org.roller.pojos.PingTargetData;
-import org.roller.pojos.WebsiteData;
 
 
 /**
@@ -22,7 +19,7 @@
  * processed by the <code>PingQueueProcesssor</code> and 
<code>PingQueueTask</code> components in the application
  * layer.
  */
-public interface PingQueueManager extends Serializable {
+public interface PingQueueManager {
     
     
     /**
@@ -40,7 +37,7 @@
      * @param pingQueueEntry update the given queue entry
      * @throws RollerException
      */
-    public void storeQueueEntry(PingQueueEntryData pingQueueEntry) throws 
RollerException;
+    public void saveQueueEntry(PingQueueEntryData pingQueueEntry) throws 
RollerException;
     
     
     /**
@@ -53,39 +50,13 @@
     
     
     /**
-     * Remove all of the queue entries that reference the given ping target.  
This is used when the ping target is being
-     * deleted (application-level cascading).
-     *
-     * @param pingTarget the ping target for which queue entries are to be 
removed
-     */
-    public void removeQueueEntriesByPingTarget(PingTargetData pingTarget) 
throws RollerException;
-    
-    
-    /**
-     * Remove all of the queue entries that reference the given website. This 
is used when the website is being deleted
-     * (application-level cascading).
-     *
-     * @param website the website for which queue entreis are to be removed
-     */
-    public void removeQueueEntriesByWebsite(WebsiteData website) throws 
RollerException;
-    
-    
-    /**
-     * Drop the queue.  Removes all elements from the queue.
-     *
-     * @throws RollerException
-     */
-    public void dropQueue() throws RollerException;
-    
-    
-    /**
      * Retrieve an entry from the queue.
      *
      * @param id the unique id of the entry.
      * @return the queue entry with the specified id.
      * @throws RollerException
      */
-    public PingQueueEntryData retrieveQueueEntry(String id) throws 
RollerException;
+    public PingQueueEntryData getQueueEntry(String id) throws RollerException;
     
     
     /**

Modified: 
incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueProcessor.java
URL: 
http://svn.apache.org/viewcvs/incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueProcessor.java?rev=395361&r1=395360&r2=395361&view=diff
==============================================================================
--- 
incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueProcessor.java
 (original)
+++ 
incubator/roller/branches/roller-newbackend/src/org/roller/presentation/pings/PingQueueProcessor.java
 Wed Apr 19 12:22:08 2006
@@ -172,7 +172,7 @@
             logger.warn("Error on ping attempt (" + 
pingQueueEntry.getAttempts() + ") for " + pingQueueEntry +
                 ": [" + ex.getMessage() + "]. Will re-queue for later 
attempts.");
             if (logger.isDebugEnabled()) logger.debug("Error on last ping 
attempt was: ", ex);
-            pingQueueMgr.storeQueueEntry(pingQueueEntry);
+            pingQueueMgr.saveQueueEntry(pingQueueEntry);
         }
         else
         {


Reply via email to