Author: chris.laprun(a)jboss.com
Date: 2008-04-21 18:13:52 -0400 (Mon, 21 Apr 2008)
New Revision: 10679
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java
Log:
- Implemented getCache and getSecurity. getSecurity might need improvements pending
clarification of SecurityInfo contract.
- add* methods now properly create a collection even if the given collection is empty.
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-04-21
22:11:19 UTC (rev 10678)
+++
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/portlet/info/WSRPPortletInfo.java 2008-04-21
22:13:52 UTC (rev 10679)
@@ -27,6 +27,7 @@
import org.jboss.portal.WindowState;
import org.jboss.portal.common.net.media.MediaType;
import org.jboss.portal.common.util.ParameterValidation;
+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.EventingInfo;
@@ -184,12 +185,31 @@
public SecurityInfo getSecurity()
{
- throw new UnsupportedOperationException("getSecurity currently not
supported!");
+ // todo: get more details on the SecurityInfo contract...
+ return new SecurityInfo()
+ {
+ public boolean containsTransportGuarantee(TransportGuarantee
transportGuarantee)
+ {
+ return TransportGuarantee.NONE.equals(transportGuarantee);
+ }
+
+ public Set<TransportGuarantee> getTransportGuarantees()
+ {
+ return Collections.singleton(TransportGuarantee.NONE);
+ }
+ };
}
public CacheInfo getCache()
{
- throw new UnsupportedOperationException("getCache currently not
supported!");
+ return new CacheInfo()
+ {
+ public int getExpirationSecs()
+ {
+ Integer expirationCacheSeconds =
originatingProducer.getExpirationCacheSeconds();
+ return expirationCacheSeconds != null ? expirationCacheSeconds : 0;
+ }
+ };
}
public Boolean isRemotable()
@@ -512,15 +532,12 @@
if (modes != null)
{
int size = modes.size();
- if (size != 0)
+ if (this.modes == null)
{
- if (this.modes == null)
- {
- this.modes = new HashSet<ModeInfo>(size);
- }
+ this.modes = new HashSet<ModeInfo>(size);
+ }
- this.modes.addAll(modes);
- }
+ this.modes.addAll(modes);
}
}
@@ -529,15 +546,12 @@
if (windowStates != null)
{
int size = windowStates.size();
- if (size != 0)
+ if (this.windowStates == null)
{
- if (this.windowStates == null)
- {
- this.windowStates = new HashSet<WindowStateInfo>(size);
- }
+ this.windowStates = new HashSet<WindowStateInfo>(size);
+ }
- this.windowStates.addAll(windowStates);
- }
+ this.windowStates.addAll(windowStates);
}
}
@@ -546,15 +560,12 @@
if (locales != null)
{
int size = locales.size();
- if (size != 0)
+ if (this.locales == null)
{
- if (this.locales == null)
- {
- this.locales = new HashSet<Locale>(size);
- }
+ this.locales = new HashSet<Locale>(size);
+ }
- this.locales.addAll(locales);
- }
+ this.locales.addAll(locales);
}
}
}
Show replies by date