JBoss Portal SVN: r5984 - in trunk/workflow/src/main/org/jboss/portal/workflow: cms and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 15:01:45 -0500 (Wed, 10 Jan 2007)
New Revision: 5984
Modified:
trunk/workflow/src/main/org/jboss/portal/workflow/WorkflowException.java
trunk/workflow/src/main/org/jboss/portal/workflow/cms/TaskExceptionHandler.java
trunk/workflow/src/main/org/jboss/portal/workflow/service/WorkflowServiceImpl.java
trunk/workflow/src/main/org/jboss/portal/workflow/test/Finalize.java
trunk/workflow/src/main/org/jboss/portal/workflow/test/PortalCMSPublish.java
trunk/workflow/src/main/org/jboss/portal/workflow/test/PublishAssignmentHandler.java
Log:
optimize imports in workflow
Modified: trunk/workflow/src/main/org/jboss/portal/workflow/WorkflowException.java
===================================================================
--- trunk/workflow/src/main/org/jboss/portal/workflow/WorkflowException.java 2007-01-10 19:59:04 UTC (rev 5983)
+++ trunk/workflow/src/main/org/jboss/portal/workflow/WorkflowException.java 2007-01-10 20:01:45 UTC (rev 5984)
@@ -34,7 +34,7 @@
*/
public WorkflowException()
{
- this("");
+ super();
}
/**
Modified: trunk/workflow/src/main/org/jboss/portal/workflow/cms/TaskExceptionHandler.java
===================================================================
--- trunk/workflow/src/main/org/jboss/portal/workflow/cms/TaskExceptionHandler.java 2007-01-10 19:59:04 UTC (rev 5983)
+++ trunk/workflow/src/main/org/jboss/portal/workflow/cms/TaskExceptionHandler.java 2007-01-10 20:01:45 UTC (rev 5984)
@@ -22,9 +22,9 @@
******************************************************************************/
package org.jboss.portal.workflow.cms;
-import org.jbpm.graph.def.*;
-import org.jbpm.graph.exe.*;
import org.jbpm.taskmgmt.exe.TaskInstance;
+import org.jbpm.graph.exe.ExecutionContext;
+import org.jbpm.graph.def.ActionHandler;
/**
Modified: trunk/workflow/src/main/org/jboss/portal/workflow/service/WorkflowServiceImpl.java
===================================================================
--- trunk/workflow/src/main/org/jboss/portal/workflow/service/WorkflowServiceImpl.java 2007-01-10 19:59:04 UTC (rev 5983)
+++ trunk/workflow/src/main/org/jboss/portal/workflow/service/WorkflowServiceImpl.java 2007-01-10 20:01:45 UTC (rev 5984)
@@ -22,36 +22,19 @@
******************************************************************************/
package org.jboss.portal.workflow.service;
-
import org.apache.log4j.Logger;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jbpm.JbpmConfiguration;
-import org.jbpm.JbpmContext;
-import org.jbpm.graph.def.ProcessDefinition;
-import java.io.StringWriter;
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.transform.Source;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-
/**
* @author sohil.shah(a)jboss.com
*
*/
public class WorkflowServiceImpl extends AbstractJBossService implements WorkflowService
{
+
private static Logger log = Logger.getLogger(WorkflowServiceImpl.class);
-
private JbpmConfiguration jbpmConfiguration = null;
private String jbpmConfigurationXml = null;
Modified: trunk/workflow/src/main/org/jboss/portal/workflow/test/Finalize.java
===================================================================
--- trunk/workflow/src/main/org/jboss/portal/workflow/test/Finalize.java 2007-01-10 19:59:04 UTC (rev 5983)
+++ trunk/workflow/src/main/org/jboss/portal/workflow/test/Finalize.java 2007-01-10 20:01:45 UTC (rev 5984)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.workflow.test;
-import org.jbpm.graph.def.*;
-import org.jbpm.graph.exe.*;
+import org.jbpm.graph.def.ActionHandler;
+import org.jbpm.graph.exe.ExecutionContext;
// MyActionHandler represents a class that could execute
Modified: trunk/workflow/src/main/org/jboss/portal/workflow/test/PortalCMSPublish.java
===================================================================
--- trunk/workflow/src/main/org/jboss/portal/workflow/test/PortalCMSPublish.java 2007-01-10 19:59:04 UTC (rev 5983)
+++ trunk/workflow/src/main/org/jboss/portal/workflow/test/PortalCMSPublish.java 2007-01-10 20:01:45 UTC (rev 5984)
@@ -22,9 +22,6 @@
******************************************************************************/
package org.jboss.portal.workflow.test;
-import java.util.*;
-
-import org.jbpm.graph.exe.*;
import org.jbpm.JbpmConfiguration;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
@@ -34,6 +31,9 @@
import junit.framework.TestCase;
+import java.util.Collection;
+import java.util.Iterator;
+
/**
* @author sohil.shah(a)jboss.com
*/
Modified: trunk/workflow/src/main/org/jboss/portal/workflow/test/PublishAssignmentHandler.java
===================================================================
--- trunk/workflow/src/main/org/jboss/portal/workflow/test/PublishAssignmentHandler.java 2007-01-10 19:59:04 UTC (rev 5983)
+++ trunk/workflow/src/main/org/jboss/portal/workflow/test/PublishAssignmentHandler.java 2007-01-10 20:01:45 UTC (rev 5984)
@@ -24,10 +24,10 @@
import java.util.Collection;
-import org.jbpm.graph.exe.*;
-import org.jbpm.taskmgmt.def.*;
import org.jbpm.taskmgmt.exe.Assignable;
import org.jbpm.taskmgmt.exe.TaskInstance;
+import org.jbpm.taskmgmt.def.AssignmentHandler;
+import org.jbpm.graph.exe.ExecutionContext;
/**
* @author sohil.shah(a)jboss.com
19 years, 3 months
JBoss Portal SVN: r5983 - trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 14:59:04 -0500 (Wed, 10 Jan 2007)
New Revision: 5983
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java
Log:
idea config : workflow does not depend on cms + workflow export jBPM lib as it is exposed in the public API
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java 2007-01-10 19:56:05 UTC (rev 5982)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/command/ContentCreateNewVersionCommand.java 2007-01-10 19:59:04 UTC (rev 5983)
@@ -46,6 +46,7 @@
*/
public class ContentCreateNewVersionCommand extends JCRCommand
{
+
/** The serialVersionUID */
private static final long serialVersionUID = -4055346144913229565L;
List mContents = new ArrayList();
19 years, 3 months
JBoss Portal SVN: r5982 - trunk/build/ide/intellij/idea60/modules/cms.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 14:56:05 -0500 (Wed, 10 Jan 2007)
New Revision: 5982
Modified:
trunk/build/ide/intellij/idea60/modules/cms/cms.iml
Log:
make cms idea module depend on workflow
Modified: trunk/build/ide/intellij/idea60/modules/cms/cms.iml
===================================================================
--- trunk/build/ide/intellij/idea60/modules/cms/cms.iml 2007-01-10 16:24:46 UTC (rev 5981)
+++ trunk/build/ide/intellij/idea60/modules/cms/cms.iml 2007-01-10 19:56:05 UTC (rev 5982)
@@ -169,6 +169,7 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="identity" />
+ <orderEntry type="module" module-name="workflow" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
19 years, 3 months
JBoss Portal SVN: r5981 - trunk/cms/src/main/org/jboss/portal/cms/impl/jcr.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 11:24:46 -0500 (Wed, 10 Jan 2007)
New Revision: 5981
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
Log:
minor issue introduced in prevrioius commit, oups
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-01-10 16:23:58 UTC (rev 5980)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-01-10 16:24:46 UTC (rev 5981)
@@ -233,14 +233,15 @@
{
try
{
-
return (UserModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
}
- catch (IdentityException e)
+ catch (IdentityException ignore)
{
- return null;
}
}
+
+ //
+ return null;
}
public IdentityServiceController getIdentityServiceController()
19 years, 3 months
JBoss Portal SVN: r5980 - trunk/cms/src/main/org/jboss/portal/cms/impl/jcr.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 11:23:58 -0500 (Wed, 10 Jan 2007)
New Revision: 5980
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
Log:
don't try to return UserModule if identity service controller is null in JCRCMS
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-01-10 16:03:11 UTC (rev 5979)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-01-10 16:23:58 UTC (rev 5980)
@@ -229,14 +229,18 @@
public UserModule getUserModule()
{
- try
+ if (identityServiceController != null)
{
- return (UserModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+ try
+ {
+
+ return (UserModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+ }
+ catch (IdentityException e)
+ {
+ return null;
+ }
}
- catch (IdentityException e)
- {
- return null;
- }
}
public IdentityServiceController getIdentityServiceController()
19 years, 3 months
JBoss Portal SVN: r5979 - in trunk: common/src/main/org/jboss/portal/common/util and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 11:03:11 -0500 (Wed, 10 Jan 2007)
New Revision: 5979
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
trunk/common/src/main/org/jboss/portal/common/util/JNDI.java
Log:
- make JCRCMS uses JNDI binding utility
- added javadoc to JNDI binding utility
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-01-10 15:47:37 UTC (rev 5978)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-01-10 16:03:11 UTC (rev 5979)
@@ -25,7 +25,6 @@
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.jboss.cache.Version;
-import org.jboss.naming.NonSerializableFactory;
import org.jboss.portal.cms.CMS;
import org.jboss.portal.cms.CMSException;
import org.jboss.portal.cms.CMSMimeMappings;
@@ -47,6 +46,7 @@
import org.jboss.portal.common.net.URLVisitor;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.common.util.XML;
+import org.jboss.portal.common.util.JNDI;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portal.identity.IdentityServiceController;
@@ -65,7 +65,6 @@
import javax.jcr.Session;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
-import javax.naming.CompositeName;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URL;
@@ -106,6 +105,8 @@
private String jndiName;
+ private JNDI.Binding jndiBinding;
+
private InvocationHandler handler = new InvocationHandler()
{
public Object invoke(Invocation invocation) throws Exception, InvocationException
@@ -271,7 +272,8 @@
{
if (this.jndiName != null)
{
- NonSerializableFactory.rebind(new CompositeName(this.jndiName), this, true);
+ jndiBinding = new JNDI.Binding(jndiName, this);
+ jndiBinding.bind();
}
//check the version of jbosscache being run
@@ -298,17 +300,11 @@
/** Shuts down the repo and unregisters it */
public void stopService()
{
- try
- {
- if (this.jndiName != null)
- {
- NonSerializableFactory.unbind(this.jndiName);
- }
- }
- catch(Exception e)
- {
- log.error(this, e);
- }
+ if (jndiBinding != null)
+ {
+ jndiBinding.unbind();
+ jndiBinding = null;
+ }
log.info("Stopping JCR CMS");
stopJCR();
// removeInterceptors();
Modified: trunk/common/src/main/org/jboss/portal/common/util/JNDI.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/JNDI.java 2007-01-10 15:47:37 UTC (rev 5978)
+++ trunk/common/src/main/org/jboss/portal/common/util/JNDI.java 2007-01-10 16:03:11 UTC (rev 5979)
@@ -26,14 +26,49 @@
import javax.naming.CompositeName;
import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
/**
+ * Various JNDI stuff.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public class JNDI
{
+ /**
+ * Encapsulate JNDI binding operation into one single class, hidding non usefull JNDI complexity.
+ * It has been designed to fit with service life cycle.
+ *
+ * <code>
+ *
+ * private String jndiName;
+ * private JNDI.Binding jndiBinding;
+ *
+ * public void startService() throws Exception
+ * {
+ * ...
+ * if (this.jndiName != null)
+ * {
+ * jndiBinding = new JNDI.Binding(jndiName, this);
+ * jndiBinding.bind();
+ * }
+ * ...
+ * }
+ *
+ * public void stopService() throws Exception
+ * {
+ * ...
+ * if (jndiBinding != null)
+ * {
+ * jndiBinding.unbind();
+ * jndiBinding = null;
+ * }
+ * ...
+ * }
+ * </code>
+ */
public static class Binding
{
@@ -60,12 +95,20 @@
this.o = o;
}
- public void bind() throws Exception
+ /**
+ * Attempt to perform binding.
+ *
+ * @throws NamingException on failure
+ */
+ public void bind() throws NamingException
{
NonSerializableFactory.rebind(new CompositeName(jndiName), o, true);
unbindJNDIName = jndiName;
}
+ /**
+ * Unbinds in a safe manner.
+ */
public void unbind()
{
if (unbindJNDIName != null)
19 years, 3 months
JBoss Portal SVN: r5978 - in trunk: core/src/resources/portal-cms-sar/META-INF and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 10:47:37 -0500 (Wed, 10 Jan 2007)
New Revision: 5978
Modified:
trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml
trunk/identity/src/main/org/jboss/portal/identity/IdentityContext.java
trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
trunk/identity/src/main/org/jboss/portal/identity/IdentityServiceController.java
Log:
- make JCRCMS not use JNDI to lookup user module, instead inject identity service controller and retrieve user module from it. It was causing test case to fail in CMS
- use copy on write hashmap in identity service controller
Modified: trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java
===================================================================
--- trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-01-10 15:18:22 UTC (rev 5977)
+++ trunk/cms/src/main/org/jboss/portal/cms/impl/jcr/JCRCMS.java 2007-01-10 15:47:37 UTC (rev 5978)
@@ -49,6 +49,9 @@
import org.jboss.portal.common.util.XML;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
+import org.jboss.portal.identity.IdentityServiceController;
+import org.jboss.portal.identity.IdentityContext;
+import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.workflow.cms.ApprovePublish;
@@ -63,8 +66,6 @@
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import javax.naming.CompositeName;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.URL;
@@ -99,13 +100,12 @@
private Element config;
- private UserModule userModule = null;
+ private IdentityServiceController identityServiceController;
- private ApprovePublish approvePublishWorkflow = null;
+ private ApprovePublish approvePublishWorkflow;
- private String jndiName = null;
+ private String jndiName;
-
private InvocationHandler handler = new InvocationHandler()
{
public Object invoke(Invocation invocation) throws Exception, InvocationException
@@ -226,24 +226,28 @@
this.approvePublishWorkflow = approvePublishWorkflow;
}
- /**
- *
- * @return
- */
public UserModule getUserModule()
{
- return this.userModule;
+ try
+ {
+ return (UserModule)identityServiceController.getIdentityContext().getObject(IdentityContext.TYPE_USER_MODULE);
+ }
+ catch (IdentityException e)
+ {
+ return null;
+ }
}
-
- /**
- *
- * @param userModule
- */
- public void setUserModule(UserModule userModule)
+
+ public IdentityServiceController getIdentityServiceController()
{
- this.userModule = userModule;
+ return identityServiceController;
}
-
+
+ public void setIdentityServiceController(IdentityServiceController identityServiceController)
+ {
+ this.identityServiceController = identityServiceController;
+ }
+
/**
*
* @return
@@ -265,16 +269,6 @@
/** CMS Start */
public void startService() throws Exception
{
- try
- {
- this.userModule = (UserModule)new InitialContext().lookup("java:portal/UserModule");
- }
- catch (NamingException e)
- {
- log.error("Cannot obtain UserModule from JNDI: ", e);
- throw e;
- }
-
if (this.jndiName != null)
{
NonSerializableFactory.rebind(new CompositeName(this.jndiName), this, true);
@@ -390,12 +384,13 @@
URL root = Thread.currentThread().getContextClassLoader().getResource(defaultContentLocation);
//make the user executing these to create the default content, an 'Admin' user
- //without this, the fine grained security won't allow the creation
- if(this.userModule != null)
+ //without this, the fine grained security won't allow the creation
+ UserModule userModule = getUserModule();
+ if(userModule != null)
{
org.hibernate.Session session = org.jboss.portal.cms.hibernate.state.Tools.getOpenSession();
org.hibernate.Transaction tx = session.beginTransaction();
- User user = this.userModule.findUserByUserName("admin");
+ User user = userModule.findUserByUserName("admin");
if(user!=null)
{
JCRCMS.getUserInfo().set(user);
Modified: trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-01-10 15:18:22 UTC (rev 5977)
+++ trunk/core/src/resources/portal-cms-sar/META-INF/jboss-service.xml 2007-01-10 15:47:37 UTC (rev 5978)
@@ -57,10 +57,11 @@
<depends>jboss.jca:service=DataSourceBinding,name=@portal.datasource.name@</depends>
<depends>portal:service=JAASLoginModule</depends>
<depends>portal:service=Hibernate,type=CMS</depends>
- <depends>portal:service=Module,type=IdentityServiceController</depends>
- <!--depends optional-attribute-name="UserModule" proxy-type="attribute">portal:service=Module,type=User</depends-->
- <!-- add this to activate publish/approval workflow integration -->
- <!--depends optional-attribute-name="ApprovePublishWorkflow" proxy-type="attribute">portal:service=ApprovePublish,type=Workflow</depends-->
+ <depends optional-attribute-name="IdentityServiceController" proxy-type="attribute">portal:service=Module,type=IdentityServiceController</depends>
+ <!-- Add this to activate publish/approval workflow integration -->
+ <!--
+ <depends optional-attribute-name="ApprovePublishWorkflow" proxy-type="attribute">portal:service=ApprovePublish,type=Workflow</depends>
+ -->
<depends optional-attribute-name="StackFactory" proxy-type="attribute">portal:service=InterceptorStackFactory,type=Cms</depends>
<attribute name="DoChecking">true</attribute>
<attribute name="DefaultContentLocation">portal/cms/conf/default-content/default/</attribute>
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityContext.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityContext.java 2007-01-10 15:18:22 UTC (rev 5977)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityContext.java 2007-01-10 15:47:37 UTC (rev 5978)
@@ -21,8 +21,6 @@
*/
package org.jboss.portal.identity;
-import org.jboss.portal.identity.IdentityException;
-
/**
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
* @version $Revision: 1.1 $
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-01-10 15:18:22 UTC (rev 5977)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityContextImpl.java 2007-01-10 15:47:37 UTC (rev 5978)
@@ -37,7 +37,7 @@
public class IdentityContextImpl extends AbstractJBossService implements IdentityContext {
//private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(IdentityContextImpl.class);
- private Map registry;
+ private volatile Map registry;
public IdentityContextImpl()
{
@@ -62,7 +62,9 @@
throw new IdentityException("Name: " + name + " already registered.");
}
if (log.isDebugEnabled()) log.debug("registering object: " + name + " ; " + object.getClass());
- registry.put(name, object);
+ Map tmp = new HashMap(registry);
+ tmp.put(name, object);
+ registry = tmp;
}
}
@@ -77,8 +79,9 @@
if(registry.containsKey(name))
{
if (log.isDebugEnabled()) log.debug("unregistering object: " + name);
-
- registry.remove(name);
+ Map tmp = new HashMap(registry);
+ tmp.remove(name);
+ registry = tmp;
}
}
}
@@ -89,18 +92,11 @@
{
throw new IllegalArgumentException("Name cannot be null");
}
-
- //TODO:
- synchronized(this)
+ Object o = registry.get(name);
+ if (o == null)
{
- if (registry.containsKey(name))
- {
- return registry.get(name);
- }
- else
- {
- throw new IdentityException("No such mapping in IdentityContext: " + name);
- }
+ throw new IdentityException("No such mapping in IdentityContext: " + name);
}
+ return o;
}
}
Modified: trunk/identity/src/main/org/jboss/portal/identity/IdentityServiceController.java
===================================================================
--- trunk/identity/src/main/org/jboss/portal/identity/IdentityServiceController.java 2007-01-10 15:18:22 UTC (rev 5977)
+++ trunk/identity/src/main/org/jboss/portal/identity/IdentityServiceController.java 2007-01-10 15:47:37 UTC (rev 5978)
@@ -21,8 +21,6 @@
*/
package org.jboss.portal.identity;
-import org.jboss.portal.identity.IdentityContext;
-
/**
*
* @author <a href="mailto:boleslaw dot dawidowicz at jboss.org">Boleslaw Dawidowicz</a>
19 years, 3 months
JBoss Portal SVN: r5977 - in trunk: core/src/resources/portal-core-sar and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 10:18:22 -0500 (Wed, 10 Jan 2007)
New Revision: 5977
Modified:
trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
trunk/core/src/resources/portal-core-sar/portal-aop.xml
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesSequenceBuilder.java
Log:
- fixed issues in aspect weaving due to refactoring
- commented the 2 portlet tests that cannot technically pass
- fixed wrong portal object test case
Modified: trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2007-01-10 14:09:42 UTC (rev 5976)
+++ trunk/core/src/main/org/jboss/portal/test/core/model/portal/PortalObjectContainerTestCase.java 2007-01-10 15:18:22 UTC (rev 5977)
@@ -159,7 +159,7 @@
assertNull(page.getDeclaredProperty("foo1"));
assertEquals("bar1", page.getProperty("foo1"));
assertEquals("bar2_", page.getDeclaredProperty("foo2"));
- assertEquals("bar2", page.getProperty("foo2"));
+ assertEquals("bar2_", page.getProperty("foo2"));
assertEquals("bar3", page.getDeclaredProperty("foo3"));
assertEquals("bar3", page.getProperty("foo3"));
Modified: trunk/core/src/resources/portal-core-sar/portal-aop.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/portal-aop.xml 2007-01-10 14:09:42 UTC (rev 5976)
+++ trunk/core/src/resources/portal-core-sar/portal-aop.xml 2007-01-10 15:18:22 UTC (rev 5977)
@@ -95,16 +95,16 @@
<metadata
tag="transaction"
class="org.jboss.portal.core.impl.model.instance.PersistentInstanceContainer">
- <method name="getInstance">
+ <method name="getDefinition">
<trans-attribute>Required</trans-attribute>
</method>
- <method name="createInstance">
+ <method name="createDefinition">
<trans-attribute>Required</trans-attribute>
</method>
- <method name="destroyInstance">
+ <method name="destroyDefinition">
<trans-attribute>Required</trans-attribute>
</method>
- <method name="getInstances">
+ <method name="getDefinitions">
<trans-attribute>Required</trans-attribute>
</method>
<method name="invoke">
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java 2007-01-10 14:09:42 UTC (rev 5976)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/portletresponses/PortletResponsesSequenceBuilder.java 2007-01-10 15:18:22 UTC (rev 5977)
@@ -723,11 +723,13 @@
/**
+ * todo : it cannot pass as of today
+ *
* @portlet.specification assert="SPEC:71 - If the setPortletMode or setWindowState methods are called after the
* sendRedirect method has been called an IllegalStateException must be thrown. (...) If the exception is propagated
* back to the portlet-container, the redirection must not be executed."
*/
- public void createIllegalStateExceptionAfterSendRedirectCase(SequenceRegistry registry)
+ public void _createIllegalStateExceptionAfterSendRedirectCase(SequenceRegistry registry)
{
Sequence seq = new Sequence();
registry.addSequence("IllegalStateExceptionAfterSendRedirect", seq);
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesSequenceBuilder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesSequenceBuilder.java 2007-01-10 14:09:42 UTC (rev 5976)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/jsr168/tck/windowstates/WindowStatesSequenceBuilder.java 2007-01-10 15:18:22 UTC (rev 5977)
@@ -52,7 +52,7 @@
* @portlet.specification assert="SPEC:40 - If a custom window state defined in the deployment descriptor is not
* mapped to a custom window state provided by the portal, portlets must not be invoked in that window state."
*/
- public void createCustomStateNotMappedNotInvokedCase(SequenceRegistry registry)
+ public void _createCustomStateNotMappedNotInvokedCase(SequenceRegistry registry)
{
Sequence seq = new Sequence();
registry.addSequence("CustomStateNotMappedNotInvoked", seq);
19 years, 3 months
JBoss Portal SVN: r5976 - in trunk: core/src/main/org/jboss/portal/core/aspects/controller/node and 18 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 09:09:42 -0500 (Wed, 10 Jan 2007)
New Revision: 5976
Added:
trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java
trunk/portlet/src/main/org/jboss/portal/portlet/PortletParametersStateString.java
Removed:
trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java
trunk/portlet/src/main/org/jboss/portal/portlet/ParametersStateString.java
Modified:
trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java
trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestDecoder.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/spi/ActionContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/spi/RenderContext.java
trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/ActionContextSupport.java
trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/PortletRequestDecoderTestCase.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/navigation/StateStringTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
Log:
- renamed Parameters to PortletParameters
- renamed ParametersStateString to PortletParametersStateString
- improved javadoc or PortletInvocationContext, ActionContext, RenderContext
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/PageCustomizerInterceptor.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -44,8 +44,7 @@
import org.jboss.portal.core.model.portal.command.ImportPageToDashboardCommand;
import org.jboss.portal.core.model.CustomizationManager;
import org.jboss.portal.identity.User;
-import org.jboss.portal.portlet.impl.PortletRequestDecoder;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.security.PortalSecurityException;
import org.jboss.portal.security.spi.auth.PortalAuthorizationManagerFactory;
import org.jboss.portal.server.request.URLContext;
@@ -179,7 +178,7 @@
if (isDashboard)
{
// Edit page
- ParametersStateString navState = new ParametersStateString();
+ PortletParametersStateString navState = new PortletParametersStateString();
navState.setValue("editPageSelect", pageName);
InvokePortletInstanceRenderCommand command = new InvokePortletInstanceRenderCommand("ConfiguratorPortletInstance", navState);
dashboardActionURL = controllerCtx.renderURL(command, null, null);
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/EventBroadcasterInterceptor.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -42,8 +42,8 @@
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.event.PortalEventListenerRegistry;
import org.jboss.portal.core.model.instance.Instance;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
@@ -107,10 +107,10 @@
Map params = wae.getParameters();
//
- Parameters interactionParams = null;
+ PortletParameters interactionParams = null;
if (params instanceof LazyParameterMap)
{
- interactionParams = (Parameters)((LazyParameterMap)params).createDelegate();
+ interactionParams = (PortletParameters)((LazyParameterMap)params).createDelegate();
}
else
{
@@ -125,7 +125,7 @@
mode,
windowState,
null,
- new ParametersStateString(interactionParams),
+ new PortletParametersStateString(interactionParams),
null);
}
}
@@ -135,7 +135,7 @@
Map params = wre.getParameters();
//
- Parameters navigationalParams = asParameters(params);
+ PortletParameters navigationalParams = asParameters(params);
//
if (navigationalParams != null)
@@ -144,7 +144,7 @@
nodeRef,
mode,
windowState,
- new ParametersStateString(navigationalParams));
+ new PortletParametersStateString(navigationalParams));
}
}
else if (nextEvent instanceof WindowNavigationEvent)
@@ -167,7 +167,7 @@
LazyParameterMap lpm = (LazyParameterMap)params;
if (lpm.isModified())
{
- iwac.setInteractionState(new ParametersStateString(lpm.params));
+ iwac.setInteractionState(new PortletParametersStateString(lpm.params));
iwac.setFormParameters(null);
}
}
@@ -204,13 +204,13 @@
InvokePortletWindowActionCommand iwac = (InvokePortletWindowActionCommand)wc;
//
- Parameters formParams = iwac.getFormParameters();
+ PortletParameters formParams = iwac.getFormParameters();
//
- Parameters interactionParams = null;
- if (iwac.getInteractionState() instanceof ParametersStateString)
+ PortletParameters interactionParams = null;
+ if (iwac.getInteractionState() instanceof PortletParametersStateString)
{
- interactionParams = ((ParametersStateString)iwac.getInteractionState()).getParameters();
+ interactionParams = ((PortletParametersStateString)iwac.getInteractionState()).getParameters();
}
//
@@ -234,7 +234,7 @@
}
else
{
- params = new Parameters();
+ params = new PortletParameters();
}
}
@@ -254,9 +254,9 @@
if (navigationalState != null)
{
Map params = null;
- if (navigationalState instanceof ParametersStateString)
+ if (navigationalState instanceof PortletParametersStateString)
{
- params = ((ParametersStateString)navigationalState).getParameters();
+ params = ((PortletParametersStateString)navigationalState).getParameters();
}
//
@@ -284,21 +284,21 @@
return null;
}
- private Parameters asParameters(Map map)
+ private PortletParameters asParameters(Map map)
{
if (map == null)
{
return null;
}
- if (map instanceof Parameters)
+ if (map instanceof PortletParameters)
{
- return (Parameters)map;
+ return (PortletParameters)map;
}
else
{
try
{
- return new Parameters(map);
+ return new PortletParameters(map);
}
catch (IllegalArgumentException e)
{
@@ -311,15 +311,15 @@
private static class LazyParameterMap extends LazyMap
{
/** . */
- private Parameters formParams;
+ private PortletParameters formParams;
/** . */
- private Parameters interactionParams;
+ private PortletParameters interactionParams;
/** . */
- private Parameters params;
+ private PortletParameters params;
- public LazyParameterMap(Parameters interactionParams, Parameters formParams)
+ public LazyParameterMap(PortletParameters interactionParams, PortletParameters formParams)
{
this.formParams = formParams;
this.interactionParams = interactionParams;
@@ -330,7 +330,7 @@
{
if (params == null)
{
- params = new Parameters(interactionParams);
+ params = new PortletParameters(interactionParams);
params.append(formParams);
}
return params;
Modified: trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/core/src/main/org/jboss/portal/core/aspects/controller/node/PortalNodeURLFactory.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -24,7 +24,7 @@
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.server.request.URLFormat;
import org.jboss.portal.core.controller.ControllerContext;
@@ -74,7 +74,7 @@
protected PortalObjectId id;
protected ControllerContext controllerContext;
- protected ParametersStateString parameters;
+ protected PortletParametersStateString parameters;
protected Boolean wantSecure;
protected Boolean wantAuthenticated;
protected boolean relative;
@@ -84,7 +84,7 @@
this.id = id;
this.controllerContext = controllerContext;
this.relative = true;
- this.parameters = new ParametersStateString();
+ this.parameters = new PortletParametersStateString();
}
public void setParameter(String name, String value)
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -32,7 +32,7 @@
import org.jboss.portal.core.model.portal.command.InvokePortletWindowRenderCommand;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.core.controller.command.mapper.AbstractCommandFactory;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.server.ServerInvocation;
import java.util.Locale;
@@ -137,7 +137,7 @@
else
{
//Set the content as a render parameter
- ParametersStateString parameters = new ParametersStateString();
+ PortletParametersStateString parameters = new PortletParametersStateString();
parameters.setValue("path", requestPath);
// Perform a render URL on the target window
@@ -150,7 +150,7 @@
{
if(e.toString().indexOf("Access to this resource is denied")!=-1)
{
- ParametersStateString parameters = new ParametersStateString();
+ PortletParametersStateString parameters = new PortletParametersStateString();
parameters.setValue("path", requestPath);
return new InvokePortletWindowRenderCommand(targetWindowId, Mode.VIEW, null, parameters);
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/core/src/main/org/jboss/portal/core/controller/portlet/PortletInvocationFactory.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -26,7 +26,7 @@
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.RenderURL;
@@ -78,7 +78,7 @@
WindowState windowState,
StateString navigationalState,
StateString interactionState,
- Parameters form,
+ PortletParameters form,
Window window,
Portal portal)
{
@@ -93,7 +93,7 @@
WindowState windowState,
StateString navigationalState,
StateString interactionState,
- Parameters form,
+ PortletParameters form,
PortletContextFactory cf,
InvokePortletCommandFactory cpc)
{
@@ -166,7 +166,7 @@
{
private InvokePortletCommandFactory cmdFactory;
private ControllerContext controllerContext;
- public ControllerActionContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo, StateString interactionState, Parameters form)
+ public ControllerActionContext(InvokePortletCommandFactory cmdFactory, ControllerContext controllerContext, Mode mode, WindowState windowState, StateString navigationalState, HTTPStreamInfo streamInfo, StateString interactionState, PortletParameters form)
{
super(mode, windowState, navigationalState, streamInfo, interactionState, form);
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/command/InvokePortletInstanceActionCommand.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -30,7 +30,7 @@
import org.jboss.portal.core.model.instance.InvokePortletInstanceCommandFactory;
import org.jboss.portal.core.model.instance.command.response.PortletInstanceResponse;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -48,9 +48,9 @@
private StateString interactionState;
/** The nform. */
- private Parameters form;
+ private PortletParameters form;
- public InvokePortletInstanceActionCommand(String instanceId, StateString navigationalState, StateString interactionState, Parameters form)
+ public InvokePortletInstanceActionCommand(String instanceId, StateString navigationalState, StateString interactionState, PortletParameters form)
{
super(instanceId, navigationalState);
@@ -64,7 +64,7 @@
return interactionState;
}
- public Parameters getForm()
+ public PortletParameters getForm()
{
return form;
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/command/InvokePortletWindowActionCommand.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -33,7 +33,7 @@
import org.jboss.portal.core.model.portal.command.response.PortletWindowResponse;
import org.jboss.portal.core.model.portal.PortalObjectId;
import org.jboss.portal.portlet.NoSuchPortletException;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -59,7 +59,7 @@
private StateString interactionState;
/** . */
- private Parameters formParameters;
+ private PortletParameters formParameters;
public InvokePortletWindowActionCommand(
PortalObjectId windowId,
@@ -67,7 +67,7 @@
WindowState windowState,
StateString navigationalState,
StateString interactionState,
- Parameters formParameters)
+ PortletParameters formParameters)
throws IllegalArgumentException
{
super(windowId, mode, windowState);
@@ -91,12 +91,12 @@
this.interactionState = interactionState;
}
- public Parameters getFormParameters()
+ public PortletParameters getFormParameters()
{
return formParameters;
}
- public void setFormParameters(Parameters formParameters)
+ public void setFormParameters(PortletParameters formParameters)
{
this.formParameters = formParameters;
}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -1,171 +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;
-
-import org.jboss.portal.common.util.ParameterMap;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-
-/**
- * A set of parameters.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public final class Parameters extends ParameterMap implements Serializable
-{
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -8529807471117491810L;
-
- /** The data. */
- private Map map;
-
- /** Creates an empty parameter set. */
- public Parameters()
- {
- this.map = new HashMap();
- }
-
- /**
- * Copy constructor.
- *
- * @throws IllegalArgumentException if the parameters is null
- */
- public Parameters(Parameters parameters) throws IllegalArgumentException
- {
- if (parameters == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- this.map = new HashMap(parameters.map);
- }
-
- /**
- * Copy the parameter map to initialize the object state.
- *
- * @throws IllegalArgumentException if the parameter map is null or not valid
- * @throws NullPointerException if the map contains a null key or a null value
- * @throws IllegalArgumentException if the map is null or it contains a value with a zero length array or a null
- * element in the array
- * @throws ClassCastException if the map contains a key that is not a string or a value that is not a string
- * array
- */
- public Parameters(Map parameterMap) throws NullPointerException, ClassCastException, IllegalArgumentException
- {
- if (parameterMap == null)
- {
- throw new IllegalArgumentException("No null map accepted");
- }
-
- //
- this.map = new HashMap();
-
- //
- replace(parameterMap);
- }
-
- protected Map getDelegate()
- {
- return map;
- }
-
- /**
- * Append the content of the argument map to that map. If both maps contains an entry sharing the same key, then the
- * string arrays or the two entries will be concatenated into a single array. Each entry present on the argument map
- * and not in the current map will be kept as is. The argument validation is performed before the state is updated.
- *
- * @param params the parameters to appends
- * @throws NullPointerException if the map contains a null key or a null value
- * @throws IllegalArgumentException if the map is null or it contains a value with a zero length array or a null
- * element in the array
- * @throws ClassCastException if the map contains a key that is not a string or a value that is not a string
- * array
- */
- public void append(Map params) throws ClassCastException, NullPointerException, IllegalArgumentException
- {
- validate(params, false);
-
- //
- internalAppend(params);
- }
-
- /** Append actual implementation. */
- private void internalAppend(Map params)
- {
- for (Iterator entries = params.entrySet().iterator(); entries.hasNext();)
- {
- Map.Entry entry = (Map.Entry)entries.next();
- String name = (String)entry.getKey();
- String[] appendedValues = (String[])entry.getValue();
-
- // Merge or use appended values
- String[] values = (String[])map.get(name);
- if (values != null)
- {
- String[] tmp = new String[values.length + appendedValues.length];
- System.arraycopy(values, 0, tmp, 0, values.length);
- System.arraycopy(appendedValues, 0, tmp, values.length, appendedValues.length);
- values = tmp;
- }
- else
- {
- values = appendedValues;
- }
-
- //
- map.put(name, values);
- }
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer("Parameters[");
- if (map != null)
- {
- for (Iterator i = map.entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String name = (String)entry.getKey();
- String[] values = (String[])entry.getValue();
- buffer.append(name);
- for (int j = 0; j < values.length; j++)
- {
- buffer.append(j > 0 ? ',' : '=').append(values[j]);
- }
- if (i.hasNext())
- {
- buffer.append(" | ");
- }
- }
- }
- buffer.append(']');
- return buffer.toString();
- }
-}
Deleted: trunk/portlet/src/main/org/jboss/portal/portlet/ParametersStateString.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/ParametersStateString.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/ParametersStateString.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -1,293 +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;
-
-import org.jboss.portal.common.util.Base64;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * A set of parameters.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class ParametersStateString extends StateString implements Serializable
-{
- /** . */
- public static final String JBPNS_PREFIX = "JBPNS_";
-
- /** The serialVersionUID */
- private static final long serialVersionUID = -8529807471117491810L;
-
- /** . */
- private static final String EOF = "__EOF__";
-
- /** The data. */
- private Parameters parameters;
-
- public ParametersStateString(String opaqueValue)
- {
- if (opaqueValue == null)
- {
- throw new IllegalArgumentException("No navigational state provided");
- }
- if (!opaqueValue.startsWith(JBPNS_PREFIX))
- {
- throw new IllegalArgumentException("Bad format");
- }
- opaqueValue = opaqueValue.substring(JBPNS_PREFIX.length());
- if (opaqueValue.length() > 0)
- {
- try
- {
- byte[] bytes = Base64.decode(opaqueValue, true);
- ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
- ObjectInputStream ois = new ObjectInputStream(bais);
- Map params = new HashMap();
-
- String[] values = null;
-
- // read the first String which should be a param name
- String current = ois.readUTF();
-
- // keep reading until we haven't reached the EOF marker
- while (!EOF.equals(current))
- {
- // next is the size of the value array
- int length = ois.readInt();
- values = new String[length];
-
- // read as many Strings as are supposed to be in the array
- for (int i = 0; i < length; i++)
- {
- values[i] = ois.readUTF();
- }
-
- // we're done for this param, add it to the param map
- params.put(current, values);
-
- // read the next string to loop
- current = ois.readUTF();
- }
-
- parameters = new Parameters(params);
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
- else
- {
- parameters = new Parameters();
- }
- }
-
- /** Creates an empty parameter set. */
- public ParametersStateString()
- {
- this.parameters = new Parameters();
- }
-
- /**
- * Copy the parameter map to initialize the object state.
- *
- * @throws IllegalArgumentException if the parameter map is null or not valid
- */
- public ParametersStateString(Parameters parameterMap)
- {
- this.parameters = new Parameters(parameterMap);
- }
-
- /**
- * Return the parameter value or null if it does not exist.
- *
- * @param name the parameter name
- * @return the parameter value or null if it does not exist
- * @throws IllegalArgumentException if the name is null
- */
- public String getValue(String name) throws IllegalArgumentException
- {
- return parameters.getValue(name);
- }
-
- /**
- * Return the parameter values or null if it does not exist.
- *
- * @param name the value to get
- * @return the parameter values
- * @throws IllegalArgumentException if the name is null
- */
- public String[] getValues(String name) throws IllegalArgumentException
- {
- return parameters.getValues(name);
- }
-
- /** Return the a map containing the values. */
- public Map getMap()
- {
- return parameters;
- }
-
- /** Clear all the parameters. */
- public void clear()
- {
- parameters.clear();
- }
-
- /**
- * Replace all the parameters.
- *
- * @throws IllegalArgumentException if the map is not valid
- */
- public void replace(Map map)
- {
- this.parameters.replace(map);
- }
-
- /**
- * Set the a parameter value.
- *
- * @param name the parameter name
- * @param value the parameter value
- * @throws IllegalArgumentException if the name is null
- * @throws IllegalArgumentException if the value is null
- */
- public void setValue(String name, String value)
- {
- parameters.setValue(name, value);
- }
-
- /**
- * Set the parameter values. This method does not make a defensive copy of the values.
- *
- * @param name the parameter name
- * @param values the parameter values
- * @throws IllegalArgumentException if the name is null
- */
- public void setValues(String name, String[] values)
- {
- parameters.setValues(name, values);
- }
-
- /**
- * Remove a parameter.
- *
- * @throws IllegalArgumentException if the name is null
- */
- public void remove(String name)
- {
- parameters.remove(name);
- }
-
- /** Return the size. */
- public int getSize()
- {
- return parameters.size();
- }
-
- /**
- * Return the underlying parameter object.
- *
- * @return the parameter object
- */
- public Parameters getParameters()
- {
- return parameters;
- }
-
- /**
- * Retrieves the opaque version associated with this navigational state.
- *
- * @return a URL-safe String representation of this navigational state.
- */
- public String getStringValue()
- {
- if (parameters != null && parameters.size() != 0)
- {
- try
- {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- for (Iterator entries = parameters.entrySet().iterator(); entries.hasNext();)
- {
- Map.Entry entry = (Map.Entry)entries.next();
- String name = (String)entry.getKey();
- oos.writeUTF(name);
- String[] values = (String[])entry.getValue();
- int length = values.length;
- oos.writeInt(length);
- for (int i = 0; i < values.length; i++)
- {
- oos.writeUTF(values[i]);
- }
- }
- oos.writeUTF(EOF);
- oos.close();
- byte[] bytes = baos.toByteArray();
- return JBPNS_PREFIX + Base64.encodeBytes(bytes, true);
- }
- catch (IOException e)
- {
- throw new RuntimeException(e);
- }
- }
- else
- {
- return JBPNS_PREFIX;
- }
- }
-
- public int hashCode()
- {
- return getMap().hashCode();
- }
-
- public boolean equals(Object o)
- {
- if (o == this)
- {
- return true;
- }
- if (o instanceof ParametersStateString)
- {
- ParametersStateString that = (ParametersStateString)o;
- return that.parameters.equals(parameters);
- }
- return false;
- }
-
- public String toString()
- {
- return "StateString[" + parameters + "]";
- }
-}
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java (from rev 5972, trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java 2007-01-10 02:17:27 UTC (rev 5972)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -0,0 +1,171 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.portal.common.util.ParameterMap;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+
+/**
+ * A set of parameters.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public final class PortletParameters extends ParameterMap implements Serializable
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8529807471117491810L;
+
+ /** The data. */
+ private Map map;
+
+ /** Creates an empty parameter set. */
+ public PortletParameters()
+ {
+ this.map = new HashMap();
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @throws IllegalArgumentException if the parameters is null
+ */
+ public PortletParameters(PortletParameters parameters) throws IllegalArgumentException
+ {
+ if (parameters == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ this.map = new HashMap(parameters.map);
+ }
+
+ /**
+ * Copy the parameter map to initialize the object state.
+ *
+ * @throws IllegalArgumentException if the parameter map is null or not valid
+ * @throws NullPointerException if the map contains a null key or a null value
+ * @throws IllegalArgumentException if the map is null or it contains a value with a zero length array or a null
+ * element in the array
+ * @throws ClassCastException if the map contains a key that is not a string or a value that is not a string
+ * array
+ */
+ public PortletParameters(Map parameterMap) throws NullPointerException, ClassCastException, IllegalArgumentException
+ {
+ if (parameterMap == null)
+ {
+ throw new IllegalArgumentException("No null map accepted");
+ }
+
+ //
+ this.map = new HashMap();
+
+ //
+ replace(parameterMap);
+ }
+
+ protected Map getDelegate()
+ {
+ return map;
+ }
+
+ /**
+ * Append the content of the argument map to that map. If both maps contains an entry sharing the same key, then the
+ * string arrays or the two entries will be concatenated into a single array. Each entry present on the argument map
+ * and not in the current map will be kept as is. The argument validation is performed before the state is updated.
+ *
+ * @param params the parameters to appends
+ * @throws NullPointerException if the map contains a null key or a null value
+ * @throws IllegalArgumentException if the map is null or it contains a value with a zero length array or a null
+ * element in the array
+ * @throws ClassCastException if the map contains a key that is not a string or a value that is not a string
+ * array
+ */
+ public void append(Map params) throws ClassCastException, NullPointerException, IllegalArgumentException
+ {
+ validate(params, false);
+
+ //
+ internalAppend(params);
+ }
+
+ /** Append actual implementation. */
+ private void internalAppend(Map params)
+ {
+ for (Iterator entries = params.entrySet().iterator(); entries.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)entries.next();
+ String name = (String)entry.getKey();
+ String[] appendedValues = (String[])entry.getValue();
+
+ // Merge or use appended values
+ String[] values = (String[])map.get(name);
+ if (values != null)
+ {
+ String[] tmp = new String[values.length + appendedValues.length];
+ System.arraycopy(values, 0, tmp, 0, values.length);
+ System.arraycopy(appendedValues, 0, tmp, values.length, appendedValues.length);
+ values = tmp;
+ }
+ else
+ {
+ values = appendedValues;
+ }
+
+ //
+ map.put(name, values);
+ }
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer("Parameters[");
+ if (map != null)
+ {
+ for (Iterator i = map.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)i.next();
+ String name = (String)entry.getKey();
+ String[] values = (String[])entry.getValue();
+ buffer.append(name);
+ for (int j = 0; j < values.length; j++)
+ {
+ buffer.append(j > 0 ? ',' : '=').append(values[j]);
+ }
+ if (i.hasNext())
+ {
+ buffer.append(" | ");
+ }
+ }
+ }
+ buffer.append(']');
+ return buffer.toString();
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/PortletParameters.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/portlet/src/main/org/jboss/portal/portlet/PortletParametersStateString.java (from rev 5968, trunk/portlet/src/main/org/jboss/portal/portlet/ParametersStateString.java)
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/ParametersStateString.java 2007-01-09 00:35:52 UTC (rev 5968)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/PortletParametersStateString.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -0,0 +1,293 @@
+/******************************************************************************
+ * 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;
+
+import org.jboss.portal.common.util.Base64;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * A set of parameters.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision$
+ */
+public class PortletParametersStateString extends StateString implements Serializable
+{
+ /** . */
+ public static final String JBPNS_PREFIX = "JBPNS_";
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -8529807471117491810L;
+
+ /** . */
+ private static final String EOF = "__EOF__";
+
+ /** The data. */
+ private PortletParameters parameters;
+
+ public PortletParametersStateString(String opaqueValue)
+ {
+ if (opaqueValue == null)
+ {
+ throw new IllegalArgumentException("No navigational state provided");
+ }
+ if (!opaqueValue.startsWith(JBPNS_PREFIX))
+ {
+ throw new IllegalArgumentException("Bad format");
+ }
+ opaqueValue = opaqueValue.substring(JBPNS_PREFIX.length());
+ if (opaqueValue.length() > 0)
+ {
+ try
+ {
+ byte[] bytes = Base64.decode(opaqueValue, true);
+ ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ Map params = new HashMap();
+
+ String[] values = null;
+
+ // read the first String which should be a param name
+ String current = ois.readUTF();
+
+ // keep reading until we haven't reached the EOF marker
+ while (!EOF.equals(current))
+ {
+ // next is the size of the value array
+ int length = ois.readInt();
+ values = new String[length];
+
+ // read as many Strings as are supposed to be in the array
+ for (int i = 0; i < length; i++)
+ {
+ values[i] = ois.readUTF();
+ }
+
+ // we're done for this param, add it to the param map
+ params.put(current, values);
+
+ // read the next string to loop
+ current = ois.readUTF();
+ }
+
+ parameters = new PortletParameters(params);
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ else
+ {
+ parameters = new PortletParameters();
+ }
+ }
+
+ /** Creates an empty parameter set. */
+ public PortletParametersStateString()
+ {
+ this.parameters = new PortletParameters();
+ }
+
+ /**
+ * Copy the parameter map to initialize the object state.
+ *
+ * @throws IllegalArgumentException if the parameter map is null or not valid
+ */
+ public PortletParametersStateString(PortletParameters parameterMap)
+ {
+ this.parameters = new PortletParameters(parameterMap);
+ }
+
+ /**
+ * Return the parameter value or null if it does not exist.
+ *
+ * @param name the parameter name
+ * @return the parameter value or null if it does not exist
+ * @throws IllegalArgumentException if the name is null
+ */
+ public String getValue(String name) throws IllegalArgumentException
+ {
+ return parameters.getValue(name);
+ }
+
+ /**
+ * Return the parameter values or null if it does not exist.
+ *
+ * @param name the value to get
+ * @return the parameter values
+ * @throws IllegalArgumentException if the name is null
+ */
+ public String[] getValues(String name) throws IllegalArgumentException
+ {
+ return parameters.getValues(name);
+ }
+
+ /** Return the a map containing the values. */
+ public Map getMap()
+ {
+ return parameters;
+ }
+
+ /** Clear all the parameters. */
+ public void clear()
+ {
+ parameters.clear();
+ }
+
+ /**
+ * Replace all the parameters.
+ *
+ * @throws IllegalArgumentException if the map is not valid
+ */
+ public void replace(Map map)
+ {
+ this.parameters.replace(map);
+ }
+
+ /**
+ * Set the a parameter value.
+ *
+ * @param name the parameter name
+ * @param value the parameter value
+ * @throws IllegalArgumentException if the name is null
+ * @throws IllegalArgumentException if the value is null
+ */
+ public void setValue(String name, String value)
+ {
+ parameters.setValue(name, value);
+ }
+
+ /**
+ * Set the parameter values. This method does not make a defensive copy of the values.
+ *
+ * @param name the parameter name
+ * @param values the parameter values
+ * @throws IllegalArgumentException if the name is null
+ */
+ public void setValues(String name, String[] values)
+ {
+ parameters.setValues(name, values);
+ }
+
+ /**
+ * Remove a parameter.
+ *
+ * @throws IllegalArgumentException if the name is null
+ */
+ public void remove(String name)
+ {
+ parameters.remove(name);
+ }
+
+ /** Return the size. */
+ public int getSize()
+ {
+ return parameters.size();
+ }
+
+ /**
+ * Return the underlying parameter object.
+ *
+ * @return the parameter object
+ */
+ public PortletParameters getParameters()
+ {
+ return parameters;
+ }
+
+ /**
+ * Retrieves the opaque version associated with this navigational state.
+ *
+ * @return a URL-safe String representation of this navigational state.
+ */
+ public String getStringValue()
+ {
+ if (parameters != null && parameters.size() != 0)
+ {
+ try
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ for (Iterator entries = parameters.entrySet().iterator(); entries.hasNext();)
+ {
+ Map.Entry entry = (Map.Entry)entries.next();
+ String name = (String)entry.getKey();
+ oos.writeUTF(name);
+ String[] values = (String[])entry.getValue();
+ int length = values.length;
+ oos.writeInt(length);
+ for (int i = 0; i < values.length; i++)
+ {
+ oos.writeUTF(values[i]);
+ }
+ }
+ oos.writeUTF(EOF);
+ oos.close();
+ byte[] bytes = baos.toByteArray();
+ return JBPNS_PREFIX + Base64.encodeBytes(bytes, true);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ else
+ {
+ return JBPNS_PREFIX;
+ }
+ }
+
+ public int hashCode()
+ {
+ return getMap().hashCode();
+ }
+
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof PortletParametersStateString)
+ {
+ PortletParametersStateString that = (PortletParametersStateString)o;
+ return that.parameters.equals(parameters);
+ }
+ return false;
+ }
+
+ public String toString()
+ {
+ return "StateString[" + parameters + "]";
+ }
+}
Property changes on: trunk/portlet/src/main/org/jboss/portal/portlet/PortletParametersStateString.java
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/ConsumerCacheInterceptor.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -30,7 +30,7 @@
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.spi.RenderContext;
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.invocation.AttributeResolver;
@@ -89,17 +89,17 @@
{
useEntry = true;
}
- else if (entryNavState instanceof ParametersStateString)
+ else if (entryNavState instanceof PortletParametersStateString)
{
// We consider a parameters state string empty equivalent to a null value
- useEntry = ((ParametersStateString)entryNavState).getSize() == 0;
+ useEntry = ((PortletParametersStateString)entryNavState).getSize() == 0;
}
}
else if (entryNavState == null)
{
- if (navState instanceof ParametersStateString)
+ if (navState instanceof PortletParametersStateString)
{
- useEntry = ((ParametersStateString)navState).getSize() == 0;
+ useEntry = ((PortletParametersStateString)navState).getSize() == 0;
}
}
else
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestDecoder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestDecoder.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestDecoder.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -25,8 +25,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.OpaqueStateString;
import java.util.Iterator;
@@ -94,7 +94,7 @@
private StateString interactionState;
/** . */
- private Parameters form;
+ private PortletParameters form;
/** . */
private int type;
@@ -170,7 +170,7 @@
if (!opaque)
{
// Compute the parameters skipping the portlet navigational state that may be encoded as well
- ParametersStateString query = new ParametersStateString();
+ PortletParametersStateString query = new PortletParametersStateString();
for (Iterator i = queryParams.entrySet().iterator(); i.hasNext();)
{
Map.Entry entry = (Map.Entry)i.next();
@@ -202,7 +202,7 @@
}
// Julien :
- Parameters form = new Parameters();
+ PortletParameters form = new PortletParameters();
if (bodyParams != null)
{
form.putAll(bodyParams);
@@ -250,7 +250,7 @@
}
//
- form = new Parameters();
+ form = new PortletParameters();
if (bodyParams != null)
{
form.putAll(bodyParams);
@@ -312,7 +312,7 @@
return interactionState;
}
- public Parameters getForm()
+ public PortletParameters getForm()
{
return form;
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/PortletRequestEncoder.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -25,8 +25,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.ParametersStateString;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.server.ServerURL;
import java.util.Iterator;
@@ -51,7 +51,7 @@
//
if (interactionState != null)
{
- if (interactionState instanceof ParametersStateString)
+ if (interactionState instanceof PortletParametersStateString)
{
if (navigationalState != null)
{
@@ -59,7 +59,7 @@
}
// Add the parameters
- Parameters parameters = ((ParametersStateString)interactionState).getParameters();
+ PortletParameters parameters = ((PortletParametersStateString)interactionState).getParameters();
configure(url, parameters);
}
else
@@ -92,10 +92,10 @@
//
if (navigationalState != null)
{
- if (navigationalState instanceof ParametersStateString)
+ if (navigationalState instanceof PortletParametersStateString)
{
// Add the parameters
- Parameters parameters = ((ParametersStateString)navigationalState).getParameters();
+ PortletParameters parameters = ((PortletParametersStateString)navigationalState).getParameters();
configure(url, parameters);
}
else
@@ -111,7 +111,7 @@
configure(meta, url, mode, windowState);
}
- private static void configure(ServerURL url, Parameters parameters)
+ private static void configure(ServerURL url, PortletParameters parameters)
{
for (Iterator i = parameters.entrySet().iterator(); i.hasNext();)
{
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionRequestImpl.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -22,8 +22,8 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.spi.ActionContext;
@@ -56,14 +56,14 @@
if (interactionState != null)
{
// Unserialize the interaction state if necessary
- ParametersStateString parametersState = null;
- if (interactionState instanceof ParametersStateString)
+ PortletParametersStateString parametersState = null;
+ if (interactionState instanceof PortletParametersStateString)
{
- parametersState = (ParametersStateString)interactionState;
+ parametersState = (PortletParametersStateString)interactionState;
}
else
{
- parametersState = new ParametersStateString(interactionState.getStringValue());
+ parametersState = new PortletParametersStateString(interactionState.getStringValue());
}
//
@@ -71,7 +71,7 @@
}
//
- Parameters form = actionContext.getForm();
+ PortletParameters form = actionContext.getForm();
if (form != null)
{
if (parameters == null)
@@ -80,7 +80,7 @@
}
else
{
- parameters = new Parameters(parameters);
+ parameters = new PortletParameters(parameters);
parameters.append(form);
}
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/ActionResponseImpl.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -25,7 +25,7 @@
import org.apache.log4j.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.invocation.ActionInvocation;
import org.jboss.portal.portlet.invocation.response.HTTPRedirectionResponse;
import org.jboss.portal.portlet.invocation.response.PortletInvocationResponse;
@@ -62,7 +62,7 @@
//
RenderResponse rr = new RenderResponse();
- rr.setNavigationalState(new ParametersStateString());
+ rr.setNavigationalState(new PortletParametersStateString());
//
this.response = rr;
@@ -157,7 +157,7 @@
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
{
- ((ParametersStateString)((RenderResponse)response).getNavigationalState()).replace(map);
+ ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).replace(map);
decision = WANT_RENDER;
}
else
@@ -173,7 +173,7 @@
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
{
- ((ParametersStateString)((RenderResponse)response).getNavigationalState()).setValue(name, value);
+ ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).setValue(name, value);
decision = WANT_RENDER;
}
else
@@ -189,7 +189,7 @@
//
if (decision == WANT_NOTHING || decision == WANT_RENDER)
{
- ((ParametersStateString)((RenderResponse)response).getNavigationalState()).setValues(name, values);
+ ((PortletParametersStateString)((RenderResponse)response).getNavigationalState()).setValues(name, values);
decision = WANT_RENDER;
}
else
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletRequestImpl.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -24,7 +24,7 @@
import org.apache.log4j.Logger;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.container.PortletApplicationImpl;
import org.jboss.portal.portlet.container.PortletContainer;
import org.jboss.portal.portlet.container.info.ContainerPortletInfo;
@@ -90,7 +90,7 @@
protected int sessionStatus;
/** . */
- protected Parameters parameters;
+ protected PortletParameters parameters;
/** The lazy request attributes map added or removed during the request of the portlet. */
protected Map attributes;
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/PortletURLImpl.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -24,8 +24,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.ParametersStateString;
+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.invocation.PortletInvocation;
@@ -155,16 +155,16 @@
return null;
}
- protected abstract Parameters getInternalParameters();
+ protected abstract PortletParameters getInternalParameters();
}
static class InternalActionURL extends InternalPortletURL implements ActionURL
{
/** . */
- private ParametersStateString parameters = new ParametersStateString();
+ private PortletParametersStateString parameters = new PortletParametersStateString();
- protected Parameters getInternalParameters()
+ protected PortletParameters getInternalParameters()
{
return parameters.getParameters();
}
@@ -185,9 +185,9 @@
{
/** . */
- private ParametersStateString navigationalState = new ParametersStateString();
+ private PortletParametersStateString navigationalState = new PortletParametersStateString();
- protected Parameters getInternalParameters()
+ protected PortletParameters getInternalParameters()
{
return navigationalState.getParameters();
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/jsr168/RenderRequestImpl.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.impl.jsr168;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.RenderInvocation;
import org.jboss.portal.portlet.spi.RenderContext;
@@ -55,13 +55,13 @@
{
}
- else if (navigationalState instanceof ParametersStateString)
+ else if (navigationalState instanceof PortletParametersStateString)
{
- parameters = ((ParametersStateString)navigationalState).getParameters();
+ parameters = ((PortletParametersStateString)navigationalState).getParameters();
}
else
{
- ParametersStateString parametersState = new ParametersStateString(navigationalState.getStringValue());
+ PortletParametersStateString parametersState = new PortletParametersStateString(navigationalState.getStringValue());
parameters = parametersState.getParameters();
}
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/impl/spi/AbstractActionContext.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -24,7 +24,7 @@
import org.jboss.portal.portlet.spi.ActionContext;
import org.jboss.portal.portlet.StateString;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.server.util.HTTPStreamInfo;
@@ -44,7 +44,7 @@
protected StateString interactionState;
/** . */
- protected Parameters form;
+ protected PortletParameters form;
protected AbstractActionContext(
@@ -53,7 +53,7 @@
StateString navigationalState,
HTTPStreamInfo streamInfo,
StateString interactionState,
- Parameters form)
+ PortletParameters form)
{
super(mode, windowState, navigationalState, streamInfo);
this.interactionState = interactionState;
@@ -90,7 +90,7 @@
return interactionState;
}
- public Parameters getForm()
+ public PortletParameters getForm()
{
return form;
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/ActionContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/ActionContext.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/ActionContext.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.spi;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.StateString;
import java.io.BufferedReader;
@@ -30,43 +30,84 @@
import java.io.InputStream;
/**
- * Abstract how the container access the input parameters of the request.
+ * Extends the generic invocation context to provide action invocation specific input/services.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
public interface ActionContext extends PortletInvocationContext
{
+
/**
+ * Returns the name of the character encoding used in the body of this request. This method returns <code>null</code>
+ * if the request does not specify a character encoding.
*
+ * @return a <code>String</code> containing the name of the chararacter encoding, or <code>null</code> if the
+ * request does not specify a character encoding.
*/
String getCharacterEncoding();
/**
+ * Returns the length, in bytes, of the request body which is made available by the input stream, or -1 if the length
+ * is not known.
*
+ * @return an integer containing the length of the request body or -1 if the length is not known
*/
int getContentLength();
/**
+ * Retrieves the body of the HTTP request from the client to the portal as character data using a
+ * <code>BufferedReader</code>. The reader translates the character data according to the character encoding used on
+ * the body. Either this method or {@link #getInputStream} may be called to read the body, not both.
+ * <p/>
+ * For HTTP POST data of type application/x-www-form-urlencoded this method throws an
+ * <code>IllegalStateException</code> as this data has been already processed by the portal/portlet-container and is
+ * available as request parameters.
*
+ * @throws java.io.UnsupportedEncodingException if the character set encoding used is not supported and
+ * the text cannot be decoded
+ * @throws java.lang.IllegalStateException if {@link #getInputStream} method has been called on this request,
+ * it is a HTTP POST data of type application/x-www-form-urlencoded.
+ * @throws java.io.IOException if an input or output exception occurred
+ * @return a <code>BufferedReader</code> containing the body of the request
+ * @see #getInputStream
*/
BufferedReader getReader() throws IOException;
/**
+ * Retrieves the body of the HTTP request from client to portal as binary data using an <CODE>InputStream</CODE>.
+ * Either this method or {@link #getReader} may be called to read the body, but not both.
+ * <p/>
+ * For HTTP POST data of type application/x-www-form-urlencoded this method throws an
+ * <code>IllegalStateException</code> as this data has been already processed by the portal/portlet-container and is
+ * available as request parameters.
*
+ * @return an input stream containing the body of the request
+ * @throws java.lang.IllegalStateException if getReader was already called, or it is a HTTP POST data of type
+ * application/x-www-form-urlencoded
+ * @throws java.io.IOException if an input or output exception occurred
*/
- InputStream getInputStream() throws IOException;
+ InputStream getInputStream() throws IOException, IllegalStateException;
- /** The content type accepted by the portal. */
+ /**
+ * Returns the MIME type of the body of the request, or null if the type is not known.
+ *
+ * @return a <code>String</code> containing the name of the MIME type of the request, or null if the type is not
+ * known.
+ */
String getContentType();
/**
+ * Returns the interaction state of the request.
*
+ * @return the interaction state
*/
StateString getInteractionState();
/**
+ * Returns the form parameters of the request or null if no form could be decoded by the caller.
*
+ * @return the request form
*/
- Parameters getForm();
+ PortletParameters getForm();
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/PortletInvocationContext.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -30,6 +30,8 @@
import org.jboss.portal.server.util.HTTPStreamInfo;
/**
+ * Contract that defines what input/services the caller of a portlet container must provide.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 5064 $
*/
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/spi/RenderContext.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/spi/RenderContext.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/spi/RenderContext.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -23,6 +23,8 @@
package org.jboss.portal.portlet.spi;
/**
+ * Extends the generic invocation context to provide render invocation specific input/services.
+ *
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
*/
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/ActionContextSupport.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/ActionContextSupport.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/support/spi/ActionContextSupport.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.jboss.portal.portlet.support.spi;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.spi.ActionContext;
@@ -67,7 +67,7 @@
throw new UnsupportedOperationException();
}
- public Parameters getForm()
+ public PortletParameters getForm()
{
throw new UnsupportedOperationException();
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/test/PortletController.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -30,8 +30,8 @@
import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.ActionURL;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
import org.jboss.portal.portlet.PortletInvoker;
@@ -140,7 +140,7 @@
if (decoder.getType() == PortletRequestDecoder.ACTION_TYPE)
{
// Get the navigational state if it exist
- ParametersStateString navigationalState = (ParametersStateString)invocation.getAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getContext().getId());
+ PortletParametersStateString navigationalState = (PortletParametersStateString)invocation.getAttribute(ServerInvocation.NAVIGATIONAL_STATE_SCOPE, portlet.getContext().getId());
//
ActionContextImpl actionContext = new ActionContextImpl(
@@ -449,7 +449,7 @@
private HttpServletRequest req;
private StateString interactionState;
- private Parameters form;
+ private PortletParameters form;
public ActionContextImpl(
Portlet portlet,
@@ -458,7 +458,7 @@
WindowState windowState,
Mode mode,
StateString interactionState,
- Parameters form)
+ PortletParameters form)
{
super(portlet, invocation, navigationalState, windowState, mode);
req = invocation.getServerContext().getClientRequest();
@@ -496,7 +496,7 @@
return interactionState;
}
- public Parameters getForm()
+ public PortletParameters getForm()
{
return form;
}
@@ -640,10 +640,10 @@
serverURL.setParameterValue(PortletRequestDecoder.META_PARAMETER, Integer.toHexString(meta));
// Unwrap in a specific jboss portlet navigational state
- Parameters parameters = null;
+ PortletParameters parameters = null;
if (portletURL instanceof ActionURL)
{
- ParametersStateString interactionState = (ParametersStateString)((ActionURL)portletURL).getInteractionState();
+ PortletParametersStateString interactionState = (PortletParametersStateString)((ActionURL)portletURL).getInteractionState();
if (interactionState != null)
{
parameters = interactionState.getParameters();
@@ -651,7 +651,7 @@
}
else
{
- ParametersStateString navState = (ParametersStateString)((RenderURL)portletURL).getNavigationalState();
+ PortletParametersStateString navState = (PortletParametersStateString)((RenderURL)portletURL).getNavigationalState();
if (navState != null)
{
parameters = navState.getParameters();
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -23,7 +23,7 @@
package org.jboss.portal.test.portlet;
import org.jboss.portal.common.junit.ExtendedAssert;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import java.util.Arrays;
import java.util.HashMap;
@@ -44,11 +44,11 @@
super(name);
}
- private Parameters param;
+ private PortletParameters param;
public void setUp()
{
- param = new Parameters();
+ param = new PortletParameters();
}
public void tearDown()
@@ -175,7 +175,7 @@
public void testReplaceWithParameters()
{
- Parameters other = new Parameters();
+ PortletParameters other = new PortletParameters();
other.setValue("a", "b");
other.setValues("c", new String[]{"d", "e"});
param.replace(other);
@@ -187,7 +187,7 @@
{
try
{
- new Parameters(null);
+ new PortletParameters(null);
fail("Expected IllegalArgumentException");
}
catch (IllegalArgumentException e)
@@ -199,7 +199,7 @@
{
try
{
- new Parameters((Map)null);
+ new PortletParameters((Map)null);
fail("Expected IllegalArgumentException");
}
catch (IllegalArgumentException e)
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/PortletRequestDecoderTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/PortletRequestDecoderTestCase.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/PortletRequestDecoderTestCase.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -26,8 +26,8 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.OpaqueStateString;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.impl.PortletRequestDecoder;
import java.util.HashMap;
@@ -260,7 +260,7 @@
o.decode(queryParams, null);
assertNull(o.getForm());
assertNull(o.getInteractionState());
- assertEquals(new ParametersStateString(), o.getNavigationalstate());
+ assertEquals(new PortletParametersStateString(), o.getNavigationalstate());
assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
assertNull(o.getMode());
assertNull(o.getWindowState());
@@ -272,7 +272,7 @@
o.decode(queryParams, null);
assertNull(o.getForm());
assertNull(o.getInteractionState());
- assertEquals(new ParametersStateString(), o.getNavigationalstate());
+ assertEquals(new PortletParametersStateString(), o.getNavigationalstate());
assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
assertEquals(Mode.VIEW, o.getMode());
assertNull(o.getWindowState());
@@ -284,7 +284,7 @@
o.decode(queryParams, null);
assertNull(o.getForm());
assertNull(o.getInteractionState());
- assertEquals(new ParametersStateString(), o.getNavigationalstate());
+ assertEquals(new PortletParametersStateString(), o.getNavigationalstate());
assertEquals(PortletRequestDecoder.RENDER_TYPE, o.getType());
assertNull(o.getMode());
assertEquals(WindowState.NORMAL, o.getWindowState());
@@ -296,7 +296,7 @@
Map queryParams = new HashMap();
Map bodyParams = new HashMap();
PortletRequestDecoder o = new PortletRequestDecoder();
- ParametersStateString navState = new ParametersStateString();
+ PortletParametersStateString navState = new PortletParametersStateString();
// Query parameter
queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.RENDER_MASK)));
@@ -502,8 +502,8 @@
// Empty
queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
o.decode(queryParams, null);
- assertEquals(new Parameters(), o.getForm());
- assertEquals(new ParametersStateString(), o.getInteractionState());
+ assertEquals(new PortletParameters(), o.getForm());
+ assertEquals(new PortletParametersStateString(), o.getInteractionState());
assertNull(o.getNavigationalstate());
assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
assertNull(o.getMode());
@@ -514,8 +514,8 @@
queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.MODE_MASK)));
queryParams.put(PortletRequestDecoder.MODE_PARAMETER, asStringArray(Mode.VIEW.toString()));
o.decode(queryParams, null);
- assertEquals(new Parameters(), o.getForm());
- assertEquals(new ParametersStateString(), o.getInteractionState());
+ assertEquals(new PortletParameters(), o.getForm());
+ assertEquals(new PortletParametersStateString(), o.getInteractionState());
assertNull(o.getNavigationalstate());
assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
assertEquals(Mode.VIEW, o.getMode());
@@ -526,8 +526,8 @@
queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.WINDOW_STATE_MASK)));
queryParams.put(PortletRequestDecoder.WINDOW_STATE_PARAMETER, asStringArray(WindowState.NORMAL.toString()));
o.decode(queryParams, null);
- assertEquals(new Parameters(), o.getForm());
- assertEquals(new ParametersStateString(), o.getInteractionState());
+ assertEquals(new PortletParameters(), o.getForm());
+ assertEquals(new PortletParametersStateString(), o.getInteractionState());
assertNull(o.getNavigationalstate());
assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
assertNull(o.getMode());
@@ -540,8 +540,8 @@
Map queryParams = new HashMap();
Map bodyParams = new HashMap();
PortletRequestDecoder o = new PortletRequestDecoder();
- ParametersStateString intState = new ParametersStateString();
- Parameters form = new Parameters();
+ PortletParametersStateString intState = new PortletParametersStateString();
+ PortletParameters form = new PortletParameters();
// Query parameter
queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK)));
@@ -615,7 +615,7 @@
// Empty
queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
o.decode(queryParams, null);
- assertEquals(new Parameters(), o.getForm());
+ assertEquals(new PortletParameters(), o.getForm());
assertNull(o.getInteractionState());
assertNull(o.getNavigationalstate());
assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
@@ -627,7 +627,7 @@
queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
queryParams.put(PortletRequestDecoder.NAVIGATIONAL_STATE_PARAMETER, asStringArray("navstatevalue"));
o.decode(queryParams, null);
- assertEquals(new Parameters(), o.getForm());
+ assertEquals(new PortletParameters(), o.getForm());
assertNull(o.getInteractionState());
assertEquals(new OpaqueStateString("navstatevalue"), o.getNavigationalstate());
assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
@@ -639,7 +639,7 @@
queryParams.put(PortletRequestDecoder.META_PARAMETER, asStringArray(Integer.toHexString(PortletRequestDecoder.ACTION_MASK | PortletRequestDecoder.OPAQUE_MASK)));
queryParams.put(PortletRequestDecoder.INTERACTION_STATE_PARAMETER, asStringArray("intstatevalue"));
o.decode(queryParams, null);
- assertEquals(new Parameters(), o.getForm());
+ assertEquals(new PortletParameters(), o.getForm());
assertEquals(new OpaqueStateString("intstatevalue"), o.getInteractionState());
assertNull(o.getNavigationalstate());
assertEquals(PortletRequestDecoder.ACTION_TYPE, o.getType());
@@ -654,7 +654,7 @@
queryParams.put("foo3", new String[]{"bar4"});
bodyParams.put("foo3", new String[]{"bar5"});
o.decode(queryParams, bodyParams);
- Parameters form = new Parameters();
+ PortletParameters form = new PortletParameters();
form.setValue("foo1", "bar1");
form.setValues("foo2", new String[]{"bar2", "bar3"});
form.setValues("foo3", new String[]{"bar5"});
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/navigation/StateStringTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/navigation/StateStringTestCase.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/navigation/StateStringTestCase.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -24,7 +24,7 @@
package org.jboss.portal.test.portlet.navigation;
import junit.framework.TestCase;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -39,7 +39,7 @@
public void testNavigationalState() throws Exception
{
- ParametersStateString ns = new ParametersStateString();
+ PortletParametersStateString ns = new PortletParametersStateString();
ns.setValue(NAME1, VALUE1);
assertEquals(VALUE1, ns.getValue(NAME1));
@@ -47,7 +47,7 @@
System.out.println("opaqueValue = " + opaqueValue);
assertNotNull(opaqueValue);
- ns = new ParametersStateString(opaqueValue);
+ ns = new PortletParametersStateString(opaqueValue);
assertEquals(VALUE1, ns.getValue(NAME1));
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/TestPortletInvocationContext.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -26,7 +26,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.common.MediaType;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.impl.spi.AbstractPortletInvocationContext;
@@ -48,7 +48,7 @@
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision: 5064 $
+ * @version $Revision$
* @since 2.4
*/
public class TestPortletInvocationContext extends AbstractPortletInvocationContext
@@ -145,7 +145,7 @@
return null;
}
- public Parameters getForm()
+ public PortletParameters getForm()
{
return null;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -24,8 +24,8 @@
package org.jboss.portal.wsrp.consumer;
import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.portlet.Parameters;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParameters;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateEvent;
import org.jboss.portal.portlet.StateString;
@@ -86,14 +86,14 @@
if (interactionState != null)
{
String state = interactionState.getStringValue();
- if (!ParametersStateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
+ if (!PortletParametersStateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
{
interactionParams.setInteractionState(state);
}
}
// form parameters
- Parameters params = actionContext.getForm();
+ PortletParameters params = actionContext.getForm();
if (params != null && !params.isEmpty())
{
List formParameters = new ArrayList(params.size());
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RequestPrecursor.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -25,7 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.portlet.ParametersStateString;
+import org.jboss.portal.portlet.PortletParametersStateString;
import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.invocation.PortletInvocation;
@@ -117,7 +117,7 @@
if (navigationalState != null)
{
String state = navigationalState.getStringValue();
- if (!ParametersStateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
+ if (!PortletParametersStateString.JBPNS_PREFIX.equals(state)) // fix-me: see JBPORTAL-900
{
markupParams.setNavigationalState(state);
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/invocation/WSRPActionContext.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -25,7 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.StateString;
import org.jboss.portal.portlet.spi.ActionContext;
import org.jboss.portal.portlet.spi.InstanceContext;
@@ -49,7 +49,7 @@
*/
public class WSRPActionContext extends WSRPPortletInvocationContext implements ActionContext
{
- private Parameters formParameters;
+ private PortletParameters formParameters;
private HttpServletRequest request;
private String characterEncoding;
private String contentType;
@@ -59,7 +59,7 @@
SecurityContext securityContext, HTTPStreamInfo streamInfo, PortalContext portalContext,
UserContext userContext, InstanceContext instanceContext, WindowContext windowContext,
StateString interactionState, Mode mode, WindowState windowState,
- Parameters formParameters, String characterEncoding, String contentType)
+ PortletParameters formParameters, String characterEncoding, String contentType)
{
super(navigationalState, securityContext, streamInfo, portalContext, userContext, instanceContext,
windowContext, mode, windowState);
@@ -100,7 +100,7 @@
return contentType;
}
- public Parameters getForm()
+ public PortletParameters getForm()
{
return formParameters;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java 2007-01-10 13:42:44 UTC (rev 5975)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/MarkupHandler.java 2007-01-10 14:09:42 UTC (rev 5976)
@@ -28,7 +28,7 @@
import org.jboss.portal.common.util.LocaleInfo;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.OpaqueStateString;
-import org.jboss.portal.portlet.Parameters;
+import org.jboss.portal.portlet.PortletParameters;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletInvoker;
import org.jboss.portal.portlet.PortletInvokerException;
@@ -335,7 +335,7 @@
WSRPInstanceContext instanceContext = createInstanceContext(portletHandle, WSRPUtils.getAccessModeFromStateChange(stateChange));
- Parameters parameters;
+ PortletParameters parameters;
NamedString[] formParams = interactionParams.getFormParameters();
if (formParams != null && formParams.length > 0)
{
@@ -361,11 +361,11 @@
params.put(paramName, new String[]{paramValue});
}
}
- parameters = new Parameters(params);
+ parameters = new PortletParameters(params);
}
else
{
- parameters = new Parameters();
+ parameters = new PortletParameters();
}
log.debug("form parameters:\n" + parameters);
19 years, 3 months
JBoss Portal SVN: r5975 - in trunk: core/src/main/org/jboss/portal/core/controller/classic and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-01-10 08:42:44 -0500 (Wed, 10 Jan 2007)
New Revision: 5975
Modified:
trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactory.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactoryDelegate.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactoryService.java
trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
trunk/server/src/main/org/jboss/portal/server/ServerInvocationContext.java
trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java
trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
Log:
applied the portal host idea from JBPORTAL-1004
Modified: trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -92,7 +92,7 @@
targetWindowId = null;
}
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
try
{
@@ -110,11 +110,11 @@
getCMD = CMSService.getCommandFactory().createFileGetCommand(portalRequestPath, new Locale(CMSService.getDefaultLocale()));
}
*/
- Command getCMD = CMSService.getCommandFactory().createFileGetCommand(portalRequestPath, invocation.getRequest().getLocale());
+ Command getCMD = CMSService.getCommandFactory().createFileGetCommand(requestPath, invocation.getRequest().getLocale());
File file = (File)CMSService.execute(getCMD);
if (file == null)
{
- getCMD = CMSService.getCommandFactory().createFileGetCommand(portalRequestPath, new Locale(CMSService.getDefaultLocale()));
+ getCMD = CMSService.getCommandFactory().createFileGetCommand(requestPath, new Locale(CMSService.getDefaultLocale()));
file = (File)CMSService.execute(getCMD);
}
@@ -132,13 +132,13 @@
if (isStreamable)
{
- return new StreamContentCommand(portalRequestPath);
+ return new StreamContentCommand(requestPath);
}
else
{
//Set the content as a render parameter
ParametersStateString parameters = new ParametersStateString();
- parameters.setValue("path", portalRequestPath);
+ parameters.setValue("path", requestPath);
// Perform a render URL on the target window
return new InvokePortletWindowRenderCommand(targetWindowId, Mode.VIEW, null, parameters);
@@ -151,7 +151,7 @@
if(e.toString().indexOf("Access to this resource is denied")!=-1)
{
ParametersStateString parameters = new ParametersStateString();
- parameters.setValue("path", portalRequestPath);
+ parameters.setValue("path", requestPath);
return new InvokePortletWindowRenderCommand(targetWindowId, Mode.VIEW, null, parameters);
}
else
Modified: trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/controller/classic/ClassicController.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -66,7 +66,7 @@
ControllerContext ctx = new ControllerContext(invocation, this);
// Invoke the chain that creates the initial command
- ControllerCommand cmd = commandFactory.doMapping(invocation, invocation.getServerContext().getPortalContextPath(), invocation.getServerContext().getPortalRequestPath());
+ ControllerCommand cmd = commandFactory.doMapping(invocation, invocation.getServerContext().getPortalHost(), invocation.getServerContext().getPortalContextPath(), invocation.getServerContext().getPortalRequestPath());
//
if (cmd == null)
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractCommandFactory.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/AbstractCommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -35,6 +35,6 @@
public abstract ControllerCommand doMapping(
ServerInvocation invocation,
- String portalContextPath,
- String portalRequestPath);
+ String host, String contextPath,
+ String requestPath);
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactory.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -37,13 +37,15 @@
/**
* Create a command.
*
- * @param invocation the invocation
- * @param portalContextPath
- * @param portalRequestPath
+ * @param invocation the invocation
+ * @param host the host
+ * @param contextPath the context path
+ * @param requestPath the request path
* @return the command or null if no command is recognized
*/
ControllerCommand doMapping(
ServerInvocation invocation,
- String portalContextPath,
- String portalRequestPath);
+ String host,
+ String contextPath,
+ String requestPath);
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactoryDelegate.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactoryDelegate.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/CommandFactoryDelegate.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -81,8 +81,8 @@
delegatingFactory.unregister(path);
}
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
- return delegateFactory.doMapping(invocation, portalContextPath, portalRequestPath);
+ return delegateFactory.doMapping(invocation, host, contextPath, requestPath);
}
}
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactoryService.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactoryService.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/DelegatingCommandFactoryService.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -122,29 +122,29 @@
}
}
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
//
- if (portalRequestPath.length() == 0)
+ if (requestPath.length() == 0)
{
return null;
}
//
- PathMappingResult result = parser.map(mapping, portalRequestPath);
+ PathMappingResult result = parser.map(mapping, requestPath);
Object target = result.getTarget();
ControllerCommand cmd = null;
if (target instanceof CommandFactory)
{
CommandFactory delegate = (CommandFactory)target;
String remainingPath = result.getRemainingPath();
- cmd = delegate.doMapping(invocation, portalContextPath + result.getMatchedPath(), remainingPath);
+ cmd = delegate.doMapping(invocation, host, contextPath + result.getMatchedPath(), remainingPath);
}
//
if (cmd == null && nextFactory != null)
{
- cmd = nextFactory.doMapping(invocation, portalContextPath, portalRequestPath);
+ cmd = nextFactory.doMapping(invocation, host, contextPath, requestPath);
}
return cmd;
Modified: trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleCommandFactory.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/controller/command/mapper/SimpleCommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -66,7 +66,7 @@
commandClass = null;
}
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
try
{
Modified: trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/model/instance/InstanceCommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -49,7 +49,7 @@
this.instanceId = instanceId;
}
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
PortletRequestDecoder decoder = new PortletRequestDecoder();
decoder.decode(invocation.getServerContext().getQueryParameterMap(), invocation.getServerContext().getBodyParameterMap());
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DashboardCommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -33,7 +33,7 @@
*/
public class DashboardCommandFactory extends AbstractCommandFactory
{
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
return new ViewDashboardCommand();
}
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/DefaultPortalCommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -63,9 +63,9 @@
this.nextFactory = nextFactory;
}
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
- ControllerCommand cmd = nextFactory.doMapping(invocation, portalContextPath, portalRequestPath);
+ ControllerCommand cmd = nextFactory.doMapping(invocation, host, contextPath, requestPath);
if (cmd == null)
{
Portal portal = (Portal)container.getObject(defaultPortalPath);
Modified: trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectCommandFactory.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -38,8 +38,6 @@
import org.jboss.portal.server.servlet.PathParser;
import org.jboss.portal.theme.navigation.WindowNavigationalState;
-import java.util.Map;
-
/**
* This command mapper is used to map portal objects living in a container to <code>org.jboss.portal.core.command.RenderPageCommand</code>
*
@@ -86,22 +84,22 @@
this.container = container;
}
- public ControllerCommand doMapping(ServerInvocation invocation, String portalContextPath, String portalRequestPath)
+ public ControllerCommand doMapping(ServerInvocation invocation, String host, String contextPath, String requestPath)
{
- if (portalRequestPath == null)
+ if (requestPath == null)
{
return null;
}
//
Object target;
- if (portalRequestPath.length() == 0)
+ if (requestPath.length() == 0)
{
target = container.getRootObject();
}
else
{
- PathMappingResult result = pathParser.map(mapping, portalRequestPath);
+ PathMappingResult result = pathParser.map(mapping, requestPath);
target = result.getTarget();
}
Modified: trunk/server/src/main/org/jboss/portal/server/ServerInvocationContext.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/ServerInvocationContext.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/server/src/main/org/jboss/portal/server/ServerInvocationContext.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -97,6 +97,13 @@
String getPortalContextPath();
/**
+ * Return the portal host value for this request.
+ *
+ * @return the portal host
+ */
+ String getPortalHost();
+
+ /**
* @param url
* @param context
* @param format
Modified: trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/server/src/main/org/jboss/portal/server/impl/ServerInvocationContextImpl.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -60,6 +60,9 @@
/** The portal request path. */
private String portalRequestPath;
+ /** The portal host. */
+ private String portalHost;
+
/** . */
private String mediaType;
@@ -84,6 +87,7 @@
public ServerInvocationContextImpl(
HttpServletRequest req,
HttpServletResponse resp,
+ String portalHost,
String portalRequestPath,
String portalContextPath,
Map queryParameterMap,
@@ -105,6 +109,7 @@
this.resp = resp;
this.portalRequestPath = portalRequestPath;
this.portalContextPath = portalContextPath;
+ this.portalHost = portalHost;
this.queryParameterMap = new InternalParameterMap(queryParameterMap);
this.bodyParameterMap = bodyParameterMap != null ? new InternalParameterMap(bodyParameterMap) : null;
this.urlContext = urlContext;
@@ -178,6 +183,11 @@
return portalContextPath;
}
+ public String getPortalHost()
+ {
+ return portalHost;
+ }
+
public String renderURL(ServerURL url, URLContext context, URLFormat format)
{
int index = context.getMask() << 2 | format.getMask();
Modified: trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java 2007-01-10 04:44:22 UTC (rev 5974)
+++ trunk/server/src/main/org/jboss/portal/server/servlet/PortalServlet.java 2007-01-10 13:42:44 UTC (rev 5975)
@@ -29,7 +29,6 @@
import org.jboss.portal.common.invocation.InvocationException;
import org.jboss.portal.common.util.Exceptions;
import org.jboss.portal.common.util.URLTools;
-import org.jboss.portal.common.util.ParameterMap;
import org.jboss.portal.server.PortalConstants;
import org.jboss.portal.server.RequestController;
import org.jboss.portal.server.RequestControllerDispatcher;
@@ -251,6 +250,9 @@
}
}
+ // Determine the host for this request
+ String portalHost = req.getServerName();
+
// Determine the request path
String portalRequestPath = null;
String portalContextPath = null;
@@ -348,6 +350,7 @@
ServerInvocationContext invocationCtx = new ServerInvocationContextImpl(
req,
resp,
+ portalHost,
portalRequestPath,
portalContextPath,
queryParameterMap,
19 years, 3 months