[jboss-cvs] jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer ...
Julien Viet
julien at jboss.com
Thu Aug 24 09:21:38 EDT 2006
User: julien
Date: 06/08/24 09:21:38
Modified: portlet/src/main/org/jboss/portal/portlet/state/producer
StatefulPortletInvoker.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.15 +36 -18 jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer/StatefulPortletInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StatefulPortletInvoker.java
===================================================================
RCS file: /cvsroot/jboss/jboss-portal/portlet/src/main/org/jboss/portal/portlet/state/producer/StatefulPortletInvoker.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- StatefulPortletInvoker.java 23 Aug 2006 12:55:01 -0000 1.14
+++ StatefulPortletInvoker.java 24 Aug 2006 13:21:38 -0000 1.15
@@ -34,6 +34,7 @@
import org.jboss.portal.portlet.state.AccessMode;
import org.jboss.portal.portlet.state.AbstractPropertyContext;
import org.jboss.portal.portlet.state.PropertyChange;
+import org.jboss.portal.portlet.state.DestroyCloneFailure;
import org.jboss.portal.portlet.info.PreferenceInfo;
import org.jboss.portal.portlet.info.PreferencesInfo;
import org.jboss.portal.portlet.info.PortletInfo;
@@ -42,10 +43,12 @@
import java.util.Iterator;
import java.util.Set;
+import java.util.List;
+import java.util.ArrayList;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Revision: 1.14 $
+ * @version $Revision: 1.15 $
*/
public class StatefulPortletInvoker extends AbstractJBossService implements PortletInvoker
{
@@ -372,28 +375,43 @@
}
}
- public void destroyClone(String portletId) throws PortletInvokerException
+ public List destroyClones(List portletIds) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
{
- if (portletId == null)
+ if (portletIds == null)
{
- throw new IllegalArgumentException("PortletId cannot be null");
+ throw new IllegalArgumentException("No portlet ids provided");
}
+ List result = new ArrayList();
+ for (int i = 0; i < portletIds.size(); i++)
+ {
+ final String portletId = (String)portletIds.get(i);
if (portletId.startsWith(CLONE_ID_PREFIX) == false)
{
- throw new InvalidPortletIdException("Bad portletId format " + portletId);
+ log.debug("Attempt to destroy a producer offered portlet " + portletId);
+ DestroyCloneFailure failure = new DestroyCloneFailure(portletId, "Cannot destroy POP");
+ result.add(failure);
}
+ else
+ {
try
{
stateStore.destroyState(portletId.substring(1));
}
catch (NoSuchStateException e)
{
- throw new NoSuchPortletException(e, portletId);
+ log.debug("Attempt to destroy a non existing portlet " + portletId);
+ DestroyCloneFailure failure = new DestroyCloneFailure(portletId, "Not found");
+ result.add(failure);
}
catch (InvalidStateIdException e)
{
- throw new InvalidPortletIdException(e, portletId);
+ log.debug("Attempt to destroy a non valid portlet " + portletId);
+ DestroyCloneFailure failure = new DestroyCloneFailure(portletId, "Invalid portlet id");
+ result.add(failure);
+ }
+ }
}
+ return result;
}
public PropertyMap getProperties(String portletId, Set keys) throws IllegalArgumentException, PortletInvokerException, UnsupportedOperationException
More information about the jboss-cvs-commits
mailing list