portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wea...@apache.org
Subject cvs commit: jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/page/impl DatabasePageManager.java
Date Thu, 11 Mar 2004 14:08:26 GMT
weaver      2004/03/11 06:08:26

  Modified:    portal/src/java/org/apache/jetspeed/page/impl
                        DatabasePageManager.java
  Log:
  switched to use persistence store instead of plugin
  
  Revision  Changes    Path
  1.4       +20 -16    jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java
  
  Index: DatabasePageManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/java/org/apache/jetspeed/page/impl/DatabasePageManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DatabasePageManager.java	8 Mar 2004 00:29:27 -0000	1.3
  +++ DatabasePageManager.java	11 Mar 2004 14:08:26 -0000	1.4
  @@ -21,6 +21,8 @@
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  +import org.apache.jetspeed.components.persistence.store.Filter;
  +import org.apache.jetspeed.components.persistence.store.PersistenceStore;
   import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer;
   import org.apache.jetspeed.exception.JetspeedException;
   import org.apache.jetspeed.idgenerator.IdGenerator;
  @@ -28,8 +30,6 @@
   import org.apache.jetspeed.page.PageManager;
   import org.apache.jetspeed.page.PageNotRemovedException;
   import org.apache.jetspeed.page.PageNotUpdatedException;
  -import org.apache.jetspeed.persistence.LookupCriteria;
  -import org.apache.jetspeed.persistence.PersistencePlugin;
   import org.apache.jetspeed.profiler.ProfileLocator;
   import org.picocontainer.Startable;
   
  @@ -42,13 +42,7 @@
   public class DatabasePageManager extends AbstractPageManager implements PageManager, Startable
   {
       protected final static Log log = LogFactory.getLog(DatabasePageManager.class);
  -
  -    private PersistencePlugin plugin;
  -
  -    private PersistencePlugin originalPlugin;
  -
  -    private String originalAlias;
  -
  +    private PersistenceStoreContainer pContainer;
       // TODO: this should eventually use a system cach like JCS
       private Map pageCache = new HashMap();
   
  @@ -64,6 +58,8 @@
       public DatabasePageManager(PersistenceStoreContainer pContainer, IdGenerator generator,
String storeName)
       {
           super(generator);
  +        this.pContainer = pContainer;
  +        
       }
   
       public void start()
  @@ -95,10 +91,12 @@
           }
           else
           {
  -            LookupCriteria c = plugin.newLookupCriteria();
  -            c.addEqualTo("id", id);
  -            Object q = plugin.generateQuery(pageClass, c);
  -            Page page = (Page) plugin.getObjectByQuery(pageClass, q);
  +            PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  +            Filter filter = store.newFilter();
  +            filter.addEqualTo("id", id);
  +            Object q = store.newQuery(pageClass, filter);
  +            store.getTransaction().begin();
  +            Page page = (Page) store.getObjectByQuery( q);
   
               pageCache.put(id, page);
               return page;
  @@ -144,7 +142,10 @@
       {
           try
           {
  -            plugin.prepareForUpdate(page);
  +            PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  +            store.getTransaction().begin();
  +            store.lockForWrite(page);
  +            store.getTransaction().commit();
           }
           catch (Exception e)
           {
  @@ -165,7 +166,10 @@
           }
           try
           {
  -            plugin.prepareForDelete(page);
  +            PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  +            store.getTransaction().begin();
  +            store.deletePersistent(page);
  +            store.getTransaction().commit();
           }
           catch (Exception e)
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org


Mime
View raw message