roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r409435 [1/3] - in /incubator/roller/branches/roller_3.0: src/org/apache/roller/business/ src/org/apache/roller/business/hibernate/ src/org/apache/roller/business/search/ src/org/apache/roller/business/search/operations/ src/org/apache/roll...
Date Thu, 25 May 2006 19:06:37 GMT
Author: snoopdave
Date: Thu May 25 12:06:35 2006
New Revision: 409435

URL: http://svn.apache.org/viewvc?rev=409435&view=rev
Log:
First portion of Atlas frontpage work on the backend

Added:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/pojos/WeblogEntry.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/SitePageModel.java
Modified:
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/IndexManagerImpl.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernatePlanetManagerImpl.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/FieldConstants.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/IndexUtil.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/AddEntryOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/IndexOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReIndexEntryOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReadFromIndexOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/RebuildWebsiteIndexOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/RemoveEntryOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/RemoveWebsiteIndexOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/SearchOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/WriteToIndexOperation.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/model/PlanetManager.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/model/RefererManager.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/model/UserManager.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/model/WeblogManager.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/pojos/PlanetEntryData.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/pojos/WeblogEntryData.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/admin/struts/actions/PlanetAction.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/admin/struts/actions/SyncWebsitesTask.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/core/MainPageAction.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/ui/rendering/velocity/PlanetPageModel.java
    incubator/roller/branches/roller_3.0/src/org/apache/roller/webservices/xmlrpc/BloggerAPIHandler.java
    incubator/roller/branches/roller_3.0/testdata/roller-custom.properties
    incubator/roller/branches/roller_3.0/tests/org/apache/roller/RollerTestBase.java
    incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/IndexManagerTest.java
    incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PermissionTest.java
    incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerLocalTest.java
    incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/PlanetManagerTest.java
    incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/RefererTest.java
    incubator/roller/branches/roller_3.0/tests/org/apache/roller/business/WeblogTest.java

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/IndexManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/IndexManagerImpl.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/IndexManagerImpl.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/IndexManagerImpl.java Thu May 25 12:06:35 2006
@@ -1,25 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Created on Jul 18, 2003
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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
  *
- * Authored by: Mindaugas Idzelis  (min@idzelis.com)
+ *     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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
  */
+/* Created on Jul 18, 2003 */
 package org.apache.roller.business;
 
 import java.io.File;
@@ -53,52 +49,50 @@
 import org.apache.roller.util.StringUtils;
 
 /**
- * Lucene implementation of IndexManager. This is the central entry point into the Lucene
- * searching API.
- * @author aim4min
+ * Lucene implementation of IndexManager. This is the central entry point 
+ * into the Lucene searching API.
+ * @author Mindaugas Idzelis (min@idzelis.com)
  * @author mraible (formatting and making indexDir configurable)
  */
