[jboss-cvs] jboss-portal/federation/src/main/org/jboss/portal/federation/impl ...

Julien Viet julien at jboss.com
Thu Aug 24 09:21:37 EDT 2006


  User: julien  
  Date: 06/08/24 09:21:37

  Modified:    federation/src/main/org/jboss/portal/federation/impl  
                        FederatedPortletInvokerService.java
                        FederatingPortletInvokerService.java
  Log:
  updated the implementation of destroyClone to now destroy a list of ids and return the list of non destroyed ids. updated the InstanceContainer accordingly
  
  Revision  Changes    Path
  1.8       +21 -4     jboss-portal/federation/src/main/org/jboss/portal/federation/impl/FederatedPortletInvokerService.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FederatedPortletInvokerService.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-portal/federation/src/main/org/jboss/portal/federation/impl/FederatedPortletInvokerService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -b -r1.7 -r1.8
  --- FederatedPortletInvokerService.java	23 Aug 2006 12:55:00 -0000	1.7
  +++ FederatedPortletInvokerService.java	24 Aug 2006 13:21:37 -0000	1.8
  @@ -37,10 +37,13 @@
   import java.util.Iterator;
   import java.util.LinkedHashSet;
   import java.util.Set;
  +import java.util.List;
  +import java.util.Collections;
  +import java.util.ArrayList;
   
   /**
    * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
  - * @version $Revision: 1.7 $
  + * @version $Revision: 1.8 $
    * @since 2.4
    */
   public class FederatedPortletInvokerService implements FederatedPortletInvoker
  @@ -152,10 +155,24 @@
         return id + FederatingPortletInvokerService.SEPARATOR + portletInvoker.createClone(portletId);
      }
   
  -   public void destroyClone(String compoundPortletId) throws PortletInvokerException
  +   public List destroyClones(List portletIds) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
      {
  +      if (portletIds == null)
  +      {
  +         throw new IllegalArgumentException("Null portlet id list not accepted");
  +      }
  +      if (portletIds.size() == 0)
  +      {
  +         return Collections.EMPTY_LIST;
  +      }
  +      List dereferencedList = new ArrayList(portletIds);
  +      for (int i = 0; i < dereferencedList.size(); i++)
  +      {
  +         String compoundPortletId = (String)dereferencedList.get(i);
         String portletId = getPortletIdFrom(compoundPortletId);
  -      portletInvoker.destroyClone(portletId);
  +         dereferencedList.set(i, portletId);
  +      }
  +      return portletInvoker.destroyClones(portletIds);
      }
   
      public PropertyMap getProperties(String compoundPortletId) throws PortletInvokerException
  
  
  
  1.6       +31 -4     jboss-portal/federation/src/main/org/jboss/portal/federation/impl/FederatingPortletInvokerService.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: FederatingPortletInvokerService.java
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-portal/federation/src/main/org/jboss/portal/federation/impl/FederatingPortletInvokerService.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- FederatingPortletInvokerService.java	23 Aug 2006 12:55:00 -0000	1.5
  +++ FederatingPortletInvokerService.java	24 Aug 2006 13:21:37 -0000	1.6
  @@ -39,11 +39,13 @@
   import java.util.Map;
   import java.util.Set;
   import java.util.Collection;
  +import java.util.List;
  +import java.util.Collections;
   
   /**
    * @author <a href="mailto:julien at jboss.org">Julien Viet</a>
    * @author <a href="mailto:chris.laprun at jboss.com">Chris Laprun</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    * @since 2.4
    */
   public class FederatingPortletInvokerService extends AbstractJBossService implements FederatingPortletInvoker
  @@ -162,10 +164,35 @@
         return federated.createClone(compoundPortletId);
      }
   
  -   public void destroyClone(String compoundPortletId) throws PortletInvokerException
  +   public List destroyClones(List portletIds) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
      {
  +      if (portletIds == null)
  +      {
  +         throw new IllegalArgumentException("No null list accepted");
  +      }
  +      if (portletIds.size() == 0)
  +      {
  +         return Collections.EMPTY_LIST;
  +      }
  +
  +      // Get the invoker and check that we address only one invoker (for now)
  +      FederatedPortletInvoker invoker = null;
  +      for (int i = 0; i < portletIds.size(); i++)
  +      {
  +         String compoundPortletId = (String)portletIds.get(i);
         FederatedPortletInvoker federated = getFederatedPortletInvokerFor(compoundPortletId);
  -      federated.destroyClone(compoundPortletId);
  +         if (invoker == null)
  +         {
  +            invoker = federated;
  +         }
  +         else if (invoker.equals(federated) == false)
  +         {
  +            throw new PortletInvokerException("Cannot destroy portlet lists that requires more than one federated invoker");
  +         }
  +      }
  +
  +      //
  +      return invoker.destroyClones(portletIds);
      }
   
      public PropertyMap getProperties(String compoundPortletId, Set keys) throws PortletInvokerException
  
  
  



More information about the jboss-cvs-commits mailing list