JBoss Portal SVN: r11249 - docs/branches/JBoss_Portal_Branch_2_7/common/en/modules.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-07-01 22:14:42 -0400 (Tue, 01 Jul 2008)
New Revision: 11249
Modified:
docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml
Log:
- fixing my spelling mistake in the feature list (fJBoss Application...)
Modified: docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml 2008-07-02 02:12:46 UTC (rev 11248)
+++ docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml 2008-07-02 02:14:42 UTC (rev 11249)
@@ -86,7 +86,7 @@
support in JBoss Portal</ulink> for further details.
</listitem>
<listitem>
- <emphasis role="bold">Full <trademark class="trade">J2EE</trademark> 1.4 compliance when used with fJBoss Application Server.</emphasis>
+ <emphasis role="bold">Full <trademark class="trade">J2EE</trademark> 1.4 compliance when used with JBoss Application Server.</emphasis>
</listitem>
</itemizedlist>
</para>
@@ -281,4 +281,4 @@
basic submit for review and approval process.
</listitem>
</itemizedlist>
-</preface>c
+</preface>
17 years, 10 months
JBoss Portal SVN: r11248 - in docs/branches/JBoss_Portal_Branch_2_7: referenceGuide/en and 1 other directory.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-07-01 22:12:46 -0400 (Tue, 01 Jul 2008)
New Revision: 11248
Modified:
docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml
docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/overview.xml
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/master.xml
Log:
- minor revisions to feature list
- registered trademark for JBoss
Modified: docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml 2008-07-02 01:15:54 UTC (rev 11247)
+++ docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml 2008-07-02 02:12:46 UTC (rev 11248)
@@ -32,7 +32,7 @@
clustered for all portal instances.
</listitem>
<listitem>
- <emphasis role="bold">Hot-Deployment:</emphasis>
+ <emphasis role="bold">Hot-deployment:</emphasis>
leverages JBoss dynamic auto-deployment
features.
</listitem>
@@ -50,7 +50,7 @@
<emphasis role="bold">Leverages Apache Tomcat and JBoss Single sign-on (SSO) solutions.</emphasis>
</listitem>
<listitem>
- <emphasis role="bold">Integrates with JOSSO and Central Authentication Service (CAS) out of the box (experimental support for OpenSSO).</emphasis>
+ <emphasis role="bold">Integrates with Java Open Single Sign-On (JOSSO) and Central Authentication Service (CAS) out of the box. Experimental support for the Open Web SSO project (OpenSSO).</emphasis>
</listitem>
</itemizedlist>
</para>
@@ -61,7 +61,7 @@
<emphasis role="bold">Connect to virtually any LDAP server.</emphasis>
</listitem>
<listitem>
- <emphasis role="bold">Integrates with <trademark class="trade">Sun</trademark> Active Directory and OpenLDAP out of the box (experimental support for <trademark class="registered">Microsoft</trademark> <trademark class="registered">Active Directory</trademark>).</emphasis>
+ <emphasis role="bold">Integrates with <trademark class="trade">Sun</trademark> Active Directory and OpenLDAP out of the box. Experimental support for <trademark class="registered">Microsoft</trademark> <trademark class="registered">Active Directory</trademark>.</emphasis>
</listitem>
</itemizedlist>
</para>
@@ -81,12 +81,12 @@
<emphasis role="bold">Java Management Extension (<trademark class="trade">JMX</trademark>) 1.2.</emphasis>
</listitem>
<listitem>
- <emphasis role="bold">Web Services for Remote Portlets (WSRP) 1.0:</emphasis>
+ <emphasis role="bold">Web Services for Remote Portlets (WSRP) 1.0:</emphasis>
refer to <ulink url="http://docs.jboss.com/jbportal/v2.6.5/referenceGuide/html/wsrp.html#wsrp_...">WSRP
support in JBoss Portal</ulink> for further details.
</listitem>
<listitem>
- <emphasis role="bold">Full <trademark class="trade">J2EE</trademark> 1.4 compliance when used with JBoss AS.</emphasis>
+ <emphasis role="bold">Full <trademark class="trade">J2EE</trademark> 1.4 compliance when used with fJBoss Application Server.</emphasis>
</listitem>
</itemizedlist>
</para>
@@ -174,7 +174,7 @@
</listitem>
<listitem>
<emphasis role="bold">Create and Edit Roles:</emphasis>
- Ability for administrators to create and edit
+ ability for administrators to create and edit
roles.
</listitem>
<listitem>
@@ -184,7 +184,7 @@
</listitem>
<listitem>
<emphasis role="bold">CAPTCHA Support:</emphasis>
- to distinguish humans from machines when registering.
+ distinguish between humans and machines when registering.
</listitem>
</itemizedlist>
<para>
@@ -229,12 +229,12 @@
</listitem>
<listitem>
<emphasis role="bold">Content Serving Search-engine-friendly URLS:</emphasis>
- http://yourdomain/portal/content/index.html (does not apply to portlet actions).
+ http://<replaceable>yourdomain</replaceable>/portal/content/index.html (does not apply to portlet actions).
</listitem>
<listitem>
<emphasis role="bold">No Long Portal URLS:</emphasis>
serve binaries with simple URLs
- (http://domain/files/products.pdf).
+ (http://<replaceable>yourdomain</replaceable>/files/products.pdf).
</listitem>
<listitem>
<emphasis role="bold">Multiple HTML Portlet Instance Support:</emphasis>
@@ -248,13 +248,11 @@
</listitem>
<listitem>
<emphasis role="bold">File Functions:</emphasis>
- create, move, copy, upload, and delete
- files.
+ create, move, delete, copy, and upload files.
</listitem>
<listitem>
<emphasis role="bold">Embedded Directory-browser:</emphasis>
- when copying, moving,
- deleting, or creating files, administrators can simply navigate the directory tree to find
+ when creating, moving, deleting, or copying files, administrators can navigate the directory tree to find
the collection they want to perform the action on.
</listitem>
<listitem>
@@ -266,13 +264,12 @@
<emphasis role="bold">Full-featured HTML Editor:</emphasis>
the HTML editor contains a WYSIWYG
mode, preview functionality, and HTML source editting mode. HTML commands support tables,
- fonts, zooming, image and URL linking, flash movie support, bulleted and numbered list, and
+ fonts, zooming, image and URL linking, flash movie support, bullet and numbered list, and
dozens more.
</listitem>
<listitem>
<emphasis role="bold">Editor Style Sheet Support:</emphasis>
- the WYSIWYG editor displays
- the current portal style sheet, to easily chose classes.
+ to easily chose classes, the WYSIWYG editor displays the current portal style sheet.
</listitem>
<listitem>
<emphasis role="bold">Internationalization Support:</emphasis>
@@ -284,4 +281,4 @@
basic submit for review and approval process.
</listitem>
</itemizedlist>
-</preface>
+</preface>c
Modified: docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/overview.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/overview.xml 2008-07-02 01:15:54 UTC (rev 11247)
+++ docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/overview.xml 2008-07-02 02:12:46 UTC (rev 11248)
@@ -11,7 +11,7 @@
goal by deploying enterprise portals within their IT infrastructure. Enterprise portals
simplify access to information by providing a single source of interaction with corporate
information. Although today's packaged portal frameworks help enterprises launch portals more
- quickly, only JBoss Portal can deliver the benefits of a zero-cost open source license,
+ quickly, only <trademark class="registered">JBoss</trademark> Portal can deliver the benefits of a zero-cost open source license,
combined with a flexible and scalable underlying platform.</para>
<para>JBoss Portal provides an open source and standards-based environment for hosting and
serving a portal's Web interface, publishing and managing its content, and customizing its
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/master.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/master.xml 2008-07-02 01:15:54 UTC (rev 11247)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/master.xml 2008-07-02 02:12:46 UTC (rev 11248)
@@ -38,7 +38,7 @@
]>
<book lang="en">
<bookinfo>
- <title>JBoss Portal 2.7.0</title>
+ <title><trademark class="registered">JBoss</trademark> Portal 2.7.0</title>
<subtitle>Reference Guide</subtitle>
<releaseinfo>Release 2.7.0</releaseinfo>
<releaseinfo>July 2008</releaseinfo>
17 years, 10 months
JBoss Portal SVN: r11247 - in docs/branches/JBoss_Portal_Branch_2_7: referenceGuide/en and 1 other directories.
by portal-commits@lists.jboss.org
Author: mmcallis
Date: 2008-07-01 21:15:54 -0400 (Tue, 01 Jul 2008)
New Revision: 11247
Modified:
docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/master.xml
docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/sso.xml
Log:
- added email address
- Java trademarks
- minor revisions to feature list
Modified: docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml 2008-07-01 22:58:36 UTC (rev 11246)
+++ docs/branches/JBoss_Portal_Branch_2_7/common/en/modules/featurelist.xml 2008-07-02 01:15:54 UTC (rev 11247)
@@ -1,7 +1,7 @@
<preface id="features">
<title>Feature List</title>
- <para>The following list details features found in this document's related release. For a
- technical view of our features, view the
+ <para>The following list details features found in this release of JBoss Portal. For a
+ technical view of the JBoss Portal features, view the
<ulink
url="http://jira.jboss.com/jira/browse/JBPORTAL">Project Roadmap and Task List</ulink>
.
@@ -19,7 +19,7 @@
works with any RDBMS supported by Hibernate.
</listitem>
<listitem>
- <emphasis role="bold">JAAS Authentication:</emphasis>
+ <emphasis role="bold"><trademark class="trade">Java</trademark> Authentication and Authorization Service (JAAS):</emphasis>
custom authentication via JAAS login modules.
</listitem>
<listitem>
@@ -50,7 +50,7 @@
<emphasis role="bold">Leverages Apache Tomcat and JBoss Single sign-on (SSO) solutions.</emphasis>
</listitem>
<listitem>
- <emphasis role="bold">Integrates with JOSSO and CAS out of the box (experimental support for Open SSO).</emphasis>
+ <emphasis role="bold">Integrates with JOSSO and Central Authentication Service (CAS) out of the box (experimental support for OpenSSO).</emphasis>
</listitem>
</itemizedlist>
</para>
@@ -115,9 +115,9 @@
resource files for every portlet.
</listitem>
<listitem>
- <emphasis role="bold">Pluggable services:</emphasis>
- authentication performed by the
- servlet container and JAAS make it possible to swap the authentication scheme.
+ <emphasis role="bold">Pluggable Services:</emphasis>
+ with authentication performed by the
+ servlet container and JAAS, it is possible to swap the authentication scheme.
</listitem>
<listitem>
<emphasis role="bold">Page-based Architecture:</emphasis>
@@ -135,7 +135,7 @@
</para>
<itemizedlist>
<listitem>
- <emphasis role="bold">Swappable themes and layouts:</emphasis>
+ <emphasis role="bold">Swapping Themes and Layouts:</emphasis>
new themes and layouts
containing images can easily be deployed in WAR archives.
</listitem>
@@ -145,7 +145,7 @@
separate the business layer from the presentation layer.
</listitem>
<listitem>
- <emphasis role="bold">Per-page layout strategy:</emphasis>
+ <emphasis role="bold">Per-page Layout Strategy:</emphasis>
different layouts can be
assigned to different pages.
</listitem>
@@ -174,7 +174,7 @@
</listitem>
<listitem>
<emphasis role="bold">Create and Edit Roles:</emphasis>
- Ability for administrators create and edit
+ Ability for administrators to create and edit
roles.
</listitem>
<listitem>
@@ -192,7 +192,7 @@
</para>
<itemizedlist>
<listitem>
- <emphasis role="bold">Extendable permissions API:</emphasis>
+ <emphasis role="bold">Extendable Permissions API:</emphasis>
allows custom portlet
permissions based on role definition.
</listitem>
@@ -225,7 +225,7 @@
<listitem>
<emphasis role="bold">Version and History Support:</emphasis>
all content edited and created is
- autoversioned with a history of edits, that can be viewed at any time.
+ auto-versioned with a history of edits, that can be viewed at any time.
</listitem>
<listitem>
<emphasis role="bold">Content Serving Search-engine-friendly URLS:</emphasis>
@@ -270,9 +270,9 @@
dozens more.
</listitem>
<listitem>
- <emphasis role="bold">Editor Style-sheet Support:</emphasis>
+ <emphasis role="bold">Editor Style Sheet Support:</emphasis>
the WYSIWYG editor displays
- the current portal style-sheet, for easy choosing of classes.
+ the current portal style sheet, to easily chose classes.
</listitem>
<listitem>
<emphasis role="bold">Internationalization Support:</emphasis>
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/master.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/master.xml 2008-07-01 22:58:36 UTC (rev 11246)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/master.xml 2008-07-02 01:15:54 UTC (rev 11247)
@@ -47,7 +47,7 @@
<surname>Heute</surname>
<email>theute(a)jboss.org</email>
</author>
- <author>
+ <author>
<firstname>Julien</firstname>
<surname>Viet</surname>
<email>julien(a)jboss.org</email>
@@ -69,6 +69,7 @@
<author>
<firstname>Murray</firstname>
<surname>McAllister</surname>
+ <email>mmcallis(a)redhat.com</email>
</author>
</bookinfo>
<toc/>
Modified: docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/sso.xml
===================================================================
--- docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/sso.xml 2008-07-01 22:58:36 UTC (rev 11246)
+++ docs/branches/JBoss_Portal_Branch_2_7/referenceGuide/en/modules/sso.xml 2008-07-02 01:15:54 UTC (rev 11247)
@@ -268,7 +268,7 @@
</sect2>
</sect1>
<sect1>
- <title>JOSSO - Java Open Single SignOn</title>
+ <title>JOSSO - <trademark class="trade">Java</trademark> Open Single SignOn</title>
<para>JBoss Portal enables seamless integration with JOSSO server. More details on JOSSO can be found
<ulink url="http://www.josso.org/">here</ulink></para>
<note>The steps below assume that JOSS server and JBoss Portal will be deployed on the same JBoss Application Server instance.
17 years, 10 months
JBoss Portal SVN: r11246 - in modules/presentation/trunk/portal/src/main: java/org/jboss/portal/presentation/portal and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-01 18:58:36 -0400 (Tue, 01 Jul 2008)
New Revision: 11246
Modified:
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java
Log:
added remove capabilities to back end model which is going to allow to play with refresh capabilities and test how well it works (or not)
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-07-01 22:16:51 UTC (rev 11245)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/jboss-beans.xml 2008-07-01 22:58:36 UTC (rev 11246)
@@ -160,6 +160,7 @@
<parameter><inject bean="PortalNodeAdapter"/></parameter>
<parameter><inject bean="StructuralStateContext"/></parameter>
<parameter><inject bean="ContentHandlerRegistry"/></parameter>
+ <parameter><inject bean="LayoutStore"/></parameter>
</constructor>
</bean>
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-07-01 22:16:51 UTC (rev 11245)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-07-01 22:58:36 UTC (rev 11246)
@@ -28,6 +28,8 @@
import org.jboss.portal.presentation.portal.model.node.PageNode;
import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.content.PageContentContextImpl;
+import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
import org.jboss.portal.presentation.portal.content.ContentHandlerRegistry;
@@ -63,6 +65,9 @@
private PortalNodeManager portalNodeManager;
/** . */
+ private LayoutStore layoutStore;
+
+ /** . */
private StructuralAdapter structuralAdapter;
/** . */
@@ -75,12 +80,14 @@
PortalNodeManager portalNodeManager,
StructuralAdapter structuralAdapter,
StructuralStateContext structuralStateContext,
- ContentHandlerRegistry contentHandlerRegistry)
+ ContentHandlerRegistry contentHandlerRegistry,
+ LayoutStore layoutStore)
{
this.portalNodeManager = portalNodeManager;
this.structuralAdapter = structuralAdapter;
this.structuralStateContext = structuralStateContext;
this.contentHandlerRegistry = contentHandlerRegistry;
+ this.layoutStore = layoutStore;
}
public StructuralStateContext getStructuralStateContext()
@@ -132,9 +139,18 @@
}
else if (objectAction instanceof DestroyUIObjectAction)
{
- targetNode.getParent().destroyChild(targetNode.getName());
+ LayoutElement referent = layoutStore.findElementByRef(targetNode.getId());
//
+ if (referent != null)
+ {
+ layoutStore.destroyElement(referent.getId());
+ }
+
+ //
+ portalNodeManager.destroy(targetNode.getId());
+
+ //
return new PresentationResponse(new ShowUIObjectResponse(targetId));
}
else if (objectAction instanceof LinkActivation)
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-07-01 22:16:51 UTC (rev 11245)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-07-01 22:58:36 UTC (rev 11246)
@@ -61,7 +61,7 @@
final void unregister()
{
- throw new NotYetImplemented("No need for now");
+ this.context = null;
}
public final LayoutStructure getStructure()
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java 2008-07-01 22:16:51 UTC (rev 11245)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java 2008-07-01 22:58:36 UTC (rev 11246)
@@ -61,4 +61,9 @@
{
store.register(element);
}
+
+ void unregister(LayoutElement element)
+ {
+ store.unregister(element);
+ }
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-07-01 22:16:51 UTC (rev 11245)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-07-01 22:58:36 UTC (rev 11246)
@@ -25,6 +25,8 @@
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.ConcurrentHashMap;
import java.util.Map;
+import java.util.List;
+import java.util.LinkedList;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -54,13 +56,85 @@
}
/**
- * Locate a layout object by its id.
+ * Destroy a specified element and its descendants. Returns the set of references held
+ * by the graph.
*
+ * @param id the element id
+ * @throws IllegalArgumentException if the argument is null
+ * @throws IllegalStateException if the element does not exist
+ * @return the set of references
+ */
+ public List<String> destroyElement(String id) throws IllegalArgumentException, IllegalStateException
+ {
+ if (id == null)
+ {
+ throw new IllegalArgumentException("No null element id accepted");
+ }
+
+ //
+ LayoutElementContext targetContext = contextsById.get(id);
+ LayoutElement targetElement = targetContext.getObject();
+ LinkedList<String> references = new LinkedList<String>();
+
+ //
+ if (targetElement instanceof LayoutStructure)
+ {
+ LayoutStructure structure = (LayoutStructure)targetElement;
+
+ //
+ for (LayoutElement element : structure.getElements())
+ {
+ references.addAll(destroyElement(element.getId()));
+ }
+ }
+
+ //
+ LayoutStructure structure = targetElement.getStructure();
+ if (structure == null)
+ {
+ unregister(targetElement);
+ }
+ else
+ {
+ structure.removeElement(targetElement);
+ }
+
+ //
+ String objectRef = null;
+ if (targetElement instanceof SimpleStructure)
+ {
+ objectRef = ((SimpleStructure)targetElement).getObjectRef();
+ }
+ else if (targetElement instanceof SimpleElement)
+ {
+ objectRef = ((SimpleElement)targetElement).getRef();
+ }
+
+ //
+ if (objectRef != null)
+ {
+ references.addLast(objectRef);
+ }
+
+ //
+ return references;
+ }
+
+ /**
+ * Locate a layout object by its id or return null.
+ *
* @param id the layout object id
* @return a layout object
+ * @throws IllegalArgumentException if the argument is null
*/
- public LayoutElement getElement(String id)
+ public LayoutElement getElement(String id) throws IllegalArgumentException
{
+ if (id == null)
+ {
+ throw new IllegalArgumentException("No null element id accepted");
+ }
+
+ //
LayoutElementContext context = contextsById.get(id);
//
@@ -68,13 +142,20 @@
}
/**
- * Locate a layout object by the reference.
+ * Locate a layout object by the reference or return null.
*
* @param ref the reference
* @return a layout object
+ * @throws IllegalArgumentException if the argument is null
*/
public LayoutElement findElementByRef(String ref)
{
+ if (ref == null)
+ {
+ throw new IllegalArgumentException("No null element ref accepted");
+ }
+
+ //
LayoutElementContext context = contextsByObjectRef.get(ref);
//
@@ -90,8 +171,6 @@
//
String objectRef = null;
-
- //
if (element instanceof SimpleStructure)
{
objectRef = ((SimpleStructure)element).getObjectRef();
@@ -110,4 +189,35 @@
//
element.register(context);
}
+
+ void unregister(LayoutElement element)
+ {
+ LayoutElementContext context = contextsById.remove(element.getId());
+
+ //
+ if (context == null)
+ {
+ throw new IllegalStateException("No such element with id " + element.getId());
+ }
+
+ //
+ String objectRef = null;
+ if (element instanceof SimpleStructure)
+ {
+ objectRef = ((SimpleStructure)element).getObjectRef();
+ }
+ else if (element instanceof SimpleElement)
+ {
+ objectRef = ((SimpleElement)element).getRef();
+ }
+
+ //
+ if (objectRef != null)
+ {
+ contextsByObjectRef.remove(objectRef);
+ }
+
+ //
+ element.unregister();
+ }
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-07-01 22:16:51 UTC (rev 11245)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-07-01 22:58:36 UTC (rev 11246)
@@ -73,7 +73,7 @@
{
if (element.structure != null)
{
- throw new IllegalArgumentException("Layout element is already attached to a layout");
+ throw new IllegalArgumentException("Layout element is already attached to a structure");
}
// Wire
@@ -83,4 +83,19 @@
// Register and contextualize
getContext().register(element);
}
+
+ public void removeElement(LayoutElement element)
+ {
+ if (element.structure != this)
+ {
+ throw new IllegalArgumentException("Layout element not attached to this structure");
+ }
+
+ //
+ getContext().unregister(element);
+
+ // Unwire
+ element.structure = null;
+ elements.remove(element);
+ }
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java 2008-07-01 22:16:51 UTC (rev 11245)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/node/PortalNodeManager.java 2008-07-01 22:58:36 UTC (rev 11246)
@@ -79,6 +79,12 @@
PortalNode node = nodes.get(objectId);
//
+ if (node == null)
+ {
+ throw new IllegalStateException("No such node to destroy " + objectId);
+ }
+
+ //
PortalNode parent = node.getParent();
//
17 years, 10 months
JBoss Portal SVN: r11245 - in branches/JBoss_Portal_Branch_2_6: core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-01 18:16:51 -0400 (Tue, 01 Jul 2008)
New Revision: 11245
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/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
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/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/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
Log:
- Re-factored RefreshResult as it was mixing concerns by providing user-oriented messages.
- More internalization.
- Started to use ui:repeat instead of c:forEach as it's supposed to be better.
- Registration management fails with facelets 1.1.15-B1 but works OK with facelets 1.1.11.
- Status messages don't appear anymore for some reason (regardless of facelets version) with a warning on console.
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 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-07-01 22:16:51 UTC (rev 11245)
@@ -51,6 +51,10 @@
static final String EXPECTED_REG_INFO_KEY = "expectedRegistrationInfo";
private static final String NO_CONSUMER = "bean_consumermanager_no_consumer";
private static final String INVALID_NEW_CONSUMER_NAME = "bean_consumermanager_invalid_new_consumer_name";
+ private static final String REFRESH_BYPASSED = "bean_consumermanager_refresh_bypassed";
+ private static final String REFRESH_SUCCESS = "bean_consumermanager_refresh_success";
+ private static final String REFRESH_FAILURE = "bean_consumermanager_refresh_failure";
+ private static final String REFRESH_EXCEPTION = "bean_consumermanager_refresh_exception";
public ConsumerRegistry getRegistry()
{
@@ -231,7 +235,7 @@
{
RefreshResult result = consumer.refresh(true);
-
+ String status = getLocalizationKeyFrom(result);
if (result.hasIssues())
{
// create the expected registration info and make it available
@@ -239,7 +243,7 @@
expected.refresh(result.getServiceDescription(), consumer.getProducerId(), true, true, true);
setExpectedRegistrationInfo(expected);
- beanContext.createErrorMessage(result.getStatus());
+ beanContext.createErrorMessage(status);
// refresh had issues, we should deactivate this consumer
registry.deactivateConsumerWith(consumer.getProducerId());
@@ -256,7 +260,7 @@
registry.deactivateConsumerWith(consumer.getProducerId());
}
- beanContext.createMessage(BeanContext.STATUS, result.getStatus(), beanContext.getInfoSeverity()); // todo: localize status!
+ beanContext.createInfoMessage(status);
}
return result;
}
@@ -267,6 +271,28 @@
}
}
+ private String getLocalizationKeyFrom(RefreshResult result)
+ {
+ RefreshResult.Status status = result.getStatus();
+ if(RefreshResult.Status.BYPASSED.equals(status))
+ {
+ return REFRESH_BYPASSED;
+ }
+ else if (RefreshResult.Status.SUCCESS.equals(status))
+ {
+ return REFRESH_SUCCESS;
+ }
+ else if (RefreshResult.Status.FAILURE.equals(status))
+ {
+ // todo: extract information from registration result to be more precise
+ return REFRESH_FAILURE;
+ }
+ else
+ {
+ return REFRESH_EXCEPTION;
+ }
+ }
+
RefreshResult refresh(WSRPConsumer consumer)
{
RefreshResult result = internalRefresh(consumer);
@@ -323,4 +349,4 @@
{
beanContext.createErrorMessage(NO_CONSUMER);
}
-}
\ No newline at end of file
+}
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-07-01 22:16:51 UTC (rev 11245)
@@ -150,8 +150,12 @@
# ConsumerManagerBean
bean_consumermanager_invalid_new_consumer_name = Need a non-null, non-empty name for the new consumer!
bean_consumermanager_no_consumer = No consumer was selected!
+bean_consumermanager_refresh_bypassed = Refresh was not necessary.
+bean_consumermanager_refresh_success = Refresh was successful.
+bean_consumermanager_refresh_failure = Refresh failed (probably because the registration information was not valid).
+bean_consumermanager_refresh_exception = An unexpected error occurred.
# ProducerBean
bean_producer_regpolicy_unset = RegistrationPolicy unset
bean_producer_cannot_save = Couldn't save producer configuration. Cause: {0}
-bean_producer_cannot_reload = Couldn't reload producer configuration. Cause: {0}
\ No newline at end of file
+bean_producer_cannot_reload = Couldn't reload producer configuration. Cause: {0}
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-07-01 22:16:51 UTC (rev 11245)
@@ -126,4 +126,8 @@
producer_config_save=Sauvegarder
producer_config_sd_requires_reg=L'acc\u00e8s \u00e0 la description compl\u00e8te des services requiert l'enregistrement.
producer_config_strict=Utiliser la validation WSRP stricte.
-producer_config_title=Configuration producteur
\ No newline at end of file
+producer_config_title=Configuration producteur
+bean_consumermanager_refresh_bypassed=Le rafra\u00eechissement n'\u00e9tait pas requis.
+bean_consumermanager_refresh_exception=Une erreur inattendue s'est produite.
+bean_consumermanager_refresh_failure=Le rafra\u00eechissement a \u00e9chou\u00e9 (probablement \u00e0 cause d'informations d'enregistrement non valides)
+bean_consumermanager_refresh_success=Le rafra\u00eechissement a r\u00e9ussi.
\ No newline at end of file
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 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2008-07-01 22:16:51 UTC (rev 11245)
@@ -74,24 +74,23 @@
</td>
</tr>
<c:if test="#{consumer.localInfoPresent}">
-<tr>
- <th>#{i18n.edit_consumer_registration}</th>
- <td>
- <c:choose>
- <c:when test="#{consumer.localInfoPresent}">
- <h3 class="portlet-area-header">#{i18n.edit_consumer_registration_current}</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>
- <th class="nameColumn">#{i18n.edit_consumer_prop_name}</th>
- <th class="descColumn">#{i18n.edit_consumer_prop_desc}</th>
- <th>#{i18n.edit_consumer_prop_value}</th>
- </tr>
- <c:forEach items="#{consumer.producerInfo.registrationInfo.registrationProperties}"
- var="prop">
- <tr title="#{prop.description.label.value}">
+ <tr>
+ <th>#{i18n.edit_consumer_registration}</th>
+ <td>
+ <c:choose>
+ <c:when test="#{consumer.localInfoPresent}">
+ <h3 class="portlet-area-header">#{i18n.edit_consumer_registration_current}</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>
+ <th class="nameColumn">#{i18n.edit_consumer_prop_name}</th>
+ <th class="descColumn">#{i18n.edit_consumer_prop_desc}</th>
+ <th>#{i18n.edit_consumer_prop_value}</th>
+ </tr>
+ <tr jsfc="ui:repeat" value="#{consumer.producerInfo.registrationInfo.registrationProperties}"
+ var="prop" title="#{prop.description.label.value}">
<td>#{prop.name}</td>
<td>#{prop.description.label.value}</td>
<td>
@@ -102,49 +101,11 @@
rendered="#{prop.determinedInvalid}"/>
</td>
</tr>
- </c:forEach>
- </table>
- <h:commandLink action="#{consumer.update}"
- value="#{i18n.edit_consumer_registration_update_props}"
- rendered="#{consumer.registered}"
- styleClass="portlet-form-button portlet-section-buttonrow"/>
- </c:when>
- <c:otherwise>
- #{i18n.edit_consumer_registration_no_props}
- </c:otherwise>
- </c:choose>
- <h:commandLink action="#{consumer.modifyRegistration}" value="#{i18n.edit_consumer_registration_modify}"
- rendered="#{consumer.registrationLocallyModified}"
- title="#{i18n.edit_consumer_registration_modify_title}"
- styleClass="portlet-form-button portlet-section-buttonrow"/>
- <br style="clear:both;"/>
- </h:panelGroup>
-
- <br/>
-
- <c:if test="#{consumer.registrationModified}">
- <h3 class="portlet-area-header">#{i18n.edit_consumer_registration_expected}</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">#{i18n.edit_consumer_prop_name}</th>
- <th class="descColumn">#{i18n.edit_consumer_prop_desc}</th>
- <th>#{i18n.edit_consumer_prop_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>
+ <h:commandLink action="#{consumer.update}"
+ value="#{i18n.edit_consumer_registration_update_props}"
+ rendered="#{consumer.registered}"
+ styleClass="portlet-form-button portlet-section-buttonrow"/>
</c:when>
<c:otherwise>
#{i18n.edit_consumer_registration_no_props}
@@ -152,31 +113,67 @@
</c:choose>
<h:commandLink action="#{consumer.modifyRegistration}"
value="#{i18n.edit_consumer_registration_modify}"
+ rendered="#{consumer.registrationLocallyModified}"
title="#{i18n.edit_consumer_registration_modify_title}"
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}">
- #{i18n.edit_consumer_no_registration}
- </c:when>
- </c:choose>
- </td>
-</tr>
-<c:if test="#{!empty consumer.producerInfo.registrationInfo.registrationHandle}">
- <tr>
- <th>#{i18n.edit_consumer_registration_context}</th>
- <td id="handle">
- #{i18n.edit_consumer_registration_context_handle} <h:outputText
- value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
- <h:commandLink action="confirmEraseRegistration" value="#{i18n.edit_consumer_registration_context_erase}"
- title="#{i18n.edit_consumer_registration_context_erase_title}"
- styleClass="portlet-form-button"/>
+
+ <br/>
+
+ <c:if test="#{consumer.registrationModified}">
+ <h3 class="portlet-area-header">#{i18n.edit_consumer_registration_expected}</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">#{i18n.edit_consumer_prop_name}</th>
+ <th class="descColumn">#{i18n.edit_consumer_prop_desc}</th>
+ <th>#{i18n.edit_consumer_prop_value}</th>
+ </tr>
+ <tr jsfc="ui:repeat" value="#{consumer.expectedRegistrationInfo.registrationProperties}"
+ var="prop" 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>
+ </table>
+ </c:when>
+ <c:otherwise>
+ #{i18n.edit_consumer_registration_no_props}
+ </c:otherwise>
+ </c:choose>
+ <h:commandLink action="#{consumer.modifyRegistration}"
+ value="#{i18n.edit_consumer_registration_modify}"
+ title="#{i18n.edit_consumer_registration_modify_title}"
+ 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}">
+ #{i18n.edit_consumer_no_registration}
+ </c:when>
+ </c:choose>
</td>
</tr>
+ <c:if test="#{!empty consumer.producerInfo.registrationInfo.registrationHandle}">
+ <tr>
+ <th>#{i18n.edit_consumer_registration_context}</th>
+ <td id="handle">
+ #{i18n.edit_consumer_registration_context_handle} <h:outputText value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
+ <h:commandLink action="confirmEraseRegistration" value="#{i18n.edit_consumer_registration_context_erase}"
+ title="#{i18n.edit_consumer_registration_context_erase_title}"
+ styleClass="portlet-form-button"/>
+ </td>
+ </tr>
+ </c:if>
</c:if>
-</c:if>
<tr>
<th/>
<td class="portlet-section-buttonrow">
@@ -190,4 +187,4 @@
</table>
</h:form>
</ui:define>
-</ui:decorate>
+</ui:decorate>
\ No newline at end of file
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 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2008-07-01 22:16:51 UTC (rev 11245)
@@ -139,20 +139,20 @@
RefreshResult result = info.refresh(sd, producerId, true, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
- assertTrue(info.isConsistentWithProducerExpectations().booleanValue());
- assertFalse(info.isRegistrationRequired().booleanValue());
+ assertTrue(info.isConsistentWithProducerExpectations());
+ assertFalse(info.isRegistrationRequired());
assertTrue(info.isRegistrationDeterminedNotRequired());
assertFalse(info.isRegistrationDeterminedRequired());
- assertTrue(info.isRegistrationValid().booleanValue());
+ assertTrue(info.isRegistrationValid());
result = info.refresh(sd, producerId, false, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
- assertTrue(info.isConsistentWithProducerExpectations().booleanValue());
- assertFalse(info.isRegistrationRequired().booleanValue());
+ assertTrue(info.isConsistentWithProducerExpectations());
+ assertFalse(info.isRegistrationRequired());
assertTrue(info.isRegistrationDeterminedNotRequired());
assertFalse(info.isRegistrationDeterminedRequired());
- assertTrue(info.isRegistrationValid().booleanValue());
+ assertTrue(info.isRegistrationValid());
}
public void testRefreshRegistrationDefaultRegistrationNoLocalInfo()
@@ -165,10 +165,10 @@
createServiceDescription(true, 0), producerId, true, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
- assertTrue(info.isRegistrationRequired().booleanValue());
+ assertTrue(info.isRegistrationRequired());
assertTrue(info.isRegistrationDeterminedRequired());
assertFalse(info.isRegistrationDeterminedNotRequired());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
}
public void testRefreshRegistrationDefaultRegistrationExtraLocalInfo()
@@ -180,9 +180,7 @@
createServiceDescription(true, 0), producerId, false, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
- String status = result.getStatus();
- assertNotNull(status);
- assertTrue(status.indexOf("foo") != -1);
+ assertEquals(RefreshResult.Status.FAILURE, result.getStatus());
assertEquals(1, info.getRegistrationProperties().size());
assertEquals(1, result.getRegistrationProperties().size());
@@ -192,7 +190,7 @@
RegistrationProperty prop = (RegistrationProperty)regProps.get("foo");
assertNotNull(prop);
assertEquals("bar", prop.getValue());
- assertTrue(prop.isInvalid().booleanValue());
+ assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.INEXISTENT_STATUS, prop.getStatus());
}
@@ -204,9 +202,7 @@
RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId, false, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
- String status = result.getStatus();
- assertNotNull(status);
- assertTrue(status.indexOf("prop0") != -1 && status.indexOf("prop1") != -1);
+ assertEquals(RefreshResult.Status.FAILURE, result.getStatus());
assertEquals(0, info.getRegistrationProperties().size());
assertEquals(2, result.getRegistrationProperties().size());
@@ -215,8 +211,12 @@
RegistrationProperty prop = (RegistrationProperty)regProps.get("prop0");
assertNotNull(prop);
- assertTrue(prop.isInvalid().booleanValue());
+ assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.MISSING_STATUS, prop.getStatus());
+ prop = (RegistrationProperty)regProps.get("prop1");
+ assertNotNull(prop);
+ assertTrue(prop.isInvalid());
+ assertEquals(RegistrationProperty.MISSING_STATUS, prop.getStatus());
}
public void testRefreshRegistrationRegistrationMergeWithLocalInfo()
@@ -231,13 +231,13 @@
RegistrationProperty prop = info.getRegistrationProperty("prop0");
assertNotNull(prop);
assertNull(prop.getValue());
- assertTrue(prop.isInvalid().booleanValue());
+ assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.MISSING_VALUE_STATUS, prop.getStatus());
prop = info.getRegistrationProperty("prop1");
assertNotNull(prop);
assertNull(prop.getValue());
- assertTrue(prop.isInvalid().booleanValue());
+ assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.MISSING_VALUE_STATUS, prop.getStatus());
assertEquals(2, info.getRegistrationProperties().size());
assertEquals(2, result.getRegistrationProperties().size());
@@ -251,28 +251,28 @@
RefreshResult result = info.refresh(createServiceDescription(true, 0), producerId, false, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
// 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, false);
assertTrue(result.hasIssues());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
info.removeRegistrationProperty("foo");
result = info.refresh(createServiceDescription(true, 0), producerId, false, false, false);
assertFalse(result.hasIssues());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
// producer has changed but we're not forcing refresh so registration should still be invalid
result = info.refresh(createServiceDescription(false, 0), producerId, false, false, false);
assertFalse(result.hasIssues());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
// force refresh, registration should now be valid
result = info.refresh(createServiceDescription(false, 0), producerId, false, true, false);
assertFalse(result.hasIssues());
- assertTrue(info.isRegistrationValid().booleanValue());
+ assertTrue(info.isRegistrationValid());
}
public void testSetRegistrationContext()
@@ -286,10 +286,10 @@
assertNotNull(registrationContext);
assertEquals(registrationHandle, registrationContext.getRegistrationHandle());
assertNull(registrationContext.getRegistrationState());
- assertTrue(info.isConsistentWithProducerExpectations().booleanValue());
- assertTrue(info.isRegistrationValid().booleanValue());
+ assertTrue(info.isConsistentWithProducerExpectations());
+ assertTrue(info.isRegistrationValid());
assertFalse(info.isRefreshNeeded());
- assertTrue(info.isRegistrationRequired().booleanValue());
+ assertTrue(info.isRegistrationRequired());
assertTrue(info.isRegistrationDeterminedRequired());
assertFalse(info.isRegistrationDeterminedNotRequired());
}
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 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-07-01 22:16:51 UTC (rev 11245)
@@ -265,7 +265,7 @@
*/
public boolean refresh(boolean forceRefresh) throws PortletInvokerException
{
- return detailedRefresh(forceRefresh).specificCode();
+ return detailedRefresh(forceRefresh).didRefreshHappen();
}
public RefreshResult detailedRefresh(boolean forceRefresh) throws PortletInvokerException
@@ -273,7 +273,7 @@
RefreshResult result = internalRefresh(forceRefresh);
// update DB
- if (result.specificCode())
+ if (result.didRefreshHappen())
{
// mark as inactive if the refresh had issues...
if (result.hasIssues())
@@ -303,14 +303,17 @@
if (forceRefresh || isRefreshNeeded(true))
{
log.debug("Refreshing info for producer '" + getId() + "'");
- RefreshResult result = new RefreshResult(true, REFRESH_MEANING);
+// RefreshResult result = new RefreshResult(true, REFRESH_MEANING);
+ RefreshResult result = new RefreshResult();
try
{
persistentEndpointInfo.refresh();
}
catch (InvokerUnavailableException e)
{
- result.appendToStatus("Couldn't refresh endpoint information: ").append(e.getLocalizedMessage());
+ log.debug("Couldn't refresh endpoint information: " + e);
+// result.appendToStatus("Couldn't refresh endpoint information: ").append(e.getLocalizedMessage());
+// throw new PortletInvokerException("Couldn't refresh endpoint information: " + e.getLocalizedMessage());
}
// save changes to endpoint
registry.updateProducerInfo(this);
@@ -340,8 +343,9 @@
setActiveAndSave(false);
}
- result.appendToStatus(registrationResult.getStatus(), false);
- result.setHasIssues(registrationResult.hasIssues());
+ result.setRegistrationResult(registrationResult);
+ /*result.appendToStatus(registrationResult.getStatus(), false);
+ result.setHasIssues(registrationResult.hasIssues());*/
return result;
}
else
@@ -366,13 +370,13 @@
RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, true, forceRefresh, !registeredSDSucceeded);
registry.updateProducerInfo(this);
- result.appendToStatus(registrationResult.getStatus());
+// result.appendToStatus(registrationResult.getStatus());
// attempt to register and determine if the current service description can be used to extract POPs
if (registeredSDSucceeded && !registrationResult.hasIssues())
{
registrationResult = register(serviceDescription, false);
- if (registrationResult.specificCode())
+ if (RefreshResult.Status.SUCCESS.equals(registrationResult.getStatus()))
{
// registration occurred, so we should ask for a new service description
serviceDescription = getServiceDescription(false);
@@ -382,9 +386,10 @@
extractOfferedPortlets(serviceDescription);
}
- result.appendToStatus(registrationResult.getStatus());
- result.setHasIssues(registrationResult.hasIssues());
- result.appendToStatus("Producer information successfully refreshed");
+// result.appendToStatus(registrationResult.getStatus());
+// result.setHasIssues(registrationResult.hasIssues());
+ result.setRegistrationResult(registrationResult);
+// result.appendToStatus("Producer information successfully refreshed");
return result;
}
@@ -397,7 +402,7 @@
}
}
- return new RefreshResult(false, REFRESH_MEANING);
+ return new RefreshResult(RefreshResult.Status.BYPASSED);
}
private Map<String, ItemDescription> toMap(ItemDescription[] itemDescriptions)
@@ -838,8 +843,11 @@
String msg = "Consumer with id '" + persistentId + "' successfully registered with handle: '"
+ registrationContext.getRegistrationHandle() + "'";
log.debug(msg);
- result.appendToStatus(msg);
- return new RefreshResult(result, true, REGISTER_MEANING);
+// result.appendToStatus(msg);
+ RefreshResult res = new RefreshResult();
+ res.setRegistrationResult(result);
+ return res;
+// return new RefreshResult(result, true, REGISTER_MEANING);
}
catch (Exception e)
{
@@ -861,7 +869,7 @@
}
}
- return new RefreshResult(false, REGISTER_MEANING);
+ return new RefreshResult(RefreshResult.Status.BYPASSED);
}
public void deregister() throws PortletInvokerException
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 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2008-07-01 22:16:51 UTC (rev 11245)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.consumer;
+import static org.jboss.portal.wsrp.consumer.RefreshResult.Status.*;
import org.jboss.portal.wsrp.core.ServiceDescription;
/**
@@ -32,75 +33,56 @@
*/
public class RefreshResult
{
- private StringBuffer status = new StringBuffer();
- private boolean hasIssues;
- private boolean specificCode;
- private final String meaning;
+ public enum Status { SUCCESS, FAILURE, UNAVAILABLE, BYPASSED, UNKNOWN }
+
private ServiceDescription serviceDescription;
- private static final String COLON = ".\n";
+ private Status status;
+ private RefreshResult registrationResult;
- public RefreshResult(boolean specificCode, String specificCodeMeaning)
+ public RefreshResult()
{
- this.specificCode = specificCode;
- this.meaning = specificCodeMeaning;
+ status = UNKNOWN;
}
- public RefreshResult(RefreshResult previous, boolean specificCode, String specificCodeMeaning)
+ public RefreshResult(Status status)
{
- this(specificCode, specificCodeMeaning);
- appendToStatus(previous.getStatus());
- setHasIssues(previous.hasIssues);
+ this.status = status;
}
- public boolean hasIssues()
+ public RefreshResult getRegistrationResult()
{
- return hasIssues;
+ return registrationResult;
}
- public void setHasIssues(boolean hasIssues)
+ public void setRegistrationResult(RefreshResult registrationResult)
{
- this.hasIssues = hasIssues;
+ if (registrationResult != null)
+ {
+ this.registrationResult = registrationResult;
+ status = registrationResult.getStatus();
+ }
}
- public String getStatus()
+ public boolean didRefreshHappen()
{
- return status.toString();
+ return SUCCESS.equals(status) || FAILURE.equals(status);
}
- StringBuffer appendToStatus(String message)
+ public boolean hasIssues()
{
- return appendToStatus(message, true);
+ return !(SUCCESS.equals(status) || BYPASSED.equals(status)) ;
}
- StringBuffer appendToStatus(String message, boolean appendColon)
+ public Status getStatus()
{
- if (message != null && message.length() > 1)
- {
- status.append(message);
- // only happen a colon if the message is not ending with one already.
- if (appendColon && (status.lastIndexOf(COLON) != status.length() - 2))
- {
- status.append(COLON);
- }
- }
return status;
}
- public boolean specificCode()
+ public void setStatus(Status status)
{
- return specificCode;
+ this.status = status;
}
- public void setSpecificCode(boolean specificCode)
- {
- this.specificCode = specificCode;
- }
-
- public String getMeaning()
- {
- return meaning;
- }
-
public void setServiceDescription(ServiceDescription serviceDescription)
{
this.serviceDescription = 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 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-07-01 22:16:51 UTC (rev 11245)
@@ -59,7 +59,7 @@
private String persistentConsumerName;
private String persistentRegistrationHandle;
private byte[] persistentRegistrationState;
- private Map persistentRegistrationProperties;
+ private Map<String, RegistrationProperty> persistentRegistrationProperties;
private transient Boolean requiresRegistration;
private transient Boolean consistentWithProducerExpectations;
@@ -100,10 +100,9 @@
if (other.persistentRegistrationProperties != null)
{
- this.persistentRegistrationProperties = new HashMap(other.persistentRegistrationProperties.size());
- for (Object o : other.persistentRegistrationProperties.values())
+ this.persistentRegistrationProperties = new HashMap<String, RegistrationProperty>(other.persistentRegistrationProperties.size());
+ for (RegistrationProperty otherProp : other.persistentRegistrationProperties.values())
{
- RegistrationProperty otherProp = (RegistrationProperty)o;
String name = otherProp.getName();
RegistrationProperty prop = new RegistrationProperty(name, otherProp.getValue(), otherProp.getLang());
prop.setStatus(otherProp.getStatus());
@@ -231,7 +230,7 @@
public boolean hasLocalInfo()
{
- return persistentRegistrationHandle != null || !getRegistrationProperties().isEmpty();
+ return persistentRegistrationHandle != null || (persistentRegistrationProperties != null && !persistentRegistrationProperties.isEmpty());
}
public RegistrationData getRegistrationData()
@@ -239,7 +238,7 @@
registrationData = WSRPTypeFactory.createDefaultRegistrationData();
registrationData.setConsumerName(persistentConsumerName);
List<Property> properties = new ArrayList<Property>();
- Map regProps = getRegistrationProperties();
+ Map regProps = getRegistrationProperties(false);
if (!regProps.isEmpty())
{
for (Object o : regProps.values())
@@ -276,7 +275,7 @@
public RegistrationProperty getRegistrationProperty(String name)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "registration property name", "RegistrationInfo.getRegistrationProperty");
- return (RegistrationProperty)getRegistrationProperties().get(name);
+ return getRegistrationProperties(false).get(name);
}
public RegistrationProperty setRegistrationPropertyValue(String name, String value)
@@ -284,7 +283,7 @@
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "registration property name", "RegistrationInfo.setRegistrationPropertyValue");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(value, "registration property value", "RegistrationInfo.setRegistrationPropertyValue");
- RegistrationProperty prop = (RegistrationProperty)getOrCreateRegistrationPropertiesMap(true).get(name);
+ RegistrationProperty prop = getOrCreateRegistrationPropertiesMap(true).get(name);
if (prop != null)
{
value = modifyIfNeeded(prop.getValue(), value);
@@ -312,26 +311,38 @@
dirty = true;
}
- private Map getOrCreateRegistrationPropertiesMap(boolean forceCreate)
+ private Map<String, RegistrationProperty> getOrCreateRegistrationPropertiesMap(boolean forceCreate)
{
if (forceCreate && persistentRegistrationProperties == null)
{
- persistentRegistrationProperties = new HashMap();
+ persistentRegistrationProperties = new HashMap<String, RegistrationProperty>();
}
return persistentRegistrationProperties;
}
- public Map getRegistrationProperties()
+ public Map<String,RegistrationProperty> getRegistrationProperties()
{
- Map properties = getOrCreateRegistrationPropertiesMap(false);
+ return getRegistrationProperties(true);
+ }
+
+ private Map<String,RegistrationProperty> getRegistrationProperties(boolean immutable)
+ {
+ Map<String,RegistrationProperty> properties = getOrCreateRegistrationPropertiesMap(false);
if (properties != null)
{
- return Collections.unmodifiableMap(properties);
+ if (immutable)
+ {
+ return Collections.unmodifiableMap(properties);
+ }
+ else
+ {
+ return properties;
+ }
}
else
{
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
}
@@ -360,6 +371,7 @@
if (forceRefresh || isRefreshNeeded())
{
+ // get a service description if we don't already have one
if (serviceDescription == null && parent != null)
{
try
@@ -373,6 +385,7 @@
}
}
+ // if we still don't have a service description, we have a problem!
if (serviceDescription == null)
{
String msg = "Couldn't get a service description to refresh from!";
@@ -383,10 +396,11 @@
persistentRegistrationProperties = getOrCreateRegistrationPropertiesMap(true);
RegistrationRefreshResult result = new RegistrationRefreshResult();
- // if we're not merging, we need to copy the properties so that we can collect validation results.
+
+ // if we're not merging, we need to copy the current properties so that we can collect validation results.
if (!mergeWithLocalInfo)
{
- result.setRegistrationProperties(new HashMap(persistentRegistrationProperties));
+ result.setRegistrationProperties(new HashMap<String,RegistrationProperty>(persistentRegistrationProperties));
}
dirty = false;
@@ -394,27 +408,26 @@
{
requiresRegistration = Boolean.TRUE;
StringBuffer message = new StringBuffer("Producer '").append(producerId).append("' requires registration");
- result.appendToStatus(message.toString());
+// result.appendToStatus(message.toString());
log.debug(message);
// check if the configured registration properties match the producer expectations
ModelDescription regPropDescs = serviceDescription.getRegistrationPropertyDescription();
if (regPropDescs != null)
{
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
PropertyDescription[] propertyDescriptions = regPropDescs.getPropertyDescriptions();
if (propertyDescriptions != null && propertyDescriptions.length > 0)
{
- Map descriptionsMap = getRegistrationPropertyDescriptionsFromWSRP(propertyDescriptions);
+ Map<String,RegistrationProperty> descriptionsMap = getRegistrationPropertyDescriptionsFromWSRP(propertyDescriptions);
// check that we don't have unexpected registration properties and if so, mark them as invalid or remove them
- Set expectedNames = descriptionsMap.keySet();
+ Set<String> expectedNames = descriptionsMap.keySet();
checkForExtraProperties(producerId, result, expectedNames, persistentRegistrationProperties, !mergeWithLocalInfo);
// Merge existing properties
- for (Object o : descriptionsMap.values())
+ for (RegistrationProperty prop : descriptionsMap.values())
{
- RegistrationProperty prop = (RegistrationProperty)o;
String name = prop.getName();
RegistrationProperty existing = getRegistrationProperty(name);
if (existing != null)
@@ -423,7 +436,7 @@
existing.setDescription(prop.getDescription());
if (existing.isDeterminedInvalid())
{
- result.setHasIssues(true);
+ result.setStatus(RefreshResult.Status.FAILURE);
}
}
else
@@ -438,8 +451,9 @@
result.getRegistrationProperties().put(name, prop);
}
- result.appendToStatus("Missing value for property '" + name + "'");
- result.setHasIssues(true);
+ log.debug("Missing value for property '" + name + "'");
+// result.appendToStatus("Missing value for property '" + name + "'");
+ result.setStatus(RefreshResult.Status.FAILURE);
}
}
}
@@ -457,9 +471,9 @@
{
String msg = "Producer '" + producerId + "' doesn't require registration";
log.debug(msg);
- result.appendToStatus(msg);
+// result.appendToStatus(msg);
requiresRegistration = Boolean.FALSE;
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
}
// if we're merging, the resulting properties are the saved properties
@@ -469,17 +483,19 @@
}
// if issues have been detected, mark the registration as invalid (but do not reset the data)
+ // todo: check if the state is consistent with the producer expectations for example if we have registration
+ // properties when the producer does not require registration?
consistentWithProducerExpectations = !result.hasIssues();
- String msg = "Registration configuration is " + (result.hasIssues() ? "NOT " : "") + "valid";
- result.appendToStatus(msg);
+ String msg = "Registration configuration is " + (consistentWithProducerExpectations ? "" : "NOT ") + "valid";
+// result.appendToStatus(msg);
log.debug(msg);
return result;
}
else
{
RegistrationRefreshResult result = new RegistrationRefreshResult();
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
result.setRegistrationProperties(persistentRegistrationProperties);
return result;
}
@@ -488,7 +504,7 @@
private void handleNoRequiredRegistrationProperties(String producerId, RegistrationRefreshResult result, boolean keepExtra, boolean forceCheckOfExtraProps)
{
log.debug("The producer didn't require any specific registration properties");
- Map properties = getOrCreateRegistrationPropertiesMap(false);
+ Map<String, RegistrationProperty> properties = getOrCreateRegistrationPropertiesMap(false);
if (properties != null && !properties.isEmpty())
{
if (forceCheckOfExtraProps || !hasRegisteredIfNeeded())
@@ -499,14 +515,14 @@
else
{
log.debug("Consumer is registered: producer most likely did not resend property descriptions");
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
}
}
else
{
log.debug("Using default registration data for producer '" + producerId + "'");
registrationData = WSRPTypeFactory.createDefaultRegistrationData();
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
}
}
@@ -516,27 +532,26 @@
* @param expectedNames
* @param properties
*/
- private void checkForExtraProperties(String producerId, RegistrationRefreshResult result, Set expectedNames, Map properties, boolean keepExtra)
+ private void checkForExtraProperties(String producerId, RegistrationRefreshResult result, Set<String> expectedNames, Map<String, RegistrationProperty> properties, boolean keepExtra)
{
- Set unexpected = new HashSet(properties.keySet());
+ Set<String> unexpected = new HashSet<String>(properties.keySet());
unexpected.removeAll(expectedNames);
if (!unexpected.isEmpty())
{
StringBuffer message = new StringBuffer("Unexpected registration properties:\n");
int size = unexpected.size();
int index = 0;
- for (Object anUnexpected : unexpected)
+ for (String name : unexpected)
{
- String name = (String)anUnexpected;
message.append("'").append(name).append("'");
if (keepExtra)
{
// mark the prop as invalid
- RegistrationProperty prop = (RegistrationProperty)properties.get(name);
+ RegistrationProperty prop = properties.get(name);
prop.setInvalid(Boolean.TRUE, RegistrationProperty.INEXISTENT_STATUS);
// do the same in the result
- prop = (RegistrationProperty)result.getRegistrationProperties().get(name);
+ prop = result.getRegistrationProperties().get(name);
prop.setInvalid(Boolean.TRUE, RegistrationProperty.INEXISTENT_STATUS);
}
else
@@ -551,8 +566,8 @@
}
}
log.debug(message);
- result.appendToStatus(message.toString());
- result.setHasIssues(true);
+// result.appendToStatus(message.toString());
+ result.setStatus(RefreshResult.Status.FAILURE);
}
}
@@ -560,7 +575,7 @@
* @param descriptions
* @return
*/
- private Map getRegistrationPropertyDescriptionsFromWSRP(PropertyDescription[] descriptions)
+ private Map<String,RegistrationProperty> getRegistrationPropertyDescriptionsFromWSRP(PropertyDescription[] descriptions)
{
if (descriptions != null)
{
@@ -579,7 +594,7 @@
}
else
{
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
}
@@ -646,32 +661,22 @@
public class RegistrationRefreshResult extends RefreshResult
{
+ private Map<String, RegistrationProperty> registrationProperties;
+
public RegistrationRefreshResult()
{
- super(false, "Unused");
+ super();
}
- private Map registrationProperties;
-
- public Map getRegistrationProperties()
+ public Map<String, RegistrationProperty> getRegistrationProperties()
{
return registrationProperties;
}
- public void setRegistrationProperties(Map registrationProperties)
+ public void setRegistrationProperties(Map<String,RegistrationProperty> registrationProperties)
{
this.registrationProperties = registrationProperties;
- }
-
- public boolean specificCode()
- {
- throw new UnsupportedOperationException();
- }
-
- public void setSpecificCode(boolean specificCode)
- {
- throw new UnsupportedOperationException();
- }
+ }
}
private String modifyIfNeeded(String oldValue, String newValue)
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java 2008-07-01 22:16:24 UTC (rev 11244)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java 2008-07-01 22:16:51 UTC (rev 11245)
@@ -60,13 +60,14 @@
setValue(stringValue);
}
+ @Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
- if (o == null || getClass() != o.getClass())
+ if (!(o instanceof RegistrationProperty))
{
return false;
}
@@ -81,40 +82,17 @@
{
return false;
}
- if (!persistentValue.equals(that.persistentValue))
- {
- return false;
- }
- if (persistentDescription != null ? !persistentDescription.equals(that.persistentDescription) : that.persistentDescription != null)
- {
- return false;
- }
- if (persistentInvalid != null ? !persistentInvalid.equals(that.persistentInvalid) : that.persistentInvalid != null)
- {
- return false;
- }
- if (!persistentLang.equals(that.persistentLang))
- {
- return false;
- }
- if (status != null ? !status.equals(that.status) : that.status != null)
- {
- return false;
- }
+ return !(persistentValue != null ? !persistentValue.equals(that.persistentValue) : that.persistentValue != null);
- return true;
}
+ @Override
public int hashCode()
{
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 + (status != null ? status.hashCode() : 0);
+ result = 31 * result + (persistentValue != null ? persistentValue.hashCode() : 0);
return result;
}
@@ -166,7 +144,7 @@
public boolean isDeterminedInvalid()
{
- return persistentInvalid != null && persistentInvalid.booleanValue();
+ return persistentInvalid != null && persistentInvalid;
}
public void setInvalid(Boolean invalid, String status)
17 years, 10 months
JBoss Portal SVN: r11244 - in branches/JBoss_Portal_Branch_2_7: core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes and 3 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-01 18:16:24 -0400 (Tue, 01 Jul 2008)
New Revision: 11244
Modified:
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
Log:
- Re-factored RefreshResult as it was mixing concerns by providing user-oriented messages.
- More internalization.
- Started to use ui:repeat instead of c:forEach as it's supposed to be better.
- Registration management fails with facelets 1.1.15-B1 but works OK with facelets 1.1.11.
- Status messages don't appear anymore for some reason (regardless of facelets version) with a warning on console.
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerManagerBean.java 2008-07-01 22:16:24 UTC (rev 11244)
@@ -51,6 +51,10 @@
static final String EXPECTED_REG_INFO_KEY = "expectedRegistrationInfo";
private static final String NO_CONSUMER = "bean_consumermanager_no_consumer";
private static final String INVALID_NEW_CONSUMER_NAME = "bean_consumermanager_invalid_new_consumer_name";
+ private static final String REFRESH_BYPASSED = "bean_consumermanager_refresh_bypassed";
+ private static final String REFRESH_SUCCESS = "bean_consumermanager_refresh_success";
+ private static final String REFRESH_FAILURE = "bean_consumermanager_refresh_failure";
+ private static final String REFRESH_EXCEPTION = "bean_consumermanager_refresh_exception";
public ConsumerRegistry getRegistry()
{
@@ -231,7 +235,7 @@
{
RefreshResult result = consumer.refresh(true);
-
+ String status = getLocalizationKeyFrom(result);
if (result.hasIssues())
{
// create the expected registration info and make it available
@@ -239,7 +243,7 @@
expected.refresh(result.getServiceDescription(), consumer.getProducerId(), true, true, true);
setExpectedRegistrationInfo(expected);
- beanContext.createErrorMessage(result.getStatus());
+ beanContext.createErrorMessage(status);
// refresh had issues, we should deactivate this consumer
registry.deactivateConsumerWith(consumer.getProducerId());
@@ -256,7 +260,7 @@
registry.deactivateConsumerWith(consumer.getProducerId());
}
- beanContext.createMessage(BeanContext.STATUS, result.getStatus(), beanContext.getInfoSeverity()); // todo: localize status!
+ beanContext.createInfoMessage(status);
}
return result;
}
@@ -267,6 +271,28 @@
}
}
+ private String getLocalizationKeyFrom(RefreshResult result)
+ {
+ RefreshResult.Status status = result.getStatus();
+ if (RefreshResult.Status.BYPASSED.equals(status))
+ {
+ return REFRESH_BYPASSED;
+ }
+ else if (RefreshResult.Status.SUCCESS.equals(status))
+ {
+ return REFRESH_SUCCESS;
+ }
+ else if (RefreshResult.Status.FAILURE.equals(status))
+ {
+ // todo: extract information from registration result to be more precise
+ return REFRESH_FAILURE;
+ }
+ else
+ {
+ return REFRESH_EXCEPTION;
+ }
+ }
+
RefreshResult refresh(WSRPConsumer consumer)
{
RefreshResult result = internalRefresh(consumer);
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource.properties 2008-07-01 22:16:24 UTC (rev 11244)
@@ -150,6 +150,10 @@
# ConsumerManagerBean
bean_consumermanager_invalid_new_consumer_name = Need a non-null, non-empty name for the new consumer!
bean_consumermanager_no_consumer = No consumer was selected!
+bean_consumermanager_refresh_bypassed = Refresh was not necessary.
+bean_consumermanager_refresh_success = Refresh was successful.
+bean_consumermanager_refresh_failure = Refresh failed (probably because the registration information was not valid).
+bean_consumermanager_refresh_exception = An unexpected error occurred.
# ProducerBean
bean_producer_regpolicy_unset = RegistrationPolicy unset
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/classes/WSRPConfigurationResource_fr.properties 2008-07-01 22:16:24 UTC (rev 11244)
@@ -126,4 +126,8 @@
producer_config_save=Sauvegarder
producer_config_sd_requires_reg=L'acc\u00e8s \u00e0 la description compl\u00e8te des services requiert l'enregistrement.
producer_config_strict=Utiliser la validation WSRP stricte.
-producer_config_title=Configuration producteur
\ No newline at end of file
+producer_config_title=Configuration producteur
+bean_consumermanager_refresh_bypassed=Le rafra\u00eechissement n'\u00e9tait pas requis.
+bean_consumermanager_refresh_exception=Une erreur inattendue s'est produite.
+bean_consumermanager_refresh_failure=Le rafra\u00eechissement a \u00e9chou\u00e9 (probablement \u00e0 cause d'informations d'enregistrement non valides)
+bean_consumermanager_refresh_success=Le rafra\u00eechissement a r\u00e9ussi.
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2008-07-01 22:16:24 UTC (rev 11244)
@@ -89,20 +89,18 @@
<th class="descColumn">#{i18n.edit_consumer_prop_desc}</th>
<th>#{i18n.edit_consumer_prop_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"
- valueChangeListener="#{consumer.regPropListener}"
- disabled="#{consumer.registrationModified}"/>
- <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
- rendered="#{prop.determinedInvalid}"/>
- </td>
- </tr>
- </c:forEach>
+ <tr jsfc="ui:repeat" value="#{consumer.producerInfo.registrationInfo.registrationProperties}"
+ var="prop" title="#{prop.description.label.value}">
+ <td>#{prop.name}</td>
+ <td>#{prop.description.label.value}</td>
+ <td>
+ <h:inputText value="#{prop.value}" size="50"
+ valueChangeListener="#{consumer.regPropListener}"
+ disabled="#{consumer.registrationModified}"/>
+ <h:outputText styleClass="portlet-msg-error" value="#{prop.status}"
+ rendered="#{prop.determinedInvalid}"/>
+ </td>
+ </tr>
</table>
<h:commandLink action="#{consumer.update}"
value="#{i18n.edit_consumer_registration_update_props}"
@@ -113,7 +111,8 @@
#{i18n.edit_consumer_registration_no_props}
</c:otherwise>
</c:choose>
- <h:commandLink action="#{consumer.modifyRegistration}" value="#{i18n.edit_consumer_registration_modify}"
+ <h:commandLink action="#{consumer.modifyRegistration}"
+ value="#{i18n.edit_consumer_registration_modify}"
rendered="#{consumer.registrationLocallyModified}"
title="#{i18n.edit_consumer_registration_modify_title}"
styleClass="portlet-form-button portlet-section-buttonrow"/>
@@ -133,17 +132,16 @@
<th class="descColumn">#{i18n.edit_consumer_prop_desc}</th>
<th>#{i18n.edit_consumer_prop_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>
+ <tr jsfc="ui:repeat" value="#{consumer.expectedRegistrationInfo.registrationProperties}"
+ var="prop" 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>
</table>
</c:when>
<c:otherwise>
@@ -151,9 +149,9 @@
</c:otherwise>
</c:choose>
<h:commandLink action="#{consumer.modifyRegistration}"
- value="#{i18n.edit_consumer_registration_modify}"
- title="#{i18n.edit_consumer_registration_modify_title}"
- styleClass="portlet-form-button portlet-section-buttonrow"/>
+ value="#{i18n.edit_consumer_registration_modify}"
+ title="#{i18n.edit_consumer_registration_modify_title}"
+ styleClass="portlet-form-button portlet-section-buttonrow"/>
<br style="clear:both;"/>
</h:panelGroup>
</c:if>
@@ -168,7 +166,8 @@
<tr>
<th>#{i18n.edit_consumer_registration_context}</th>
<td id="handle">
- #{i18n.edit_consumer_registration_context_handle} <h:outputText value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
+ #{i18n.edit_consumer_registration_context_handle} <h:outputText
+ value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
<h:commandLink action="confirmEraseRegistration" value="#{i18n.edit_consumer_registration_context_erase}"
title="#{i18n.edit_consumer_registration_context_erase_title}"
styleClass="portlet-form-button"/>
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/consumer/RegistrationInfoTestCase.java 2008-07-01 22:16:24 UTC (rev 11244)
@@ -129,7 +129,7 @@
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());
+ RegistrationProperty.UNCHECKED_VALUE_STATUS, prop.getStatus());
}
public void testRefreshNoRegistration()
@@ -139,20 +139,20 @@
RefreshResult result = info.refresh(sd, producerId, true, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
- assertTrue(info.isConsistentWithProducerExpectations().booleanValue());
- assertFalse(info.isRegistrationRequired().booleanValue());
+ assertTrue(info.isConsistentWithProducerExpectations());
+ assertFalse(info.isRegistrationRequired());
assertTrue(info.isRegistrationDeterminedNotRequired());
assertFalse(info.isRegistrationDeterminedRequired());
- assertTrue(info.isRegistrationValid().booleanValue());
+ assertTrue(info.isRegistrationValid());
result = info.refresh(sd, producerId, false, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
- assertTrue(info.isConsistentWithProducerExpectations().booleanValue());
- assertFalse(info.isRegistrationRequired().booleanValue());
+ assertTrue(info.isConsistentWithProducerExpectations());
+ assertFalse(info.isRegistrationRequired());
assertTrue(info.isRegistrationDeterminedNotRequired());
assertFalse(info.isRegistrationDeterminedRequired());
- assertTrue(info.isRegistrationValid().booleanValue());
+ assertTrue(info.isRegistrationValid());
}
public void testRefreshRegistrationDefaultRegistrationNoLocalInfo()
@@ -162,13 +162,13 @@
assertNull(info.isRegistrationValid());
RegistrationInfo.RegistrationRefreshResult result = info.refresh(
- createServiceDescription(true, 0), producerId, true, false, false);
+ createServiceDescription(true, 0), producerId, true, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
- assertTrue(info.isRegistrationRequired().booleanValue());
+ assertTrue(info.isRegistrationRequired());
assertTrue(info.isRegistrationDeterminedRequired());
assertFalse(info.isRegistrationDeterminedNotRequired());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
}
public void testRefreshRegistrationDefaultRegistrationExtraLocalInfo()
@@ -177,12 +177,10 @@
info.setRegistrationPropertyValue("foo", "bar");
RegistrationInfo.RegistrationRefreshResult result = info.refresh(
- createServiceDescription(true, 0), producerId, false, false, false);
+ createServiceDescription(true, 0), producerId, false, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
- String status = result.getStatus();
- assertNotNull(status);
- assertTrue(status.indexOf("foo") != -1);
+ assertEquals(RefreshResult.Status.FAILURE, result.getStatus());
assertEquals(1, info.getRegistrationProperties().size());
assertEquals(1, result.getRegistrationProperties().size());
@@ -192,7 +190,7 @@
RegistrationProperty prop = (RegistrationProperty)regProps.get("foo");
assertNotNull(prop);
assertEquals("bar", prop.getValue());
- assertTrue(prop.isInvalid().booleanValue());
+ assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.INEXISTENT_STATUS, prop.getStatus());
}
@@ -204,9 +202,7 @@
RegistrationInfo.RegistrationRefreshResult result = info.refresh(sd, producerId, false, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
- String status = result.getStatus();
- assertNotNull(status);
- assertTrue(status.indexOf("prop0") != -1 && status.indexOf("prop1") != -1);
+ assertEquals(RefreshResult.Status.FAILURE, result.getStatus());
assertEquals(0, info.getRegistrationProperties().size());
assertEquals(2, result.getRegistrationProperties().size());
@@ -215,8 +211,12 @@
RegistrationProperty prop = (RegistrationProperty)regProps.get("prop0");
assertNotNull(prop);
- assertTrue(prop.isInvalid().booleanValue());
+ assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.MISSING_STATUS, prop.getStatus());
+ prop = (RegistrationProperty)regProps.get("prop1");
+ assertNotNull(prop);
+ assertTrue(prop.isInvalid());
+ assertEquals(RegistrationProperty.MISSING_STATUS, prop.getStatus());
}
public void testRefreshRegistrationRegistrationMergeWithLocalInfo()
@@ -224,20 +224,20 @@
info.setRegistrationPropertyValue("foo", "bar");
RegistrationInfo.RegistrationRefreshResult result = info.refresh(createServiceDescription(true, 2),
- producerId, true, false, false);
+ producerId, true, false, false);
assertNotNull(result);
assertTrue(result.hasIssues());
RegistrationProperty prop = info.getRegistrationProperty("prop0");
assertNotNull(prop);
assertNull(prop.getValue());
- assertTrue(prop.isInvalid().booleanValue());
+ assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.MISSING_VALUE_STATUS, prop.getStatus());
prop = info.getRegistrationProperty("prop1");
assertNotNull(prop);
assertNull(prop.getValue());
- assertTrue(prop.isInvalid().booleanValue());
+ assertTrue(prop.isInvalid());
assertEquals(RegistrationProperty.MISSING_VALUE_STATUS, prop.getStatus());
assertEquals(2, info.getRegistrationProperties().size());
assertEquals(2, result.getRegistrationProperties().size());
@@ -251,28 +251,28 @@
RefreshResult result = info.refresh(createServiceDescription(true, 0), producerId, false, false, false);
assertNotNull(result);
assertFalse(result.hasIssues());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
// 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, false);
assertTrue(result.hasIssues());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
info.removeRegistrationProperty("foo");
result = info.refresh(createServiceDescription(true, 0), producerId, false, false, false);
assertFalse(result.hasIssues());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
// producer has changed but we're not forcing refresh so registration should still be invalid
result = info.refresh(createServiceDescription(false, 0), producerId, false, false, false);
assertFalse(result.hasIssues());
- assertFalse(info.isRegistrationValid().booleanValue());
+ assertFalse(info.isRegistrationValid());
// force refresh, registration should now be valid
result = info.refresh(createServiceDescription(false, 0), producerId, false, true, false);
assertFalse(result.hasIssues());
- assertTrue(info.isRegistrationValid().booleanValue());
+ assertTrue(info.isRegistrationValid());
}
public void testSetRegistrationContext()
@@ -286,10 +286,10 @@
assertNotNull(registrationContext);
assertEquals(registrationHandle, registrationContext.getRegistrationHandle());
assertNull(registrationContext.getRegistrationState());
- assertTrue(info.isConsistentWithProducerExpectations().booleanValue());
- assertTrue(info.isRegistrationValid().booleanValue());
+ assertTrue(info.isConsistentWithProducerExpectations());
+ assertTrue(info.isRegistrationValid());
assertFalse(info.isRefreshNeeded());
- assertTrue(info.isRegistrationRequired().booleanValue());
+ assertTrue(info.isRegistrationRequired());
assertTrue(info.isRegistrationDeterminedRequired());
assertFalse(info.isRegistrationDeterminedNotRequired());
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2008-07-01 22:16:24 UTC (rev 11244)
@@ -265,7 +265,7 @@
*/
public boolean refresh(boolean forceRefresh) throws PortletInvokerException
{
- return detailedRefresh(forceRefresh).specificCode();
+ return detailedRefresh(forceRefresh).didRefreshHappen();
}
public RefreshResult detailedRefresh(boolean forceRefresh) throws PortletInvokerException
@@ -273,7 +273,7 @@
RefreshResult result = internalRefresh(forceRefresh);
// update DB
- if (result.specificCode())
+ if (result.didRefreshHappen())
{
// mark as inactive if the refresh had issues...
if (result.hasIssues())
@@ -303,14 +303,17 @@
if (forceRefresh || isRefreshNeeded(true))
{
log.debug("Refreshing info for producer '" + getId() + "'");
- RefreshResult result = new RefreshResult(true, REFRESH_MEANING);
+// RefreshResult result = new RefreshResult(true, REFRESH_MEANING);
+ RefreshResult result = new RefreshResult();
try
{
persistentEndpointInfo.refresh();
}
catch (InvokerUnavailableException e)
{
- result.appendToStatus("Couldn't refresh endpoint information: ").append(e.getLocalizedMessage());
+ log.debug("Couldn't refresh endpoint information: " + e);
+// result.appendToStatus("Couldn't refresh endpoint information: ").append(e.getLocalizedMessage());
+// throw new PortletInvokerException("Couldn't refresh endpoint information: " + e.getLocalizedMessage());
}
// save changes to endpoint
registry.updateProducerInfo(this);
@@ -340,8 +343,9 @@
setActiveAndSave(false);
}
- result.appendToStatus(registrationResult.getStatus(), false);
- result.setHasIssues(registrationResult.hasIssues());
+ result.setRegistrationResult(registrationResult);
+ /*result.appendToStatus(registrationResult.getStatus(), false);
+ result.setHasIssues(registrationResult.hasIssues());*/
return result;
}
else
@@ -366,13 +370,13 @@
RefreshResult registrationResult = internalRefreshRegistration(serviceDescription, true, forceRefresh, !registeredSDSucceeded);
registry.updateProducerInfo(this);
- result.appendToStatus(registrationResult.getStatus());
+// result.appendToStatus(registrationResult.getStatus());
// attempt to register and determine if the current service description can be used to extract POPs
if (registeredSDSucceeded && !registrationResult.hasIssues())
{
registrationResult = register(serviceDescription, false);
- if (registrationResult.specificCode())
+ if (RefreshResult.Status.SUCCESS.equals(registrationResult.getStatus()))
{
// registration occurred, so we should ask for a new service description
serviceDescription = getServiceDescription(false);
@@ -382,9 +386,10 @@
extractOfferedPortlets(serviceDescription);
}
- result.appendToStatus(registrationResult.getStatus());
- result.setHasIssues(registrationResult.hasIssues());
- result.appendToStatus("Producer information successfully refreshed");
+// result.appendToStatus(registrationResult.getStatus());
+// result.setHasIssues(registrationResult.hasIssues());
+ result.setRegistrationResult(registrationResult);
+// result.appendToStatus("Producer information successfully refreshed");
return result;
}
@@ -397,7 +402,7 @@
}
}
- return new RefreshResult(false, REFRESH_MEANING);
+ return new RefreshResult(RefreshResult.Status.BYPASSED);
}
private Map<String, ItemDescription> toMap(ItemDescription[] itemDescriptions)
@@ -487,8 +492,8 @@
if (info.isUsesMethodGet())
{
log.warn("Portlet '" + portletHandle
- + "' uses the GET method in forms. Since we don't handle this, this portlet will be excluded from " +
- "the list of offered portlets for producer " + persistentId);
+ + "' uses the GET method in forms. Since we don't handle this, this portlet will be excluded from " +
+ "the list of offered portlets for producer " + persistentId);
}
else
{
@@ -561,7 +566,7 @@
catch (Exception e)
{
log.debug("Couldn't get portlet via getPortletDescription for producer '" + persistentId
- + "'. Attempting to retrieve it from the service description as this producer might not support the PortletManagement interface.", e);
+ + "'. Attempting to retrieve it from the service description as this producer might not support the PortletManagement interface.", e);
justRefreshed = refresh(true);
portlet = getPortletFromCaches(portletHandle, justRefreshed);
@@ -632,7 +637,7 @@
private boolean isCacheExpired()
{
boolean result = !useCache() || System.currentTimeMillis() > expirationTimeMillis || popsMap == null
- || portletGroups == null;
+ || portletGroups == null;
if (result)
{
log.debug("Cache expired or not used");
@@ -705,7 +710,7 @@
{
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);
+ + persistentId + ", please see the logs for more information.", cause == null ? e : cause);
}
private GetServiceDescription getServiceDescriptionRequest(boolean asUnregistred) throws PortletInvokerException
@@ -774,7 +779,7 @@
throw new RuntimeException("Couldn't reset registration", e);
}
throw new IllegalArgumentException("Couldn't get property descriptions for portlet '" + portletHandle
- + "' because the provided registration is invalid!");
+ + "' because the provided registration is invalid!");
}
catch (Exception e)
{
@@ -826,7 +831,7 @@
{
log.debug("Attempting registration");
RegistrationContext registrationContext = persistentEndpointInfo.getRegistrationService()
- .register(persistentRegistrationInfo.getRegistrationData());
+ .register(persistentRegistrationInfo.getRegistrationData());
if (registrationContext == null)
{
@@ -836,10 +841,13 @@
persistentRegistrationInfo.setRegistrationContext(registrationContext);
String msg = "Consumer with id '" + persistentId + "' successfully registered with handle: '"
- + registrationContext.getRegistrationHandle() + "'";
+ + registrationContext.getRegistrationHandle() + "'";
log.debug(msg);
- result.appendToStatus(msg);
- return new RefreshResult(result, true, REGISTER_MEANING);
+// result.appendToStatus(msg);
+ RefreshResult res = new RefreshResult();
+ res.setRegistrationResult(result);
+ return res;
+// return new RefreshResult(result, true, REGISTER_MEANING);
}
catch (Exception e)
{
@@ -861,7 +869,7 @@
}
}
- return new RefreshResult(false, REGISTER_MEANING);
+ return new RefreshResult(RefreshResult.Status.BYPASSED);
}
public void deregister() throws PortletInvokerException
@@ -904,7 +912,7 @@
{
RegistrationContext registrationContext = getRegistrationContext();
ModifyRegistration modifyRegistration = WSRPTypeFactory.createModifyRegistration(registrationContext,
- persistentRegistrationInfo.getRegistrationData());
+ persistentRegistrationInfo.getRegistrationData());
RegistrationState state = persistentEndpointInfo.getRegistrationService().modifyRegistration(modifyRegistration);
// force refresh of internal RegistrationInfo state
@@ -934,7 +942,7 @@
else
{
throw new IllegalStateException("Cannot modify registration for producer '" + persistentId
- + "' as it's not registered");
+ + "' as it's not registered");
}
}
@@ -954,7 +962,7 @@
}
RefreshResult result =
- persistentRegistrationInfo.refresh(serviceDescription, persistentId, mergeWithLocalInfo, forceRefresh, forceCheckOfExtraProps);
+ persistentRegistrationInfo.refresh(serviceDescription, persistentId, mergeWithLocalInfo, forceRefresh, forceCheckOfExtraProps);
log.debug("Refreshed registration information for consumer with id '" + persistentId + "'");
@@ -964,9 +972,9 @@
public boolean isRefreshNeeded(boolean considerCache)
{
boolean result = (considerCache && isCacheExpired())
- || persistentRegistrationInfo == null
- || persistentRegistrationInfo.isRefreshNeeded()
- || persistentEndpointInfo.isRefreshNeeded();
+ || persistentRegistrationInfo == null
+ || persistentRegistrationInfo.isRefreshNeeded()
+ || persistentEndpointInfo.isRefreshNeeded();
if (result)
{
log.debug("Refresh needed for producer '" + persistentId + "'");
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RefreshResult.java 2008-07-01 22:16:24 UTC (rev 11244)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp.consumer;
+import static org.jboss.portal.wsrp.consumer.RefreshResult.Status.*;
import org.jboss.portal.wsrp.core.ServiceDescription;
/**
@@ -32,73 +33,57 @@
*/
public class RefreshResult
{
- private StringBuffer status = new StringBuffer();
- private boolean hasIssues;
- private boolean specificCode;
- private final String meaning;
- private ServiceDescription serviceDescription;
- private static final String COLON = ".\n";
-
- public RefreshResult(boolean specificCode, String specificCodeMeaning)
+ public enum Status
{
- this.specificCode = specificCode;
- this.meaning = specificCodeMeaning;
+ SUCCESS, FAILURE, UNAVAILABLE, BYPASSED, UNKNOWN
}
- public RefreshResult(RefreshResult previous, boolean specificCode, String specificCodeMeaning)
- {
- this(specificCode, specificCodeMeaning);
- appendToStatus(previous.getStatus());
- setHasIssues(previous.hasIssues);
- }
+ private ServiceDescription serviceDescription;
+ private Status status;
+ private RefreshResult registrationResult;
- public boolean hasIssues()
+ public RefreshResult()
{
- return hasIssues;
+ status = UNKNOWN;
}
- public void setHasIssues(boolean hasIssues)
+ public RefreshResult(Status status)
{
- this.hasIssues = hasIssues;
+ this.status = status;
}
- public String getStatus()
+ public RefreshResult getRegistrationResult()
{
- return status.toString();
+ return registrationResult;
}
- StringBuffer appendToStatus(String message)
+ public void setRegistrationResult(RefreshResult registrationResult)
{
- return appendToStatus(message, true);
+ if (registrationResult != null)
+ {
+ this.registrationResult = registrationResult;
+ status = registrationResult.getStatus();
+ }
}
- StringBuffer appendToStatus(String message, boolean appendColon)
+ public boolean didRefreshHappen()
{
- if (message != null && message.length() > 1)
- {
- status.append(message);
- // only happen a colon if the message is not ending with one already.
- if (appendColon && (status.lastIndexOf(COLON) != status.length() - 2))
- {
- status.append(COLON);
- }
- }
- return status;
+ return SUCCESS.equals(status) || FAILURE.equals(status);
}
- public boolean specificCode()
+ public boolean hasIssues()
{
- return specificCode;
+ return !(SUCCESS.equals(status) || BYPASSED.equals(status));
}
- public void setSpecificCode(boolean specificCode)
+ public Status getStatus()
{
- this.specificCode = specificCode;
+ return status;
}
- public String getMeaning()
+ public void setStatus(Status status)
{
- return meaning;
+ this.status = status;
}
public void setServiceDescription(ServiceDescription serviceDescription)
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationInfo.java 2008-07-01 22:16:24 UTC (rev 11244)
@@ -59,7 +59,7 @@
private String persistentConsumerName;
private String persistentRegistrationHandle;
private byte[] persistentRegistrationState;
- private Map persistentRegistrationProperties;
+ private Map<String, RegistrationProperty> persistentRegistrationProperties;
private transient Boolean requiresRegistration;
private transient Boolean consistentWithProducerExpectations;
@@ -100,10 +100,9 @@
if (other.persistentRegistrationProperties != null)
{
- this.persistentRegistrationProperties = new HashMap(other.persistentRegistrationProperties.size());
- for (Object o : other.persistentRegistrationProperties.values())
+ this.persistentRegistrationProperties = new HashMap<String, RegistrationProperty>(other.persistentRegistrationProperties.size());
+ for (RegistrationProperty otherProp : other.persistentRegistrationProperties.values())
{
- RegistrationProperty otherProp = (RegistrationProperty)o;
String name = otherProp.getName();
RegistrationProperty prop = new RegistrationProperty(name, otherProp.getValue(), otherProp.getLang());
prop.setStatus(otherProp.getStatus());
@@ -231,7 +230,7 @@
public boolean hasLocalInfo()
{
- return persistentRegistrationHandle != null || !getRegistrationProperties().isEmpty();
+ return persistentRegistrationHandle != null || (persistentRegistrationProperties != null && !persistentRegistrationProperties.isEmpty());
}
public RegistrationData getRegistrationData()
@@ -239,7 +238,7 @@
registrationData = WSRPTypeFactory.createDefaultRegistrationData();
registrationData.setConsumerName(persistentConsumerName);
List<Property> properties = new ArrayList<Property>();
- Map regProps = getRegistrationProperties();
+ Map regProps = getRegistrationProperties(false);
if (!regProps.isEmpty())
{
for (Object o : regProps.values())
@@ -276,7 +275,7 @@
public RegistrationProperty getRegistrationProperty(String name)
{
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "registration property name", "RegistrationInfo.getRegistrationProperty");
- return (RegistrationProperty)getRegistrationProperties().get(name);
+ return getRegistrationProperties(false).get(name);
}
public RegistrationProperty setRegistrationPropertyValue(String name, String value)
@@ -284,7 +283,7 @@
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "registration property name", "RegistrationInfo.setRegistrationPropertyValue");
ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(value, "registration property value", "RegistrationInfo.setRegistrationPropertyValue");
- RegistrationProperty prop = (RegistrationProperty)getOrCreateRegistrationPropertiesMap(true).get(name);
+ RegistrationProperty prop = getOrCreateRegistrationPropertiesMap(true).get(name);
if (prop != null)
{
value = modifyIfNeeded(prop.getValue(), value);
@@ -312,26 +311,38 @@
dirty = true;
}
- private Map getOrCreateRegistrationPropertiesMap(boolean forceCreate)
+ private Map<String, RegistrationProperty> getOrCreateRegistrationPropertiesMap(boolean forceCreate)
{
if (forceCreate && persistentRegistrationProperties == null)
{
- persistentRegistrationProperties = new HashMap();
+ persistentRegistrationProperties = new HashMap<String, RegistrationProperty>();
}
return persistentRegistrationProperties;
}
- public Map getRegistrationProperties()
+ public Map<String, RegistrationProperty> getRegistrationProperties()
{
- Map properties = getOrCreateRegistrationPropertiesMap(false);
+ return getRegistrationProperties(true);
+ }
+
+ private Map<String, RegistrationProperty> getRegistrationProperties(boolean immutable)
+ {
+ Map<String, RegistrationProperty> properties = getOrCreateRegistrationPropertiesMap(false);
if (properties != null)
{
- return Collections.unmodifiableMap(properties);
+ if (immutable)
+ {
+ return Collections.unmodifiableMap(properties);
+ }
+ else
+ {
+ return properties;
+ }
}
else
{
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
}
@@ -360,6 +371,7 @@
if (forceRefresh || isRefreshNeeded())
{
+ // get a service description if we don't already have one
if (serviceDescription == null && parent != null)
{
try
@@ -373,6 +385,7 @@
}
}
+ // if we still don't have a service description, we have a problem!
if (serviceDescription == null)
{
String msg = "Couldn't get a service description to refresh from!";
@@ -383,10 +396,11 @@
persistentRegistrationProperties = getOrCreateRegistrationPropertiesMap(true);
RegistrationRefreshResult result = new RegistrationRefreshResult();
- // if we're not merging, we need to copy the properties so that we can collect validation results.
+
+ // if we're not merging, we need to copy the current properties so that we can collect validation results.
if (!mergeWithLocalInfo)
{
- result.setRegistrationProperties(new HashMap(persistentRegistrationProperties));
+ result.setRegistrationProperties(new HashMap<String, RegistrationProperty>(persistentRegistrationProperties));
}
dirty = false;
@@ -394,27 +408,26 @@
{
requiresRegistration = Boolean.TRUE;
StringBuffer message = new StringBuffer("Producer '").append(producerId).append("' requires registration");
- result.appendToStatus(message.toString());
+// result.appendToStatus(message.toString());
log.debug(message);
// check if the configured registration properties match the producer expectations
ModelDescription regPropDescs = serviceDescription.getRegistrationPropertyDescription();
if (regPropDescs != null)
{
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
PropertyDescription[] propertyDescriptions = regPropDescs.getPropertyDescriptions();
if (propertyDescriptions != null && propertyDescriptions.length > 0)
{
- Map descriptionsMap = getRegistrationPropertyDescriptionsFromWSRP(propertyDescriptions);
+ Map<String, RegistrationProperty> descriptionsMap = getRegistrationPropertyDescriptionsFromWSRP(propertyDescriptions);
// check that we don't have unexpected registration properties and if so, mark them as invalid or remove them
- Set expectedNames = descriptionsMap.keySet();
+ Set<String> expectedNames = descriptionsMap.keySet();
checkForExtraProperties(producerId, result, expectedNames, persistentRegistrationProperties, !mergeWithLocalInfo);
// Merge existing properties
- for (Object o : descriptionsMap.values())
+ for (RegistrationProperty prop : descriptionsMap.values())
{
- RegistrationProperty prop = (RegistrationProperty)o;
String name = prop.getName();
RegistrationProperty existing = getRegistrationProperty(name);
if (existing != null)
@@ -423,7 +436,7 @@
existing.setDescription(prop.getDescription());
if (existing.isDeterminedInvalid())
{
- result.setHasIssues(true);
+ result.setStatus(RefreshResult.Status.FAILURE);
}
}
else
@@ -438,8 +451,9 @@
result.getRegistrationProperties().put(name, prop);
}
- result.appendToStatus("Missing value for property '" + name + "'");
- result.setHasIssues(true);
+ log.debug("Missing value for property '" + name + "'");
+// result.appendToStatus("Missing value for property '" + name + "'");
+ result.setStatus(RefreshResult.Status.FAILURE);
}
}
}
@@ -457,9 +471,9 @@
{
String msg = "Producer '" + producerId + "' doesn't require registration";
log.debug(msg);
- result.appendToStatus(msg);
+// result.appendToStatus(msg);
requiresRegistration = Boolean.FALSE;
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
}
// if we're merging, the resulting properties are the saved properties
@@ -469,17 +483,19 @@
}
// if issues have been detected, mark the registration as invalid (but do not reset the data)
+ // todo: check if the state is consistent with the producer expectations for example if we have registration
+ // properties when the producer does not require registration?
consistentWithProducerExpectations = !result.hasIssues();
- String msg = "Registration configuration is " + (result.hasIssues() ? "NOT " : "") + "valid";
- result.appendToStatus(msg);
+ String msg = "Registration configuration is " + (consistentWithProducerExpectations ? "" : "NOT ") + "valid";
+// result.appendToStatus(msg);
log.debug(msg);
return result;
}
else
{
RegistrationRefreshResult result = new RegistrationRefreshResult();
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
result.setRegistrationProperties(persistentRegistrationProperties);
return result;
}
@@ -488,7 +504,7 @@
private void handleNoRequiredRegistrationProperties(String producerId, RegistrationRefreshResult result, boolean keepExtra, boolean forceCheckOfExtraProps)
{
log.debug("The producer didn't require any specific registration properties");
- Map properties = getOrCreateRegistrationPropertiesMap(false);
+ Map<String, RegistrationProperty> properties = getOrCreateRegistrationPropertiesMap(false);
if (properties != null && !properties.isEmpty())
{
if (forceCheckOfExtraProps || !hasRegisteredIfNeeded())
@@ -499,14 +515,14 @@
else
{
log.debug("Consumer is registered: producer most likely did not resend property descriptions");
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
}
}
else
{
log.debug("Using default registration data for producer '" + producerId + "'");
registrationData = WSRPTypeFactory.createDefaultRegistrationData();
- result.setHasIssues(false);
+ result.setStatus(RefreshResult.Status.SUCCESS);
}
}
@@ -516,27 +532,26 @@
* @param expectedNames
* @param properties
*/
- private void checkForExtraProperties(String producerId, RegistrationRefreshResult result, Set expectedNames, Map properties, boolean keepExtra)
+ private void checkForExtraProperties(String producerId, RegistrationRefreshResult result, Set<String> expectedNames, Map<String, RegistrationProperty> properties, boolean keepExtra)
{
- Set unexpected = new HashSet(properties.keySet());
+ Set<String> unexpected = new HashSet<String>(properties.keySet());
unexpected.removeAll(expectedNames);
if (!unexpected.isEmpty())
{
StringBuffer message = new StringBuffer("Unexpected registration properties:\n");
int size = unexpected.size();
int index = 0;
- for (Object anUnexpected : unexpected)
+ for (String name : unexpected)
{
- String name = (String)anUnexpected;
message.append("'").append(name).append("'");
if (keepExtra)
{
// mark the prop as invalid
- RegistrationProperty prop = (RegistrationProperty)properties.get(name);
+ RegistrationProperty prop = properties.get(name);
prop.setInvalid(Boolean.TRUE, RegistrationProperty.INEXISTENT_STATUS);
// do the same in the result
- prop = (RegistrationProperty)result.getRegistrationProperties().get(name);
+ prop = result.getRegistrationProperties().get(name);
prop.setInvalid(Boolean.TRUE, RegistrationProperty.INEXISTENT_STATUS);
}
else
@@ -551,8 +566,8 @@
}
}
log.debug(message);
- result.appendToStatus(message.toString());
- result.setHasIssues(true);
+// result.appendToStatus(message.toString());
+ result.setStatus(RefreshResult.Status.FAILURE);
}
}
@@ -560,7 +575,7 @@
* @param descriptions
* @return
*/
- private Map getRegistrationPropertyDescriptionsFromWSRP(PropertyDescription[] descriptions)
+ private Map<String, RegistrationProperty> getRegistrationPropertyDescriptionsFromWSRP(PropertyDescription[] descriptions)
{
if (descriptions != null)
{
@@ -579,7 +594,7 @@
}
else
{
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
}
@@ -646,32 +661,22 @@
public class RegistrationRefreshResult extends RefreshResult
{
+ private Map<String, RegistrationProperty> registrationProperties;
+
public RegistrationRefreshResult()
{
- super(false, "Unused");
+ super();
}
- private Map registrationProperties;
-
- public Map getRegistrationProperties()
+ public Map<String, RegistrationProperty> getRegistrationProperties()
{
return registrationProperties;
}
- public void setRegistrationProperties(Map registrationProperties)
+ public void setRegistrationProperties(Map<String, RegistrationProperty> registrationProperties)
{
this.registrationProperties = registrationProperties;
}
-
- public boolean specificCode()
- {
- throw new UnsupportedOperationException();
- }
-
- public void setSpecificCode(boolean specificCode)
- {
- throw new UnsupportedOperationException();
- }
}
private String modifyIfNeeded(String oldValue, String newValue)
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java 2008-07-01 21:53:05 UTC (rev 11243)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/consumer/RegistrationProperty.java 2008-07-01 22:16:24 UTC (rev 11244)
@@ -60,13 +60,14 @@
setValue(stringValue);
}
+ @Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
- if (o == null || getClass() != o.getClass())
+ if (!(o instanceof RegistrationProperty))
{
return false;
}
@@ -81,40 +82,17 @@
{
return false;
}
- if (!persistentValue.equals(that.persistentValue))
- {
- return false;
- }
- if (persistentDescription != null ? !persistentDescription.equals(that.persistentDescription) : that.persistentDescription != null)
- {
- return false;
- }
- if (persistentInvalid != null ? !persistentInvalid.equals(that.persistentInvalid) : that.persistentInvalid != null)
- {
- return false;
- }
- if (!persistentLang.equals(that.persistentLang))
- {
- return false;
- }
- if (status != null ? !status.equals(that.status) : that.status != null)
- {
- return false;
- }
+ return !(persistentValue != null ? !persistentValue.equals(that.persistentValue) : that.persistentValue != null);
- return true;
}
+ @Override
public int hashCode()
{
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 + (status != null ? status.hashCode() : 0);
+ result = 31 * result + (persistentValue != null ? persistentValue.hashCode() : 0);
return result;
}
@@ -166,7 +144,7 @@
public boolean isDeterminedInvalid()
{
- return persistentInvalid != null && persistentInvalid.booleanValue();
+ return persistentInvalid != null && persistentInvalid;
}
public void setInvalid(Boolean invalid, String status)
17 years, 10 months
JBoss Portal SVN: r11243 - in modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model: layout and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-01 17:53:05 -0400 (Tue, 01 Jul 2008)
New Revision: 11243
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
Log:
rename methods
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-07-01 21:51:03 UTC (rev 11242)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-07-01 21:53:05 UTC (rev 11243)
@@ -92,7 +92,7 @@
}
else if (id.startsWith("structure."))
{
- return layoutStore.getItem(id.substring(10));
+ return layoutStore.getElement(id.substring(10));
}
else
{
@@ -153,7 +153,7 @@
{
if (o instanceof PageNode)
{
- LayoutStructure layoutStructure = (LayoutStructure)layoutStore.findItemByRef(((PageNode)o).getId());
+ LayoutStructure layoutStructure = (LayoutStructure)layoutStore.findElementByRef(((PageNode)o).getId());
//
children = layoutStructure.getElements();
@@ -244,7 +244,7 @@
PageNode page = (PageNode)o;
//
- LayoutStructure layoutStructure = (LayoutStructure)layoutStore.findItemByRef(((PageNode)o).getId());
+ LayoutStructure layoutStructure = (LayoutStructure)layoutStore.findElementByRef(((PageNode)o).getId());
//
Map<String, Serializable> properties = new HashMap<String, Serializable>(page.getProperties());
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-07-01 21:51:03 UTC (rev 11242)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-07-01 21:53:05 UTC (rev 11243)
@@ -59,7 +59,7 @@
* @param id the layout object id
* @return a layout object
*/
- public LayoutElement getItem(String id)
+ public LayoutElement getElement(String id)
{
LayoutElementContext context = contextsById.get(id);
@@ -73,7 +73,7 @@
* @param ref the reference
* @return a layout object
*/
- public LayoutElement findItemByRef(String ref)
+ public LayoutElement findElementByRef(String ref)
{
LayoutElementContext context = contextsByObjectRef.get(ref);
17 years, 10 months
JBoss Portal SVN: r11242 - in modules/presentation/trunk: ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model and 7 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-07-01 17:51:03 -0400 (Tue, 01 Jul 2008)
New Revision: 11242
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/MetaWidget.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/DestroyObjectAction.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml
modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/portlet.xml
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
Log:
add explicit refresh capabiities on windows
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -32,6 +32,7 @@
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.i18n.client.DateTimeFormat;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
import org.jboss.portal.presentation.ajax.client.model.AjaxObject;
import org.jboss.portal.presentation.ajax.client.utils.Bootstrap;
@@ -41,6 +42,7 @@
import java.util.Map;
import java.util.HashMap;
+import java.util.Date;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -122,9 +124,12 @@
/** . */
private Element container;
+ private DateTimeFormat format;
+
private SimpleAppender()
{
container = getElement();
+ format = DateTimeFormat.getFormat("HH:mm:ss:SSSS");
//
// DOM.setStyleAttribute(container, "width", "auto");
@@ -135,12 +140,12 @@
setStylePrimaryName("log");
}
- public void append(Level level, String category, String msg)
+ public void append(Level level, Date time, String category, String msg)
{
Element div = DOM.createDiv();
//
- DOM.setInnerHTML(div, level + " " + category + " " + msg);
+ DOM.setInnerHTML(div, level + " " + format.format(time) + " " + category + " " + msg);
//
DOM.appendChild(container, div);
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -27,6 +27,7 @@
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.DOM;
@@ -38,6 +39,7 @@
import org.jboss.portal.presentation.ajax.client.protocol.OpaqueWindowAction;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxRequest;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxResponse;
+import org.jboss.portal.presentation.ajax.client.protocol.DestroyObjectAction;
import org.jboss.portal.presentation.ajax.client.utils.Tools;
import org.jboss.portal.presentation.ajax.client.utils.Logger;
@@ -55,6 +57,9 @@
private static final Logger log = Logger.getLogger(AjaxWindow.class);
/** . */
+ private MetaWidget meta;
+
+ /** . */
private Label title;
/** . */
@@ -74,7 +79,55 @@
Label title = new Label("Window " + getId());
HTML markup = new HTML();
VerticalPanel widget = new VerticalPanel();
- widget.add(title);
+ Button close = new Button("close", new ClickListener()
+ {
+ public void onClick(Widget widget)
+ {
+ DestroyObjectAction action = new DestroyObjectAction(getId());
+ AjaxRequest request = new AjaxRequest();
+ request.setAction(action);
+
+ //
+ final PresentationClientRemoteAsync remote = (PresentationClientRemoteAsync)GWT.create(PresentationClientRemote.class);
+ ServiceDefTarget endpoint = (ServiceDefTarget)remote;
+ String moduleRelativeURL = GWT.getModuleBaseURL() + "remote";
+ endpoint.setServiceEntryPoint(moduleRelativeURL);
+
+ //
+ remote.process(request, new AsyncCallback()
+ {
+ public void onFailure(Throwable throwable)
+ {
+ }
+
+ public void onSuccess(Object o)
+ {
+ AjaxResponse response = (AjaxResponse)o;
+// for (int i = 0; i < response.getStaleObjects().length; i++)
+// {
+// String staleObject = response.getStaleObjects()[i];
+//
+// AjaxObject stale = getContext().getObject(staleObject);
+//
+// if (stale != null)
+// {
+// log.info("Going to refresh portlet window " + staleObject);
+// stale.refresh(true);
+// }
+// else
+// {
+// log.info("No stale window found for " + staleObject);
+// }
+//
+// }
+ }
+ });
+ }
+ });
+ MetaWidget meta = new MetaWidget(this);
+ meta.add(title);
+ widget.add(meta);
+ widget.add(close);
widget.add(markup);
//
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/MetaWidget.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/MetaWidget.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/MetaWidget.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -0,0 +1,163 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.presentation.ajax.client.model;
+
+import com.google.gwt.user.client.ui.SimplePanel;
+import com.google.gwt.user.client.ui.PopupPanel;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.gwt.user.client.ui.Widget;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.ClickListener;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Timer;
+import com.google.gwt.user.client.Element;
+import org.jboss.portal.presentation.ajax.client.utils.Logger;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class MetaWidget extends FlowPanel
+{
+
+ /** . */
+ private Timer timer;
+
+ /** . */
+ private AjaxObject object;
+
+ /** . */
+ private Widget popup;
+
+ public MetaWidget(AjaxObject object)
+ {
+ this.object = object;
+
+ //
+ DOM.sinkEvents(getElement(), Event.MOUSEEVENTS);
+ }
+
+ public void create()
+ {
+
+ }
+
+ public void destroy()
+ {
+
+ }
+
+ public void onBrowserEvent(Event event)
+ {
+ final Logger log = Logger.getLogger(MetaWidget.class + "." + object.getId());
+ switch (DOM.eventGetType(event))
+ {
+ case Event.ONMOUSEMOVE:
+ break;
+ case Event.ONMOUSEOVER:
+ Element from = DOM.eventGetFromElement(event);
+ if (!isDescendant(getElement(), from))
+ {
+ if (timer == null)
+ {
+ timer = new Timer()
+ {
+ public void run()
+ {
+ log.info("Creating popup widget");
+
+
+ VerticalPanel popup = new VerticalPanel();
+
+ popup.add(new Button("Refresh", new ClickListener()
+ {
+ public void onClick(Widget widget)
+ {
+ object.refresh(true);
+ }
+ }));
+
+
+ MetaWidget.this.popup = popup;
+ add(popup);
+ }
+ };
+ timer.schedule(4000);
+ log.info("Scheduling");
+ }
+ else
+ {
+ log.info("Will not schedule because it is already scheduled");
+ }
+ }
+ else
+ {
+ log.info("Will not schedule because the from element is descendant");
+ }
+ break;
+ case Event.ONMOUSEOUT:
+ Element to = DOM.eventGetToElement(event);
+ if (!isDescendant(getElement(), to))
+ {
+ if (timer != null)
+ {
+ log.info("Unscheduling");
+ timer.cancel();
+ log.info("Timer cancelled");
+ if (popup != null)
+ {
+ remove(popup);
+ log.info("Removed popup");
+ }
+ timer = null;
+ popup = null;
+ log.info("Unscheduled");
+ }
+ }
+ break;
+ }
+ }
+
+ private boolean isDescendant(Element current, Element element)
+ {
+ if (current == element)
+ {
+ return true;
+ }
+
+ //
+ for (int i = DOM.getChildCount(current) - 1;i >= 0;i--)
+ {
+ if (isDescendant(DOM.getChild(current, i), element))
+ {
+ return true;
+ }
+ }
+
+ //
+ return false;
+ }
+}
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/DestroyObjectAction.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/DestroyObjectAction.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/protocol/DestroyObjectAction.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, 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.presentation.ajax.client.protocol;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class DestroyObjectAction extends AjaxAction
+{
+
+ /** . */
+ private String objectId;
+
+ public DestroyObjectAction(String objectId)
+ {
+ this.objectId = objectId;
+ }
+
+ public DestroyObjectAction()
+ {
+ }
+
+ public String getObjectId()
+ {
+ return objectId;
+ }
+
+ public void setObjectId(String objectId)
+ {
+ this.objectId = objectId;
+ }
+}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -22,6 +22,8 @@
******************************************************************************/
package org.jboss.portal.presentation.ajax.client.utils;
+import java.util.Date;
+
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -29,6 +31,6 @@
public interface Appender
{
- void append(Level level, String category, String msg);
+ void append(Level level, Date time, String category, String msg);
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -27,6 +27,7 @@
import java.util.Set;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Date;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -47,6 +48,33 @@
/**
* Returns a logger.
*
+ * @param category the logger category
+ * @return the logger
+ * @throws IllegalArgumentException if the clazz argument is null
+ */
+ public static Logger getLogger(String category) throws IllegalArgumentException
+ {
+ if (category == null)
+ {
+ throw new IllegalArgumentException("No null category accepted");
+ }
+
+ //
+ Logger logger = (Logger)loggers.get(category);
+
+ //
+ if (logger == null)
+ {
+ loggers.put(category, logger = new Logger(category));
+ }
+
+ //
+ return logger;
+ }
+
+ /**
+ * Returns a logger.
+ *
* @param clazz the logger key
* @return the logger
* @throws IllegalArgumentException if the clazz argument is null
@@ -67,16 +95,7 @@
}
//
- Logger logger = (Logger)loggers.get(name);
-
- //
- if (logger == null)
- {
- loggers.put(name, logger = new Logger(name));
- }
-
- //
- return logger;
+ return getLogger(name);
}
public static void registerAppender(Appender appender)
@@ -115,12 +134,15 @@
}
//
+ Date now = new Date();
+
+ //
for (Iterator i = appenders.iterator();i.hasNext();)
{
Appender appender = (Appender)i.next();
//
- appender.append(level, category, msg);
+ appender.append(level, now, category, msg);
}
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-07-01 21:51:03 UTC (rev 11242)
@@ -16,11 +16,13 @@
}
.pf-Title {
+cursor:default;
border: 1px solid black;
padding: 1px;
}
.pf-Markup {
+cursor:default;
border: 1px solid black;
padding: 1px;
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/server/PresentationClientServlet.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -28,6 +28,7 @@
import org.jboss.portal.presentation.ajax.client.protocol.OpaqueWindowAction;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxResponse;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxRequest;
+import org.jboss.portal.presentation.ajax.client.protocol.DestroyObjectAction;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
import org.jboss.portal.presentation.ajax.server.model.AjaxViewPortContext;
import org.jboss.portal.presentation.ajax.server.protocol.AjaxActionDecoderContext;
@@ -46,6 +47,7 @@
import org.jboss.portal.presentation.protocol.codec.ActionEncoder;
import org.jboss.portal.presentation.protocol.codec.ActionDecoder;
import org.jboss.portal.presentation.protocol.ProtocolAction;
+import org.jboss.portal.presentation.protocol.DestroyUIObjectAction;
import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.web.ServletContainer;
import org.jboss.portal.web.WebRequest;
@@ -210,6 +212,31 @@
return new AjaxResponse();
}
}
+ else if (action instanceof DestroyObjectAction)
+ {
+ DestroyObjectAction ajaxAction = (DestroyObjectAction)action;
+
+ DestroyUIObjectAction destroyAction = new DestroyUIObjectAction(ajaxAction.getObjectId());
+
+ // Now we execute
+ PresentationServer server = getPresentationServer();
+
+ PresentationClientImpl client = createPresentationClient();
+
+ PresentationRequest prequest = new PresentationRequest(destroyAction);
+
+ try
+ {
+ server.process(client, prequest);
+ }
+ catch (PresentationServerException e)
+ {
+ e.printStackTrace();
+ }
+
+ //
+ return new AjaxResponse();
+ }
else
{
return new AjaxResponse();
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/page-structure.xml 2008-07-01 21:51:03 UTC (rev 11242)
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<context-def
xmlns="urn:jboss:portal:presentation:page:1.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ name="">
<simple-layout>
<window-def name="windowA">
<portlet ref="/portal-server.Catalog"/>
@@ -28,6 +29,9 @@
<portlet ref="/portal-server.PublicParameterPortlet3"/>
</window-def>
</simple-layout>
+ <window-def name="windowH">
+ <portlet ref="/portal-server.SessionCounter"/>
+ </window-def>
</simple-layout>
<page-def name="child-page-1">
<simple-layout>
Modified: modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/portlet.xml
===================================================================
--- modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/portlet.xml 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/portal/src/main/artifacts/presentation-portal-war/WEB-INF/portlet.xml 2008-07-01 21:51:03 UTC (rev 11242)
@@ -28,6 +28,21 @@
version="2.0">
<portlet>
+ <description>Session Counter Portlet</description>
+ <portlet-name>SessionCounter</portlet-name>
+ <display-name>Session Counter Portlet</display-name>
+ <portlet-class>org.jboss.portal.portlet.samples.basic.SessionCounterPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Session Counter</title>
+ <keywords>sample,basic</keywords>
+ </portlet-info>
+ </portlet>
+
+ <portlet>
<description>Catalog Portlet</description>
<portlet-name>Catalog</portlet-name>
<display-name>Catalog Portlet</display-name>
@@ -73,7 +88,7 @@
</supports>
<portlet-info>
<title>Public Parameter Portlet</title>
- <keywords>sample,test</keywords>
+ <keywords>sample,basic</keywords>
</portlet-info>
<supported-public-render-parameter>foo</supported-public-render-parameter>
<supported-public-render-parameter>bar</supported-public-render-parameter>
@@ -88,7 +103,7 @@
</supports>
<portlet-info>
<title>Public Parameter Portlet</title>
- <keywords>sample,test</keywords>
+ <keywords>sample,basic</keywords>
</portlet-info>
<supported-public-render-parameter>foo</supported-public-render-parameter>
<supported-public-render-parameter>juu</supported-public-render-parameter>
@@ -103,7 +118,7 @@
</supports>
<portlet-info>
<title>Public Parameter Portlet</title>
- <keywords>sample,test</keywords>
+ <keywords>sample,basic</keywords>
</portlet-info>
<supported-public-render-parameter>bar</supported-public-render-parameter>
<supported-public-render-parameter>juu</supported-public-render-parameter>
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -44,6 +44,7 @@
import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
import org.jboss.portal.presentation.protocol.LinkActivation;
import org.jboss.portal.presentation.protocol.ProtocolResponse;
+import org.jboss.portal.presentation.protocol.DestroyUIObjectAction;
import org.jboss.portal.presentation.server.PresentationRequest;
import org.jboss.portal.presentation.server.PresentationResponse;
import org.jboss.portal.presentation.server.PresentationServer;
@@ -129,6 +130,13 @@
{
return new PresentationResponse(new ShowUIObjectResponse(targetId));
}
+ else if (objectAction instanceof DestroyUIObjectAction)
+ {
+ targetNode.getParent().destroyChild(targetNode.getName());
+
+ //
+ return new PresentationResponse(new ShowUIObjectResponse(targetId));
+ }
else if (objectAction instanceof LinkActivation)
{
throw new NotYetImplemented();
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-07-01 21:19:51 UTC (rev 11241)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-07-01 21:51:03 UTC (rev 11242)
@@ -206,7 +206,7 @@
}
else
{
- throw new NotYetImplemented();
+ throw new NotYetImplemented("Cannot get id of object " + o);
}
}
17 years, 10 months
JBoss Portal SVN: r11241 - branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-07-01 17:19:51 -0400 (Tue, 01 Jul 2008)
New Revision: 11241
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
Log:
- Deal more gracefully with missing portlets.
Modified: branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2008-07-01 21:18:01 UTC (rev 11240)
+++ branches/JBoss_Portal_Branch_2_7/core/src/main/org/jboss/portal/core/impl/model/content/InternalContentProvider.java 2008-07-01 21:19:51 UTC (rev 11241)
@@ -63,7 +63,6 @@
import org.w3c.dom.Element;
import javax.portlet.MimeResponse;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -180,16 +179,14 @@
try
{
- /*
// Check that the associated portlet is deployed
Instance portletInstance = getPortletInstance(rendererContext);
if (portletInstance == null)
{
- throw new NoSuchPortletException("");
+ log.debug("Portlet associated with " + rendererContext.getWindow() + " window could not be found!");
+ throw new NoSuchPortletException("Portlet associated with " + rendererContext.getWindow() + " window could not be found!");
}
portletInstance.getPortlet();
-*/
- getPortletInstance(rendererContext).getPortlet();
}
catch (PortletInvokerException e)
{
17 years, 10 months
JBoss Portal SVN: r11240 - in branches/JBoss_Portal_Branch_2_7/core-samples/src: resources/portal-users-samples-sar/META-INF and 1 other directory.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2008-07-01 17:18:01 -0400 (Tue, 01 Jul 2008)
New Revision: 11240
Modified:
branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/event/StatsListener.java
branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-sar/META-INF/jboss-service.xml
Log:
I correct a current users portlet bug.. I missed to add a session_listener that verify the current sessions of users
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/event/StatsListener.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/event/StatsListener.java 2008-07-01 19:59:35 UTC (rev 11239)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/main/org/jboss/portal/core/samples/users/event/StatsListener.java 2008-07-01 21:18:01 UTC (rev 11240)
@@ -11,6 +11,10 @@
import org.jboss.portal.api.event.PortalEventListener;
import org.jboss.portal.core.identity.UsersActivityStatsService;
+/**
+ * @author <a href="mailto:jedim@vige.it">Luca Stancapiano</a>
+ * @version $Revision: 1.1 $
+ */
public abstract class StatsListener implements PortalEventListener
{
Modified: branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-sar/META-INF/jboss-service.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-sar/META-INF/jboss-service.xml 2008-07-01 19:59:35 UTC (rev 11239)
+++ branches/JBoss_Portal_Branch_2_7/core-samples/src/resources/portal-users-samples-sar/META-INF/jboss-service.xml 2008-07-01 21:18:01 UTC (rev 11240)
@@ -26,15 +26,28 @@
<mbean
code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
- name="portal:service=ListenerService,type=counter_listener"
+ name="portal:service=ListenerService,type=current_user_listener"
xmbean-dd=""
xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
<xmbean/>
<depends
optional-attribute-name="Registry"
proxy-type="attribute">portal:service=ListenerRegistry</depends>
- <attribute name="RegistryId">counter_listener</attribute>
+ <attribute name="RegistryId">current_user_listener</attribute>
<attribute name="ListenerClassName">org.jboss.portal.core.samples.users.event.UserEventListener</attribute>
</mbean>
+ <mbean
+ code="org.jboss.portal.core.event.PortalEventListenerServiceImpl"
+ name="portal:service=ListenerService,type=session_listener"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+ optional-attribute-name="Registry"
+ proxy-type="attribute">portal:service=ListenerRegistry</depends>
+ <attribute name="RegistryId">session_listener</attribute>
+ <attribute name="ListenerClassName">org.jboss.portal.core.samples.users.event.PortalSessionEventListener</attribute>
+ </mbean>
+
</server>
17 years, 10 months