You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by sn...@apache.org on 2006/02/06 15:47:02 UTC

svn commit: r375290 - in /incubator/roller/trunk: src/org/roller/config/RollerConfig.java src/org/roller/presentation/planet/SyncWebsitesTask.java web/WEB-INF/classes/roller.properties

Author: snoopdave
Date: Mon Feb  6 06:47:01 2006
New Revision: 375290

URL: http://svn.apache.org/viewcvs?rev=375290&view=rev
Log:
Technorati limit is configurable (ROL-938)

Modified:
    incubator/roller/trunk/src/org/roller/config/RollerConfig.java
    incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java
    incubator/roller/trunk/web/WEB-INF/classes/roller.properties

Modified: incubator/roller/trunk/src/org/roller/config/RollerConfig.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/config/RollerConfig.java?rev=375290&r1=375289&r2=375290&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/config/RollerConfig.java (original)
+++ incubator/roller/trunk/src/org/roller/config/RollerConfig.java Mon Feb  6 06:47:01 2006
@@ -151,6 +151,26 @@
     }
 
     /**
+     * Retrieve a property as an int ... defaults to 0 if not present.
+     **/
+    public static int getIntProperty(String name) {
+        return getIntProperty(name, 0);
+    }
+
+    /**
+     * Retrieve a property as a int ... with specified default if not present.
+     */
+    public static int getIntProperty(String name, int defaultValue) {
+        // get the value first, then convert
+        String value = RollerConfig.getProperty(name);
+
+        if (value == null)
+            return defaultValue;
+
+        return (new Integer(value)).intValue();
+    }
+
+    /**
      * Retrieve all property keys
      *
      * @return Enumeration A list of all keys

Modified: incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java?rev=375290&r1=375289&r2=375290&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/planet/SyncWebsitesTask.java Mon Feb  6 06:47:01 2006
@@ -11,6 +11,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.roller.RollerException;
+import org.roller.config.RollerConfig;
 import org.roller.config.RollerRuntimeConfig;
 import org.roller.model.PlanetManager;
 import org.roller.model.Roller;
@@ -169,9 +170,8 @@
             }
             UserManager userManager = roller.getUserManager();
             try {
-                // Technorati API allows only 500 queries per-day
-                // TODO: make this configurable
-                int limit = 500;
+                int limit = RollerConfig.getIntProperty(
+                    "planet.aggregator.technorati.limit", 500);
                 int userCount = planet.getSubscriptionCount();
                 int mod = (userCount / limit) + 1;
                 

Modified: incubator/roller/trunk/web/WEB-INF/classes/roller.properties
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/web/WEB-INF/classes/roller.properties?rev=375290&r1=375289&r2=375290&view=diff
==============================================================================
--- incubator/roller/trunk/web/WEB-INF/classes/roller.properties (original)
+++ incubator/roller/trunk/web/WEB-INF/classes/roller.properties Mon Feb  6 06:47:01 2006
@@ -292,6 +292,9 @@
 # Planet cache must exist and must be writable by Roller process
 planet.aggregator.cache.dir=/var/roller/planetcache
 
+# Number of queries allowed per day
+planet.aggregator.technorati.limit=500
+
 #----------------------------------
 # user creation setttings: blogroll and cats for new users