JBoss Portal SVN: r7458 - in trunk/wsrp: src/main/org/jboss/portal/test/wsrp/consumer and 4 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-18 20:44:22 -0400 (Mon, 18 Jun 2007)
New Revision: 7458
Added:
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationPropertyTestCase.java
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/EndpointConfigurationInfoTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml
Log:
- Modified RegistrationProperty handling of values to be able to better detect the validity status of the property and related test case.
- Modified Hibernate mapping for RegistrationProperty (invalid property is now a java.lang.Boolean instead of boolean).
- Started testing registration behavior on ProducerInfo.
- Added more test cases in particular to check that some methods properly result in the expected state.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/build.xml 2007-06-19 00:44:22 UTC (rev 7458)
@@ -781,6 +781,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.EndpointConfigurationInfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.ProducerInfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.RegistrationInfoTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.RegistrationPropertyTestCase"/>
<zest todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.ConsumerRegistryTestCase"
outfile="TEST-ConsumerRegistryTestCase">
<parameter name="Config" value="persistent-jboss-beans.xml"/>
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/EndpointConfigurationInfoTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/EndpointConfigurationInfoTestCase.java 2007-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/EndpointConfigurationInfoTestCase.java 2007-06-19 00:44:22 UTC (rev 7458)
@@ -23,10 +23,12 @@
package org.jboss.portal.test.wsrp.consumer;
import junit.framework.TestCase;
+import org.jboss.portal.portlet.InvokerUnavailableException;
import org.jboss.portal.test.wsrp.framework.support.BehaviorBackedServiceFactory;
import org.jboss.portal.wsrp.consumer.EndpointConfigurationInfo;
import org.jboss.portal.wsrp.services.PerEndpointSOAPInvokerServiceFactory;
import org.jboss.portal.wsrp.services.RemoteSOAPInvokerServiceFactory;
+import org.jboss.portal.wsrp.services.ServiceFactory;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -43,7 +45,7 @@
info = new EndpointConfigurationInfo();
}
- public void testSetURLs()
+ public void testSetURLs() throws InvokerUnavailableException
{
info.setServiceDescriptionURL(url);
assertEquals(url, info.getServiceDescriptionURL());
@@ -63,7 +65,7 @@
assertTrue(info.getServiceFactory().isAvailable());
}
- public void testSetWSDLURL()
+ public void testSetWSDLURL() throws InvokerUnavailableException
{
info.setServiceDescriptionURL(url);
info.setMarkupURL(url);
@@ -124,4 +126,18 @@
info.getServiceDescriptionService();
assertFalse(info.isRefreshNeeded());
}
+
+ public void testGetServiceFactory() throws Exception
+ {
+ assertTrue(info.isRefreshNeeded());
+ assertFalse(info.isAvailable());
+
+ // change the service factory to a fake one to be able to simulate access to endpoint
+ info.setServiceFactory(new BehaviorBackedServiceFactory());
+ ServiceFactory factory = info.getServiceFactory();
+ assertNotNull(factory);
+ assertFalse(info.isRefreshNeeded());
+ assertTrue(info.isAvailable());
+ assertTrue(factory.isAvailable());
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-06-19 00:44:22 UTC (rev 7458)
@@ -26,14 +26,17 @@
import junit.framework.TestCase;
import org.jboss.portal.portlet.Portlet;
import org.jboss.portal.portlet.PortletContext;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.test.wsrp.framework.PortletManagementBehavior;
import org.jboss.portal.test.wsrp.framework.RegistrationBehavior;
import org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior;
import org.jboss.portal.test.wsrp.framework.support.BehaviorBackedServiceFactory;
import org.jboss.portal.test.wsrp.framework.support.MockConsumerRegistry;
+import org.jboss.portal.wsrp.WSRPExceptionFactory;
import org.jboss.portal.wsrp.WSRPTypeFactory;
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.core.AccessDeniedFault;
import org.jboss.portal.wsrp.core.GetPortletDescription;
import org.jboss.portal.wsrp.core.InconsistentParametersFault;
@@ -43,7 +46,9 @@
import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+import org.jboss.portal.wsrp.core.Property;
import org.jboss.portal.wsrp.core.RegistrationContext;
+import org.jboss.portal.wsrp.core.RegistrationData;
import java.rmi.RemoteException;
@@ -166,6 +171,36 @@
assertEquals("Service description should have been called once unregistered and once registered", 2, sd.getCallCount());
}
+ public void testRegister() throws Exception
+ {
+ ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior();
+ sd.setServiceDescription(true, 1);
+
+ serviceFactory.getRegistry().setServiceDescriptionBehavior(sd);
+ RegistrationBehavior regBehavior = new TestRegistrationBehavior();
+ serviceFactory.getRegistry().setRegistrationBehavior(regBehavior);
+
+ try
+ {
+ info.register();
+ fail("Shouldn't register with invalid information");
+ }
+ catch (PortletInvokerException expected)
+ {
+ }
+
+ RegistrationInfo regInfo = info.getRegistrationInfo();
+ regInfo.setRegistrationPropertyValue("prop0", "value");
+
+ info.register();
+ RegistrationContext registrationContext = info.getRegistrationContext();
+ assertNotNull(registrationContext);
+ assertEquals(RegistrationBehavior.REGISTRATION_HANDLE, registrationContext.getRegistrationHandle());
+ assertTrue(info.isRegistered());
+ assertTrue(info.isRegistrationChecked());
+ assertTrue(info.isRegistrationRequired());
+ }
+
private static class TestPortletManagementBehavior extends PortletManagementBehavior
{
public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription)
@@ -176,4 +211,27 @@
return WSRPTypeFactory.createPortletDescriptionResponse(createPortletDescription("test2", null));
}
}
+
+ private static class TestRegistrationBehavior extends RegistrationBehavior
+ {
+ public RegistrationContext register(RegistrationData register) throws MissingParametersFault, OperationFailedFault, RemoteException
+ {
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(register, "RegistrationData");
+
+ Property[] props = register.getRegistrationProperties();
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(props, "Registration properties");
+
+ Property prop = props[0];
+ WSRPExceptionFactory.throwOperationFailedFaultIfValueIsMissing(prop, "Registration property");
+
+ String value = prop.getStringValue();
+ if ("value".equals(value) && "prop0".equals(prop.getName()))
+ {
+ return super.register(register);
+ }
+
+ throw WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.OPERATION_FAILED,
+ value + " is not a valid value for 'prop0'", null);
+ }
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2007-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2007-06-19 00:44:22 UTC (rev 7458)
@@ -24,12 +24,11 @@
package org.jboss.portal.test.wsrp.consumer;
import junit.framework.TestCase;
-import org.jboss.portal.wsrp.WSRPConstants;
+import org.jboss.portal.test.wsrp.framework.ServiceDescriptionBehavior;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.consumer.RefreshResult;
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import org.jboss.portal.wsrp.consumer.RegistrationProperty;
-import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.RegistrationContext;
import org.jboss.portal.wsrp.core.ServiceDescription;
@@ -88,7 +87,7 @@
}
}
- public void testSetGetRegistrationProperty()
+ public void testSimpleSetGetRegistrationProperty()
{
String key = "foo";
info.setRegistrationPropertyValue(key, "bar");
@@ -104,6 +103,25 @@
assertEquals("bar", info.getRegistrationProperty(key).getValue());
}
+ public void testRegistrationPropertiesAndRefresh()
+ {
+ info.setRegistrationPropertyValue("prop0", "value0");
+ RefreshResult result = info.refresh(createServiceDescription(true, 1), producerId, true, false);
+ RegistrationProperty prop = info.getRegistrationProperty("prop0");
+ assertNull(prop.isInvalid());
+ assertFalse(result.hasIssues());
+
+ // specifiy that the prop is valid to simulate a successful registration (integration test, should have something
+ // testing that in ProducerInfoTestCase)
+ prop.setInvalid(Boolean.FALSE, null);
+
+ info.setRegistrationPropertyValue("prop0", "value1");
+ assertTrue(info.isRefreshNeeded());
+ assertNull("Property value has changed since last refresh, status should be unknown", prop.isInvalid());
+ assertEquals("Property value has changed since last refresh, status should be unknown",
+ RegistrationProperty.UNCHECKED_VALUE_STATUS, prop.getStatus());
+ }
+
public void testRefreshNoRegistration()
{
// no registration expected
@@ -164,7 +182,7 @@
RegistrationProperty prop = (RegistrationProperty)regProps.get("foo");
assertNotNull(prop);
assertEquals("bar", prop.getValue());
- assertTrue(prop.isInvalid());
+ assertTrue(prop.isInvalid().booleanValue());
assertEquals(RegistrationProperty.INEXISTENT_STATUS, prop.getStatus());
}
@@ -187,7 +205,7 @@
RegistrationProperty prop = (RegistrationProperty)regProps.get("prop0");
assertNotNull(prop);
- assertTrue(prop.isInvalid());
+ assertTrue(prop.isInvalid().booleanValue());
assertEquals(RegistrationProperty.MISSING_STATUS, prop.getStatus());
}
@@ -203,13 +221,13 @@
RegistrationProperty prop = info.getRegistrationProperty("prop0");
assertNotNull(prop);
assertNull(prop.getValue());
- assertTrue(prop.isInvalid());
+ assertTrue(prop.isInvalid().booleanValue());
assertEquals(RegistrationProperty.MISSING_VALUE_STATUS, prop.getStatus());
prop = info.getRegistrationProperty("prop1");
assertNotNull(prop);
assertNull(prop.getValue());
- assertTrue(prop.isInvalid());
+ assertTrue(prop.isInvalid().booleanValue());
assertEquals(RegistrationProperty.MISSING_VALUE_STATUS, prop.getStatus());
assertEquals(2, info.getRegistrationProperties().size());
assertEquals(2, result.getRegistrationProperties().size());
@@ -268,18 +286,6 @@
private ServiceDescription createServiceDescription(boolean requiresRegistration, int numberOfProperties)
{
- ServiceDescription sd = WSRPTypeFactory.createServiceDescription(requiresRegistration);
-
- if (requiresRegistration)
- {
- PropertyDescription[] descriptions = new PropertyDescription[numberOfProperties];
- for (int i = 0; i < numberOfProperties; i++)
- {
- descriptions[i] = WSRPTypeFactory.createPropertyDescription("prop" + i, WSRPConstants.XSD_STRING);
- }
- sd.setRegistrationPropertyDescription(WSRPTypeFactory.createModelDescription(descriptions));
- }
-
- return sd;
+ return ServiceDescriptionBehavior.createServiceDescription(requiresRegistration, numberOfProperties);
}
}
Added: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationPropertyTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationPropertyTestCase.java (rev 0)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationPropertyTestCase.java 2007-06-19 00:44:22 UTC (rev 7458)
@@ -0,0 +1,71 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, 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.wsrp.consumer;
+
+import junit.framework.TestCase;
+import org.jboss.portal.wsrp.consumer.RegistrationProperty;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6
+ */
+public class RegistrationPropertyTestCase extends TestCase
+{
+ private RegistrationProperty prop;
+
+ protected void setUp() throws Exception
+ {
+ prop = new RegistrationProperty("name", "value", "en");
+ }
+
+ public void testGetters()
+ {
+ assertEquals("name", prop.getName());
+ assertEquals("value", prop.getValue());
+ assertEquals("en", prop.getLang());
+ assertNull(prop.isInvalid());
+ assertFalse(prop.isDeterminedInvalid());
+ assertNull(prop.getDescription());
+ assertEquals(RegistrationProperty.UNCHECKED_VALUE_STATUS, prop.getStatus());
+ }
+
+ public void testSetValue()
+ {
+ prop.setInvalid(Boolean.FALSE, null);
+ assertEquals(Boolean.FALSE, prop.isInvalid());
+ assertNull(prop.getStatus());
+
+ // we haven't changed the value, so the status shouldn't have changed
+ prop.setValue("value");
+ assertEquals(Boolean.FALSE, prop.isInvalid());
+ assertNull(prop.getStatus());
+
+ // we changed the value, status is now unknown
+ prop.setValue("value2");
+ assertEquals("value2", prop.getValue());
+ assertNull(prop.isInvalid());
+ assertEquals(RegistrationProperty.UNCHECKED_VALUE_STATUS, prop.getStatus());
+ }
+}
Property changes on: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationPropertyTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java 2007-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/ServiceDescriptionBehavior.java 2007-06-19 00:44:22 UTC (rev 7458)
@@ -24,12 +24,14 @@
package org.jboss.portal.test.wsrp.framework;
import org.jboss.portal.common.util.Tools;
+import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.core.CookieProtocol;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletDescription;
+import org.jboss.portal.wsrp.core.PropertyDescription;
import org.jboss.portal.wsrp.core.ServiceDescription;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
@@ -71,6 +73,11 @@
serviceDescription.setRequiresInitCookie(requiresInitCookie);
}
+ public void setServiceDescription(boolean requiresRegistration, int numberOfProps)
+ {
+ serviceDescription = createServiceDescription(requiresRegistration, numberOfProps);
+ }
+
public static ServiceDescription getDefaultServiceDescription()
{
return DEFAULT_SERVICE_DESCRIPTION;
@@ -90,4 +97,21 @@
serviceDescription.setOfferedPortlets((PortletDescription[])portlets.toArray(new PortletDescription[0]));
}
}
+
+ public static ServiceDescription createServiceDescription(boolean requiresRegistration, int numberOfProperties)
+ {
+ ServiceDescription sd = WSRPTypeFactory.createServiceDescription(requiresRegistration);
+
+ if (requiresRegistration)
+ {
+ PropertyDescription[] descriptions = new PropertyDescription[numberOfProperties];
+ for (int i = 0; i < numberOfProperties; i++)
+ {
+ descriptions[i] = WSRPTypeFactory.createPropertyDescription("prop" + i, WSRPConstants.XSD_STRING);
+ }
+ sd.setRegistrationPropertyDescription(WSRPTypeFactory.createModelDescription(descriptions));
+ }
+
+ return sd;
+ }
}
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java 2007-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/framework/support/BehaviorBackedServiceFactory.java 2007-06-19 00:44:22 UTC (rev 7458)
@@ -63,6 +63,7 @@
private final static String M_URL = "m";
private final static String PM_URL = "pm";
private final static String R_URL = "r";
+ private boolean initialized = false;
public BehaviorBackedServiceFactory()
@@ -104,6 +105,11 @@
public boolean isAvailable()
{
+ if (!initialized)
+ {
+ initialized = true;
+ return false;
+ }
return true;
}
@@ -154,7 +160,7 @@
public void start() throws Exception
{
- throw new NotYetImplemented();
+ // do nothing
}
public void stop()
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-06-19 00:44:22 UTC (rev 7458)
@@ -208,7 +208,7 @@
{
RegistrationProperty prop = (RegistrationProperty)entries.next();
String value = prop.getValue();
- if (value != null && !prop.isInvalid())
+ if (value != null && !prop.isDeterminedInvalid())
{
properties.add(WSRPTypeFactory.createProperty(prop.getName(), prop.getLang(), prop.getValue()));
}
@@ -363,7 +363,7 @@
{
// take the opportunity to add the property description... ^_^
existing.setDescription(prop.getDescription());
- if (existing.isInvalid())
+ if (existing.isDeterminedInvalid())
{
result.setHasIssues(true);
}
@@ -469,13 +469,11 @@
{
// mark the prop as invalid
RegistrationProperty prop = (RegistrationProperty)properties.get(name);
- prop.setInvalid(true);
- prop.setStatus(RegistrationProperty.INEXISTENT_STATUS);
+ prop.setInvalid(Boolean.TRUE, RegistrationProperty.INEXISTENT_STATUS);
// do the same in the result
prop = (RegistrationProperty)result.getRegistrationProperties().get(name);
- prop.setInvalid(true);
- prop.setStatus(RegistrationProperty.INEXISTENT_STATUS);
+ prop.setInvalid(Boolean.TRUE, RegistrationProperty.INEXISTENT_STATUS);
}
else
{
@@ -504,8 +502,7 @@
RegistrationPropertyDescription desc = WSRPUtils.convertToRegistrationPropertyDescription(description);
RegistrationProperty prop = new RegistrationProperty(name, null, WSRPUtils.toString(desc.getLang()));
prop.setDescription(desc);
- prop.setStatus(RegistrationProperty.MISSING_VALUE_STATUS);
- prop.setInvalid(true);
+ prop.setInvalid(Boolean.TRUE, RegistrationProperty.MISSING_VALUE_STATUS);
result.put(name, prop);
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java 2007-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java 2007-06-19 00:44:22 UTC (rev 7458)
@@ -35,7 +35,7 @@
{
private Long persistentId;
private RegistrationPropertyDescription persistentDescription;
- private boolean persistentInvalid;
+ private Boolean persistentInvalid;
private String persistentLang;
private String persistentName;
private String persistentValue;
@@ -44,6 +44,8 @@
public static final String INEXISTENT_STATUS = "Inexistent on Producer";
public static final String MISSING_STATUS = "Missing";
public static final String MISSING_VALUE_STATUS = "Missing value";
+ public static final String UNCHECKED_VALUE_STATUS = "Undetermined status";
+ public static final String INVALID_VALUE_STATUS = "Invalid value";
public RegistrationProperty()
{
@@ -54,9 +56,8 @@
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "Name", "RegistrationProperty");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(lang, "Lang", "RegistrationProperty");
this.persistentName = name;
- this.persistentValue = stringValue;
this.persistentLang = lang;
- persistentInvalid = (stringValue == null || stringValue.length() == 0);
+ setValue(stringValue);
}
public boolean equals(Object o)
@@ -72,15 +73,15 @@
RegistrationProperty that = (RegistrationProperty)o;
- if (!persistentName.equals(that.persistentName))
+ if (persistentId != null ? !persistentId.equals(that.persistentId) : that.persistentId != null)
{
return false;
}
- if (!persistentLang.equals(that.persistentLang))
+ if (!persistentName.equals(that.persistentName))
{
return false;
}
- if (persistentInvalid != that.persistentInvalid)
+ if (!persistentValue.equals(that.persistentValue))
{
return false;
}
@@ -88,14 +89,18 @@
{
return false;
}
- if (persistentId != null ? !persistentId.equals(that.persistentId) : that.persistentId != null)
+ if (persistentInvalid != null ? !persistentInvalid.equals(that.persistentInvalid) : that.persistentInvalid != null)
{
return false;
}
- if (persistentValue != null ? !persistentValue.equals(that.persistentValue) : that.persistentValue != null)
+ if (!persistentLang.equals(that.persistentLang))
{
return false;
}
+ if (status != null ? !status.equals(that.status) : that.status != null)
+ {
+ return false;
+ }
return true;
}
@@ -105,10 +110,11 @@
int result;
result = (persistentId != null ? persistentId.hashCode() : 0);
result = 31 * result + persistentName.hashCode();
+ result = 31 * result + persistentValue.hashCode();
+ result = 31 * result + (persistentDescription != null ? persistentDescription.hashCode() : 0);
+ result = 31 * result + (persistentInvalid != null ? persistentInvalid.hashCode() : 0);
result = 31 * result + persistentLang.hashCode();
- result = 31 * result + (persistentDescription != null ? persistentDescription.hashCode() : 0);
- result = 31 * result + (persistentInvalid ? 1 : 0);
- result = 31 * result + (persistentValue != null ? persistentValue.hashCode() : 0);
+ result = 31 * result + (status != null ? status.hashCode() : 0);
return result;
}
@@ -148,21 +154,42 @@
this.persistentDescription = description;
}
- public boolean isInvalid()
+ public Boolean isInvalid()
{
return persistentInvalid;
}
- public void setInvalid(boolean invalid)
+ void setInvalid(Boolean invalid)
{
this.persistentInvalid = invalid;
}
+ public boolean isDeterminedInvalid()
+ {
+ return persistentInvalid != null && persistentInvalid.booleanValue();
+ }
+
+ public void setInvalid(Boolean invalid, String status)
+ {
+ this.persistentInvalid = invalid;
+ this.status = status;
+ }
+
public void setValue(String stringValue)
{
- persistentValue = stringValue;
- persistentInvalid = (persistentValue == null);
- status = (persistentValue == null ? MISSING_VALUE_STATUS : null);
+ if ((persistentValue != null && !persistentValue.equals(stringValue)) || (persistentValue == null && stringValue != null))
+ {
+ persistentValue = stringValue;
+ persistentInvalid = null;
+ if (persistentValue == null)
+ {
+ status = MISSING_VALUE_STATUS;
+ }
+ else
+ {
+ status = UNCHECKED_VALUE_STATUS;
+ }
+ }
}
public String getLang()
@@ -181,7 +208,7 @@
return status;
}
- public void setStatus(String status)
+ void setStatus(String status)
{
this.status = status;
}
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-06-18 21:48:52 UTC (rev 7457)
+++ trunk/wsrp/src/resources/portal-wsrp-sar/conf/consumer/hibernate/domain.hbm.xml 2007-06-19 00:44:22 UTC (rev 7458)
@@ -93,7 +93,7 @@
</id>
<property name="name" type="java.lang.String" not-null="true"/>
<property name="value" type="java.lang.String"/>
- <property name="invalid" type="boolean"/>
+ <property name="invalid" type="java.lang.Boolean"/>
<property name="lang" type="java.lang.String" not-null="true"/>
<many-to-one
name="description"
18 years, 10 months
JBoss Portal SVN: r7457 - in trunk: core-admin and 1 other directory.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-06-18 17:48:52 -0400 (Mon, 18 Jun 2007)
New Revision: 7457
Modified:
trunk/build/build-thirdparty.xml
trunk/core-admin/build.xml
Log:
integrating the jsf-facelets and jsf-portlet patched files
Modified: trunk/build/build-thirdparty.xml
===================================================================
--- trunk/build/build-thirdparty.xml 2007-06-18 09:38:44 UTC (rev 7456)
+++ trunk/build/build-thirdparty.xml 2007-06-18 21:48:52 UTC (rev 7457)
@@ -69,7 +69,7 @@
<componentref name="dom4j" version="1.6.1jboss"/>
<componentref name="ehcache" version="1.2.2"/>
<componentref name="el" version="1.0"/>
- <componentref name="facelets" version="1.1.1"/>
+ <componentref name="facelets" version="1.1.1-patched-jboss4.2"/>
<componentref name="hibernate" version="3.2.0.CR2"/>
<componentref name="httpunit" version="1.6"/>
<componentref name="hsqldb" version="1.8.0.2"/>
@@ -95,8 +95,7 @@
<componentref name="jsunit" version="2.1"/>
<componentref name="junit" version="3.8.1"/>
<componentref name="odmg" version="3.0"/>
- <componentref name="oswego-concurrent" version="1.3.4"/>
- <componentref name="portals-bridges" version="1.0"/>
+ <componentref name="oswego-concurrent" version="1.3.4"/>
<componentref name="qdox" version="1.4"/>
<componentref name="trove" version="1.0.2"/>
<componentref name="sleepycat" version="3.0.12"/>
@@ -110,6 +109,9 @@
<componentref name="jbpm/jaronly" version="3.1.2"/>
<componentref name="freemarker" version="2.3.9"/>
<componentref name="wutka-dtdparser" version="1.2.1"/>
+ <componentref name="portals-bridges" version="1.0"/>
+ <!-- patched jsf-portlet bridge -->
+ <componentref name="portals-bridges/jsf-portlet" version="1.1.4-patched"/>
</build>
<synchronizeinfo/>
Modified: trunk/core-admin/build.xml
===================================================================
--- trunk/core-admin/build.xml 2007-06-18 09:38:44 UTC (rev 7456)
+++ trunk/core-admin/build.xml 2007-06-18 21:48:52 UTC (rev 7457)
@@ -203,6 +203,7 @@
<fileset dir="../core-admin/src/etc/sun-jsf" includes="jsf-example.jar"/>
<fileset dir="${facelets.facelets.lib}" includes="jsf-facelets.jar"/>
<fileset dir="${el.el.lib}" includes="el-api.jar,el-ri.jar"/>
+ <fileset dir="${portals.bridges/jsf.portlet.lib}" includes="jsf-portlet.jar"/>
</copy>
<copy todir="${build.resources}/portal-admin.sar/portal-admin.war">
18 years, 10 months
JBoss Portal SVN: r7456 - trunk/core/src/main/org/jboss/portal/core/controller/ajax.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-18 05:38:44 -0400 (Mon, 18 Jun 2007)
New Revision: 7456
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
Log:
- fixed partial update bug that was not sending back the correct markup to the client
Modified: trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-06-17 23:33:00 UTC (rev 7455)
+++ trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-06-18 09:38:44 UTC (rev 7456)
@@ -253,14 +253,14 @@
//
if (!fullRefresh)
{
- ArrayList windowToRefresh = new ArrayList();
+ ArrayList refreshedWindows = new ArrayList();
for (Iterator i = page.getChildren(PortalObject.WINDOW_MASK).iterator();i.hasNext();)
{
PortalObject child = (PortalObject)i.next();
PortalObjectId childId = child.getId();
if (dirtyWindowIds.contains(childId))
{
- windowToRefresh.add(child);
+ refreshedWindows.add(child);
}
}
@@ -281,12 +281,12 @@
WindowContextFactory wcf = new WindowContextFactory(controllerContext);
//
- for (Iterator i = windowToRefresh.iterator();i.hasNext() && !fullRefresh;)
+ for (Iterator i = refreshedWindows.iterator();i.hasNext() && !fullRefresh;)
{
try
{
- PortalObject _window = (PortalObject)i.next();
- RenderWindowCommand rwc = new RenderWindowCommand(_window.getId());
+ Window refreshedWindow = (Window)i.next();
+ RenderWindowCommand rwc = new RenderWindowCommand(refreshedWindow.getId());
WindowRendition rendition = rwc.render(controllerContext);
//
@@ -297,7 +297,7 @@
//
if (resp instanceof MarkupResponse)
{
- WindowContext wc = wcf.createWindowContext(window, rendition);
+ WindowContext wc = wcf.createWindowContext(refreshedWindow, rendition);
// WindowContext wc = new WindowContext(
// _window.getId().toString(PortalObjectPath.LEGACY_BASE64_FORMAT),
18 years, 10 months
JBoss Portal SVN: r7455 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-17 19:33:00 -0400 (Sun, 17 Jun 2007)
New Revision: 7455
Modified:
docs/trunk/referenceGuide/en/modules/urls.xml
Log:
typppo
Modified: docs/trunk/referenceGuide/en/modules/urls.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/urls.xml 2007-06-17 23:25:32 UTC (rev 7454)
+++ docs/trunk/referenceGuide/en/modules/urls.xml 2007-06-17 23:33:00 UTC (rev 7455)
@@ -29,7 +29,7 @@
notions.</para>
</sect1>
<sect1>
- <title>Acessing a portal</title>
+ <title>Accessing a portal</title>
<para>Each portal container can contains multiple portals, also there is one special portal
which is the default portal, i.e the one used when no portal is specified in particular.
<itemizedlist> The following examples show you how the selection is done.
18 years, 10 months
JBoss Portal SVN: r7454 - docs/trunk/referenceGuide/en/modules.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-17 19:25:32 -0400 (Sun, 17 Jun 2007)
New Revision: 7454
Added:
docs/trunk/referenceGuide/en/modules/errorhandling.xml
Log:
forgot to add error handling docs
Added: docs/trunk/referenceGuide/en/modules/errorhandling.xml
===================================================================
--- docs/trunk/referenceGuide/en/modules/errorhandling.xml (rev 0)
+++ docs/trunk/referenceGuide/en/modules/errorhandling.xml 2007-06-17 23:25:32 UTC (rev 7454)
@@ -0,0 +1,303 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chapter id="errorhandling">
+ <chapterinfo>
+ <author>
+ <firstname>Julien</firstname>
+ <surname>Viet</surname>
+ <email>julien.viet(a)jboss.com</email>
+ </author>
+ </chapterinfo>
+ <title>Error handling configuration</title>
+ <para>JBoss Portal request pipeline provides configuring of the error handling policy. At runtime when an error
+ occurs it is possible to configure how the portal behaves in a fine grained and dynamic manner.</para>
+ <sect1>
+ <title>Error types</title>
+ <para>There are several kind of errors that can be happen during a request.</para>
+ <itemizedlist>
+ <listitem>Access denied: the user does not have the security rights to access a resource</listitem>
+ <listitem>Error: an expected error, like a portlet threw an exception</listitem>
+ <listitem>Internal error: an unexpected error</listitem>
+ <listitem>Resource not found: a resource is not found</listitem>
+ <listitem>Resource not available: a resource is found but is not serviceable</listitem>
+ </itemizedlist>
+ </sect1>
+ <sect1>
+ <title>Control policies</title>
+ <para>When an error occurs, the request control flow changes according to the configuration. The configuration
+ is also called <emphasis>control policy</emphasis>.</para>
+ <sect2>
+ <title>Policy delegation and cascading</title>
+ <para>Whenever a control policy is invoked it is given the opportunity to change the response sent
+ by the control flow. If the control policy ignores the error then the next policy will handle the error
+ at this turn. However if the control policy decides to provide a new response then the next policy
+ will not be invoked since the new response will not be of type error. For instance, if a portlet part of a page
+ produces an exception, the following reactions are possible:</para>
+ <itemizedlist>
+ <listitem>The error is displayed in the window</listitem>
+ <listitem>The window is removed from the aggregation</listitem>
+ <listitem>An portal error page is displayed</listitem>
+ <listitem>An HTTP 500 error response is sent to the browser</listitem>
+ </itemizedlist>
+ </sect2>
+ <sect2>
+ <title>Default policy</title>
+ <para>The default policy applies when error are not handled at other level. By default errors are translated
+ into the most appropriate HTTP response:
+ </para>
+ <itemizedlist>
+ <listitem>Access denied: HTTP 403 Forbidden response</listitem>
+ <listitem>Error: HTTP 500 Internal Server Error response</listitem>
+ <listitem>Internal error: HTTP 500 Internal Server Error response</listitem>
+ <listitem>Resource not found: HTTP 404 Not Found response</listitem>
+ <listitem>Resource not available: HTTP 404 Not Found response</listitem>
+ </itemizedlist>
+ </sect2>
+ <sect2>
+ <title>Portal policy</title>
+ <para>Portal error policy controls the response that will be sent to the browser when an error occurs. There is a default
+ configuration and it is reconfigurable per portal. Whenever an error occurs, the policy can either handle a redirect to
+ a JSP page or ignore the error. If the error is ignored it will be handled by the default policy, otherwise a JSP page
+ will be invoked with appropriate request attributes to allow page customization.</para>
+ </sect2>
+ <sect2>
+ <title>Page policy</title>
+ <para>Window error policy controls how the page reacts to aggregation errors. Indeed the page is most of the time
+ an aggregation of several portlet windows and the action to take when an error occurs is different than the other
+ policies. Whenever an error occurs, the policy can either handle it or ignore it. If the error is ignored then
+ it will be treated by the portal policy. The different actions that are possible upon an error are:</para>
+ <itemizedlist>
+ <listitem>Remove the window from the aggregation</listitem>
+ <listitem>Replace the markup of the window by a redirection to a JSP page</listitem>
+ </itemizedlist>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Configuration using the XML descriptors</title>
+ <para>Since the different policies are configured using portal object properties it is possible to configure
+ the error handling policy in the XML descriptors of those objects.</para>
+ <sect2>
+ <title>Portal policy properties</title>
+ <para>A set of properties configure the the behavior of the portal policy. Those properties will only be
+ taken in account for objects of type portal.</para>
+ <para>
+ <table frame="all">
+ <title>Portal policy properties</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Property name</entry>
+ <entry align="center">Description</entry>
+ <entry align="center">Possible values</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry align="center">control.portal.access_denied</entry>
+ <entry align="center">On access denied</entry>
+ <entry align="center"><emphasis>ignore</emphasis> and <emphasis>jsp</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.portal.unavailable</entry>
+ <entry align="center">On resource not available</entry>
+ <entry align="center"><emphasis>ignore</emphasis> and <emphasis>jsp</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.portal.error</entry>
+ <entry align="center">On an expected error</entry>
+ <entry align="center"><emphasis>ignore</emphasis> and <emphasis>jsp</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.portal.internal_error</entry>
+ <entry align="center">On an unexpected error</entry>
+ <entry align="center"><emphasis>ignore</emphasis> and <emphasis>jsp</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.portal.not_found</entry>
+ <entry align="center">On resource not found</entry>
+ <entry align="center"><emphasis>ignore</emphasis> and <emphasis>jsp</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.portal.resource_uri</entry>
+ <entry align="center">The path of the JSP used for redirections</entry>
+ <entry align="center">A valid path to a JSP located in the portal-core.war file</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>An example of portal configuration:
+ <programlisting><![CDATA[
+<portal>
+ <portal-name>MyPortal</portal-name>
+ ...
+ <properties>
+ <property>
+ <name>control.portal.access_denied</name>
+ <value>ignore</value>
+ </property>
+ <property>
+ <name>control.portal.unavailable</name>
+ <value>ignore</value>
+ </property>
+ <property>
+ <name>control.portal.not_found</name>
+ <value>ignore</value>
+ </property>
+ <property>
+ <name>control.portal.internal_error</name>
+ <value>jsp</value>
+ </property>
+ <property>
+ <name>control.portal.error</name>
+ <value>jsp</value>
+ </property>
+ <property>
+ <name>control.portal.resource_uri</name>
+ <value>/WEB-INF/jsp/error/portal.jsp</value>
+ </property>
+ ...
+ </properties>
+ ...
+</portal>
+]]></programlisting>
+ </para>
+ </sect2>
+ <sect2>
+ <title>Page policy properties</title>
+ <para>A set of properties configure the the behavior of the page policy. Those properties will only be
+ taken in account for objects of type portal and page.</para>
+ <para>
+ <table frame="all">
+ <title>Page policy properties</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Property name</entry>
+ <entry align="center">Description</entry>
+ <entry align="center">Possible values</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry align="center">control.page.access_denied</entry>
+ <entry align="center">On access denied</entry>
+ <entry align="center"><emphasis>ignore</emphasis>, <emphasis>jsp</emphasis> and <emphasis>hide</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.page.unavailable</entry>
+ <entry align="center">On resource not available</entry>
+ <entry align="center"><emphasis>ignore</emphasis>, <emphasis>jsp</emphasis> and <emphasis>hide</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.page.error</entry>
+ <entry align="center">On an expected error</entry>
+ <entry align="center"><emphasis>ignore</emphasis>, <emphasis>jsp</emphasis> and <emphasis>hide</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.page.internal_error</entry>
+ <entry align="center">On an unexpected error</entry>
+ <entry align="center"><emphasis>ignore</emphasis>, <emphasis>jsp</emphasis> and <emphasis>hide</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.page.not_found</entry>
+ <entry align="center">On resource not found</entry>
+ <entry align="center"><emphasis>ignore</emphasis>, <emphasis>jsp</emphasis> and <emphasis>hide</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">control.page.resource_uri</entry>
+ <entry align="center">The path of the JSP used for redirections</entry>
+ <entry align="center"><emphasis>ignore</emphasis>, <emphasis>jsp</emphasis> and <emphasis>hide</emphasis></entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <para>An example of page configuration:
+ <programlisting><![CDATA[
+<page>
+ <page-name>MyPortal</page-name>
+ ...
+ <properties>
+ <property>
+ <name>control.page.access_denied</name>
+ <value>hide</value>
+ </property>
+ <property>
+ <name>control.page.unavailable</name>
+ <value>hide</value>
+ </property>
+ <property>
+ <name>control.page.not_found</name>
+ <value>hide</value>
+ </property>
+ <property>
+ <name>control.page.internal_error</name>
+ <value>jsp</value>
+ </property>
+ <property>
+ <name>control.page.error</name>
+ <value>jsp</value>
+ </property>
+ <property>
+ <name>control.page.resource_uri</name>
+ <value>/WEB-INF/jsp/error/page.jsp</value>
+ </property>
+ ...
+ </properties>
+ ...
+</page>
+]]></programlisting>
+ </para>
+ <note>You can configure the page properties also on objects of type portal, in that case they will be inherited by the pages
+ which are located in the portal.</note>
+ </sect2>
+ </sect1>
+ <sect1>
+ <title>Handling errors with JSP</title>
+ <para>As described above it is possible to redirect error handling to a JavaServer Page. Two pages can be created
+ to handle errors at portal and page level. Portal level error handling requires a page that will produce a full
+ page and the page level error handling requires a page that will producer markup for a window only. When the page
+ is invoked it will be passed a set of request attributes.</para>
+ <para>
+ <table frame="all">
+ <title>Request attributes</title>
+ <tgroup cols="3" align="left" colsep="1" rowset="1">
+ <colspec colname='c1'/>
+ <colspec colname='c2'/>
+ <colspec colname='c3'/>
+ <thead>
+ <row>
+ <entry align="center">Attribute name</entry>
+ <entry align="center">Attribute Description</entry>
+ <entry align="center">Attribute value</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry align="center">org.jboss.portal.control.ERROR_TYPE</entry>
+ <entry align="center">The error type</entry>
+ <entry align="center">The possible values are <emphasis>ACCESS_DENIED</emphasis>, <emphasis>UNAVAILABLE</emphasis>, <emphasis>ERROR</emphasis>, <emphasis>INTERNAL_ERROR</emphasis>, <emphasis>NOT_FOUND</emphasis></entry>
+ </row>
+ <row>
+ <entry align="center">org.jboss.portal.control.CAUSE</entry>
+ <entry align="center">The throwable cause that can be null</entry>
+ <entry align="center">The object is a subclass of java.lang.Throwable</entry>
+ </row>
+ <row>
+ <entry align="center">org.jboss.portal.control.MESSAGE</entry>
+ <entry align="center">An error message that can be null</entry>
+ <entry align="center">Text</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </para>
+ <note>The JavaServer Pages have to be located in the jboss-portal.sar/portal-core.war Web Application.</note>
+ </sect1>
+</chapter>
\ No newline at end of file
18 years, 10 months
JBoss Portal SVN: r7453 - trunk/common.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-17 15:40:50 -0400 (Sun, 17 Jun 2007)
New Revision: 7453
Modified:
trunk/common/build.xml
Log:
- improved a bit the implementation of JavaBeanModelMBeanBuilder by removing unnecessary creation of HashMap objects
- fixed bug when an overriden getter produces 2 getter operations in the model mbean operation infos metadata
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-06-17 19:40:31 UTC (rev 7452)
+++ trunk/common/build.xml 2007-06-17 19:40:50 UTC (rev 7453)
@@ -211,7 +211,6 @@
</x-sysproperty>
<x-test>
-<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.net.URLNavigatorTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.net.URLToolsTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.io.IOToolsTestCase"/>
@@ -240,9 +239,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.StringTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.JarTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.PathTestCase"/>
--->
<test todir="${test.reports}" name="org.jboss.portal.test.common.JavaBeanModelMBeanBuilderTestCase"/>
-<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.ParameterMapTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.LocalizedStringTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ImplodeTestCase"/>
@@ -252,7 +249,6 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.ToolsTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.IteratorStatusTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.PathMapperTestCase"/>
--->
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
18 years, 10 months
JBoss Portal SVN: r7452 - in trunk/common: src/main/org/jboss/portal/common/mx and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-06-17 15:40:31 -0400 (Sun, 17 Jun 2007)
New Revision: 7452
Modified:
trunk/common/build.xml
trunk/common/src/main/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java
trunk/common/src/main/org/jboss/portal/test/common/JavaBeanModelMBeanBuilderTestCase.java
Log:
- improved a bit the implementation of JavaBeanModelMBeanBuilder by removing unnecessary creation of HashMap objects
- fixed bug when an overriden getter produces 2 getter operations in the model mbean operation infos metadata
Modified: trunk/common/build.xml
===================================================================
--- trunk/common/build.xml 2007-06-17 16:39:12 UTC (rev 7451)
+++ trunk/common/build.xml 2007-06-17 19:40:31 UTC (rev 7452)
@@ -211,6 +211,7 @@
</x-sysproperty>
<x-test>
+<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.net.URLNavigatorTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.net.URLToolsTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.io.IOToolsTestCase"/>
@@ -239,7 +240,9 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.StringTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.JarTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.PathTestCase"/>
+-->
<test todir="${test.reports}" name="org.jboss.portal.test.common.JavaBeanModelMBeanBuilderTestCase"/>
+<!--
<test todir="${test.reports}" name="org.jboss.portal.test.common.ParameterMapTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.LocalizedStringTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.ImplodeTestCase"/>
@@ -249,6 +252,7 @@
<test todir="${test.reports}" name="org.jboss.portal.test.common.ToolsTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.IteratorStatusTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.common.PathMapperTestCase"/>
+-->
</x-test>
<x-classpath>
<pathelement location="${build.classes}"/>
Modified: trunk/common/src/main/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java 2007-06-17 16:39:12 UTC (rev 7451)
+++ trunk/common/src/main/org/jboss/portal/common/mx/JavaBeanModelMBeanBuilder.java 2007-06-17 19:40:31 UTC (rev 7452)
@@ -82,7 +82,7 @@
//
Map beanGetters = new HashMap();
Map beanSetters = new HashMap();
- Set beanMethods = new HashSet();
+ Map beanMethods = new HashMap();
//
for (Class c = from;c != null && !c.equals(to);c = c.getSuperclass())
@@ -108,22 +108,31 @@
methodName.length() > 3)
{
String propertyName = methodName.substring(3);
- Map setters = new HashMap();
- setters.putAll(beanSetters);
- setters.putAll(currentClassSetters);
- Method beanSetter = (Method)setters.get(propertyName);
+
+ // Try to locate an existing setter for the same property
+ Method beanSetter = (Method)currentClassSetters.get(propertyName);
+ if (beanSetter == null)
+ {
+ beanSetter = (Method)beanSetters.get(propertyName);
+ }
+
+ // Check we do not have a setter with a different return type
if (beanSetter != null && !beanSetter.getParameterTypes()[0].equals(returnType))
{
throw new IllegalArgumentException("Property " + propertyName + " has a setter" +
" type " + beanSetter.getParameterTypes()[0] + " different from the corresponding" +
" getter type " + returnType);
}
+
+ // Get an existing bean getter
Method beanGetter = (Method)currentClassGetters.get(propertyName);
if (beanGetter != null)
{
throw new IllegalArgumentException("Property " + propertyName + " has two getters " +
beanGetter + " and " + method);
}
+
+ //
currentClassGetters.put(propertyName, method);
}
else if (methodName.startsWith("is") &&
@@ -132,22 +141,31 @@
methodName.length() > 2)
{
String propertyName = methodName.substring(2);
- Map setters = new HashMap();
- setters.putAll(beanSetters);
- setters.putAll(currentClassSetters);
- Method beanSetter = (Method)setters.get(propertyName);
+
+ // Try to locate an existing setter for the same property
+ Method beanSetter = (Method)beanSetters.get(propertyName);
+ if (beanSetter != null)
+ {
+ beanSetter = (Method)currentClassSetters.get(propertyName);
+ }
+
+ // Check we do not have a setter with a different return type
if (beanSetter != null && !beanSetter.getParameterTypes()[0].equals(returnType))
{
throw new IllegalArgumentException("Property " + propertyName + " has a setter" +
" type " + beanSetter.getParameterTypes()[0] + " different from the corresponding" +
" getter type " + returnType);
}
+
+ // Get an existing getter
Method beanGetter = (Method)beanGetters.get(propertyName);
if (beanGetter != null)
{
throw new IllegalArgumentException("Property " + propertyName + " has two getters " +
beanGetter + " and " + method);
}
+
+ //
currentClassGetters.put(propertyName, method);
}
else if (methodName.startsWith("set") &&
@@ -156,29 +174,36 @@
methodName.length() > 3)
{
String propertyName = methodName.substring(3);
- Map getters = new HashMap();
- getters.putAll(beanGetters);
- getters.putAll(currentClassGetters);
- Method beanGetter = (Method)getters.get(propertyName);
-
+
+ // Try to locate an existing getter
+ Method beanGetter = (Method)beanGetters.get(propertyName);
+ if (beanGetter == null)
+ {
+ beanGetter = (Method)currentClassGetters.get(propertyName);
+ }
+
+ // Check we do not have a getter with a different return type
if (beanGetter != null && !beanGetter.getReturnType().equals(parameterTypes[0]))
{
throw new IllegalArgumentException("Property " + propertyName + " has a setter" +
" type " + parameterTypes[0] + " different from the corresponding" +
" getter type " + beanGetter.getReturnType());
}
+
+ // Get an existing setter
Method beanSetter = (Method)beanSetters.get(propertyName);
if (beanSetter != null)
{
throw new IllegalArgumentException("Property " + propertyName + " cannot have two setters " +
beanSetter + " and " + method);
}
- beanSetters.put(propertyName, method);
+
+ //
currentClassSetters.put(propertyName, method);
}
//
- beanMethods.add(method);
+ beanMethods.put(new MethodKey(method), method);
}
}
beanGetters.putAll(currentClassGetters);
@@ -239,7 +264,7 @@
// Methods->Operations
mmois = new ArrayList();
- for (Iterator i = beanMethods.iterator(); i.hasNext();)
+ for (Iterator i = beanMethods.values().iterator(); i.hasNext();)
{
Method method = (Method)i.next();
@@ -279,22 +304,6 @@
(ModelMBeanOperationInfo[])mmois.toArray(new ModelMBeanOperationInfo[mmois.size()]),
new ModelMBeanNotificationInfo[0]);
- // Comment out the code that adds the service proxy unwrapper
- // don't remove that though it may be usefull later
-// try
-// {
-// // Add the specific interceptor that will unwrap proxies during dependency injection
-// Descriptor mbeanDesc = info.getDescriptor("", "mbean");
-// Descriptor interceptorDesc = new DescriptorSupport();
-// interceptorDesc.setField("code", ProxyUnwrapperInterceptor.class.getName());
-// mbeanDesc.setField("interceptors", new Descriptor[]{interceptorDesc});
-// info.setDescriptor(mbeanDesc, "mbean");
-// }
-// catch (MBeanException e)
-// {
-// log.error("Not able to setup the proxy unwrapper interceptor", e);
-// }
-
//
return info;
}
@@ -308,4 +317,67 @@
{
return new JavaBeanModelMBeanBuilder(o.getClass(), null).getInfo();
}
+
+ /**
+ * Key a method during the lookup operations
+ */
+ private static class MethodKey
+ {
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Class[] parameterTypes;
+
+ /** . */
+ private final int hashCode;
+
+ public MethodKey(Method method)
+ {
+ this.name = method.getName();
+ this.parameterTypes = method.getParameterTypes();
+
+ // Compute hash code
+ int hashCode = method.getName().hashCode();
+ for (int i = 0;i < parameterTypes.length;i++)
+ {
+ Class parameterType = parameterTypes[i];
+ hashCode = hashCode * 43 + parameterType.hashCode();
+ }
+ this.hashCode = hashCode;
+ }
+
+ public int hashCode()
+ {
+ return hashCode;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == this)
+ {
+ return true;
+ }
+ if (obj instanceof MethodKey)
+ {
+ MethodKey that = (MethodKey)obj;
+
+ //
+ if (that.name.equals(this.name) && that.parameterTypes.length == this.parameterTypes.length)
+ {
+ for (int i = 0;i < that.parameterTypes.length;i++)
+ {
+ if (!that.parameterTypes[i].equals(this.parameterTypes[i]))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
}
Modified: trunk/common/src/main/org/jboss/portal/test/common/JavaBeanModelMBeanBuilderTestCase.java
===================================================================
--- trunk/common/src/main/org/jboss/portal/test/common/JavaBeanModelMBeanBuilderTestCase.java 2007-06-17 16:39:12 UTC (rev 7451)
+++ trunk/common/src/main/org/jboss/portal/test/common/JavaBeanModelMBeanBuilderTestCase.java 2007-06-17 19:40:31 UTC (rev 7452)
@@ -32,8 +32,10 @@
import javax.management.MBeanServerFactory;
import javax.management.ObjectName;
import javax.management.Attribute;
+import javax.management.Descriptor;
import javax.management.modelmbean.ModelMBeanInfo;
import javax.management.modelmbean.RequiredModelMBean;
+import javax.management.modelmbean.ModelMBeanOperationInfo;
import java.util.HashSet;
import java.util.Set;
import java.util.Arrays;
@@ -62,7 +64,7 @@
assertEquals(0, ops.length);
}
- public void testOneMethod() throws Exception
+ public void testSimpleClass() throws Exception
{
JavaBeanModelMBeanBuilder builder = new JavaBeanModelMBeanBuilder(TestClass.class, Object.class);
ModelMBeanInfo info = builder.getInfo();
@@ -83,12 +85,12 @@
//
Set expectedOps = new HashSet();
- expectedOps.add(new TestOperation("void", "operation", new String[]{}));
- expectedOps.add(new TestOperation("void", "operation", new String[]{"java.lang.String"}));
- expectedOps.add(new TestOperation("void", "setString", new String[]{"java.lang.String"}));
- expectedOps.add(new TestOperation("java.lang.String", "getString", new String[]{}));
- expectedOps.add(new TestOperation("void", "setBoolean", new String[]{"boolean"}));
- expectedOps.add(new TestOperation("boolean", "isBoolean", new String[]{}));
+ expectedOps.add(TestOperation.newOperation("void", "operation", new String[]{}));
+ expectedOps.add(TestOperation.newOperation("void", "operation", new String[]{"java.lang.String"}));
+ expectedOps.add(TestOperation.newSetter("setString", "java.lang.String"));
+ expectedOps.add(TestOperation.newGetter("getString", "java.lang.String"));
+ expectedOps.add(TestOperation.newSetter("setBoolean", "boolean"));
+ expectedOps.add(TestOperation.newGetter("isBoolean", "boolean"));
assertEquals(expectedOps, ops);
}
@@ -103,7 +105,7 @@
//
Set expectedOps = new HashSet();
- expectedOps.add(new TestOperation("void", "overridenOperation", new String[]{}));
+ expectedOps.add(TestOperation.newOperation("void", "overridenOperation", new String[]{}));
assertEquals(expectedOps, ops);
}
@@ -114,15 +116,23 @@
JavaBeanModelMBeanBuilder builder = new JavaBeanModelMBeanBuilder(OverloadedSetter.class, Object.class);
fail();
}
- catch (Exception e)
+ catch (Exception expected)
{
// expected
}
}
- public void testGetterOverride() throws Exception
+ public void testOverridenGetter() throws Exception
{
JavaBeanModelMBeanBuilder builder = new JavaBeanModelMBeanBuilder(TestOverridenExtend.class, Object.class);
+ ModelMBeanInfo info = builder.getInfo();
+
+ //
+ Set ops = getOperations(info);
+ Set expectedOps = new HashSet();
+ expectedOps.add(TestOperation.newGetter("getTest", "java.util.Set"));
+ assertEquals(expectedOps, ops);
+
}
public void testAttributesAreNotCached() throws Exception
@@ -207,7 +217,7 @@
for (int i = 0; i < ops.length; i++)
{
MBeanOperationInfo op = ops[i];
- set.add(new TestOperation(op));
+ set.add(new TestOperation((ModelMBeanOperationInfo)op));
}
return set;
}
@@ -320,15 +330,39 @@
}
}
+ public class TestOverridenBase
+ {
+ public Set getTest()
+ {
+ //nothing
+ return new HashSet();
+ }
+ }
+
+ public class TestOverridenExtend extends TestOverridenBase
+ {
+ public Set getTest()
+ {
+ //nothing
+ return new HashSet();
+ }
+ }
+
public static class TestAttribute
{
+
+ /** . */
public final String type;
+
+ /** . */
public final String name;
+
public TestAttribute(MBeanAttributeInfo info)
{
this.type = info.getType();
this.name = info.getName();
}
+
public TestAttribute(String type, String name)
{
if (type == null)
@@ -342,15 +376,18 @@
this.type = type;
this.name = name;
}
+
public int hashCode()
{
return type.hashCode() * 43 + name.hashCode();
}
+
public boolean equals(Object obj)
{
TestAttribute that = (TestAttribute)obj;
return type.equals(that.type) && name.equals(that.name);
}
+
public String toString()
{
return "Attribute[" + type + "," + name + "]";
@@ -359,21 +396,50 @@
public static class TestOperation
{
+
+ /** . */
public final String returnType;
+
+ /** . */
public final String name;
+
+ /** . */
public final String[] argTypes;
- public TestOperation(MBeanOperationInfo info)
+
+ /** . */
+ public final String role;
+
+ public TestOperation(ModelMBeanOperationInfo info)
{
- returnType = info.getReturnType();
- name = info.getName();
- argTypes = new String[info.getSignature().length];
+ Descriptor desc = info.getDescriptor();
+
+ this.returnType = info.getReturnType();
+ this.name = info.getName();
+ this.argTypes = new String[info.getSignature().length];
+ this.role = (String)desc.getFieldValue("role");
for (int i = 0; i < argTypes.length; i++)
{
argTypes[i] = info.getSignature()[i].getType();
}
}
- public TestOperation(String returnType, String name, String[] argTypes)
+
+ public static TestOperation newOperation(String returnType, String name, String[] argTypes)
{
+ return new TestOperation(returnType, name, argTypes, "operation");
+ }
+
+ public static TestOperation newGetter(String name, String type)
+ {
+ return new TestOperation(type, name, new String[0], "getter");
+ }
+
+ public static TestOperation newSetter(String name, String type)
+ {
+ return new TestOperation("void", name, new String[]{type}, "setter");
+ }
+
+ public TestOperation(String returnType, String name, String[] argTypes, String role)
+ {
if (returnType == null)
{
throw new IllegalArgumentException();
@@ -396,10 +462,12 @@
this.returnType = returnType;
this.name = name;
this.argTypes = argTypes;
+ this.role = role;
}
+
public int hashCode()
{
- int code = returnType.hashCode() * 43 + name.hashCode();
+ int code = (returnType.hashCode() * 43 + name.hashCode()) * 43 + role.hashCode();
for (int i = 0; i < argTypes.length; i++)
{
String argType = argTypes[i];
@@ -407,14 +475,16 @@
}
return code;
}
+
public boolean equals(Object obj)
{
TestOperation that = (TestOperation)obj;
- return returnType.equals(that.returnType) && name.equals(that.name) && Arrays.equals(argTypes, that.argTypes);
+ return returnType.equals(that.returnType) && name.equals(that.name) && role.equals(that.role) && Arrays.equals(argTypes, that.argTypes);
}
+
public String toString()
{
- StringBuffer tmp = new StringBuffer("Operation[").append(returnType).append(",").append(name);
+ StringBuffer tmp = new StringBuffer("Operation[").append(returnType).append(",").append(name).append(",").append(role);
for (int i = 0; i < argTypes.length; i++)
{
tmp.append(",").append(argTypes[i]);
@@ -423,24 +493,4 @@
return tmp.toString();
}
}
-
- public class TestOverridenBase
- {
- public Set getTest()
- {
- //nothing
- return new HashSet();
- }
-
-
- }
-
- public class TestOverridenExtend extends TestOverridenBase
- {
- public Set getTest()
- {
- //nothing
- return new HashSet();
- }
- }
}
18 years, 10 months
JBoss Portal SVN: r7451 - in trunk/wsrp: src/main/org/jboss/portal/test/wsrp/consumer and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-06-17 12:39:12 -0400 (Sun, 17 Jun 2007)
New Revision: 7451
Modified:
trunk/wsrp/build.xml
trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
Log:
- ProducerInfo.getRegistrationContext was providing a code path where out of date information could be sent to the Producer.
Modified: trunk/wsrp/build.xml
===================================================================
--- trunk/wsrp/build.xml 2007-06-17 09:14:54 UTC (rev 7450)
+++ trunk/wsrp/build.xml 2007-06-17 16:39:12 UTC (rev 7451)
@@ -342,7 +342,7 @@
<!-- ================================================================== -->
<target name="main" depends="most"/>
- <target name="all" depends="_default:all"/>
+ <target name="all" depends="_default:all, explode"/>
<target name="most" depends="_default:most"/>
<target name="help" depends="_default:help"/>
@@ -780,7 +780,7 @@
name="org.jboss.portal.test.wsrp.consumer.ProducerSessionInformationTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.EndpointConfigurationInfoTestCase"/>
<test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.ProducerInfoTestCase"/>
- <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.RegistrationInfoTestCase"/>
+ <test todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.RegistrationInfoTestCase"/>
<zest todir="${test.reports}" name="org.jboss.portal.test.wsrp.consumer.ConsumerRegistryTestCase"
outfile="TEST-ConsumerRegistryTestCase">
<parameter name="Config" value="persistent-jboss-beans.xml"/>
Modified: trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-06-17 09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-06-17 16:39:12 UTC (rev 7451)
@@ -43,6 +43,7 @@
import org.jboss.portal.wsrp.core.MissingParametersFault;
import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
+import org.jboss.portal.wsrp.core.RegistrationContext;
import java.rmi.RemoteException;
@@ -147,6 +148,24 @@
assertEquals(1, regBehavior.getCallCount());
}
+ public void testGetRegistrationContext() throws Exception
+ {
+ assertFalse(info.isRegistered());
+ assertNull(info.getRegistrationInfo());
+
+ ServiceDescriptionBehavior sd = new ServiceDescriptionBehavior();
+ sd.setRequiresRegistration(true);
+ serviceFactory.getRegistry().setServiceDescriptionBehavior(sd);
+ RegistrationBehavior regBehavior = new RegistrationBehavior();
+ serviceFactory.getRegistry().setRegistrationBehavior(regBehavior);
+
+ RegistrationContext registrationContext = info.getRegistrationContext();
+ assertNotNull(registrationContext);
+ assertEquals(RegistrationBehavior.REGISTRATION_HANDLE, registrationContext.getRegistrationHandle());
+ assertEquals("Registration should have occured", 1, regBehavior.getCallCount());
+ assertEquals("Service description should have been called once unregistered and once registered", 2, sd.getCallCount());
+ }
+
private static class TestPortletManagementBehavior extends PortletManagementBehavior
{
public PortletDescriptionResponse getPortletDescription(GetPortletDescription getPortletDescription)
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2007-06-17 09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ActionHandler.java 2007-06-17 16:39:12 UTC (rev 7451)
@@ -208,7 +208,7 @@
getActionRequest(request).setUserContext(userContext);
}
- protected void updateRegistrationContext(Object request)
+ protected void updateRegistrationContext(Object request) throws PortletInvokerException
{
getActionRequest(request).setRegistrationContext(consumer.getRegistrationContext());
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-06-17 09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-06-17 16:39:12 UTC (rev 7451)
@@ -252,7 +252,7 @@
protected abstract void updateUserContext(Object request, UserContext userContext);
- protected abstract void updateRegistrationContext(Object request);
+ protected abstract void updateRegistrationContext(Object request) throws PortletInvokerException;
protected abstract RuntimeContext getRuntimeContextFrom(Object request);
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-06-17 09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-06-17 16:39:12 UTC (rev 7451)
@@ -257,7 +257,7 @@
// POPs and rest of producer info separetely...
if (forceRefresh || isRefreshNeeded(true))
{
- log.debug("Refreshing...");
+ log.debug("Refreshing info for producer '" + getId() + "'");
RefreshResult result = new RefreshResult(true, REFRESH_MEANING);
try
{
@@ -270,7 +270,8 @@
// save changes to endpoint
registry.updateProducerInfo(this);
- serviceDescription = getServiceDescription(false);
+ // if we don't yet have registration information, get an unregistered service description
+ serviceDescription = getServiceDescription(persistentRegistrationInfo == null);
// do we need to call initCookie or not?
requiresInitCookie = serviceDescription.getRequiresInitCookie();
@@ -567,7 +568,7 @@
}
}
- private GetServiceDescription getServiceDescriptionRequest(boolean asUnregistred)
+ private GetServiceDescription getServiceDescriptionRequest(boolean asUnregistred) throws PortletInvokerException
{
//todo: might need to implement customization of default service description
GetServiceDescription gsd = WSRPTypeFactory.createGetServiceDescription();
@@ -584,9 +585,14 @@
}
}
- public RegistrationContext getRegistrationContext()
+ public RegistrationContext getRegistrationContext() throws PortletInvokerException
{
- return persistentRegistrationInfo == null ? null : persistentRegistrationInfo.getRegistrationContext();
+ if (persistentRegistrationInfo == null)
+ {
+ refresh(false);
+ }
+
+ return persistentRegistrationInfo.getRegistrationContext();
}
public void resetRegistration() throws PortletInvokerException
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2007-06-17 09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/RenderHandler.java 2007-06-17 16:39:12 UTC (rev 7451)
@@ -23,8 +23,9 @@
package org.jboss.portal.wsrp.consumer;
+import org.jboss.portal.common.net.URLTools;
import org.jboss.portal.common.util.Tools;
-import org.jboss.portal.common.net.URLTools;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.portlet.invocation.PortletInvocation;
import org.jboss.portal.portlet.invocation.response.ErrorResponse;
import org.jboss.portal.portlet.invocation.response.FragmentResponse;
@@ -131,7 +132,7 @@
getRenderRequest(request).setUserContext(userContext);
}
- protected void updateRegistrationContext(Object request)
+ protected void updateRegistrationContext(Object request) throws PortletInvokerException
{
getRenderRequest(request).setRegistrationContext(consumer.getRegistrationContext());
}
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-06-17 09:14:54 UTC (rev 7450)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/WSRPConsumerImpl.java 2007-06-17 16:39:12 UTC (rev 7451)
@@ -443,7 +443,7 @@
producerInfo.resetRegistration();
}
- RegistrationContext getRegistrationContext()
+ RegistrationContext getRegistrationContext() throws PortletInvokerException
{
return producerInfo.getRegistrationContext();
}
18 years, 10 months
JBoss Portal SVN: r7450 - trunk/core-admin/src/main/org/jboss/portal/core/admin/ui.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-06-17 05:14:54 -0400 (Sun, 17 Jun 2007)
New Revision: 7450
Modified:
trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java
Log:
fix for error handling in property editor
Modified: trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java
===================================================================
--- trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java 2007-06-15 20:15:54 UTC (rev 7449)
+++ trunk/core-admin/src/main/org/jboss/portal/core/admin/ui/ControlPropertyBean.java 2007-06-17 09:14:54 UTC (rev 7450)
@@ -46,7 +46,7 @@
private final PropertyInfo info;
/** . */
- private final boolean inherited;
+ private boolean inherited;
public ControlPropertyBean(ControlPropertiesBean container, PropertyInfo info, boolean inherited, String value)
{
@@ -81,6 +81,11 @@
return inherited;
}
+ public void setInherited(boolean inherited)
+ {
+ this.inherited = inherited;
+ }
+
public void inherit(ValueChangeEvent event)
{
@@ -109,11 +114,14 @@
public void setValue(Object value)
{
- this.value = value.toString();
+ if (!inherited)
+ {
+ this.value = value.toString();
- // Need to use the container as it will contain the refreshed object
- PortalObject portalObject = container.pomgr.getSelectedObject();
- portalObject.setDeclaredProperty(getName(), value.toString());
+ // Need to use the container as it will contain the refreshed object
+ PortalObject portalObject = container.pomgr.getSelectedObject();
+ portalObject.setDeclaredProperty(getName(), value.toString());
+ }
}
18 years, 10 months
JBoss Portal SVN: r7449 - trunk/core-cms/src/main/org/jboss/portal/core/cms.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-06-15 16:15:54 -0400 (Fri, 15 Jun 2007)
New Revision: 7449
Modified:
trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactoryService.java
Log:
minor fix for POJO injection into InternalCMSContentProvider
Modified: trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactoryService.java
===================================================================
--- trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactoryService.java 2007-06-15 19:23:26 UTC (rev 7448)
+++ trunk/core-cms/src/main/org/jboss/portal/core/cms/CMSObjectCommandFactoryService.java 2007-06-15 20:15:54 UTC (rev 7449)
@@ -47,7 +47,7 @@
*
* @author <a href="mailto:roy@jboss.org">Roy Russo</a>
*/
-public class CMSObjectCommandFactoryService extends AbstractCommandFactory
+public class CMSObjectCommandFactoryService extends AbstractCommandFactory implements CMSObjectCommandFactory
{
/** . */
18 years, 10 months