Author: chris.laprun(a)jboss.com
Date: 2010-10-02 10:48:30 -0400 (Sat, 02 Oct 2010)
New Revision: 4466
Added:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java
Removed:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java
Modified:
portal/branches/wsrp2-integration/webui/portal/src/main/java/conf/portal/configuration.xml
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/AbstractContextualPropertyProviderPlugin.java
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManager.java
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManagerImpl.java
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
Log:
- Reversed merged of webui -r4244:4240 to remove issue with commits 4242 and related
4243.
Modified:
portal/branches/wsrp2-integration/webui/portal/src/main/java/conf/portal/configuration.xml
===================================================================
---
portal/branches/wsrp2-integration/webui/portal/src/main/java/conf/portal/configuration.xml 2010-10-02
12:29:53 UTC (rev 4465)
+++
portal/branches/wsrp2-integration/webui/portal/src/main/java/conf/portal/configuration.xml 2010-10-02
14:48:30 UTC (rev 4466)
@@ -43,29 +43,22 @@
<type>org.exoplatform.portal.application.state.ContextualPropertyManagerImpl</type>
<component-plugins>
<component-plugin>
- <name>PublicPropertiesPlugin</name>
+ <name>NavigationalStateProviderPlugin</name>
<set-method>addPlugin</set-method>
-
<type>org.exoplatform.portal.application.state.PublicPropertiesPlugin</type>
+
<type>org.exoplatform.portal.application.state.NavigationalStateProviderPlugin</type>
<init-params>
<value-param>
<name>namespaceURI</name>
<description>Namespace URI</description>
- <
value>http://www.gatein.org/xml/ns/prp_1_0</value>
+ <value>http://www.gatein.org</value>
</value-param>
+ <value-param>
+ <name>prefix</name>
+ <description>Prefix of QName</description>
+ <value>gtn</value>
+ </value-param>
</init-params>
</component-plugin>
- <component-plugin>
- <name>InternalPropertiesPlugin</name>
- <set-method>addPlugin</set-method>
-
<type>org.exoplatform.portal.application.state.InternalPropertiesPlugin</type>
- <init-params>
- <value-param>
- <name>namespaceURI</name>
- <description>Namespace URI</description>
- <
value>http://www.gatein.org/xml/ns/internal_prp_1_0</value>
- </value-param>
- </init-params>
- </component-plugin>
</component-plugins>
</component>
</configuration>
Modified:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/AbstractContextualPropertyProviderPlugin.java
===================================================================
---
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/AbstractContextualPropertyProviderPlugin.java 2010-10-02
12:29:53 UTC (rev 4465)
+++
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/AbstractContextualPropertyProviderPlugin.java 2010-10-02
14:48:30 UTC (rev 4466)
@@ -23,35 +23,16 @@
import javax.xml.namespace.QName;
import org.exoplatform.container.component.BaseComponentPlugin;
-import org.exoplatform.container.xml.InitParams;
import org.exoplatform.portal.webui.application.UIPortlet;
-import org.gatein.common.logging.Logger;
-import org.gatein.common.logging.LoggerFactory;
/**
* @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
+ * @date
*/
+
public abstract class AbstractContextualPropertyProviderPlugin extends
BaseComponentPlugin
{
- /** . */
- protected final Logger log = LoggerFactory.getLogger(getClass());
+ public abstract Map<QName, String[]> getProperties(UIPortlet portletWindow);
- /** . */
- protected final String namespaceURI;
-
- protected AbstractContextualPropertyProviderPlugin(InitParams params)
- {
- this.namespaceURI = params.getValueParam("namespaceURI").getValue();
- }
-
- public abstract void getProperties(UIPortlet portletWindow, Map<QName, String[]>
properties);
-
- protected final void addProperty(Map<QName, String[]> map, QName qname, String
value)
- {
- if (value != null)
- {
- map.put(qname, new String[]{value});
- }
- }
}
Modified:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManager.java
===================================================================
---
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManager.java 2010-10-02
12:29:53 UTC (rev 4465)
+++
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManager.java 2010-10-02
14:48:30 UTC (rev 4466)
@@ -23,19 +23,16 @@
import javax.xml.namespace.QName;
import org.exoplatform.portal.webui.application.UIPortlet;
+import org.picocontainer.Startable;
/**
* @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
+ * @date
*/
-public interface ContextualPropertyManager
+
+public interface ContextualPropertyManager extends Startable
{
- /**
- * Returns a map of qualified names and string values for contextual properties of the
portlet.
- *
- * @param portletWindow the portlet
- * @return the contextual properties
- */
public Map<QName, String[]> getProperties(UIPortlet portletWindow);
}
Modified:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManagerImpl.java
===================================================================
---
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManagerImpl.java 2010-10-02
12:29:53 UTC (rev 4465)
+++
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/ContextualPropertyManagerImpl.java 2010-10-02
14:48:30 UTC (rev 4466)
@@ -27,42 +27,41 @@
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.portal.webui.application.UIPortlet;
-import org.picocontainer.Startable;
/**
* @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
* @date
*/
-public class ContextualPropertyManagerImpl implements ContextualPropertyManager,
Startable
+public class ContextualPropertyManagerImpl implements ContextualPropertyManager
{
- private ArrayList<AbstractContextualPropertyProviderPlugin>
propertyProviderPlugins;
+ private List<AbstractContextualPropertyProviderPlugin> propertyProviderPlugins;
public ContextualPropertyManagerImpl() throws Exception
{
propertyProviderPlugins = new
ArrayList<AbstractContextualPropertyProviderPlugin>();
}
+ @Override
public Map<QName, String[]> getProperties(UIPortlet portletWindow)
{
Map<QName, String[]> whatPortletWindowSee = new HashMap<QName,
String[]>();
-
- // No need to use an iterator here
- for (int i = 0;i < propertyProviderPlugins.size();i++)
+
+ for(AbstractContextualPropertyProviderPlugin plugin : propertyProviderPlugins)
{
- AbstractContextualPropertyProviderPlugin plugin =
propertyProviderPlugins.get(i);
- plugin.getProperties(portletWindow, whatPortletWindowSee);
+ whatPortletWindowSee.putAll(plugin.getProperties(portletWindow));
}
-
- //
+
return whatPortletWindowSee;
}
+ @Override
public void start()
{
}
+ @Override
public void stop()
{
}
@@ -74,4 +73,5 @@
propertyProviderPlugins.add((AbstractContextualPropertyProviderPlugin)plugin);
}
}
+
}
Deleted:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java
===================================================================
---
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java 2010-10-02
12:29:53 UTC (rev 4465)
+++
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/InternalPropertiesPlugin.java 2010-10-02
14:48:30 UTC (rev 4466)
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2010 eXo Platform SAS.
- *
- * 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.exoplatform.portal.application.state;
-
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.portal.webui.application.UIPortlet;
-
-import javax.xml.namespace.QName;
-import java.util.Map;
-
-/**
- * This plugins setup properties that are NOT publicly supported, however it is
recommanded to not change anything
- * but there are no guarantees that it won't change.
- *
- * @author <a href="mailto:julien.viet@exoplatform.com">Julien
Viet</a>
- * @version $Revision$
- */
-public class InternalPropertiesPlugin extends AbstractContextualPropertyProviderPlugin
-{
-
- /** . */
- private final QName storageIdQName;
-
- /** . */
- private final QName storageNameQName;
-
- public InternalPropertiesPlugin(InitParams params)
- {
- super(params);
-
- //
- this.storageIdQName = new QName(namespaceURI, "storage_id");
- this.storageNameQName = new QName(namespaceURI, "storage_name");
- }
-
- @Override
- public void getProperties(UIPortlet portletWindow, Map<QName, String[]>
properties)
- {
- addProperty(properties, storageIdQName, portletWindow.getStorageId());
- addProperty(properties, storageNameQName, portletWindow.getStorageName());
- }
-}
Copied:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java
(from rev 4240,
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java)
===================================================================
---
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java
(rev 0)
+++
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/NavigationalStateProviderPlugin.java 2010-10-02
14:48:30 UTC (rev 4466)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 eXo Platform SAS.
+ *
+ * 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.exoplatform.portal.application.state;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import org.exoplatform.container.xml.InitParams;
+import org.exoplatform.portal.config.model.PageNode;
+import org.exoplatform.portal.webui.application.UIPortlet;
+import org.exoplatform.portal.webui.page.UIPage;
+import org.exoplatform.portal.webui.portal.UIPortal;
+import org.exoplatform.portal.webui.util.Util;
+
+/**
+ * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
+ * @date
+ */
+
+public class NavigationalStateProviderPlugin extends
AbstractContextualPropertyProviderPlugin
+{
+
+ private final String NAMESPACE_URI;
+
+ private final String PREFIX;
+
+ public NavigationalStateProviderPlugin(InitParams params) throws Exception
+ {
+ NAMESPACE_URI = params.getValueParam("namespaceURI").getValue();
+ PREFIX = params.getValueParam("prefix").getValue();
+ }
+
+ @Override
+ public Map<QName, String[]> getProperties(UIPortlet portletWindow)
+ {
+ Map<QName, String[]> whatThisPluginProvides = new HashMap<QName,
String[]>();
+
+ try
+ {
+ UIPortal currentSite = Util.getUIPortalApplication().getShowedUIPortal();
+ PageNode currentNode = currentSite.getSelectedNode();
+
+ //Provides current node URI
+ whatThisPluginProvides.put(new QName(NAMESPACE_URI, "navigation_uri",
PREFIX), new String[]{currentNode.getUri()});
+
+ //Provides current page name
+ UIPage currentPage = currentSite.getUIPage(currentNode.getPageReference());
+ if(currentPage != null)
+ {
+ whatThisPluginProvides.put(new QName(NAMESPACE_URI, "page_name",
PREFIX), new String[]{currentPage.getTitle()});
+ }
+
+ //Provides current site type
+ whatThisPluginProvides.put(new QName(NAMESPACE_URI, "site_type",
PREFIX), new String[]{currentSite.getOwnerType()});
+
+ //Provides current site name
+ whatThisPluginProvides.put(new QName(NAMESPACE_URI, "site_name",
PREFIX), new String[]{currentSite.getOwner()});
+
+ return whatThisPluginProvides;
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ return null;
+ }
+ }
+
+}
Deleted:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java
===================================================================
---
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java 2010-10-02
12:29:53 UTC (rev 4465)
+++
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/application/state/PublicPropertiesPlugin.java 2010-10-02
14:48:30 UTC (rev 4466)
@@ -1,108 +0,0 @@
-/*
- * Copyright (C) 2009 eXo Platform SAS.
- *
- * 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.exoplatform.portal.application.state;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.exoplatform.container.xml.InitParams;
-import org.exoplatform.portal.config.model.PageNode;
-import org.exoplatform.portal.webui.application.UIPortlet;
-import org.exoplatform.portal.webui.page.UIPage;
-import org.exoplatform.portal.webui.portal.UIPortal;
-import org.exoplatform.portal.webui.util.Util;
-
-/**
- * This plugin setup properties that are publicly supported, hence this is part of a
public API
- * and once published its contract must not change whatsoever.
- *
- * @author <a href="mailto:hoang281283@gmail.com">Minh Hoang
TO</a>
- */
-public class PublicPropertiesPlugin extends AbstractContextualPropertyProviderPlugin
-{
-
- /** . */
- private final QName navigationURIQName;
-
- /** . */
- private final QName pageNameQName;
-
- /** . */
- private final QName siteTypeQName;
-
- /** . */
- private final QName siteNameQName;
-
- /** . */
- private final QName windowShowInfoBarQName;
-
- /** . */
- private final QName windowHeight;
-
- /** . */
- private final QName windowWidth;
-
- public PublicPropertiesPlugin(InitParams params) throws Exception
- {
- super(params);
-
- //
- this.navigationURIQName = new QName(namespaceURI, "navigation_uri");
- this.pageNameQName = new QName(namespaceURI, "page_name");
- this.siteTypeQName = new QName(namespaceURI, "site_type");
- this.siteNameQName = new QName(namespaceURI, "site_name");
- this.windowWidth = new QName(namespaceURI, "window_width");
- this.windowHeight = new QName(namespaceURI, "window_height");
- this.windowShowInfoBarQName = new QName(namespaceURI,
"window_show_info_bar");
- }
-
- @Override
- public void getProperties(UIPortlet portletWindow, Map<QName, String[]>
properties)
- {
- try
- {
- UIPortal currentSite = Util.getUIPortalApplication().getShowedUIPortal();
- PageNode currentNode = currentSite.getSelectedNode();
-
- // Navigation related properties
- addProperty(properties, navigationURIQName, currentNode.getUri());
-
- // Page related properties
- UIPage currentPage = currentSite.getUIPage(currentNode.getPageReference());
- if(currentPage != null)
- {
- addProperty(properties, pageNameQName, currentPage.getTitle());
- }
-
- // Site related properties
- addProperty(properties, siteTypeQName, currentSite.getOwnerType());
- addProperty(properties, siteNameQName, currentSite.getOwner());
-
- // Window related properties
- addProperty(properties, windowShowInfoBarQName,
Boolean.toString(portletWindow.getShowInfoBar()));
- addProperty(properties, windowWidth, portletWindow.getWidth());
- addProperty(properties, windowHeight, portletWindow.getHeight());
- }
- catch (Exception ex)
- {
- log.error("Could not obtain contextual properties for portlet " +
portletWindow, ex);
- }
- }
-}
Modified:
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
---
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2010-10-02
12:29:53 UTC (rev 4465)
+++
portal/branches/wsrp2-integration/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2010-10-02
14:48:30 UTC (rev 4466)
@@ -154,7 +154,7 @@
private List<QName> supportedPublishingEvents_;
- private Map<QName, String> supportedPublicParams_;
+ private List<String> supportedPublicParams_;
private boolean portletInPortal_ = true;
@@ -354,37 +354,12 @@
supportedProcessingEvents_ = supportedProcessingEvents;
}
- public Map<QName, String> getSupportedPublicRenderParameters()
+ public List<String> getSupportedPublicRenderParameters()
{
- if (supportedPublicParams_ == null)
- {
- if (producedOfferedPortlet == null)
- {
- log.info("Could not find portlet with ID : " +
producerOfferedPortletContext.getId());
- return Collections.emptyMap();
- }
-
- //
- Collection<ParameterInfo> parameters =
(Collection<ParameterInfo>)producedOfferedPortlet.getInfo().getNavigation().getPublicParameters();
- Map<QName, String> supportedPublicParams = Collections.emptyMap();
- for (ParameterInfo parameter : parameters)
- {
- if (supportedPublicParams.isEmpty())
- {
- supportedPublicParams = new HashMap<QName, String>();
- }
- supportedPublicParams.put(parameter.getName(), parameter.getId());
- }
-
- //
- this.supportedPublicParams_ = supportedPublicParams;
- }
-
- //
return supportedPublicParams_;
}
- public void setSupportedPublicRenderParameters(Map<QName, String>
supportedPublicRenderParameters)
+ public void setSupportedPublicRenderParameters(List<String>
supportedPublicRenderParameters)
{
supportedPublicParams_ = supportedPublicRenderParameters;
}
@@ -560,35 +535,46 @@
/**
* Tells, according to the info located in portlet.xml, wether this portlet supports
the public render parameter
- * qname given as method argument. If the qname is supported, the public render
parameter id is returned otherwise
- * false is returned.
- *
- * @param supportedPublicParam the supported public parameter qname
- * @return the supported public parameter id
+ * given as a method argument
*/
- public String supportsPublicParam(QName supportedPublicParam)
+ public boolean supportsPublicParam(String supportedPublicParam)
{
- Map<QName, String> supportedPublicParams =
getSupportedPublicRenderParameters();
- return supportedPublicParams.get(supportedPublicParam);
- }
+ if (supportedPublicParams_ == null)
+ {
- /**
- * Tells, according to the info located in portlet.xml, wether this portlet supports
the public render parameter
- * id given as a method argument.
- *
- * @param supportedPublicParamId the supported public parameter id
- * @return true if the supported public parameter id is supported
- */
- public boolean supportsPublicParam(String supportedPublicParamId)
- {
- Map<QName, String> supportedPublicParams =
getSupportedPublicRenderParameters();
- boolean supported = supportedPublicParams.containsValue(supportedPublicParamId);
- if (supported && log.isDebugEnabled())
+ //
+ if (producedOfferedPortlet == null)
+ {
+ log.info("Could not find portlet with ID : " +
producerOfferedPortletContext.getId());
+ return false;
+ }
+
+ //
+ Collection<ParameterInfo> parameters =
+
(Collection<ParameterInfo>)producedOfferedPortlet.getInfo().getNavigation().getPublicParameters();
+ supportedPublicParams_ = new ArrayList<String>();
+ for (ParameterInfo parameter : parameters)
+ {
+ supportedPublicParams_.add(parameter.getId());
+ }
+ }
+
+ //
+ for (String publicParam : supportedPublicParams_)
{
- log.debug("The Portlet " + producerOfferedPortletContext.getId()
- + " supports the public render parameter : " +
supportedPublicParamId);
+ if (publicParam.equals(supportedPublicParam))
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("The Portlet " +
producerOfferedPortletContext.getId()
+ + " supports the public render parameter : " +
supportedPublicParam);
+ }
+ return true;
+ }
}
- return true;
+
+ //
+ return false;
}
/**
@@ -632,19 +618,16 @@
}
}
- // Handle exposed portal contextual properties
+ //Handle exposed portal contextual properties
ContextualPropertyManager propertyManager =
this.getApplicationComponent(ContextualPropertyManager.class);
Map<QName, String[]> exposedPortalState =
propertyManager.getProperties(this);
- for(QName prpQName : exposedPortalState.keySet())
+ for(QName qName : exposedPortalState.keySet())
{
- String prpId = supportsPublicParam(prpQName);
- if(prpId != null)
+ if(supportsPublicParam(qName.getLocalPart()))
{
- publicParamsMap.put(prpId, exposedPortalState.get(prpQName));
+ publicParamsMap.put(qName.toString(), exposedPortalState.get(qName));
}
}
-
- //
return publicParamsMap;
}