Author: julien(a)jboss.com
Date: 2008-01-11 11:23:48 -0500 (Fri, 11 Jan 2008)
New Revision: 9484
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilderContext.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerTypeInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ContainerInfoBuilderContextImpl.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/TypeInfo.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventInfoSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/TypeInfoSupport.java
Removed:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfoBuilder.java
Modified:
modules/portlet/trunk/federation/src/test/java/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
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/jsr168/PortletContainerImpl.java
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/support/info/PortletInfoSupport.java
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/PortletInvokerSupport.java
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
Log:
- preliminary implemenation for portlet event runtime info
- now ContainerPortletInfoBuilder has been renamed ContainerInfoBuilder and build the info
of all portlet containers
- introduced ContainerInfoBuilderContext which provides the necessary callbacks for using
a ContainerInfoBuilder
Modified:
modules/portlet/trunk/federation/src/test/java/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java
===================================================================
---
modules/portlet/trunk/federation/src/test/java/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java 2008-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/federation/src/test/java/org/jboss/portal/test/portlet/federation/FederatingPortletInvokerTestCase.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -75,7 +75,7 @@
// Configure
PortletInfoSupport fooInfo = federatedPortlet.getInfoSupport();
- fooInfo.getMetaSupport().setDisplayName("FooPortlet");
+ fooInfo.getMeta().setDisplayName("FooPortlet");
// Wire
federatedInvoker.addInternalPortlet("MyPortlet", federatedPortlet);
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2008-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/container/PortletApplicationContextImpl.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -28,17 +28,14 @@
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
+import org.jboss.portal.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletInfoFactory;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.info.ContainerPortletInfoBuilder;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilder;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilderContext;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
-import org.jboss.portal.portlet.metadata.JBossPortletMetaData;
-import org.jboss.portal.common.i18n.ResourceBundleFactory;
-import org.jboss.portal.common.i18n.SimpleResourceBundleFactory;
-import org.jboss.portal.common.i18n.ResourceBundleManager;
import javax.servlet.ServletContext;
@@ -110,8 +107,13 @@
//
registrationContext = registry.registerPortletApplication(portletApp);
+ // Fixme here need the web App
+ ContainerInfoBuilderContext builderContext = new
ContainerInfoBuilderContextImpl(portletAppMD, null);
+ ContainerInfoBuilder builder = new ContainerInfoBuilder(portletAppMD,
builderContext);
+ builder.build();
+
//
- for (PortletMetaData portletMD : portletAppMD.getPortlets().values())
+ for (ContainerPortletInfo containerInfo : builder.getContainerInfos())
{
// JBossPortletMetaData jBossPortletMD = null;
// if (jbossAppMD != null)
@@ -119,16 +121,9 @@
// jBossPortletMD =
(JBossPortletMetaData)jbossAppMD.getPortlets().get(portletMD.getName());
// }
- // Create resource bundle manager
- String baseName = portletMD.getResourceBundle();
- ResourceBundleFactory rbf = new SimpleResourceBundleFactory(baseName,
classLoader);
- ResourceBundleManager bundleMgr = new ResourceBundleManager(null, rbf);
- // Build container info
- ContainerPortletInfo containerInfo = new ContainerPortletInfoBuilder(portletMD,
bundleMgr).build();
-
//
- PortletContainerImpl container = new PortletContainerImpl(containerInfo,
bundleMgr);
+ PortletContainerImpl container = new PortletContainerImpl(containerInfo);
//
container.setApplication(portletApp);
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventInfo.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventInfo.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,97 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.portlet.info.EventInfo;
+import org.jboss.portal.common.i18n.LocalizedString;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+import java.util.Collection;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerEventInfo implements EventInfo
+{
+
+ /** . */
+ private QName name;
+
+ /** . */
+ private ContainerTypeInfo type;
+
+ /** . */
+ private LocalizedString displayName;
+
+ /** . */
+ private LocalizedString description;
+
+ /** . */
+ private List<QName> aliases;
+
+ public ContainerEventInfo(
+ QName name,
+ ContainerTypeInfo type,
+ LocalizedString displayName,
+ LocalizedString description)
+ {
+ this.name = name;
+ this.type = type;
+ this.displayName = displayName;
+ this.description = description;
+ this.aliases = new ArrayList<QName>();
+ }
+
+ public void addAlias(QName alias)
+ {
+ aliases.add(alias);
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public ContainerTypeInfo getType()
+ {
+ return type;
+ }
+
+ public Collection<QName> getAliases()
+ {
+ return aliases;
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerEventsInfo.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.portlet.info.EventsInfo;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerEventsInfo implements EventsInfo
+{
+
+ /** . */
+ private final List<ContainerEventInfo> producedEvents;
+
+ /** . */
+ private final List<ContainerEventInfo> consumedEvents;
+
+ public ContainerEventsInfo()
+ {
+ producedEvents = new ArrayList<ContainerEventInfo>();
+ consumedEvents = new ArrayList<ContainerEventInfo>();
+ }
+
+ public void addProducedEvent(ContainerEventInfo producedEvent)
+ {
+ producedEvents.add(producedEvent);
+ }
+
+ public void addConsumedEvent(ContainerEventInfo consumedEvent)
+ {
+ consumedEvents.add(consumedEvent);
+ }
+
+ public Collection<ContainerEventInfo> getProducedEvents()
+ {
+ return producedEvents;
+ }
+
+ public Collection<ContainerEventInfo> getConsumedEvents()
+ {
+ return consumedEvents;
+ }
+}
Copied:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
(from rev 9481,
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfoBuilder.java)
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilder.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,482 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportedLocaleMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SupportsMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletModeMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.SecurityRoleRefMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.WindowStateMetaData;
+import org.jboss.portal.portlet.impl.metadata.security.SecurityConstraintMetaData;
+import org.jboss.portal.portlet.impl.metadata.common.InitParamMetaData;
+import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionReferenceMetaData;
+import org.jboss.portal.portlet.impl.metadata.event.EventDefinitionMetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.info.MetaInfo;
+import org.jboss.portal.common.value.Value;
+import org.jboss.portal.common.value.StringValue;
+import org.jboss.portal.common.i18n.LocalizedString;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+import org.jboss.portal.Mode;
+
+import javax.xml.namespace.QName;
+import java.util.Locale;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.List;
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerInfoBuilder
+{
+
+ /** . */
+ private static final String[] KEYS = {MetaInfo.TITLE, MetaInfo.SHORT_TITLE,
MetaInfo.KEYWORDS};
+
+ /** . */
+ private static final String JAVAX_PORTLET = "javax.portlet.";
+
+ /** . */
+ private static final String[] BUNDLE_KEYS = {JAVAX_PORTLET + MetaInfo.TITLE,
JAVAX_PORTLET + MetaInfo.SHORT_TITLE, JAVAX_PORTLET + MetaInfo.KEYWORDS};
+
+ /** . */
+ private final PortletApplication10MetaData portletApplicationMD;
+
+ /** . */
+ private final ContainerInfoBuilderContext context;
+
+ /** . */
+ private final List<ContainerPortletInfo> containerInfos;
+
+ /** . */
+ private final Map<QName, ContainerEventInfo> events;
+
+ public ContainerInfoBuilder(
+ PortletApplication10MetaData portletApplicationMD,
+ ContainerInfoBuilderContext context)
+ {
+ this.portletApplicationMD = portletApplicationMD;
+ this.context = context;
+ this.containerInfos = new ArrayList<ContainerPortletInfo>();
+ this.events = new HashMap<QName, ContainerEventInfo>();
+ }
+
+ public List<ContainerPortletInfo> getContainerInfos()
+ {
+ return containerInfos;
+ }
+
+ private void fixMetaData()
+ {
+ if (portletApplicationMD instanceof PortletApplication20MetaData)
+ {
+ PortletApplication20MetaData tmp =
(PortletApplication20MetaData)portletApplicationMD;
+ if (tmp.getEvents() == null)
+ {
+ tmp.setEvents(new ArrayList<EventDefinitionMetaData>());
+ }
+ }
+ }
+
+ private void fixMetaData(PortletMetaData portletMD)
+ {
+ if (portletMD.getSecurityRoleRef() == null)
+ {
+ portletMD.setSecurityRoleRef(new ArrayList<SecurityRoleRefMetaData>());
+ }
+ if (portletMD.getPortletApplication().getSecurityConstraints() == null)
+ {
+ portletMD.getPortletApplication().setSecurityConstraints(new
ArrayList<SecurityConstraintMetaData>());
+ }
+ if (portletMD.getSupportedLocale() == null)
+ {
+ portletMD.setSupportedLocale(new ArrayList<SupportedLocaleMetaData>());
+ }
+ for (SupportsMetaData supportsMD : portletMD.getSupports())
+ {
+ if (supportsMD.getPortletModes() == null)
+ {
+ supportsMD.setPortletModes(new ArrayList<PortletModeMetaData>());
+ }
+ if (supportsMD.getWindowStates() == null)
+ {
+ supportsMD.setWindowStates(new ArrayList<WindowStateMetaData>());
+ }
+ }
+ if (portletMD.getPortletPreferences() == null)
+ {
+ portletMD.setPortletPreferences(new PortletPreferencesMetaData());
+ }
+ if (portletMD.getPortletPreferences().getPortletPreferences() == null)
+ {
+ portletMD.getPortletPreferences().setPortletPreferences(new HashMap<String,
PortletPreferenceMetaData>());
+ }
+ if (portletMD.getInitParams() == null)
+ {
+ portletMD.setInitParams(new ArrayList<InitParamMetaData>());
+ }
+ for (PortletPreferenceMetaData portletPreferenceMD :
portletMD.getPortletPreferences().getPortletPreferences().values())
+ {
+ if (portletPreferenceMD.getValue() == null)
+ {
+ portletPreferenceMD.setValue(new ArrayList<String>());
+ }
+ }
+
+ //
+ if (portletApplicationMD instanceof PortletApplication20MetaData)
+ {
+ if (portletMD.getSupportedProcessingEvent() == null)
+ {
+ portletMD.setSupportedProcessingEvent(new
ArrayList<EventDefinitionReferenceMetaData>());
+ }
+ if (portletMD.getSupportedPublishingEvent() == null)
+ {
+ portletMD.setSupportedPublishingEvent(new
ArrayList<EventDefinitionReferenceMetaData>());
+ }
+ }
+ }
+
+ private QName getName(QName name, String localPart)
+ {
+ if (name == null)
+ {
+ String namespaceURI =
((PortletApplication20MetaData)portletApplicationMD).getDefaultNamespace().toString();
+ return new QName(namespaceURI, localPart);
+ }
+ else
+ {
+ return name;
+ }
+ }
+
+ private List<Locale> getSupportedLocales(PortletMetaData portletMD)
+ {
+ List<Locale> locales = new ArrayList<Locale>();
+ for (SupportedLocaleMetaData supportedLocaleMD : portletMD.getSupportedLocale())
+ {
+ Locale locale = supportedLocaleMD.getLocale();
+ locales.add(locale);
+ }
+ return locales;
+ }
+
+ public void build()
+ {
+ fixMetaData();
+
+ //
+ if (portletApplicationMD instanceof PortletApplication20MetaData)
+ {
+ PortletApplication20MetaData tmp =
(PortletApplication20MetaData)portletApplicationMD;
+
+ //
+ for (EventDefinitionMetaData eventDefinitionMD : tmp.getEvents())
+ {
+ ContainerEventInfo event = build(eventDefinitionMD);
+ events.put(event.getName(), event);
+ }
+ }
+
+ //
+ for (PortletMetaData portletMD : portletApplicationMD.getPortletCollection())
+ {
+ ContainerPortletInfo portletInfo = build(portletMD);
+ containerInfos.add(portletInfo);
+ }
+ }
+
+ private ContainerEventInfo build(EventDefinitionMetaData eventDefinitionMD)
+ {
+ QName name = getName(eventDefinitionMD.getQname(), eventDefinitionMD.getName());
+ ResourceBundleManager bundleMgr = context.getBundleManager();
+
+ //
+ String valueType = eventDefinitionMD.getValueType();
+ Class clazz = context.getClass(valueType);
+
+ //
+ LocalizedString displayName =
bundleMgr.getLocalizedValue("javax.portlet.app.event-definition.." + name +
".display-name", "Event " + name);
+ LocalizedString description =
bundleMgr.getLocalizedValue("javax.portlet.app.event-definition." + name +
".description", "Description of event " + name);
+
+ //
+ ContainerTypeInfo type = new ContainerTypeInfo(clazz);
+ return new ContainerEventInfo(name, type, displayName, description);
+ }
+
+ private ContainerPortletInfo build(PortletMetaData portletMD)
+ {
+ fixMetaData(portletMD);
+
+ //
+ ContainerCapabilitiesInfo containerCapabilities =
buildContainerCapabilities(portletMD);
+ ContainerPreferencesInfo containerPreferences =
buildContainerPreferences(portletMD);
+ ContainerMetaInfo containerMeta = buildContainerMeta(portletMD);
+ ContainerSecurityInfo containerSecurity = buildContainerSecurityInfo(portletMD);
+ ContainerCacheInfo containerCache = buildContainerCache(portletMD);
+ ContainerSessionInfo containerSession = buildContainerSession(portletMD);
+
+ //
+ ContainerPortletInfo containerPortletInfo;
+ if (portletApplicationMD instanceof PortletApplication20MetaData)
+ {
+ ContainerEventsInfo containerEvents = buildContainerEventsInfo(portletMD);
+
+ //
+ containerPortletInfo = new ContainerPortletInfo(
+ containerCapabilities,
+ containerPreferences,
+ containerMeta,
+ containerSecurity,
+ containerCache,
+ containerSession,
+ containerEvents,
+ portletMD.getPortletName(),
+ portletMD.getPortletClass(),
+ false,
+ context.getBundleManager(portletMD)
+ );
+ }
+ else
+ {
+ containerPortletInfo = new ContainerPortletInfo(
+ containerCapabilities,
+ containerPreferences,
+ containerMeta,
+ containerSecurity,
+ containerCache,
+ containerSession,
+ portletMD.getPortletName(),
+ portletMD.getPortletClass(),
+ false,
+ context.getBundleManager(portletMD)
+ );
+ }
+
+ //
+ for (InitParamMetaData initParamMD : portletMD.getInitParams())
+ {
+ containerPortletInfo.addInitParameter(initParamMD.getName(),
initParamMD.getValue());
+ }
+
+ //
+ return containerPortletInfo;
+ }
+
+ private ContainerEventsInfo buildContainerEventsInfo(PortletMetaData portletMD)
+ {
+ ContainerEventsInfo portletEvents = new ContainerEventsInfo();
+
+ //
+ for (EventDefinitionReferenceMetaData eventDefinitionReferenceMD :
portletMD.getSupportedProcessingEvent())
+ {
+ QName name = getName(eventDefinitionReferenceMD.getQname(),
eventDefinitionReferenceMD.getName());
+ ContainerEventInfo event = events.get(name);
+ portletEvents.addConsumedEvent(event);
+ }
+
+ //
+ for (EventDefinitionReferenceMetaData eventDefinitionReferenceMD :
portletMD.getSupportedPublishingEvent())
+ {
+ QName name = getName(eventDefinitionReferenceMD.getQname(),
eventDefinitionReferenceMD.getName());
+ ContainerEventInfo event = events.get(name);
+ portletEvents.addProducedEvent(event);
+ }
+
+ //
+ return portletEvents;
+ }
+
+ private ContainerSecurityInfo buildContainerSecurityInfo(PortletMetaData portletMD)
+ {
+ ContainerSecurityInfo containerSecurity = new ContainerSecurityInfo();
+
+ // Security role ref
+ for (SecurityRoleRefMetaData securityRoleRefMD : portletMD.getSecurityRoleRef())
+ {
+ containerSecurity.addRoleRef(securityRoleRefMD.getRoleName(),
securityRoleRefMD.getRoleLink());
+ }
+
+ //
+ for (SecurityConstraintMetaData securityConstraintMD :
portletMD.getPortletApplication().getSecurityConstraints())
+ {
+ if
(securityConstraintMD.getPortletList().getPortletNames().contains(portletMD.getPortletName()))
+ {
+
containerSecurity.addTransportGuarantee(securityConstraintMD.getUserDataConstraint().getTransportQuarantee());
+ }
+ }
+
+ //
+ return containerSecurity;
+ }
+
+ private ContainerSessionInfo buildContainerSession(PortletMetaData portletMD)
+ {
+ return new ContainerSessionInfo(false);
+ }
+
+ private ContainerCacheInfo buildContainerCache(PortletMetaData portletMD)
+ {
+ int expirationCache = portletMD.getExpirationCache();
+
+ //
+ if (expirationCache < 0 && expirationCache != -1)
+ {
+ // log.warn("Seen bad caching expiration value " + expirationTimeSecs
+ " disable caching instead");
+ expirationCache = 0;
+ }
+
+ //
+ return new ContainerCacheInfo(expirationCache);
+ }
+
+ private ContainerCapabilitiesInfo buildContainerCapabilities(PortletMetaData
portletMD)
+ {
+ ContainerCapabilitiesInfo capabilities = new ContainerCapabilitiesInfo();
+
+ //
+ for (SupportsMetaData supportsMD : portletMD.getSupports())
+ {
+ // Get the mime type
+ String mimeType = supportsMD.getMimeType().toLowerCase();
+
+ // Add the content type to the view mode
+ // because each content type must handle this view
+ capabilities.add(mimeType, Mode.VIEW);
+
+ // Then process each mode
+ for (PortletModeMetaData modeMD : supportsMD.getPortletModes())
+ {
+ capabilities.add(mimeType, modeMD.getPortletMode());
+ }
+ }
+
+ //
+ return capabilities;
+ }
+
+ private ContainerMetaInfo buildContainerMeta(PortletMetaData portletMD)
+ {
+ ContainerMetaInfo containerMeta = new ContainerMetaInfo();
+
+ //
+ ResourceBundleManager bundleMgr = context.getBundleManager(portletMD);
+
+ // Capture inline values
+ String[] inlines = {
+ portletMD.getPortletInfo().getTitle(),
+ portletMD.getPortletInfo().getShortTitle(),
+ portletMD.getPortletInfo().getKeywords()
+ };
+
+ // Construct info from resource bundle manager
+ for (int i = 0; i < KEYS.length; i++)
+ {
+ String key = KEYS[i];
+
+ //
+ Map<Locale, String> tmp = new HashMap<Locale, String>();
+
+ //
+ List<Locale> locales = getSupportedLocales(portletMD);
+
+ // Add english locale
+ locales.add(Locale.ENGLISH);
+
+ // Feed with the known locales (perhaps should try more locales)
+ for (Locale locale : locales)
+ {
+ ResourceBundle bundle = bundleMgr.getResourceBundle(locale);
+
+ //
+ if (bundle != null)
+ {
+ try
+ {
+ String value = bundle.getString(BUNDLE_KEYS[i]);
+ tmp.put(locale, value);
+ }
+ catch (MissingResourceException ignore)
+ {
+ }
+ }
+ }
+
+ // Add the inline value if it is present
+ if (inlines[i] != null)
+ {
+ tmp.put(Locale.ENGLISH, inlines[i]);
+ }
+
+ //
+ LocalizedString ls = new LocalizedString(tmp, Locale.ENGLISH);
+ containerMeta.addMetaValue(key, ls);
+ }
+
+ // Add stuff coming from deployment descriptor
+ containerMeta.addMetaValue(MetaInfo.DESCRIPTION, portletMD.getDescription());
+ containerMeta.addMetaValue(MetaInfo.DISPLAY_NAME, portletMD.getDisplayName());
+
+ //
+ return containerMeta;
+ }
+
+ private ContainerPreferencesInfo buildContainerPreferences(PortletMetaData portletMD)
+ {
+ PortletPreferencesMetaData preferencesMD = portletMD.getPortletPreferences();
+
+ //
+ String validatorClassName = null;
+ if (preferencesMD != null)
+ {
+ validatorClassName = preferencesMD.getPreferenceValidator();
+ }
+
+ //
+ ContainerPreferencesInfo containerPreferences = new
ContainerPreferencesInfo(validatorClassName);
+
+ //
+ ResourceBundleManager bundleMgr = context.getBundleManager(portletMD);
+
+ //
+ for (PortletPreferenceMetaData portletPreferenceMD :
preferencesMD.getPortletPreferences().values())
+ {
+ Value value = new StringValue(portletPreferenceMD.getValue());
+ LocalizedString displayName =
bundleMgr.getLocalizedValue("javax.portlet.preference.name." +
portletPreferenceMD.getName(), portletPreferenceMD.getName());
+ LocalizedString description =
bundleMgr.getLocalizedValue("javax.portlet.preference.description." +
portletPreferenceMD.getName(), portletPreferenceMD.getName());
+ containerPreferences.addContainerPreference(portletPreferenceMD.getName(),
value, portletPreferenceMD.isReadOnly(), displayName, description);
+ }
+
+ //
+ return containerPreferences;
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilderContext.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilderContext.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerInfoBuilderContext.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,41 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface ContainerInfoBuilderContext
+{
+
+ ResourceBundleManager getBundleManager();
+
+ ResourceBundleManager getBundleManager(PortletMetaData portletMD);
+
+ Class getClass(String className);
+
+}
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-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfo.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -23,6 +23,7 @@
package org.jboss.portal.portlet.impl.info;
import org.jboss.portal.portlet.info.PortletInfo;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
import java.util.Map;
import java.util.HashMap;
@@ -39,35 +40,41 @@
{
/** . */
- private ContainerCapabilitiesInfo capabilities;
+ private final ContainerCapabilitiesInfo capabilities;
/** . */
- private ContainerPreferencesInfo preferences;
+ private final ContainerPreferencesInfo preferences;
/** . */
- private ContainerMetaInfo meta;
+ private final ContainerMetaInfo meta;
/** . */
- private ContainerSecurityInfo security;
+ private final ContainerSecurityInfo security;
/** . */
- private ContainerCacheInfo cache;
+ private final ContainerCacheInfo cache;
/** . */
- private ContainerSessionInfo session;
+ private final ContainerSessionInfo session;
/** . */
- private String name;
+ private final ContainerEventsInfo events;
/** . */
- private String className;
+ private final String name;
/** . */
- private Map<String, String> initParameters;
+ private final String className;
/** . */
- private Boolean remotable;
+ private final Map<String, String> initParameters;
+ /** . */
+ private final Boolean remotable;
+
+ /** . */
+ private ResourceBundleManager bundleManager;
+
public ContainerPortletInfo(
ContainerCapabilitiesInfo capabilities,
ContainerPreferencesInfo preferences,
@@ -77,7 +84,8 @@
ContainerSessionInfo session,
String name,
String className,
- Boolean remotable)
+ Boolean remotable,
+ ResourceBundleManager bundleManager)
{
this.capabilities = capabilities;
this.preferences = preferences;
@@ -85,17 +93,51 @@
this.security = security;
this.cache = cache;
this.session = session;
+ this.events = null;
this.name = name;
this.className = className;
this.initParameters = new HashMap<String, String>();
this.remotable = remotable;
+ this.bundleManager = bundleManager;
}
+ public ContainerPortletInfo(
+ ContainerCapabilitiesInfo capabilities,
+ ContainerPreferencesInfo preferences,
+ ContainerMetaInfo meta,
+ ContainerSecurityInfo security,
+ ContainerCacheInfo cache,
+ ContainerSessionInfo session,
+ ContainerEventsInfo events,
+ String name,
+ String className,
+ Boolean remotable,
+ ResourceBundleManager bundleManager)
+ {
+ this.capabilities = capabilities;
+ this.preferences = preferences;
+ this.meta = meta;
+ this.security = security;
+ this.cache = cache;
+ this.session = session;
+ this.events = events;
+ this.name = name;
+ this.className = className;
+ this.initParameters = new HashMap<String, String>();
+ this.remotable = remotable;
+ this.bundleManager = bundleManager;
+ }
+
public String getName()
{
return name;
}
+ public ResourceBundleManager getBundleManager()
+ {
+ return bundleManager;
+ }
+
public String getClassName()
{
return className;
@@ -150,4 +192,9 @@
{
return remotable;
}
+
+ public ContainerEventsInfo getEvents()
+ {
+ return events;
+ }
}
\ No newline at end of file
Deleted:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfoBuilder.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfoBuilder.java 2008-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerPortletInfoBuilder.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -1,327 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.portlet.impl.info;
-
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferenceMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.SupportedLocaleMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.SupportsMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletModeMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.SecurityRoleRefMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletPreferencesMetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.WindowStateMetaData;
-import org.jboss.portal.portlet.impl.metadata.security.SecurityConstraintMetaData;
-import org.jboss.portal.portlet.impl.metadata.common.InitParamMetaData;
-import org.jboss.portal.portlet.info.MetaInfo;
-import org.jboss.portal.common.value.Value;
-import org.jboss.portal.common.value.StringValue;
-import org.jboss.portal.common.i18n.LocalizedString;
-import org.jboss.portal.common.i18n.ResourceBundleManager;
-import org.jboss.portal.Mode;
-
-import java.util.Locale;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.List;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import java.util.ArrayList;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class ContainerPortletInfoBuilder
-{
-
- /** . */
- private static final String[] KEYS = {MetaInfo.TITLE, MetaInfo.SHORT_TITLE,
MetaInfo.KEYWORDS};
-
- /** . */
- private static final String JAVAX_PORTLET = "javax.portlet.";
-
- /** . */
- private static final String[] BUNDLE_KEYS = {JAVAX_PORTLET + MetaInfo.TITLE,
JAVAX_PORTLET + MetaInfo.SHORT_TITLE, JAVAX_PORTLET + MetaInfo.KEYWORDS};
-
- /** . */
- private PortletMetaData portletMD;
-
- /** . */
- private ResourceBundleManager bundleMgr;
-
- public ContainerPortletInfoBuilder(PortletMetaData portletMD, ResourceBundleManager
bundleMgr)
- {
- this.portletMD = portletMD;
- this.bundleMgr = bundleMgr;
- }
-
- public ContainerPortletInfo build()
- {
- fixMetaData();
-
- //
- ContainerCapabilitiesInfo containerCapabilities = buildContainerCapabilities();
- ContainerPreferencesInfo containerPreferences = buildContainerPreferences();
- ContainerMetaInfo containerMeta = buildContainerMeta();
- ContainerSecurityInfo containerSecurity = buildContainerSecurityInfo();
- ContainerCacheInfo containerCache = buildContainerCache();
- ContainerSessionInfo containerSession = buildContainerSession();
-
- //
- ContainerPortletInfo containerPortletInfo = new ContainerPortletInfo(
- containerCapabilities,
- containerPreferences,
- containerMeta,
- containerSecurity,
- containerCache,
- containerSession,
- portletMD.getPortletName(),
- portletMD.getPortletClass(),
- false
- );
-
- //
- for (InitParamMetaData initParamMD : portletMD.getInitParams())
- {
- containerPortletInfo.addInitParameter(initParamMD.getName(),
initParamMD.getValue());
- }
-
- //
- return containerPortletInfo;
- }
-
- private void fixMetaData()
- {
- if (portletMD.getSecurityRoleRef() == null)
- {
- portletMD.setSecurityRoleRef(new ArrayList<SecurityRoleRefMetaData>());
- }
- if (portletMD.getPortletApplication().getSecurityConstraints() == null)
- {
- portletMD.getPortletApplication().setSecurityConstraints(new
ArrayList<SecurityConstraintMetaData>());
- }
- if (portletMD.getSupportedLocale() == null)
- {
- portletMD.setSupportedLocale(new ArrayList<SupportedLocaleMetaData>());
- }
- for (SupportsMetaData supportsMD : portletMD.getSupports())
- {
- if (supportsMD.getPortletModes() == null)
- {
- supportsMD.setPortletModes(new ArrayList<PortletModeMetaData>());
- }
- if (supportsMD.getWindowStates() == null)
- {
- supportsMD.setWindowStates(new ArrayList<WindowStateMetaData>());
- }
- }
- if (portletMD.getPortletPreferences() == null)
- {
- portletMD.setPortletPreferences(new PortletPreferencesMetaData());
- }
- if (portletMD.getPortletPreferences().getPortletPreferences() == null)
- {
- portletMD.getPortletPreferences().setPortletPreferences(new HashMap<String,
PortletPreferenceMetaData>());
- }
- if (portletMD.getInitParams() == null)
- {
- portletMD.setInitParams(new ArrayList<InitParamMetaData>());
- }
- for (PortletPreferenceMetaData portletPreferenceMD :
portletMD.getPortletPreferences().getPortletPreferences().values())
- {
- if (portletPreferenceMD.getValue() == null)
- {
- portletPreferenceMD.setValue(new ArrayList<String>());
- }
- }
- }
-
- private List<Locale> getSupportedLocales()
- {
- List<Locale> locales = new ArrayList<Locale>();
- for (SupportedLocaleMetaData supportedLocaleMD : portletMD.getSupportedLocale())
- {
- Locale locale = supportedLocaleMD.getLocale();
- locales.add(locale);
- }
- return locales;
- }
-
- private ContainerSecurityInfo buildContainerSecurityInfo()
- {
- ContainerSecurityInfo containerSecurity = new ContainerSecurityInfo();
-
- // Security role ref
- for (SecurityRoleRefMetaData securityRoleRefMD : portletMD.getSecurityRoleRef())
- {
- containerSecurity.addRoleRef(securityRoleRefMD.getRoleName(),
securityRoleRefMD.getRoleLink());
- }
-
- //
- for (SecurityConstraintMetaData securityConstraintMD :
portletMD.getPortletApplication().getSecurityConstraints())
- {
- if
(securityConstraintMD.getPortletList().getPortletNames().contains(portletMD.getPortletName()))
- {
-
containerSecurity.addTransportGuarantee(securityConstraintMD.getUserDataConstraint().getTransportQuarantee());
- }
- }
-
- //
- return containerSecurity;
- }
-
- private ContainerSessionInfo buildContainerSession()
- {
- return new ContainerSessionInfo(false);
- }
-
- private ContainerCacheInfo buildContainerCache()
- {
- int expirationCache = portletMD.getExpirationCache();
-
- //
- if (expirationCache < 0 && expirationCache != -1)
- {
- // log.warn("Seen bad caching expiration value " + expirationTimeSecs
+ " disable caching instead");
- expirationCache = 0;
- }
-
- //
- return new ContainerCacheInfo(expirationCache);
- }
-
- private ContainerCapabilitiesInfo buildContainerCapabilities()
- {
- ContainerCapabilitiesInfo capabilities = new ContainerCapabilitiesInfo();
-
- //
- for (SupportsMetaData supportsMD : portletMD.getSupports())
- {
- // Get the mime type
- String mimeType = supportsMD.getMimeType().toLowerCase();
-
- // Add the content type to the view mode
- // because each content type must handle this view
- capabilities.add(mimeType, Mode.VIEW);
-
- // Then process each mode
- for (PortletModeMetaData modeMD : supportsMD.getPortletModes())
- {
- capabilities.add(mimeType, modeMD.getPortletMode());
- }
- }
-
- //
- return capabilities;
- }
-
- private ContainerMetaInfo buildContainerMeta()
- {
- ContainerMetaInfo containerMeta = new ContainerMetaInfo();
-
- // Capture inline values
- String[] inlines = {
- portletMD.getPortletInfo().getTitle(),
- portletMD.getPortletInfo().getShortTitle(),
- portletMD.getPortletInfo().getKeywords()
- };
-
- // Construct info from resource bundle manager
- for (int i = 0; i < KEYS.length; i++)
- {
- String key = KEYS[i];
-
- //
- Map<Locale, String> tmp = new HashMap<Locale, String>();
-
- //
- List<Locale> locales = getSupportedLocales();
-
- // Add english locale
- locales.add(Locale.ENGLISH);
-
- // Feed with the known locales (perhaps should try more locales)
- for (Locale locale : locales)
- {
- ResourceBundle bundle = bundleMgr.getResourceBundle(locale);
-
- //
- if (bundle != null)
- {
- try
- {
- String value = bundle.getString(BUNDLE_KEYS[i]);
- tmp.put(locale, value);
- }
- catch (MissingResourceException ignore)
- {
- }
- }
- }
-
- // Add the inline value if it is present
- if (inlines[i] != null)
- {
- tmp.put(Locale.ENGLISH, inlines[i]);
- }
-
- //
- LocalizedString ls = new LocalizedString(tmp, Locale.ENGLISH);
- containerMeta.addMetaValue(key, ls);
- }
-
- // Add stuff coming from deployment descriptor
- containerMeta.addMetaValue(MetaInfo.DESCRIPTION, portletMD.getDescription());
- containerMeta.addMetaValue(MetaInfo.DISPLAY_NAME, portletMD.getDisplayName());
-
- //
- return containerMeta;
- }
-
- private ContainerPreferencesInfo buildContainerPreferences()
- {
- PortletPreferencesMetaData preferencesMD = portletMD.getPortletPreferences();
-
- //
- String validatorClassName = null;
- if (preferencesMD != null)
- {
- validatorClassName = preferencesMD.getPreferenceValidator();
- }
-
- //
- ContainerPreferencesInfo containerPreferences = new
ContainerPreferencesInfo(validatorClassName);
-
- //
- for (PortletPreferenceMetaData portletPreferenceMD :
preferencesMD.getPortletPreferences().values())
- {
- Value value = new StringValue(portletPreferenceMD.getValue());
- LocalizedString displayName =
bundleMgr.getLocalizedValue("javax.portlet.preference.name." +
portletPreferenceMD.getName(), portletPreferenceMD.getName());
- LocalizedString description =
bundleMgr.getLocalizedValue("javax.portlet.preference.description." +
portletPreferenceMD.getName(), portletPreferenceMD.getName());
- containerPreferences.addContainerPreference(portletPreferenceMD.getName(),
value, portletPreferenceMD.isReadOnly(), displayName, description);
- }
-
- //
- return containerPreferences;
- }
-}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerTypeInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerTypeInfo.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/info/ContainerTypeInfo.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.info;
+
+import org.jboss.portal.portlet.info.TypeInfo;
+
+import javax.xml.bind.annotation.XmlRootElement;
+import java.lang.reflect.AnnotatedElement;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerTypeInfo implements TypeInfo
+{
+
+ /** . */
+ private final Class type;
+
+ /** . */
+ private final XmlRootElement annotation;
+
+ public ContainerTypeInfo(Class type)
+ {
+ this.type = type;
+ this.annotation = ((AnnotatedElement)type).getAnnotation(XmlRootElement.class);
+ }
+
+ public Class getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return type.getClass().getName();
+ }
+
+ public XmlRootElement getXMLBinding()
+ {
+ return annotation;
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ContainerInfoBuilderContextImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ContainerInfoBuilderContextImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/ContainerInfoBuilderContextImpl.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.impl.jsr168;
+
+import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
+import org.jboss.portal.portlet.impl.metadata.PortletApplication20MetaData;
+import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilderContext;
+import org.jboss.portal.web.WebApp;
+import org.jboss.portal.common.i18n.ResourceBundleManager;
+import org.jboss.portal.common.i18n.ResourceBundleFactory;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class ContainerInfoBuilderContextImpl implements ContainerInfoBuilderContext
+{
+
+ private PortletApplication10MetaData metaData;
+
+ private WebApp webApp;
+
+ private final Map<String, ResourceBundleManager> portletBundleMgrs = new
HashMap<String, ResourceBundleManager>();
+
+ private ResourceBundleManager applicationBundleMgr;
+
+ public ContainerInfoBuilderContextImpl(PortletApplication10MetaData metaData, WebApp
webApp)
+ {
+ this.metaData = metaData;
+ this.webApp = webApp;
+ }
+
+ public ResourceBundleManager getBundleManager()
+ {
+ if (applicationBundleMgr == null)
+ {
+ String baseName = ((PortletApplication20MetaData)metaData).getResourceBundle();
+ ResourceBundleFactory rbf = new
SimpleResourceBundleFactory(webApp.getClassLoader(), baseName);
+ applicationBundleMgr = new ResourceBundleManager(null, rbf);
+ }
+ return applicationBundleMgr;
+ }
+
+ public ResourceBundleManager getBundleManager(PortletMetaData portletMD)
+ {
+ ResourceBundleManager bundleMgr =
portletBundleMgrs.get(portletMD.getPortletName());
+ if (bundleMgr == null)
+ {
+ String baseName = portletMD.getResourceBundle();
+ ResourceBundleFactory rbf = new
SimpleResourceBundleFactory(webApp.getClassLoader(), baseName);
+ bundleMgr = new ResourceBundleManager(null, rbf);
+ portletBundleMgrs.put(portletMD.getPortletName(), bundleMgr);
+ }
+ return bundleMgr;
+ }
+
+ public Class getClass(String className)
+ {
+ try
+ {
+ return webApp.getClassLoader().loadClass(className);
+ }
+ catch (ClassNotFoundException e)
+ {
+ e.printStackTrace();
+
+ // todo
+ return null;
+ }
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/PortletContainerImpl.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -38,7 +38,6 @@
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
import org.jboss.portal.portlet.impl.info.ContainerPreferencesInfo;
-import org.jboss.portal.portlet.info.PortletInfo;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.RenderInvocation;
@@ -89,9 +88,6 @@
/** User data constraint. */
protected Set userDataConstraints;
- /** . */
- protected ResourceBundleManager internalBundleManager;
-
/** Return info. */
protected ContainerPortletInfo info;
@@ -101,10 +97,9 @@
*/
protected PreferencesValidator preferencesValidator;
- public PortletContainerImpl(ContainerPortletInfo info, ResourceBundleManager
internalBundleManager)
+ public PortletContainerImpl(ContainerPortletInfo info)
{
this.info = info;
- this.internalBundleManager = internalBundleManager;
this.valve = new Valve();
this.log = Logger.getLogger("org.jboss.portal.portlet.container." +
info.getClassName().replace('.', '_'));
this.started = false;
@@ -171,7 +166,7 @@
}
//
- ResourceBundleManager bundleManager =
PortletResourceBundleFactory.createResourceBundleManager(internalBundleManager, info);
+ ResourceBundleManager bundleManager =
PortletResourceBundleFactory.createResourceBundleManager(info.getBundleManager(), info);
// Portlet config object
PortletConfig config = new PortletConfigImpl(application.getPortletContext(), info,
bundleManager);
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventInfo.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventInfo.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.info;
+
+import org.jboss.portal.common.i18n.LocalizedString;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface EventInfo
+{
+
+ QName getName();
+
+ LocalizedString getDisplayName();
+
+ LocalizedString getDescription();
+
+ TypeInfo getType();
+
+ Collection<QName> getAliases();
+
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/EventsInfo.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.info;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface EventsInfo
+{
+
+ Collection<? extends EventInfo> getProducedEvents();
+
+ Collection<? extends EventInfo> getConsumedEvents();
+
+}
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-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/PortletInfo.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -85,4 +85,6 @@
* explicitely for the associated portlet.
*/
Boolean isRemotable();
+
+ EventsInfo getEvents();
}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/TypeInfo.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/TypeInfo.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/info/TypeInfo.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.info;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface TypeInfo
+{
+
+ String getName();
+
+ XmlRootElement getXMLBinding();
+
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventInfoSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventInfoSupport.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventInfoSupport.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,111 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.EventInfo;
+import org.jboss.portal.portlet.info.TypeInfo;
+import org.jboss.portal.common.i18n.LocalizedString;
+
+import javax.xml.namespace.QName;
+import java.util.Collection;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventInfoSupport implements EventInfo
+{
+
+ /** . */
+ private QName name;
+
+ /** . */
+ private TypeInfoSupport type;
+
+ /** . */
+ private LocalizedString displayName;
+
+ /** . */
+ private LocalizedString description;
+
+ /** . */
+ private List<QName> aliases;
+
+ public EventInfoSupport(QName name, TypeInfoSupport type)
+ {
+ this.name = name;
+ this.type = type;
+ this.aliases = new ArrayList<QName>();
+ this.displayName = new LocalizedString("Event " + name);
+ this.description = new LocalizedString("Description of event " + name);
+ }
+
+ public EventInfoSupport(QName name, String type)
+ {
+ this.name = name;
+ this.type = new TypeInfoSupport(type);
+ this.aliases = new ArrayList<QName>();
+ }
+
+ public QName getName()
+ {
+ return name;
+ }
+
+ public TypeInfo getType()
+ {
+ return type;
+ }
+
+ public LocalizedString getDisplayName()
+ {
+ return displayName;
+ }
+
+ public LocalizedString getDescription()
+ {
+ return description;
+ }
+
+ public Collection<QName> getAliases()
+ {
+ return aliases;
+ }
+
+ public void setDisplayName(LocalizedString displayName)
+ {
+ this.displayName = displayName;
+ }
+
+ public void setDescription(LocalizedString description)
+ {
+ this.description = description;
+ }
+
+ public void addAlias(QName alias)
+ {
+ aliases.add(alias);
+ }
+}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/EventsInfoSupport.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,70 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.EventsInfo;
+import org.jboss.portal.portlet.info.EventInfo;
+
+import java.util.Collection;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class EventsInfoSupport implements EventsInfo
+{
+
+ /** . */
+ private List<EventInfoSupport> producedEvents;
+
+ /** . */
+ private List<EventInfoSupport> consumedEvents;
+
+ public EventsInfoSupport()
+ {
+ producedEvents = new ArrayList<EventInfoSupport>();
+ consumedEvents = new ArrayList<EventInfoSupport>();
+ }
+
+ public void addProducedEvent(EventInfoSupport event)
+ {
+ producedEvents.add(event);
+ }
+
+ public void addConsumedEvent(EventInfoSupport event)
+ {
+ producedEvents.add(event);
+ }
+
+ public Collection<? extends EventInfo> getProducedEvents()
+ {
+ return producedEvents;
+ }
+
+ public Collection<? extends EventInfo> getConsumedEvents()
+ {
+ return consumedEvents;
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/PortletInfoSupport.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -29,6 +29,7 @@
import org.jboss.portal.portlet.info.PreferencesInfo;
import org.jboss.portal.portlet.info.SecurityInfo;
import org.jboss.portal.portlet.info.SessionInfo;
+import org.jboss.portal.portlet.info.EventsInfo;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -43,62 +44,38 @@
private CacheInfoSupport cacheSupport = new CacheInfoSupport();
private SessionInfoSupport sessionSupport = new SessionInfoSupport();
private MetaInfoSupport metaSupport = new MetaInfoSupport();
+ private EventsInfoSupport eventsSupports = new EventsInfoSupport();
public CapabilitiesInfo getCapabilities()
{
throw new UnsupportedOperationException("Implement me");
}
- public PreferencesInfo getPreferences()
+ public PreferencesInfoSupport getPreferences()
{
return preferencesSupport;
}
- public PreferencesInfoSupport getPreferencesSupport()
+ public MetaInfoSupport getMeta()
{
- return preferencesSupport;
- }
-
- public MetaInfo getMeta()
- {
return metaSupport;
}
- public MetaInfoSupport getMetaSupport()
+ public SecurityInfoSupport getSecurity()
{
- return metaSupport;
- }
-
- public SecurityInfo getSecurity()
- {
return securitySupport;
}
- public SecurityInfoSupport getSecuritySupport()
+ public CacheInfoSupport getCache()
{
- return securitySupport;
- }
-
- public CacheInfo getCache()
- {
return cacheSupport;
}
- public CacheInfoSupport getCacheSupport()
+ public SessionInfoSupport getSession()
{
- return cacheSupport;
- }
-
- public SessionInfo getSession()
- {
return sessionSupport;
}
- public SessionInfoSupport getSessionSupport()
- {
- return sessionSupport;
- }
-
public Boolean isRemotable()
{
return remotable;
@@ -108,4 +85,9 @@
{
this.remotable = remotable;
}
+
+ public EventsInfoSupport getEvents()
+ {
+ return eventsSupports;
+ }
}
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/TypeInfoSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/TypeInfoSupport.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/support/info/TypeInfoSupport.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.portlet.support.info;
+
+import org.jboss.portal.portlet.info.TypeInfo;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class TypeInfoSupport implements TypeInfo
+{
+
+ /** . */
+ private final String name;
+
+ public TypeInfoSupport(String name)
+ {
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public XmlRootElement getXMLBinding()
+ {
+ return null;
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/PortletInvokerSupport.java
===================================================================
---
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/PortletInvokerSupport.java 2008-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/portlet/src/test/java/org/jboss/portal/test/portlet/state/PortletInvokerSupport.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -180,13 +180,13 @@
public void addPreference(String key, Value value)
{
- support.getInfoSupport().getPreferencesSupport().addPreference(key);
+ support.getInfoSupport().getPreferences().addPreference(key);
state.put(key, value);
}
public void addPreference(String key, Value value, Boolean readOnly)
{
- support.getInfoSupport().getPreferencesSupport().addPreference(key, readOnly);
+ support.getInfoSupport().getPreferences().addPreference(key, readOnly);
state.put(key, value);
}
Modified:
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java
===================================================================
---
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2008-01-10
23:37:38 UTC (rev 9483)
+++
modules/portlet/trunk/test/src/main/java/org/jboss/portal/portlet/test/PortletApplicationDeployment.java 2008-01-11
16:23:48 UTC (rev 9484)
@@ -25,18 +25,16 @@
import org.jboss.portal.portlet.container.PortletApplicationContext;
import org.jboss.portal.portlet.impl.jsr168.PortletApplicationImpl;
import org.jboss.portal.portlet.impl.jsr168.PortletContainerImpl;
-import org.jboss.portal.portlet.impl.jsr168.SimpleResourceBundleFactory;
+import org.jboss.portal.portlet.impl.jsr168.ContainerInfoBuilderContextImpl;
import org.jboss.portal.portlet.impl.jsr168.spi.PortletAPIFactory;
import org.jboss.portal.portlet.impl.metadata.PortletApplication10MetaData;
-import org.jboss.portal.portlet.impl.metadata.portlet.PortletMetaData;
import org.jboss.portal.portlet.impl.info.ContainerPortletInfo;
-import org.jboss.portal.portlet.impl.info.ContainerPortletInfoBuilder;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilder;
+import org.jboss.portal.portlet.impl.info.ContainerInfoBuilderContext;
import org.jboss.portal.portlet.metadata.JBossApplicationMetaData;
import org.jboss.portal.web.WebApp;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.common.i18n.ResourceBundleFactory;
-import org.jboss.portal.common.i18n.ResourceBundleManager;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
@@ -88,6 +86,8 @@
/** . */
private List<KernelControllerContext> portletContainerControllerContexts = new
ArrayList<KernelControllerContext>();
+ /** . */
+
public PortletApplicationDeployment(Kernel kernel, WebApp webApp,
PortletApplication10MetaData metaData)
{
this.kernel = kernel;
@@ -109,23 +109,20 @@
String portletApplicationId = "PortletApplication[" +
webApp.getContextPath() + "]";
//
- for (PortletMetaData portletMetaData : metaData.getPortlets().values())
- {
- // Create resource bundle manager
- String baseName = portletMetaData.getResourceBundle();
- ResourceBundleFactory rbf = new
SimpleResourceBundleFactory(webApp.getClassLoader(), baseName);
- ResourceBundleManager bundleMgr = new ResourceBundleManager(null, rbf);
+ ContainerInfoBuilderContext builderContext = new
ContainerInfoBuilderContextImpl(metaData, webApp);
+ ContainerInfoBuilder builder = new ContainerInfoBuilder(metaData, builderContext);
+ builder.build();
- // Build container info
- ContainerPortletInfo containerInfo = new
ContainerPortletInfoBuilder(portletMetaData, bundleMgr).build();
-
+ //
+ for (ContainerPortletInfo containerInfo : builder.getContainerInfos())
+ {
//
- String portletContainerId = "PortletContainer[" +
webApp.getContextPath() + "," + portletMetaData.getPortletName() +
"]";
+ String portletContainerId = "PortletContainer[" +
webApp.getContextPath() + "," + containerInfo.getName() + "]";
//
AbstractBeanMetaData bmd = new AbstractBeanMetaData(portletContainerId,
PortletContainerImpl.class.getName());
AbstractConstructorMetaData ctormd = new AbstractConstructorMetaData();
- ctormd.setParameters(Tools.toList((ParameterMetaData)new
AbstractParameterMetaData(ContainerPortletInfo.class.getName(), containerInfo), new
AbstractParameterMetaData(ResourceBundleManager.class.getName(), bundleMgr)));
+ ctormd.setParameters(Tools.toList((ParameterMetaData)new
AbstractParameterMetaData(ContainerPortletInfo.class.getName(), containerInfo)));
bmd.setConstructor(ctormd);
bmd.setStart(new AbstractLifecycleMetaData("start"));
bmd.setStop(new AbstractLifecycleMetaData("stop"));
@@ -156,7 +153,7 @@
}
catch (Throwable t)
{
- log.debug("Cannot install portlet container " +
portletMetaData.getPortletName() + " produced an error", t);
+ log.debug("Cannot install portlet container " +
containerInfo.getName() + " produced an error", t);
}
}