Author: julien(a)jboss.com
Date: 2008-03-12 07:15:20 -0400 (Wed, 12 Mar 2008)
New Revision: 10270
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
Log:
added notion of generic attachment on PortletInfo interface with an implementation in
ContainerPortletInfo
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-12
06:59:37 UTC (rev 10269)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-03-12
11:15:20 UTC (rev 10270)
@@ -29,6 +29,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.HashMap;
/**
* For now implementation that use the portlet container directly.
@@ -41,6 +42,9 @@
{
/** . */
+ private final Map<Class, Object> attachments;
+
+ /** . */
private final ContainerCapabilitiesInfo capabilities;
/** . */
@@ -102,6 +106,7 @@
Boolean remotable,
ResourceBundleManager bundleManager)
{
+ this.attachments = new HashMap<Class, Object>();
this.capabilities = capabilities;
this.preferences = preferences;
this.meta = meta;
@@ -138,6 +143,7 @@
ResourceBundleManager bundleManager,
Map<String, ContainerOptionInfo> options)
{
+ this.attachments = new HashMap<Class, Object>();
this.capabilities = capabilities;
this.preferences = preferences;
this.meta = meta;
@@ -156,6 +162,16 @@
this.options = options;
}
+ public <T> T getAttachment(Class<T> type)
+ {
+ return type.cast(attachments.get(type));
+ }
+
+ public <T> void setAttachment(Class<T> type, T object)
+ {
+ attachments.put(type, object);
+ }
+
public String getName()
{
return name;
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-03-12
06:59:37 UTC (rev 10269)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-03-12
11:15:20 UTC (rev 10270)
@@ -101,7 +101,26 @@
*/
Boolean isRemotable();
+ /**
+ * Return the eventing information.
+ *
+ * @return the eventing information
+ */
EventingInfo getEventing();
+ /**
+ * Returns the navigation information.
+ *
+ * @return the navigation information
+ */
NavigationInfo getNavigation();
+
+ /**
+ * Returns a generic attachment on the portlet info.
+ *
+ * @param type the parameter type
+ * @return the attachment or null
+ * @throws IllegalArgumentException if the parameter type is null
+ */
+ <T> T getAttachment(Class<T> type) throws IllegalArgumentException;
}
Show replies by date