roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c..@apache.org
Subject svn commit: r440982 - in /incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business: datamapper/ jdo/
Date Thu, 07 Sep 2006 05:41:35 GMT
Author: clr
Date: Wed Sep  6 22:41:34 2006
New Revision: 440982

URL: http://svn.apache.org/viewvc?view=rev&rev=440982
Log:
Datamapper updates

Added:
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRemoveQuery.java
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDORemoveQueryImpl.java
Modified:
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPersistenceStrategy.java
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPingTargetManagerImpl.java
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperQuery.java
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperUserManagerImpl.java
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOPersistenceStrategy.java
    incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOQueryImpl.java

Modified: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java?view=diff&rev=440982&r1=440981&r2=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java
(original)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperAutoPingManagerImpl.java
Wed Sep  6 22:41:34 2006
@@ -63,7 +63,7 @@
 
     public void removeAutoPing(PingTargetData pingTarget, WebsiteData website) 
             throws RollerException {
-        strategy.newQuery(AutoPingData.class, "getByPingTarget&Website")
+        strategy.newRemoveQuery(AutoPingData.class, "getByPingTarget&Website")
                 .removeAll(new Object[]{pingTarget, website});
     }
 

Modified: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPersistenceStrategy.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPersistenceStrategy.java?view=diff&rev=440982&r1=440981&r2=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPersistenceStrategy.java
(original)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPersistenceStrategy.java
Wed Sep  6 22:41:34 2006
@@ -103,4 +103,13 @@
     public DatamapperQuery newQuery(Class clazz, String queryName)
             throws RollerException;
 
+    /**
+     * Create query used for bulk remove operations.
+     * @param clazz the class of instances to remove
+     * @param queryName the name of the query
+     * @throws org.apache.roller.RollerException on any error
+     */
+    public DatamapperRemoveQuery newRemoveQuery(Class clazz, String queryName)
+            throws RollerException;
+
 }

Modified: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPingTargetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPingTargetManagerImpl.java?view=diff&rev=440982&r1=440981&r2=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPingTargetManagerImpl.java
(original)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPingTargetManagerImpl.java
Wed Sep  6 22:41:34 2006
@@ -58,16 +58,16 @@
     public void removePingTarget(PingTargetData pingTarget)
             throws RollerException {
         // remove queued ping entries that refer to this ping target
-        strategy.newQuery(PingQueueEntryData.class, "getByPingTarget")
+        strategy.newRemoveQuery(PingQueueEntryData.class, "getByPingTarget")
             .removeAll(pingTarget);
         // remove autopings that refer to this ping target
-        strategy.newQuery(AutoPingData.class, "getByPingTarget")
+        strategy.newRemoveQuery(AutoPingData.class, "getByPingTarget")
             .removeAll(pingTarget);
     }
 
     public void removeAllCustomPingTargets()
             throws RollerException {
-        strategy.newQuery(PingTargetData.class, "getByWebsiteNotNull")
+        strategy.newRemoveQuery(PingTargetData.class, "getByWebsiteNotNull")
             .removeAll();
     }
 

Modified: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java?view=diff&rev=440982&r1=440981&r2=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java
(original)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperPlanetManagerImpl.java
Wed Sep  6 22:41:34 2006
@@ -32,9 +32,8 @@
 import org.apache.velocity.VelocityContext;
 import org.apache.roller.RollerException;
 import org.apache.roller.config.RollerRuntimeConfig;
-import org.apache.roller.model.PagePluginManager;
 import org.apache.roller.model.PlanetManager;
-import org.apache.roller.model.Roller;
+import org.apache.roller.model.RollerFactory;
 import org.apache.roller.model.UserManager;
 import org.apache.roller.model.WeblogManager;
 import org.apache.roller.pojos.PlanetConfigData;
