Author: julien(a)jboss.com
Date: 2007-02-26 10:27:15 -0500 (Mon, 26 Feb 2007)
New Revision: 6402
Added:
trunk/faces/src/main/org/jboss/portal/faces/el/PropertyValue.java
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractPropertyDecorator.java
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/BeanDecorator.java
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/PropertyDecorator.java
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/SimpleBeanDecorator.java
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/DynamicBean.java
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/DynamicProperty.java
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java
Removed:
trunk/faces/src/main/org/jboss/portal/faces/el/PropertyAccessor.java
trunk/faces/src/main/org/jboss/portal/faces/el/PropertyDef.java
trunk/faces/src/main/org/jboss/portal/faces/el/TypeDef.java
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorRegistryBean.java
trunk/faces/build.xml
trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
Log:
refactored the org.jboss.portal.faces.el package which was messy and not prone to add unit
testing
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java 2007-02-26
14:46:22 UTC (rev 6401)
+++
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/AbstractAuthorizationBean.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -23,7 +23,8 @@
package org.jboss.portal.core.portlet.management;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.faces.el.PropertyAccessor;
+import org.jboss.portal.faces.el.dynamic.AbstractDynamicBean;
+import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.security.RoleSecurityBinding;
import org.jboss.portal.security.SecurityConstants;
import org.jboss.portal.security.spi.provider.DomainConfigurator;
@@ -49,28 +50,29 @@
public abstract class AbstractAuthorizationBean
{
- public PropertyAccessor getForRole()
+ public AbstractDynamicBean getForRole()
{
- return new PropertyAccessor()
+ return new AbstractDynamicBean()
{
public Class getType(Object propertyName)
{
return String[].class;
}
- public Object getValue(Object propertyName)
+ public PropertyValue getValue(Object propertyName)
{
- return getActionsForRole((String)propertyName);
+ String[] actions = getActionsForRole((String)propertyName);
+ return actions != null ? new PropertyValue(actions) : null;
}
- public void setValue(Object propertyName, Object value)
+ public boolean setValue(Object propertyName, Object value)
{
- setActionsForRole((String)propertyName, (String[])value);
+ return setActionsForRole((String)propertyName, (String[])value);
}
};
}
- public void setActionsForRole(String roleName, String[] actions)
+ public boolean setActionsForRole(String roleName, String[] actions)
{
String uri = getURI();
if (uri != null)
@@ -95,7 +97,12 @@
{
e.printStackTrace();
}
+ return true;
}
+ else
+ {
+ return false;
+ }
}
public String[] getActionsForRole(String roleName)
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2007-02-26
14:46:22 UTC (rev 6401)
+++
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/PortalObjectManagerBean.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -63,8 +63,8 @@
import org.jboss.portal.core.model.portal.Window;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.faces.el.DelegatingPropertyResolver;
-import org.jboss.portal.faces.el.PropertyDef;
-import org.jboss.portal.faces.el.TypeDef;
+import org.jboss.portal.faces.el.decorator.SimpleBeanDecorator;
+import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.RoleModule;
import org.jboss.portal.portlet.Portlet;
@@ -104,14 +104,14 @@
static
{
- TypeDef roleModuleDef = new TypeDef(RoleModule.class);
- roleModuleDef.addAccessor("roles", new PropertyDef(Set.class)
+ SimpleBeanDecorator roleModuleDecorator = new SimpleBeanDecorator();
+ roleModuleDecorator.setProperty("roles", new
AbstractPropertyDecorator(Set.class)
{
- public Object getValue(Object base)
+ public Object getValue(Object bean)
{
try
{
- RoleModule module = (RoleModule)base;
+ RoleModule module = (RoleModule)bean;
return module.findRoles();
}
catch (IdentityException e)
@@ -123,23 +123,23 @@
});
//
- TypeDef portletDef = new TypeDef(Portlet.class);
- portletDef.addAccessor("name", new PropertyDef(String.class)
+ SimpleBeanDecorator portletDecorator = new SimpleBeanDecorator();
+ portletDecorator.setProperty("name", new
AbstractPropertyDecorator(String.class)
{
- public Object getValue(Object base)
+ public Object getValue(Object bean) throws IllegalArgumentException
{
- Portlet portlet = (Portlet)base;
+ Portlet portlet = (Portlet)bean;
LocalizedString displayName =
portlet.getInfo().getMeta().getMetaValue(MetaInfo.DISPLAY_NAME);
FacesContext ctx = FacesContext.getCurrentInstance();
Locale locale = ctx.getExternalContext().getRequestLocale();
return displayName.getString(locale, true);
}
});
- portletDef.addAccessor("description", new PropertyDef(String.class)
+ portletDecorator.setProperty("description", new
AbstractPropertyDecorator(String.class)
{
- public Object getValue(Object base)
+ public Object getValue(Object bean) throws IllegalArgumentException
{
- Portlet portlet = (Portlet)base;
+ Portlet portlet = (Portlet)bean;
LocalizedString displayName =
portlet.getInfo().getMeta().getMetaValue(MetaInfo.DESCRIPTION);
FacesContext ctx = FacesContext.getCurrentInstance();
Locale locale = ctx.getExternalContext().getRequestLocale();
@@ -151,16 +151,19 @@
return name;
}
});
- portletDef.addAccessor("remotable", new PropertyDef(String.class)
+ portletDecorator.setProperty("remotable", new
AbstractPropertyDecorator(String.class)
{
- public Object getValue(Object base)
+ public Object getValue(Object bean) throws IllegalArgumentException
{
- Portlet portlet = (Portlet)base;
+ Portlet portlet = (Portlet)bean;
PortletInfo info = portlet.getInfo();
return info.isRemotable();
}
});
- DelegatingPropertyResolver.registerTypeDef(portletDef);
+
+ //
+ DelegatingPropertyResolver.registerDecorator(Portlet.class, portletDecorator);
+ DelegatingPropertyResolver.registerDecorator(RoleModule.class,
roleModuleDecorator);
}
/** . */
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorRegistryBean.java
===================================================================
---
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorRegistryBean.java 2007-02-26
14:46:22 UTC (rev 6401)
+++
trunk/core-admin/src/main/org/jboss/portal/core/portlet/management/content/ContentEditorRegistryBean.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -22,12 +22,11 @@
******************************************************************************/
package org.jboss.portal.core.portlet.management.content;
-import org.jboss.portal.faces.el.PropertyAccessor;
+import org.jboss.portal.faces.el.dynamic.AbstractDynamicBean;
+import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.core.model.content.ContentType;
import javax.faces.model.SelectItem;
-import java.util.Map;
-import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ArrayList;
@@ -44,7 +43,7 @@
private ContentEditorRegistry registry;
/** . */
- private PropertyAccessor editors;
+ private AbstractDynamicBean editors;
/** . */
private String selectedType;
@@ -52,7 +51,7 @@
public ContentEditorRegistryBean()
{
selectedType = "portlet";
- editors = new PropertyAccessor()
+ editors = new AbstractDynamicBean()
{
public Class getType(Object propertyName)
{
@@ -63,9 +62,10 @@
}
return null;
}
- public Object getValue(Object propertyName)
+ public PropertyValue getValue(Object propertyName)
{
- return getEditor(propertyName);
+ ContentEditor editor = getEditor(propertyName);
+ return editor != null ? new PropertyValue(editor) : null;
}
};
}
@@ -115,7 +115,7 @@
this.registry = registry;
}
- public PropertyAccessor getEditors()
+ public AbstractDynamicBean getEditors()
{
return editors;
}
Modified: trunk/faces/build.xml
===================================================================
--- trunk/faces/build.xml 2007-02-26 14:46:22 UTC (rev 6401)
+++ trunk/faces/build.xml 2007-02-26 15:27:15 UTC (rev 6402)
@@ -93,6 +93,7 @@
<path refid="facelets.facelets.classpath"/>
<path refid="el.el.classpath"/>
<path refid="apache.log4j.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
</path>
<!-- Configure modules -->
Modified: trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java
===================================================================
---
trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2007-02-26
14:46:22 UTC (rev 6401)
+++
trunk/faces/src/main/org/jboss/portal/faces/el/DelegatingPropertyResolver.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -23,6 +23,8 @@
package org.jboss.portal.faces.el;
import org.apache.log4j.Logger;
+import org.jboss.portal.faces.el.dynamic.DynamicBean;
+import org.jboss.portal.faces.el.decorator.BeanDecorator;
import javax.faces.el.EvaluationException;
import javax.faces.el.PropertyNotFoundException;
@@ -31,7 +33,7 @@
import java.util.Map;
/**
- * A property resolver that provide fine grained configuration of the resolving
mechanism.
+ * A property resolver that provide fine grained configuration of the resolution
mechanism.
*
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -46,14 +48,22 @@
private final PropertyResolver delegate;
/** . */
- private static Map resolverMap = new HashMap();
+ private static volatile Map decoratorMap = new HashMap();
- public static synchronized void registerTypeDef(TypeDef typeDef)
+ public static synchronized void registerDecorator(Class clazz, BeanDecorator
decorator)
{
- Map copy = new HashMap(resolverMap);
- copy.put(typeDef.getType(), typeDef);
- resolverMap = copy;
- log.debug("Added type def " + typeDef.getType() + " in resolver
map");
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (decorator == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ Map copy = new HashMap(decoratorMap);
+ copy.put(clazz.getName(), decorator);
+ decoratorMap = copy;
+ log.debug("Added bean decorator " + clazz.getName() + " in resolver
map");
}
public DelegatingPropertyResolver(PropertyResolver delegate)
@@ -68,57 +78,91 @@
public Class getType(Object base, Object property) throws EvaluationException,
PropertyNotFoundException
{
- if (base instanceof PropertyAccessor)
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
{
- PropertyAccessor accessor = (PropertyAccessor)base;
- Class type = accessor.getType(property);
+ DynamicBean dynamicBean = (DynamicBean)base;
+ Class type = dynamicBean.getType(property);
if (type != null)
{
return type;
}
}
- TypeDef typeDef = resolveTypeDef(base);
- if (typeDef != null)
+
+ //
+ BeanDecorator decorator = resolveTypeDef(base);
+ if (decorator != null)
{
- PropertyDef propDef = typeDef.getAccessor(base, property);
- if (propDef != null)
+ Class type = decorator.getType(base, property);
+ if (type != null)
{
- return propDef.getType();
+ return type;
}
}
+
+ //
return delegate.getType(base, property);
}
- public Object getValue(Object base, int index) throws EvaluationException,
PropertyNotFoundException
- {
- return delegate.getValue(base, index);
- }
-
public Object getValue(Object base, Object property) throws EvaluationException,
PropertyNotFoundException
{
- if (base instanceof PropertyAccessor)
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
{
- PropertyAccessor accessor = (PropertyAccessor)base;
- return accessor.getValue(property);
+ DynamicBean dynamicBean = (DynamicBean)base;
+ PropertyValue value = dynamicBean.getValue(property);
+ if (value != null)
+ {
+ return value.getObject();
+ }
}
- TypeDef map = resolveTypeDef(base);
- if (map != null)
+
+ //
+ BeanDecorator decorator = resolveTypeDef(base);
+ if (decorator != null)
{
- PropertyDef nav = map.getAccessor(base, property);
+ PropertyValue nav = decorator.getValue(base, property);
if (nav != null)
{
- try
- {
- return nav.getValue(base);
- }
- catch (UnsupportedOperationException ignore)
- {
- }
+ return nav.getObject();
}
}
+
+ //
return delegate.getValue(base, property);
}
+ public void setValue(Object base, Object property, Object value) throws
EvaluationException, PropertyNotFoundException
+ {
+ // See if the object can handle itself the property
+ if (base instanceof DynamicBean)
+ {
+ DynamicBean dynamic = (DynamicBean)base;
+ if (dynamic.setValue(property, value))
+ {
+ return;
+ }
+ }
+
+ //
+ BeanDecorator decorator = resolveTypeDef(base);
+ if (decorator != null)
+ {
+ if (decorator.setValue(base, property, value))
+ {
+ return;
+ }
+ }
+
+ //
+ delegate.setValue(base, property, value);
+ }
+
+ public Object getValue(Object base, int index) throws EvaluationException,
PropertyNotFoundException
+ {
+ return delegate.getValue(base, index);
+ }
+
public boolean isReadOnly(Object base, int index) throws EvaluationException,
PropertyNotFoundException
{
return delegate.isReadOnly(base, index);
@@ -134,19 +178,6 @@
delegate.setValue(base, index, value);
}
- public void setValue(Object base, Object property, Object value) throws
EvaluationException, PropertyNotFoundException
- {
- if (base instanceof PropertyAccessor)
- {
- PropertyAccessor accessor = (PropertyAccessor)base;
- accessor.setValue(property, value);
- }
- else
- {
- delegate.setValue(base, property, value);
- }
- }
-
/**
* Resolve the type def from the provided object. First the class name is used to
lookup a type def. If none is found
* then the implemented interfaces are examined to see if one can provide a type def.
@@ -155,17 +186,17 @@
* @return the type def if found, null otherwise
* @todo implement merging of type def if more than one is found
*/
- private TypeDef resolveTypeDef(Object base)
+ private BeanDecorator resolveTypeDef(Object base)
{
Class clazz = base.getClass();
- TypeDef typeDef = (TypeDef)resolverMap.get(clazz.getName());
+ BeanDecorator typeDef = (BeanDecorator)decoratorMap.get(clazz.getName());
if (typeDef == null)
{
Class[] itfs = clazz.getInterfaces();
for (int i = 0; i < itfs.length; i++)
{
Class itf = clazz.getInterfaces()[i];
- typeDef = (TypeDef)resolverMap.get(itf.getName());
+ typeDef = (BeanDecorator)decoratorMap.get(itf.getName());
if (typeDef != null)
{
break;
Deleted: trunk/faces/src/main/org/jboss/portal/faces/el/PropertyAccessor.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/PropertyAccessor.java 2007-02-26
14:46:22 UTC (rev 6401)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/PropertyAccessor.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -1,48 +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.faces.el;
-
-/**
- * Defines an object to access the state and metadata of a property.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class PropertyAccessor
-{
-
- public Class getType(Object propertyName)
- {
- return null;
- }
-
- public Object getValue(Object propertyName)
- {
- throw new UnsupportedOperationException();
- }
-
- public void setValue(Object propertyName, Object value)
- {
- throw new UnsupportedOperationException();
- }
-}
Deleted: trunk/faces/src/main/org/jboss/portal/faces/el/PropertyDef.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/PropertyDef.java 2007-02-26 14:46:22
UTC (rev 6401)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/PropertyDef.java 2007-02-26 15:27:15
UTC (rev 6402)
@@ -1,49 +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.faces.el;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public abstract class PropertyDef
-{
-
- /** . */
- private final Class type;
-
- protected PropertyDef(Class type)
- {
- this.type = type;
- }
-
- public Object getValue(Object base) throws UnsupportedOperationException
- {
- throw new UnsupportedOperationException();
- }
-
- public Class getType()
- {
- return type;
- }
-}
Added: trunk/faces/src/main/org/jboss/portal/faces/el/PropertyValue.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/PropertyValue.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/PropertyValue.java 2007-02-26 15:27:15
UTC (rev 6402)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * 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.faces.el;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class PropertyValue
+{
+
+ /** . */
+ private final Object object;
+
+ public PropertyValue(Object object)
+ {
+ this.object = object;
+ }
+
+ public Object getObject()
+ {
+ return object;
+ }
+}
Deleted: trunk/faces/src/main/org/jboss/portal/faces/el/TypeDef.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/TypeDef.java 2007-02-26 14:46:22 UTC
(rev 6401)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/TypeDef.java 2007-02-26 15:27:15 UTC
(rev 6402)
@@ -1,78 +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.faces.el;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision$
- */
-public class TypeDef
-{
-
- /** . */
- private final String type;
-
- /** . */
- private Map accessors;
-
- public TypeDef(Class clazz)
- {
- if (clazz == null)
- {
- throw new IllegalArgumentException();
- }
- this.type = clazz.getName();
- this.accessors = new HashMap();
- }
-
- public String getType()
- {
- return type;
- }
-
- public synchronized void addAccessor(String propertyName, PropertyDef accessor)
- {
- Map copy = new HashMap(accessors);
- copy.put(propertyName, accessor);
- accessors = copy;
- }
-
- public PropertyDef getAccessor(Object base, Object propertyName)
- {
- PropertyDef def = (PropertyDef)accessors.get(propertyName);
- if (def == null)
- {
- def = resolveDef(base, propertyName);
- }
- return def;
- }
-
- protected PropertyDef resolveDef(Object base, Object propertyName)
- {
- return null;
- }
-
-}
Added:
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -0,0 +1,102 @@
+/******************************************************************************
+ * 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.faces.el.decorator;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractBeanDecorator implements BeanDecorator
+{
+
+ public Class getType(Object bean, Object propertyName) throws
IllegalArgumentException
+ {
+ if (bean == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PropertyDecorator property = getProperty(propertyName);
+ if (property != null)
+ {
+ return property.getType(bean);
+ }
+
+ //
+ return null;
+ }
+
+ public PropertyValue getValue(Object bean, Object propertyName) throws
IllegalArgumentException
+ {
+ if (bean == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PropertyDecorator property = getProperty(propertyName);
+ if (property != null)
+ {
+ return new PropertyValue(property.getValue(bean));
+ }
+
+ //
+ return null;
+ }
+
+ public boolean setValue(Object bean, Object propertyName, Object value) throws
IllegalArgumentException
+ {
+ if (bean == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ PropertyDecorator property = getProperty(propertyName);
+ if (property != null)
+ {
+ property.setValue(bean, propertyName);
+ return true;
+ }
+
+ //
+ return false;
+ }
+
+ protected abstract PropertyDecorator getProperty(Object propertyName);
+}
Added:
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractPropertyDecorator.java
===================================================================
---
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractPropertyDecorator.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractPropertyDecorator.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * 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.faces.el.decorator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class AbstractPropertyDecorator implements PropertyDecorator
+{
+
+ /** . */
+ private Class type;
+
+ public AbstractPropertyDecorator(Class type)
+ {
+ if (type == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ this.type = type;
+ }
+
+ public Class getType(Object bean) throws IllegalArgumentException
+ {
+ return type;
+ }
+
+ public boolean setValue(Object bean, Object value) throws IllegalArgumentException
+ {
+ return false;
+ }
+}
Added: trunk/faces/src/main/org/jboss/portal/faces/el/decorator/BeanDecorator.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/decorator/BeanDecorator.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/decorator/BeanDecorator.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.faces.el.decorator;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface BeanDecorator
+{
+ /**
+ * Return the type of the specified property.
+ *
+ * @param bean the decorated bean
+ * @param propertyName the property name
+ * @return the type of the specified property or null
+ * @throws IllegalArgumentException if the bean is null or the property name is null
+ */
+ Class getType(Object bean, Object propertyName) throws IllegalArgumentException;
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @param bean the decorated bean
+ * @param propertyName the property name
+ * @return the property value
+ * @throws IllegalArgumentException if the bean is null or the property is null
+ */
+ PropertyValue getValue(Object bean, Object propertyName) throws
IllegalArgumentException;
+
+ /**
+ * Set the value of the specified property.
+ *
+ * @param bean the decorated bean
+ * @param propertyName the property name
+ * @param value the new property value
+ * @return true if the property was succesfully set
+ * @throws IllegalArgumentException if the bean is null or the property name is null
+ */
+ boolean setValue(Object bean, Object propertyName, Object value) throws
IllegalArgumentException;
+}
Added: trunk/faces/src/main/org/jboss/portal/faces/el/decorator/PropertyDecorator.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/decorator/PropertyDecorator.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/PropertyDecorator.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -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.faces.el.decorator;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface PropertyDecorator
+{
+ /**
+ * Return the type of the specified property.
+ *
+ * @param bean the decorated bean
+ * @return the type of the specified property or null
+ * @throws IllegalArgumentException if the bean is null
+ */
+ Class getType(Object bean) throws IllegalArgumentException;
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @param bean the decorated bean
+ * @return the property value
+ * @throws IllegalArgumentException if the bean is null
+ */
+ Object getValue(Object bean) throws IllegalArgumentException;
+
+ /**
+ * Set the value of the specified property.
+ *
+ * @param bean the decorated bean
+ * @param value the new property value
+ * @return true if the property was succesfully set
+ * @throws IllegalArgumentException if the bean is null
+ */
+ boolean setValue(Object bean, Object value) throws IllegalArgumentException;
+}
Added: trunk/faces/src/main/org/jboss/portal/faces/el/decorator/SimpleBeanDecorator.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/decorator/SimpleBeanDecorator.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/SimpleBeanDecorator.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.faces.el.decorator;
+
+import EDU.oswego.cs.dl.util.concurrent.ConcurrentReaderHashMap;
+
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleBeanDecorator extends AbstractBeanDecorator
+{
+
+ private Map properties;
+
+ public SimpleBeanDecorator()
+ {
+ properties = new ConcurrentReaderHashMap();
+ }
+
+ protected PropertyDecorator getProperty(Object propertyName)
+ {
+ return (PropertyDecorator)properties.get(propertyName);
+ }
+
+ public void setProperty(Object propertyName, PropertyDecorator decorator)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ if (decorator == null)
+ {
+ properties.remove(propertyName);
+ }
+ else
+ {
+ properties.put(propertyName, decorator);
+ }
+ }
+}
Added: trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java
(rev 0)
+++
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * 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.faces.el.dynamic;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * Base implementation.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 6370 $
+ */
+public class AbstractDynamicBean implements DynamicBean
+{
+
+ /**
+ * @return always null
+ */
+ public Class getType(Object propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return null;
+ }
+
+ /**
+ * @return always null
+ */
+ public PropertyValue getValue(Object propertyName)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return null;
+ }
+
+ /**
+ * @return always false
+ */
+ public boolean setValue(Object propertyName, Object value)
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ return false;
+ }
+}
Property changes on:
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/AbstractDynamicBean.java
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/DynamicBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/DynamicBean.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/DynamicBean.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -0,0 +1,63 @@
+/******************************************************************************
+ * 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.faces.el.dynamic;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * Defines an interface that an object can implement when that object wants to manage
itself
+ * the resolution of its properties.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DynamicBean
+{
+ /**
+ * Return the type of the specified property.
+ *
+ * @param propertyName the property name
+ * @return the type of the specified property or null
+ * @throws IllegalArgumentException if the property name is null
+ */
+ Class getType(Object propertyName) throws IllegalArgumentException;
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @param propertyName the property name
+ * @return the property value
+ * @throws IllegalArgumentException if the property is null
+ */
+ PropertyValue getValue(Object propertyName) throws IllegalArgumentException;
+
+ /**
+ * Set the value of the specified property.
+ *
+ * @param propertyName the property name
+ * @param value the new property value
+ * @return true if the property was succesfully set
+ * @throws IllegalArgumentException if the property name is null
+ */
+ boolean setValue(Object propertyName, Object value) throws IllegalArgumentException;
+}
Added: trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/DynamicProperty.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/DynamicProperty.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/DynamicProperty.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * 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.faces.el.dynamic;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface DynamicProperty
+{
+ /**
+ * Return the type of the specified property.
+ *
+ * @return the type of the specified property or null
+ * @throws IllegalArgumentException if the property name is null
+ */
+ Class getType() throws IllegalArgumentException;
+
+ /**
+ * Return the value of the specified property.
+ *
+ * @return the property value
+ * @throws IllegalArgumentException if the property is null
+ */
+ Object getValue() throws IllegalArgumentException;
+
+ /**
+ * Set the value of the specified property.
+ *
+ * @param value the new property value
+ * @throws IllegalArgumentException if the property name is null
+ */
+ boolean setValue(Object value) throws IllegalArgumentException;
+}
Added: trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java
(rev 0)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java 2007-02-26
15:27:15 UTC (rev 6402)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * 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.faces.el.dynamic;
+
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public abstract class SimpleBean implements DynamicBean
+{
+
+ public SimpleBean()
+ {
+ }
+
+ public Class getType(Object propertyName) throws IllegalArgumentException
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ DynamicProperty property = getProperty(propertyName);
+ if (property != null)
+ {
+ return property.getType();
+ }
+ return null;
+ }
+
+ public PropertyValue getValue(Object propertyName) throws IllegalArgumentException
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ DynamicProperty property = getProperty(propertyName);
+ if (property != null)
+ {
+ return new PropertyValue(property.getValue());
+ }
+ return null;
+ }
+
+ public boolean setValue(Object propertyName, Object value) throws
IllegalArgumentException
+ {
+ if (propertyName == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ DynamicProperty property = getProperty(propertyName);
+ if (property != null)
+ {
+ return property.setValue(value);
+ }
+ return false;
+ }
+
+ /**
+ * Return a dynamic property or null if not found.
+ *
+ * @param propertyName the property name
+ * @return a dynamic property
+ */
+ protected abstract DynamicProperty getProperty(Object propertyName);
+
+}