JBoss Portal SVN: r8968 - modules/identity/trunk/identity.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-16 06:07:25 -0500 (Fri, 16 Nov 2007)
New Revision: 8968
Modified:
modules/identity/trunk/identity/pom.xml
Log:
pathetic build halter...
Modified: modules/identity/trunk/identity/pom.xml
===================================================================
--- modules/identity/trunk/identity/pom.xml 2007-11-16 10:33:37 UTC (rev 8967)
+++ modules/identity/trunk/identity/pom.xml 2007-11-16 11:07:25 UTC (rev 8968)
@@ -290,7 +290,7 @@
<testsuites>
<testsuite>
<config>jboss-unit.xml</config>
- <JPDA>true</JPDA>
+ <!--<JPDA>true</JPDA>-->
</testsuite>
</testsuites>
<reports>
16 years, 10 months
JBoss Portal SVN: r8967 - in branches/JBoss_Portal_Branch_2_6: build/ide/intellij/idea60/modules/core-samples and 2 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-16 05:33:37 -0500 (Fri, 16 Nov 2007)
New Revision: 8967
Added:
branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/basic/WindowIDPortlet.java
Modified:
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-admin/core-admin.iml
branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-samples/core-samples.iml
branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
Log:
added basic sample that show how the portlet window id
Modified: branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-admin/core-admin.iml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-admin/core-admin.iml 2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-admin/core-admin.iml 2007-11-16 10:33:37 UTC (rev 8967)
@@ -108,6 +108,15 @@
</library>
</orderEntry>
<orderEntry type="module" module-name="server" />
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-jsr168api-lib.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Modified: branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-samples/core-samples.iml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-samples/core-samples.iml 2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/build/ide/intellij/idea60/modules/core-samples/core-samples.iml 2007-11-16 10:33:37 UTC (rev 8967)
@@ -59,6 +59,15 @@
<SOURCES />
</library>
</orderEntry>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url="jar://$MODULE_DIR$/../../../../../../thirdparty/jboss-portal/modules/portlet/lib/portal-portlet-jsr168api-lib.jar!/" />
+ </CLASSES>
+ <JAVADOC />
+ <SOURCES />
+ </library>
+ </orderEntry>
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
Added: branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/basic/WindowIDPortlet.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/basic/WindowIDPortlet.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/main/org/jboss/portal/core/samples/basic/WindowIDPortlet.java 2007-11-16 10:33:37 UTC (rev 8967)
@@ -0,0 +1,81 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.samples.basic;
+
+import javax.portlet.GenericPortlet;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSecurityException;
+import javax.portlet.PortletSession;
+import javax.servlet.http.HttpSessionBindingListener;
+import javax.servlet.http.HttpSessionBindingEvent;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class WindowIDPortlet extends GenericPortlet
+{
+
+ protected void doView(RenderRequest request, RenderResponse response) throws PortletException, PortletSecurityException, IOException
+ {
+ PortletSession session = request.getPortletSession();
+ WindowIDRetriever retriever = (WindowIDRetriever)session.getAttribute("retriever");
+ if (retriever == null)
+ {
+ retriever = new WindowIDRetriever();
+ session.setAttribute("retriever", retriever);
+ }
+ String windowID = retriever.getWindowID();
+
+ //
+ response.setContentType("text/html");
+ PrintWriter writer = response.getWriter();
+ writer.print("Window ID is equals to " + windowID);
+ }
+
+ public static class WindowIDRetriever implements HttpSessionBindingListener
+ {
+
+ /** . */
+ private String windowID;
+
+ public void valueBound(HttpSessionBindingEvent event)
+ {
+ String name = event.getName();
+ windowID = name.substring("javax.portlet.p.".length(), name.indexOf('?'));
+ }
+
+ public void valueUnbound(HttpSessionBindingEvent event)
+ {
+ }
+
+ public String getWindowID()
+ {
+ return windowID;
+ }
+ }
+}
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/default-object.xml 2007-11-16 10:33:37 UTC (rev 8967)
@@ -308,6 +308,21 @@
<height>0</height>
</window>
</page>
+ <page>
+ <page-name>window id test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>WindowIDPortletWindow</window-name>
+ <instance-ref>WindowIDPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
</page>
</deployment>
<deployment>
@@ -591,6 +606,21 @@
<height>0</height>
</window>
</page>
+ <page>
+ <page-name>window id test</page-name>
+ <window>
+ <window-name>CatalogPortletWindow</window-name>
+ <instance-ref>CatalogPortletInstance</instance-ref>
+ <region>left</region>
+ <height>0</height>
+ </window>
+ <window>
+ <window-name>WindowIDPortletWindow</window-name>
+ <instance-ref>WindowIDPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
</page>
</deployment>
</deployments>
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml 2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet-instances.xml 2007-11-16 10:33:37 UTC (rev 8967)
@@ -151,4 +151,10 @@
<portlet-ref>FormAutoSubmitPortlet</portlet-ref>
</instance>
</deployment>
+ <deployment>
+ <instance>
+ <instance-id>WindowIDPortletInstance</instance-id>
+ <portlet-ref>WindowIDPortlet</portlet-ref>
+ </instance>
+ </deployment>
</deployments>
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2007-11-16 08:00:38 UTC (rev 8966)
+++ branches/JBoss_Portal_Branch_2_6/core-samples/src/resources/portal-basic-samples-war/WEB-INF/portlet.xml 2007-11-16 10:33:37 UTC (rev 8967)
@@ -335,10 +335,24 @@
<portlet-mode>VIEW</portlet-mode>
</supports>
<portlet-info>
- <title>Auto submit</title>
+ <title>Auto submit Portlet</title>
<keywords>sample,test</keywords>
</portlet-info>
</portlet>
+ <portlet>
+ <description>Portlet which displays the window ID</description>
+ <portlet-name>WindowIDPortlet</portlet-name>
+ <display-name>Window ID Portlet</display-name>
+ <portlet-class>org.jboss.portal.core.samples.basic.WindowIDPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ </supports>
+ <portlet-info>
+ <title>Window ID Portlet</title>
+ <keywords>sample,test</keywords>
+ </portlet-info>
+ </portlet>
<custom-portlet-mode>
<name>ADMIN</name>
</custom-portlet-mode>
16 years, 10 months
JBoss Portal SVN: r8966 - in branches/JBoss_Portal_Branch_2_6: core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF and 12 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-11-16 03:00:38 -0500 (Fri, 16 Nov 2007)
New Revision: 8966
Added:
branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationPolicyChangeListener.java
Modified:
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/faces-config.xml
branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/consumerTemplate.xhtml
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/producer.xhtml
branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationManager.java
branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationPropertyDescriptionTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.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/producer/RegistrationHandler.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java
Log:
- JBPORTAL-1567: Removed confusing portions of the consumer configuration screen. Needs more testing.
- Use h:message id="status" instead of h:messages for information as is done in other pages.
- JBPORTAL-1802: Added possibility to erase local registration data. Need to protect it with a confirmation screen as it's a
dangerous operation.
- JBPORTAL-1803: Added new "Producer Data" tab (currently inactive).
- JBPORTAL-1715:
+ Tried alternate implementation (trying to only pass strings instead of QName and avoid using QNameConverter) but no dice...
Added ProducerRegistrationRequirements.addEmptyRegistrationProperty method and RegistrationPropertyDescription.nameAsString
property for that purpose.
+ Properly update the registration policy when the producer configuration is updated. This requires propagating the new policy
to the registration manager (done via RegistrationPolicyChangeListener)
- JBPORTAL-1804: RegistrationManager now set the status of registrations to PENDING instead of INVALID if registration properties
in the producer configuration have changed. RegistrationHandler.isRegistrationValid changed to support this.
- Optimization: Do not force a refresh of registration info when we register (as this was just done) in ProducerInfo.internalRefresh.
- Properly reset registration data if we receive an InvalidRegistrationFault when trying to retrieve the service description.
- Properly create a ProducerRegistrationRequirements if none exist instead of using a static variable (to avoid modifying the class
variable).
- Moved ProducerRegistrationRequirements code to Java 5, added support for RegistrationPolicyChangeListener, renamed
addRegistrationPropertyChangeListeners to addRegistrationPropertyChangeListener.
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/BeanContext.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -30,6 +30,8 @@
*/
public abstract class BeanContext
{
+ private static final String STATUS = "status";
+
protected abstract String getParameter(String key);
protected abstract void createMessage(String target, String message, Object severity);
@@ -40,7 +42,7 @@
protected void createErrorMessage(String message)
{
- createMessage(null, message, getErrorSeverity());
+ createMessage(STATUS, message, getErrorSeverity());
}
protected void createErrorMessage(String target, String message)
@@ -50,7 +52,7 @@
protected void createErrorMessageFrom(Exception e)
{
- createErrorMessageFrom(null, e);
+ createErrorMessageFrom(STATUS, e);
}
protected void createErrorMessageFrom(String target, Exception e)
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ConsumerBean.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -307,16 +307,22 @@
public String refreshConsumer()
{
- if (isModified())
+ if (consumer != null)
{
- String updateResult = update();
- if (updateResult == null)
+ if (isModified())
{
- return null;
+ String updateResult = update();
+ if (updateResult == null)
+ {
+ return null;
+ }
}
+
+ return manager.refreshConsumer();
}
- return manager.refreshConsumer();
+ beanContext.createErrorMessage("Couldn't save Consumer!");
+ return null;
}
public String refreshRegistrationInfo()
@@ -387,6 +393,18 @@
return null;
}
+ public String eraseLocalRegistration()
+ {
+ if (consumer != null)
+ {
+ getProducerInfo().eraseRegistrationInfo();
+ return null;
+ }
+
+ beanContext.createErrorMessage("Couldn't erase local Registration!");
+ return null;
+ }
+
private Object modifyIfNeeded(Object oldValue, Object newValue, String target, boolean checkURL)
{
if ((oldValue != null && !oldValue.equals(newValue)) || (oldValue == null && newValue != null))
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/main/org/jboss/portal/wsrp/admin/ui/ProducerBean.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -25,7 +25,6 @@
import org.jboss.portal.registration.RegistrationPolicy;
import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
-import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.producer.config.ProducerConfiguration;
import org.jboss.portal.wsrp.producer.config.ProducerConfigurationService;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
@@ -154,6 +153,10 @@
{
try
{
+ if (!ProducerRegistrationRequirements.DEFAULT_POLICY_CLASS_NAME.equals(policyClassName))
+ {
+ getRegRequirements().reloadPolicyFrom(policyClassName, validatorClassName);
+ }
configurationService.saveConfiguration();
}
catch (Exception e)
@@ -166,7 +169,7 @@
public String addRegistrationProperty()
{
- getRegRequirements().addRegistrationProperty(new RegistrationPropertyDescription(PROPERTY + counter++, WSRPConstants.XSD_STRING));
+ getRegRequirements().addEmptyRegistrationProperty(PROPERTY + counter++);
return PRODUCER;
}
}
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/faces-config.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/faces-config.xml 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/faces-config.xml 2007-11-16 08:00:38 UTC (rev 8966)
@@ -36,10 +36,10 @@
<converter-for-class>org.jboss.portal.wsrp.registration.LocalizedString</converter-for-class>
<converter-class>org.jboss.portal.wsrp.admin.ui.LocalizedStringConverter</converter-class>
</converter>
- <converter>
+ <!--<converter>
<converter-for-class>javax.xml.namespace.QName</converter-for-class>
<converter-class>org.jboss.portal.wsrp.admin.ui.QNameConverter</converter-class>
- </converter>
+ </converter>-->
<managed-bean>
<managed-bean-name>beanContext</managed-bean-name>
@@ -113,5 +113,5 @@
<from-outcome>producer</from-outcome>
<to-view-id>/WEB-INF/jsf/producer.xhtml</to-view-id>
</navigation-case>
- </navigation-rule>
+ </navigation-rule>
</faces-config>
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/consumerTemplate.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/consumerTemplate.xhtml 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/consumerTemplate.xhtml 2007-11-16 08:00:38 UTC (rev 8966)
@@ -8,9 +8,8 @@
<h:form>
<ul class="topnav">
<li id="currentTab">Consumers</li>
- <li>
- <h:commandLink value="Producer" action="producer"/>
- </li>
+ <li><h:commandLink value="Producer Configuration" action="producer"/></li>
+ <li>Producer Data</li>
</ul>
</h:form>
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/consumers/editConsumer.xhtml 2007-11-16 08:00:38 UTC (rev 8966)
@@ -14,7 +14,6 @@
<hr/>
<h:form>
-<h:messages errorClass="portlet-msg-error" infoClass="portlet-msg-success"/>
<table width="100%" class="portlet-table-body #{consumer.active ? 'active' : 'inactive'}">
<tr>
<th>Producer id:</th>
@@ -78,7 +77,7 @@
</c:choose>
</td>
</tr>
-<c:if test="#{consumer.localInfoPresent or !consumer.refreshNeeded}">
+<c:if test="#{consumer.localInfoPresent}">
<tr>
<th>Registration information</th>
<td>
@@ -120,40 +119,14 @@
<c:if test="#{!empty consumer.producerInfo.registrationInfo.registrationHandle}">
<tr>
<th>Registration context:</th>
- <td>Handle:
- <h:outputText value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
+ <td>
+ Handle: <h:outputText value="#{consumer.producerInfo.registrationInfo.registrationHandle}"/>
+ <h:commandLink action="#{consumer.eraseLocalRegistration}" value="Erase local registration"
+ title="Erase local registration information (potentially dangerous!)"
+ styleClass="portlet-form-button"/>
</td>
</tr>
</c:if>
- <c:choose>
- <c:when test="#{consumer.registrationCheckNeeded}">
- <tr>
- <td colspan="2">
- <p class="portlet-msg-alert">Registration information hasn't been validated with the Producer. You should
- validate
- it.</p>
- <h:commandLink action="#{consumer.refreshRegistrationInfo}" value="Validate"
- title="Validate registration info from Producer" styleClass="portlet-form-button">
- <f:param name="mergeLocalInfo" value="true"/>
- </h:commandLink>
- </td>
- </tr>
- </c:when>
- <c:otherwise>
- <c:if
- test="#{!empty consumer.producerInfo.registrationInfo.registrationHandle and !consumer.registrationValid}">
- <tr>
- <td colspan="2">
- <p class="portlet-msg-error">Registration is not valid. You can try to fix the problems and modify the
- registration.</p>
- <h:commandLink action="#{consumer.modifyRegistration}" value="Modify registration"
- title="Modify the registration held with this Producer"
- styleClass="portlet-form-button"/>
- </td>
- </tr>
- </c:if>
- </c:otherwise>
- </c:choose>
<c:if test="#{consumer.registrationModified}">
<tr>
<td colspan="2">
@@ -166,10 +139,7 @@
</c:if>
<tr>
<td colspan="2" style="padding: 1em 1em 1em 0;">
- <h:commandButton action="#{consumer.update}" value="Save" styleClass="portlet-form-button">
- <f:param name="id" value="#{consumer.id}"/>
- </h:commandButton>
- <h:commandLink action="#{consumer.refreshConsumer}" value="Save & Refresh"
+ <h:commandLink action="#{consumer.refreshConsumer}" value="Refresh & Save"
title="Save changes and refresh information from Producer"
styleClass="portlet-form-button">
<f:param name="id" value="#{consumer.id}"/>
Modified: branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer.xhtml 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/core-wsrp/src/resources/portal-wsrp-admin-war/WEB-INF/jsf/producer.xhtml 2007-11-16 08:00:38 UTC (rev 8966)
@@ -7,8 +7,9 @@
<h:form>
<ul class="topnav">
- <li><h:commandLink action="#{consumersMgr.listConsumers}" value="Consumers"/></li>
+ <li><h:commandLink action="#{consumersMgr.listConsumers}" value="Consumers Configuration"/></li>
<li id="currentTab">Producer</li>
+ <li>Producer Data</li>
</ul>
</h:form>
@@ -56,7 +57,7 @@
headerClass="portlet-section-header">
<h:column>
<f:facet name="header">Name</f:facet>
- <h:inputText value="#{property.name}" size="30"/>
+ <h:inputText value="#{property.nameAsString}" size="30"/>
</h:column>
<h:column>
<f:facet name="header">Type</f:facet>
Modified: branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationManager.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationManager.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationManager.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -31,7 +31,7 @@
* @version $Revision$
* @since 2.6
*/
-public interface RegistrationManager extends RegistrationPropertyChangeListener
+public interface RegistrationManager extends RegistrationPropertyChangeListener, RegistrationPolicyChangeListener
{
RegistrationPolicy getPolicy();
Added: branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationPolicyChangeListener.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationPolicyChangeListener.java (rev 0)
+++ branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationPolicyChangeListener.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2007, Your Corporation. All Rights Reserved.
+ */
+
+package org.jboss.portal.registration;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ * @since 2.6.3
+ */
+public interface RegistrationPolicyChangeListener
+{
+ void policyUpdatedTo(RegistrationPolicy policy);
+}
Property changes on: branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/RegistrationPolicyChangeListener.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/registration/src/main/org/jboss/portal/registration/impl/RegistrationManagerImpl.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -272,7 +272,7 @@
}
else
{
- return getConsumer ? (Object)registration.getConsumer() : registration;
+ return getConsumer ? registration.getConsumer() : registration;
}
}
@@ -321,7 +321,8 @@
/**
* We listen to registration property changes on the producer configuration so that we can invalidate the current
- * registrations. Consumers will need to call modifyRegistration since properties have changed...
+ * registrations. Consumers will need to call modifyRegistration since properties have changed... which requires
+ * throwing an OperationFailedFault... not an InvalidRegistrationFault!
*/
public void propertiesHaveChanged()
{
@@ -329,9 +330,21 @@
for (Iterator regs = persistenceManager.getRegistrations().iterator(); regs.hasNext();)
{
Registration reg = (Registration)regs.next();
- reg.setStatus(RegistrationStatus.INVALID);
-// reg.clearAssociatedState(); //todo: do we need to clear the associateed state? If we do, should we wait until current operations are done?
+
+ // pending instead of invalid as technically, the registration is not yet invalid
+ reg.setStatus(RegistrationStatus.PENDING);
+// reg.clearAssociatedState(); //todo: do we need to clear the associated state? If we do, should we wait until current operations are done?
}
}
+ /**
+ * We listen for RegistrationPolicy changes so that we can provide the proper behavior at all time if the policy has
+ * been changed by users since this RegistrationManager was initialized...
+ *
+ * @param policy
+ */
+ public void policyUpdatedTo(RegistrationPolicy policy)
+ {
+ setPolicy(policy);
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationPropertyDescriptionTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationPropertyDescriptionTestCase.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/RegistrationPropertyDescriptionTestCase.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -25,6 +25,7 @@
import junit.framework.TestCase;
import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.RegistrationPolicyChangeListener;
import org.jboss.portal.registration.RegistrationPropertyChangeListener;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
@@ -171,7 +172,7 @@
notifyCalled = true;
}
- public void addRegistrationPropertyChangeListeners(RegistrationPropertyChangeListener listener)
+ public void addRegistrationPropertyChangeListener(RegistrationPropertyChangeListener listener)
{
}
@@ -206,5 +207,25 @@
propName = propertyDescription.getName().getLocalPart();
}
}
+
+ public void addEmptyRegistrationProperty(String name)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void addRegistrationPolicyChangeListener(RegistrationPolicyChangeListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void removeRegistrationPolicyChangeListener(RegistrationPolicyChangeListener listener)
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void clearRegistrationPolicyChangeListeners()
+ {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/v1/producer/V1ProducerBaseTest.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -24,13 +24,12 @@
package org.jboss.portal.test.wsrp.v1.producer;
import org.jboss.portal.common.junit.ExtendedAssert;
+import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
import org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator;
-import org.jboss.portal.registration.RegistrationManager;
import org.jboss.portal.test.wsrp.WSRPProducerBaseTest;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPTypeFactory;
-import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.LocalizedString;
import org.jboss.portal.wsrp.core.MarkupType;
@@ -44,6 +43,7 @@
import org.jboss.portal.wsrp.core.WSRP_v1_PortletManagement_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_Registration_PortType;
import org.jboss.portal.wsrp.core.WSRP_v1_ServiceDescription_PortType;
+import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
import javax.xml.namespace.QName;
@@ -188,7 +188,7 @@
producer.getProducerRegistrationRequirements().setPolicy(defaultRegistrationPolicy);
RegistrationManager registrationManager = producer.getRegistrationManager();
registrationManager.setPolicy(defaultRegistrationPolicy);
- producer.getProducerRegistrationRequirements().addRegistrationPropertyChangeListeners(registrationManager);
+ producer.getProducerRegistrationRequirements().addRegistrationPropertyChangeListener(registrationManager);
return regProp;
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -92,7 +92,7 @@
String causeMessage = cause.getLocalizedMessage();
if (causeMessage != null)
{
- message += " " + causeMessage;
+ message += ". " + causeMessage;
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/consumer/ProducerInfo.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -35,11 +35,11 @@
import org.jboss.portal.wsrp.consumer.portlet.WSRPPortlet;
import org.jboss.portal.wsrp.consumer.portlet.info.WSRPPortletInfo;
import org.jboss.portal.wsrp.core.CookieProtocol;
-import org.jboss.portal.wsrp.core.Fault;
import org.jboss.portal.wsrp.core.GetPortletDescription;
import org.jboss.portal.wsrp.core.GetPortletPropertyDescription;
import org.jboss.portal.wsrp.core.GetServiceDescription;
import org.jboss.portal.wsrp.core.InvalidHandleFault;
+import org.jboss.portal.wsrp.core.InvalidRegistrationFault;
import org.jboss.portal.wsrp.core.ModifyRegistration;
import org.jboss.portal.wsrp.core.PortletDescription;
import org.jboss.portal.wsrp.core.PortletDescriptionResponse;
@@ -106,6 +106,7 @@
private ConsumerRegistry registry;
private static final String REGISTER_MEANING = "Should clients ask for a new service description?";
private static final String REFRESH_MEANING = "Did just refresh?";
+ private static final String ERASED_LOCAL_REGISTRATION_INFORMATION = "Erased local registration information!";
/*protected org.jboss.portal.wsrp.core.ItemDescription[] userCategoryDescriptions;
protected org.jboss.portal.wsrp.core.ItemDescription[] customUserProfileItemDescriptions;
@@ -306,7 +307,7 @@
if (!registrationResult.hasIssues())
{
- registrationResult = register(serviceDescription, forceRefresh);
+ registrationResult = register(serviceDescription, false);
if (registrationResult.specificCode())
{
// registration occurred, so we should ask for a new service description
@@ -595,6 +596,11 @@
{
log.debug("Caught Exception in getServiceDescription:\n", e);
+ if (e instanceof InvalidRegistrationFault)
+ {
+ resetRegistration();
+ }
+
// de-activate
setActiveAndSave(false);
@@ -659,7 +665,7 @@
{
throw new IllegalArgumentException("Unknown portlet '" + portletHandle + "'");
}
- catch (org.jboss.portal.wsrp.core.InvalidRegistrationFault invalidRegistrationFault)
+ catch (InvalidRegistrationFault invalidRegistrationFault)
{
try
{
@@ -885,4 +891,14 @@
ccpsMap.remove(portletHandle);
popsMap.remove(portletHandle);
}
+
+ public void eraseRegistrationInfo()
+ {
+ persistentRegistrationInfo = null;
+
+ registry.updateProducerInfo(this);
+
+ log.warn(ERASED_LOCAL_REGISTRATION_INFORMATION);
+ log.debug(ERASED_LOCAL_REGISTRATION_INFORMATION);
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/RegistrationHandler.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -236,12 +236,12 @@
/**
* @param reg
- * @param throwExceptionIfExistsAndInvalid
+ * @param throwExceptionIfExistsAndNotValid
*
* @return
* @since 2.6.2
*/
- boolean isRegistrationValid(Registration reg, boolean throwExceptionIfExistsAndInvalid)
+ boolean isRegistrationValid(Registration reg, boolean throwExceptionIfExistsAndNotValid)
{
if (reg == null)
{
@@ -256,15 +256,27 @@
}
else
{
- boolean result = RegistrationStatus.VALID.equals(reg.getStatus());
- log.debug("Registration required: registration is " + (result ? "valid!" : "invalid!"));
+ boolean isValid = RegistrationStatus.VALID.equals(reg.getStatus());
+ boolean isPending = RegistrationStatus.PENDING.equals(reg.getStatus());
+ log.debug("Registration required: registration is " + (isValid ? "valid!" : (isPending ? "pending!" : "invalid!")));
- if (throwExceptionIfExistsAndInvalid && !result)
+ if (throwExceptionIfExistsAndNotValid)
{
- throwInvalidRegistrationFault("registration with handle '" + reg.getRegistrationHandle() + "' is not valid!");
+ if (isPending)
+ {
+ throwOperationFailedFault("Registration with handle '" + reg.getRegistrationHandle()
+ + "' is pending. Consumer needs to call modifyRegistration().", null);
+ }
+ else
+ {
+ if (!isValid)
+ {
+ throwInvalidRegistrationFault("Registration with handle '" + reg.getRegistrationHandle() + "' is not valid!");
+ }
+ }
}
- return result;
+ return isValid;
}
}
@@ -296,8 +308,8 @@
}
catch (RegistrationException e)
{
- throw WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.OPERATION_FAILED,
- "Failed to retrieve registration information associated with handle " + regHandle, e);
+ throwOperationFailedFault("Failed to retrieve registration information associated with handle " + regHandle, e);
+ return null;
}
}
else
@@ -310,6 +322,11 @@
}
}
+ private void throwOperationFailedFault(String message, RegistrationException e)
+ {
+ throw WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.OPERATION_FAILED, message, e);
+ }
+
boolean throwInvalidRegistrationFault(String message)
{
throw WSRPExceptionFactory.throwSOAPFaultException(WSRPExceptionFactory.INVALID_REGISTRATION,
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -271,12 +271,16 @@
protected void startService() throws Exception
{
super.startService();
+
producerConfiguration = configurationService.getConfiguration();
+
ProducerRegistrationRequirements registrationRequirements = getProducerRegistrationRequirements();
+ registrationRequirements.addRegistrationPolicyChangeListener(registrationManager);
+
if (registrationRequirements.isRegistrationRequired())
{
registrationManager.setPolicy(registrationRequirements.getPolicy());
- registrationRequirements.addRegistrationPropertyChangeListeners(registrationManager);
+ registrationRequirements.addRegistrationPropertyChangeListener(registrationManager);
}
}
@@ -287,6 +291,8 @@
{
registrationRequirements.removeRegistrationPropertyChangeListener(registrationManager);
}
+ registrationRequirements.removeRegistrationPolicyChangeListener(registrationManager);
+
super.stopService();
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/ProducerRegistrationRequirements.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -24,6 +24,7 @@
package org.jboss.portal.wsrp.producer.config;
import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.RegistrationPolicyChangeListener;
import org.jboss.portal.registration.RegistrationPropertyChangeListener;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
@@ -68,7 +69,7 @@
void notifyRegistrationPropertyChangeListeners();
- void addRegistrationPropertyChangeListeners(RegistrationPropertyChangeListener listener);
+ void addRegistrationPropertyChangeListener(RegistrationPropertyChangeListener listener);
void clearRegistrationPropertyChangeListeners();
@@ -80,5 +81,31 @@
void reloadPolicyFrom(String policyClassName, String validatorClassName);
+ /**
+ * @param propertyDescription
+ * @param oldName
+ * @since 2.6.3
+ */
void propertyHasBeenRenamed(RegistrationPropertyDescription propertyDescription, QName oldName);
+
+ /**
+ * @param name
+ * @since 2.6.3
+ */
+ void addEmptyRegistrationProperty(String name);
+
+ /**
+ * @param listener
+ * @since 2.6.3
+ */
+ void addRegistrationPolicyChangeListener(RegistrationPolicyChangeListener listener);
+
+ /**
+ * @param listener
+ * @since 2.6.3
+ */
+ void removeRegistrationPolicyChangeListener(RegistrationPolicyChangeListener listener);
+
+ /** @since 2.6.3 */
+ void clearRegistrationPolicyChangeListeners();
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerConfigurationImpl.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -34,14 +34,12 @@
public class ProducerConfigurationImpl implements ProducerConfiguration
{
private ProducerRegistrationRequirements requirements;
- private static final ProducerRegistrationRequirements DEFAULT_REGISTRATION_REQUIREMENTS =
- new ProducerRegistrationRequirementsImpl(false, false, false);
public ProducerRegistrationRequirements getRegistrationRequirements()
{
if (requirements == null)
{
- requirements = DEFAULT_REGISTRATION_REQUIREMENTS;
+ requirements = new ProducerRegistrationRequirementsImpl(false, false, false);
}
return requirements;
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/config/impl/ProducerRegistrationRequirementsImpl.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -26,10 +26,12 @@
import org.jboss.logging.Logger;
import org.jboss.portal.common.util.ParameterValidation;
import org.jboss.portal.registration.RegistrationPolicy;
+import org.jboss.portal.registration.RegistrationPolicyChangeListener;
import org.jboss.portal.registration.RegistrationPropertyChangeListener;
import org.jboss.portal.registration.policies.DefaultRegistrationPolicy;
import org.jboss.portal.registration.policies.DefaultRegistrationPropertyValidator;
import org.jboss.portal.registration.policies.RegistrationPropertyValidator;
+import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.producer.config.ProducerRegistrationRequirements;
import org.jboss.portal.wsrp.registration.RegistrationPropertyDescription;
@@ -37,7 +39,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -48,18 +49,19 @@
*/
public class ProducerRegistrationRequirementsImpl implements ProducerRegistrationRequirements
{
- private final Logger log = Logger.getLogger(getClass());
+ private static final Logger log = Logger.getLogger(ProducerRegistrationRequirementsImpl.class);
private boolean requiresRegistration;
private boolean fullServiceDescriptionRequiresRegistration;
- private transient Set listeners = new HashSet(3);
private RegistrationPolicy policy;
private String policyClassName;
private String validatorClassName;
-
/** property name (QName) -> PropertyDescription */
- private Map registrationProperties;
+ private Map<QName, RegistrationPropertyDescription> registrationProperties;
+ private Set<RegistrationPropertyChangeListener> propertyChangeListeners = new HashSet<RegistrationPropertyChangeListener>(3);
+ private Set<RegistrationPolicyChangeListener> policyChangeListeners = new HashSet<RegistrationPolicyChangeListener>(3);
+
public ProducerRegistrationRequirementsImpl(boolean requiresMarshalling, boolean requiresRegistration, boolean fullServiceDescriptionRequiresRegistration)
{
this();
@@ -69,7 +71,7 @@
public ProducerRegistrationRequirementsImpl()
{
- registrationProperties = new HashMap(7);
+ registrationProperties = new HashMap<QName, RegistrationPropertyDescription>(7);
}
public boolean isRegistrationRequired()
@@ -108,6 +110,14 @@
notifyRegistrationPropertyChangeListeners();
}
+ public void addEmptyRegistrationProperty(String name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(name, "Property name");
+ RegistrationPropertyDescription reg = new RegistrationPropertyDescription(name, WSRPConstants.XSD_STRING);
+
+ addRegistrationProperty(reg);
+ }
+
public boolean acceptValueFor(QName propertyName, Object value)
{
ParameterValidation.throwIllegalArgExceptionIfNull(propertyName, "Property name");
@@ -132,13 +142,13 @@
public RegistrationPropertyDescription getRegistrationPropertyWith(QName name)
{
ParameterValidation.throwIllegalArgExceptionIfNull(name, "Property name");
- return (RegistrationPropertyDescription)registrationProperties.get(name);
+ return registrationProperties.get(name);
}
private RegistrationPropertyDescription getPropertyDescription(QName propertyName)
{
// copy to ensure immutability
- return new RegistrationPropertyDescription((RegistrationPropertyDescription)registrationProperties.get(propertyName));
+ return new RegistrationPropertyDescription(registrationProperties.get(propertyName));
}
public void removeRegistrationProperty(QName propertyName)
@@ -159,32 +169,65 @@
removeRegistrationProperty(new QName(propertyName));
}
+ /*
+ * == RegistrationPropertyChangeListeners handling ==
+ */
+
public void notifyRegistrationPropertyChangeListeners()
{
- for (Iterator iterator = listeners.iterator(); iterator.hasNext();)
+ for (RegistrationPropertyChangeListener listener : propertyChangeListeners)
{
- RegistrationPropertyChangeListener listener = (RegistrationPropertyChangeListener)iterator.next();
listener.propertiesHaveChanged();
}
}
public void clearRegistrationPropertyChangeListeners()
{
- listeners.clear();
+ propertyChangeListeners.clear();
}
- public void addRegistrationPropertyChangeListeners(RegistrationPropertyChangeListener listener)
+ public void addRegistrationPropertyChangeListener(RegistrationPropertyChangeListener listener)
{
ParameterValidation.throwIllegalArgExceptionIfNull(listener, "RegistrationPropertyChangeListener");
- listeners.add(listener);
+ propertyChangeListeners.add(listener);
}
public void removeRegistrationPropertyChangeListener(RegistrationPropertyChangeListener listener)
{
ParameterValidation.throwIllegalArgExceptionIfNull(listener, "RegistrationPropertyChangeListener");
- listeners.remove(listener);
+ propertyChangeListeners.remove(listener);
}
+ /*
+ * == RegistrationPolicyChangeListeners handling
+ */
+
+ public void addRegistrationPolicyChangeListener(RegistrationPolicyChangeListener listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener, "RegistrationPolicyChangeListener");
+ policyChangeListeners.add(listener);
+ }
+
+ public void removeRegistrationPolicyChangeListener(RegistrationPolicyChangeListener listener)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNull(listener, "RegistrationPolicyChangeListener");
+ policyChangeListeners.remove(listener);
+ }
+
+ public void clearRegistrationPolicyChangeListeners()
+ {
+ policyChangeListeners.clear();
+ }
+
+ public void notifyRegistrationPolicyChangeListeners()
+ {
+ for (RegistrationPolicyChangeListener listener : policyChangeListeners)
+ {
+ listener.policyUpdatedTo(policy);
+ }
+ }
+
+
public void setPolicy(RegistrationPolicy policy)
{
this.policy = policy;
@@ -199,9 +242,10 @@
validatorClassName = registrationPolicy.getValidator().getClass().getName();
}
}
+
+ notifyRegistrationPolicyChangeListeners();
}
-
public RegistrationPolicy getPolicy()
{
if (policy == null && requiresRegistration)
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java 2007-11-16 02:50:10 UTC (rev 8965)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/registration/RegistrationPropertyDescription.java 2007-11-16 08:00:38 UTC (rev 8966)
@@ -178,6 +178,16 @@
}
}
+ public void setNameAsString(String name)
+ {
+ setName(new QName(name));
+ }
+
+ public String getNameAsString()
+ {
+ return getName().getLocalPart();
+ }
+
public QName getType()
{
return type;
16 years, 10 months
JBoss Portal SVN: r8965 - branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-11-15 21:50:10 -0500 (Thu, 15 Nov 2007)
New Revision: 8965
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java
Log:
- Hmm, still need to create a detail even if the passed cause is null!
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java 2007-11-15 22:23:54 UTC (rev 8964)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPExceptionFactory.java 2007-11-16 02:50:10 UTC (rev 8965)
@@ -23,6 +23,7 @@
package org.jboss.portal.wsrp;
+import org.jboss.logging.Logger;
import org.jboss.portal.wsrp.servlet.ServletAccess;
import javax.servlet.http.HttpServletRequest;
@@ -39,6 +40,7 @@
*/
public class WSRPExceptionFactory
{
+ private static Logger log = Logger.getLogger(WSRPExceptionFactory.class);
private static final String NS = "urn:oasis:names:tc:wsrp:v1:types";
@@ -87,22 +89,6 @@
Detail detail = null;
if (cause != null)
{
- try
- {
- SOAPFactory soapFactory = SOAPFactory.newInstance();
- detail = soapFactory.createDetail();
-
- // using a DetailEntry with the proper errorCode and NS will cause JBossWS to create a user created exception
- // for ex: errorCode == InvalidRegistration => InvalidRegistrationFault on the client side...
- // however, due to the crappy nature of faults in WSRP, this is highly uninformative as all extra information
- // is not propagated once the user exception is created :(
- detail.addDetailEntry(soapFactory.createName(errorCode, NS_PREFIX, NS));
- }
- catch (SOAPException e)
- {
- e.printStackTrace();
- }
-
String causeMessage = cause.getLocalizedMessage();
if (causeMessage != null)
{
@@ -110,6 +96,22 @@
}
}
+ try
+ {
+ SOAPFactory soapFactory = SOAPFactory.newInstance();
+ detail = soapFactory.createDetail();
+
+ // using a DetailEntry with the proper errorCode and NS will cause JBossWS to create a user created exception
+ // for ex: errorCode == InvalidRegistration => InvalidRegistrationFault on the client side...
+ // however, due to the crappy nature of faults in WSRP, this is highly uninformative as all extra information
+ // is not propagated once the user exception is created :(
+ detail.addDetailEntry(soapFactory.createName(errorCode, NS_PREFIX, NS));
+ }
+ catch (SOAPException e)
+ {
+ log.debug("Couldn't create exception detail: ", e);
+ }
+
String actor = null;
HttpServletRequest req = ServletAccess.getRequest();
if (req != null)
16 years, 10 months
JBoss Portal SVN: r8964 - branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2007-11-15 17:23:54 -0500 (Thu, 15 Nov 2007)
New Revision: 8964
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/CreateUIObjectAction.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/DestroyUIObjectAction.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/MoveUIObjectAction.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/RenameUIObjectAction.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowUIObjectResponse.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/UIObjectAction.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/UIObjectResponse.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewUIObjectAction.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java
Log:
commit more server action as place holder
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/CreateUIObjectAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/CreateUIObjectAction.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/CreateUIObjectAction.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class CreateUIObjectAction extends UIObjectAction
+{
+ public CreateUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/DestroyUIObjectAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/DestroyUIObjectAction.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/DestroyUIObjectAction.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class DestroyUIObjectAction extends UIObjectAction
+{
+ public DestroyUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/MoveUIObjectAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/MoveUIObjectAction.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/MoveUIObjectAction.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -0,0 +1,35 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class MoveUIObjectAction extends UIObjectAction
+{
+ public MoveUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/RenameUIObjectAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/RenameUIObjectAction.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/RenameUIObjectAction.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class RenameUIObjectAction extends UIObjectAction
+{
+
+ /** . */
+ private String name;
+
+ public RenameUIObjectAction(String targetId, String name)
+ {
+ super(targetId);
+
+ //
+ this.name = name;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java 2007-11-15 22:16:03 UTC (rev 8963)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -1,46 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.action.server;
-
-/**
- * Tell the client to show a particular page.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ShowPageResponse extends ServerResponse
-{
-
- /** . */
- private final String pageId;
-
- public ShowPageResponse(String pageId)
- {
- this.pageId = pageId;
- }
-
- public String getPageId()
- {
- return pageId;
- }
-}
Copied: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowUIObjectResponse.java (from rev 8963, branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowPageResponse.java)
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowUIObjectResponse.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ShowUIObjectResponse.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.action.server;
+
+/**
+ * Tell the client to show a particular page.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ShowUIObjectResponse extends UIObjectResponse
+{
+ public ShowUIObjectResponse(String targetId)
+ {
+ super(targetId);
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/UIObjectAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/UIObjectAction.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/UIObjectAction.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UIObjectAction extends ServerAction
+{
+
+ /** . */
+ private final String targetId;
+
+ public UIObjectAction(String targetId)
+ {
+ this.targetId = targetId;
+ }
+
+ public String getTargetId()
+ {
+ return targetId;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/UIObjectResponse.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/UIObjectResponse.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/UIObjectResponse.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.action.server;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UIObjectResponse extends ServerResponse
+{
+
+ /** . */
+ private final String targetId;
+
+ public UIObjectResponse(String targetId)
+ {
+ this.targetId = targetId;
+ }
+
+ public String getTargetId()
+ {
+ return targetId;
+ }
+}
Deleted: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java 2007-11-15 22:16:03 UTC (rev 8963)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -1,46 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.action.server;
-
-/**
- * Shows a page.
- *
- * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
- * @version $Revision: 1.1 $
- */
-public class ViewPageAction extends ServerAction
-{
-
- /** . */
- private final String pageId;
-
- public ViewPageAction(String pageId)
- {
- this.pageId = pageId;
- }
-
- public String getPageId()
- {
- return pageId;
- }
-}
Copied: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewUIObjectAction.java (from rev 8963, branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewPageAction.java)
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewUIObjectAction.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/action/server/ViewUIObjectAction.java 2007-11-15 22:23:54 UTC (rev 8964)
@@ -0,0 +1,37 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.action.server;
+
+/**
+ * Shows a page.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ViewUIObjectAction extends UIObjectAction
+{
+ public ViewUIObjectAction(String targetId)
+ {
+ super(targetId);
+ }
+}
16 years, 10 months
JBoss Portal SVN: r8963 - branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2007-11-15 17:16:03 -0500 (Thu, 15 Nov 2007)
New Revision: 8963
Modified:
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageTheme.xhtml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPortalTheme.xhtml
branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editWindowTheme.xhtml
Log:
- f:param doesn't do anything on commandButtons...
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageTheme.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageTheme.xhtml 2007-11-15 21:52:45 UTC (rev 8962)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPageTheme.xhtml 2007-11-15 22:16:03 UTC (rev 8963)
@@ -13,9 +13,7 @@
<h:commandButton value="Update" action="objects" actionListener="#{portalobjectmgr.theme.execute}"
styleClass="portlet-form-button"/>
<h:commandButton value="Cancel" action="#{portalobjectmgr.selectObject}"
- styleClass="portlet-form-button">
- <f:param name="id" value="#{node.id}"/>
- </h:commandButton>
+ styleClass="portlet-form-button"/>
</ui:define>
</ui:decorate>
</ui:define>
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPortalTheme.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPortalTheme.xhtml 2007-11-15 21:52:45 UTC (rev 8962)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editPortalTheme.xhtml 2007-11-15 22:16:03 UTC (rev 8963)
@@ -17,9 +17,7 @@
<h:commandButton value="Update" action="objects" actionListener="#{portalobjectmgr.theme.execute}"
styleClass="portlet-form-button"/>
<h:commandButton value="Cancel" action="#{portalobjectmgr.selectObject}"
- styleClass="portlet-form-button">
- <f:param name="id" value="#{node.id}"/>
- </h:commandButton>
+ styleClass="portlet-form-button"/>
</ui:define>
</ui:decorate>
</ui:define>
Modified: branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editWindowTheme.xhtml
===================================================================
--- branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editWindowTheme.xhtml 2007-11-15 21:52:45 UTC (rev 8962)
+++ branches/JBoss_Portal_Branch_2_6/core-admin/src/resources/portal-admin-war/WEB-INF/jsf/editWindowTheme.xhtml 2007-11-15 22:16:03 UTC (rev 8963)
@@ -13,9 +13,7 @@
<h:commandButton value="Update" action="objects" actionListener="#{portalobjectmgr.theme.execute}"
styleClass="portlet-form-button portlet-section-buttonrow"/>
<h:commandButton value="Cancel" action="#{portalobjectmgr.selectObject}"
- styleClass="portlet-form-button portlet-section-buttonrow">
- <f:param name="id" value="#{node.id}"/>
- </h:commandButton>
+ styleClass="portlet-form-button portlet-section-buttonrow"/>
</ui:define>
</ui:decorate>
</ui:define>
16 years, 10 months
JBoss Portal SVN: r8962 - in branches/UIServer: core/src/main/org/jboss/portal/core/presentation/server and 8 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-11-15 16:52:45 -0500 (Thu, 15 Nov 2007)
New Revision: 8962
Added:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIContainer.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIObject.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIPage.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIPortal.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/ModelLoader.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/ObjectState.java
Removed:
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
Log:
refactoring
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -29,12 +29,12 @@
import java.util.Iterator;
import java.util.ArrayList;
-import org.jboss.portal.presentation.model2.UIObject;
-import org.jboss.portal.presentation.model2.UIPortal;
-import org.jboss.portal.presentation.model2.UIPage;
-import org.jboss.portal.presentation.model2.UIWindow;
-import org.jboss.portal.presentation.model2.state.ModelLoader;
-import org.jboss.portal.presentation.model2.state.ObjectState;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.state.ModelLoader;
+import org.jboss.portal.presentation.model.state.ObjectState;
import org.jboss.portal.core.model.portal.PortalObjectContainer;
import org.jboss.portal.core.model.portal.PortalContainer;
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/server/PresentationServerImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -25,8 +25,8 @@
import org.jboss.portal.presentation.RequestContext;
import org.jboss.portal.presentation.server.Processor;
import org.jboss.portal.presentation.server.PresentationServer;
-import org.jboss.portal.presentation.model2.UIWindow;
-import org.jboss.portal.presentation.model2.state.ModelLoader;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.state.ModelLoader;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
Modified: branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java 2007-11-15 21:29:52 UTC (rev 8961)
+++ branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -36,8 +36,11 @@
import org.jboss.portal.core.model.portal.*;
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.presentation.model.ModelLoaderImpl;
-import org.jboss.portal.presentation.model2.*;
-import org.jboss.portal.presentation.impl.model2.UIContextImpl;
+import org.jboss.portal.presentation.impl.model.UIContextImpl;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIPage;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java 2007-11-15 21:29:52 UTC (rev 8961)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/RequestContext.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -23,8 +23,8 @@
package org.jboss.portal.presentation;
import org.jboss.portal.presentation.action.server.ServerAction;
-import org.jboss.portal.presentation.model2.UIContext;
-import org.jboss.portal.presentation.model2.state.ModelLoader;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.state.ModelLoader;
/**
* The contract that defines the services that the client provides to the server during a server invocation.
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContainerImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model;
+
+import org.jboss.portal.presentation.model.UIContainer;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIWindow;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIContainerImpl extends UIObjectImpl implements UIContainer
+{
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ boolean isAllowedAsChild = false;
+
+ if(type == UIWindow.class)
+ {
+ isAllowedAsChild = true;
+ }
+
+ return isAllowedAsChild;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIContextImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,131 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model;
+
+import java.util.Map;
+import java.util.Iterator;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.state.ModelLoader;
+import org.jboss.portal.presentation.model.state.ObjectState;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIContextImpl extends UIObjectImpl implements UIContext
+{
+ /**
+ *
+ */
+ private ModelLoader modelLoader = null;
+
+ /**
+ *
+ *
+ */
+ public UIContextImpl()
+ {
+ }
+
+ /**
+ *
+ */
+ public <T extends UIObject> T getObject(String id, Class<T> type)
+ {
+ try
+ {
+ T uiObject = null;
+
+ //Fetch the state of the UIObject in question
+ ObjectState objectState = this.modelLoader.loadState(id);
+
+ uiObject = this.getImplementationClass(type).newInstance();
+ ((UIObjectImpl)uiObject).setState(this,objectState, true);
+
+ return uiObject;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ */
+ public UIContext initUIObjectTree(Map<String,Class<? extends UIObject>> rootChildrenInfo)
+ {
+ UIContext uiContext = new UIContextImpl();
+ ((UIContextImpl)uiContext).setModelLoader(this.getModelLoader());
+
+ //load the children of the UIContext
+ Iterator<String> childrenNames = rootChildrenInfo.keySet().iterator();
+ while(childrenNames.hasNext())
+ {
+ String childName = childrenNames.next();
+ Class<? extends UIObject> type = rootChildrenInfo.get(childName);
+ UIObject child = uiContext.createChild(childName, type);
+ ObjectState objectState = this.modelLoader.loadState(child.getId());
+ ((UIObjectImpl)child).setState(this,objectState, false);
+ }
+
+ return uiContext;
+ }
+
+ /**
+ *
+ */
+ public ModelLoader getModelLoader()
+ {
+ return this.modelLoader;
+ }
+
+ /**
+ *
+ * @param modelLoader
+ */
+ public void setModelLoader(ModelLoader modelLoader)
+ {
+ this.modelLoader = modelLoader;
+ }
+
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ boolean isAllowedAsChild = false;
+
+ if(type == UIPortal.class)
+ {
+ isAllowedAsChild = true;
+ }
+
+ return isAllowedAsChild;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIObjectImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,387 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.io.Serializable;
+
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIContext;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIContainer;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.UIPage;
+
+import org.jboss.portal.presentation.model.state.ObjectState;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public abstract class UIObjectImpl implements UIObject, Serializable
+{
+ /**
+ *
+ */
+ protected String id = null;
+
+ /**
+ *
+ */
+ protected String name = null;
+
+ /**
+ *
+ */
+ protected UIObject parent = null;
+
+ /**
+ *
+ */
+ protected List<UIObject> children = new ArrayList<UIObject>(); //Lazy loaded
+
+ /**
+ * used to see if the children of this UIObject are fully loaded or not. Used for helping with lazy loading
+ */
+ private boolean childrenFullyLoaded = false;
+
+
+ /**
+ * This is used to assist with data needed during lazy loading, other state related data etc
+ */
+ private ObjectState state = null;
+
+
+ /**
+ *
+ */
+ public UIObjectImpl()
+ {
+ }
+
+ //UIObject interface implementation-----------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public String getId()
+ {
+ return this.id;
+ }
+
+ /**
+ *
+ */
+ public String getName()
+ {
+ return this.name;
+ }
+
+ /**
+ *
+ */
+ public UIObject getParent()
+ {
+ return this.parent;
+ }
+
+ /**
+ *
+ */
+ public List<UIObject> getChildren()
+ {
+ if(!this.childrenFullyLoaded)
+ {
+ //Lazy Load just the children of this UIObject. Don't load the children of each child though
+ if(this.state != null)
+ {
+ List<String> childrenIds = this.state.getChildrenIds();
+ if(childrenIds != null)
+ {
+ for(int i=0; i<childrenIds.size(); i++)
+ {
+ String childId = childrenIds.get(i);
+ ObjectState childState = this.getUIContext().getModelLoader().loadState(childId);
+ this.createChild(childState.getName(), childState.getType());
+ }
+ }
+ }
+
+ this.childrenFullyLoaded = true;
+ }
+
+ return this.children;
+ }
+
+ /**
+ *
+ */
+ public <T extends UIObject> List<T> getChildren(Class<T> type)
+ {
+ try
+ {
+ List<T> filteredList = new ArrayList<T>();
+
+ //Making sure all children are fully loaded
+ List<UIObject> allChildren = this.getChildren();
+
+ Class<T> implementationClass = this.getImplementationClass(type);
+ if(allChildren != null)
+ {
+ for(int i=0; i<allChildren.size(); i++)
+ {
+ UIObject child = allChildren.get(i);
+ if(implementationClass == child.getClass())
+ {
+ filteredList.add((T)child);
+ }
+ }
+ }
+ return filteredList;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> Class<T> getImplementationClass(Class<T> type) throws Exception
+ {
+ Class<T> uiobjectClass = null;
+
+ if(type == UIContext.class)
+ {
+ uiobjectClass = (Class<T>)UIContextImpl.class;
+ }
+ else if(type == UIPortal.class)
+ {
+ uiobjectClass = (Class<T>)UIPortalImpl.class;
+ }
+ else if(type == UIPage.class)
+ {
+ uiobjectClass = (Class<T>)UIPageImpl.class;
+ }
+ else if(type == UIContainer.class)
+ {
+ uiobjectClass = (Class<T>)UIContainerImpl.class;
+ }
+ else if(type == UIWindow.class)
+ {
+ uiobjectClass = (Class<T>)UIWindowImpl.class;
+ }
+
+ return uiobjectClass;
+ }
+
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected abstract <T extends UIObject> boolean isAllowedAsChild(Class<T> type);
+
+
+ /**
+ *
+ */
+ public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException
+ {
+ if(!this.isAllowedAsChild(type))
+ {
+ throw new IllegalArgumentException(type.getName()+" cannot be added as a child to this parent");
+ }
+ try
+ {
+ T child = this.getImplementationClass(type).newInstance();
+
+ //Name
+ ((UIObjectImpl)child).name = name;
+
+ //Parent
+ ((UIObjectImpl)child).parent = this;
+
+ //Id
+ ((UIObjectImpl)child).id = this.generateChildId(name);
+
+ //State
+ ((UIObjectImpl)child).state = this.getUIContext().getModelLoader().loadState(((UIObjectImpl)child).id);
+
+ this.children.add(child);
+
+ return child;
+ }
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ *
+ */
+ public void destroyChild(String name)
+ {
+ //Make sure all children are loaded
+ this.getChildren();
+ if(this.children != null)
+ {
+ for(int i=0; i<this.children.size(); i++)
+ {
+ UIObject child = this.children.get(i);
+ if(child.getName().equals(name))
+ {
+ this.children.remove(child);
+ break;
+ }
+ }
+ }
+ }
+ //-----UIObjectImpl implementation specific methods------------------------------------------------------------------------------------------------------------
+ protected void setState(UIContext uiContext, ObjectState state, boolean loadParent)
+ {
+ //Name
+ this.name = state.getName();
+
+ //Parent..load using parentId from state being used
+ if(loadParent && state.getParentId() != null && state.getParentId().trim().length()>0)
+ {
+ ObjectState parentState = uiContext.getModelLoader().loadState(state.getParentId());
+ this.parent = uiContext.getObject(state.getParentId(), parentState.getType());
+ }
+
+ //Id
+ this.id = this.generateId();
+
+ //State
+ this.state = state;
+ }
+ //--------------------------------------------------------------------------------------------------------------------------------------------------------------
+ /**
+ *
+ * @return
+ */
+ private String generateId()
+ {
+ String newId = null;
+
+ String myName = "";
+ if(this.getName() != null && this.getName().trim().length()>0)
+ {
+ myName = this.getName();
+ }
+
+ //Generate a new id concatenating its entire path in the UIObject tree
+ StringBuffer buffer = new StringBuffer();
+ if(this.getParent() != null && !(this.getParent() instanceof UIContext))
+ {
+ buffer.append("/"+this.getParent().getId().substring(1)+"/");
+ if(myName.trim().length()>0)
+ {
+ buffer.append(myName);
+ }
+ newId = buffer.toString();
+ }
+ else
+ {
+ buffer.append("/");
+ if(myName.trim().length()>0)
+ {
+ buffer.append(myName);
+ }
+ newId = buffer.toString();
+ }
+
+ return newId;
+ }
+
+ /**
+ *
+ * @return
+ */
+ private String generateChildId(String childName)
+ {
+ String newId = null;
+
+ String myName = "";
+ if(this.getName() != null && this.getName().trim().length()>0)
+ {
+ myName = this.getName();
+ }
+
+ //Generate a new id concatenating its entire path in the UIObject tree
+ StringBuffer buffer = new StringBuffer();
+ if(this.getParent() != null && !(this.getParent() instanceof UIContext))
+ {
+ buffer.append("/"+this.getParent().getId().substring(1)+"/");
+ if(myName.trim().length()>0)
+ {
+ buffer.append(myName+"/");
+ }
+ buffer.append(childName);
+ newId = buffer.toString();
+ }
+ else
+ {
+ buffer.append("/");
+ if(myName.trim().length()>0)
+ {
+ buffer.append(myName+"/");
+ }
+ buffer.append(childName);
+ newId = buffer.toString();
+ }
+
+ return newId;
+ }
+
+ /**
+ *
+ * @return
+ */
+ private UIContext getUIContext()
+ {
+ UIContext uiContext = null;
+
+ //Make sure this UIObject is not the root UIContext object
+ if(this.getParent() == null)
+ {
+ return (UIContext)this;
+ }
+
+ //Move up the tree to the UIContext and get the ModelLoader
+ UIObject parent = this.getParent();
+ while(!(parent instanceof UIContext))
+ {
+ parent = parent.getParent();
+ }
+ uiContext = (UIContext)parent;
+
+ return uiContext;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIPageImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,57 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model;
+
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIContainer;
+import org.jboss.portal.presentation.model.UIPage;
+import org.jboss.portal.presentation.model.UIWindow;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIPageImpl extends UIObjectImpl implements UIPage
+{
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ boolean isAllowedAsChild = false;
+
+ if(
+ type == UIPage.class ||
+ type == UIContainer.class ||
+ type == UIWindow.class
+ )
+ {
+ isAllowedAsChild = true;
+ }
+
+ return isAllowedAsChild;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIPortalImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model;
+
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.UIPage;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIPortalImpl extends UIObjectImpl implements UIPortal
+{
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ boolean isAllowedAsChild = false;
+
+ if(
+ type == UIPage.class
+ )
+ {
+ isAllowedAsChild = true;
+ }
+
+ return isAllowedAsChild;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model/UIWindowImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,109 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.impl.model;
+
+import org.jboss.portal.Mode;
+import org.jboss.portal.WindowState;
+import org.jboss.portal.presentation.model.UIObject;
+import org.jboss.portal.presentation.model.UIWindow;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIWindowImpl extends UIObjectImpl implements UIWindow
+{
+ /**
+ *
+ */
+ private Mode mode = null;
+
+ /**
+ *
+ */
+ private WindowState windowState = null;
+
+ /**
+ *
+ */
+ private String title = null;
+
+ /**
+ *
+ */
+ public Mode getMode()
+ {
+ return this.mode;
+ }
+
+ /**
+ *
+ */
+ public String getTitle()
+ {
+ return this.title;
+ }
+
+ /**
+ *
+ */
+ public WindowState getWindowState()
+ {
+ return this.windowState;
+ }
+
+ /**
+ *
+ */
+ public void setMode(Mode mode)
+ {
+ this.mode = mode;
+ }
+
+ /**
+ *
+ */
+ public void setTitle(String title)
+ {
+ this.title = title;
+ }
+
+ /**
+ *
+ */
+ public void setWindowState(WindowState windowState)
+ {
+ this.windowState = windowState;
+ }
+
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ return false;
+ }
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIContainer.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIContainer.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIContainer.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UIContainer extends UIObject
+{
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIContext.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIContext.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIContext.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,54 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+import java.util.Map;
+import org.jboss.portal.presentation.model.state.ModelLoader;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UIContext extends UIObject
+{
+ /**
+ *
+ * @param id
+ * @return
+ */
+ public <T extends UIObject> T getObject(String id, Class<T> type);
+
+ /**
+ *
+ * @param <T>
+ * @param childrenInfo
+ * @return
+ */
+ public UIContext initUIObjectTree(Map<String,Class<? extends UIObject>> rootChildrenInfo);
+
+ /**
+ *
+ * @return
+ */
+ public ModelLoader getModelLoader();
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIObject.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIObject.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIObject.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,80 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UIObject
+{
+ /**
+ *
+ * @return
+ */
+ public String getId();
+
+ /**
+ *
+ * @return
+ */
+ public String getName();
+
+ /**
+ *
+ * @return
+ */
+ public UIObject getParent();
+
+ /**
+ * Create a child with a specified type.
+ *
+ * @param name the child name
+ * @param type the child type
+ * @return the newly created child
+ * @throws IllegalArgumentException if the name is null, already exists or this kind of object does not accept children of the specified type
+ */
+ public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException;
+
+ /**
+ *
+ * @param name
+ */
+ public void destroyChild(String name);
+
+ /**
+ *
+ * @return
+ */
+ public List<UIObject> getChildren();
+
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ public <T extends UIObject> List<T> getChildren(Class<T> type);
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIPage.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIPage.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIPage.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UIPage extends UIObject
+{
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIPortal.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIPortal.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIPortal.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UIPortal extends UIObject
+{
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/UIWindow.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,69 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model;
+
+import org.jboss.portal.WindowState;
+import org.jboss.portal.Mode;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface UIWindow extends UIObject
+{
+ /**
+ *
+ * @return
+ */
+ public String getTitle();
+
+ /**
+ *
+ * @param title
+ */
+ public void setTitle(String title);
+
+ /**
+ *
+ * @return
+ */
+ public WindowState getWindowState();
+
+ /**
+ *
+ * @param windowState
+ */
+ public void setWindowState(WindowState windowState);
+
+ /**
+ *
+ * @return
+ */
+ public Mode getMode();
+
+ /**
+ *
+ * @param mode
+ */
+ public void setMode(Mode mode);
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/ModelLoader.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/ModelLoader.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/ModelLoader.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,43 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model.state;
+
+import org.jboss.portal.presentation.model.state.ObjectState;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ModelLoader
+{
+
+ /**
+ * Load the state of a specified object.
+ *
+ * @param objectId the object id
+ * @return the state of the object or null if such state does not exist
+ * @throws IllegalArgumentException if the object id argument is null
+ */
+ ObjectState loadState(String objectId) throws IllegalArgumentException;
+
+}
Added: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/ObjectState.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/ObjectState.java (rev 0)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model/state/ObjectState.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -0,0 +1,86 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.model.state;
+
+import org.jboss.portal.presentation.model.UIObject;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.List;
+
+/**
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class ObjectState implements Serializable
+{
+
+ /** . */
+ private final Class<? extends UIObject> type;
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final Map<String, String> properties;
+
+ /** . */
+ private final String parentId;
+
+ /** . */
+ private final List<String> childrenIds;
+
+ public ObjectState(Class<? extends UIObject> type, String name, Map<String, String> properties, String parentId, List<String> childrenIds)
+ {
+ this.type = type;
+ this.name = name;
+ this.properties = properties;
+ this.parentId = parentId;
+ this.childrenIds = childrenIds;
+ }
+
+ public Class<? extends UIObject> getType()
+ {
+ return type;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Map<String, String> getProperties()
+ {
+ return properties;
+ }
+
+ public String getParentId()
+ {
+ return parentId;
+ }
+
+ public List<String> getChildrenIds()
+ {
+ return childrenIds;
+ }
+}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-15 21:29:52 UTC (rev 8961)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/server/PresentationServer.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -23,8 +23,8 @@
package org.jboss.portal.presentation.server;
import org.jboss.portal.presentation.RequestContext;
-import org.jboss.portal.presentation.model2.UIWindow;
-import org.jboss.portal.presentation.model2.state.ModelLoader;
+import org.jboss.portal.presentation.model.UIWindow;
+import org.jboss.portal.presentation.model.state.ModelLoader;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -25,9 +25,9 @@
import java.util.List;
import java.util.ArrayList;
-import org.jboss.portal.presentation.model2.UIPortal;
-import org.jboss.portal.presentation.model2.state.ModelLoader;
-import org.jboss.portal.presentation.model2.state.ObjectState;
+import org.jboss.portal.presentation.model.UIPortal;
+import org.jboss.portal.presentation.model.state.ModelLoader;
+import org.jboss.portal.presentation.model.state.ObjectState;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-11-15 21:29:52 UTC (rev 8961)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-11-15 21:52:45 UTC (rev 8962)
@@ -29,8 +29,8 @@
import java.util.Map;
import java.util.HashMap;
-import org.jboss.portal.presentation.model2.*;
-import org.jboss.portal.presentation.impl.model2.UIContextImpl;
+import org.jboss.portal.presentation.model.*;
+import org.jboss.portal.presentation.impl.model.UIContextImpl;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
16 years, 10 months
JBoss Portal SVN: r8961 - in branches/UIServer: core/src/main/org/jboss/portal/test/core/presentation/model and 3 other directories.
by portal-commits@lists.jboss.org
Author: sohil.shah(a)jboss.com
Date: 2007-11-15 16:29:52 -0500 (Thu, 15 Nov 2007)
New Revision: 8961
Modified:
branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContainerImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPageImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPortalImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIWindowImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java
branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
Log:
cleanup to make sure client to the UI model is implementation-agnostic
Modified: branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/core/src/main/org/jboss/portal/core/presentation/model/ModelLoaderImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -30,9 +30,9 @@
import java.util.ArrayList;
import org.jboss.portal.presentation.model2.UIObject;
-import org.jboss.portal.presentation.impl.model2.UIPortalImpl;
-import org.jboss.portal.presentation.impl.model2.UIPageImpl;
-import org.jboss.portal.presentation.impl.model2.UIWindowImpl;
+import org.jboss.portal.presentation.model2.UIPortal;
+import org.jboss.portal.presentation.model2.UIPage;
+import org.jboss.portal.presentation.model2.UIWindow;
import org.jboss.portal.presentation.model2.state.ModelLoader;
import org.jboss.portal.presentation.model2.state.ObjectState;
@@ -138,15 +138,15 @@
if(portalObject instanceof Portal)
{
- type = UIPortalImpl.class;
+ type = UIPortal.class;
}
else if(portalObject instanceof Page)
{
- type = UIPageImpl.class;
+ type = UIPage.class;
}
else if(portalObject instanceof Window)
{
- type = UIWindowImpl.class;
+ type = UIWindow.class;
}
return type;
Modified: branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java
===================================================================
--- branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/core/src/main/org/jboss/portal/test/core/presentation/model/UIModelTester.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -37,7 +37,7 @@
import org.jboss.portal.core.model.content.ContentType;
import org.jboss.portal.core.presentation.model.ModelLoaderImpl;
import org.jboss.portal.presentation.model2.*;
-import org.jboss.portal.presentation.impl.model2.*;
+import org.jboss.portal.presentation.impl.model2.UIContextImpl;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -91,14 +91,13 @@
//Setup rootChildrenInfo
Map rootChildrenInfo = new HashMap();
- rootChildrenInfo.put("defaultPortal", UIPortalImpl.class);
+ rootChildrenInfo.put("defaultPortal", UIPortal.class);
UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
- UIObject defaultPortal = objectTree.getChildren(UIPortalImpl.class).get(0);
+ UIPortal defaultPortal = objectTree.getChildren(UIPortal.class).get(0);
assertEquals(defaultPortal.getName(), "defaultPortal");
assertEquals(defaultPortal.getId(), "/defaultPortal");
- assertTrue(defaultPortal instanceof UIPortal);
List<UIObject> lazyLoadedChildren = defaultPortal.getChildren();
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContainerImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContainerImpl.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContainerImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -23,6 +23,8 @@
package org.jboss.portal.presentation.impl.model2;
import org.jboss.portal.presentation.model2.UIContainer;
+import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.model2.UIWindow;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -30,5 +32,21 @@
*/
public class UIContainerImpl extends UIObjectImpl implements UIContainer
{
-
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ boolean isAllowedAsChild = false;
+
+ if(type == UIWindow.class)
+ {
+ isAllowedAsChild = true;
+ }
+
+ return isAllowedAsChild;
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIContextImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -26,6 +26,7 @@
import java.util.Iterator;
import org.jboss.portal.presentation.model2.UIContext;
import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.model2.UIPortal;
import org.jboss.portal.presentation.model2.state.ModelLoader;
import org.jboss.portal.presentation.model2.state.ObjectState;
@@ -60,19 +61,15 @@
//Fetch the state of the UIObject in question
ObjectState objectState = this.modelLoader.loadState(id);
- uiObject = type.newInstance();
+ uiObject = this.getImplementationClass(type).newInstance();
((UIObjectImpl)uiObject).setState(this,objectState, true);
return uiObject;
}
- catch(InstantiationException ie)
+ catch(Exception e)
{
- throw new RuntimeException(ie);
- }
- catch(IllegalAccessException iae)
- {
- throw new RuntimeException(iae);
- }
+ throw new RuntimeException(e);
+ }
}
/**
@@ -113,4 +110,22 @@
{
this.modelLoader = modelLoader;
}
+
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ boolean isAllowedAsChild = false;
+
+ if(type == UIPortal.class)
+ {
+ isAllowedAsChild = true;
+ }
+
+ return isAllowedAsChild;
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIObjectImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -28,6 +28,11 @@
import org.jboss.portal.presentation.model2.UIObject;
import org.jboss.portal.presentation.model2.UIContext;
+import org.jboss.portal.presentation.model2.UIPortal;
+import org.jboss.portal.presentation.model2.UIContainer;
+import org.jboss.portal.presentation.model2.UIWindow;
+import org.jboss.portal.presentation.model2.UIPage;
+
import org.jboss.portal.presentation.model2.state.ObjectState;
/**
@@ -131,58 +136,90 @@
/**
*
*/
- public <T extends UIObject> List<UIObject> getChildren(Class<T> type)
+ public <T extends UIObject> List<T> getChildren(Class<T> type)
{
- List<UIObject> filteredList = new ArrayList<UIObject>();
-
- //Making sure all children are fully loaded
- List<UIObject> allChildren = this.getChildren();
-
- if(allChildren != null)
+ try
{
- for(int i=0; i<allChildren.size(); i++)
+ List<T> filteredList = new ArrayList<T>();
+
+ //Making sure all children are fully loaded
+ List<UIObject> allChildren = this.getChildren();
+
+ Class<T> implementationClass = this.getImplementationClass(type);
+ if(allChildren != null)
{
- UIObject child = allChildren.get(i);
- if(type == child.getClass())
+ for(int i=0; i<allChildren.size(); i++)
{
- filteredList.add(child);
+ UIObject child = allChildren.get(i);
+ if(implementationClass == child.getClass())
+ {
+ filteredList.add((T)child);
+ }
}
}
+ return filteredList;
}
- return filteredList;
+ catch(Exception e)
+ {
+ throw new RuntimeException(e);
+ }
}
- protected Class<? extends UIObjectImpl> getImplementationType(Class<? extends UIObject> type)
+ /**
+ *
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> Class<T> getImplementationClass(Class<T> type) throws Exception
{
- return null;
+ Class<T> uiobjectClass = null;
+
+ if(type == UIContext.class)
+ {
+ uiobjectClass = (Class<T>)UIContextImpl.class;
+ }
+ else if(type == UIPortal.class)
+ {
+ uiobjectClass = (Class<T>)UIPortalImpl.class;
+ }
+ else if(type == UIPage.class)
+ {
+ uiobjectClass = (Class<T>)UIPageImpl.class;
+ }
+ else if(type == UIContainer.class)
+ {
+ uiobjectClass = (Class<T>)UIContainerImpl.class;
+ }
+ else if(type == UIWindow.class)
+ {
+ uiobjectClass = (Class<T>)UIWindowImpl.class;
+ }
+
+ return uiobjectClass;
}
+
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected abstract <T extends UIObject> boolean isAllowedAsChild(Class<T> type);
- protected abstract boolean isChildTypeAccepted(Class<? extends UIObject> type);
/**
*
*/
public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException
{
- if (!isChildTypeAccepted(type))
+ if(!this.isAllowedAsChild(type))
{
- throw new IllegalArgumentException("Blah");
+ throw new IllegalArgumentException(type.getName()+" cannot be added as a child to this parent");
}
-
- //
- Class<? extends UIObjectImpl> implType = getImplementationType(type);
-
try
{
- T child = null;
+ T child = this.getImplementationClass(type).newInstance();
- if(type == UIContextImpl.class)
- {
- throw new IllegalArgumentException("UIContext must be the root of the UIObject tree. It should not be added to any UIObject as a child");
- }
-
- child = type.newInstance();
-
//Name
((UIObjectImpl)child).name = name;
@@ -196,16 +233,13 @@
((UIObjectImpl)child).state = this.getUIContext().getModelLoader().loadState(((UIObjectImpl)child).id);
this.children.add(child);
+
return child;
}
- catch(InstantiationException ie)
+ catch(Exception e)
{
- throw new RuntimeException(ie);
- }
- catch(IllegalAccessException iae)
- {
- throw new RuntimeException(iae);
- }
+ throw new RuntimeException(e);
+ }
}
/**
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPageImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPageImpl.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPageImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -22,12 +22,36 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model2;
+import org.jboss.portal.presentation.model2.UIObject;
+import org.jboss.portal.presentation.model2.UIContainer;
import org.jboss.portal.presentation.model2.UIPage;
+import org.jboss.portal.presentation.model2.UIWindow;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
*
*/
public class UIPageImpl extends UIObjectImpl implements UIPage
-{
+{
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ boolean isAllowedAsChild = false;
+
+ if(
+ type == UIPage.class ||
+ type == UIContainer.class ||
+ type == UIWindow.class
+ )
+ {
+ isAllowedAsChild = true;
+ }
+
+ return isAllowedAsChild;
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPortalImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPortalImpl.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIPortalImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -22,7 +22,9 @@
******************************************************************************/
package org.jboss.portal.presentation.impl.model2;
+import org.jboss.portal.presentation.model2.UIObject;
import org.jboss.portal.presentation.model2.UIPortal;
+import org.jboss.portal.presentation.model2.UIPage;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -30,5 +32,23 @@
*/
public class UIPortalImpl extends UIObjectImpl implements UIPortal
{
-
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ boolean isAllowedAsChild = false;
+
+ if(
+ type == UIPage.class
+ )
+ {
+ isAllowedAsChild = true;
+ }
+
+ return isAllowedAsChild;
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIWindowImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIWindowImpl.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/impl/model2/UIWindowImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -24,6 +24,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.presentation.model2.UIObject;
import org.jboss.portal.presentation.model2.UIWindow;
/**
@@ -94,4 +95,15 @@
{
this.windowState = windowState;
}
+
+ /**
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ protected <T extends UIObject> boolean isAllowedAsChild(Class<T> type)
+ {
+ return false;
+ }
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/model2/UIObject.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -56,7 +56,7 @@
* @return the newly created child
* @throws IllegalArgumentException if the name is null, already exists or this kind of object does not accept children of the specified type
*/
- public <T extends UIObject>T createChild(String name, Class<T> type) throws IllegalArgumentException;
+ public <T extends UIObject> T createChild(String name, Class<T> type) throws IllegalArgumentException;
/**
*
@@ -76,5 +76,5 @@
* @param type
* @return
*/
- public <T extends UIObject> List<UIObject> getChildren(Class<T> type);
+ public <T extends UIObject> List<T> getChildren(Class<T> type);
}
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/MockModelLoaderImpl.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -25,7 +25,7 @@
import java.util.List;
import java.util.ArrayList;
-import org.jboss.portal.presentation.impl.model2.UIPortalImpl;
+import org.jboss.portal.presentation.model2.UIPortal;
import org.jboss.portal.presentation.model2.state.ModelLoader;
import org.jboss.portal.presentation.model2.state.ObjectState;
@@ -57,7 +57,7 @@
}
- state = new ObjectState(UIPortalImpl.class,
+ state = new ObjectState(UIPortal.class,
name,
null, //properties
parentId,
Modified: branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java
===================================================================
--- branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-11-15 21:14:22 UTC (rev 8960)
+++ branches/UIServer/uiserver/src/main/org/jboss/portal/presentation/test/model/UIModelTester.java 2007-11-15 21:29:52 UTC (rev 8961)
@@ -30,7 +30,7 @@
import java.util.HashMap;
import org.jboss.portal.presentation.model2.*;
-import org.jboss.portal.presentation.impl.model2.*;
+import org.jboss.portal.presentation.impl.model2.UIContextImpl;
/**
* @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
@@ -67,39 +67,33 @@
//Adding a UIContext...this should result in an IllegalArgumentException
try
{
- this.uiContext.createChild("duplicateRoot", UIContextImpl.class);
+ this.uiContext.createChild("duplicateRoot", UIContext.class);
}
catch(Exception e)
{
this.assertEquals(e.getClass(), IllegalArgumentException.class);
}
- //Add a UIPage to the UIContext
- this.uiContext.createChild("defaultPortal", UIPortalImpl.class);
-
//Assert the state of UIPortal added to the UIObject tree
- UIObject portal = this.uiContext.getChildren(UIPortalImpl.class).get(0);
+ UIPortal portal = this.uiContext.createChild("defaultPortal", UIPortal.class);
assertEquals(portal.getName(), "defaultPortal");
assertEquals(portal.getId(), "/defaultPortal");
assertTrue(portal.getParent() instanceof UIContext);
//Add a UIPage to the UIPortal
- portal.createChild("defaultPage", UIPageImpl.class);
- UIObject page = portal.getChildren(UIPageImpl.class).get(0);
+ UIPage page = portal.createChild("defaultPage", UIPage.class);
assertEquals(page.getName(), "defaultPage");
assertEquals(page.getId(), "/defaultPortal/defaultPage");
assertTrue(page.getParent() instanceof UIPortal);
//Add a UIPage to the UIContainer
- page.createChild("defaultContainer", UIContainerImpl.class);
- UIObject container = page.getChildren(UIContainerImpl.class).get(0);
+ UIContainer container = page.createChild("defaultContainer", UIContainer.class);
assertEquals(container.getName(), "defaultContainer");
assertEquals(container.getId(), "/defaultPortal/defaultPage/defaultContainer");
assertTrue(container.getParent() instanceof UIPage);
//Add a UIWindow to UIPage
- container.createChild("defaultWindow", UIWindowImpl.class);
- UIObject window = container.getChildren(UIWindowImpl.class).get(0);
+ UIWindow window = container.createChild("defaultWindow", UIWindow.class);
assertEquals(window.getName(), "defaultWindow");
assertEquals(window.getId(), "/defaultPortal/defaultPage/defaultContainer/defaultWindow");
assertTrue(window.getParent() instanceof UIContainer);
@@ -110,24 +104,18 @@
* @throws Exception
*/
public void testDestroyChild() throws Exception
- {
- //Add a UIPage to the UIContext
- this.uiContext.createChild("defaultPortal", UIPortalImpl.class);
-
+ {
//Assert the state of UIPortal added to the UIObject tree
- UIObject portal = this.uiContext.getChildren(UIPortalImpl.class).get(0);
+ UIPortal portal = this.uiContext.createChild("defaultPortal", UIPortal.class);
//Add a UIPage to the UIPortal
- portal.createChild("defaultPage", UIPageImpl.class);
- UIObject page = portal.getChildren(UIPageImpl.class).get(0);
+ UIPage page = portal.createChild("defaultPage", UIPage.class);
//Add a UIPage to the UIContainer
- page.createChild("defaultContainer", UIContainerImpl.class);
- UIObject container = page.getChildren(UIContainerImpl.class).get(0);
+ UIContainer container = page.createChild("defaultContainer", UIContainer.class);
//Add a UIWindow to UIPage
- container.createChild("defaultWindow", UIWindowImpl.class);
- UIObject window = container.getChildren(UIWindowImpl.class).get(0);
+ UIWindow window = container.createChild("defaultWindow", UIWindow.class);
//Destroy the container. When this is done, both container and window must be destroyed from the UIObject tree
page.destroyChild(container.getName());
@@ -143,12 +131,12 @@
{
//Setup rootChildrenInfo
Map rootChildrenInfo = new HashMap();
- rootChildrenInfo.put("defaultPortal", UIPortalImpl.class);
- rootChildrenInfo.put("someOtherPortal", UIPortalImpl.class);
+ rootChildrenInfo.put("defaultPortal", UIPortal.class);
+ rootChildrenInfo.put("someOtherPortal", UIPortal.class);
UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
- UIObject defaultPortal = objectTree.getChildren(UIPortalImpl.class).get(0);
- UIObject someOtherPortal = objectTree.getChildren(UIPortalImpl.class).get(1);
+ UIPortal defaultPortal = objectTree.getChildren(UIPortal.class).get(0);
+ UIPortal someOtherPortal = objectTree.getChildren(UIPortal.class).get(1);
assertEquals(defaultPortal.getName(), "defaultPortal");
assertEquals(defaultPortal.getId(), "/defaultPortal");
@@ -164,12 +152,12 @@
{
//Setup rootChildrenInfo
Map rootChildrenInfo = new HashMap();
- rootChildrenInfo.put("defaultPortal", UIPortalImpl.class);
+ rootChildrenInfo.put("defaultPortal", UIPortal.class);
UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
- UIObject uiObject = objectTree.getObject("/defaultPortal/defaultPage", UIPortalImpl.class);
- UIObject parent = uiObject.getParent();
+ UIPortal portal = objectTree.getObject("/defaultPortal/defaultPage", UIPortal.class);
+ UIObject parent = portal.getParent();
assertEquals(parent.getName(), "defaultPortal");
assertEquals(parent.getId(), "/defaultPortal");
@@ -182,10 +170,10 @@
public void testLazyLoading() throws Exception
{
Map rootChildrenInfo = new HashMap();
- rootChildrenInfo.put("testingLazyLoading", UIPortalImpl.class);
+ rootChildrenInfo.put("testingLazyLoading", UIPortal.class);
UIContext objectTree = this.uiContext.initUIObjectTree(rootChildrenInfo);
- UIObject defaultPortal = objectTree.getChildren(UIPortalImpl.class).get(0);
+ UIPortal defaultPortal = objectTree.getChildren(UIPortal.class).get(0);
List<UIObject> lazyLoadedChildren = defaultPortal.getChildren();
assertTrue((lazyLoadedChildren != null && lazyLoadedChildren.size()>0));
16 years, 10 months
JBoss Portal SVN: r8960 - modules/identity/trunk/identity/src/test/java/org/jboss/portal/test/identity.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-15 16:14:22 -0500 (Thu, 15 Nov 2007)
New Revision: 8960
Modified:
modules/identity/trunk/identity/src/test/java/org/jboss/portal/test/identity/GenericTest.java
Log:
bobo
Modified: modules/identity/trunk/identity/src/test/java/org/jboss/portal/test/identity/GenericTest.java
===================================================================
--- modules/identity/trunk/identity/src/test/java/org/jboss/portal/test/identity/GenericTest.java 2007-11-15 20:50:04 UTC (rev 8959)
+++ modules/identity/trunk/identity/src/test/java/org/jboss/portal/test/identity/GenericTest.java 2007-11-15 21:14:22 UTC (rev 8960)
@@ -721,10 +721,10 @@
Role g1 = ctx.getRoleModule().createRole("role1", "role1");
Role g2 = ctx.getRoleModule().createRole("role2", "role2");
ctx.getMembershipModule().assignRoles(u1, Collections.singleton(g1));
- //ctx.getMembershipModule().assignRoles(u2, (Set)CollectionBuilder.hashSet().add(g1).add(g2).get());
- //ctx.getMembershipModule().assignRoles(admin, (Set)CollectionBuilder.hashSet().add(g1).add(g2).get());
- ctx.getMembershipModule().assignRoles(u2, new CollectionBuilder().add(g1).add(g2).toHashSet());
- ctx.getMembershipModule().assignRoles(admin, new CollectionBuilder().add(g1).add(g2).toHashSet());
+ ctx.getMembershipModule().assignRoles(u2, (Set)CollectionBuilder.hashSet().add(g1).add(g2).get());
+ ctx.getMembershipModule().assignRoles(admin, (Set)CollectionBuilder.hashSet().add(g1).add(g2).get());
+ //ctx.getMembershipModule().assignRoles(u2, new CollectionBuilder().add(g1).add(g2).toHashSet());
+ //ctx.getMembershipModule().assignRoles(admin, new CollectionBuilder().add(g1).add(g2).toHashSet());
ctx.commit();
}
16 years, 10 months
JBoss Portal SVN: r8959 - modules/identity/trunk/identity.
by portal-commits@lists.jboss.org
Author: bdaw
Date: 2007-11-15 15:50:04 -0500 (Thu, 15 Nov 2007)
New Revision: 8959
Modified:
modules/identity/trunk/identity/pom.xml
Log:
make it build
Modified: modules/identity/trunk/identity/pom.xml
===================================================================
--- modules/identity/trunk/identity/pom.xml 2007-11-15 19:53:15 UTC (rev 8958)
+++ modules/identity/trunk/identity/pom.xml 2007-11-15 20:50:04 UTC (rev 8959)
@@ -47,6 +47,11 @@
<artifactId>portal-test</artifactId>
<!--<scope>test</scope>-->
</dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.jboss.unit</groupId>-->
+ <!--<artifactId>jboss-unit-tooling-maven2</artifactId>-->
+ <!--<scope>test</scope>-->
+ <!--</dependency>-->
<dependency>
<groupId>jboss</groupId>
<artifactId>jboss-logging-spi</artifactId>
@@ -145,6 +150,7 @@
<!--<scope>test</scope>-->
</dependency>
</dependencies>
+
<build>
<plugins>
<plugin>
@@ -269,11 +275,9 @@
</configuration>
</plugin>
<plugin>
- <dependencies>
-
- </dependencies>
<groupId>org.jboss.unit</groupId>
<artifactId>jboss-unit-tooling-maven2</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
<executions>
<execution>
<phase>integration-test</phase>
@@ -286,7 +290,7 @@
<testsuites>
<testsuite>
<config>jboss-unit.xml</config>
- <!--<JPDA>true</JPDA>-->
+ <JPDA>true</JPDA>
</testsuite>
</testsuites>
<reports>
16 years, 10 months