@@ -92,7 +91,7 @@
 
     public void saveSubscription(PlanetSubscriptionData sub)
             throws RollerException {
-        PlanetSubscriptionData existing = getSubscription(sub.getFeedUrl());
+        PlanetSubscriptionData existing = getSubscription(sub.getFeedURL());
         if (existing == null || (existing.getId().equals(sub.getId()))) {
             strategy.store(sub);
         }
@@ -137,17 +136,40 @@
     public PlanetGroupData getGroupById(String id) throws RollerException {
         return (PlanetGroupData) strategy.load(PlanetGroupData.class, id);
     }
-
-    public synchronized List getAggregation(int maxEntries)
-            throws RollerException {
-        return getAggregation(null, maxEntries);
+    /**
+     * Get agggration for group from cache, enries in reverse chonological order.
+     * Respects category constraints of group.
+     * @param group Restrict to entries from one subscription group.
+     * @param offset    Offset into results (for paging)
+     * @param len       Maximum number of results to return (for paging)
+     */
+    public List getAggregation(
+            PlanetGroupData group, Date startDate, Date endDate,
+            int offset, int len) throws RollerException {
+        return null;
     }
-
-    public synchronized List getAggregation(PlanetGroupData group,
-            int maxEntries) throws RollerException {
+    
+    public List getAggregation(
+            int offset, int len) throws RollerException {
         return null;
     }
-
+    
+    public List getAggregation(
+            PlanetGroupData group, int offset, int len) throws RollerException {
+        return null;
+    }
+    
+    /**
+     * Get agggration from cache, enries in reverse chonological order.
+     * @param offset    Offset into results (for paging)
+     * @param len       Maximum number of results to return (for paging)
+     */
+    public List getAggregation(Date startDate, Date endDate,
+            int offset, int len) throws RollerException {
+        return null;
+    }
+    
+    
     public void deleteEntry(PlanetEntryData entry) throws RollerException {
         strategy.remove(entry);
     }
@@ -174,11 +196,34 @@
         return null;
     }
 
+    /**
+     * Get top X subscriptions.
+     */
+    public List getTopSubscriptions(int offset, int len) throws RollerException {
+        return null;
+    }
+    
     public synchronized List getTopSubscriptions(PlanetGroupData group, int max)
             throws RollerException {
         return null;
     }
 
+    /**
+     * Get top X subscriptions, restricted by group.
+     */
+    public List getTopSubscriptions(
+            String groupHandle, int offset, int len) throws RollerException {
+        return null;
+    }
+    
+    /**
+     * Get entries in a single feed as list of PlanetEntryData objects.
+     */
+    public List getFeedEntries(
+            String feedUrl, int offset, int len) throws RollerException {
+        return null;
+    }
+
     public synchronized void clearCachedAggregations() {
         lastUpdatedByGroup.clear();
     }
@@ -199,9 +244,9 @@
         try {
             // for local feeds, sub.author = website.handle
             if (sub.getAuthor() != null
-                    && sub.getFeedUrl().endsWith(sub.getAuthor())) {
+                    && sub.getFeedURL().endsWith(sub.getAuthor())) {
 
-                logger.debug("Getting LOCAL feed " + sub.getFeedUrl());
+                logger.debug("Getting LOCAL feed " + sub.getFeedURL());
 
                 // get corresponding website object
                 WebsiteData website = (WebsiteData)strategy.newQuery(
@@ -211,7 +256,7 @@
                     return newEntries;
 
                 // figure website last update time
-                WeblogManager blogmgr = roller.getWeblogManager();
+                WeblogManager blogmgr = RollerFactory.getRoller().getWeblogManager();
 
                 Date siteUpdated = blogmgr.getWeblogLastPublishTime(website);
                 if (siteUpdated == null) { // Site never updated, skip it
@@ -244,26 +289,7 @@
                         logger.debug(msg);
                     }
                 }
-                // Populate subscription object with new entries
-                PagePluginManager ppmgr = roller.getPagePluginManager();
-                Map pagePlugins = ppmgr.createAndInitPagePlugins(website, null,
-                        RollerRuntimeConfig.getProperty("site.absoluteurl"),
-                        new VelocityContext());
-                Iterator entryIter = entries.iterator();
-                while (entryIter.hasNext()) {
-                    try {
-                        WeblogEntryData rollerEntry = (WeblogEntryData) entryIter
-                                .next();
-                        PlanetEntryData entry = new PlanetEntryData(
-                                rollerEntry, sub, pagePlugins);
-                        saveEntry(entry);
-                        newEntries.add(entry);
-                    }
-                    catch (Exception e) {
-                        logger.error("ERROR processing subscription entry", e);
-                    }
-                }
-                return newEntries;
+                return null;
             }
         }
         catch (Exception e) {

Modified: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperQuery.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperQuery.java?view=diff&rev=440982&r1=440981&r2=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperQuery.java
(original)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperQuery.java
Wed Sep  6 22:41:34 2006
@@ -40,23 +40,6 @@
      */
     Object execute(Object[] params);
 
-    /** Remove instances selected by the query with no parameters.
-     * @return the results of the query
-     */
-    void removeAll();
-
-    /** Remove instances selected by the query with one parameter.
-     * @param param the parameter
-     * @return the results of the query
-     */
-    void removeAll(Object param);
-
-    /** Remove instances selected by the query with parameters.
-     * @param params the parameters
-     * @return the results of the query
-     */
-    void removeAll(Object[] params);
-
     /** Set the result to be a single instance (not a List).
      * @result the instance on which this method is called
      */

Added: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRemoveQuery.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRemoveQuery.java?view=auto&rev=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRemoveQuery.java
(added)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperRemoveQuery.java
Wed Sep  6 22:41:34 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.roller.business.datamapper;
+
+import java.util.List;
+
+/**
+ *
+ */
+public interface DatamapperRemoveQuery {
+
+    /** Remove instances selected by the query with no parameters.
+     * @return the results of the query
+     */
+    void removeAll();
+
+    /** Remove instances selected by the query with one parameter.
+     * @param param the parameter
+     * @return the results of the query
+     */
+    void removeAll(Object param);
+
+    /** Remove instances selected by the query with parameters.
+     * @param params the parameters
+     * @return the results of the query
+     */
+    void removeAll(Object[] params);
+
+    /** Set the result to be a single instance (not a List).
+     * @result the instance on which this method is called
+     */
+    DatamapperRemoveQuery setUnique();
+
+    /** Set the types of the parameters. This is only needed if the 
+     * parameter types are temporal types, e.g. Date, Time, Calendar.
+     * @param the types of the parameters in corresponding positions.
+     * @result the instance on which this method is called
+     */
+    DatamapperRemoveQuery setTypes(Object[] types);
+
+}

Modified: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperUserManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperUserManagerImpl.java?view=diff&rev=440982&r1=440981&r2=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperUserManagerImpl.java
(original)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/datamapper/DatamapperUserManagerImpl.java
Wed Sep  6 22:41:34 2006
@@ -17,6 +17,7 @@
 package org.apache.roller.business.datamapper;
 
 import java.util.Collection;
+import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
 import org.apache.commons.logging.Log;
@@ -296,6 +297,46 @@
             .execute(new Object[]{user, enabled, active});
     }
 
+    /**
+     * Get websites optionally restricted by user, enabled and active status.
+     * @param user    Get all websites for this user (or null for all)
+     * @param offset  Offset into results (for paging)
+     * @param len     Maximum number of results to return (for paging)
+     * @param enabled Get all with this enabled state (or null or all)
+     * @param active  Get all with this active state (or null or all)
+     * @param startDate Restrict to those created after (or null for all)
+     * @param endDate Restrict to those created before (or null for all)
+     * @returns List of WebsiteData objects.
+     */
+    public List getWebsites(
+            UserData user, 
+            Boolean  enabled, 
+            Boolean  active, 
+            Date     startDate, 
+            Date     endDate, 
+            int      offset, 
+            int      length) 
+            throws RollerException {
+        return null;
+    }
+    
+    /**
+     * Get websites ordered by descending number of comments.
+     * @param startDate Restrict to those created after (or null for all)
+     * @param endDate Restrict to those created before (or null for all)
+     * @param offset    Offset into results (for paging)
+     * @param len       Maximum number of results to return (for paging)
+     * @returns List of WebsiteData objects.
+     */
+    public List getMostCommentedWebsites(
+            Date startDate, 
+            Date endDate, 
+            int  offset, 
+            int  length) 
+            throws RollerException {
+        return null;
+    }
+    
     public void savePermissions(PermissionsData perms) 
             throws RollerException {
         strategy.store(perms);

Modified: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOPersistenceStrategy.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOPersistenceStrategy.java?view=diff&rev=440982&r1=440981&r2=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOPersistenceStrategy.java
(original)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOPersistenceStrategy.java
Wed Sep  6 22:41:34 2006
@@ -27,6 +27,7 @@
 import org.apache.roller.RollerException;
 import org.apache.roller.business.datamapper.DatamapperPersistenceStrategy;
 import org.apache.roller.business.datamapper.DatamapperQuery;
+import org.apache.roller.business.datamapper.DatamapperRemoveQuery;
 import org.apache.roller.pojos.PersistentObject;
 import org.apache.roller.pojos.UserData;
 
@@ -302,5 +303,18 @@
         PersistenceManager pm = getPersistenceManager(false, false);
         return new JDOQueryImpl(pm, clazz, queryName);
     }
+
+    /**
+     * Create query used for bulk remove operations.
+     * @param clazz the class of instances to remove
+     * @param queryName the name of the query
+     * @throws org.apache.roller.RollerException on any error
+     */
+    public DatamapperRemoveQuery newRemoveQuery(Class clazz, String queryName)
+            throws RollerException {
+        PersistenceManager pm = getPersistenceManager(false, false);
+        return new JDORemoveQueryImpl(pm, clazz, queryName);
+    }
+
 }
 

Modified: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOQueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOQueryImpl.java?view=diff&rev=440982&r1=440981&r2=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOQueryImpl.java
(original)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDOQueryImpl.java
Wed Sep  6 22:41:34 2006
@@ -20,6 +20,7 @@
 import javax.jdo.Query;
 
 import org.apache.roller.business.datamapper.DatamapperQuery;
+import org.apache.roller.business.datamapper.DatamapperRemoveQuery;
 
 /**
  *
@@ -49,18 +50,6 @@
 
     public Object execute(Object[] params) {
         return q.execute(params);
-    }
-
-    public void removeAll() {
-        q.deletePersistentAll();
-    }
-
-    public void removeAll(Object param) {
-        q.deletePersistentAll(new Object[]{param});
-    }
-
-    public void removeAll(Object[] params) {
-        q.deletePersistentAll(params);
     }
 
     public DatamapperQuery setUnique() {

Added: incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDORemoveQueryImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDORemoveQueryImpl.java?view=auto&rev=440982
==============================================================================
--- incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDORemoveQueryImpl.java
(added)
+++ incubator/roller/branches/roller_3.0/sandbox/jdobackend/src/org/apache/roller/business/jdo/JDORemoveQueryImpl.java
Wed Sep  6 22:41:34 2006
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at 
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+
+package org.apache.roller.business.jdo;
+
+import javax.jdo.PersistenceManager;
+import javax.jdo.Query;
+
+import org.apache.roller.business.datamapper.DatamapperRemoveQuery;
+
+/**
+ *
+ */
+public class JDORemoveQueryImpl implements DatamapperRemoveQuery {
+
+    /** */
+    protected PersistenceManager pm;
+
+    /** */
+    protected Query q;
+    
+    /** Creates a new instance of JDOQueryImpl */
+    public JDORemoveQueryImpl(PersistenceManager pm,
+            Class clazz, String queryName) {
+        this.pm = pm;
+        q = pm.newQuery(clazz, queryName);
+    }
+
+    public void removeAll() {
+        q.deletePersistentAll();
+    }
+
+    public void removeAll(Object param) {
+        q.deletePersistentAll(new Object[]{param});
+    }
+
+    public void removeAll(Object[] params) {
+        q.deletePersistentAll(params);
+    }
+
+    public DatamapperRemoveQuery setUnique() {
+        q.setUnique(true);
+        return this;
+    }
+
+    public DatamapperRemoveQuery setTypes(Object[] types) {
+        return this;
+    }
+
+}
\ No newline at end of file



Mime
View raw message