JBoss Portal SVN: r9218 - in branches/JBoss_Portal_Branch_2_6: core/src/main/org/jboss/portal/core/impl/portlet/state and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-30 08:56:36 -0500 (Fri, 30 Nov 2007)
New Revision: 9218
Modified:
branches/JBoss_Portal_Branch_2_6/core/build.xml
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java
Log:
JBPORTAL-1826 : bug fix and test case for "Registration data is not properly persisted on updates"
Modified: branches/JBoss_Portal_Branch_2_6/core/build.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/build.xml 2007-11-30 13:47:54 UTC (rev 9217)
+++ branches/JBoss_Portal_Branch_2_6/core/build.xml 2007-11-30 13:56:36 UTC (rev 9218)
@@ -613,7 +613,7 @@
<parameter name="CacheNaturalId" value="true"/>
<parameter name="Config" value="persistent-jboss-beans.xml"/>
</zest>
-
+
<!--
<zest todir="${test.reports}" name="org.jboss.portal.test.core.model.instance.InstanceContainerTestCase"
outfile="TEST-PersistedLocally-ClonedOnCreate-InstanceContainerTestCase">
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2007-11-30 13:47:54 UTC (rev 9217)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/impl/portlet/state/PersistentRegistration.java 2007-11-30 13:56:36 UTC (rev 9218)
@@ -23,6 +23,7 @@
package org.jboss.portal.core.impl.portlet.state;
import org.jboss.portal.common.NotYetImplemented;
+import org.jboss.portal.common.util.MapAccessor;
import org.jboss.portal.common.util.TypedMap;
import org.jboss.portal.registration.Consumer;
import org.jboss.portal.registration.Registration;
@@ -30,10 +31,10 @@
import javax.xml.namespace.QName;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import java.util.HashMap;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -175,7 +176,7 @@
public Map getProperties()
{
- return Collections.unmodifiableMap(persistentProperties);
+ return Collections.unmodifiableMap(properties);
}
public void setPropertyValueFor(QName propertyName, Object value)
@@ -289,13 +290,21 @@
}
};
+ private final MapAccessor accessor = new MapAccessor()
+ {
+ public Map getMap(boolean b)
+ {
+ return persistentProperties;
+ }
+ };
+
/** Implement registration properties semantics, mostly validation and equality. */
public class Properties extends TypedMap
{
public Properties()
{
- super(persistentProperties, KEY_CONVERTER, VALUE_CONVERTER);
+ super(accessor, KEY_CONVERTER, VALUE_CONVERTER);
}
public void setProperty(String propertyName, Object value)
Modified: branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java 2007-11-30 13:47:54 UTC (rev 9217)
+++ branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/test/registration/AbstractRegistrationPersistenceManagerTestCase.java 2007-11-30 13:56:36 UTC (rev 9218)
@@ -29,6 +29,7 @@
import org.jboss.portal.registration.NoSuchRegistrationException;
import org.jboss.portal.registration.Registration;
import org.jboss.portal.registration.RegistrationPersistenceManager;
+import org.jboss.portal.common.util.MapBuilder;
import javax.xml.namespace.QName;
import java.util.ArrayList;
@@ -397,4 +398,40 @@
assertEquals(null, getManager().getRegistration(regId));
stopInteraction();
}
+
+ public void testBulkUpdateRegistrationProperties() throws Exception
+ {
+ startInteraction();
+ ConsumerGroup group = getManager().createConsumerGroup("Foo");
+ Consumer consumer = getManager().createConsumer("Bar", "Bar");
+ group.addConsumer(consumer);
+ getManager().addRegistrationFor("Bar", registrationProperties);
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ Registration reg = (Registration)consumer.getRegistrations().iterator().next();
+ registrationProperties.remove(new QName("prop1"));
+ reg.updateProperties(registrationProperties);
+ assertEquals(Collections.singletonMap(new QName("prop2"), "value2"), reg.getProperties());
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ reg = (Registration)consumer.getRegistrations().iterator().next();
+ assertEquals(Collections.singletonMap(new QName("prop2"), "value2"), reg.getProperties());
+ registrationProperties.put(new QName("prop3"), "value3");
+ reg.updateProperties(registrationProperties);
+ assertEquals(MapBuilder.hashMap().put(new QName("prop2"), "value2").put(new QName("prop3"), "value3").get(), reg.getProperties());
+ stopInteraction();
+
+ //
+ startInteraction();
+ consumer = getManager().getConsumerById("Bar");
+ reg = (Registration)consumer.getRegistrations().iterator().next();
+ assertEquals(MapBuilder.hashMap().put(new QName("prop2"), "value2").put(new QName("prop3"), "value3").get(), reg.getProperties());
+ stopInteraction();
+ }
}
16 years, 5 months
JBoss Portal SVN: r9217 - branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-30 08:47:54 -0500 (Fri, 30 Nov 2007)
New Revision: 9217
Modified:
branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
Log:
JBPORTAL-1830 New user properties (locale) set by the user is not immediately used by the portal
Modified: branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2007-11-30 12:25:13 UTC (rev 9216)
+++ branches/JBoss_Portal_Branch_2_6/core-identity/src/main/org/jboss/portal/core/identity/ui/actions/EditProfileAction.java 2007-11-30 13:47:54 UTC (rev 9217)
@@ -29,19 +29,29 @@
import javax.faces.application.FacesMessage;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
+import javax.portlet.PortletRequest;
import javax.portlet.WindowState;
import javax.portlet.WindowStateException;
import org.jboss.logging.Logger;
import org.jboss.portal.api.node.PortalNode;
import org.jboss.portal.api.node.PortalNodeURL;
+import org.jboss.portal.common.p3p.P3PConstants;
import org.jboss.portal.common.text.FastURLDecoder;
+import org.jboss.portal.core.aspects.server.UserInterceptor;
import org.jboss.portal.core.identity.services.IdentityConstants;
import org.jboss.portal.core.identity.services.workflow.ValidateEmailService;
import org.jboss.portal.core.identity.ui.IdentityUIUser;
import org.jboss.portal.core.identity.ui.common.IdentityUserBean;
+import org.jboss.portal.faces.el.PropertyValue;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.User;
+import org.jboss.portal.portlet.aspects.portlet.ContextDispatcherInterceptor;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletContextImpl;
+import org.jboss.portal.portlet.impl.jsr168.api.PortletRequestImpl;
+import org.jboss.portal.portlet.invocation.ActionInvocation;
+import org.jboss.portal.portlet.invocation.RenderInvocation;
+import org.jboss.portal.server.ServerInvocation;
import org.jboss.portal.server.ServerInvocationContext;
import org.jboss.portlet.JBossActionRequest;
import org.jboss.portlet.JBossActionResponse;
@@ -235,6 +245,20 @@
FacesContext.getCurrentInstance().addMessage("status", new FacesMessage(bundle.getString("IDENTITY_EDIT_PROFILE_ERROR")));
log.error("",e);
}
+
+ // Removing user properties caching so that the changes are immediately available
+ ActionInvocation rInvocation = (ActionInvocation)((PortletRequest)ctx.getExternalContext().getRequest()).getAttribute(ContextDispatcherInterceptor.REQ_ATT_COMPONENT_INVOCATION);
+ rInvocation.setAttribute(ServerInvocation.PRINCIPAL_SCOPE, UserInterceptor.PROFILE_KEY, null);
+ rInvocation.setAttribute(ServerInvocation.PRINCIPAL_SCOPE, UserInterceptor.USER_KEY, null);
+
+ // JSR crap is also keeping a reference to a previous locale...
+ // Let's fix that for this portlet only
+ Object propertyValue = uiUser.getAttribute().getValue("locale").getObject();
+ if (propertyValue != null)
+ {
+ FacesContext.getCurrentInstance().getViewRoot().setLocale(new Locale(propertyValue.toString()));
+ }
+
this.resetWindowState(ctx);
return "start";
}
@@ -261,6 +285,7 @@
{
ctx.addMessage("status", new FacesMessage(bundle.getString("IDENTITY_EDIT_CHANGE_PASSWORD_ERROR")));
}
+
this.resetWindowState(ctx);
return "status";
}
16 years, 5 months
JBoss Portal SVN: r9216 - in branches/JBoss_Portal_Branch_2_6/widget/src: main/org/jboss/portal/widget/google/provider and 2 other directories.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-11-30 07:25:13 -0500 (Fri, 30 Nov 2007)
New Revision: 9216
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/google/QueryResultParserTestCase.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp
branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp
Log:
align styles with core-admin
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/google/QueryResultParserTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/google/QueryResultParserTestCase.java 2007-11-30 10:27:26 UTC (rev 9215)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/test/widget/google/QueryResultParserTestCase.java 2007-11-30 12:25:13 UTC (rev 9216)
@@ -126,8 +126,7 @@
assertNotNull(url);
GGQueryResultBuilder builder = new GGQueryResultBuilder(url);
GGQueryResult result = builder.build(5000);
- assertNotNull(result);
- assertEquals(0, result.collection().size());
+ assertNull(result);
fail();
}
catch(WidgetException e)
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java 2007-11-30 10:27:26 UTC (rev 9215)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java 2007-11-30 12:25:13 UTC (rev 9216)
@@ -109,9 +109,10 @@
//
if (bytes == null)
{
- throw new WidgetException("Cannot retrieve url: " + url);
+ throw new WidgetException("Cannot retrieve url: " + url + " - you can try to increase the connectionTimeout");
}
+ // Remove .replace if google rss feed returns correct xml
String string = new String(bytes).replace("Fun & Games", "Fun & Games");
List data = null;
@@ -149,7 +150,7 @@
}
catch(JBossXBException e)
{
- throw new WidgetException("Failed to parse directory response.", e);
+ throw new WidgetException("Failed to parse directory response.", e.getCause());
}
catch(IOException e)
{
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp 2007-11-30 10:27:26 UTC (rev 9215)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-netvibes-war/WEB-INF/jsp/edit_content.jsp 2007-11-30 12:25:13 UTC (rev 9216)
@@ -177,8 +177,12 @@
}
%>
- <% // If widget directory lookup was successful
- if ( queryResults == null || queryResults instanceof DirectoryResultFailure )
+ <%
+ if (queryResults == null)
+ {
+
+ } // If widget directory lookup was successful
+ else if ( queryResults instanceof DirectoryResultFailure )
{
DirectoryResultFailure resultFailure = (DirectoryResultFailure) queryResults;
%>
@@ -189,7 +193,12 @@
{
%>
<p>
- <table style="width:100%; border: 1px solid;" cellspacing="0" cellpadding="0">
+ <table style="width:100%;" class="portlet-def-table datatable" cellspacing="0" cellpadding="0">
+ <thead class="portlet-section-header">
+ <tr>
+ <td>Search results</td>
+ </tr>
+ </thead>
<%
for (IteratorStatus i = new IteratorStatus(queryResults.entries()); i.hasNext();)
{
@@ -236,6 +245,12 @@
</tr>
<%
}
+ if ( queryResults.resultSize() == 0 )
+ {
+ %><tr>
+ <td>Your search did not match any widgets.</td>
+ </tr><%
+ }
%>
</table>
<table style="width:100%; border: none;" cellspacing="0" cellpadding="0">
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp 2007-11-30 10:27:26 UTC (rev 9215)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/resources/portal-widget-war/WEB-INF/jsp/edit_content.jsp 2007-11-30 12:25:13 UTC (rev 9216)
@@ -184,7 +184,11 @@
</form>
<% // If widget directory lookup was successful
- if ( queryResults == null || queryResults instanceof DirectoryResultFailure )
+ if (queryResults == null)
+ {
+
+ }
+ else if ( queryResults instanceof DirectoryResultFailure )
{
DirectoryResultFailure resultFailure = (DirectoryResultFailure) queryResults;
%>
@@ -195,7 +199,12 @@
{
%>
<p>
- <table style="width:100%; border: 1px solid;" cellspacing="0" cellpadding="0">
+ <table style="width:100%;" class="portlet-def-table datatable" cellspacing="0" cellpadding="0">
+ <thead class="portlet-section-header">
+ <tr>
+ <td>Search results</td>
+ </tr>
+ </thead>
<%
for (IteratorStatus i = new IteratorStatus(queryResults.entries()); i.hasNext();)
{
@@ -237,6 +246,12 @@
</tr>
<%
}
+ if ( queryResults.resultSize() == 0 )
+ {
+ %><tr>
+ <td>Your search did not match any gadgets.</td>
+ </tr><%
+ }
%>
</table>
<table style="width:100%; border: none;" cellspacing="0" cellpadding="0">
16 years, 5 months
JBoss Portal SVN: r9215 - branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-30 05:27:26 -0500 (Fri, 30 Nov 2007)
New Revision: 9215
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
Log:
JBPORTAL-1822 On logout, redirect to the default page of the default portal
Modified: branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2007-11-30 09:27:05 UTC (rev 9214)
+++ branches/JBoss_Portal_Branch_2_6/core/src/main/org/jboss/portal/core/controller/classic/OtherResponseHandler.java 2007-11-30 10:27:26 UTC (rev 9215)
@@ -22,6 +22,10 @@
******************************************************************************/
package org.jboss.portal.core.controller.classic;
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+
import org.apache.log4j.Logger;
import org.jboss.portal.common.util.MarkupInfo;
import org.jboss.portal.core.controller.ControllerCommand;
@@ -39,8 +43,6 @@
import org.jboss.portal.core.controller.handler.ResponseHandlerException;
import org.jboss.portal.core.model.portal.Portal;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
-import org.jboss.portal.core.model.portal.PortalObjectId;
-import org.jboss.portal.core.model.portal.PortalObjectPath;
import org.jboss.portal.core.model.portal.command.view.ViewPageCommand;
import org.jboss.portal.core.theme.PageRendition;
import org.jboss.portal.server.ServerInvocation;
@@ -49,9 +51,6 @@
import org.jboss.portal.server.request.URLContext;
import org.jboss.portal.web.ServletContextDispatcher;
-import javax.servlet.ServletException;
-import java.io.IOException;
-
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision$
@@ -60,7 +59,7 @@
{
/** . */
- private static final PortalObjectId DEFAULT_PORTAL_PATH = PortalObjectId.parse("/default", PortalObjectPath.CANONICAL_FORMAT);
+ // private static final PortalObjectId DEFAULT_PORTAL_PATH = PortalObjectId.parse("/", PortalObjectPath.CANONICAL_FORMAT);
/** . */
private static final Logger log = Logger.getLogger(OtherResponseHandler.class);
@@ -97,7 +96,7 @@
if (location == null)
{
PortalObjectContainer portalObjectContainer = controllerContext.getController().getPortalObjectContainer();
- Portal portal = (Portal)portalObjectContainer.getObject(DEFAULT_PORTAL_PATH);
+ Portal portal = (Portal)portalObjectContainer.getContext().getDefaultPortal();
ViewPageCommand renderCmd = new ViewPageCommand(portal.getId());
URLContext urlContext = invocation.getServerContext().getURLContext();
location = controllerContext.renderURL(renderCmd, urlContext.asNonAuthenticated(), null);
@@ -115,7 +114,7 @@
if (location == null)
{
PortalObjectContainer portalObjectContainer = controllerContext.getController().getPortalObjectContainer();
- Portal portal = (Portal)portalObjectContainer.getObject(DEFAULT_PORTAL_PATH);
+ Portal portal = (Portal)portalObjectContainer.getContext().getDefaultPortal();
ViewPageCommand renderCmd = new ViewPageCommand(portal.getId());
URLContext urlContext = invocation.getServerContext().getURLContext();
location = controllerContext.renderURL(renderCmd, urlContext, null);
@@ -172,7 +171,7 @@
}
else if (controllerResponse instanceof UnavailableResourceResponse)
{
- UnavailableResourceResponse unavailable = (UnavailableResourceResponse)controllerResponse;
+ // UnavailableResourceResponse unavailable = (UnavailableResourceResponse)controllerResponse;
//
return HTTPResponse.sendNotFound();
16 years, 5 months
JBoss Portal SVN: r9214 - branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider.
by portal-commits@lists.jboss.org
Author: emuckenhuber
Date: 2007-11-30 04:27:05 -0500 (Fri, 30 Nov 2007)
New Revision: 9214
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java
Log:
quick-and-dirty workarounded google directory lookup bug
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java 2007-11-30 07:09:29 UTC (rev 9213)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java 2007-11-30 09:27:05 UTC (rev 9214)
@@ -112,7 +112,7 @@
throw new WidgetException("Cannot retrieve url: " + url);
}
- String string = new String(bytes);
+ String string = new String(bytes).replace("Fun & Games", "Fun & Games");
List data = null;
@@ -122,7 +122,8 @@
ObjectModelFactory factory = new GGWidgetDirectoryFactory();
// let the object model factory to create an instance of List and populate it with data from XML
- data = (List)unmarshaller.unmarshal(new ByteArrayInputStream(string.getBytes("UTF-8")), factory, null);
+ data = (List) unmarshaller.unmarshal(new ByteArrayInputStream(string.getBytes("UTF-8")), factory, null);
+
List entries = new ArrayList();
for (Iterator iterator = data.iterator(); iterator.hasNext();)
16 years, 5 months
JBoss Portal SVN: r9213 - in branches/JBoss_Portal_Branch_2_6: core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-11-30 02:09:29 -0500 (Fri, 30 Nov 2007)
New Revision: 9213
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/conf/hibernate/consumer/domain.hbm.xml
Log:
- JBPORTAL-1825:
+ Added support to display both current and expected registration information: modifications are made to the expected
version and only persisted if successful. Expected registration information is put in the session when the consumer
refreshes and issues are found.
+ Better handling of modifyRegistration status.
- JBPORTAL-1827: Properly handle empty registration prop description when registered and no error is sent by producer.
This was incorrectly interpreted as a need to modify the registration.
- Better ProducerInfo.refresh behavior.
- RefreshResult improvements:
+ Now remembers the service description that was used so that it can be reused by calling code if needed.
+ Simplified handling of appendToStatus.
- RegistrationInfo improvements:
+ Copy constructor.
+ Can now directly call refresh more easily.
+ Better handling of empty registration property descriptions for JBPORTAL-1827.
+ Use direct access to persistentConsumerName and persistentRegistrationHandle by Hibernate to avoid marking
a newly restored RegistrationInfo as modified.
- Some code moved to Java 5.
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-11-30 07:09:29 UTC (rev 9213)
@@ -27,13 +27,13 @@
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.RefreshResult;
import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.Map;
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
@@ -47,7 +47,7 @@
private Boolean useWSDL = null;
private ConsumerManagerBean manager;
private boolean modified;
- private boolean registrationModified;
+ private boolean registrationLocallyModified;
private String serviceDescription;
private String markup;
@@ -55,6 +55,8 @@
private String registration;
private String wsdl;
+ private transient RegistrationInfo expectedRegistrationInfo;
+
public ConsumerBean()
{
useWSDL = Boolean.TRUE; // use WSDL by default
@@ -72,7 +74,7 @@
public boolean isModified()
{
- return modified || registrationModified;
+ return modified || getProducerInfo().isModifyRegistrationRequired() || isRegistrationLocallyModified();
}
public boolean isUseWSDL()
@@ -233,9 +235,14 @@
public boolean isRegistrationModified()
{
- return registrationModified;
+ return getProducerInfo().isModifyRegistrationRequired();
}
+ public boolean isRegistrationLocallyModified()
+ {
+ return registrationLocallyModified;
+ }
+
public boolean isRegistrationChecked()
{
return getProducerInfo().isRegistrationChecked();
@@ -260,6 +267,17 @@
return getProducerInfo().hasLocalRegistrationInfo();
}
+ public RegistrationInfo getExpectedRegistrationInfo()
+ {
+ if (expectedRegistrationInfo == null)
+ {
+ Map sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
+ expectedRegistrationInfo = (RegistrationInfo)sessionMap.get(ConsumerManagerBean.EXPECTED_REG_INFO_KEY);
+ }
+
+ return expectedRegistrationInfo;
+ }
+
// Actions
public String update()
@@ -302,7 +320,7 @@
{
registry.updateProducerInfo(prodInfo);
modified = false;
- registrationModified = false;
+ registrationLocallyModified = false;
}
public String refreshConsumer()
@@ -318,15 +336,7 @@
}
}
- RefreshResult result = manager.refresh(consumer);
- if (result.hasIssues())
- {
- registrationModified = true; // if we have issues, it might indicate a need to modify the registration
- }
- else
- {
- registrationModified = false;
- }
+ manager.refresh(consumer);
return ConsumerManagerBean.CONFIGURE_CONSUMER;
}
@@ -339,28 +349,57 @@
{
if (consumer != null)
{
- if (registrationModified)
+ ProducerInfo info = getProducerInfo();
+ if (isModified())
{
+ // get updated registration info
+ RegistrationInfo newReg = getExpectedRegistrationInfo();
+
+ // check that we have the proper state: need to check before saving modifications as this will reset the modified status
+ if (newReg == null && !isRegistrationLocallyModified())
+ {
+ IllegalStateException e =
+ new IllegalStateException("Registration not locally modified: there should be expected registration from producer!");
+ log.debug(e);
+ throw e;
+ }
+
+ // make sure we save any modified registration properties
+ saveToRegistry(info);
+
+ // save old info in case something goes wrong
+ RegistrationInfo oldReg = getProducerInfo().getRegistrationInfo();
+
+ // if we want to change an existing registration property (for example, to upgrade service) then there are
+ // no expected information, we're just using the modified local version
+ if (newReg == null)
+ {
+ newReg = oldReg;
+ }
+
try
{
- ProducerInfo info = getProducerInfo();
- saveToRegistry(info); // make sure we save any modified registration properties
-
// todo: this should be done better cf regPropListener
- getProducerInfo().getRegistrationInfo().setModified(true); // mark as modified to force refresh of RegistrationData
+ newReg.setModified(true); // mark as modified to force refresh of RegistrationData
+ // attempt to modify the registration using new registration info
+ info.setRegistrationInfo(newReg);
info.modifyRegistration();
- getProducerInfo().getRegistrationInfo().setModified(false);
+ newReg.setModified(false);
+ registrationLocallyModified = false;
+
beanContext.createInfoMessage("Successfully modified Registration!");
- registrationModified = false;
-
- refreshConsumer();
}
catch (Exception e)
{
+ // restore old info
+ info.setRegistrationInfo(oldReg);
+
beanContext.createErrorMessageFrom(e);
return null;
}
+
+ refreshConsumer();
return null;
}
else
@@ -423,7 +462,7 @@
{
// todo: should use modifyIfNeeded but it might be tricky as the name of the property that has been changed
// cannot be easily retrieved (we cannot use it as an id directly), could use title but that would be hackish
- registrationModified = true;
+ registrationLocallyModified = true;
// bypass the rest of the life cycle and re-display page
FacesContext.getCurrentInstance().renderResponse();
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2007-11-30 07:09:29 UTC (rev 9213)
@@ -27,6 +27,7 @@
import org.jboss.portal.wsrp.WSRPConsumer;
import org.jboss.portal.wsrp.consumer.ConsumerRegistry;
import org.jboss.portal.wsrp.consumer.RefreshResult;
+import org.jboss.portal.wsrp.consumer.RegistrationInfo;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
@@ -47,6 +48,7 @@
static final String CONFIGURE_CONSUMER = "configureConsumer";
static final String INDEX = "index";
+ static final String EXPECTED_REG_INFO_KEY = "expectedRegistrationInfo";
public ConsumerRegistry getRegistry()
{
@@ -226,8 +228,15 @@
try
{
RefreshResult result = consumer.refresh(true);
+
+
if (result.hasIssues())
{
+ // create the expected registration info and make it available
+ RegistrationInfo expected = new RegistrationInfo(consumer.getProducerInfo().getRegistrationInfo());
+ expected.refresh(result.getServiceDescription(), consumer.getProducerId(), true, true, true);
+ setExpectedRegistrationInfo(expected);
+
beanContext.createErrorMessage(result.getStatus());
// refresh had issues, we should deactivate this consumer
@@ -259,11 +268,18 @@
RefreshResult refresh(WSRPConsumer consumer)
{
RefreshResult result = internalRefresh(consumer);
+
selectedId = consumer.getProducerId();
setConsumerIdInSession(false);
return result;
}
+ private void setExpectedRegistrationInfo(RegistrationInfo expected)
+ {
+ Map sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
+ sessionMap.put(EXPECTED_REG_INFO_KEY, expected);
+ }
+
public String listConsumers()
{
setConsumerIdInSession(true);
@@ -287,8 +303,10 @@
{
Map sessionMap = FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
String consumerBeanName = "consumer"; // must match ConsumerBean name in faces-config.xml
- sessionMap.remove(consumerBeanName); // force recreation of ConsumerBean
+ // force recreation of ConsumerBean otherwise switching to the consumer view might not show the proper consumer
+ sessionMap.remove(consumerBeanName);
+
if (!remove)
{
sessionMap.put(CONSUMER_ID, selectedId);
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-11-30 07:09:29 UTC (rev 9213)
@@ -79,41 +79,79 @@
<td>
<c:choose>
<c:when test="#{consumer.localInfoPresent}">
- <c:choose>
- <c:when test="#{!empty consumer.producerInfo.registrationInfo.registrationProperties}">
- <table class="registration-prop-table #{consumer.active ? 'active' : 'inactive'}">
- <tr>
- <th class="nameColumn">Name</th>
- <th class="descColumn">Description</th>
- <th>Value</th>
- </tr>
- <c:forEach items="#{consumer.producerInfo.registrationInfo.registrationProperties}" var="prop">
- <tr title="#{prop.description.label.value}">
- <td>#{prop.name}</td>
- <td>#{prop.description.label.value}</td>
- <td>
- <h:inputText value="#{prop.value}" size="50" onchange="this.form.submit()"
- immediate="true" valueChangeListener="#{consumer.regPropListener}"/>
- <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
- rendered="#{prop.determinedInvalid}"/>
- </td>
- </tr>
- </c:forEach>
- <c:if test="#{consumer.registrationModified}">
+ <h3 class="portlet-area-header">Current registration information:</h3>
+ <h:panelGroup styleClass="portlet-area-body">
+ <c:choose>
+ <c:when test="#{!empty consumer.producerInfo.registrationInfo.registrationProperties}">
+ <table class="registration-prop-table #{consumer.active ? 'active' : 'inactive'}">
<tr>
- <td colspan="3">
- <h:commandLink action="#{consumer.modifyRegistration}" value="Modify registration"
- title="Modify the registration held with this Producer"
- styleClass="portlet-form-button portlet-section-buttonrow"/>
- </td>
+ <th class="nameColumn">Name</th>
+ <th class="descColumn">Description</th>
+ <th>Value</th>
</tr>
- </c:if>
- </table>
- </c:when>
- <c:otherwise>
- Registration is indicated as required without registration properties.
- </c:otherwise>
- </c:choose>
+ <c:forEach items="#{consumer.producerInfo.registrationInfo.registrationProperties}"
+ var="prop">
+ <tr title="#{prop.description.label.value}">
+ <td>#{prop.name}</td>
+ <td>#{prop.description.label.value}</td>
+ <td>
+ <h:inputText value="#{prop.value}" size="50" onblur="this.form.submit()"
+ immediate="true" valueChangeListener="#{consumer.regPropListener}"
+ disabled="#{consumer.registrationModified}"/>
+ <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
+ rendered="#{prop.determinedInvalid}"/>
+ </td>
+ </tr>
+ </c:forEach>
+ </table>
+ </c:when>
+ <c:otherwise>
+ Registration is indicated as required without registration properties.
+ </c:otherwise>
+ </c:choose>
+ <h:commandLink action="#{consumer.modifyRegistration}" value="Modify registration"
+ rendered="#{consumer.registrationLocallyModified}"
+ title="Modify the registration held with this Producer"
+ styleClass="portlet-form-button portlet-section-buttonrow"/>
+ <br style="clear:both;"/>
+ </h:panelGroup>
+
+ <br/>
+
+ <c:if test="#{consumer.registrationModified}">
+ <h3 class="portlet-area-header">Expected registration information:</h3>
+ <h:panelGroup styleClass="portlet-area-body">
+ <c:choose>
+ <c:when test="#{!empty consumer.expectedRegistrationInfo.registrationProperties}">
+ <table class="registration-prop-table #{consumer.active ? 'active' : 'inactive'}">
+ <tr>
+ <th class="nameColumn">Name</th>
+ <th class="descColumn">Description</th>
+ <th>Value</th>
+ </tr>
+ <c:forEach items="#{consumer.expectedRegistrationInfo.registrationProperties}" var="prop">
+ <tr title="#{prop.description.label.value}">
+ <td>#{prop.name}</td>
+ <td>#{prop.description.label.value}</td>
+ <td>
+ <h:inputText value="#{prop.value}" size="50"/>
+ <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
+ rendered="#{prop.determinedInvalid}"/>
+ </td>
+ </tr>
+ </c:forEach>
+ </table>
+ </c:when>
+ <c:otherwise>
+ Registration is indicated as required without registration properties.
+ </c:otherwise>
+ </c:choose>
+ <h:commandLink action="#{consumer.modifyRegistration}" value="Modify registration"
+ title="Modify the registration held with this Producer"
+ styleClass="portlet-form-button portlet-section-buttonrow"/>
+ <br style="clear:both;"/>
+ </h:panelGroup>
+ </c:if>
</c:when>
<c:when test="#{consumer.registrationChecked and !consumer.registrationRequired}">
Producer doesn't require registration.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/ProducerInfoTestCase.java 2007-11-30 07:09:29 UTC (rev 9213)
@@ -91,7 +91,7 @@
assertTrue(info.isRegistrationChecked());
assertEquals(2, behavior.getCallCount());
- info.setExpirationCacheSeconds(new Integer(1));
+ info.setExpirationCacheSeconds(1);
assertEquals(new Integer(1), info.getExpirationCacheSeconds());
assertTrue(info.refresh(false));
assertFalse(info.refresh(false));
@@ -270,6 +270,7 @@
regInfo.setRegistrationPropertyValue(TestRegistrationBehavior.PROP_NAME, "invalid");
assertTrue(info.isRefreshNeeded(false));
assertTrue(info.isRegistered());
+ assertTrue(info.isModifyRegistrationRequired());
RegistrationProperty prop = regInfo.getRegistrationProperty(TestRegistrationBehavior.PROP_NAME);
assertNull(prop.isInvalid());
@@ -285,16 +286,18 @@
regInfo.setRegistrationPropertyValue(TestRegistrationBehavior.PROP_NAME, TestRegistrationBehavior.MODIFIED_VALUE);
assertTrue(info.isRefreshNeeded(false));
assertNull(prop.isInvalid());
+ assertTrue(info.isModifyRegistrationRequired());
info.modifyRegistration();
assertTrue(info.isRefreshNeeded(true)); // cache should have been invalidated
assertFalse(info.isRefreshNeeded(false)); // but the rest of the information is valid so no refresh needed there
assertTrue(info.refresh(false)); // however, if we refresh the producer info, it should have refreshed
+ assertFalse(info.isModifyRegistrationRequired());
Boolean invalid = prop.isInvalid();
assertNotNull(invalid);
- assertFalse(invalid.booleanValue());
+ assertFalse(invalid);
}
private static class TestPortletManagementBehavior extends PortletManagementBehavior
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2007-11-30 07:09:29 UTC (rev 9213)
@@ -70,6 +70,8 @@
// and we don't know if the registration is valid
assertNull(info.isRegistrationValid());
+ assertFalse(info.isModified());
+
try
{
info.isRegistrationDeterminedNotRequired();
@@ -93,7 +95,11 @@
{
String key = "foo";
info.setRegistrationPropertyValue(key, "bar");
+
+ // check status
assertNull(info.isConsistentWithProducerExpectations());
+ assertTrue(info.isModified());
+
Map properties = info.getRegistrationProperties();
assertFalse(properties.isEmpty());
Set names = info.getRegistrationPropertyNames();
@@ -108,10 +114,12 @@
public void testRegistrationPropertiesAndRefresh()
{
info.setRegistrationPropertyValue("prop0", "value0");
- RefreshResult result = info.refresh(createServiceDescription(true, 1), producerId, true, false);
+ RefreshResult result = info.refresh(createServiceDescription(true, 1), producerId, true, false, false);
RegistrationProperty prop = info.getRegistrationProperty("prop0");
assertNull(prop.isInvalid());
assertFalse(result.hasIssues());
+ assertFalse(info.isModified());
+ assertTrue(info.isConsistentWithProducerExpectations());
// specifiy that the prop is valid to simulate a successful registration (integration test, should have something
// testing that in ProducerInfoTestCase)
@@ -128,7 +136,7 @@
{
// no registration expected
ServiceDescription sd = createServiceDescription(false, 0);
- RefreshResult result = info.refresh(sd, producerId, true, false);
+ RefreshResult result = info.refresh(sd, producerId, true, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
assertTrue(info.isConsistentWithProducerExpectations().booleanValue());
@@ -137,7 +145,7 @@
assertFalse(info.isRegistrationDeterminedRequired());
assertTrue(info.isRegistrationValid().booleanValue());
- result = info.refresh(sd, producerId, false, false);
+ result = info.refresh(sd, producerId, false, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
assertTrue(info.isConsistentWithProducerExpectations().booleanValue());
@@ -154,7 +162,7 @@
assertNull(info.isRegistrationValid());
RegistrationInfo.RegistrationRefreshResult result = info.refresh(
- createServiceDescription(true, 0), producerId, true, false);
+ createServiceDescription(true, 0), producerId, true, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
assertTrue(info.isRegistrationRequired().booleanValue());
@@ -169,7 +177,7 @@
info.setRegistrationPropertyValue("foo", "bar");
RegistrationInfo.RegistrationRefreshResult result = info.refresh(
- createServiceDescription(true, 0), producerId, false, false);
+ createServiceDescription(true, 0), producerId, false, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
String status = result.getStatus();
@@ -193,7 +201,7 @@
// producer requests 2 registration properties
ServiceDescription sd = createServiceDescription(true, 2);
- RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId, false, false);
+ RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId, false, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
String status = result.getStatus();
@@ -216,7 +224,7 @@
info.setRegistrationPropertyValue("foo", "bar");
RegistrationInfo.RegistrationRefreshResult result = info.refresh(createServiceDescription(true, 2),
- producerId, true, false);
+ producerId, true, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
@@ -240,29 +248,29 @@
public void testForceRefreshRegistration()
{
//
- RefreshResult result = info.refresh(createServiceDescription(true, 0), producerId, false, false);
+ RefreshResult result = info.refresh(createServiceDescription(true, 0), producerId, false, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
assertFalse(info.isRegistrationValid().booleanValue());
// Modifying a property renders the info dirty and hence should be refreshed
info.setRegistrationPropertyValue("foo", "bar");
- result = info.refresh(createServiceDescription(true, 0), producerId, false, false);
+ result = info.refresh(createServiceDescription(true, 0), producerId, false, false, false);
assertTrue(result.hasIssues());
assertFalse(info.isRegistrationValid().booleanValue());
info.removeRegistrationProperty("foo");
- result = info.refresh(createServiceDescription(true, 0), producerId, false, false);
+ result = info.refresh(createServiceDescription(true, 0), producerId, false, false, false);
assertFalse(result.hasIssues());
assertFalse(info.isRegistrationValid().booleanValue());
// producer has changed but we're not forcing refresh so registration should still be invalid
- result = info.refresh(createServiceDescription(false, 0), producerId, false, false);
+ result = info.refresh(createServiceDescription(false, 0), producerId, false, false, false);
assertFalse(result.hasIssues());
assertFalse(info.isRegistrationValid().booleanValue());
// force refresh, registration should now be valid
- result = info.refresh(createServiceDescription(false, 0), producerId, false, true);
+ result = info.refresh(createServiceDescription(false, 0), producerId, false, true, false);
assertFalse(result.hasIssues());
assertTrue(info.isRegistrationValid().booleanValue());
}
@@ -310,6 +318,30 @@
assertEquals("value1", properties[0].getStringValue());
}
+ public void testRefreshWhileRegisteredAndProducerNotSendingPropertyDescriptions()
+ {
+ info.setRegistrationPropertyValue("prop0", "value0");
+ info.refresh(createServiceDescription(true, 1), producerId, true, true, false);
+
+ // simulate successful registration
+ info.setRegistrationContext(WSRPTypeFactory.createRegistrationContext("handle"));
+
+ assertTrue(info.isRegistrationRequired());
+ assertTrue(info.isRegistrationValid());
+
+ ServiceDescription description = createServiceDescription(true, 0);
+ info.refresh(description, producerId, true, true, false);
+ assertTrue(info.isRegistrationValid());
+ RegistrationProperty prop = info.getRegistrationProperty("prop0");
+ assertNotNull(prop);
+ assertFalse(prop.isInvalid());
+
+ // check that forcing check of extra properties work
+ info.refresh(description, producerId, true, true, true);
+ assertFalse(info.isRegistrationValid());
+ assertNull(info.getRegistrationProperty("prop0"));
+ }
+
private ServiceDescription createServiceDescription(boolean requiresRegistration, int numberOfProperties)
{
return ServiceDescriptionBehavior.createServiceDescription(requiresRegistration, numberOfProperties);
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-11-30 07:09:29 UTC (rev 9213)
@@ -41,6 +41,7 @@
import org.jboss.portal.wsrp.core.InvalidHandleFault;
import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.ModifyRegistration;
+import org.jboss.portal.wsrp.core.OperationFailedFault;
import org.jboss.portal.wsrp.core.PortletDescription;
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
import org.jboss.portal.wsrp.core.PortletPropertyDescriptionResponse;
@@ -103,6 +104,8 @@
/** Time at which the cache expires */
private long expirationTimeMillis;
+ private boolean isModifyRegistrationRequired;
+
private ConsumerRegistry registry;
private static final String REGISTER_MEANING = "Should clients ask for a new service description?";
private static final String REFRESH_MEANING = "Did just refresh?";
@@ -158,7 +161,7 @@
return persistentRegistrationInfo;
}
- void setRegistrationInfo(RegistrationInfo registrationInfo)
+ public void setRegistrationInfo(RegistrationInfo registrationInfo)
{
this.persistentRegistrationInfo = registrationInfo;
}
@@ -223,6 +226,11 @@
registry.updateProducerInfo(this);
}
+ public boolean isModifyRegistrationRequired()
+ {
+ return isModifyRegistrationRequired || (persistentRegistrationInfo != null && persistentRegistrationInfo.isModified());
+ }
+
CookieProtocol getRequiresInitCookie()
{
return requiresInitCookie;
@@ -288,25 +296,56 @@
// save changes to endpoint
registry.updateProducerInfo(this);
- // if we don't yet have registration information, get an unregistered service description
- serviceDescription = getServiceDescription(persistentRegistrationInfo == null);
+ boolean registeredSDSucceeded = true;
+ try
+ {
+ // if we don't yet have registration information, get an unregistered service description
+ serviceDescription = getUnmanagedServiceDescription(persistentRegistrationInfo == null);
+ result.setServiceDescription(serviceDescription);
+ }
+ catch (OperationFailedFault operationFailedFault)
+ {
+ if (hasLocalRegistrationInfo())
+ {
+ log.debug("OperationFailedFault occurred, might indicate a need to modify registration");
+ registeredSDSucceeded = false;
+ // attempt to get unregistered service description
+ serviceDescription = getServiceDescription(true);
+ result.setServiceDescription(serviceDescription);
+ // validate the registration information
+ RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, false, true, true);
+ if (registrationResult.hasIssues())
+ {
+ isModifyRegistrationRequired = true;
+ setActiveAndSave(false);
+ }
+
+ result.appendToStatus(registrationResult.getStatus());
+ result.setHasIssues(registrationResult.hasIssues());
+ return result;
+ }
+ else
+ {
+ serviceDescription = rethrowAsInvokerUnvailable(operationFailedFault);
+ }
+ }
+
// do we need to call initCookie or not?
requiresInitCookie = serviceDescription.getRequiresInitCookie();
// do we need to register?
if (serviceDescription.isRequiresRegistration())
{
+ // refresh and force check for extra props if the registered SD failed
+ RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, true, forceRefresh, !registeredSDSucceeded);
+ registry.updateProducerInfo(this);
+
+ result.appendToStatus(registrationResult.getStatus());
+
// attempt to register and determine if the current service description can be used to extract POPs
- RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, true, forceRefresh);
- String status = registrationResult.getStatus();
- if (status != null)
+ if (registeredSDSucceeded && !registrationResult.hasIssues())
{
- result.appendToStatus(status);
- }
-
- if (!registrationResult.hasIssues())
- {
registrationResult = register(serviceDescription, false);
if (registrationResult.specificCode())
{
@@ -318,11 +357,7 @@
extractOfferedPortlets(serviceDescription);
}
- status = registrationResult.getStatus();
- if (status != null)
- {
- result.appendToStatus(status);
- }
+ result.appendToStatus(registrationResult.getStatus());
result.setHasIssues(registrationResult.hasIssues());
result.appendToStatus("Producer information successfully refreshed");
@@ -573,7 +608,7 @@
this.persistentExpirationCacheSeconds = expirationCacheSeconds;
}
- private ServiceDescription getServiceDescription(boolean asUnregistered) throws PortletInvokerException
+ private ServiceDescription getUnmanagedServiceDescription(boolean asUnregistered) throws PortletInvokerException, OperationFailedFault
{
GetServiceDescription request = getServiceDescriptionRequest(asUnregistered);
@@ -596,20 +631,41 @@
{
log.debug("Caught Exception in getServiceDescription:\n", e);
+ // de-activate
+ setActiveAndSave(false);
+
if (e instanceof InvalidRegistrationFault)
{
resetRegistration();
}
+ else if (e instanceof OperationFailedFault)
+ {
+ throw (OperationFailedFault)e; // rethrow to deal at higher level as meaning can vary depending on context
+ }
- // de-activate
- setActiveAndSave(false);
+ return rethrowAsInvokerUnvailable(e);
+ }
+ }
- Throwable cause = e.getCause();
- throw new InvokerUnavailableException("Problem getting service description for producer "
- + persistentId, cause == null ? e : cause);
+ ServiceDescription getServiceDescription(boolean asUnregistered) throws PortletInvokerException
+ {
+ try
+ {
+ return getUnmanagedServiceDescription(asUnregistered);
}
+ catch (OperationFailedFault operationFailedFault)
+ {
+ return rethrowAsInvokerUnvailable(operationFailedFault);
+ }
}
+ private ServiceDescription rethrowAsInvokerUnvailable(Exception e) throws InvokerUnavailableException
+ {
+ Throwable cause = e.getCause();
+ throw new InvokerUnavailableException("Problem getting service description for producer "
+ + persistentId + ", please see the logs for more information.", cause == null ? e : cause);
+ }
+
private GetServiceDescription getServiceDescriptionRequest(boolean asUnregistred) throws PortletInvokerException
{
//todo: might need to implement customization of default service description
@@ -721,7 +777,7 @@
if (serviceDescription.isRequiresRegistration())
{
// check if the configured registration information is correct and if we can get the service description
- RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription, persistentId, true, forceRefresh);
+ RefreshResult result = persistentRegistrationInfo.refresh(serviceDescription, persistentId, true, forceRefresh, false);
if (!result.hasIssues())
{
try
@@ -739,7 +795,7 @@
persistentRegistrationInfo.setRegistrationContext(registrationContext);
String msg = "Consumer with id '" + persistentId + "' successfully registered with handle: '"
+ registrationContext.getRegistrationHandle() + "'";
- log.info(msg);
+ log.debug(msg);
result.appendToStatus("\n").append(msg);
return new RefreshResult(result, true, REGISTER_MEANING);
}
@@ -756,7 +812,7 @@
}
else
{
- log.info(result.getStatus());
+ log.debug(result.getStatus());
setActiveAndSave(false);
throw new PortletInvokerException("Consumer is not ready to be registered with producer because of missing or invalid registration information.");
}
@@ -798,7 +854,7 @@
public void modifyRegistration() throws PortletInvokerException
{
- if (isRegistered())
+ if (persistentRegistrationInfo != null && persistentRegistrationInfo.getRegistrationHandle() != null)
{
persistentEndpointInfo.refresh();
@@ -812,6 +868,9 @@
// force refresh of internal RegistrationInfo state
persistentRegistrationInfo.setRegistrationValidInternalState();
+ // registration is not modified anymore :)
+ isModifyRegistrationRequired = false;
+
if (state != null)
{
persistentRegistrationInfo.setRegistrationState(state.getRegistrationState());
@@ -845,29 +904,17 @@
}
}
- public RefreshResult refreshRegistrationInfo(boolean mergeWithLocalInfo) throws PortletInvokerException
+ private RefreshResult internalRefreshRegistration(ServiceDescription serviceDescription, boolean mergeWithLocalInfo, boolean forceRefresh, boolean forceCheckOfExtraProps) throws PortletInvokerException
{
- return internalRefreshRegistration(getServiceDescription(true), mergeWithLocalInfo, true);
- }
-
- private RefreshResult internalRefreshRegistration(ServiceDescription serviceDescription, boolean mergeWithLocalInfo, boolean forceRefresh) throws PortletInvokerException
- {
if (persistentRegistrationInfo == null)
{
persistentRegistrationInfo = new RegistrationInfo(this);
}
- RefreshResult result;
- try
- {
- result = persistentRegistrationInfo.refresh(serviceDescription, persistentId, mergeWithLocalInfo, forceRefresh);
- }
- finally
- {
- registry.updateProducerInfo(this);
- }
+ RefreshResult result =
+ persistentRegistrationInfo.refresh(serviceDescription, persistentId, mergeWithLocalInfo, forceRefresh, forceCheckOfExtraProps);
- log.info("Refreshed registration information for consumer with id '" + persistentId + "'");
+ log.debug("Refreshed registration information for consumer with id '" + persistentId + "'");
return result;
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2007-11-30 07:09:29 UTC (rev 9213)
@@ -23,6 +23,8 @@
package org.jboss.portal.wsrp.consumer;
+import org.jboss.portal.wsrp.core.ServiceDescription;
+
/**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
@@ -30,10 +32,11 @@
*/
public class RefreshResult
{
- private StringBuffer status;
+ private StringBuffer status = new StringBuffer();
private boolean hasIssues;
private boolean specificCode;
private final String meaning;
+ private ServiceDescription serviceDescription;
public RefreshResult(boolean specificCode, String specificCodeMeaning)
{
@@ -44,11 +47,7 @@
public RefreshResult(RefreshResult previous, boolean specificCode, String specificCodeMeaning)
{
this(specificCode, specificCodeMeaning);
- String status = previous.getStatus();
- if (status != null)
- {
- appendToStatus(status);
- }
+ appendToStatus(previous.getStatus());
setHasIssues(previous.hasIssues);
}
@@ -64,25 +63,15 @@
public String getStatus()
{
- if (status == null)
- {
- return null;
- }
-
return status.toString();
}
StringBuffer appendToStatus(String message)
{
- if (status == null)
+ if (message != null && message.length() > 1)
{
- status = new StringBuffer(message);
- }
- else
- {
status.append(".\n").append(message);
}
-
return status;
}
@@ -100,4 +89,14 @@
{
return meaning;
}
+
+ public void setServiceDescription(ServiceDescription serviceDescription)
+ {
+ this.serviceDescription = serviceDescription;
+ }
+
+ public ServiceDescription getServiceDescription()
+ {
+ return serviceDescription;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2007-11-30 07:09:29 UTC (rev 9213)
@@ -25,6 +25,7 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
+import org.jboss.portal.portlet.PortletInvokerException;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
import org.jboss.portal.wsrp.WSRPUtils;
@@ -65,18 +66,20 @@
private transient Boolean consistentWithProducerExpectations;
private transient RegistrationData registrationData;
private transient boolean dirty;
+ private transient ProducerInfo parent;
public RegistrationInfo(ProducerInfo producerInfo)
{
this();
ParameterValidation.throwIllegalArgExceptionIfNull(producerInfo, "ProducerInfo");
producerInfo.setRegistrationInfo(this);
+ parent = producerInfo;
}
public RegistrationInfo(ProducerInfo producerInfo, boolean requiresRegistration)
{
this(producerInfo);
- this.requiresRegistration = Boolean.valueOf(requiresRegistration);
+ this.requiresRegistration = requiresRegistration;
}
public RegistrationInfo()
@@ -84,6 +87,32 @@
persistentConsumerName = WSRPConstants.DEFAULT_CONSUMER_NAME;
}
+ public RegistrationInfo(RegistrationInfo other)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(other, "RegistrationInfo to clone from");
+ this.persistentConsumerName = other.persistentConsumerName;
+ this.persistentRegistrationHandle = other.persistentRegistrationHandle;
+
+ if (other.persistentRegistrationState != null)
+ {
+ this.persistentRegistrationState = new byte[other.persistentRegistrationState.length];
+ System.arraycopy(other.persistentRegistrationState, 0, this.persistentRegistrationState, 0, other.persistentRegistrationState.length);
+ }
+
+ if (other.persistentRegistrationProperties != null)
+ {
+ this.persistentRegistrationProperties = new HashMap(other.persistentRegistrationProperties.size());
+ for (Object o : other.persistentRegistrationProperties.values())
+ {
+ RegistrationProperty otherProp = (RegistrationProperty)o;
+ String name = otherProp.getName();
+ RegistrationProperty prop = new RegistrationProperty(name, otherProp.getValue(), otherProp.getLang());
+ prop.setStatus(otherProp.getStatus());
+ this.persistentRegistrationProperties.put(name, prop);
+ }
+ }
+ }
+
public Long getKey()
{
return key;
@@ -114,9 +143,19 @@
this.persistentRegistrationState = registrationState;
}
+ public ProducerInfo getParent()
+ {
+ return parent;
+ }
+
+ public void setParent(ProducerInfo parent)
+ {
+ this.parent = parent;
+ }
+
public boolean isRefreshNeeded()
{
- boolean result = isModified() || requiresRegistration == null;
+ boolean result = requiresRegistration == null || isModified();
if (result)
{
log.debug("Refresh needed");
@@ -130,10 +169,12 @@
{
return null;
}
+ return consistentWithProducerExpectations && hasRegisteredIfNeeded();
+ }
- boolean hasRegisteredIfNeeded =
- (persistentRegistrationHandle != null && isRegistrationDeterminedRequired()) || isRegistrationDeterminedNotRequired();
- return Boolean.valueOf(consistentWithProducerExpectations.booleanValue() && hasRegisteredIfNeeded);
+ private boolean hasRegisteredIfNeeded()
+ {
+ return (persistentRegistrationHandle != null && isRegistrationDeterminedRequired()) || isRegistrationDeterminedNotRequired();
}
public Boolean isConsistentWithProducerExpectations()
@@ -313,15 +354,36 @@
* @param producerId
* @param mergeWithLocalInfo
* @param forceRefresh
+ * @param forceCheckOfExtraProps
* @return
*/
public RegistrationRefreshResult refresh(ServiceDescription serviceDescription, String producerId,
- boolean mergeWithLocalInfo, boolean forceRefresh)
+ boolean mergeWithLocalInfo, boolean forceRefresh, boolean forceCheckOfExtraProps)
{
log.debug("RegistrationInfo refresh requested");
if (forceRefresh || isRefreshNeeded())
{
+ if (serviceDescription == null && parent != null)
+ {
+ try
+ {
+ serviceDescription = parent.getServiceDescription(true);
+ }
+ catch (PortletInvokerException e)
+ {
+ log.debug(e);
+ serviceDescription = null;
+ }
+ }
+
+ if (serviceDescription == null)
+ {
+ String msg = "Couldn't get a service description to refresh from!";
+ log.debug(msg);
+ throw new IllegalArgumentException(msg);
+ }
+
persistentRegistrationProperties = getOrCreateRegistrationPropertiesMap(true);
RegistrationRefreshResult result = new RegistrationRefreshResult();
@@ -387,12 +449,12 @@
}
else
{
- handleNoRequiredRegistrationProperties(producerId, result, !mergeWithLocalInfo);
+ handleNoRequiredRegistrationProperties(producerId, result, !mergeWithLocalInfo, forceCheckOfExtraProps);
}
}
else
{
- handleNoRequiredRegistrationProperties(producerId, result, !mergeWithLocalInfo);
+ handleNoRequiredRegistrationProperties(producerId, result, !mergeWithLocalInfo, forceCheckOfExtraProps);
}
}
else
@@ -427,20 +489,28 @@
}
}
- private void handleNoRequiredRegistrationProperties(String producerId, RegistrationRefreshResult result, boolean keepExtra)
+ private void handleNoRequiredRegistrationProperties(String producerId, RegistrationRefreshResult result, boolean keepExtra, boolean forceCheckOfExtraProps)
{
- log.info("The producer didn't require any specific registration properties");
+ log.debug("The producer didn't require any specific registration properties");
Map properties = getOrCreateRegistrationPropertiesMap(false);
if (properties != null && !properties.isEmpty())
{
String msg = "Registration data is available for producer '"
+ producerId + "' when none is expected by the producer";
- log.info(msg);
- checkForExtraProperties(producerId, result, Collections.EMPTY_SET, properties, keepExtra);
+ if (forceCheckOfExtraProps || !hasRegisteredIfNeeded())
+ {
+ log.debug(msg);
+ checkForExtraProperties(producerId, result, Collections.EMPTY_SET, properties, keepExtra);
+ }
+ else
+ {
+ log.debug("Consumer is registered: producer most likely did not resend property descriptions");
+ result.setHasIssues(false);
+ }
}
else
{
- log.info("Using default registration data for producer '" + producerId + "'");
+ log.debug("Using default registration data for producer '" + producerId + "'");
registrationData = WSRPTypeFactory.createDefaultRegistrationData();
result.setHasIssues(false);
}
@@ -461,10 +531,10 @@
{
StringBuffer message = new StringBuffer("The registration for producer '"
+ producerId + "' provided values for unexpected registration properties: ");
- for (Iterator invalidProps = unexpected.iterator(); invalidProps.hasNext();)
+ for (Object anUnexpected : unexpected)
{
- String name = (String)invalidProps.next();
- message.append("\t- ").append(name).append("\n");
+ String name = (String)anUnexpected;
+ message.append("\t- ").append(name);
if (keepExtra)
{
// mark the prop as invalid
@@ -477,10 +547,12 @@
}
else
{
+ message.append(" (was removed)");
properties.remove(name);
}
+ message.append("\n");
}
- log.info(message);
+ log.debug(message);
result.appendToStatus(message.toString());
result.setHasIssues(true);
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/conf/hibernate/consumer/domain.hbm.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/conf/hibernate/consumer/domain.hbm.xml 2007-11-30 01:31:05 UTC (rev 9212)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/resources/portal-wsrp-sar/conf/hibernate/consumer/domain.hbm.xml 2007-11-30 07:09:29 UTC (rev 9213)
@@ -25,7 +25,7 @@
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
- <hibernate-mapping>
+<hibernate-mapping>
<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" type="java.lang.Long">
@@ -74,8 +74,9 @@
<param name="sequence">wsrpconsumer_seq</param>
</generator>
</id>
- <property name="consumerName" column="CONSUMER_NAME" type="java.lang.String" not-null="true"/>
- <property name="registrationHandle" column="HANDLE" type="java.lang.String"/>
+ <property name="persistentConsumerName" column="CONSUMER_NAME" type="java.lang.String" not-null="true"
+ access="field"/>
+ <property name="persistentRegistrationHandle" column="HANDLE" type="java.lang.String" access="field"/>
<property name="registrationState" column="STATE" type="binary" length="50000000"/>
<map name="persistentRegistrationProperties" cascade="all,delete-orphan" lazy="false" access="field">
<cache usage="@portal.hibernate.cache.usage@"/>
16 years, 5 months
JBoss Portal SVN: r9212 - branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-29 20:31:05 -0500 (Thu, 29 Nov 2007)
New Revision: 9212
Modified:
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java
branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java
Log:
Remove System.out.println statements
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java 2007-11-30 01:24:27 UTC (rev 9211)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGQueryResultBuilder.java 2007-11-30 01:31:05 UTC (rev 9212)
@@ -134,7 +134,11 @@
GGQueryResultEntry entry = new GGQueryResultEntry(md);
entries.add(entry);
}
- System.out.println("fetchting directory took: " + NumberFormat.getInstance().format((System.currentTimeMillis() - millis) / 1000.0));
+ if (log.isDebugEnabled())
+ {
+ log.debug("Fetchting directory took: " + NumberFormat.getInstance().format((System.currentTimeMillis() - millis) / 1000.0));
+ }
+
//
return new GGQueryResult(entries);
}
Modified: branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java 2007-11-30 01:24:27 UTC (rev 9211)
+++ branches/JBoss_Portal_Branch_2_6/widget/src/main/org/jboss/portal/widget/google/provider/GGWidgetInfoBuilder.java 2007-11-30 01:31:05 UTC (rev 9212)
@@ -66,6 +66,8 @@
*/
public class GGWidgetInfoBuilder
{
+ /** . */
+ private static final org.jboss.logging.Logger log = org.jboss.logging.Logger.getLogger(GGWidgetInfoBuilder.class);
/** . */
private final URL url;
@@ -322,8 +324,11 @@
int width = (widthAttr != null && widthAttr.length() > 0) ? Integer.parseInt(widthAttr) : 320;
int height = (heightAttr != null && heightAttr.length() > 0) ? Integer.parseInt(heightAttr) : 200;
- System.out.println("fetchting & building gadget: " + url.toString() + " took: "
+ if (log.isDebugEnabled())
+ {
+ log.debug("fetchting & building gadget: " + url.toString() + " took: "
+ NumberFormat.getInstance().format((System.currentTimeMillis() - millis) / 1000.0));
+ }
return new GGWidgetInfo(title, directoryTitle, description, width, height, prefsInfo);
}
else
16 years, 5 months
JBoss Portal SVN: r9211 - in branches/JBoss_Portal_Branch_2_6/core-admin/src: resources/portal-admin-war/WEB-INF/jsf and 1 other directories.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-29 20:24:27 -0500 (Thu, 29 Nov 2007)
New Revision: 9211
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/confirm.xhtml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
Log:
JBPORTAL-1824 admin console: problem with deletion (portlet,page) and browser back button
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-11-29 23:40:15 UTC (rev 9210)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/main/org/jboss/portal/core/admin/ui/PortalObjectManagerBean.java 2007-11-30 01:24:27 UTC (rev 9211)
@@ -144,6 +144,9 @@
private PortalObject selectedObject;
/** . */
+ private PortalObject selectedDeletingObject;
+
+ /** . */
private PropertiesBean selectedProperties;
/** . */
@@ -371,6 +374,11 @@
return selectedObject;
}
+ public PortalObject getSelectedDeletingObject()
+ {
+ return selectedDeletingObject;
+ }
+
public PropertiesBean getSelectedProperties()
{
return selectedProperties;
@@ -428,6 +436,15 @@
selectObject();
}
+ public void selectDeletingObject(ActionEvent ae)
+ {
+ PortalObjectId poid = getSelectedPortalObjectId();
+
+ selectedDeletingObject = portalObjectContainer.getObject(poid);
+ selectObject();
+
+ }
+
public String makeObjectDefault()
{
PortalObjectId poid = getSelectedPortalObjectId();
@@ -528,7 +545,7 @@
Map pmap = getRequestParameterMap();
selectedPlugin = (String)pmap.get("plugin");
}
-
+
public Map getRequestParameterMap()
{
return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
@@ -573,15 +590,27 @@
PortalObjectId poid = PortalObjectId.parse(id, PortalObjectPath.LEGACY_BASE64_FORMAT);
PortalObject object = portalObjectContainer.getObject(poid);
- selectObject(object.getParent());
+ if (object != null)
+ {
+ selectObject(object.getParent());
- String stringMessage = object.getName() + " has successfully been destroyed";
+ String stringMessage = object.getName() + " has successfully been destroyed";
- //
- object.getParent().destroyChild(object.getName());
+ //
+ object.getParent().destroyChild(object.getName());
- FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, stringMessage, stringMessage);
- FacesContext.getCurrentInstance().addMessage("status", message);
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, stringMessage, stringMessage);
+ FacesContext.getCurrentInstance().addMessage("status", message);
+
+ selectedDeletingObject = null;
+ }
+ else
+ {
+ String stringMessage = "Cannot delete this already deleted object";
+
+ FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, stringMessage, stringMessage);
+ FacesContext.getCurrentInstance().addMessage("status", message);
+ }
}
}
catch (Exception e)
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/confirm.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/confirm.xhtml 2007-11-29 23:40:15 UTC (rev 9210)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/common/confirm.xhtml 2007-11-30 01:24:27 UTC (rev 9211)
@@ -12,6 +12,13 @@
<ui:param name="portalObjectScreen" value="Delete"/>
<ui:define name="content">
+ <f:subview rendered="#{empty portalobjectmgr.selectedDeletingObject}">
+ <p class="portlet-msg-error">Inconsistent state</p>
+ </f:subview>
+
+ <f:subview rendered="#{not empty portalobjectmgr.selectedDeletingObject}">
+
+
<div class="portlet-msg">
<div class="portlet-msg-icon"><h:graphicImage url="/img/msgIcon_Warning.gif" alt="/!\"/></div>
<div class="portlet-msg-body">
@@ -32,7 +39,7 @@
<h:form>
<h:commandButton value="Delete" action="objects" actionListener="#{portalobjectmgr.destroyObject}"
styleClass="portlet-form-button portlet-section-buttonrow">
- <f:attribute name="objectId" value="#{portalobjectmgr.selectedObject.id}"/>
+ <f:attribute name="objectId" value="#{portalobjectmgr.selectedDeletingObject.id}"/>
</h:commandButton>
<h:commandButton value="Cancel" action="objects"
actionListener="#{portalobjectmgr.selectParentObject}"
@@ -40,6 +47,7 @@
</h:form>
</div>
</div>
+ </f:subview>
</ui:define>
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml 2007-11-29 23:40:15 UTC (rev 9210)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPage.xhtml 2007-11-30 01:24:27 UTC (rev 9211)
@@ -43,7 +43,7 @@
<f:param name="id" value="#{portalobjectmgr.selectedObject.id}" />
Display Names
</h:commandLink> | </h:panelGroup><h:commandLink action="confirm" styleClass="actionDelete"
- actionListener="#{portalobjectmgr.selectObject}">
+ actionListener="#{portalobjectmgr.selectDeletingObject}">
<f:param name="id" value="#{portalobjectmgr.selectedObject.id}"/>
Delete
</h:commandLink>
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-11-29 23:40:15 UTC (rev 9210)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/objectNavigation.xhtml 2007-11-30 01:24:27 UTC (rev 9211)
@@ -56,7 +56,7 @@
</h:commandLink>
</h:panelGroup>
| <h:commandLink action="confirm" styleClass="actionDelete"
- actionListener="#{portalobjectmgr.selectObject}">
+ actionListener="#{portalobjectmgr.selectDeletingObject}">
<f:param name="id" value="#{object.id}"/>
Delete
</h:commandLink>
@@ -114,7 +114,7 @@
<f:param name="id" value="#{object.id}"/>
Display Names
</h:commandLink> |<h:commandLink action="confirm" styleClass="actionDelete"
- actionListener="#{portalobjectmgr.selectObject}">
+ actionListener="#{portalobjectmgr.selectDeletingObject}">
<f:param name="id" value="#{object.id}"/>
Delete
</h:commandLink>
@@ -189,7 +189,7 @@
actionListener="#{portalobjectmgr.selectObject}">
<f:param name="id" value="#{object.id}"/>
Rename
- </h:commandLink> | <h:commandLink action="confirm" actionListener="#{portalobjectmgr.selectObject}"
+ </h:commandLink> | <h:commandLink action="confirm" actionListener="#{portalobjectmgr.selectDeletingObject}"
styleClass="actionDelete">
<f:param name="id" value="#{object.id}"/>
Delete
16 years, 5 months
JBoss Portal SVN: r9210 - branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-29 18:40:15 -0500 (Thu, 29 Nov 2007)
New Revision: 9210
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
Thanks Prabhat
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-29 22:46:20 UTC (rev 9209)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-29 23:40:15 UTC (rev 9210)
@@ -449,79 +449,93 @@
<!--
| Uncomment in clustered mode : replicated cache for hibernate
@portal.single.xml.close@
- <mbean
- code="org.jboss.cache.TreeCache"
- name="portal:service=TreeCache,type=hibernate">
- <depends>jboss:service=Naming</depends>
- <depends>jboss:service=TransactionManager</depends>
- <attribute name="TransactionManagerLookupClass">org.jboss.cache.JBossTransactionManagerLookup</attribute>
- <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
- <attribute name="CacheMode">REPL_SYNC</attribute>
- <attribute name="ClusterName">portal.hibernate</attribute>
- <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
- <attribute name="ClusterConfig">
- <config>
- <UDP mcast_addr=224.0.0.36
- mcast_port=55566
- tos="8"
- ucast_recv_buf_size="20000000"
- ucast_send_buf_size="640000"
- mcast_recv_buf_size="25000000"
- mcast_send_buf_size="640000"
- loopback="false"
- discard_incompatible_packets="true"
- enable_bundling="false"
- max_bundle_size="64000"
- max_bundle_timeout="30"
- use_incoming_packet_handler="true"
- use_outgoing_packet_handler="false"
- ip_ttl="${jgroups.udp.ip_ttl:2}"
- down_thread="false" up_thread="false"/>
- <PING timeout="2000"
- down_thread="false" up_thread="false" num_initial_members="3"/>
- <MERGE2 max_interval="100000"
- down_thread="false" up_thread="false" min_interval="20000"/>
- <FD_SOCK down_thread="false" up_thread="false"/>
- <FD timeout="10000" max_tries="5" down_thread="false" up_thread="false" shun="true"/>
- <VERIFY_SUSPECT timeout="1500" down_thread="false" up_thread="false"/>
- <pbcast.NAKACK max_xmit_size="60000"
- use_mcast_xmit="false" gc_lag="0"
- retransmit_timeout="300,600,1200,2400,4800"
- down_thread="false" up_thread="false"
- discard_delivered_msgs="true"/>
- <UNICAST timeout="300,600,1200,2400,3600"
- down_thread="false" up_thread="false"/>
- <pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
- down_thread="false" up_thread="false"
- max_bytes="400000"/>
- <pbcast.GMS print_local_addr="true" join_timeout="3000"
- down_thread="false" up_thread="false"
- join_retry_timeout="2000" shun="true"
- view_bundling="true"/>
- <FRAG2 frag_size="60000" down_thread="false" up_thread="false"/>
- <pbcast.STATE_TRANSFER down_thread="false" up_thread="false" use_flush="false"/>
- </config>
- </attribute>
-
- <attribute name="EvictionPolicyClass">org.jboss.cache.eviction.LRUPolicy</attribute>
+ <mbean code="org.jboss.cache.TreeCache"
+ name="portal:service=TreeCache,type=hibernate">
+ <depends>jboss:service=Naming</depends>
+ <depends>jboss:service=TransactionManager</depends>
- <attribute name="EvictionPolicyConfig">
- <config>
- <attribute name="wakeUpIntervalSeconds">5</attribute>
- <region name="/_default_">
- <attribute name="maxNodes">5000</attribute>
- <attribute name="timeToLiveSeconds">1000</attribute>
- </region>
- </config>
- </attribute>
-
- </mbean>
+ <attribute name="TransactionManagerLookupClass">
+ org.jboss.cache.JBossTransactionManagerLookup
+ </attribute>
- <mbean
- code="org.jboss.portal.jems.hibernate.JBossTreeCacheProvider"
- name="portal:service=TreeCacheProvider,type=hibernate">
- <depends optional-attribute-name="CacheName">portal:service=TreeCache,type=hibernate</depends>
- </mbean>
+ <attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
+ <attribute name="IsolationLevel">REPEATABLE_READ</attribute>
+
+ <attribute name="CacheMode">REPL_SYNC</attribute>
+
+ <attribute name="ClusterName">
+ ${portal.hibernate.cache.partition.name:portal.hibernate}
+ </attribute>
+
+ <attribute name="InitialStateRetrievalTimeout">17500</attribute>
+
+ <attribute name="SyncReplTimeout">17500</attribute>
+
+ <attribute name="LockAcquisitionTimeout">15000</attribute>
+
+
+ <attribute name="EvictionPolicyClass">
+ org.jboss.cache.eviction.LRUPolicy
+ </attribute>
+ <attribute name="EvictionPolicyConfig">
+ <config>
+ <attribute name="wakeUpIntervalSeconds">5</attribute>
+
+ <region name="/_default_">
+ <attribute name="maxNodes">5000</attribute>
+ <attribute name="timeToLiveSeconds">1000</attribute>
+ </region>
+ </config>
+ </attribute>
+
+ <attribute name="ClusterConfig">
+ <config>
+ <UDP
+ mcast_addr="${jboss.partition.udpGroup:239.11.12.13}"
+ mcast_port="${portal.hibernate.cache.udpPort:23456}" tos="8"
+ ucast_recv_buf_size="20000000" ucast_send_buf_size="640000"
+ mcast_recv_buf_size="25000000" mcast_send_buf_size="640000"
+ loopback="false" discard_incompatible_packets="true"
+ enable_bundling="false" max_bundle_size="64000"
+ max_bundle_timeout="30" use_incoming_packet_handler="true"
+ use_outgoing_packet_handler="false"
+ ip_ttl="${jgroups.udp.ip_ttl:2}" down_thread="false"
+ up_thread="false" />
+ <PING timeout="2000" down_thread="false"
+ up_thread="false" num_initial_members="3" />
+ <MERGE2 max_interval="100000" down_thread="false"
+ up_thread="false" min_interval="20000" />
+ <FD_SOCK down_thread="false" up_thread="false" />
+ <FD timeout="10000" max_tries="5" down_thread="false"
+ up_thread="false" shun="true" />
+ <VERIFY_SUSPECT timeout="1500" down_thread="false"
+ up_thread="false" />
+ <pbcast.NAKACK max_xmit_size="60000"
+ use_mcast_xmit="false" gc_lag="0"
+ retransmit_timeout="300,600,1200,2400,4800" down_thread="false"
+ up_thread="false" discard_delivered_msgs="true" />
+ <UNICAST timeout="300,600,1200,2400,3600"
+ down_thread="false" up_thread="false" />
+ <pbcast.STABLE stability_delay="1000"
+ desired_avg_gossip="50000" down_thread="false" up_thread="false"
+ max_bytes="400000" />
+ <pbcast.GMS print_local_addr="true" join_timeout="3000"
+ down_thread="false" up_thread="false" join_retry_timeout="2000"
+ shun="true" view_bundling="true" />
+ <FRAG2 frag_size="60000" down_thread="false"
+ up_thread="false" />
+ <pbcast.STATE_TRANSFER down_thread="false"
+ up_thread="false" use_flush="false" />
+ </config>
+ </attribute>
+ </mbean>
+
+ <mbean code="org.jboss.portal.jems.hibernate.JBossTreeCacheProvider"
+ name="portal:service=TreeCacheProvider,type=hibernate">
+ <depends optional-attribute-name="CacheName">
+ portal:service=TreeCache,type=hibernate
+ </depends>
+ </mbean>
@portal.single.xml.open@
-->
16 years, 5 months
JBoss Portal SVN: r9209 - branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF.
by portal-commits@lists.jboss.org
Author: thomas.heute(a)jboss.com
Date: 2007-11-29 17:46:20 -0500 (Thu, 29 Nov 2007)
New Revision: 9209
Modified:
branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
Need to ask Galder for confirmation
Modified: branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-29 22:35:21 UTC (rev 9208)
+++ branches/JBoss_Portal_Branch_2_6/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-11-29 22:46:20 UTC (rev 9209)
@@ -461,8 +461,8 @@
<attribute name="NodeLockingScheme">OPTIMISTIC</attribute>
<attribute name="ClusterConfig">
<config>
- <UDP mcast_addr="${jboss.partition.udpGroup:230.1.2.3}"
- mcast_port="${jboss.ejb3entitypartition.mcast_port:43333}"
+ <UDP mcast_addr=224.0.0.36
+ mcast_port=55566
tos="8"
ucast_recv_buf_size="20000000"
ucast_send_buf_size="640000"
16 years, 5 months