Author: chris.laprun(a)jboss.com
Date: 2010-01-20 06:12:45 -0500 (Wed, 20 Jan 2010)
New Revision: 1391
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/ListAccessImpl.java
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/ActivatingFederatingPortletInvoker.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerOverview.java
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpRegistrationDetails.java
Log:
- Improved ListAccessImpl's error handling.
- Use ListAccessImpl.
Modified:
portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/ListAccessImpl.java
===================================================================
---
portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/ListAccessImpl.java 2010-01-20
09:33:19 UTC (rev 1390)
+++
portal/trunk/component/common/src/main/java/org/exoplatform/commons/utils/ListAccessImpl.java 2010-01-20
11:12:45 UTC (rev 1391)
@@ -19,6 +19,8 @@
package org.exoplatform.commons.utils;
+import org.gatein.common.util.ParameterValidation;
+
import java.io.Serializable;
import java.lang.reflect.Array;
import java.util.List;
@@ -38,14 +40,8 @@
public ListAccessImpl(Class<E> elementType, List<E> list)
{
- if (elementType == null)
- {
- throw new NullPointerException();
- }
- if (list == null)
- {
- throw new NullPointerException();
- }
+ ParameterValidation.throwIllegalArgExceptionIfNull(elementType, "element
type");
+ ParameterValidation.throwIllegalArgExceptionIfNull(list, "elements");
this.elementType = elementType;
this.list = list;
}
Modified:
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/ActivatingFederatingPortletInvoker.java
===================================================================
---
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/ActivatingFederatingPortletInvoker.java 2010-01-20
09:33:19 UTC (rev 1390)
+++
portal/trunk/component/wsrp/src/main/java/org/gatein/portal/wsrp/ActivatingFederatingPortletInvoker.java 2010-01-20
11:12:45 UTC (rev 1391)
@@ -53,6 +53,8 @@
* TODO: This is a fork of the FederatingPortletInvokerService in the PC module to avoid
having to create a new release.
* Once PC 2.1.0.CR03 or above is release, revisit and clean up. The only thing that is
really needed here is a
* different implementation of {@link
#getFederatedPortletInvokerFor(org.gatein.pc.api.PortletContext)}.
+ * <p/>
+ * - Move to WSRP module - Update with new NullInvokerHandler capability
*
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision$
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java 2010-01-20
09:33:19 UTC (rev 1390)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerEditor.java 2010-01-20
11:12:45 UTC (rev 1391)
@@ -23,6 +23,7 @@
package org.exoplatform.wsrp.webui.component.consumer;
import org.exoplatform.commons.utils.LazyPageList;
+import org.exoplatform.commons.utils.ListAccessImpl;
import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.web.application.ApplicationMessage;
@@ -161,7 +162,7 @@
popup.setShow(false);
//temp way to refresh list, should call broadcast event (below)
- LazyPageList pageList =
consumerOverview.createPageList(consumerOverview.getConfiguredConsumers());
+ LazyPageList pageList = new LazyPageList<WSRPConsumer>(new
ListAccessImpl<WSRPConsumer>(WSRPConsumer.class,
consumerOverview.getConfiguredConsumers()), 10);
UIGrid uiGrid = consumerOverview.getChild(UIGrid.class);
uiGrid.getUIPageIterator().setPageList(pageList);
//uiGrid.configure()
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerOverview.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerOverview.java 2010-01-20
09:33:19 UTC (rev 1390)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/consumer/UIWsrpConsumerOverview.java 2010-01-20
11:12:45 UTC (rev 1391)
@@ -23,7 +23,7 @@
package org.exoplatform.wsrp.webui.component.consumer;
import org.exoplatform.commons.utils.LazyPageList;
-import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.commons.utils.ListAccessImpl;
import org.exoplatform.container.ExoContainerContext;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.config.annotation.ComponentConfig;
@@ -70,52 +70,11 @@
private UIPopupWindow consumerEditorPopup;
private UIPageIterator consumersIterator;
- public List getConfiguredConsumers() throws Exception
+ public List<WSRPConsumer> getConfiguredConsumers() throws Exception
{
return controller.getConfiguredConsumers();
}
- public LazyPageList createPageList(final List pageList)
- {
- return new LazyPageList<WSRPConsumer>(new ListAccess<WSRPConsumer>()
- {
-
- public int getSize() throws Exception
- {
- return pageList.size();
- }
-
- public WSRPConsumer[] load(int index, int length) throws Exception
- {
- WSRPConsumer[] pcs = new WSRPConsumer[pageList.size()];
-
- if (index < 0)
- {
- throw new IllegalArgumentException("Illegal index: index must be a
positive number");
- }
-
- if (length < 0)
- {
- throw new IllegalArgumentException("Illegal length: length must be a
positive number");
- }
-
- if (index + length > pageList.size())
- {
- throw new IllegalArgumentException(
- "Illegal index or length: sum of the index and the length cannot
be greater than the list size");
- }
-
- for (int i = 0; i < length; i++)
- {
- pcs[i] = (WSRPConsumer)pageList.get(i + index);
- }
-
- return pcs;
- }
-
- }, 10);
- }
-
public UIWsrpConsumerOverview() throws Exception
{
// controller
@@ -159,7 +118,8 @@
private void refreshConsumersList() throws Exception
{
- LazyPageList pageList = createPageList(getConfiguredConsumers());
+ List<WSRPConsumer> consumers = getConfiguredConsumers();
+ LazyPageList pageList = new LazyPageList<WSRPConsumer>(new
ListAccessImpl<WSRPConsumer>(WSRPConsumer.class, consumers), 10);
consumersIterator.setPageList(pageList);
}
Modified:
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpRegistrationDetails.java
===================================================================
---
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpRegistrationDetails.java 2010-01-20
09:33:19 UTC (rev 1390)
+++
portal/trunk/portlet/exoadmin/src/main/java/org/exoplatform/wsrp/webui/component/producer/UIWsrpRegistrationDetails.java 2010-01-20
11:12:45 UTC (rev 1391)
@@ -25,6 +25,7 @@
import org.exoplatform.commons.utils.LazyPageList;
import org.exoplatform.commons.utils.ListAccess;
+import org.exoplatform.commons.utils.ListAccessImpl;
import org.exoplatform.portal.webui.util.Util;
import org.exoplatform.web.application.ApplicationMessage;
import org.exoplatform.webui.application.WebuiRequestContext;
@@ -150,7 +151,9 @@
// registration properties
Map<QName, RegistrationPropertyDescription> regProps =
registrationRequirements.getRegistrationProperties();
-
registrationProperties.getUIPageIterator().setPageList(createPageList(getPropertyList(regProps)));
+ List<RegistrationPropertyDescription> descriptions =
getPropertyList(regProps);
+ ListAccess<RegistrationPropertyDescription> listAccess = new
ListAccessImpl<RegistrationPropertyDescription>(RegistrationPropertyDescription.class,
descriptions);
+ registrationProperties.getUIPageIterator().setPageList(new
LazyPageList<RegistrationPropertyDescription>(listAccess, 10));
}
ProducerConfigurationService getService()
@@ -173,47 +176,6 @@
return result;
}
- private LazyPageList<RegistrationPropertyDescription> createPageList(final
List<RegistrationPropertyDescription> pageList)
- {
- return new LazyPageList<RegistrationPropertyDescription>(new
ListAccess<RegistrationPropertyDescription>()
- {
-
- public int getSize() throws Exception
- {
- return pageList.size();
- }
-
- public RegistrationPropertyDescription[] load(int index, int length) throws
Exception, IllegalArgumentException
- {
- RegistrationPropertyDescription[] pcs = new
RegistrationPropertyDescription[pageList.size()];
-
- if (index < 0)
- {
- throw new IllegalArgumentException("Illegal index: index must be a
positive number");
- }
-
- if (length < 0)
- {
- throw new IllegalArgumentException("Illegal length: length must be a
positive number");
- }
-
- if (index + length > pageList.size())
- {
- throw new IllegalArgumentException(
- "Illegal index or length: sum of the index and the length cannot
be greater than the list size");
- }
-
- for (int i = 0; i < length; i++)
- {
- pcs[i] = pageList.get(i + index);
- }
-
- return pcs;
- }
-
- }, 10);
- }
-
@Override
public void processRender(WebuiRequestContext context) throws Exception
{
Show replies by date