You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by cd...@apache.org on 2006/11/27 06:13:57 UTC
svn commit: r479519 - in /portals/pluto/branches/1.1-286-COMPATIBILITY:
pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/
pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/
pluto-portal-driver/...
Author: cdoremus
Date: Sun Nov 26 21:13:56 2006
New Revision: 479519
URL: http://svn.apache.org/viewvc?view=rev&rev=479519
Log:
Modifications for PLUTO-270 to allow context path to contain dots.
Modified:
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java
portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PortletWindowConfig.java
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java?view=diff&rev=479519&r1=479518&r2=479519
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-descriptor-api/src/main/java/org/apache/pluto/descriptors/portlet/PortletDD.java Sun Nov 26 21:13:56 2006
@@ -89,8 +89,15 @@
/**
* Set the unique name of the portlet.
* @param portletName
+ * @throws IllegalArgumentException if the name has a period since it is used
+ * to create the portlet ID in <code>PortletWindowConfig.createPortletId()</code>
+ * using a dot to separate the context path from the portlet name.
+ * @see PortletWindowConfig#createPortletId(String, String)
*/
public void setPortletName(String portletName) {
+ if (portletName.indexOf('.') != -1) {
+ throw new IllegalArgumentException("Portlet name must not have a dot(period). Please remove the dot from the value of the portlet-name element ("+ portletName + ") in portlet.xml");
+ }
this.portletName = portletName;
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java?view=diff&rev=479519&r1=479518&r2=479519
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/services/impl/resource/ResourceConfig.java Sun Nov 26 21:13:56 2006
@@ -236,9 +236,12 @@
* @return the context, derived from the portlet id.
*/
private String getContextFromPortletId(String portletId) {
- int idx = portletId.indexOf(".");
+ if (portletId == null) {
+ throw new NullPointerException("Portlet ID must not be null.");
+ }
+ int idx = portletId.lastIndexOf(".");
if (idx < 0) {
- return null;
+ throw new IllegalArgumentException("Portlet ID does not contain a dot.");
}
return portletId.substring(0, idx);
}
@@ -249,9 +252,12 @@
* @return the name of the portlet.
*/
private String getPortletNameFromPortletId(String portletId) {
- int idx = portletId.indexOf(".");
+ if (portletId == null) {
+ throw new NullPointerException("Portlet ID must not be null.");
+ }
+ int idx = portletId.lastIndexOf(".");
if (idx < 0) {
- return null;
+ throw new IllegalArgumentException("Portlet ID does not contain a dot.");
}
return portletId.substring(idx + 1);
}
Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PortletWindowConfig.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PortletWindowConfig.java?view=diff&rev=479519&r1=479518&r2=479519
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PortletWindowConfig.java (original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver/src/main/java/org/apache/pluto/driver/services/portal/PortletWindowConfig.java Sun Nov 26 21:13:56 2006
@@ -70,11 +70,27 @@
* Creates the portlet ID from context path and portlet name. The portlet ID
* is constructed by concatinating the context path and the portlet name
* using a dot ('.').
+ *
+ * The method checks that the portlet name parameter does not have a dot. This check
+ * is not done for the portlet ID.
+ *
* @param contextPath the portlet context path.
* @param portletName the portlet name.
+ * @throws IllegalArgumentException if the portletName has a dot
+ * @throws NullPointerException if the portlet Name or context path is null.
*/
- public static String createPortletId(String contextPath,
- String portletName) {
+ public static String createPortletId(String contextPath, String portletName)
+ throws NullPointerException, IllegalArgumentException {
+
+ if (contextPath == null) {
+ throw new NullPointerException("Context path must not be null.");
+ }
+ if (portletName == null) {
+ throw new NullPointerException("Portlet name must not be null.");
+ }
+ if (portletName.indexOf('.') != -1) {
+ throw new IllegalArgumentException("Portlet name must not have a dot(period). Please remove the dot from the value of the portlet-name element ("+ portletName + ") in portlet.xml");
+ }
return contextPath + "." + portletName;
}