JBoss Portal SVN: r5798 - trunk/core/src/resources/portal-server-war
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-11 12:30:18 -0500 (Mon, 11 Dec 2006)
New Revision: 5798
Modified:
trunk/core/src/resources/portal-server-war/error.jsp
Log:
removed useless comment
Modified: trunk/core/src/resources/portal-server-war/error.jsp
===================================================================
--- trunk/core/src/resources/portal-server-war/error.jsp 2006-12-11 17:21:44 UTC (rev 5797)
+++ trunk/core/src/resources/portal-server-war/error.jsp 2006-12-11 17:30:18 UTC (rev 5798)
@@ -25,7 +25,6 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
-<%-- <p:theme themeName='Nphalanx'/>--%>
</head>
<body id="body">
19 years, 5 months
JBoss Portal SVN: r5797 - branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-11 12:21:44 -0500 (Mon, 11 Dec 2006)
New Revision: 5797
Modified:
branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/error.jsp
branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/login.jsp
Log:
removed references to layout tld
Modified: branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/error.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/error.jsp 2006-12-11 17:15:07 UTC (rev 5796)
+++ branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/error.jsp 2006-12-11 17:21:44 UTC (rev 5797)
@@ -1,11 +1,6 @@
-<%@ taglib uri="/WEB-INF/theme/portal-layout.tld" prefix="p" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
-<head>
- <p:theme themeName='renaissance'/>
-</head>
-
<body id="body">
<div id="portal-container">
<div id="sizer">
Modified: branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/login.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/login.jsp 2006-12-11 17:15:07 UTC (rev 5796)
+++ branches/JBoss_Portal_Branch_2_4/core/src/resources/portal-server-war/login.jsp 2006-12-11 17:21:44 UTC (rev 5797)
@@ -21,7 +21,6 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
-<%@ taglib uri="/WEB-INF/theme/portal-layout.tld" prefix="p" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
19 years, 5 months
JBoss Portal SVN: r5796 - trunk/core/src/resources/portal-server-war
by portal-commits@lists.jboss.org
Author: roy.russo(a)jboss.com
Date: 2006-12-11 12:15:07 -0500 (Mon, 11 Dec 2006)
New Revision: 5796
Modified:
trunk/core/src/resources/portal-server-war/error.jsp
trunk/core/src/resources/portal-server-war/login.jsp
Log:
removed ref to missing taglib
Modified: trunk/core/src/resources/portal-server-war/error.jsp
===================================================================
--- trunk/core/src/resources/portal-server-war/error.jsp 2006-12-11 16:31:23 UTC (rev 5795)
+++ trunk/core/src/resources/portal-server-war/error.jsp 2006-12-11 17:15:07 UTC (rev 5796)
@@ -21,12 +21,11 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
-<%@ taglib uri="/WEB-INF/theme/portal-layout.tld" prefix="p" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
- <p:theme themeName='Nphalanx'/>
+<%-- <p:theme themeName='Nphalanx'/>--%>
</head>
<body id="body">
Modified: trunk/core/src/resources/portal-server-war/login.jsp
===================================================================
--- trunk/core/src/resources/portal-server-war/login.jsp 2006-12-11 16:31:23 UTC (rev 5795)
+++ trunk/core/src/resources/portal-server-war/login.jsp 2006-12-11 17:15:07 UTC (rev 5796)
@@ -21,7 +21,6 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
-<%@ taglib uri="/WEB-INF/theme/portal-layout.tld" prefix="p" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
19 years, 5 months
JBoss Portal SVN: r5795 - in trunk/wsrp/src/main/org/jboss/portal: test/wsrp/registration wsrp/producer/registration/impl
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2006-12-11 11:31:23 -0500 (Mon, 11 Dec 2006)
New Revision: 5795
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java
Log:
- Fixed a bug in createConsumer where incorrect name was passed for the Consumer (thanks Julien)
- Modified test so that group name doesn't shadow consumer name (which hid the bug).
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-12-11 16:22:08 UTC (rev 5794)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/registration/RegistrationManagerTestCase.java 2006-12-11 16:31:23 UTC (rev 5795)
@@ -147,7 +147,7 @@
{
public String getGroupNameFor(String consumerName)
{
- return consumerName;
+ return "group_" + consumerName;
}
};
manager.setPolicy(policy);
@@ -157,7 +157,7 @@
Consumer consumer = manager.createConsumer(name);
assertNotNull(consumer);
- ConsumerGroup group = manager.getConsumerGroup(name);
+ ConsumerGroup group = manager.getConsumerGroup("group_" + name);
assertNotNull(group);
assertEquals(group, consumer.getGroup());
assertTrue(group.getConsumers().contains(consumer));
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java 2006-12-11 16:22:08 UTC (rev 5794)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/impl/RegistrationManagerImpl.java 2006-12-11 16:31:23 UTC (rev 5795)
@@ -132,10 +132,10 @@
// deal with group if needed
// let the policy decide if there should be a group associated with the Consumer and if yes, with which id
- String groupName = policy.getGroupNameFor(consumer.getName());
+ String groupName = policy.getGroupNameFor(name);
if (groupName != null)
{
- addConsumerToGroupNamed(groupName, groupName, true, false);
+ addConsumerToGroupNamed(name, groupName, true, false);
}
return consumer;
19 years, 5 months
JBoss Portal SVN: r5794 - trunk/tools/etc/buildfragments
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-11 11:22:08 -0500 (Mon, 11 Dec 2006)
New Revision: 5794
Modified:
trunk/tools/etc/buildfragments/modules.ent
Log:
update wsrp classpath
Modified: trunk/tools/etc/buildfragments/modules.ent
===================================================================
--- trunk/tools/etc/buildfragments/modules.ent 2006-12-11 16:08:27 UTC (rev 5793)
+++ trunk/tools/etc/buildfragments/modules.ent 2006-12-11 16:22:08 UTC (rev 5794)
@@ -102,7 +102,7 @@
<property name="jboss.portal-wsrp.root" value="${project.root}/wsrp/output"/>
<property name="jboss.portal-wsrp.lib" value="${jboss.portal-wsrp.root}/lib"/>
<path id="jboss.portal-wsrp.classpath">
- <pathelement path="${jboss.portal-wsrp.lib}/jboss-wsrp-lib.jar"/>
+ <pathelement path="${jboss.portal-wsrp.lib}/portal-wsrp-lib.jar"/>
</path>
<!-- security -->
19 years, 5 months
JBoss Portal SVN: r5793 - in trunk: common common/src/main/org/jboss/portal/common/util common/src/main/org/jboss/portal/test/common core/src/main/org/jboss/portal/core/impl/portlet/state portlet/src/main/org/jboss/portal/portlet portlet/src/main/org/jboss/portal/test/portlet wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-11 11:08:27 -0500 (Mon, 11 Dec 2006)
New Revision: 5793
Added:
trunk/common/src/main/org/jboss/portal/test/common/TypedMapTestCase.java
Modified:
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java
trunk/common/src/main/org/jboss/portal/common/util/TypedMap.java
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java
trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java
Log:
- improved the TypedMap class to support more stuff
- added a test case for TypedMap
- in core extends the TypedMap class to provide registration properties type checking and equality implementation
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2006-12-11 11:06:15 UTC (rev 5792)
+++ trunk/common/build.xml 2006-12-11 16:08:27 UTC (rev 5793)
@@ -201,6 +201,7 @@
-->
<x-test>
+ <test todir="${test.reports}" name="org.jboss.portal.test.common.TypedMapTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.InfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.TestParameterValueTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.test.TestParametrizationTestCase"/>
Modified: trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java 2006-12-11 11:06:15 UTC (rev 5792)
+++ trunk/common/src/main/org/jboss/portal/common/util/ParameterMap.java 2006-12-11 16:08:27 UTC (rev 5793)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.common.util;
+import java.util.Arrays;
+
/**
* A decorator that enforce the map content to be <String,String[]>
*
@@ -87,4 +89,11 @@
{
return value;
}
+
+ protected boolean internalValueEquals(Object left, Object right)
+ {
+ String[] valuesL = (String[])left;
+ String[] valuesR = (String[])right;
+ return Arrays.equals(valuesL, valuesR);
+ }
}
Modified: trunk/common/src/main/org/jboss/portal/common/util/TypedMap.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/util/TypedMap.java 2006-12-11 11:06:15 UTC (rev 5792)
+++ trunk/common/src/main/org/jboss/portal/common/util/TypedMap.java 2006-12-11 16:08:27 UTC (rev 5793)
@@ -32,6 +32,7 @@
/**
* A decorator that enforce the map content to be checked against a type.
+ * Null internal values are not supported.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -43,9 +44,8 @@
/**
* @throws ClassCastException if the key is of an inappropriate type for this map
- * @throws NullPointerException if the key is null and this map does not not permit null keys
*/
- protected abstract void assertKeyValidity(Object key) throws ClassCastException, NullPointerException;
+ protected abstract void assertKeyValidity(Object key) throws ClassCastException;
/**
* Unwrap the value to the the internal value that will be stored in the map.
@@ -54,15 +54,72 @@
* @return the unwrapped value
* @throws ClassCastException if the class of the specified value prevents it from being stored in this map
* @throws IllegalArgumentException if some aspect of this key prevents it from being stored in this map
- * @throws NullPointerException this map does not permit null values, and the specified value is null
*/
- protected abstract Object getInternalValue(Object value) throws IllegalArgumentException, ClassCastException, NullPointerException;
+ protected abstract Object getInternalValue(Object value) throws IllegalArgumentException, ClassCastException;
/**
* Wrap the internal value into its external representation.
*/
protected abstract Object getExternalValue(Object value);
+ private void validateKey(Object key)
+ {
+ if (key == null)
+ {
+ throw new NullPointerException("No null value accepted");
+ }
+ assertKeyValidity(key);
+ }
+
+ private Object unwrapValue(Object value) throws IllegalArgumentException, ClassCastException, NullPointerException
+ {
+ if (value == null)
+ {
+ throw new NullPointerException("No null value accepted");
+ }
+
+ //
+ value = getInternalValue(value);
+ if (value == null)
+ {
+ throw new IllegalArgumentException("The provided value " + value + " was converted to a null value");
+ }
+
+ //
+ return value;
+ }
+
+ private Object wrapValue(Object value) throws IllegalStateException
+ {
+ if (value == null)
+ {
+ return null;
+ }
+
+ //
+ Object wrappedValue = getExternalValue(value);
+ if (wrappedValue == null)
+ {
+ throw new IllegalStateException("Converted an internal value to a null value " + value);
+ }
+
+ //
+ return wrappedValue;
+ }
+
+ /**
+ * Compare internal values, the default implementation delegates the operation to the equals method
+ * of the left argument.
+ *
+ * @param left
+ * @param right
+ * @return true if the values are equals
+ */
+ protected boolean internalValueEquals(Object left, Object right)
+ {
+ return left.equals(right);
+ }
+
public int size()
{
return getDelegate().size();
@@ -80,13 +137,13 @@
public boolean containsKey(Object key)
{
- assertKeyValidity(key);
+ validateKey(key);
return getDelegate().containsKey(key);
}
public boolean containsValue(Object value)
{
- value = getInternalValue(value);
+ value = unwrapValue(value);
return getDelegate().containsValue(value);
}
@@ -98,14 +155,8 @@
public void putAll(Map t)
{
Map tmp = new HashMap(t);
- for (Iterator i = tmp.entrySet().iterator(); i.hasNext();)
- {
- Entry entry = (Entry)i.next();
- assertKeyValidity(entry.getKey());
- Object value = getInternalValue(entry.getValue());
- entry.setValue(value);
- }
- getDelegate().putAll(tmp);
+ validate(tmp, true);
+ getDelegate().putAll(t);
}
public Set entrySet()
@@ -120,28 +171,161 @@
public Object get(Object key)
{
- assertKeyValidity(key);
+ validateKey(key);
Object value = getDelegate().get(key);
- return getExternalValue(value);
+ value = wrapValue(value);
+ return value;
}
public Object remove(Object key)
{
- assertKeyValidity(key);
+ validateKey(key);
Object value = getDelegate().remove(key);
- value = getExternalValue(value);
+ value = wrapValue(value);
return value;
}
public Object put(Object key, Object value)
{
- assertKeyValidity(key);
- value = getInternalValue(value);
+ validateKey(key);
+ value = unwrapValue(value);
value = getDelegate().put(key, value);
- value = getExternalValue(value);
+ value = wrapValue(value);
return value;
}
+ // Overriden methods
+
+ /** Compare to parameters objects. */
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (o instanceof Map)
+ {
+ Map that = (Map)o;
+ Map delegate = getDelegate();
+
+ // Must have same sizes
+ if (that.size() != delegate.size())
+ {
+ return false;
+ }
+
+ //
+ for (Iterator i = that.entrySet().iterator(); i.hasNext();)
+ {
+ Map.Entry thatEntry = (Map.Entry)i.next();
+ Object thatKey = thatEntry.getKey();
+ Object thatValue = thatEntry.getValue();
+
+ //
+ try
+ {
+ // We don't support null values
+ if (thatValue == null)
+ {
+ return false;
+ }
+
+ // Check key validity
+ validateKey(thatKey);
+
+ // Unwrap
+ Object thatInternalValue = unwrapValue(thatValue);
+
+ // Get the internal value
+ Object internalValue = delegate.get(thatKey);
+
+ // Check the internal value
+ if (internalValue == null)
+ {
+ return false;
+ }
+
+ // Perform value comparison
+ if (internalValueEquals(internalValue, thatInternalValue) == false)
+ {
+ return false;
+ }
+ }
+ catch (IllegalArgumentException e)
+ {
+ return false;
+ }
+ catch (ClassCastException e)
+ {
+ return false;
+ }
+ catch (NullPointerException e)
+ {
+ return false;
+ }
+ }
+
+ //
+ return true;
+ }
+
+ //
+ return false;
+ }
+
+ // API extension
+
+ /**
+ * Replace the content with the new map which is validated before replacement.
+ *
+ * @param t the replacement map
+ * @throws ClassCastException
+ * @throws NullPointerException
+ * @throws IllegalArgumentException
+ */
+ public void replace(Map t) throws ClassCastException, NullPointerException, IllegalArgumentException
+ {
+ validate(t, false);
+
+ //
+ Map delegate = getDelegate();
+ delegate.clear();
+ delegate.putAll(t);
+ }
+
+ /**
+ * Validate the content.
+ *
+ * @throws ClassCastException
+ * @throws NullPointerException
+ * @throws IllegalArgumentException
+ */
+ public void validate() throws ClassCastException, NullPointerException, IllegalArgumentException
+ {
+ validate(this, false);
+ }
+
+ /**
+ * Validate the map and unwrap it if necessary.
+ */
+ protected final void validate(Map t, boolean unwrap) throws IllegalArgumentException, NullPointerException, ClassCastException
+ {
+ if (t == null)
+ {
+ throw new NullPointerException("No null map can be accepted");
+ }
+ for (Iterator i = t.entrySet().iterator(); i.hasNext();)
+ {
+ Entry entry = (Entry)i.next();
+ validateKey(entry.getKey());
+ Object value = unwrapValue(entry.getValue());
+ if (unwrap)
+ {
+ entry.setValue(value);
+ }
+ }
+ }
+
public class TypedEntrySet implements Set
{
@@ -281,13 +465,13 @@
public Object getValue()
{
Object value = delegate.getValue();
- value = getExternalValue(value);
+ value = wrapValue(value);
return value;
}
public Object setValue(Object value)
{
- value = getInternalValue(value);
+ value = unwrapValue(value);
return delegate.setValue(value);
}
}
Added: trunk/common/src/main/org/jboss/portal/test/common/TypedMapTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/TypedMapTestCase.java 2006-12-11 11:06:15 UTC (rev 5792)
+++ trunk/common/src/main/org/jboss/portal/test/common/TypedMapTestCase.java 2006-12-11 16:08:27 UTC (rev 5793)
@@ -0,0 +1,417 @@
+/******************************************************************************
+ * 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.test.common;
+
+import junit.framework.TestCase;
+import org.jboss.portal.common.util.TypedMap;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class TypedMapTestCase extends TestCase
+{
+
+ public TypedMapTestCase(String name)
+ {
+ super(name);
+ }
+
+ public void testGetWithBrokenGetInternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.internalValueReturnsNull = true;
+ map.get("abc");
+ map.delegate.put("abc", new Integer(0));
+ map.get("abc");
+ }
+
+ public void testPutWithBrokenGetInternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.internalValueReturnsNull = true;
+ try
+ {
+ map.put("abc", "0");
+ fail();
+ }
+ catch (IllegalArgumentException e)
+ {
+ }
+ }
+
+ public void testRemoveWithBrokenGetInternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.internalValueReturnsNull = true;
+ map.remove("abc");
+ }
+
+ public void testRemoveWithBrokenGetExternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.externalValueReturnsNull = true;
+ map.remove("abc");
+ map.delegate.put("abc", new Integer(0));
+ try
+ {
+ map.remove("abc");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ }
+
+ public void testGetWithBrokenGetExternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.externalValueReturnsNull = true;
+ map.get("abc");
+ map.delegate.put("abc", new Integer(0));
+ try
+ {
+ map.get("abc");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ }
+
+ public void testPutWithBrokenGetExternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.externalValueReturnsNull = true;
+ map.put("abc", "0");
+ try
+ {
+ map.put("abc", "0");
+ fail();
+ }
+ catch (IllegalStateException e)
+ {
+ }
+ }
+
+ public void testGetWithInvalidInternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.delegate.put("abc", "0");
+ try
+ {
+ map.get("abc");
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testPutWithInvalidInternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.delegate.put("abc", "0");
+ try
+ {
+ map.put("abc", "0");
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testRemoveWithInvalidInternalValue()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.delegate.put("abc", "0");
+ try
+ {
+ map.remove("abc");
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testRemove()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ assertNull(map.remove("abc"));
+ map.delegate.put("abc", new Integer(0));
+ assertEquals("0", map.remove("abc"));
+ assertTrue(map.delegate.isEmpty());
+ }
+
+ public void testPut()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ map.put("abc", "0");
+ assertEquals(Collections.singletonMap("abc", new Integer(0)), map.delegate);
+ }
+
+ public void testGet()
+ {
+ StringToIntegerMap map = new StringToIntegerMap();
+ assertNull(map.get("abc"));
+ map.delegate.put("abc", new Integer(0));
+ assertEquals(Collections.singletonMap("abc", "0"), map);
+ }
+
+ public void testContainsKeyWithInvalidKey()
+ {
+ try
+ {
+ new StringToIntegerMap().containsKey(null);
+ fail();
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ try
+ {
+ new StringToIntegerMap().containsKey(new Object());
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testContainsValueWithInvalidValue()
+ {
+ try
+ {
+ new StringToIntegerMap().containsValue(null);
+ fail();
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ try
+ {
+ new StringToIntegerMap().containsValue(new Object());
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testRemoveWithInvalidKey()
+ {
+ try
+ {
+ new StringToIntegerMap().remove(null);
+ fail();
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ try
+ {
+ new StringToIntegerMap().remove(new Object());
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testGetWithInvalidKey()
+ {
+ try
+ {
+ new StringToIntegerMap().get(null);
+ fail();
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ try
+ {
+ new StringToIntegerMap().get(new Object());
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testPutWithInvalidKey()
+ {
+ try
+ {
+ new StringToIntegerMap().put(null, "0");
+ fail();
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ try
+ {
+ new StringToIntegerMap().put(new Object(), "0");
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testWithPutInvalidValue()
+ {
+ try
+ {
+ new StringToIntegerMap().put("", null);
+ fail();
+ }
+ catch (NullPointerException expected)
+ {
+ }
+ try
+ {
+ new StringToIntegerMap().put("", new Object());
+ fail();
+ }
+ catch (ClassCastException expected)
+ {
+ }
+ }
+
+ public void testEquals()
+ {
+ StringToIntegerMap left = new StringToIntegerMap();
+ left.delegate.put("abc", new Integer(0));
+ Map right = new HashMap();
+
+ //
+ assertFalse(left.equals(right));
+ assertFalse(right.equals(left));
+
+ //
+ right.put("abc", new Object());
+ assertFalse(left.equals(right));
+ assertFalse(right.equals(left));
+
+ //
+ right.put("abc", "abc");
+ assertFalse(left.equals(right));
+ assertFalse(right.equals(left));
+
+ //
+ right.put("abc", "0");
+ assertTrue(left.equals(right));
+ assertTrue(right.equals(left));
+
+ //
+ right.put("def", "1");
+ assertFalse(left.equals(right));
+ assertFalse(right.equals(left));
+
+ //
+ right.remove("def");
+ right.put(null, "0");
+ assertFalse(left.equals(right));
+ assertFalse(right.equals(left));
+
+ //
+ right.remove(null);
+ right.put("def", null);
+ assertFalse(left.equals(right));
+ assertFalse(right.equals(left));
+ }
+
+ public static class StringToIntegerMap extends TypedMap
+ {
+
+ /** . */
+ final Map delegate = new HashMap();
+
+ /** . */
+ boolean internalValueReturnsNull = false;
+
+ /** . */
+ boolean externalValueReturnsNull = false;
+
+ protected Map getDelegate()
+ {
+ return delegate;
+ }
+
+ protected void assertKeyValidity(Object key) throws ClassCastException
+ {
+ assertNotNull(key);
+ if (key instanceof String == false)
+ {
+ throw new ClassCastException();
+ }
+ }
+
+ protected Object getInternalValue(Object value) throws IllegalArgumentException, ClassCastException
+ {
+ assertNotNull(value);
+ if (internalValueReturnsNull)
+ {
+ return null;
+ }
+ String s = (String)value;
+ try
+ {
+ return new Integer(s);
+ }
+ catch (NumberFormatException e)
+ {
+ IllegalArgumentException iae = new IllegalArgumentException();
+ iae.initCause(e);
+ throw iae;
+ }
+ }
+
+ protected Object getExternalValue(Object value)
+ {
+ assertNotNull(value);
+ if (externalValueReturnsNull)
+ {
+ return null;
+ }
+ Integer i = (Integer)value;
+ return i.toString();
+ }
+
+ protected boolean internalValueEquals(Object left, Object right)
+ {
+ assertNotNull(left);
+ assertNotNull(right);
+ Integer li = (Integer)left;
+ Integer ri = (Integer)right;
+ return li.intValue() == ri.intValue();
+ }
+ }
+
+}
Modified: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2006-12-11 11:06:15 UTC (rev 5792)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2006-12-11 16:08:27 UTC (rev 5793)
@@ -25,9 +25,12 @@
import org.jboss.portal.wsrp.producer.registration.api.Registration;
import org.jboss.portal.wsrp.producer.registration.api.Consumer;
import org.jboss.portal.wsrp.producer.registration.api.RegistrationStatus;
+import org.jboss.portal.common.util.TypedMap;
+import org.jboss.portal.common.NotYetImplemented;
import javax.xml.namespace.QName;
import java.util.Map;
+import java.util.Collections;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -47,6 +50,10 @@
private PersistentConsumer relatedConsumer;
+ // Wrapper
+
+ private Properties properties;
+
/**
* Hibernate constructor.
*/
@@ -56,6 +63,8 @@
this.persistentHandle = null;
this.relatedConsumer = null;
this.persistentStatus = null;
+ this.persistentProperties = null;
+ this.properties = new Properties();
}
PersistentRegistration(Map properties, RegistrationStatus status)
@@ -64,6 +73,11 @@
this.persistentHandle = null;
this.relatedConsumer = null;
this.persistentStatus = status;
+ this.persistentProperties = properties;
+ this.properties = new Properties();
+
+ // Perform properties validation
+ this.properties.validate();
}
// Hibernate
@@ -147,66 +161,185 @@
public Map getProperties()
{
- return null;
+ return Collections.unmodifiableMap(persistentProperties);
}
public void setPropertyValueFor(QName propertyName, Object value)
{
- //To change body of implemented methods use File | Settings | File Templates.
+ properties.setProperty(propertyName, value);
}
public void setPropertyValueFor(String propertyName, Object value)
{
- //To change body of implemented methods use File | Settings | File Templates.
+ properties.setProperty(propertyName, value);
}
- public boolean hasEqualProperties(Registration registration)
+ public void removeProperty(QName propertyName)
{
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ properties.removeProperty(propertyName);
}
- public boolean hasEqualProperties(Map properties)
+ public void removeProperty(String propertyName)
{
- return false; //To change body of implemented methods use File | Settings | File Templates.
+ properties.removeProperty(propertyName);
}
- public RegistrationStatus getStatus()
+ public Object getPropertyValueFor(QName propertyName)
{
- return persistentStatus;
+ return properties.getProperty(propertyName);
}
- public void setStatus(RegistrationStatus status)
+ public Object getPropertyValueFor(String propertyName)
{
- this.persistentStatus = status;
+ return properties.getProperty(propertyName);
}
- public void clearAssociatedState()
+ public void updateProperties(Map registrationProperties)
{
- //To change body of implemented methods use File | Settings | File Templates.
+ properties.replace(registrationProperties);
}
- public void updateProperties(Map registrationProperties)
+ public boolean hasEqualProperties(Registration registration)
{
- //To change body of implemented methods use File | Settings | File Templates.
+ if (registration != null)
+ {
+ PersistentRegistration preg = (PersistentRegistration)registration;
+
+ //
+ return hasEqualProperties(preg.persistentProperties);
+ }
+
+ //
+ return false;
}
- public void removeProperty(QName propertyName)
+ public boolean hasEqualProperties(Map properties)
{
- //To change body of implemented methods use File | Settings | File Templates.
+ return this.properties.equals(properties);
}
- public void removeProperty(String propertyName)
+ public RegistrationStatus getStatus()
{
- //To change body of implemented methods use File | Settings | File Templates.
+ return persistentStatus;
}
- public Object getPropertyValueFor(QName propertyName)
+ public void setStatus(RegistrationStatus status)
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ this.persistentStatus = status;
}
- public Object getPropertyValueFor(String propertyName)
+ public void clearAssociatedState()
{
- return null; //To change body of implemented methods use File | Settings | File Templates.
+ throw new NotYetImplemented();
}
+
+ // ***********
+
+ /**
+ * Implement registration properties semantics, mostly validation and equality.
+ */
+ public class Properties extends TypedMap
+ {
+
+ protected Map getDelegate()
+ {
+ return persistentProperties;
+ }
+
+ protected void assertKeyValidity(Object key) throws ClassCastException, NullPointerException
+ {
+ if (key == null)
+ {
+ throw new NullPointerException();
+ }
+ if (key instanceof QName == false)
+ {
+ throw new ClassCastException();
+ }
+ }
+
+ protected Object getInternalValue(Object value) throws IllegalArgumentException, ClassCastException, NullPointerException
+ {
+ if (value == null)
+ {
+ throw new NullPointerException();
+ }
+ if (value instanceof String == false)
+ {
+ throw new ClassCastException();
+ }
+ return value;
+ }
+
+ protected Object getExternalValue(Object value)
+ {
+ return value;
+ }
+
+ public void setProperty(String propertyName, Object value)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name accepted");
+ }
+
+ //
+ setProperty(new QName(propertyName), value);
+ }
+
+ public void setProperty(QName propertyName, Object value)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name accepted");
+ }
+
+ //
+ put(propertyName, value);
+ }
+
+ public void removeProperty(QName propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name accepted");
+ }
+
+ //
+ remove(propertyName);
+ }
+
+ public void removeProperty(String propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name accepted");
+ }
+
+ //
+ removeProperty(new QName(propertyName));
+ }
+
+ public Object getProperty(QName propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name accepted");
+ }
+
+ //
+ return get(propertyName);
+ }
+
+ public Object getProperty(String propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException("No null property name accepted");
+ }
+
+ //
+ return getProperty(new QName(propertyName));
+ }
+ }
}
Modified: trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java 2006-12-11 11:06:15 UTC (rev 5792)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/Parameters.java 2006-12-11 16:08:27 UTC (rev 5793)
@@ -25,7 +25,6 @@
import org.jboss.portal.common.util.ParameterMap;
import java.io.Serializable;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -80,6 +79,12 @@
*/
public Parameters(Map parameterMap) throws NullPointerException, ClassCastException, IllegalArgumentException
{
+ if (parameterMap == null)
+ {
+ throw new IllegalArgumentException("No null map accepted");
+ }
+
+ //
this.map = new HashMap();
//
@@ -159,32 +164,12 @@
*/
public void append(Map params) throws ClassCastException, NullPointerException, IllegalArgumentException
{
- checkValidity(params);
+ validate(params, false);
//
internalAppend(params);
}
- /**
- * Replace all the existing parameters with the new ones. The argument validation is performed before the state is
- * updated.
- *
- * @param params the parameters to replace
- * @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 replace(Map params)
- {
- checkValidity(params);
-
- //
- clear();
- putAll(params);
- }
-
/** Append actual implementation. */
private void internalAppend(Map params)
{
@@ -213,47 +198,6 @@
}
}
- /** Compare to parameters objects. */
- public boolean equals(Object o)
- {
- if (o == this)
- {
- return true;
- }
- if (o instanceof Parameters)
- {
- Parameters that = (Parameters)o;
- if (that.map == null)
- {
- return map == null || map.size() == 0;
- }
- else if (map == null)
- {
- return that.map.size() == 0;
- }
- else if (that.map.size() != map.size())
- {
- return false;
- }
- for (Iterator i = that.map.entrySet().iterator(); i.hasNext();)
- {
- Map.Entry entry = (Map.Entry)i.next();
- String[] values2 = (String[])map.get(entry.getKey());
- if (values2 == null)
- {
- return false;
- }
- String[] values1 = (String[])entry.getValue();
- if (!Arrays.equals(values1, values2))
- {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-
public String toString()
{
StringBuffer buffer = new StringBuffer("Parameters[");
@@ -278,18 +222,4 @@
buffer.append(']');
return buffer.toString();
}
-
- protected void checkValidity(Map that) throws IllegalArgumentException
- {
- if (that == null)
- {
- throw new IllegalArgumentException("Map cannot be null");
- }
- for (Iterator i = that.entrySet().iterator(); i.hasNext();)
- {
- Entry entry = (Entry)i.next();
- assertKeyValidity(entry.getKey());
- getInternalValue(entry.getValue());
- }
- }
}
Modified: trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java 2006-12-11 11:06:15 UTC (rev 5792)
+++ trunk/portlet/src/main/org/jboss/portal/test/portlet/ParametersTestCase.java 2006-12-11 16:08:27 UTC (rev 5793)
@@ -173,18 +173,6 @@
}
}
- public void testSetValuesWithNullParameters()
- {
- try
- {
- param.replace((Parameters)null);
- fail("Expected IllegalArgumentException");
- }
- catch (IllegalArgumentException e)
- {
- }
- }
-
public void testReplaceWithParameters()
{
Parameters other = new Parameters();
@@ -199,7 +187,7 @@
{
try
{
- new Parameters((Parameters)null);
+ new Parameters(null);
fail("Expected IllegalArgumentException");
}
catch (IllegalArgumentException e)
@@ -223,10 +211,10 @@
{
try
{
- param.replace((Map)null);
- fail("Expected IllegalArgumentException");
+ param.replace(null);
+ fail("Expected NullPointerException");
}
- catch (IllegalArgumentException e)
+ catch (NullPointerException e)
{
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java 2006-12-11 11:06:15 UTC (rev 5792)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/producer/registration/api/Registration.java 2006-12-11 16:08:27 UTC (rev 5793)
@@ -23,6 +23,8 @@
package org.jboss.portal.wsrp.producer.registration.api;
+import org.jboss.portal.common.util.TypedMap;
+
import javax.xml.namespace.QName;
import java.util.Map;
@@ -72,7 +74,7 @@
*/
Map getProperties();
- void setPropertyValueFor(QName propertyName, Object value);
+ void setPropertyValueFor(QName propertyName, Object value) throws IllegalArgumentException;
void setPropertyValueFor(String propertyName, Object value);
19 years, 5 months
JBoss Portal SVN: r5792 - trunk/jems/src/main/org/jboss/portal/jems/hibernate
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-11 06:06:15 -0500 (Mon, 11 Dec 2006)
New Revision: 5792
Added:
trunk/jems/src/main/org/jboss/portal/jems/hibernate/QNameUserType.java
Modified:
trunk/jems/src/main/org/jboss/portal/jems/hibernate/StringWrapperUserType.java
Log:
Added hibernate QNameUserType which maps a QName on two database columns.
Added: trunk/jems/src/main/org/jboss/portal/jems/hibernate/QNameUserType.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/hibernate/QNameUserType.java 2006-12-11 10:15:31 UTC (rev 5791)
+++ trunk/jems/src/main/org/jboss/portal/jems/hibernate/QNameUserType.java 2006-12-11 11:06:15 UTC (rev 5792)
@@ -0,0 +1,140 @@
+/******************************************************************************
+ * 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.jems.hibernate;
+
+import org.hibernate.usertype.UserType;
+import org.hibernate.HibernateException;
+import org.hibernate.Hibernate;
+
+import javax.xml.namespace.QName;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.PreparedStatement;
+import java.sql.Types;
+import java.io.Serializable;
+
+/**
+ * An hibernate user type to persist the <code>javax.xml.namespace.QName</code> class on two database columns.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class QNameUserType implements UserType
+{
+
+ /** . */
+ private static final int[] SQL_TYPES = {Hibernate.STRING.sqlType(),Hibernate.STRING.sqlType()};
+
+ public int[] sqlTypes()
+ {
+ return SQL_TYPES;
+ }
+
+ public Class returnedClass()
+ {
+ return QName.class;
+ }
+
+ public boolean equals(Object x, Object y) throws HibernateException
+ {
+ if (x == y)
+ {
+ return true;
+ }
+ else if (x == null || y == null)
+ {
+ return false;
+ }
+ else
+ {
+ return x.equals(y);
+ }
+ }
+
+ public int hashCode(Object x) throws HibernateException
+ {
+ return x.hashCode();
+ }
+
+ public Object nullSafeGet(ResultSet resultSet, String[] names, Object owner) throws HibernateException, SQLException
+ {
+ // Test nullity on local part
+ String localPart = resultSet.getString(names[1]);
+ if (resultSet.wasNull())
+ {
+ return null;
+ }
+
+ // The namespace URI
+ String namespaceURI = resultSet.getString(names[0]);
+
+ // Oracle considers that the empty string is null (very nice feature, clap clap), so we replace null by empty string
+ if (namespaceURI == null)
+ {
+ namespaceURI = "";
+ }
+
+ //
+ return new QName(namespaceURI, localPart);
+ }
+
+ public void nullSafeSet(PreparedStatement statement, Object value, int index) throws HibernateException, SQLException
+ {
+ if (value == null)
+ {
+ statement.setNull(index, Types.VARCHAR);
+ statement.setNull(index + 1, Types.VARCHAR);
+ }
+ else
+ {
+ QName qname = (QName)value;
+ statement.setString(index, qname.getNamespaceURI());
+ statement.setString(index + 1, qname.getLocalPart());
+ }
+ }
+
+ public Object deepCopy(Object value) throws HibernateException
+ {
+ return value;
+ }
+
+ public boolean isMutable()
+ {
+ return false;
+ }
+
+ public Serializable disassemble(Object value) throws HibernateException
+ {
+ return (QName)value;
+ }
+
+ public Object assemble(Serializable cached, Object owner) throws HibernateException
+ {
+ return cached;
+ }
+
+ public Object replace(Object original, Object target, Object owner) throws HibernateException
+ {
+ return original;
+ }
+}
Modified: trunk/jems/src/main/org/jboss/portal/jems/hibernate/StringWrapperUserType.java
===================================================================
--- trunk/jems/src/main/org/jboss/portal/jems/hibernate/StringWrapperUserType.java 2006-12-11 10:15:31 UTC (rev 5791)
+++ trunk/jems/src/main/org/jboss/portal/jems/hibernate/StringWrapperUserType.java 2006-12-11 11:06:15 UTC (rev 5792)
@@ -65,18 +65,18 @@
}
}
- public int hashCode(Object object) throws HibernateException
+ public int hashCode(Object x) throws HibernateException
{
- return object.hashCode();
+ return x.hashCode();
}
public Object nullSafeGet(ResultSet resultSet, String[] names, Object owner) throws HibernateException, SQLException
{
+ String value = resultSet.getString(names[0]);
if (resultSet.wasNull())
{
return null;
}
- String value = resultSet.getString(names[0]);
return fromString(value);
}
19 years, 5 months
JBoss Portal SVN: r5791 - branches/JBoss_Portal_Branch_2_4/server/src/main/org/jboss/portal/server
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-11 05:15:31 -0500 (Mon, 11 Dec 2006)
New Revision: 5791
Modified:
branches/JBoss_Portal_Branch_2_4/server/src/main/org/jboss/portal/server/PortalConstants.java
Log:
2.4.1 final version in PortalConstants
Modified: branches/JBoss_Portal_Branch_2_4/server/src/main/org/jboss/portal/server/PortalConstants.java
===================================================================
--- branches/JBoss_Portal_Branch_2_4/server/src/main/org/jboss/portal/server/PortalConstants.java 2006-12-11 09:52:15 UTC (rev 5790)
+++ branches/JBoss_Portal_Branch_2_4/server/src/main/org/jboss/portal/server/PortalConstants.java 2006-12-11 10:15:31 UTC (rev 5791)
@@ -35,7 +35,7 @@
public class PortalConstants
{
/** Current version. */
- public static Version VERSION = new Version("JBoss Portal", 2, 4, 1, new Version.Qualifier(Version.Qualifier.Prefix.CR, "2"), "Devil");
+ public static Version VERSION = new Version("JBoss Portal", 2, 4, 1, new Version.Qualifier(Version.Qualifier.Prefix.GA, ""), "Devil");
/** The default portal name. */
public static String DEFAULT_PORTAL_NAME = "default";
19 years, 5 months
JBoss Portal SVN: r5790 - trunk/server/src/main/org/jboss/portal/server
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-11 04:52:15 -0500 (Mon, 11 Dec 2006)
New Revision: 5790
Modified:
trunk/server/src/main/org/jboss/portal/server/PortalConstants.java
Log:
update trunk version to 2.6 alpha
Modified: trunk/server/src/main/org/jboss/portal/server/PortalConstants.java
===================================================================
--- trunk/server/src/main/org/jboss/portal/server/PortalConstants.java 2006-12-11 01:49:48 UTC (rev 5789)
+++ trunk/server/src/main/org/jboss/portal/server/PortalConstants.java 2006-12-11 09:52:15 UTC (rev 5790)
@@ -35,7 +35,7 @@
public class PortalConstants
{
/** Current version. */
- public static Version VERSION = new Version("JBoss Portal", 2, 6, 0, new Version.Qualifier(Version.Qualifier.Prefix.SNAPSHOT, ""), "TBD");
+ public static Version VERSION = new Version("JBoss Portal", 2, 6, 0, new Version.Qualifier(Version.Qualifier.Prefix.ALPHA, "1"), "Ninja");
/** The default portal name. */
public static String DEFAULT_PORTAL_NAME = "default";
19 years, 5 months
JBoss Portal SVN: r5789 - in trunk: core/src/main/org/jboss/portal/core/impl/portlet/state portlet/src/main/org/jboss/portal/portlet/aspects/portlet
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2006-12-10 20:49:48 -0500 (Sun, 10 Dec 2006)
New Revision: 5789
Added:
trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/StateManagementPolicyImpl.java
trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java
Log:
- LocalInterceptor which denotes invocation from local portal
- StateManagementPolicy implementation whose decision is based on LocalInterceptor and RegistrationLocal
Added: trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/StateManagementPolicyImpl.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/StateManagementPolicyImpl.java 2006-12-11 01:32:38 UTC (rev 5788)
+++ trunk/core/src/main/org/jboss/portal/core/impl/portlet/state/StateManagementPolicyImpl.java 2006-12-11 01:49:48 UTC (rev 5789)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * 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.core.impl.portlet.state;
+
+import org.jboss.portal.portlet.state.StateManagementPolicy;
+import org.jboss.portal.portlet.aspects.portlet.LocalInterceptor;
+import org.jboss.portal.wsrp.producer.registration.RegistrationLocal;
+import org.jboss.portal.wsrp.producer.registration.api.Registration;
+
+/**
+ * An implementation that rely on thread local context to make up its decision. State is locally persisted
+ * only for the local portal or for wsrp invocations in the context of a registration.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class StateManagementPolicyImpl implements StateManagementPolicy
+{
+ public boolean persistLocally()
+ {
+ boolean local = LocalInterceptor.isLocal();
+
+ // If this is a local call we persist locally
+ if (local)
+ {
+ return true;
+ }
+
+ // Otherwise the optional registration from the wsrp layer
+ Registration registration = RegistrationLocal.getRegistration();
+
+ // And persist locally only in the scope of an existing registration
+ return registration != null;
+ }
+}
Added: trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java
===================================================================
--- trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java 2006-12-11 01:32:38 UTC (rev 5788)
+++ trunk/portlet/src/main/org/jboss/portal/portlet/aspects/portlet/LocalInterceptor.java 2006-12-11 01:49:48 UTC (rev 5789)
@@ -0,0 +1,58 @@
+/******************************************************************************
+ * 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.aspects.portlet;
+
+import org.jboss.portal.portlet.invocation.PortletInterceptor;
+import org.jboss.portal.portlet.invocation.PortletInvocation;
+import org.jboss.portal.common.invocation.InvocationException;
+
+/**
+ * An interceptor whose purpose is to detect invocation from the local portal.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class LocalInterceptor extends PortletInterceptor
+{
+
+ /** . */
+ private static final ThreadLocal local = new ThreadLocal();
+
+ public static boolean isLocal()
+ {
+ return Boolean.TRUE.equals(local.get());
+ }
+
+ protected Object invoke(PortletInvocation invocation) throws Exception, InvocationException
+ {
+ try
+ {
+ local.set(Boolean.TRUE);
+ return invocation.invokeNext();
+ }
+ finally
+ {
+ local.set(null);
+ }
+ }
+}
19 years, 5 months