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 Fri, 28 May 2004 19:53:04 GMT
weaver      2004/05/28 12:53:04

  Modified:    portal/src/test/org/apache/jetspeed/page
                        TestDatabasePageManager.java
               portal/src/webapp/WEB-INF/assembly jetspeed.groovy
               portal/src/java/org/apache/jetspeed/page/impl
                        DatabasePageManager.java
  Log:
  see JS2-40 <http://nagoya.apache.org/jira/browse/JS2-40>
  
  Revision  Changes    Path
  1.3       +6 -5      jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java
  
  Index: TestDatabasePageManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/page/TestDatabasePageManager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestDatabasePageManager.java	8 Mar 2004 00:37:25 -0000	1.2
  +++ TestDatabasePageManager.java	28 May 2004 19:53:03 -0000	1.3
  @@ -18,9 +18,11 @@
   import junit.framework.Test;
   import junit.framework.TestSuite;
   
  -import org.apache.jetspeed.PortalComponentAssemblyTestCase;
  +import org.apache.jetspeed.components.persistence.store.util.PersistenceSupportedTestCase;
  +import org.apache.jetspeed.idgenerator.JetspeedIdGenerator;
   import org.apache.jetspeed.om.page.Fragment;
   import org.apache.jetspeed.om.page.Page;
  +import org.apache.jetspeed.page.impl.DatabasePageManager;
   
   /**
    * TestPageService
  @@ -28,7 +30,7 @@
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @version $Id$
    */
  -public class TestDatabasePageManager extends PortalComponentAssemblyTestCase
  +public class TestDatabasePageManager extends PersistenceSupportedTestCase
   {
       private PageManager service = null;
       
  @@ -72,8 +74,7 @@
       
       public void testBuildBasePage()
       {
  -        PageManager pm = (PageManager)componentManager.getComponent("DatabasePageManager");
  -        assertNotNull("page manager is null", pm);            
  +        PageManager pm = new DatabasePageManager(persistenceStore, new JetspeedIdGenerator(10,"Page",""));
           
           Page page = pm.newPage();
           page.setTitle("TEST");
  
  
  
  1.39      +1 -17     jakarta-jetspeed-2/portal/src/webapp/WEB-INF/assembly/jetspeed.groovy
  
  Index: jetspeed.groovy
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/webapp/WEB-INF/assembly/jetspeed.groovy,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- jetspeed.groovy	27 May 2004 19:58:40 -0000	1.38
  +++ jetspeed.groovy	28 May 2004 19:53:03 -0000	1.39
  @@ -66,8 +66,6 @@
   
   // Persistence Store
   import org.apache.jetspeed.components.persistence.store.ojb.pb.PBStore
  -import org.apache.jetspeed.components.persistence.store.impl.DefaultPersistenceStoreContainer
  -import org.apache.jetspeed.components.persistence.store.PersistenceStoreContainer
   import org.apache.jetspeed.components.persistence.store.PersistenceStore
   
   // Portlet Registry and Entity
  @@ -213,23 +211,9 @@
                  )
   }
   
  -/* **********************************************************
  - *  Persistence Store Container                                                       
*
  - * ******************************************************** */
  -pContainer = new DefaultPersistenceStoreContainer(15000, 10000)
  -container.registerComponentInstance(PersistenceStoreContainer, pContainer)
  -pContainer.registerComponent( new ConstructorComponentAdapter(
  -											  "jetspeed", 
  -                                              PBStore, 
  -                                              doParams([cstParam("jetspeed")])
  -                                        )
  -)
  -
  -
   
   /* **********************************************************
    * Persistence Store: as a thread safe per thread component           *
  - * (will replace PersistenceStoreContainer above)                            *
    * ******************************************************** */
   
   container.registerComponent(makeThreadLocalAdapter(PersistenceStore, PBStore,  new Parameter[]{new
ConstantParameter("jetspeed")}))
  @@ -268,7 +252,7 @@
   container.registerComponentImplementation(
                         Capabilities, 
                         JetspeedCapabilities, 
  -                      doParams([cmpParam(PersistenceStoreContainer)])
  +                      doParams([cmpParam(PersistenceStore)])
   )
   
   /* **********************************************************
  
  
  
  1.5       +17 -21    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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DatabasePageManager.java	11 Mar 2004 14:08:26 -0000	1.4
  +++ DatabasePageManager.java	28 May 2004 19:53:04 -0000	1.5
  @@ -23,7 +23,6 @@
   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;
   import org.apache.jetspeed.om.page.Page;
  @@ -42,7 +41,7 @@
   public class DatabasePageManager extends AbstractPageManager implements PageManager, Startable
   {
       protected final static Log log = LogFactory.getLog(DatabasePageManager.class);
  -    private PersistenceStoreContainer pContainer;
  +    private PersistenceStore persistenceStore;
       // TODO: this should eventually use a system cach like JCS
       private Map pageCache = new HashMap();
   
  @@ -55,10 +54,10 @@
   	 * by the <code>PersistenceStoreContainer.getStoreForThread(String)</code>
   	 * method to obtain the current persistence for this thread.
   	 */
  -    public DatabasePageManager(PersistenceStoreContainer pContainer, IdGenerator generator,
String storeName)
  +    public DatabasePageManager(PersistenceStore persistenceStore, IdGenerator generator)
       {
           super(generator);
  -        this.pContainer = pContainer;
  +        this.persistenceStore = persistenceStore;
           
       }
   
  @@ -90,13 +89,12 @@
               return (Page) pageCache.get(id);
           }
           else
  -        {
  -            PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  -            Filter filter = store.newFilter();
  +        {          
  +            Filter filter = persistenceStore.newFilter();
               filter.addEqualTo("id", id);
  -            Object q = store.newQuery(pageClass, filter);
  -            store.getTransaction().begin();
  -            Page page = (Page) store.getObjectByQuery( q);
  +            Object q = persistenceStore.newQuery(pageClass, filter);
  +            persistenceStore.getTransaction().begin();
  +            Page page = (Page) persistenceStore.getObjectByQuery( q);
   
               pageCache.put(id, page);
               return page;
  @@ -141,11 +139,10 @@
       public void updatePage(Page page) throws JetspeedException, PageNotUpdatedException
       {
           try
  -        {
  -            PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  -            store.getTransaction().begin();
  -            store.lockForWrite(page);
  -            store.getTransaction().commit();
  +        {           
  +            persistenceStore.getTransaction().begin();
  +            persistenceStore.lockForWrite(page);
  +            persistenceStore.getTransaction().commit();
           }
           catch (Exception e)
           {
  @@ -165,11 +162,10 @@
               pageCache.remove(pageCache.get(page.getId()));
           }
           try
  -        {
  -            PersistenceStore store = pContainer.getStoreForThread("jetspeed");
  -            store.getTransaction().begin();
  -            store.deletePersistent(page);
  -            store.getTransaction().commit();
  +        {         
  +            persistenceStore.getTransaction().begin();
  +            persistenceStore.deletePersistent(page);
  +            persistenceStore.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