-public class IndexManagerImpl implements IndexManager
-{
+public class IndexManagerImpl implements IndexManager {
     //~ Static fields/initializers
     // =============================================
-
+    
     private IndexReader reader;
-
+    
     static Log mLogger = LogFactory.getFactory().getInstance(
             IndexManagerImpl.class);
-
+    
     //~ Instance fields
     // ========================================================
-
+    
     private boolean searchEnabled = true;
-
+    
     File indexConsistencyMarker;
-
+    
     private boolean useRAMIndex = false;
-
+    
     private RAMDirectory fRAMindex;
-
+    
     private String indexDir = null;
-
+    
     private boolean inconsistentAtStartup = false;
-
+    
     private ReadWriteLock rwl = new WriterPreferenceReadWriteLock();
-
+    
     //~ Constructors
     // ===========================================================
-
+    
     /**
      * Creates a new lucene index manager. This should only be created once.
      * Creating the index manager more than once will definately result in
      * errors. The preferred way of getting an index is through the
      * RollerContext.
-     * 
+     *
      * @param indexDir -
      *            the path to the index directory
      */
-    public IndexManagerImpl()
-    {
+    public IndexManagerImpl() {
         // check config to see if the internal search is enabled
         String enabled = RollerConfig.getProperty("search.enabled");
         if("false".equalsIgnoreCase(enabled))
@@ -106,348 +100,262 @@
         
         // we also need to know what our index directory is
         // Note: system property expansion is now handled by RollerConfig
-        String indexDir = RollerConfig.getProperty("search.index.dir");
-
-        this.indexDir = indexDir.replace('/', File.separatorChar);
+        String searchIndexDir = RollerConfig.getProperty("search.index.dir");
+        
+        this.indexDir = searchIndexDir.replace('/', File.separatorChar);
         
         // a little debugging
         mLogger.info("search enabled: " + this.searchEnabled);
         mLogger.info("index dir: " + this.indexDir);
-
+        
         String test = indexDir + File.separator + ".index-inconsistent";
         indexConsistencyMarker = new File(test);
-
+        
         // only setup the index if search is enabled
-        if (this.searchEnabled) 
-        {
+        if (this.searchEnabled) {
             
             // 1. If inconsistency marker exists.
             //     Delete index
             // 2. if we're using RAM index
             //     load ram index wrapper around index
             //
-            if (indexConsistencyMarker.exists()) 
-            {
+            if (indexConsistencyMarker.exists()) {
                 getFSDirectory(true);
                 inconsistentAtStartup = true;
-            } 
-            else 
-            {
-                try 
-                {
+            } else {
+                try {
                     File makeIndexDir = new File(indexDir);
-                    if (!makeIndexDir.exists()) 
-                    {
+                    if (!makeIndexDir.exists()) {
                         makeIndexDir.mkdirs();
                         inconsistentAtStartup = true;
                     }
                     indexConsistencyMarker.createNewFile();
-                } 
-                catch (IOException e) 
-                {
+                } catch (IOException e) {
                     mLogger.error(e);
                 }
             }
             
-            if (indexExists()) 
-            {
-                if (useRAMIndex) 
-                {
+            if (indexExists()) {
+                if (useRAMIndex) {
                     Directory filesystem = getFSDirectory(false);
                     
-                    try 
-                    {
+                    try {
                         fRAMindex = new RAMDirectory(filesystem);
-                    } 
-                    catch (IOException e)                     
-                    {
+                    } catch (IOException e) {
                         mLogger.error("Error creating in-memory index", e);
                     }
                 }
-            } 
-            else 
-            {
-                if (useRAMIndex) 
-                {
+            } else {
+                if (useRAMIndex) {
                     fRAMindex = new RAMDirectory();
                     createIndex(fRAMindex);
-                } 
-                else 
-                {
+                } else {
                     createIndex(getFSDirectory(true));
                 }
             }
             
-            if (isInconsistentAtStartup())
-            {
+            if (isInconsistentAtStartup()) {
                 mLogger.info(
-                    "Index was inconsistent. Rebuilding index in the background...");
-                try 
-                {                    
+                        "Index was inconsistent. Rebuilding index in the background...");
+                try {
                     rebuildWebsiteIndex();
-                }
-                catch (RollerException e) 
-                {
+                } catch (RollerException e) {
                     mLogger.error("ERROR: scheduling re-index operation");
                 }
-            }       
+            }
         }
     }
-
+    
     //~ Methods
     // ================================================================
     
-    public void rebuildWebsiteIndex() throws RollerException
-    {
-        scheduleIndexOperation( 
+    public void rebuildWebsiteIndex() throws RollerException {
+        scheduleIndexOperation(
                 new RebuildWebsiteIndexOperation(this, null));
     }
     
-    public void rebuildWebsiteIndex(WebsiteData website) throws RollerException
-    {
-        scheduleIndexOperation( 
+    public void rebuildWebsiteIndex(WebsiteData website) throws RollerException {
+        scheduleIndexOperation(
                 new RebuildWebsiteIndexOperation(this, website));
     }
     
-    public void removeWebsiteIndex(WebsiteData website) throws RollerException
-    {
+    public void removeWebsiteIndex(WebsiteData website) throws RollerException {
         scheduleIndexOperation(
                 new RemoveWebsiteIndexOperation(this, website));
     }
     
-    public void addEntryIndexOperation(WeblogEntryData entry) throws RollerException
-    {
+    public void addEntryIndexOperation(WeblogEntryData entry) throws RollerException {
         AddEntryOperation addEntry = new AddEntryOperation(this, entry);
         scheduleIndexOperation(addEntry);
     }
     
-    public void addEntryReIndexOperation(WeblogEntryData entry) throws RollerException
-    {
+    public void addEntryReIndexOperation(WeblogEntryData entry) throws RollerException {
         ReIndexEntryOperation reindex = new ReIndexEntryOperation(this, entry);
         scheduleIndexOperation(reindex);
     }
- 
-    public void removeEntryIndexOperation(WeblogEntryData entry) throws RollerException
-    {
+    
+    public void removeEntryIndexOperation(WeblogEntryData entry) throws RollerException {
         RemoveEntryOperation removeOp = new RemoveEntryOperation(this, entry);
-        executeIndexOperationNow(removeOp); 
+        executeIndexOperationNow(removeOp);
     }
     
-    public ReadWriteLock getReadWriteLock()
-    {
+    public ReadWriteLock getReadWriteLock() {
         return rwl;
     }
-
-    public boolean isInconsistentAtStartup()
-    {
+    
+    public boolean isInconsistentAtStartup() {
         return inconsistentAtStartup;
     }
-
+    
     /**
      * This is the analyzer that will be used to tokenize comment text.
-     * 
+     *
      * @return Analyzer to be used in manipulating the database.
      */
-    public static final Analyzer getAnalyzer()
-    {
+    public static final Analyzer getAnalyzer() {
         return new StandardAnalyzer();
     }
-
-    private void scheduleIndexOperation(final IndexOperation op)
-    {
-        try
-        {
+    
+    private void scheduleIndexOperation(final IndexOperation op) {
+        try {
             // only if search is enabled
             if(this.searchEnabled) {
                 mLogger.debug("Starting scheduled index operation: "+op.getClass().getName());
                 RollerFactory.getRoller().getThreadManager().executeInBackground(op);
             }
-        }
-        catch (RollerException re)
-        {
+        } catch (RollerException re) {
             mLogger.error("Error getting thread manager", re);
-        }
-        catch (InterruptedException e)
-        {
+        } catch (InterruptedException e) {
             mLogger.error("Error executing operation", e);
         }
     }
-
+    
     /**
      * @param search
      */
-    public void executeIndexOperationNow(final IndexOperation op)
-    {
-        try
-        {
+    public void executeIndexOperationNow(final IndexOperation op) {
+        try {
             // only if search is enabled
             if(this.searchEnabled) {
                 mLogger.debug("Executing index operation now: "+op.getClass().getName());
                 RollerFactory.getRoller().getThreadManager().executeInForeground(op);
             }
-        }
-        catch (RollerException re)
-        {
+        } catch (RollerException re) {
             mLogger.error("Error getting thread manager", re);
-        }
-        catch (InterruptedException e)
-        {
+        } catch (InterruptedException e) {
             mLogger.error("Error executing operation", e);
         }
     }
-
-    public synchronized void resetSharedReader() 
-    {
+    
+    public synchronized void resetSharedReader() {
         reader = null;
     }
-    public synchronized IndexReader getSharedIndexReader()
-    {
-        if (reader == null)
-        {
-            try
-            {
+    public synchronized IndexReader getSharedIndexReader() {
+        if (reader == null) {
+            try {
                 reader = IndexReader.open(getIndexDirectory());
-            }
-            catch (IOException e)
-            {
+            } catch (IOException e) {
             }
         }
         return reader;
     }
-
+    
     /**
      * Get the directory that is used by the lucene index. This method will
      * return null if there is no index at the directory location. If we are
      * using a RAM index, the directory will be a ram directory.
-     * 
+     *
      * @return Directory The directory containing the index, or null if error.
      */
-    public Directory getIndexDirectory()
-    {
-        if (useRAMIndex)
-        {
+    public Directory getIndexDirectory() {
+        if (useRAMIndex) {
             return fRAMindex;
-        }
-        else
-        {
+        } else {
             return getFSDirectory(false);
         }
     }
-
-    private boolean indexExists()
-    {
+    
+    private boolean indexExists() {
         return IndexReader.indexExists(indexDir);
     }
-
-    Directory getFSDirectory(boolean delete)
-    {
+    
+    Directory getFSDirectory(boolean delete) {
         Directory directory = null;
-
-        try
-        {
+        
+        try {
             directory = FSDirectory.getDirectory(indexDir, delete);
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             mLogger.error("Problem accessing index directory", e);
         }
-
+        
         return directory;
     }
-
-    private void createIndex(Directory dir)
-    {
+    
+    private void createIndex(Directory dir) {
         IndexWriter writer = null;
-
-        try
-        {
+        
+        try {
             writer = new IndexWriter(dir, IndexManagerImpl.getAnalyzer(), true);
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             mLogger.error("Error creating index", e);
-        }
-        finally
-        {
-            try
-            {
-                if (writer != null)
-                {
+        } finally {
+            try {
+                if (writer != null) {
                     writer.close();
                 }
-            }
-            catch (IOException e)
-            {
+            } catch (IOException e) {
             }
         }
     }
-
-    private IndexOperation getSaveIndexOperation()
-    {
+    
+    private IndexOperation getSaveIndexOperation() {
         return new WriteToIndexOperation(this) {
-            public void doRun()
-            {
+            public void doRun() {
                 Directory dir = getIndexDirectory();
                 Directory fsdir = getFSDirectory(true);
-
+                
                 IndexWriter writer = null;
-
-                try
-                {
+                
+                try {
                     writer = new IndexWriter(fsdir, IndexManagerImpl
                             .getAnalyzer(), true);
-
+                    
                     writer.addIndexes(new Directory[] { dir });
                     indexConsistencyMarker.delete();
-                }
-                catch (IOException e)
-                {
+                } catch (IOException e) {
                     mLogger.error("Problem saving index to disk", e);
-
+                    
                     // Delete the directory, since there was a problem saving
                     // the RAM contents
                     getFSDirectory(true);
-                }
-                finally
-                {
-                    try
-                    {
+                } finally {
+                    try {
                         if (writer != null)
                             writer.close();
-                    }
-                    catch (IOException e1)
-                    {
+                    } catch (IOException e1) {
                         mLogger.warn("Unable to close IndexWriter.");
                     }
                 }
-
+                
             }
         };
     }
-
-    public void release() 
-    {
+    
+    public void release() {
         // no-op
     }
     
-    public void shutdown()
-    {
-        if (useRAMIndex)
-        {
+    public void shutdown() {
+        if (useRAMIndex) {
             scheduleIndexOperation(getSaveIndexOperation());
-        }
-        else
-        {
+        } else {
             indexConsistencyMarker.delete();
         }
-
-        try
-        {
+        
+        try {
             if (reader != null)
                 reader.close();
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             // won't happen, since it was
         }
     }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernatePlanetManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernatePlanetManagerImpl.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernatePlanetManagerImpl.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernatePlanetManagerImpl.java Thu May 25 12:06:35 2006
@@ -24,6 +24,7 @@
 import com.sun.syndication.fetcher.impl.SyndFeedInfo;
 import java.io.File;
 import java.net.URL;
+import java.sql.Timestamp;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Calendar;
@@ -55,7 +56,6 @@
 import org.apache.roller.pojos.PlanetSubscriptionData;
 import org.apache.roller.util.rome.DiskFeedInfoCache;
 
-
 /**
  * Hibernate implementation of the PlanetManager.
  */
@@ -68,8 +68,7 @@
     private HibernatePersistenceStrategy strategy = null;
     private String localURL = null;
     private Map lastUpdatedByGroup = new HashMap();
-    
-    
+       
     public HibernatePlanetManagerImpl(HibernatePersistenceStrategy strat) {
         
         this.strategy = strat;
@@ -77,14 +76,14 @@
         // TODO: this is bad.  this property should be in the planet config.
         localURL = RollerRuntimeConfig.getProperty("site.absoluteurl");
     }
-    
-    
-    public void saveConfiguration(PlanetConfigData config) throws RollerException {
+        
+    public void saveConfiguration(PlanetConfigData config) 
+        throws RollerException {
         strategy.store(config);
     }
-    
-    
-    public void saveGroup(PlanetGroupData group) throws RollerException {
+        
+    public void saveGroup(PlanetGroupData group) 
+        throws RollerException {
         
         // save each sub assoc first, then the group
         Iterator assocs = group.getGroupSubscriptionAssocs().iterator();
@@ -95,14 +94,14 @@
         }
         strategy.store(group);
     }
-    
-    
-    public void saveEntry(PlanetEntryData entry) throws RollerException {
+        
+    public void saveEntry(PlanetEntryData entry) 
+        throws RollerException {
         strategy.store(entry);
     }
-    
-    
-    public void saveSubscription(PlanetSubscriptionData sub) throws RollerException {
+        
+    public void saveSubscription(PlanetSubscriptionData sub) 
+        throws RollerException {
         PlanetSubscriptionData existing = getSubscription(sub.getFeedUrl());
         if (existing == null || (existing.getId().equals(sub.getId()))) {
             this.strategy.store(sub);
@@ -110,23 +109,22 @@
             throw new RollerException("ERROR: duplicate feed URLs not allowed");
         }
     }
-    
-    
-    public void deleteEntry(PlanetEntryData entry) throws RollerException {
+        
+    public void deleteEntry(PlanetEntryData entry) 
+        throws RollerException {
         strategy.remove(entry);
     }
-    
-    
-    public void deleteGroup(PlanetGroupData group) throws RollerException {
+        
+    public void deleteGroup(PlanetGroupData group) 
+        throws RollerException {
         strategy.remove(group);
     }
-    
-    
-    public void deleteSubscription(PlanetSubscriptionData sub) throws RollerException {
+        
+    public void deleteSubscription(PlanetSubscriptionData sub) 
+        throws RollerException {
         strategy.remove(sub);
     }
-    
-    
+        
     public PlanetConfigData getConfiguration() throws RollerException {
         PlanetConfigData config = null;
         try {
@@ -146,10 +144,10 @@
             throw new RollerException(e);
         }
         return config;
-    }
+    }    
     
-    
-    public PlanetSubscriptionData getSubscription(String feedUrl) throws RollerException {
+    public PlanetSubscriptionData getSubscription(String feedUrl) 
+        throws RollerException {
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Criteria criteria =
@@ -162,13 +160,12 @@
             throw new RollerException(e);
         }
     }
-    
-    
-    public PlanetSubscriptionData getSubscriptionById(String id) throws RollerException {
+        
+    public PlanetSubscriptionData getSubscriptionById(String id) 
+        throws RollerException {
         return (PlanetSubscriptionData) strategy.load(id, PlanetSubscriptionData.class);
     }
-    
-    
+        
     public Iterator getAllSubscriptions() {
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -195,15 +192,18 @@
         }
     }
     
-    public synchronized List getTopSubscriptions(int max) throws RollerException {
+    public synchronized List getTopSubscriptions(int offset, int length) 
+        throws RollerException {
+        // TODO: ATLAS getTopSubscriptions DONE
         String groupHandle = NO_GROUP;
         List ret = null;
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
             Criteria criteria =
                     session.createCriteria(PlanetSubscriptionData.class);
-            criteria.setMaxResults(max);
             criteria.addOrder(Order.desc("inboundblogs"));
+            criteria.setFirstResult(offset);
+            criteria.setMaxResults(length);
             ret = criteria.list();
         } catch (HibernateException e) {
             throw new RollerException(e);
@@ -212,7 +212,9 @@
     }
     
     public synchronized List getTopSubscriptions(
-            PlanetGroupData group, int max) throws RollerException {
+            PlanetGroupData group, int offset, int length) 
+            throws RollerException {
+        // TODO: ATLAS getTopSubscriptions DONE
         String groupHandle = (group == null) ? NO_GROUP : group.getHandle();
         List ret = null;
         try {
@@ -224,15 +226,15 @@
                     +"assoc.group.handle=:groupHandle "
                     +"order by sub.inboundblogs desc");
             query.setString("groupHandle", group.getHandle());
-            query.setMaxResults(max);
+            query.setFirstResult(offset);
+            query.setMaxResults(length);
             ret = query.list();
         } catch (HibernateException e) {
             throw new RollerException(e);
         }
         return ret;
     }
-    
-    
+        
     public PlanetGroupData getGroup(String handle) throws RollerException {
         try {
             Session session = strategy.getSession();
@@ -248,8 +250,7 @@
     public PlanetGroupData getGroupById(String id) throws RollerException {
         return (PlanetGroupData) strategy.load(id, PlanetGroupData.class);
     }
-    
-    
+        
     public List getGroups() throws RollerException {
         try {
             Session session = ((HibernatePersistenceStrategy)strategy).getSession();
@@ -259,8 +260,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+       
     public List getGroupHandles() throws RollerException {
         List handles = new ArrayList();
         Iterator list = getGroups().iterator();
@@ -271,15 +271,29 @@
         return handles;
     }
     
-    
-    public synchronized List getAggregation(int maxEntries) throws RollerException {
-        return getAggregation(null, maxEntries);
-    }
-    
-    
-    public synchronized List getAggregation(PlanetGroupData group, int maxEntries)
-            throws RollerException {
-        
+     public List getFeedEntries(String feedUrl, int offset, int length)
+        throws RollerException {
+        // TODO: ATLAS getFeedEntries         
+        try {
+            Session session = ((HibernatePersistenceStrategy)strategy).getSession();
+            Criteria criteria = session.createCriteria(PlanetEntryData.class);
+            criteria.setFirstResult(offset);
+            criteria.setMaxResults(length);
+            return criteria.list();
+        } catch (HibernateException e) {
+            throw new RollerException(e);
+        }
+    }    
+   
+    public synchronized List getAggregation(int offset, int len) 
+        throws RollerException {
+        return getAggregation(null, offset, len);
+    } 
+    
+    public synchronized List getAggregation(
+        PlanetGroupData group, int offset, int length)
+        throws RollerException {
+        // TODO: ATLAS getAggregation DONE TESTED
         List ret = null;
         try {
             String groupHandle = (group == null) ? NO_GROUP : group.getHandle();
@@ -289,26 +303,28 @@
             
             if (group != null) {
                 Query query = session.createQuery(
-                        "select entry from org.apache.roller.pojos.PlanetEntryData entry "
-                        +"join entry.subscription.groupSubscriptionAssocs assoc "
-                        +"where assoc.group=:group order by entry.published desc");
+                    "select entry from org.apache.roller.pojos.PlanetEntryData entry "
+                    +"join entry.subscription.groupSubscriptionAssocs assoc "
+                    +"where assoc.group=:group order by entry.pubTime desc");
                 query.setEntity("group", group);
-                query.setMaxResults(maxEntries);
+                query.setFirstResult(offset);
+                query.setMaxResults(length);
                 ret = query.list();
             } else {
                 Query query = session.createQuery(
-                        "select entry from org.apache.roller.pojos.PlanetEntryData entry "
-                        +"join entry.subscription.groupSubscriptionAssocs assoc "
-                        +"where "
-                        +"assoc.group.handle='external' or assoc.group.handle='all'"
-                        +" order by entry.published desc");
-                query.setMaxResults(maxEntries);
+                    "select entry from org.apache.roller.pojos.PlanetEntryData entry "
+                    +"join entry.subscription.groupSubscriptionAssocs assoc "
+                    +"where "
+                    +"assoc.group.handle='external' or assoc.group.handle='all'"
+                    +" order by entry.pubTime desc");
+                query.setFirstResult(offset);
+                query.setMaxResults(length);
                 ret = query.list();
             }
             Date retLastUpdated = null;
             if (ret.size() > 0) {
                 PlanetEntryData entry = (PlanetEntryData)ret.get(0);
-                retLastUpdated = entry.getPublished();
+                retLastUpdated = entry.getPubTime();
             } else {
                 retLastUpdated = new Date();
             }
@@ -317,13 +333,13 @@
             long endTime = System.currentTimeMillis();
             log.info("Generated aggregation in "
                     +((endTime-startTime)/1000.0)+" seconds");
+            
         } catch (Throwable e) {
             log.error("ERROR: building aggregation for: "+group, e);
             throw new RollerException(e);
         }
         return ret;
-    }
-    
+    } 
     
     public synchronized void clearCachedAggregations() {
         lastUpdatedByGroup.clear();
@@ -357,8 +373,10 @@
                 "\\$\\{user.home}",System.getProperty("user.home"));
         
         // allow ${catalina.home} in cache dir property
-        cacheDirName = cacheDirName.replaceFirst(
-                "\\$\\{catalina.home}",System.getProperty("catalina.home"));
+        if (System.getProperty("catalina.home") != null) {
+            cacheDirName = cacheDirName.replaceFirst(
+                    "\\$\\{catalina.home}",System.getProperty("catalina.home"));
+        }
         
         // create cache  dir if it does not exist
         File cacheDir = null;
@@ -489,9 +507,9 @@
             // saving sub here causes detachment issues, so we save it later
         }
         
-        // Kludge for Feeds without entry dates: most recent entry is given
-        // feed's last publish date (or yesterday if none exists) and earler
-        // entries are placed at once day intervals before that.
+        // Horrible kludge for Feeds without entry dates: most recent entry is 
+        // given feed's last publish date (or yesterday if none exists) and 
+        // earler entries are placed at once day intervals before that.
         Calendar cal = Calendar.getInstance();
         if (sub.getLastUpdated() != null) {
             cal.setTime(sub.getLastUpdated());
@@ -507,12 +525,12 @@
                 SyndEntry romeEntry = (SyndEntry) entries.next();
                 PlanetEntryData entry =
                         new PlanetEntryData(feed, romeEntry, sub);
-                if (entry.getPublished() == null) {
+                if (entry.getPubTime() == null) {
                     log.debug(
                             "No published date, assigning fake date for "+feedUrl);
-                    entry.setPublished(cal.getTime());
+                    entry.setPubTime(new Timestamp(cal.getTimeInMillis()));
                 }
-                if (entry.getPermalink() == null) {
+                if (entry.getPermaLink() == null) {
                     log.warn("No permalink, rejecting entry from "+feedUrl);
                 } else {
                     newEntries.add(entry);
@@ -528,6 +546,6 @@
     protected String getLocalURL() {
         return localURL;
     }
-    
+
 }
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateRefererManagerImpl.java Thu May 25 12:06:35 2006
@@ -78,8 +78,7 @@
     private HibernatePersistenceStrategy strategy = null;
     private Date mRefDate = new Date();
     private SimpleDateFormat mDateFormat = DateUtil.get8charDateFormat();
-    
-    
+        
     public HibernateRefererManagerImpl(HibernatePersistenceStrategy strat) {
         
         log.debug("Instantiating Hibernate Referer Manager");
@@ -87,22 +86,14 @@
         strategy = strat;
     }
     
-    
-    /**
-     * 
-     * 
-     * @see org.apache.roller.pojos.RefererManager#saveReferer(org.apache.roller.pojos.RefererData)
-     */
     public void saveReferer(RefererData referer) throws RollerException {
         strategy.store(referer);
     }
-    
-    
+        
     public void removeReferer(RefererData referer) throws RollerException {
         strategy.remove(referer);
     }
-    
-    
+        
     /**
      * Clear referrer dayhits and remove referrers without excerpts.
      *
@@ -129,8 +120,7 @@
             log.error("EXCEPTION resetting referers",e);
         }
     }
-    
-    
+        
     /**
      * Clear referrer dayhits and remove referrers without excerpts.
      *
@@ -159,8 +149,7 @@
             log.error("EXCEPTION resetting referers",e);
         }
     }
-    
-    
+        
     /**
      * Apply ignoreWord/spam filters to all referers in system.
      */
@@ -196,8 +185,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     /**
      * Apply ignoreWord/spam filters to all referers in website.
      */
@@ -233,8 +221,7 @@
         } catch (HibernateException e) {
             throw new RollerException(e);
         }
-    }
-    
+    }    
     
     /**
      * Use Hibernate directly because Roller's Query API does too much allocation.
@@ -255,8 +242,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     /**
      * Use Hibernate directly because Roller's Query API does too much allocation.
      */
@@ -276,28 +262,51 @@
             throw new RollerException(e);
         }
     }
-    
-    
+       
     /**
-     * Use raw SQL because Hibernate can't handle sorting by sum.
-     *
-     * TODO: do we really need raw sql?  can't hibernate do this?
+     * Return most popular websites based on dayhits, in descending order.
      */
-    public List getDaysPopularWebsites(int max) throws RollerException {
-        // TODO Move to full use of mSupport
+    public List getDaysPopularWebsites(int sinceDays, int offset, int length) 
+        throws RollerException {
+        // TODO: ATLAS getDaysPopularWebsites DONE TESTED
         String msg = "Getting popular websites";
-        Session ses = null; // the session will eventually be release by RequestFilter
-        Connection con = null;
-        try {
-            List list = new ArrayList();
-            
-            ses = ((HibernatePersistenceStrategy)strategy).getSession();
-            con = ses.connection();
-            
-            final PreparedStatement stmt;
-            
-            Dialect currentDialect = ((SessionFactoryImplementor)ses.getSessionFactory()).getDialect();
-            
+        ArrayList result = new ArrayList();
+        try {      
+            Session session = 
+                ((HibernatePersistenceStrategy)strategy).getSession();            
+            Query query = session.createQuery(
+                "select sum(r.dayHits) as s, w.id, w.name, w.handle  "
+               +"from WebsiteData w, RefererData r "
+               +"where r.website=w and w.enabled=true and w.active=true "
+               +"group by w.name, w.handle, w.id order by col_0_0_ desc"); 
+            
+              // +"group by w.name, w.handle, w.id order by s desc");
+              // The above would be *much* better but "HQL parser does not   
+              // resolve alias in ORDER BY clause" (See Hibernate issue HHH-892)
+            
+            query.setFirstResult(offset);
+            query.setMaxResults(length);
+            Iterator rawResults = query.list().iterator();
+            for (Iterator it = query.list().iterator(); it.hasNext();) {
+                Object[] row = (Object[])it.next();
+                Integer hits = (Integer)row[0];
+                String websiteId = (String)row[1];
+                String websiteName = (String)row[2];
+                String websiteHandle = (String)row[3];
+                result.add(new WebsiteDisplayData(
+                    websiteId,
+                    websiteName,
+                    websiteHandle,
+                    hits));              
+            }
+            return result;
+                
+            /* The old raw SQL way:
+            List list = new ArrayList();            
+            Session ses = ((HibernatePersistenceStrategy)strategy).getSession();
+            Connection con = ses.connection();            
+            final PreparedStatement stmt;            
+            Dialect currentDialect = ((SessionFactoryImplementor)ses.getSessionFactory()).getDialect();            
             if (currentDialect instanceof HSQLDialect) {
                 // special handling for HSQLDB
                 stmt = con.prepareStatement(
@@ -305,7 +314,7 @@
                         "from website as w, referer as r "+
                         "where r.websiteid=w.id and w.isenabled=? and w.isactive=? " +
                         "group by w.name, w.handle, w.id order by s desc");
-                stmt.setInt(1, max);
+                stmt.setInt(1, len);
                 stmt.setBoolean(2, true);
                 stmt.setBoolean(3, true);
             } else if(currentDialect instanceof DerbyDialect) {
@@ -317,7 +326,7 @@
                         "group by w.name, w.handle, w.id order by s desc");
                 stmt.setBoolean(1, true);
                 stmt.setBoolean(2, true);
-                stmt.setMaxRows(max);
+                stmt.setMaxRows(len);
             } else if(currentDialect instanceof DB2Dialect) {
                 // special handling for IBM DB2
                 stmt = con.prepareStatement(
@@ -325,7 +334,7 @@
                         "from website as w, referer as r "+
                         "where r.websiteid=w.id and w.isenabled=? and w.isactive=? " +
                         "group by w.name, w.handle, w.id order by s desc fetch first " +
-                        Integer.toString(max) + " rows only");
+                        Integer.toString(len) + " rows only");
                 stmt.setBoolean(1, true);
                 stmt.setBoolean(2, true);
             } else if (currentDialect instanceof OracleDialect) {
@@ -336,9 +345,9 @@
                         "group by w.name, w.handle, w.id order by s desc");
                 stmt.setBoolean(1, true);
                 stmt.setBoolean(2, true);
-                stmt.setInt(3, max );
+                stmt.setInt(3, len );
             } else if (currentDialect instanceof SQLServerDialect) {
-                stmt = con.prepareStatement("select top " + max + " w.id, w.name, w.handle, sum(r.dayhits) as s " +
+                stmt = con.prepareStatement("select top " + len + " w.id, w.name, w.handle, sum(r.dayhits) as s " +
                         "from website as w, referer as r where r.websiteid=w.id and w.isenabled=? and w.isactive=? " +
                         "group by w.name, w.handle, w.id order by s desc");
                 stmt.setBoolean(1, true);
@@ -354,8 +363,8 @@
                         "group by w.name, w.handle, w.id order by s desc limit ?");
                 stmt.setBoolean(1, true);
                 stmt.setBoolean(2, true);
-                stmt.setInt(3, max);
-            }
+                stmt.setInt(3, len);
+            }            
             ResultSet rs = stmt.executeQuery();
             if ( rs.next() ) {
                 do
@@ -369,21 +378,21 @@
                             websiteName,
                             websiteHandle,
                             hits));
-                    if(list.size() >= max) {
+                    if(list.size() >= len) {
                         rs.close();
                         break;
                     }
                 }
                 while ( rs.next() );
-            }
-            return list;
+            }           
+            return list; */
+            
         } catch (Throwable pe) {
             log.error(msg, pe);
             throw new RollerException(msg, pe);
         }
     }
-    
-    
+        
     /**
      * Use raw SQL because Hibernate can't handle the query.
      */
@@ -428,8 +437,7 @@
         
         return hits;
     }
-    
-    
+        
     /**
      * @see org.apache.roller.pojos.RefererManager#getReferers(java.lang.String)
      */
@@ -448,8 +456,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     /**
      * @see org.apache.roller.pojos.RefererManager#getTodaysReferers(String)
      */
@@ -469,8 +476,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+       
     /**
      * Returns referers for a specified day. Duplicate enties are not
      * included in this list so the hit counts may not be accurate.
@@ -498,8 +504,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     /**
      * @see org.apache.roller.pojos.RefererManager#getReferersToEntry(
      * java.lang.String, java.lang.String)
@@ -524,8 +529,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     /**
      * Query for collection of referers.
      */
@@ -543,8 +547,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     /**
      * Query for collection of referers.
      */
@@ -574,18 +577,15 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     public int getDayHits(WebsiteData website) throws RollerException {
         return getHits(website, DAYHITS);
     }
-    
-    
+        
     public int getTotalHits(WebsiteData website) throws RollerException {
         return getHits(website, TOTALHITS);
     }
-    
-    
+        
     /**
      * @see org.apache.roller.pojos.RefererManager#retrieveReferer(java.lang.String)
      */
@@ -730,8 +730,7 @@
             log.error(npe);
         }
     }
-    
-    
+        
     /**
      * Use LinkbackExtractor to parse title and excerpt from referer
      */
@@ -856,10 +855,8 @@
         }
         
     }
-    
-    
-    public void release() {}
-    
+       
+    public void release() {}    
 }
 
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateUserManagerImpl.java Thu May 25 12:06:35 2006
@@ -1,23 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Created on Jun 16, 2004
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
  */
+/* Created on Jun 16, 2004 */
 package org.apache.roller.business.hibernate;
 
 import java.util.ArrayList;
@@ -55,16 +53,13 @@
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WebsiteData;
 
-
 /**
  * Hibernate implementation of the UserManager.
  */
 public class HibernateUserManagerImpl implements UserManager {
     
-    static final long serialVersionUID = -5128460637997081121L;
-    
-    private static Log log = LogFactory.getLog(HibernateUserManagerImpl.class);
-    
+    static final long serialVersionUID = -5128460637997081121L;    
+    private static Log log = LogFactory.getLog(HibernateUserManagerImpl.class);    
     private HibernatePersistenceStrategy strategy = null;
     
     // cached mapping of weblogHandles -> weblogIds
@@ -72,17 +67,13 @@
     
     // cached mapping of userNames -> userIds
     private Map userNameToIdMap = new Hashtable();
-    
-    
-    /**
-     * @param strategy
-     */
+        
     public HibernateUserManagerImpl(HibernatePersistenceStrategy strat) {
         log.debug("Instantiating Hibernate User Manager");
         
         this.strategy = strat;
     }
-   
+    
     /**
      * Update existing website.
      */
@@ -90,7 +81,7 @@
         
         website.setLastModified(new java.util.Date());
         strategy.store(website);
-    }    
+    }
     
     public void removeWebsite(WebsiteData weblog) throws RollerException {
         
@@ -101,15 +92,13 @@
         // remove entry from cache mapping
         this.weblogHandleToIdMap.remove(weblog.getHandle());
     }
-    
-
+        
     /**
      * convenience method for removing contents of a weblog.
-     *
      * TODO BACKEND: use manager methods instead of queries here
      */
-    private void removeWebsiteContents(WebsiteData website) 
-            throws HibernateException, RollerException {
+    private void removeWebsiteContents(WebsiteData website)
+    throws HibernateException, RollerException {
         
         Session session = this.strategy.getSession();
         
@@ -156,7 +145,7 @@
             this.strategy.remove(referer);
         }
         
-                
+        
         // remove associated pages
         Criteria pageQuery = session.createCriteria(WeblogTemplate.class);
         pageQuery.add(Expression.eq("website", website));
@@ -187,31 +176,26 @@
         }
         
     }
-    
-    
+        
     public void saveUser(UserData data) throws RollerException {
         this.strategy.store(data);
     }
-    
-    
+        
     public void removeUser(UserData user) throws RollerException {
         this.strategy.remove(user);
         
         // remove entry from cache mapping
         this.userNameToIdMap.remove(user.getUserName());
     }
-    
-    
+        
     public void savePermissions(PermissionsData perms) throws RollerException {
         this.strategy.store(perms);
     }
-    
-    
+        
     public void removePermissions(PermissionsData perms) throws RollerException {
         this.strategy.remove(perms);
     }
-    
-    
+        
     /**
      * @see org.apache.roller.model.UserManager#storePage(org.apache.roller.pojos.WeblogTemplate)
      */
@@ -221,13 +205,11 @@
         // update weblog last modified date.  date updated by saveWebsite()
         RollerFactory.getRoller().getUserManager().saveWebsite(page.getWebsite());
     }
-    
-    
+        
     public void removePage(WeblogTemplate page) throws RollerException {
         this.strategy.remove(page);
     }
-    
-    
+        
     public void addUser(UserData newUser) throws RollerException {
         
         if(newUser == null)
@@ -253,15 +235,13 @@
         
         this.strategy.store(newUser);
     }
-    
-    
+        
     public void addWebsite(WebsiteData newWeblog) throws RollerException {
         
         this.strategy.store(newWeblog);
         this.addWeblogContents(newWeblog);
     }
-    
-    
+        
     private void addWeblogContents(WebsiteData newWeblog) throws RollerException {
         
         UserManager umgr = RollerFactory.getRoller().getUserManager();
@@ -286,17 +266,17 @@
         this.strategy.store(rootCat);
         
         String cats = RollerConfig.getProperty("newuser.categories");
-        WeblogCategoryData firstCat = rootCat; 
+        WeblogCategoryData firstCat = rootCat;
         if (cats != null) {
             String[] splitcats = cats.split(",");
             for (int i=0; i<splitcats.length; i++) {
                 WeblogCategoryData c = new WeblogCategoryData(
-                    null,            // id
-                    newWeblog,       // newWeblog
-                    rootCat,         // parent
-                    splitcats[i],    // name
-                    splitcats[i],    // description
-                    null );          // image
+                        null,            // id
+                        newWeblog,       // newWeblog
+                        rootCat,         // parent
+                        splitcats[i],    // name
+                        splitcats[i],    // description
+                        null );          // image
                 if (i == 0) firstCat = c;
                 this.strategy.store(c);
             }
@@ -306,7 +286,7 @@
         
         // But default category for weblog itself should be  root
         newWeblog.setDefaultCategory(rootCat);
-
+        
         this.strategy.store(newWeblog);
         
         // add default bookmarks
@@ -350,11 +330,9 @@
             }
         }
     }
-    
-    
+        
     /**
      * Creates and stores a pending PermissionsData for user and website specified.
-     *
      * TODO BACKEND: do we really need this?  can't we just use storePermissions()?
      */
     public PermissionsData inviteUser(WebsiteData website,
@@ -371,8 +349,7 @@
         
         return perms;
     }
-    
-    
+        
     /**
      * Remove user permissions from a website.
      *
@@ -397,23 +374,20 @@
         website.removePermission(target);
         this.strategy.remove(target);
     }
-    
-    
+        
     public WebsiteData getWebsite(String id) throws RollerException {
         return (WebsiteData) this.strategy.load(id,WebsiteData.class);
     }
-    
-    
+        
     public WebsiteData getWebsiteByHandle(String handle) throws RollerException {
         return getWebsiteByHandle(handle, Boolean.TRUE);
     }
-    
-    
+        
     /**
      * Return website specified by handle.
      */
     public WebsiteData getWebsiteByHandle(String handle, Boolean enabled)
-            throws RollerException {
+    throws RollerException {
         
         if (handle==null )
             throw new RollerException("Handle cannot be null");
@@ -464,13 +438,14 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     /**
      * Get websites of a user
      */
-    public List getWebsites(UserData user, Boolean enabled, Boolean active)  throws RollerException {
-        
+    public List getWebsites(
+        UserData user, Boolean enabled, Boolean active, int offset, int length)  
+        throws RollerException {
+        // TODO: ATLAS getWebsites DONE TESTED
         try {
             Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
             Criteria criteria = session.createCriteria(WebsiteData.class);
@@ -485,25 +460,24 @@
             if (active != null) {
                 criteria.add(Expression.eq("active", active));
             }
+            criteria.setFirstResult(offset);
+            criteria.setMaxResults(length);
             return criteria.list();
         } catch (HibernateException e) {
             throw new RollerException(e);
         }
     }
-    
-    
+        
     public UserData getUser(String id) throws RollerException {
         return (UserData)this.strategy.load(id,UserData.class);
     }
-    
-    
+        
     public UserData getUserByUsername(String userName) throws RollerException {
         return getUserByUsername(userName, Boolean.TRUE);
     }
     
-    
     public UserData getUserByUsername(String userName, Boolean enabled)
-            throws RollerException {
+    throws RollerException {
         
         if (userName==null )
             throw new RollerException("userName cannot be null");
@@ -555,12 +529,10 @@
         }
     }
     
-    
     public List getUsers() throws RollerException {
         return getUsers(Boolean.TRUE);
     }
     
-    
     public List getUsers(Boolean enabled) throws RollerException {
         
         try {
@@ -576,7 +548,6 @@
         }
     }
     
-    
     /**
      * Get users of a website
      */
@@ -597,8 +568,7 @@
             throw new RollerException(e);
         }
     }
-    
-    
+        
     public List getUsersStartingWith(String startsWith,
             int offset, int length, Boolean enabled) throws RollerException {
         
@@ -634,7 +604,6 @@
         return results;
     }
     
-    
     public WeblogTemplate getPage(String id) throws RollerException {
         // Don't hit database for templates stored on disk
         if (id != null && id.endsWith(".vm")) return null;
@@ -642,7 +611,6 @@
         return (WeblogTemplate)this.strategy.load(id,WeblogTemplate.class);
     }
     
-    
     /**
      * Use Hibernate directly because Roller's Query API does too much allocation.
      */
@@ -669,7 +637,6 @@
         }
     }
     
-    
     /**
      * @see org.apache.roller.model.UserManager#getPageByName(WebsiteData, java.lang.String)
      */
@@ -696,7 +663,6 @@
         }
     }
     
-    
     /**
      * @see org.apache.roller.model.UserManager#getPages(WebsiteData)
      */
@@ -717,12 +683,10 @@
         }
     }
     
-    
     public PermissionsData getPermissions(String inviteId) throws RollerException {
         return (PermissionsData)this.strategy.load(inviteId, PermissionsData.class);
     }
     
-    
     /**
      * Return permissions for specified user in website
      */
@@ -742,7 +706,6 @@
         }
     }
     
-    
     /**
      * Get pending permissions for user
      */
@@ -760,7 +723,6 @@
         }
     }
     
-    
     /**
      * Get pending permissions for website
      */
@@ -778,7 +740,6 @@
         }
     }
     
-    
     /**
      * Get all permissions of a website (pendings not including)
      */
@@ -796,7 +757,6 @@
         }
     }
     
-    
     /**
      * Get all permissions of a user.
      */
@@ -814,16 +774,40 @@
         }
     }
     
-    
     public void release() {}
     
+    public Map getUsernameLetterMap() {
+        // TODO: ATLAS getUsernameLetterMap
+        return null;
+    }
+    
+    public List getUsersByLetter(char letter) {
+        // TODO: ATLAS getUsersByLetter
+        return null;
+    }
+    
+    public Map getWeblogHandleLetterMap() {
+        // TODO: ATLAS getWeblogHandleLetterMap
+        return null;
+    }
     
+    public List getWeblogsByLetter(char letter) {
+        // TODO: ATLAS getWeblogsByLetter
+        return null;
+    }
+        
+    public List getMostCommentedWebsites(int sinceDays, int offset, int len)
+    throws RollerException {
+        // TODO: ATLAS getMostCommentedWebsites
+        return null;
+    }
+     
     /** Doesn't seem to be any other way to get ignore case w/o QBE */
     class IgnoreCaseEqExpression extends SimpleExpression {
         public IgnoreCaseEqExpression(String property, Object value) {
             super(property, value, "=", true);
         }
-    } 
+    }
 }
 
 

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java Thu May 25 12:06:35 2006
@@ -1040,6 +1040,12 @@
         return map;
     }
     
+    public List getMostCommentedWeblogEntries(
+            WebsiteData website, int sinceDays, int offset, int len) 
+            throws RollerException {
+        return null;
+    }
+    
     public List getNextEntries(
             WeblogEntryData current, String catName, int maxEntries)
             throws RollerException {
@@ -1109,4 +1115,6 @@
             log.error("EXCEPTION applying comment defaults",e);
         }
     }     
+
+
 }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/FieldConstants.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/FieldConstants.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/FieldConstants.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/FieldConstants.java Thu May 25 12:06:35 2006
@@ -1,38 +1,28 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Created on Jul 19, 2003
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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
  *
- * Authored by: Mindaugas Idzelis  (min@idzelis.com)
+ *     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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
  */
+/* Created on Jul 19, 2003 */
 package org.apache.roller.business.search;
 
-
 /**
- * @author aim4min
- *
- * To change the template for this generated type comment go to
- * Window>Preferences>Java>Code Generation>Code and Comments
+ * Field constants for indexing blog entries and comments.
+ * @author Mindaugas Idzelis  (min@idzelis.com)
  */
-public final class FieldConstants
-{
-    //~ Static fields/initializers =============================================
-
+public final class FieldConstants {    
     public static final String ANCHOR = "anchor";
     public static final String UPDATED = "updated";
     public static final String ID = "id";

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/IndexUtil.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/IndexUtil.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/IndexUtil.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/IndexUtil.java Thu May 25 12:06:35 2006
@@ -1,25 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Created on Jul 20, 2003
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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
  *
- * Authored by: Mindaugas Idzelis  (min@idzelis.com)
+ *     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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
  */
+/* Created on Jul 20, 2003 */
 package org.apache.roller.business.search;
 
 import org.apache.lucene.analysis.Analyzer;
@@ -32,35 +28,34 @@
 import java.io.StringReader;
 
 /**
- * @author aim4min
- *
- * Class containing helper methods. 
+ * Class containing helper methods.
+ * @author Mindaugas Idzelis (min@idzelis.com)
  */
 public class IndexUtil {
-
-	/**
-	 * Create a lucene term from the first token of the input string. 
-	 * 
-	 * @param field The lucene document field to create a term with
-	 * @param input The input you wish to convert into a term
-	 * @return Lucene search term
-	 */
-	public static final Term getTerm(String field, String input) {
-		if (input==null || field==null) return null;
-		Analyzer analyer = IndexManagerImpl.getAnalyzer();
-		TokenStream tokens = analyer.tokenStream(field,
-			new StringReader(input));
-		
-		Token token = null;
-		Term term = null;
-		try {
-			token = tokens.next();
-		} catch (IOException e) {}
-		if (token!=null) {
-			String termt = token.termText();
-			term = new Term(field,termt);
-		}
-		return term;
-	}
-
+    
+    /**
+     * Create a lucene term from the first token of the input string.
+     *
+     * @param field The lucene document field to create a term with
+     * @param input The input you wish to convert into a term
+     * @return Lucene search term
+     */
+    public static final Term getTerm(String field, String input) {
+        if (input==null || field==null) return null;
+        Analyzer analyer = IndexManagerImpl.getAnalyzer();
+        TokenStream tokens = analyer.tokenStream(field,
+                new StringReader(input));
+        
+        Token token = null;
+        Term term = null;
+        try {
+            token = tokens.next();
+        } catch (IOException e) {}
+        if (token!=null) {
+            String termt = token.termText();
+            term = new Term(field,termt);
+        }
+        return term;
+    }
+    
 }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/AddEntryOperation.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/AddEntryOperation.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/AddEntryOperation.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/AddEntryOperation.java Thu May 25 12:06:35 2006
@@ -1,25 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Created on Jul 16, 2003
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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
  *
- * Authored by: Mindaugas Idzelis  (min@idzelis.com)
+ *     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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
  */
+/* Created on Jul 16, 2003 */
 package org.apache.roller.business.search.operations;
 
 import java.io.IOException;
@@ -32,59 +28,45 @@
 import org.apache.roller.model.RollerFactory;
 import org.apache.roller.pojos.WeblogEntryData;
 
-
 /**
- * @author aim4min
- *
  * An operation that adds a new log entry into the index.
+ * @author Mindaugas Idzelis  (min@idzelis.com)
  */
-public class AddEntryOperation extends WriteToIndexOperation
-{
+public class AddEntryOperation extends WriteToIndexOperation {
+    
     //~ Static fields/initializers =============================================
-
+    
     private static Log mLogger =
-        LogFactory.getFactory().getInstance(AddEntryOperation.class);
-
+            LogFactory.getFactory().getInstance(AddEntryOperation.class);
+    
     //~ Instance fields ========================================================
-
+    
     private WeblogEntryData data;
-
+    
     //~ Constructors ===========================================================
-
+    
     /**
      * Adds a web log entry into the index.
      */
-    public AddEntryOperation(IndexManagerImpl mgr, WeblogEntryData data)
-    {
+    public AddEntryOperation(IndexManagerImpl mgr, WeblogEntryData data) {
         super(mgr);
         this.data = data;
     }
-
+    
     //~ Methods ================================================================
-
-    /* (non-Javadoc)
-     * @see java.lang.Runnable#run()
-     */
-    public void doRun()
-    {    	
+    
+    public void doRun() {
         IndexWriter writer = beginWriting();
         Roller roller = RollerFactory.getRoller();
-        try
-        {
-            if (writer != null)
-            {
+        try {
+            if (writer != null) {
                 writer.addDocument(getDocument(data));
             }
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             mLogger.error("Problems adding doc to index", e);
-        }
-        finally
-        {
+        } finally {
             if (roller != null) roller.release();
             endWriting();
-        }    	
-    }
-    
+        }
+    }   
 }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/IndexOperation.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/IndexOperation.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/IndexOperation.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/IndexOperation.java Thu May 25 12:06:35 2006
@@ -15,10 +15,7 @@
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */
-/*
- * Created on Jul 16, 2003
- * Authored by: Mindaugas Idzelis  (min@idzelis.com)
- */
+/* Created on Jul 16, 2003 */
 package org.apache.roller.business.search.operations;
 
 import java.io.IOException;
@@ -40,12 +37,14 @@
 import org.apache.roller.config.RollerConfig;
 
 /**
- * @author aim4min
- *         <p/>
- *         This is the base class for all index operation. These operations include:
- *         <p/>
- *         SearchOperation AddWeblogOperation RemoveWeblogOperation
- *         RebuildUserIndexOperation
+ * This is the base class for all index operation. 
+ * These operations include:<br>
+ *    SearchOperation<br>
+ *    AddWeblogOperation<br>
+ *    RemoveWeblogOperation<br>
+ *    RebuildUserIndexOperation
+ *
+ * @author Mindaugas Idzelis (min@idzelis.com)
  */
 public abstract class IndexOperation implements Runnable {
     private static Log mLogger = LogFactory.getFactory().getInstance(IndexOperation.class);
@@ -138,7 +137,9 @@
 
         // index Category
         WeblogCategoryData categorydata = data.getCategory();
-        Field category = (categorydata == null) ? Field.UnStored(FieldConstants.CATEGORY, "") : Field.Text(FieldConstants.CATEGORY, categorydata.getName());
+        Field category = (categorydata == null) 
+           ? Field.UnStored(FieldConstants.CATEGORY, "") 
+           : Field.Text(FieldConstants.CATEGORY, categorydata.getName());
         doc.add(category);
 
         return doc;
@@ -158,6 +159,7 @@
             try {
                 reader.close();
             } catch (IOException e) {
+                mLogger.error("ERROR closing reader");
             }
         }
     }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReIndexEntryOperation.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReIndexEntryOperation.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReIndexEntryOperation.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReIndexEntryOperation.java Thu May 25 12:06:35 2006
@@ -1,25 +1,21 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-/*
- * Created on Jul 16, 2003
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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
  *
- * Authored by: Mindaugas Idzelis  (min@idzelis.com)
+ *     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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
  */
+/* Created on Jul 16, 2003 */
 package org.apache.roller.business.search.operations;
 
 import java.io.IOException;
@@ -36,74 +32,56 @@
 import org.apache.roller.pojos.WeblogEntryData;
 
 /**
- * @author aim4min
- *
  * An operation that adds a new log entry into the index.
+ * @author Mindaugas Idzelis (min@idzelis.com)
  */
-public class ReIndexEntryOperation extends WriteToIndexOperation
-{
+public class ReIndexEntryOperation extends WriteToIndexOperation {
+    
     //~ Static fields/initializers =============================================
-
+    
     private static Log mLogger =
-        LogFactory.getFactory().getInstance(AddEntryOperation.class);
-
+            LogFactory.getFactory().getInstance(AddEntryOperation.class);
+    
     //~ Instance fields ========================================================
-
+    
     private WeblogEntryData data;
-
+    
     //~ Constructors ===========================================================
-
+    
     /**
      * Adds a web log entry into the index.
      */
-    public ReIndexEntryOperation(IndexManagerImpl mgr, WeblogEntryData data)
-    {
+    public ReIndexEntryOperation(IndexManagerImpl mgr, WeblogEntryData data) {
         super(mgr);
         this.data = data;
     }
-
+    
     //~ Methods ================================================================
-
-    /* (non-Javadoc)
-     * @see java.lang.Runnable#run()
-     */
-    public void doRun()
-    {    	
+    
+    public void doRun() {
         IndexReader reader = beginDeleting();
-        try
-        {
-            if (reader != null)
-            {
+        try {
+            if (reader != null) {
                 Term term = new Term(FieldConstants.ID, data.getId());
                 reader.delete(term);
             }
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             mLogger.error("Error deleting doc from index", e);
-        }
-        finally
-        {
+        } finally {
             endDeleting();
         }
         
         IndexWriter writer = beginWriting();
         Roller roller = RollerFactory.getRoller();
-        try
-        {
-            if (writer != null)
-            {
+        try {
+            if (writer != null) {
                 writer.addDocument(getDocument(data));
             }
-        }
-        catch (IOException e)
-        {
+        } catch (IOException e) {
             mLogger.error("Problems adding doc to index", e);
-        }
-        finally
-        {
+        } finally {
             if (roller != null) roller.release();
             endWriting();
-        }    	
-    }    
+        }
+    }
 }

Modified: incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReadFromIndexOperation.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReadFromIndexOperation.java?rev=409435&r1=409434&r2=409435&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReadFromIndexOperation.java (original)
+++ incubator/roller/branches/roller_3.0/src/org/apache/roller/business/search/operations/ReadFromIndexOperation.java Thu May 25 12:06:35 2006
@@ -1,21 +1,20 @@
 /*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-*  contributor license agreements.  The ASF licenses this file to You
-* 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.  For additional information regarding
-* copyright in this work, please see the NOTICE file in the top level
-* directory of this distribution.
-*/
-
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  The ASF licenses this file to You
+ * 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.  For additional information regarding
+ * copyright in this work, please see the NOTICE file in the top level
+ * directory of this distribution.
+ */
 package org.apache.roller.business.search.operations;
 
 import org.apache.commons.logging.Log;
@@ -25,40 +24,23 @@
 /**
  * @author aim4min
  */
-public abstract class ReadFromIndexOperation extends IndexOperation
-{
-
-    /**
-     * @param manager
-     */
-    public ReadFromIndexOperation(IndexManagerImpl mgr)
-    {
+public abstract class ReadFromIndexOperation extends IndexOperation {
+    public ReadFromIndexOperation(IndexManagerImpl mgr) {
         super(mgr);
     }
-
+    
     private static Log mLogger = LogFactory.getFactory().getInstance(
             ReadFromIndexOperation.class);
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see java.lang.Runnable#run()
-     */
-    public final void run()
-    {
-        try
-        {
+    
+    public final void run() {
+        try {
             manager.getReadWriteLock().readLock().acquire();
             doRun();
-        }
-        catch (InterruptedException e)
-        {
+        } catch (InterruptedException e) {
             mLogger.info("Error acquiring read lock on index", e);
-        }
-        finally
-        {
+        } finally {
             manager.getReadWriteLock().readLock().release();
         }
     }
-
+    
 }



Mime
View raw message