Author: chris.laprun(a)jboss.com
Date: 2008-10-02 15:16:30 -0400 (Thu, 02 Oct 2008)
New Revision: 12025
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
Log:
- JBPORTAL-2185: return empty NavigationInfo and EventingInfo instead of null as it'd
cause an NPE otherwise.
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-10-02
18:40:00 UTC (rev 12024)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-10-02
19:16:30 UTC (rev 12025)
@@ -30,10 +30,12 @@
import org.jboss.portal.portlet.TransportGuarantee;
import org.jboss.portal.portlet.info.CacheInfo;
import org.jboss.portal.portlet.info.CapabilitiesInfo;
+import org.jboss.portal.portlet.info.EventInfo;
import org.jboss.portal.portlet.info.EventingInfo;
import org.jboss.portal.portlet.info.MetaInfo;
import org.jboss.portal.portlet.info.ModeInfo;
import org.jboss.portal.portlet.info.NavigationInfo;
+import org.jboss.portal.portlet.info.ParameterInfo;
import org.jboss.portal.portlet.info.PreferenceInfo;
import org.jboss.portal.portlet.info.PreferencesInfo;
import org.jboss.portal.portlet.info.SecurityInfo;
@@ -47,6 +49,8 @@
import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
import org.jboss.portal.wsrp.core.PropertyDescription;
+import javax.xml.namespace.QName;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -109,8 +113,8 @@
WSRPCapabilitiesInfo otherCapabilities =
(WSRPCapabilitiesInfo)other.getCapabilities();
capabilities = new WSRPCapabilitiesInfo(new HashMap<MediaType,
MediaTypeInfo>(otherCapabilities.mediaTypes),
- new HashSet<ModeInfo>(otherCapabilities.modes), new
HashSet<WindowStateInfo>(otherCapabilities.windowStates),
- new HashSet<Locale>(otherCapabilities.locales));
+ new HashSet<ModeInfo>(otherCapabilities.modes), new
HashSet<WindowStateInfo>(otherCapabilities.windowStates),
+ new HashSet<Locale>(otherCapabilities.locales));
WSRPMetaInfo otherMeta = (WSRPMetaInfo)other.getMeta();
metaInfo = new WSRPMetaInfo(new HashMap<String,
org.jboss.portal.common.i18n.LocalizedString>(otherMeta.metaInfos));
@@ -158,7 +162,7 @@
{
String key = desc.getName();
prefInfos.put(key, new WSRPPreferenceInfo(key,
getPortalLocalizedStringOrNullFrom(desc.getLabel()),
- getPortalLocalizedStringOrNullFrom(desc.getHint())));
+ getPortalLocalizedStringOrNullFrom(desc.getHint())));
}
}
else
@@ -220,12 +224,41 @@
public EventingInfo getEventing()
{
- return null; // todo: implement with WSRP 2.0
+ //todo: revisit when implementing WSRP 2
+ return new EventingInfo()
+ {
+ public Map<QName, ? extends EventInfo> getProducedEvents()
+ {
+ return Collections.emptyMap();
+ }
+
+ public Map<QName, ? extends EventInfo> getConsumedEvents()
+ {
+ return Collections.emptyMap();
+ }
+ };
}
public NavigationInfo getNavigation()
{
- return null; // todo: implement with WSRP 2.0
+ //todo: revisit when implementing WSRP 2
+ return new NavigationInfo()
+ {
+ public ParameterInfo getPublicParameter(String s)
+ {
+ return null;
+ }
+
+ public ParameterInfo getPublicParameter(QName qName)
+ {
+ return null;
+ }
+
+ public Collection<? extends ParameterInfo> getPublicParameters()
+ {
+ return Collections.emptyList();
+ }
+ };
}
public <T> T getAttachment(Class<T> tClass) throws
IllegalArgumentException
@@ -352,7 +385,7 @@
if (wsrpLocalizedString != null)
{
return new
org.jboss.portal.common.i18n.LocalizedString(wsrpLocalizedString.getValue(),
- WSRPUtils.getLocale(wsrpLocalizedString.getLang()));
+ WSRPUtils.getLocale(wsrpLocalizedString.getLang()));
}
return null;
@@ -495,10 +528,10 @@
return Collections.unmodifiableSet(mimeTypeInfo.modes);
}
-
+
public ModeInfo getMode(Mode mode)
{
- for (ModeInfo info: modes)
+ for (ModeInfo info : modes)
{
if (info.getMode().equals(mode))
{
@@ -526,7 +559,7 @@
public WindowStateInfo getWindowState(WindowState windowState)
{
- for (WindowStateInfo info: windowStates)
+ for (WindowStateInfo info : windowStates)
{
if (info.getWindowState().equals(windowState))
{
@@ -535,7 +568,7 @@
}
return null;
}
-
+
public Set<Locale> getAllLocales()
{
return locales;
Show replies by date