Author: julien(a)jboss.com
Date: 2008-01-10 18:37:38 -0500 (Thu, 10 Jan 2008)
New Revision: 9483
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java
Log:
added BaseURLImpl which is a parent of PortletURLImpl mirroring the new BaseURL
interface.
Added:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java
(rev 0)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/BaseURLImpl.java 2008-01-10
23:37:38 UTC (rev 9483)
@@ -0,0 +1,201 @@
+/******************************************************************************
+ * 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.api;
+
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.StateString;
+import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.spi.PortletInvocationContext;
+import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
+import org.jboss.portal.Mode;
+import org.jboss.portal.common.NotYetImplemented;
+
+import javax.portlet.BaseURL;
+import javax.portlet.PortletRequest;
+import javax.portlet.WindowState;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletSecurityException;
+import java.util.Map;
+import java.io.Writer;
+import java.io.IOException;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class BaseURLImpl implements BaseURL
+{
+
+ /** . */
+ protected PortletInvocation inv;
+
+ /** . */
+ protected PortletRequest preq;
+
+ /** . */
+ protected Boolean secure;
+
+ /** . */
+ protected InternalPortletURL url;
+
+ public BaseURLImpl(PortletInvocation invocation, PortletRequest preq,
InternalPortletURL url)
+ {
+ this.inv = invocation;
+ this.preq = preq;
+ this.url = url;
+ }
+
+ /** @throws IllegalArgumentException if the name is null */
+ public void setParameter(String name, String value)
+ {
+ PortletUtils.checkPortletParameterValidity(name, value);
+
+ //
+ url.getInternalParameters().setValue(name, value);
+ }
+
+ public void setParameter(String name, String[] values)
+ {
+ PortletUtils.checkPortletParameterValidity(name, values);
+
+ //
+ url.getInternalParameters().setValues(name, values);
+ }
+
+ public void setParameters(Map<String, String[]> parameters)
+ {
+ PortletUtils.checkPortletParameterMapValidity(parameters);
+
+ //
+ url.getInternalParameters().replace(parameters);
+ }
+
+ public void setSecure(boolean secure) throws PortletSecurityException
+ {
+ this.secure = Boolean.valueOf(secure);
+ }
+
+ public Map<String, String[]> getParameterMap()
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void write(Writer writer) throws IOException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void write(Writer writer, boolean b) throws IOException
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void addProperty(String s, String s1)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public void setProperty(String s, String s1)
+ {
+ throw new NotYetImplemented();
+ }
+
+ public String toString()
+ {
+ PortletInvocationContext responseContext = inv.getPortletContext();
+ return responseContext.renderURL(url, secure, null, true);
+ }
+
+ public static abstract class InternalPortletURL implements
org.jboss.portal.portlet.PortletURL
+ {
+
+ /** . */
+ protected WindowState windowState;
+
+ /** . */
+ protected PortletMode portletMode;
+
+ public Mode getMode()
+ {
+ if (portletMode != null)
+ {
+ return Mode.create(portletMode.toString());
+ }
+ return null;
+ }
+
+ public org.jboss.portal.WindowState getWindowState()
+ {
+ if (windowState != null)
+ {
+ return org.jboss.portal.WindowState.create(windowState.toString());
+ }
+ return null;
+ }
+
+ protected abstract PortletParameters getInternalParameters();
+ }
+
+ public static class InternalActionURL extends InternalPortletURL implements ActionURL
+ {
+
+ /** . */
+ private PortletParametersStateString parameters = new
PortletParametersStateString();
+
+ protected PortletParameters getInternalParameters()
+ {
+ return parameters.getParameters();
+ }
+
+ public StateString getInteractionState()
+ {
+ return parameters;
+ }
+
+ /** The portlet container does not need to have the navigational state provided.
*/
+ public StateString getNavigationalState()
+ {
+ return null;
+ }
+ }
+
+ public static class InternalRenderURL extends InternalPortletURL implements RenderURL
+ {
+
+ /** . */
+ private PortletParametersStateString navigationalState = new
PortletParametersStateString();
+
+ protected PortletParameters getInternalParameters()
+ {
+ return navigationalState.getParameters();
+ }
+
+ public StateString getNavigationalState()
+ {
+ return navigationalState;
+ }
+ }
+}
Modified:
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java
===================================================================
---
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java 2008-01-10
23:15:34 UTC (rev 9482)
+++
modules/portlet/trunk/portlet/src/main/java/org/jboss/portal/portlet/impl/jsr168/api/PortletURLImpl.java 2008-01-10
23:37:38 UTC (rev 9483)
@@ -22,47 +22,26 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168.api;
-import org.jboss.portal.Mode;
import org.jboss.portal.common.NotYetImplemented;
-import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.PortletParameters;
-import org.jboss.portal.portlet.PortletParametersStateString;
-import org.jboss.portal.portlet.RenderURL;
-import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.impl.jsr168.PortletUtils;
import org.jboss.portal.portlet.invocation.PortletInvocation;
-import org.jboss.portal.portlet.spi.PortletInvocationContext;
import javax.portlet.PortletMode;
import javax.portlet.PortletModeException;
import javax.portlet.PortletRequest;
-import javax.portlet.PortletSecurityException;
import javax.portlet.PortletURL;
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
-import java.util.Map;
-import java.io.Writer;
-import java.io.IOException;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 6697 $
*/
-public class PortletURLImpl implements PortletURL
+public class PortletURLImpl extends BaseURLImpl implements PortletURL
{
- private PortletInvocation inv;
- private PortletRequest preq;
-
- //
- private Boolean secure;
- private InternalPortletURL url;
-
public PortletURLImpl(PortletInvocation invocation, PortletRequest preq,
InternalPortletURL url)
{
- this.inv = invocation;
- this.preq = preq;
- this.url = url;
+ super(invocation, preq, url);
}
public void setWindowState(WindowState windowState) throws WindowStateException
@@ -95,112 +74,6 @@
}
}
- /** @throws IllegalArgumentException if the name is null */
- public void setParameter(String name, String value)
- {
- PortletUtils.checkPortletParameterValidity(name, value);
-
- //
- url.getInternalParameters().setValue(name, value);
- }
-
- public void setParameter(String name, String[] values)
- {
- PortletUtils.checkPortletParameterValidity(name, values);
-
- //
- url.getInternalParameters().setValues(name, values);
- }
-
- public void setParameters(Map<String, String[]> parameters)
- {
- PortletUtils.checkPortletParameterMapValidity(parameters);
-
- //
- url.getInternalParameters().replace(parameters);
- }
-
- public void setSecure(boolean secure) throws PortletSecurityException
- {
- this.secure = Boolean.valueOf(secure);
- }
-
- public String toString()
- {
- PortletInvocationContext responseContext = inv.getPortletContext();
- return responseContext.renderURL(url, secure, null, true);
- }
-
- public static abstract class InternalPortletURL implements
org.jboss.portal.portlet.PortletURL
- {
-
- /** . */
- private WindowState windowState;
-
- /** . */
- private PortletMode portletMode;
-
- public Mode getMode()
- {
- if (portletMode != null)
- {
- return Mode.create(portletMode.toString());
- }
- return null;
- }
-
- public org.jboss.portal.WindowState getWindowState()
- {
- if (windowState != null)
- {
- return org.jboss.portal.WindowState.create(windowState.toString());
- }
- return null;
- }
-
- protected abstract PortletParameters getInternalParameters();
- }
-
- public static class InternalActionURL extends InternalPortletURL implements ActionURL
- {
-
- /** . */
- private PortletParametersStateString parameters = new
PortletParametersStateString();
-
- protected PortletParameters getInternalParameters()
- {
- return parameters.getParameters();
- }
-
- public StateString getInteractionState()
- {
- return parameters;
- }
-
- /** The portlet container does not need to have the navigational state provided.
*/
- public StateString getNavigationalState()
- {
- return null;
- }
- }
-
- public static class InternalRenderURL extends InternalPortletURL implements RenderURL
- {
-
- /** . */
- private PortletParametersStateString navigationalState = new
PortletParametersStateString();
-
- protected PortletParameters getInternalParameters()
- {
- return navigationalState.getParameters();
- }
-
- public StateString getNavigationalState()
- {
- return navigationalState;
- }
- }
-
public PortletMode getPortletMode()
{
throw new NotYetImplemented();
@@ -215,29 +88,4 @@
{
throw new NotYetImplemented();
}
-
- public Map<String, String[]> getParameterMap()
- {
- throw new NotYetImplemented();
- }
-
- public void write(Writer writer) throws IOException
- {
- throw new NotYetImplemented();
- }
-
- public void write(Writer writer, boolean b) throws IOException
- {
- throw new NotYetImplemented();
- }
-
- public void addProperty(String s, String s1)
- {
- throw new NotYetImplemented();
- }
-
- public void setProperty(String s, String s1)
- {
- throw new NotYetImplemented();
- }
}