JBoss Portal SVN: r6405 - trunk/faces/src/main/org/jboss/portal/faces/el/dynamic.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-26 11:13:20 -0500 (Mon, 26 Feb 2007)
New Revision: 6405
Added:
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleDynamicBean.java
Removed:
trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java
Log:
renamed SimpleBean to SimpleDynamicBean
Deleted: trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java 2007-02-26 16:12:24 UTC (rev 6404)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java 2007-02-26 16:13:20 UTC (rev 6405)
@@ -1,88 +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.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);
-
-}
Copied: trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleDynamicBean.java (from rev 6402, trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleBean.java)
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleDynamicBean.java (rev 0)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/dynamic/SimpleDynamicBean.java 2007-02-26 16:13:20 UTC (rev 6405)
@@ -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 SimpleDynamicBean implements DynamicBean
+{
+
+ public SimpleDynamicBean()
+ {
+ }
+
+ 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);
+
+}
19 years, 2 months
JBoss Portal SVN: r6404 - in trunk/faces: src/main/org/jboss/portal/test/faces/el and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-26 11:12:24 -0500 (Mon, 26 Feb 2007)
New Revision: 6404
Added:
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
Modified:
trunk/faces/build.xml
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
Log:
- adding AbstractDynamicBean test case
- make AbstractBeanDecoratorTestCase state follow junit lifecycle
Modified: trunk/faces/build.xml
===================================================================
--- trunk/faces/build.xml 2007-02-26 16:01:10 UTC (rev 6403)
+++ trunk/faces/build.xml 2007-02-26 16:12:24 UTC (rev 6404)
@@ -225,6 +225,7 @@
</x-sysproperty>
<x-test>
<test todir="${test.reports}" name="org.jboss.portal.test.faces.el.AbstractBeanDecoratorTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.faces.el.AbstractDynamicBeanTestCase"/>
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Modified: trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-02-26 16:01:10 UTC (rev 6403)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-02-26 16:12:24 UTC (rev 6404)
@@ -35,10 +35,26 @@
public class AbstractBeanDecoratorTestCase extends TestCase
{
- private final Object _bean = new Object();
- private final Object _propertyName = new Object();
- private Object _propertyValue = new Value();
+ private Object _bean;
+ private Object _propertyName;
+ private Object _propertyValue;
+
+ protected void setUp() throws Exception
+ {
+ _bean = new Object();
+ _propertyName = new Object();
+ _propertyValue = new Value();
+ }
+
+
+ protected void tearDown() throws Exception
+ {
+ _bean = null;
+ _propertyName = null;
+ _propertyValue = null;
+ }
+
private static class Value
{
}
Added: trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java (rev 0)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractDynamicBeanTestCase.java 2007-02-26 16:12:24 UTC (rev 6404)
@@ -0,0 +1,87 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.test.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.dynamic.AbstractDynamicBean;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractDynamicBeanTestCase extends TestCase
+{
+
+ /** . */
+ private final AbstractDynamicBean bean = new AbstractDynamicBean();
+
+ /** . */
+ private final Object propertyName = new Object();
+
+ public void testGetType()
+ {
+ try
+ {
+ bean.getType(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(null, bean.getType(propertyName));
+ }
+
+ public void testGetValue()
+ {
+ try
+ {
+ bean.getValue(null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(null, bean.getValue(propertyName));
+ }
+
+ public void testSetValue()
+ {
+ try
+ {
+ bean.setValue(null, new Object());
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertFalse(bean.setValue(propertyName, new Object()));
+ assertFalse(bean.setValue(propertyName, null));
+ }
+
+}
19 years, 2 months
JBoss Portal SVN: r6403 - in trunk: faces/src/main/org/jboss/portal and 6 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-26 11:01:10 -0500 (Mon, 26 Feb 2007)
New Revision: 6403
Added:
trunk/faces/src/main/org/jboss/portal/test/
trunk/faces/src/main/org/jboss/portal/test/faces/
trunk/faces/src/main/org/jboss/portal/test/faces/el/
trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
Modified:
trunk/faces/build.xml
trunk/faces/src/main/org/jboss/portal/faces/el/PropertyValue.java
trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java
trunk/format/build.xml
Log:
adding AbstractBeanDecorator test case + fix bug
Modified: trunk/faces/build.xml
===================================================================
--- trunk/faces/build.xml 2007-02-26 15:27:15 UTC (rev 6402)
+++ trunk/faces/build.xml 2007-02-26 16:01:10 UTC (rev 6403)
@@ -94,6 +94,7 @@
<path refid="el.el.classpath"/>
<path refid="apache.log4j.classpath"/>
<path refid="oswego.concurrent.classpath"/>
+ <path refid="junit.junit.classpath"/>
</path>
<!-- Configure modules -->
@@ -164,6 +165,10 @@
</jar>
</target>
+ <!-- generates artifacts used for tests, requires output to be previously run -->
+ <target name="package-tests" depends="init">
+ </target>
+
<!-- ================================================================== -->
<!-- Cleaning -->
<!-- ================================================================== -->
@@ -210,4 +215,23 @@
<delete file="${jboss.home}/server/${portal.deploy.dir}/portal-faces.war"/>
</target>
+ <target name="tests" depends="compile">
+ <execute-tests>
+ <x-sysproperty>
+<!--
+ <jvmarg value="-Xdebug"/>
+ <jvmarg value="-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y"/>
+-->
+ </x-sysproperty>
+ <x-test>
+ <test todir="${test.reports}" name="org.jboss.portal.test.faces.el.AbstractBeanDecoratorTestCase"/>
+ </x-test>
+ <x-classpath>
+ <pathelement location="${build.classes}"/>
+ <pathelement location="${build.resources}/portal-format-lib-jar"/>
+ <path refid="library.classpath"/>
+ <path refid="dependentmodule.classpath"/>
+ </x-classpath>
+ </execute-tests>
+ </target>
</project>
Modified: trunk/faces/src/main/org/jboss/portal/faces/el/PropertyValue.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/PropertyValue.java 2007-02-26 15:27:15 UTC (rev 6402)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/PropertyValue.java 2007-02-26 16:01:10 UTC (rev 6403)
@@ -41,4 +41,23 @@
{
return object;
}
+
+ public int hashCode()
+ {
+ return object == null ? 0 : object.hashCode();
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof PropertyValue)
+ {
+ PropertyValue that = (PropertyValue)obj;
+ return object == null ? that.object == null : object.equals(that.object);
+ }
+ return false;
+ }
}
Modified: trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java 2007-02-26 15:27:15 UTC (rev 6402)
+++ trunk/faces/src/main/org/jboss/portal/faces/el/decorator/AbstractBeanDecorator.java 2007-02-26 16:01:10 UTC (rev 6403)
@@ -75,7 +75,7 @@
return null;
}
- public boolean setValue(Object bean, Object propertyName, Object value) throws IllegalArgumentException
+ public boolean setValue(Object bean, Object propertyName, Object propertyValue) throws IllegalArgumentException
{
if (bean == null)
{
@@ -90,7 +90,7 @@
PropertyDecorator property = getProperty(propertyName);
if (property != null)
{
- property.setValue(bean, propertyName);
+ property.setValue(bean, propertyValue);
return true;
}
Added: trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java
===================================================================
--- trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java (rev 0)
+++ trunk/faces/src/main/org/jboss/portal/test/faces/el/AbstractBeanDecoratorTestCase.java 2007-02-26 16:01:10 UTC (rev 6403)
@@ -0,0 +1,147 @@
+/******************************************************************************
+ * 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.faces.el;
+
+import junit.framework.TestCase;
+import org.jboss.portal.faces.el.decorator.AbstractBeanDecorator;
+import org.jboss.portal.faces.el.decorator.PropertyDecorator;
+import org.jboss.portal.faces.el.decorator.AbstractPropertyDecorator;
+import org.jboss.portal.faces.el.PropertyValue;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class AbstractBeanDecoratorTestCase extends TestCase
+{
+
+ private final Object _bean = new Object();
+ private final Object _propertyName = new Object();
+ private Object _propertyValue = new Value();
+
+ private static class Value
+ {
+ }
+
+ private final AbstractBeanDecorator decorator = new AbstractBeanDecorator()
+ {
+ protected PropertyDecorator getProperty(Object propertyName)
+ {
+ return propertyName == _propertyName ? new AbstractPropertyDecorator(Value.class)
+ {
+ public Object getValue(Object bean) throws IllegalArgumentException
+ {
+ return bean == _bean ? _propertyValue : null;
+ }
+ public boolean setValue(Object bean, Object value) throws IllegalArgumentException
+ {
+ if (bean == _bean )
+ {
+ _propertyValue = value;
+ return true;
+ }
+ return false;
+ }
+ } : null;
+ }
+ };
+
+ public void testGetType()
+ {
+ try
+ {
+ decorator.getType(null, _propertyName);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ decorator.getType(_bean, null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(Value.class, decorator.getType(_bean, _propertyName));
+ }
+
+ public void testGetValue()
+ {
+ try
+ {
+ decorator.getValue(_bean, null);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ decorator.getValue(null, _propertyName);
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ assertEquals(null, decorator.getValue(_bean, new Object()));
+ assertEquals(new PropertyValue(_propertyValue), decorator.getValue(_bean, _propertyName));
+ }
+
+ public void testSetValue()
+ {
+ try
+ {
+ decorator.setValue(null, _propertyName, new Object());
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ try
+ {
+ decorator.setValue(_bean, null, new Object());
+ fail("Was expecting an IAE");
+ }
+ catch (IllegalArgumentException expected)
+ {
+ }
+
+ //
+ Value expectedValue = new Value();
+ assertEquals(true, decorator.setValue(_bean, _propertyName, expectedValue));
+ assertEquals(expectedValue, _propertyValue);
+
+ //
+ assertEquals(true, decorator.setValue(_bean, _propertyName, null));
+ assertEquals(null, _propertyValue);
+ }
+}
Modified: trunk/format/build.xml
===================================================================
--- trunk/format/build.xml 2007-02-26 15:27:15 UTC (rev 6402)
+++ trunk/format/build.xml 2007-02-26 16:01:10 UTC (rev 6403)
@@ -189,8 +189,7 @@
</target>
- <!-- generates artifacts used for tests, requires output to be previously run
- -->
+ <!-- generates artifacts used for tests, requires output to be previously run -->
<target name="package-tests" depends="init">
</target>
19 years, 2 months
JBoss Portal SVN: r6402 - in trunk: core-admin/src/main/org/jboss/portal/core/portlet/management/content and 4 other directories.
by portal-commits@lists.jboss.org
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);
+
+}
19 years, 2 months
JBoss Portal SVN: r6401 - in trunk/wsrp/src/main/org/jboss/portal/test/wsrp: framework/support and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-26 09:46:22 -0500 (Mon, 26 Feb 2007)
New Revision: 6401
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/ProducerSessionInformationTestCase.java
Log:
Fixed testcases by adding support for ProducerInfo in MockWSRPConsumer and for persistConsumer in MockConsumerRegistry.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-02-26 03:58:07 UTC (rev 6400)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-02-26 14:46:22 UTC (rev 6401)
@@ -23,6 +23,7 @@
package org.jboss.portal.test.wsrp.deployment;
+import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.test.wsrp.framework.support.MockWSRPConsumer;
import org.jboss.portal.wsrp.WSRPConsumer;
@@ -44,8 +45,8 @@
public MockConsumerRegistry()
{
- consumers.put("inDB", new MockWSRPConsumer());
- consumers.put("inDB2", new MockWSRPConsumer());
+ consumers.put("inDB", new MockWSRPConsumer("inDB"));
+ consumers.put("inDB2", new MockWSRPConsumer("inDB2"));
}
public Collection getConfiguredConsumers()
@@ -70,7 +71,8 @@
public void persistConsumer(WSRPConsumer consumer)
{
- throw new UnsupportedOperationException("persistConsumer is not supported on MockConsumerRegistry");
+ ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "WSRPConsumer");
+ consumers.put(consumer.getProducerId(), consumer);
}
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java 2007-02-26 03:58:07 UTC (rev 6400)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/MockWSRPConsumer.java 2007-02-26 14:46:22 UTC (rev 6401)
@@ -46,9 +46,17 @@
*/
public class MockWSRPConsumer implements WSRPConsumer
{
+ private ProducerInfo producerInfo;
+
+ public MockWSRPConsumer(String id)
+ {
+ producerInfo = new ProducerInfo();
+ producerInfo.setId(id);
+ }
+
public String getProducerId()
{
- return null;
+ return producerInfo.getId();
}
public void setServiceFactory(ServiceFactory serviceFactory)
@@ -72,7 +80,7 @@
public ProducerInfo getProducerInfo()
{
- return null;
+ return producerInfo;
}
public void setProducerInfo(ProducerInfo producerInfo)
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/ProducerSessionInformationTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/ProducerSessionInformationTestCase.java 2007-02-26 03:58:07 UTC (rev 6400)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/other/ProducerSessionInformationTestCase.java 2007-02-26 14:46:22 UTC (rev 6401)
@@ -43,7 +43,7 @@
protected void setUp() throws Exception
{
info = new ProducerSessionInformation();
- info.setAssociatedConsumer(new MockWSRPConsumer());
+ info.setAssociatedConsumer(new MockWSRPConsumer("id"));
}
public void testUserCookie() throws Exception
19 years, 2 months
JBoss Portal SVN: r6400 - in trunk/wsrp/src: main/org/jboss/portal/wsrp/deployment and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-25 22:58:07 -0500 (Sun, 25 Feb 2007)
New Revision: 6400
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
Log:
- Added cascade properties in Hibernate mapping where relevant (my Hibernate-fu is rusty...)
- Added more information display in WSRPDeploymentFactory.
- Still needs work... in particular with respect to where consumers should be started.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-02-25 08:26:14 UTC (rev 6399)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-02-26 03:58:07 UTC (rev 6400)
@@ -29,7 +29,6 @@
import org.jboss.portal.jems.as.system.AbstractJBossService;
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.wsrp.WSRPConsumer;
-import org.jboss.portal.wsrp.deployment.WSRPConsumerService;
import javax.naming.InitialContext;
import java.util.Collection;
@@ -85,8 +84,6 @@
Session session = sessionFactory.getCurrentSession();
ProducerInfo info = consumer.getProducerInfo();
- session.persist(info.getEndpointConfigurationInfo());
- session.persist(info.getRegistrationInfo());
session.persist(info);
createAndActivateConsumerIfNeeded(info);
@@ -128,7 +125,7 @@
WSRPConsumer consumer = new WSRPConsumerImpl();
consumer.setProducerInfo(producerInfo);
consumers.put(producerInfo.getId(), consumer);
- if (producerInfo.isActive())
+ /*if (producerInfo.isActive())
{
WSRPConsumerService service = new WSRPConsumerService();
service.setConsumer(consumer);
@@ -141,7 +138,7 @@
{
throw new ConsumerException("Couldn't start Consumer service '" + producerInfo.getId() + "'", e);
}
- }
+ }*/
return consumer;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-02-25 08:26:14 UTC (rev 6399)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-02-26 03:58:07 UTC (rev 6400)
@@ -110,16 +110,33 @@
String id = attrs.getValue("id");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "producer identifier", "Configuring a producer");
+ WSRPConsumerService service = new WSRPConsumerService();
+
// check that the consumer doesn't exist in the database first
WSRPConsumer consumer = consumerRegistry.getConsumer(id);
if (consumer != null)
{
+ service.setConsumer(consumer);
+ String message = "Added consumer for producer '" + service.getId() + "' with status: ";
+
+ // if consumer is active, add it to the list of services
+ if (consumer.getProducerInfo().isActive())
+ {
+ deployment.getServices().add(service);
+ message += "active";
+ }
+ else
+ {
+ message += "inactive";
+ }
+
+ log.info(message + " (loaded from database).");
+
// consumer already exists, do not further process this producer and use the DB configuration instead
return null;
}
// consumer didn't exist in the database, so create one and configure it
- WSRPConsumerService service = new WSRPConsumerService();
consumer = new WSRPConsumerImpl();
ProducerInfo info = consumer.getProducerInfo();
info.setId(id);
@@ -134,7 +151,7 @@
}
catch (NumberFormatException e)
{
- System.out.println("Ignoring bad expiration cache value " + expirationCache);
+ log.info("Ignoring bad expiration cache value " + expirationCache + " for producer '" + id + "'");
}
}
@@ -305,13 +322,12 @@
System.out.println("addchild deployment service " + localName);
}
- // persist consumer to the database now that it's complete
- consumerRegistry.persistConsumer(service.getConsumer());
String message;
if (service.getConsumer().getServiceFactory().isAvailable())
{
- message = "Added consumer for producer '" + service.getId() + "'";
+ message = "Added consumer for producer '" + service.getId() + "' from xml configuration.";
+ service.getConsumer().getProducerInfo().setActive(true);
deployment.getServices().add(service);
}
else
@@ -320,6 +336,9 @@
+ service.getId() + "'. The consumer will NOT be available.";
}
+ // persist consumer to the database now that it's complete
+ consumerRegistry.persistConsumer(service.getConsumer());
+
log.info(message);
}
}
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-02-25 08:26:14 UTC (rev 6399)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-02-26 03:58:07 UTC (rev 6400)
@@ -26,14 +26,9 @@
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
- <class
- name="org.jboss.portal.wsrp.consumer.ProducerInfo"
- table="JBP_PRODUCER_INFO">
+ <class name="org.jboss.portal.wsrp.consumer.ProducerInfo" table="JBP_PRODUCER_INFO">
<cache usage="@portal.hibernate.cache.usage@"/>
- <id
- name="key"
- column="PK"
- access="field">
+ <id name="key" column="PK" access="field">
<generator class="native">
<param name="sequence">wsrpconsumer_seq</param>
</generator>
@@ -43,211 +38,105 @@
column="ENDPOINT_ID"
class="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
unique="true"
- not-null="true"/>
- <many-to-one
- name="registrationInfo"
- column="REGISTRATION_ID"
- class="org.jboss.portal.wsrp.consumer.RegistrationInfo"
- unique="true"
- not-null="false"/>
- <property
- name="expirationCacheSeconds"
- column="EXPIRATION_CACHE_SECONDS"
- not-null="false"
- unique="false"/>
- <property
- name="active"
- column="ACTIVE"
not-null="true"
- unique="false"/>
+ cascade="all"/>
+ <many-to-one name="registrationInfo"
+ column="REGISTRATION_ID"
+ class="org.jboss.portal.wsrp.consumer.RegistrationInfo"
+ unique="true"
+ not-null="false"
+ cascade="all"/>
+ <property name="expirationCacheSeconds" column="EXPIRATION_CACHE_SECONDS"/>
+ <property name="active" not-null="true"/>
<property name="id" not-null="true" unique="true"/>
</class>
- <class
- name="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo"
- table="JBP_ENDPOINT_INFO">
+ <class name="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo" table="JBP_ENDPOINT_INFO">
<cache usage="@portal.hibernate.cache.usage@"/>
- <id
- name="key"
- column="PK"
- type="java.lang.Long">
+ <id name="key" column="PK" type="java.lang.Long">
<generator class="native">
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <property
- name="serviceDescriptionURL"
- column="SD_URL"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="markupURL"
- column="M_URL"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="portletManagementURL"
- column="PM_URL"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="registrationURL"
- column="R_URL"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="wsdlDefinitionURL"
- column="WSDL_URL"
- type="java.lang.String"
- not-null="false"/>
+ <property name="serviceDescriptionURL" column="SD_URL" type="java.lang.String" not-null="true"/>
+ <property name="markupURL" column="M_URL" type="java.lang.String" not-null="true"/>
+ <property name="portletManagementURL" column="PM_URL" type="java.lang.String" not-null="true"/>
+ <property name="registrationURL" column="R_URL" type="java.lang.String" not-null="true"/>
+ <property name="wsdlDefinitionURL" column="WSDL_URL" type="java.lang.String" not-null="false"/>
</class>
- <class
- name="org.jboss.portal.wsrp.consumer.RegistrationInfo"
- table="JBP_REGISTRATION_INFO">
+ <class name="org.jboss.portal.wsrp.consumer.RegistrationInfo" table="JBP_REGISTRATION_INFO">
<cache usage="@portal.hibernate.cache.usage@"/>
- <id
- name="key"
- column="PK"
- type="java.lang.Long">
+ <id name="key" column="PK" type="java.lang.Long">
<generator class="native">
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <property
- name="consumerName"
- column="CONSUMER_NAME"
- type="java.lang.String"
- not-null="true"
- unique="true"/>
- <property
- name="registrationHandle"
- column="HANDLE"
- type="java.lang.String"/>
- <property
- name="registrationState"
- column="STATE"
- type="binary"/>
- <map
- name="registrationProperties">
+ <property name="consumerName" column="CONSUMER_NAME" type="java.lang.String" not-null="true"/>
+ <property name="registrationHandle" column="HANDLE" type="java.lang.String"/>
+ <property name="registrationState" column="STATE" type="binary"/>
+ <map name="registrationProperties" cascade="all">
<cache usage="@portal.hibernate.cache.usage@"/>
<key column="REG_PROP_PK"/>
- <map-key
- type="string"
- column="NAME"/>
+ <map-key type="string" column="NAME"/>
<one-to-many class="org.jboss.portal.wsrp.consumer.RegistrationProperty"/>
</map>
</class>
- <class
- name="org.jboss.portal.wsrp.consumer.RegistrationProperty"
- table="JBP_REG_PROPERTY">
+
+ <class name="org.jboss.portal.wsrp.consumer.RegistrationProperty" table="JBP_REG_PROPERTY">
<cache usage="@portal.hibernate.cache.usage@"/>
- <id
- name="key"
- column="PK"
- type="java.lang.Long">
+ <id name="key" column="PK" type="java.lang.Long">
<generator class="native">
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <property
- name="name"
- column="NAME"
- type="java.lang.String"
- not-null="true"/>
- <property
- name="value"
- column="VALUE"
- type="java.lang.String"/>
- <property
- name="invalid"
- column="INVALID"
- type="boolean"/>
- <property
- name="lang"
- column="LANG"
- type="java.lang.String"/>
+ <property name="name" type="java.lang.String" not-null="true"/>
+ <property name="value" type="java.lang.String" not-null="true"/>
+ <property name="invalid" type="boolean"/>
+ <property name="lang" type="java.lang.String"/>
<many-to-one
name="description"
column="DESC_PK"
class="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription"
- not-null="true"
- unique="true"/>
+ unique="true"
+ cascade="all"/>
</class>
- <class
- name="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription"
- table="JBP_REG_PROP_DESC">
+ <class name="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription" table="JBP_REG_PROP_DESC">
<cache usage="@portal.hibernate.cache.usage@"/>
- <id
- name="key"
- column="PK"
- type="java.lang.Long">
+ <id name="key" column="PK" type="java.lang.Long">
<generator class="native">
<param name="sequence">portlet_seq</param>
</generator>
</id>
- <property
- name="name"
- column="NAME"
- type="org.jboss.portal.jems.hibernate.QNameUserType"
- not-null="true"/>
- <property
- name="type"
- column="TYPE"
- type="org.jboss.portal.jems.hibernate.QNameUserType"
- not-null="true"/>
- <property
- name="schemaLocation"
- column="SCHEMA"
- type="java.lang.String"/>
- <component
- name="description"
- class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <property name="name" type="org.jboss.portal.jems.hibernate.QNameUserType" not-null="true"/>
+ <property name="type" type="org.jboss.portal.jems.hibernate.QNameUserType" not-null="true"/>
+ <property name="schemaLocation" column="SCHEMA" type="java.lang.String"/>
+ <component name="description" class="org.jboss.portal.wsrp.registration.LocalizedString">
<property name="value" column="DESC_VALUE"/>
<property name="locale" column="DESC_LOCALE"/>
<property name="resourceName" column="DESC_RES"/>
</component>
- <component
- name="hint"
- class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <component name="hint" class="org.jboss.portal.wsrp.registration.LocalizedString">
<property name="value" column="HINT_VALUE"/>
<property name="locale" column="HINT_LOCALE"/>
<property name="resourceName" column="HINT_RES"/>
</component>
- <component
- name="label"
- class="org.jboss.portal.wsrp.registration.LocalizedString">
+ <component name="label" class="org.jboss.portal.wsrp.registration.LocalizedString">
<property name="value" column="LABEL_VALUE"/>
<property name="locale" column="LABEL_LOCALE"/>
<property name="resourceName" column="LABEL_RES"/>
</component>
- <array
- name="usages"
- table="JBP_REG_PROP_DESC_USAGES"
- cascade="all"
- fetch="join">
+ <array name="usages" table="JBP_REG_PROP_DESC_USAGES" cascade="all" fetch="join">
<cache usage="@portal.hibernate.cache.usage@"/>
<key column="PK"/>
<index column="IDX"/>
- <element
- column="USAGE"
- type="java.lang.String"
- not-null="true"
- unique="false"/>
+ <element column="USAGE" type="java.lang.String" not-null="true" unique="false"/>
</array>
- <array
- name="aliases"
- table="JBP_REG_PROP_DESC_ALIASES"
- cascade="all"
- fetch="join">
+ <array name="aliases" table="JBP_REG_PROP_DESC_ALIASES" cascade="all" fetch="join">
<cache usage="@portal.hibernate.cache.usage@"/>
<key column="PK"/>
<index column="IDX"/>
- <element
- column="ALIAS"
- type="org.jboss.portal.jems.hibernate.QNameUserType"
- not-null="true"
- unique="false"/>
+ <element column="ALIAS" type="org.jboss.portal.jems.hibernate.QNameUserType" not-null="true" unique="false"/>
</array>
</class>
</hibernate-mapping>
19 years, 2 months
JBoss Portal SVN: r6399 - in trunk/wsrp/src: main/org/jboss/portal/wsrp/consumer and 4 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-25 03:26:14 -0500 (Sun, 25 Feb 2007)
New Revision: 6399
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerException.java
Removed:
trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java
Modified:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
Log:
- Added createConsumer and persistConsumer methods on ConsumerRegistry.
- Added id property in ProducerInfo that was somehow forgotten in Hibernate mapping.
- Made RegistrationInfo no-arg constructor public for Hibernate.
- Added ConsumerException.
- Added call to persistConsumer at the end of each unmarshalling of a consumer in WSRPDeploymentFactory.
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-02-25 08:26:14 UTC (rev 6399)
@@ -63,4 +63,14 @@
return null;
}
+ public WSRPConsumer createConsumer(String id)
+ {
+ throw new UnsupportedOperationException("createConsumer is not supported on MockConsumerRegistry");
+ }
+
+ public void persistConsumer(WSRPConsumer consumer)
+ {
+ throw new UnsupportedOperationException("persistConsumer is not supported on MockConsumerRegistry");
+ }
+
}
Added: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerException.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerException.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerException.java 2007-02-25 08:26:14 UTC (rev 6399)
@@ -0,0 +1,51 @@
+/*
+* 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.wsrp.consumer;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ConsumerException extends RuntimeException
+{
+ public ConsumerException()
+ {
+ super();
+ }
+
+ public ConsumerException(String message)
+ {
+ super(message);
+ }
+
+ public ConsumerException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public ConsumerException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerException.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-02-25 08:26:14 UTC (rev 6399)
@@ -39,4 +39,8 @@
WSRPConsumer getConsumer(String id);
FederatingPortletInvoker getFederatingPortletInvoker();
+
+ WSRPConsumer createConsumer(String id);
+
+ void persistConsumer(WSRPConsumer consumer);
}
\ No newline at end of file
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-02-25 08:26:14 UTC (rev 6399)
@@ -59,6 +59,39 @@
return federatingPortletInvoker;
}
+ public WSRPConsumer createConsumer(String id)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "Consumer identifier", "createConsumer");
+
+ if (getConsumer(id) != null)
+ {
+ throw new ConsumerException("A Consumer with id '" + id + "' already exists!");
+ }
+
+ Session session = sessionFactory.getCurrentSession();
+
+ ProducerInfo info = new ProducerInfo();
+ info.setId(id);
+
+ session.persist(info);
+
+ return createAndActivateConsumerIfNeeded(info);
+ }
+
+ public void persistConsumer(WSRPConsumer consumer)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(consumer, "Consumer");
+
+ Session session = sessionFactory.getCurrentSession();
+ ProducerInfo info = consumer.getProducerInfo();
+
+ session.persist(info.getEndpointConfigurationInfo());
+ session.persist(info.getRegistrationInfo());
+ session.persist(info);
+
+ createAndActivateConsumerIfNeeded(info);
+ }
+
public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
{
this.federatingPortletInvoker = federatingPortletInvoker;
@@ -83,21 +116,34 @@
Session session = sessionFactory.getCurrentSession();
Iterator producerInfos = session.createQuery("from ProducerInfo pi order by pi.id").iterate();
ProducerInfo producerInfo;
- WSRPConsumer consumer;
while (producerInfos.hasNext())
{
producerInfo = (ProducerInfo)producerInfos.next();
- consumer = new WSRPConsumerImpl();
- consumer.setProducerInfo(producerInfo);
- consumers.put(producerInfo.getId(), consumer);
- if (producerInfo.isActive())
+ createAndActivateConsumerIfNeeded(producerInfo);
+ }
+ }
+
+ private WSRPConsumer createAndActivateConsumerIfNeeded(ProducerInfo producerInfo)
+ {
+ WSRPConsumer consumer = new WSRPConsumerImpl();
+ consumer.setProducerInfo(producerInfo);
+ consumers.put(producerInfo.getId(), consumer);
+ if (producerInfo.isActive())
+ {
+ WSRPConsumerService service = new WSRPConsumerService();
+ service.setConsumer(consumer);
+ service.setFederatingPortletInvoker(federatingPortletInvoker);
+ try
{
- WSRPConsumerService service = new WSRPConsumerService();
- service.setConsumer(consumer);
- service.setFederatingPortletInvoker(federatingPortletInvoker);
service.start();
}
+ catch (Exception e)
+ {
+ throw new ConsumerException("Couldn't start Consumer service '" + producerInfo.getId() + "'", e);
+ }
}
+
+ return consumer;
}
protected void stopService() throws Exception
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-02-25 08:26:14 UTC (rev 6399)
@@ -73,7 +73,7 @@
requiresRegistration = true;
}
- private RegistrationInfo()
+ public RegistrationInfo()
{
consumerName = WSRPConstants.DEFAULT_CONSUMER_NAME;
isRegistrationValid = true;
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-02-25 08:26:14 UTC (rev 6399)
@@ -305,6 +305,9 @@
System.out.println("addchild deployment service " + localName);
}
+ // persist consumer to the database now that it's complete
+ consumerRegistry.persistConsumer(service.getConsumer());
+
String message;
if (service.getConsumer().getServiceFactory().isAvailable())
{
Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java 2007-02-25 08:26:14 UTC (rev 6399)
@@ -1,42 +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.wsrp.portlet.consumers;
-
-import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.wsrp.WSRPConsumer;
-
-import java.util.Collection;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public interface ConsumersRegistry
-{
- Collection getConfiguredConsumers();
-
- WSRPConsumer getConsumer(String id);
-
- FederatingPortletInvoker getFederatingPortletInvoker();
-}
\ No newline at end of file
Deleted: trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java 2007-02-25 08:26:14 UTC (rev 6399)
@@ -1,159 +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.wsrp.portlet.consumers;
-
-import org.hibernate.Session;
-import org.hibernate.SessionFactory;
-import org.jboss.portal.common.util.ParameterValidation;
-import org.jboss.portal.jems.as.system.AbstractJBossService;
-import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
-import org.jboss.portal.wsrp.WSRPConsumer;
-import org.jboss.portal.wsrp.consumer.ProducerInfo;
-import org.jboss.portal.wsrp.consumer.WSRPConsumerImpl;
-import org.jboss.portal.wsrp.deployment.WSRPConsumerService;
-
-import javax.naming.InitialContext;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-/**
- * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
- * @version $Revision$
- * @since 2.6
- */
-public class ConsumersRegistryService extends AbstractJBossService implements ConsumersRegistry
-{
- /** Gives access to the Portal's portlet invokers */
- private FederatingPortletInvoker federatingPortletInvoker;
-
- private SortedMap consumers;
-
- private SessionFactory sessionFactory;
-
- private String sessionFactoryJNDIName;
-
- public FederatingPortletInvoker getFederatingPortletInvoker()
- {
- return federatingPortletInvoker;
- }
-
- public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
- {
- this.federatingPortletInvoker = federatingPortletInvoker;
- }
-
- public String getSessionFactoryJNDIName()
- {
- return sessionFactoryJNDIName;
- }
-
- public void setSessionFactoryJNDIName(String sessionFactoryJNDIName)
- {
- this.sessionFactoryJNDIName = sessionFactoryJNDIName;
- }
-
- protected void startService() throws Exception
- {
- sessionFactory = (SessionFactory)new InitialContext().lookup(sessionFactoryJNDIName);
-
- // load the configured consumers
- consumers = new TreeMap();
- Session session = sessionFactory.getCurrentSession();
- Iterator producerInfos = session.createQuery("from ProducerInfo pi order by pi.id").iterate();
- ProducerInfo producerInfo;
- WSRPConsumer consumer;
- while (producerInfos.hasNext())
- {
- producerInfo = (ProducerInfo)producerInfos.next();
- consumer = new WSRPConsumerImpl();
- consumer.setProducerInfo(producerInfo);
- consumers.put(producerInfo.getId(), consumer);
- if (producerInfo.isActive())
- {
- WSRPConsumerService service = new WSRPConsumerService();
- service.setConsumer(consumer);
- service.setFederatingPortletInvoker(federatingPortletInvoker);
- service.start();
- }
- }
- }
-
- protected void stopService() throws Exception
- {
- sessionFactory = null;
- consumers.clear();
- consumers = null;
- }
-
- public Collection getConfiguredConsumers()
- {
- return Collections.unmodifiableCollection(consumers.values());
- }
-
- public WSRPConsumer getConsumer(String id)
- {
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "consumer id", null);
- return (WSRPConsumer)consumers.get(id);
-
- /*// first check if this consumer has already been loaded
- WSRPConsumer wsrpConsumer = (WSRPConsumer)consumers.get(id);
-
- if(wsrpConsumer != null)
- {
- return wsrpConsumer;
- }
- else
- {
- Session session = sessionFactory.getCurrentSession();
- Query query = session.createQuery("from ProducerInfo where id=:id");
- query.setString("id", id);
- ProducerInfo pi = (ProducerInfo)query.uniqueResult();
- if (pi != null)
- {
- wsrpConsumer = new WSRPConsumerImpl();
- wsrpConsumer.setProducerInfo(pi);
- consumers.put(pi.getId(), wsrpConsumer);
- if (pi.isActive())
- {
- WSRPConsumerService service = new WSRPConsumerService();
- service.setConsumer(wsrpConsumer);
- service.setFederatingPortletInvoker(federatingPortletInvoker);
- try
- {
- service.start();
- }
- catch (Exception e)
- {
- throw new RuntimeException("Couldn't start Consumer '" + pi.getId() + "'", e);
- }
- }
- return wsrpConsumer;
- }
- return null;
- }*/
- }
-}
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-02-25 08:26:14 UTC (rev 6399)
@@ -60,6 +60,7 @@
column="ACTIVE"
not-null="true"
unique="false"/>
+ <property name="id" not-null="true" unique="true"/>
</class>
<class
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-02-25 06:33:33 UTC (rev 6398)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-02-25 08:26:14 UTC (rev 6399)
@@ -26,6 +26,9 @@
<method name="startService">
<trans-attribute>Required</trans-attribute>
</method>
+ <method name="persistConsumer">
+ <trans-attribute>Required</trans-attribute>
+ </method>
</metadata>
<!-- TRANSACTIONS -->
19 years, 2 months
JBoss Portal SVN: r6398 - trunk/wsrp.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-25 01:33:33 -0500 (Sun, 25 Feb 2007)
New Revision: 6398
Modified:
trunk/wsrp/build.xml
Log:
Renamed classpath for aopc to aopc.classpath.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-02-25 06:32:01 UTC (rev 6397)
+++ trunk/wsrp/build.xml 2007-02-25 06:33:33 UTC (rev 6398)
@@ -242,14 +242,14 @@
<mkdir dir="${build.lib.test}"/>
<mkdir dir="${build.resources.test}"/>
- <path id="bilto">
+ <path id="aopc.classpath">
<path refid="jbossas/core.libs.classpath"/>
<path refid="dependentmodule.classpath"/>
<pathelement path="${build.classes}"/>
</path>
<aopc compilerclasspathref="aop.classpath" verbose="true">
- <classpath refid="bilto"/>
+ <classpath refid="aopc.classpath"/>
<src path="${build.classes}"/>
<aoppath path="${build.resources}/portal-wsrp-sar/wsrp-aop.xml"/>
<include name="org/jboss/portal/wsrp/consumer/ConsumerRegistryService.class"/>
19 years, 2 months
JBoss Portal SVN: r6397 - in trunk/wsrp: src/main/org/jboss/portal/test/wsrp/deployment and 7 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-02-25 01:32:01 -0500 (Sun, 25 Feb 2007)
New Revision: 6397
Added:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/WSRPConsumerConfigurationPortlet.java
trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jboss-portlet.xml
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp
trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/view.jsp
Log:
- JBPORTAL-1264: Moved ConsumersRegistry* to wsrp.consumer and renamed the classes to ConsumerRegistry*.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/build.xml 2007-02-25 06:32:01 UTC (rev 6397)
@@ -252,7 +252,7 @@
<classpath refid="bilto"/>
<src path="${build.classes}"/>
<aoppath path="${build.resources}/portal-wsrp-sar/wsrp-aop.xml"/>
- <include name="org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.class"/>
+ <include name="org/jboss/portal/wsrp/consumer/ConsumerRegistryService.class"/>
</aopc>
<property name="compile.disable" value="true"/>
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/deployment/MockConsumerRegistry.java 2007-02-25 06:32:01 UTC (rev 6397)
@@ -26,7 +26,7 @@
import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
import org.jboss.portal.test.wsrp.framework.support.MockWSRPConsumer;
import org.jboss.portal.wsrp.WSRPConsumer;
-import org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistry;
+import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import java.util.Collection;
import java.util.HashMap;
@@ -37,7 +37,7 @@
* @version $Revision$
* @since 2.6
*/
-public class MockConsumerRegistry implements ConsumersRegistry
+public class MockConsumerRegistry implements ConsumerRegistry
{
private Map consumers = new HashMap(3);
Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java (from rev 6396, trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistry.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java 2007-02-25 06:32:01 UTC (rev 6397)
@@ -0,0 +1,42 @@
+/*
+* 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.wsrp.consumer;
+
+import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
+import org.jboss.portal.wsrp.WSRPConsumer;
+
+import java.util.Collection;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public interface ConsumerRegistry
+{
+ Collection getConfiguredConsumers();
+
+ WSRPConsumer getConsumer(String id);
+
+ FederatingPortletInvoker getFederatingPortletInvoker();
+}
\ No newline at end of file
Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistry.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java (from rev 6396, trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/ConsumersRegistryService.java)
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java 2007-02-25 06:32:01 UTC (rev 6397)
@@ -0,0 +1,157 @@
+/******************************************************************************
+ * 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.wsrp.consumer;
+
+import org.hibernate.Session;
+import org.hibernate.SessionFactory;
+import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
+import org.jboss.portal.wsrp.WSRPConsumer;
+import org.jboss.portal.wsrp.deployment.WSRPConsumerService;
+
+import javax.naming.InitialContext;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class ConsumerRegistryService extends AbstractJBossService implements ConsumerRegistry
+{
+ /** Gives access to the Portal's portlet invokers */
+ private FederatingPortletInvoker federatingPortletInvoker;
+
+ private SortedMap consumers;
+
+ private SessionFactory sessionFactory;
+
+ private String sessionFactoryJNDIName;
+
+ public FederatingPortletInvoker getFederatingPortletInvoker()
+ {
+ return federatingPortletInvoker;
+ }
+
+ public void setFederatingPortletInvoker(FederatingPortletInvoker federatingPortletInvoker)
+ {
+ this.federatingPortletInvoker = federatingPortletInvoker;
+ }
+
+ public String getSessionFactoryJNDIName()
+ {
+ return sessionFactoryJNDIName;
+ }
+
+ public void setSessionFactoryJNDIName(String sessionFactoryJNDIName)
+ {
+ this.sessionFactoryJNDIName = sessionFactoryJNDIName;
+ }
+
+ protected void startService() throws Exception
+ {
+ sessionFactory = (SessionFactory)new InitialContext().lookup(sessionFactoryJNDIName);
+
+ // load the configured consumers
+ consumers = new TreeMap();
+ Session session = sessionFactory.getCurrentSession();
+ Iterator producerInfos = session.createQuery("from ProducerInfo pi order by pi.id").iterate();
+ ProducerInfo producerInfo;
+ WSRPConsumer consumer;
+ while (producerInfos.hasNext())
+ {
+ producerInfo = (ProducerInfo)producerInfos.next();
+ consumer = new WSRPConsumerImpl();
+ consumer.setProducerInfo(producerInfo);
+ consumers.put(producerInfo.getId(), consumer);
+ if (producerInfo.isActive())
+ {
+ WSRPConsumerService service = new WSRPConsumerService();
+ service.setConsumer(consumer);
+ service.setFederatingPortletInvoker(federatingPortletInvoker);
+ service.start();
+ }
+ }
+ }
+
+ protected void stopService() throws Exception
+ {
+ sessionFactory = null;
+ consumers.clear();
+ consumers = null;
+ }
+
+ public Collection getConfiguredConsumers()
+ {
+ return Collections.unmodifiableCollection(consumers.values());
+ }
+
+ public WSRPConsumer getConsumer(String id)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(id, "consumer id", null);
+ return (WSRPConsumer)consumers.get(id);
+
+ /*// first check if this consumer has already been loaded
+ WSRPConsumer wsrpConsumer = (WSRPConsumer)consumers.get(id);
+
+ if(wsrpConsumer != null)
+ {
+ return wsrpConsumer;
+ }
+ else
+ {
+ Session session = sessionFactory.getCurrentSession();
+ Query query = session.createQuery("from ProducerInfo where id=:id");
+ query.setString("id", id);
+ ProducerInfo pi = (ProducerInfo)query.uniqueResult();
+ if (pi != null)
+ {
+ wsrpConsumer = new WSRPConsumerImpl();
+ wsrpConsumer.setProducerInfo(pi);
+ consumers.put(pi.getId(), wsrpConsumer);
+ if (pi.isActive())
+ {
+ WSRPConsumerService service = new WSRPConsumerService();
+ service.setConsumer(wsrpConsumer);
+ service.setFederatingPortletInvoker(federatingPortletInvoker);
+ try
+ {
+ service.start();
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Couldn't start Consumer '" + pi.getId() + "'", e);
+ }
+ }
+ return wsrpConsumer;
+ }
+ return null;
+ }*/
+ }
+}
Property changes on: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ConsumerRegistryService.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployer.java 2007-02-25 06:32:01 UTC (rev 6397)
@@ -27,7 +27,7 @@
import org.jboss.deployment.SubDeployerSupport;
import org.jboss.portal.common.util.URLTools;
import org.jboss.portal.common.xml.NullEntityResolver;
-import org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistry;
+import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
@@ -50,7 +50,7 @@
setEnhancedSuffixes(DEFAULT_ENHANCED_SUFFIXES);
}
- private ConsumersRegistry consumerRegistry;
+ private ConsumerRegistry consumerRegistry;
/** . */
private URL deployedDefaultWSRPURL;
@@ -70,12 +70,12 @@
this.entityResolver = entityResolver;
}
- public ConsumersRegistry getConsumerRegistry()
+ public ConsumerRegistry getConsumerRegistry()
{
return consumerRegistry;
}
- public void setConsumerRegistry(ConsumersRegistry consumerRegistry)
+ public void setConsumerRegistry(ConsumerRegistry consumerRegistry)
{
this.consumerRegistry = consumerRegistry;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeployerMBean.java 2007-02-25 06:32:01 UTC (rev 6397)
@@ -23,7 +23,7 @@
package org.jboss.portal.wsrp.deployment;
import org.jboss.deployment.SubDeployerExtMBean;
-import org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistry;
+import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.xml.sax.EntityResolver;
/**
@@ -36,9 +36,9 @@
void setDefaultWSRPLocation(String defaultWSRPLocation);
- ConsumersRegistry getConsumerRegistry();
+ ConsumerRegistry getConsumerRegistry();
- void setConsumerRegistry(ConsumersRegistry consumerRegistry);
+ void setConsumerRegistry(ConsumerRegistry consumerRegistry);
EntityResolver getEntityResolver();
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/deployment/WSRPDeploymentFactory.java 2007-02-25 06:32:01 UTC (rev 6397)
@@ -25,11 +25,11 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.wsrp.WSRPConsumer;
+import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo;
import org.jboss.portal.wsrp.consumer.ProducerInfo;
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import org.jboss.portal.wsrp.consumer.WSRPConsumerImpl;
-import org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistry;
import org.jboss.portal.wsrp.services.AbstractJNDIServiceFactory;
import org.jboss.portal.wsrp.services.PerEndpointSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
@@ -50,7 +50,7 @@
{
private final Logger log = Logger.getLogger(getClass());
- private ConsumersRegistry consumerRegistry;
+ private ConsumerRegistry consumerRegistry;
private static final boolean DEBUG = false;
@@ -87,7 +87,7 @@
}
- public WSRPDeploymentFactory(ConsumersRegistry consumerRegistry)
+ public WSRPDeploymentFactory(ConsumerRegistry consumerRegistry)
{
this.consumerRegistry = consumerRegistry;
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/WSRPConsumerConfigurationPortlet.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/WSRPConsumerConfigurationPortlet.java 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/portlet/consumers/WSRPConsumerConfigurationPortlet.java 2007-02-25 06:32:01 UTC (rev 6397)
@@ -23,6 +23,8 @@
package org.jboss.portal.wsrp.portlet.consumers;
+import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
+
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.GenericPortlet;
@@ -42,7 +44,7 @@
*/
public class WSRPConsumerConfigurationPortlet extends GenericPortlet
{
- private ConsumersRegistry registry;
+ private ConsumerRegistry registry;
private static final String NOT_SUPPORTED = "notSupported";
private static final String JSP_PATH = "/WEB-INF/jsp/consumers/";
@@ -58,7 +60,7 @@
public void init() throws PortletException
{
super.init();
- registry = (ConsumersRegistry)getPortletContext().getAttribute(CONSUMERS_REGISTRY);
+ registry = (ConsumerRegistry)getPortletContext().getAttribute(CONSUMERS_REGISTRY);
if (registry == null)
{
throw new PortletException("Couldn't initialize Consumers registry");
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/META-INF/jboss-service.xml 2007-02-25 06:32:01 UTC (rev 6397)
@@ -149,7 +149,7 @@
</mbean>
<!-- Consumers registry for WSRP consumers -->
- <mbean code="org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistryService"
+ <mbean code="org.jboss.portal.wsrp.consumer.ConsumerRegistryService"
name="portal.wsrp:service=ConsumersRegistry"
xmbean-dd="" xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
Modified: trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/wsrp-aop.xml 2007-02-25 06:32:01 UTC (rev 6397)
@@ -22,7 +22,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<aop>
- <metadata tag="transaction" class="org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistryService">
+ <metadata tag="transaction" class="org.jboss.portal.wsrp.consumer.ConsumerRegistryService">
<method name="startService">
<trans-attribute>Required</trans-attribute>
</method>
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jboss-portlet.xml
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jboss-portlet.xml 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jboss-portlet.xml 2007-02-25 06:32:01 UTC (rev 6397)
@@ -24,7 +24,7 @@
<portlet-app>
<service>
<service-name>ConsumersRegistry</service-name>
- <service-class>org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistry</service-class>
+ <service-class>org.jboss.portal.wsrp.consumer.ConsumerRegistry</service-class>
<service-ref>portal.wsrp:service=ConsumersRegistry</service-ref>
</service>
</portlet-app>
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/consumer.jsp 2007-02-25 06:32:01 UTC (rev 6397)
@@ -1,8 +1,8 @@
<%@ page import="org.jboss.portal.wsrp.WSRPConsumer" %>
+<%@ page import="org.jboss.portal.wsrp.consumer.ConsumerRegistry" %>
<%@ page import="org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo" %>
<%@ page import="org.jboss.portal.wsrp.consumer.ProducerInfo" %>
<%@ page import="org.jboss.portal.wsrp.consumer.RegistrationInfo" %>
-<%@ page import="org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistry" %>
<%@ page import="org.jboss.portal.wsrp.portlet.consumers.WSRPConsumerConfigurationPortlet" %>
<%@ page import="org.jboss.portal.wsrp.registration.RegistrationPropertyDescription" %>
<%@ page import="java.util.Iterator" %>
@@ -11,7 +11,7 @@
<portlet:defineObjects/>
<%
- ConsumersRegistry registry = (ConsumersRegistry)portletConfig.getPortletContext().getAttribute(WSRPConsumerConfigurationPortlet.CONSUMERS_REGISTRY);
+ ConsumerRegistry registry = (ConsumerRegistry)portletConfig.getPortletContext().getAttribute(WSRPConsumerConfigurationPortlet.CONSUMERS_REGISTRY);
String id = request.getParameter(WSRPConsumerConfigurationPortlet.ID);
if (id == null)
{
Modified: trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/view.jsp
===================================================================
--- trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/view.jsp 2007-02-25 01:50:29 UTC (rev 6396)
+++ trunk/wsrp/src/resources/portal-wsrp-war/WEB-INF/jsp/consumers/view.jsp 2007-02-25 06:32:01 UTC (rev 6397)
@@ -1,12 +1,12 @@
<%@ page import="org.jboss.portal.wsrp.WSRPConsumer" %>
-<%@ page import="org.jboss.portal.wsrp.portlet.consumers.ConsumersRegistry" %>
+<%@ page import="org.jboss.portal.wsrp.consumer.ConsumerRegistry" %>
<%@ page import="org.jboss.portal.wsrp.portlet.consumers.WSRPConsumerConfigurationPortlet" %>
<%@ page import="java.util.Iterator" %>
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<portlet:defineObjects/>
<%
- ConsumersRegistry registry = (ConsumersRegistry)portletConfig.getPortletContext().getAttribute(WSRPConsumerConfigurationPortlet.CONSUMERS_REGISTRY);
+ ConsumerRegistry registry = (ConsumerRegistry)portletConfig.getPortletContext().getAttribute(WSRPConsumerConfigurationPortlet.CONSUMERS_REGISTRY);
%>
<div class="portlet-section-body">
19 years, 2 months
JBoss Portal SVN: r6396 - in trunk: core-admin and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-02-24 20:50:29 -0500 (Sat, 24 Feb 2007)
New Revision: 6396
Modified:
trunk/core-admin/build.xml
trunk/core/build.xml
Log:
have to move tomavak from core-admin to core otherwise it breaks hot redeployment of the core-admin. I suspect that myfaces has somewhere an hard cache containing classes as the error I had was an IAE on method invoke of the TreeData class where the class of instance of TreeData and the class were not the same.
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-02-25 01:11:40 UTC (rev 6395)
+++ trunk/core/build.xml 2007-02-25 01:50:29 UTC (rev 6396)
@@ -344,6 +344,7 @@
<fileset dir="${apache.lang.lib}" includes="commons-lang-2.0.jar"/>
<fileset dir="${facelets.facelets.lib}" includes="jsf-facelets.jar"/>
<fileset dir="${el.el.lib}" includes="el-api.jar,el-ri.jar"/>
+ <fileset dir="${apache.tomahawk.lib}" includes="tomahawk.jar"/>
</copy>
</target>
Modified: trunk/core-admin/build.xml
===================================================================
--- trunk/core-admin/build.xml 2007-02-25 01:11:40 UTC (rev 6395)
+++ trunk/core-admin/build.xml 2007-02-25 01:50:29 UTC (rev 6396)
@@ -196,7 +196,6 @@
</copy>
<copy todir="${build.resources}/portal-admin.sar/lib">
<fileset dir="${build.lib}" includes="portal-core-admin-lib.jar"/>
- <fileset dir="${apache.tomahawk.lib}" includes="tomahawk.jar"/>
</copy>
<copy todir="${build.resources}/portal-admin.sar/portal-admin.war">
<fileset dir="${build.resources}/portal-admin-war"/>
19 years, 2 months