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/components/registry/src/java/org/apache/jetspeed/components/portletentity PortletEntityAccessComponentImpl.java
Date Fri, 02 Jul 2004 13:30:24 GMT
weaver      2004/07/02 06:30:24

  Modified:    components/registry/src/java/org/apache/jetspeed/components/portletentity
                        PortletEntityAccessComponentImpl.java
  Log:
  Refactored undeployment to negate the need for PortletEntityAccessComponent to be a PersistenceStoreEventListener
  
  Revision  Changes    Path
  1.21      +22 -218   jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityAccessComponentImpl.java
  
  Index: PortletEntityAccessComponentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed-2/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityAccessComponentImpl.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- PortletEntityAccessComponentImpl.java	23 Jun 2004 18:36:52 -0000	1.20
  +++ PortletEntityAccessComponentImpl.java	2 Jul 2004 13:30:24 -0000	1.21
  @@ -15,15 +15,15 @@
    */
   package org.apache.jetspeed.components.portletentity;
   
  +import java.util.Collection;
   import java.util.HashMap;
  +import java.util.Iterator;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
   import org.apache.jetspeed.components.persistence.Storeable;
   import org.apache.jetspeed.components.persistence.store.Filter;
   import org.apache.jetspeed.components.persistence.store.PersistenceStore;
  -import org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent;
  -import org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener;
   import org.apache.jetspeed.components.persistence.store.Transaction;
   import org.apache.jetspeed.components.portletregistry.PortletRegistryComponent;
   import org.apache.jetspeed.om.common.portlet.MutablePortletEntity;
  @@ -34,7 +34,6 @@
   import org.apache.pluto.om.entity.PortletEntity;
   import org.apache.pluto.om.entity.PortletEntityCtrl;
   import org.apache.pluto.om.portlet.PortletDefinition;
  -import org.picocontainer.Startable;
   
   /**
    * <p>
  @@ -45,7 +44,7 @@
    * @version $Id$
    *
    */
  -public class PortletEntityAccessComponentImpl implements PortletEntityAccessComponent,
PersistenceStoreEventListener, Startable
  +public class PortletEntityAccessComponentImpl implements PortletEntityAccessComponent
   {
       protected final static Log log = LogFactory.getLog(PortletEntityAccessComponentImpl.class);
   
  @@ -287,6 +286,24 @@
            }
   
       }
  +    
  +    public Collection getPortletEntities(PortletDefinition portletDefinition)
  +    {
  +        prepareTransaction(persistenceStore);
  +        Filter filter = persistenceStore.newFilter();
  +        filter.addEqualTo("portletId", new Long(portletDefinition.getId().toString()));
  +        return persistenceStore.getCollectionByQuery(persistenceStore.newQuery(PortletEntityImpl.class,
filter));        
  +    }
  +    
  +    public void removePortletEntities(PortletDefinition portletDefinition) throws PortletEntityNotDeletedException
  +    {
  +        Iterator entities = getPortletEntities(portletDefinition).iterator();
  +        while(entities.hasNext())
  +        {
  +            PortletEntity entity = (PortletEntity) entities.next();
  +            removePortletEntity(entity);
  +        }
  +    }
   
       
       private void autoCreateEntityId(PortletEntity realEntity, PersistenceStore store)
  @@ -323,218 +340,5 @@
       {
           return persistenceStore;
       }
  -    /**
  -     * <p>
  -     * afterClose
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener#afterClose(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void afterClose( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * afterDeletePersistent
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener#afterDeletePersistent(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void afterDeletePersistent( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * afterLookup
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener#afterLookup(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void afterLookup( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * afterMakePersistent
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener#afterMakePersistent(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void afterMakePersistent( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * beforeClose
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener#beforeClose(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void beforeClose( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
   
  -    }
  -    /**
  -     * <p>
  -     * beforeDeletePersistent
  -     * </p>
  -     * Removes the entity being deleted from the internal entity cache.
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener#beforeDeletePersistent(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void beforeDeletePersistent( PersistenceStoreEvent event )
  -    {
  -        Object target = event.getTarget();
  -        if(target != null && target instanceof MutablePortletEntity)
  -        {
  -            MutablePortletEntity entity = (MutablePortletEntity) target;
  -            removeFromCache(entity);            
  -        }
  -
  -    }
  -    /**
  -     * <p>
  -     * beforeLookup
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener#beforeLookup(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void beforeLookup( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * beforeMakePersistent
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.PersistenceStoreEventListener#beforeMakePersistent(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void beforeMakePersistent( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * afterBegin
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.TransactionEventListener#afterBegin(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void afterBegin( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * afterCommit
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.TransactionEventListener#afterCommit(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void afterCommit( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * afterRollback
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.TransactionEventListener#afterRollback(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void afterRollback( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * beforeBegin
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.TransactionEventListener#beforeBegin(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void beforeBegin( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * beforeCommit
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.TransactionEventListener#beforeCommit(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void beforeCommit( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * beforeRollback
  -     * </p>
  -     *
  -     * @see org.apache.jetspeed.components.persistence.store.TransactionEventListener#beforeRollback(org.apache.jetspeed.components.persistence.store.PersistenceStoreEvent)
  -     * @param event
  -     */
  -    public void beforeRollback( PersistenceStoreEvent event )
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
  -    /**
  -     * <p>
  -     * start
  -     * </p>
  -     *
  -     * @see org.picocontainer.Startable#start()
  -     * 
  -     */
  -    public void start()
  -    {
  -        persistenceStore.addEventListener(this);
  -
  -    }
  -    /**
  -     * <p>
  -     * stop
  -     * </p>
  -     *
  -     * @see org.picocontainer.Startable#stop()
  -     * 
  -     */
  -    public void stop()
  -    {
  -        // TODO Auto-generated method stub
  -
  -    }
   }
  
  
  

---------------------------------------------------------------------
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