Author: julien_viet
Date: 2009-08-25 17:10:18 -0400 (Tue, 25 Aug 2009)
New Revision: 62
Added:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/AttributeResolver.java
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/InvocationException.java
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/AbstractSessionAttributeResolver.java
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/MapAttributeResolver.java
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/PrincipalAttributeResolver.java
Removed:
components/common/trunk/common/src/main/java/org/gatein/common/invocation/
components/common/trunk/common/src/test/java/org/gatein/common/AbstractInvocationContextTestCase.java
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/PortletInvocation.java
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
components/pc/trunk/pc/src/main/java/org/gatein/pc/container/ContainerPortletInvoker.java
components/pc/trunk/pc/src/main/java/org/gatein/pc/container/PortletContainer.java
components/pc/trunk/pc/src/main/java/org/gatein/pc/impl/jsr168/PortletContainerImpl.java
components/pc/trunk/pc/src/main/java/org/gatein/pc/impl/spi/AbstractUserContext.java
components/pc/trunk/pc/src/main/java/org/gatein/pc/state/producer/PortletStateChangeRequiredException.java
components/pc/trunk/pc/src/main/java/org/gatein/pc/state/producer/ProducerPortletInvoker.java
components/pc/trunk/pc/src/test/java/org/gatein/pc/container/PortletContainerObjectSupport.java
Log:
GTNPC-1 : Use classes from package org.gatein.common.invocation
GTNCOMMON-1 : Move org.gatein.common.invocation package to PC
Deleted:
components/common/trunk/common/src/test/java/org/gatein/common/AbstractInvocationContextTestCase.java
===================================================================
---
components/common/trunk/common/src/test/java/org/gatein/common/AbstractInvocationContextTestCase.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/common/trunk/common/src/test/java/org/gatein/common/AbstractInvocationContextTestCase.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -1,254 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2009, 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.gatein.common;
-
-import junit.framework.TestCase;
-import org.gatein.common.invocation.AbstractInvocationContext;
-import org.gatein.common.invocation.Scope;
-import org.gatein.common.invocation.AttributeResolver;
-
-import java.util.HashMap;
-import java.util.Set;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-@SuppressWarnings("unchecked")
-public class AbstractInvocationContextTestCase extends TestCase
-{
-
- /** . */
- private static final Scope TEST_SCOPE = new Scope("test");
-
- public void testNonExistingScope()
- {
- AbstractInvocationContext ctx = new AbstractInvocationContext();
- try
- {
- ctx.getAttribute(TEST_SCOPE, "foo");
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
-
- }
- try
- {
- ctx.setAttribute(TEST_SCOPE, "foo", "bar");
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
-
- }
- try
- {
- ctx.removeAttribute(TEST_SCOPE, "foo");
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
-
- }
- try
- {
- ctx.getAttributeResolver(TEST_SCOPE);
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
-
- }
- }
-
- public void testExistingScopeWithResolver()
- {
- final MapResolver resolver = new MapResolver();
- AbstractInvocationContext ctx = new AbstractInvocationContext()
- {
- {
- addResolver(TEST_SCOPE, resolver);
- }
- };
- testExistingScope(ctx, resolver);
- }
-
- public void testExistingScopeDelegation()
- {
- final MapResolver resolver = new MapResolver();
- final AbstractInvocationContext parent = new AbstractInvocationContext()
- {
- {
- addResolver(TEST_SCOPE, resolver);
- }
- };
- AbstractInvocationContext child = new AbstractInvocationContext()
- {
- {
- addResolver(TEST_SCOPE, parent);
- }
- };
- testExistingScope(child, resolver);
- }
-
-
- private void testExistingScope(AbstractInvocationContext ctx, MapResolver resolver)
- {
- // Assert empty does not exist
- assertNull(ctx.getAttribute(TEST_SCOPE, "foo"));
- assertEquals(0, resolver.size());
-
- // Remove non existing
- ctx.removeAttribute(TEST_SCOPE, "foo");
- assertNull(ctx.getAttribute(TEST_SCOPE, "foo"));
- assertEquals(0, resolver.size());
-
- // Set non existing
- ctx.setAttribute(TEST_SCOPE, "foo", "bar");
- assertEquals("bar", resolver.getAttribute("foo"));
- assertEquals(1, resolver.size());
-
- // Overwrite existing
- ctx.setAttribute(TEST_SCOPE, "foo", "bar2");
- assertEquals("bar2", resolver.getAttribute("foo"));
- assertEquals(1, resolver.size());
-
- // Remove existing
- ctx.removeAttribute(TEST_SCOPE, "foo");
- assertNull(ctx.getAttribute(TEST_SCOPE, "foo"));
- assertEquals(0, resolver.size());
-
- // Get resolver
- assertEquals(resolver, ctx.getAttributeResolver(TEST_SCOPE));
- }
-
- public void testAPI()
- {
- AbstractInvocationContext ctx = new AbstractInvocationContext();
- try
- {
- ctx.getAttribute(null, "foo");
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- ctx.getAttribute(TEST_SCOPE, null);
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- ctx.setAttribute(null, "foo", "bar");
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- ctx.setAttribute(TEST_SCOPE, null, "bar");
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- ctx.setAttribute(null, "foo", null);
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- ctx.setAttribute(TEST_SCOPE, null, null);
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- ctx.removeAttribute(null, "foo");
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- ctx.removeAttribute(TEST_SCOPE, null);
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- try
- {
- ctx.getAttributeResolver(null);
- fail("was expecting an IllegalArgumentException");
- }
- catch (IllegalArgumentException expected)
- {
- }
- }
-
- @SuppressWarnings("serial")
- private static class MapResolver extends HashMap implements AttributeResolver
- {
- public Set getKeys()
- {
- return keySet();
- }
- public Object getAttribute(Object attrKey) throws IllegalArgumentException
- {
- if (attrKey == null)
- {
- throw new IllegalArgumentException();
- }
- return get(attrKey);
- }
- public void setAttribute(Object attrKey, Object attrValue) throws
IllegalArgumentException
- {
- if (attrKey == null)
- {
- throw new IllegalArgumentException();
- }
- if (attrValue != null)
- {
- put(attrKey, attrValue);
- }
- else
- {
- remove(attrKey);
- }
- }
- }
-}
Added:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/AttributeResolver.java
===================================================================
---
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/AttributeResolver.java
(rev 0)
+++
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/AttributeResolver.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -0,0 +1,60 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, 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.gatein.pc.api.invocation;
+
+import java.util.Set;
+
+/**
+ * An attribute resolver.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public interface AttributeResolver<K, V>
+{
+ /**
+ * Returns the set of keys of the attributes bound in that resolver.
+ *
+ * @return a set of keys
+ */
+ Set<K> getKeys();
+
+ /**
+ * Return an attribute from this resolver.
+ *
+ * @param attrKey
+ * @return the attribute value or null if it is not found
+ * @throws IllegalArgumentException if the attribute key is not valid
+ */
+ V getAttribute(K attrKey) throws IllegalArgumentException;
+
+ /**
+ * Update an attribute value on this resolve. If the attribute value is null the
resolver must treat the operation as
+ * a removal of the attribute.
+ *
+ * @param attrKey
+ * @param attrValue the attribute value
+ * @throws IllegalArgumentException if the attribute key is not valid
+ */
+ void setAttribute(K attrKey, V attrValue) throws IllegalArgumentException;
+}
Added:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/InvocationException.java
===================================================================
---
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/InvocationException.java
(rev 0)
+++
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/InvocationException.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, 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.gatein.pc.api.invocation;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 5451 $
+ */
+public class InvocationException extends RuntimeException
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 7607329736844391861L;
+
+ public InvocationException()
+ {
+ }
+
+ public InvocationException(String message)
+ {
+ super(message);
+ }
+
+ public InvocationException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public InvocationException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/PortletInvocation.java
===================================================================
---
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/PortletInvocation.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/PortletInvocation.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -22,8 +22,7 @@
******************************************************************************/
package org.gatein.pc.api.invocation;
-import org.gatein.common.invocation.AttributeResolver;
-import org.gatein.common.invocation.resolver.MapAttributeResolver;
+import org.gatein.pc.api.invocation.resolver.MapAttributeResolver;
import org.gatein.pc.api.spi.InstanceContext;
import org.gatein.pc.api.spi.PortalContext;
import org.gatein.pc.api.spi.PortletInvocationContext;
Added:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/AbstractSessionAttributeResolver.java
===================================================================
---
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/AbstractSessionAttributeResolver.java
(rev 0)
+++
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/AbstractSessionAttributeResolver.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -0,0 +1,142 @@
+/******************************************************************************
+ * 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.gatein.pc.api.invocation.resolver;
+
+import org.gatein.pc.api.invocation.AttributeResolver;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public abstract class AbstractSessionAttributeResolver implements AttributeResolver
+{
+
+ /** . */
+ protected final HttpServletRequest req;
+
+ public AbstractSessionAttributeResolver(HttpServletRequest req)
+ {
+ if (req == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.req = req;
+ }
+
+
+ public Set getKeys()
+ {
+ Map map = getMap(false);
+
+ //
+ if (map != null)
+ {
+ return map.keySet();
+ }
+ else
+ {
+ return Collections.EMPTY_SET;
+ }
+ }
+
+ public Object getAttribute(Object attrKey) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Object value = null;
+ Map map = getMap(false);
+ if (map != null)
+ {
+ value = map.get(attrKey);
+ }
+ return value;
+ }
+
+ public void setAttribute(Object attrKey, Object attrValue) throws
IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ Map map = getMap(false);
+ if (map != null)
+ {
+ if (attrValue != null)
+ {
+ map.put(attrKey, attrValue);
+ }
+ else
+ {
+ map.remove(attrKey);
+ }
+ }
+ else
+ {
+ if (attrValue != null)
+ {
+ map = getMap(true);
+ map.put(attrKey, attrValue);
+ }
+ }
+ }
+
+ protected abstract String getMapKey();
+
+ protected Map createMap(String mapKey)
+ {
+ return new HashMap();
+ }
+
+ private Map getMap(boolean create)
+ {
+ HttpSession session = req.getSession(create);
+ if (session != null)
+ {
+ String mapKey = getMapKey();
+ Map map = (Map)session.getAttribute(mapKey);
+ if (map == null)
+ {
+ map = createMap(mapKey);
+ session.setAttribute(mapKey, map);
+ }
+ return map;
+ }
+ else
+ {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Added:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/MapAttributeResolver.java
===================================================================
---
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/MapAttributeResolver.java
(rev 0)
+++
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/MapAttributeResolver.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2009, 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.gatein.pc.api.invocation.resolver;
+
+import org.gatein.pc.api.invocation.AttributeResolver;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+@SuppressWarnings("unchecked")
+public class MapAttributeResolver implements AttributeResolver
+{
+
+ /** . */
+ private final Map attributes;
+
+ public MapAttributeResolver(Map attributes)
+ {
+ if (attributes == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.attributes = attributes;
+ }
+
+ public MapAttributeResolver()
+ {
+ this(new HashMap());
+ }
+
+
+ public Set getKeys()
+ {
+ return attributes.keySet();
+ }
+
+ public Object getAttribute(Object attrKey) throws IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return attributes.get(attrKey);
+ }
+
+ public void setAttribute(Object attrKey, Object attrValue) throws
IllegalArgumentException
+ {
+ if (attrKey == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (attrValue != null)
+ {
+ attributes.put(attrKey, attrValue);
+ }
+ else
+ {
+ attributes.remove(attrKey);
+ }
+ }
+}
Added:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/PrincipalAttributeResolver.java
===================================================================
---
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/PrincipalAttributeResolver.java
(rev 0)
+++
components/pc/trunk/api/src/main/java/org/gatein/pc/api/invocation/resolver/PrincipalAttributeResolver.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * 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.gatein.pc.api.invocation.resolver;
+
+import javax.servlet.http.HttpServletRequest;
+import java.security.Principal;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 7228 $
+ */
+public class PrincipalAttributeResolver extends AbstractSessionAttributeResolver
+{
+
+ /** . */
+ private String cachedPrincipalName;
+
+ /** . */
+ private String cachedMapKey;
+
+ public PrincipalAttributeResolver(HttpServletRequest req)
+ {
+ super(req);
+ }
+
+ protected String getMapKey()
+ {
+ Principal principal = req.getUserPrincipal();
+
+ //
+ if (cachedMapKey != null)
+ {
+ if (cachedPrincipalName == null)
+ {
+ if (principal != null)
+ {
+ cachedMapKey = null;
+ }
+ }
+ else
+ {
+ if (principal == null || (cachedPrincipalName.equals(principal.getName()) ==
false))
+ {
+ cachedMapKey = null;
+ }
+ }
+ }
+
+ //
+ if (cachedMapKey == null)
+ {
+ if (principal == null)
+ {
+ cachedMapKey = "portal.principal";
+ cachedPrincipalName = null;
+ }
+ else
+ {
+ cachedMapKey = "portal.principal." + principal.getName();
+ cachedPrincipalName = principal.getName();
+ }
+ }
+
+ //
+ return cachedMapKey;
+ }
+}
\ No newline at end of file
Modified:
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java
===================================================================
---
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/federation/src/main/java/org/gatein/pc/federation/impl/FederatedPortletInvokerService.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.gatein.pc.federation.impl;
-import org.gatein.common.invocation.InvocationException;
import org.gatein.pc.federation.FederatedPortletInvoker;
import org.gatein.pc.federation.FederatingPortletInvoker;
import org.gatein.pc.api.Portlet;
@@ -139,7 +138,7 @@
}
}
- public PortletInvocationResponse invoke(PortletInvocation invocation) throws
InvocationException, PortletInvokerException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
org.gatein.pc.api.invocation.InvocationException, PortletInvokerException
{
PortletContext compoundPortletContext = invocation.getTarget();
PortletContext portletContext = dereference(compoundPortletContext);
Modified:
components/pc/trunk/pc/src/main/java/org/gatein/pc/container/ContainerPortletInvoker.java
===================================================================
---
components/pc/trunk/pc/src/main/java/org/gatein/pc/container/ContainerPortletInvoker.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/pc/src/main/java/org/gatein/pc/container/ContainerPortletInvoker.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -22,7 +22,6 @@
******************************************************************************/
package org.gatein.pc.container;
-import org.gatein.common.invocation.InvocationException;
import org.gatein.pc.api.NoSuchPortletException;
import org.gatein.pc.api.Portlet;
import org.gatein.pc.api.PortletContext;
@@ -101,7 +100,7 @@
return portlet;
}
- public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException, InvocationException
+ public PortletInvocationResponse invoke(PortletInvocation invocation) throws
PortletInvokerException, org.gatein.pc.api.invocation.InvocationException
{
// Get portlet container
PortletContext ctx = invocation.getTarget();
Modified:
components/pc/trunk/pc/src/main/java/org/gatein/pc/container/PortletContainer.java
===================================================================
---
components/pc/trunk/pc/src/main/java/org/gatein/pc/container/PortletContainer.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/pc/src/main/java/org/gatein/pc/container/PortletContainer.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.gatein.pc.container;
-import org.gatein.common.invocation.InvocationException;
+import org.gatein.pc.api.invocation.InvocationException;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.info.PortletInfo;
import org.gatein.pc.api.invocation.PortletInvocation;
@@ -57,7 +57,7 @@
* @throws org.gatein.pc.api.PortletInvokerException a portlet invoker exception
* @throws InvocationException an invocation exception
*/
- PortletInvocationResponse dispatch(PortletInvocation invocation) throws
PortletInvokerException, InvocationException;
+ PortletInvocationResponse dispatch(PortletInvocation invocation) throws
PortletInvokerException, org.gatein.pc.api.invocation.InvocationException;
/**
* Returns the wired application.
Modified:
components/pc/trunk/pc/src/main/java/org/gatein/pc/impl/jsr168/PortletContainerImpl.java
===================================================================
---
components/pc/trunk/pc/src/main/java/org/gatein/pc/impl/jsr168/PortletContainerImpl.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/pc/src/main/java/org/gatein/pc/impl/jsr168/PortletContainerImpl.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -24,7 +24,7 @@
import org.gatein.common.concurrent.Valve;
import org.gatein.common.i18n.ResourceBundleManager;
-import org.gatein.common.invocation.InvocationException;
+import org.gatein.pc.api.invocation.InvocationException;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.aspects.portlet.ContextDispatcherInterceptor;
import org.gatein.pc.container.PortletApplication;
@@ -490,7 +490,7 @@
}
else
{
- throw new InvocationException("Unexpected invocation " + invocation);
+ throw new org.gatein.pc.api.invocation.InvocationException("Unexpected
invocation " + invocation);
}
//
Modified:
components/pc/trunk/pc/src/main/java/org/gatein/pc/impl/spi/AbstractUserContext.java
===================================================================
---
components/pc/trunk/pc/src/main/java/org/gatein/pc/impl/spi/AbstractUserContext.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/pc/src/main/java/org/gatein/pc/impl/spi/AbstractUserContext.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -23,9 +23,9 @@
package org.gatein.pc.impl.spi;
import org.gatein.common.util.Tools;
-import org.gatein.common.invocation.resolver.PrincipalAttributeResolver;
-import org.gatein.common.invocation.resolver.MapAttributeResolver;
-import org.gatein.common.invocation.AttributeResolver;
+import org.gatein.pc.api.invocation.resolver.PrincipalAttributeResolver;
+import org.gatein.pc.api.invocation.resolver.MapAttributeResolver;
+import org.gatein.pc.api.invocation.AttributeResolver;
import org.gatein.pc.api.spi.UserContext;
import javax.servlet.http.HttpServletRequest;
Modified:
components/pc/trunk/pc/src/main/java/org/gatein/pc/state/producer/PortletStateChangeRequiredException.java
===================================================================
---
components/pc/trunk/pc/src/main/java/org/gatein/pc/state/producer/PortletStateChangeRequiredException.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/pc/src/main/java/org/gatein/pc/state/producer/PortletStateChangeRequiredException.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -23,15 +23,13 @@
package org.gatein.pc.state.producer;
-import org.gatein.common.invocation.InvocationException;
-
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
* @version $Revision: 5776 $
* @since 2.6
*/
@SuppressWarnings("serial")
-public class PortletStateChangeRequiredException extends InvocationException
+public class PortletStateChangeRequiredException extends
org.gatein.pc.api.invocation.InvocationException
{
public PortletStateChangeRequiredException(String message)
{
Modified:
components/pc/trunk/pc/src/main/java/org/gatein/pc/state/producer/ProducerPortletInvoker.java
===================================================================
---
components/pc/trunk/pc/src/main/java/org/gatein/pc/state/producer/ProducerPortletInvoker.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/pc/src/main/java/org/gatein/pc/state/producer/ProducerPortletInvoker.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -22,7 +22,7 @@
******************************************************************************/
package org.gatein.pc.state.producer;
-import org.gatein.common.invocation.InvocationException;
+import org.gatein.pc.api.invocation.InvocationException;
import org.gatein.pc.api.InvalidPortletIdException;
import org.gatein.pc.api.NoSuchPortletException;
import org.gatein.pc.api.Portlet;
Modified:
components/pc/trunk/pc/src/test/java/org/gatein/pc/container/PortletContainerObjectSupport.java
===================================================================
---
components/pc/trunk/pc/src/test/java/org/gatein/pc/container/PortletContainerObjectSupport.java 2009-08-25
20:44:04 UTC (rev 61)
+++
components/pc/trunk/pc/src/test/java/org/gatein/pc/container/PortletContainerObjectSupport.java 2009-08-25
21:10:18 UTC (rev 62)
@@ -27,7 +27,7 @@
import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
import org.gatein.pc.api.invocation.PortletInvocation;
import org.gatein.pc.api.PortletInvokerException;
-import org.gatein.common.invocation.InvocationException;
+import org.gatein.pc.api.invocation.InvocationException;
import java.util.Map;
import java.util.HashMap;