JBoss Portal SVN: r11187 - branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2008-06-28 08:13:51 -0400 (Sat, 28 Jun 2008)
New Revision: 11187
Modified:
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_it.properties
Log:
internationalization update
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-06-28 12:13:11 UTC (rev 11186)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource.properties 2008-06-28 12:13:51 UTC (rev 11187)
@@ -123,4 +123,12 @@
CMS_CLICK_HERE=click here
CMS_SELECT_ACTION=Select Action
-CMS_QUERYERROR=The query you entered is not valid
\ No newline at end of file
+CMS_QUERYERROR=The query you entered is not valid
+
+CMS_ADMIN_SET_READ_PERMISSIONS=Set Read Permissions
+CMS_ADMIN_SET_WRITE_PERMISSIONS=Set Write Permissions
+CMS_ADMIN_SET_MANAGE_PERMISSIONS=Set Manage Permissions
+CMS_ADMIN_SELECT_ROLES=Select Roles that have access to this node.
+CMS_ADMIN_SELECT_USERS=Select Users that have access to this node.
+CMS_ADMIN_YOU_CAN_SELECT_CTRL_ROLES=You may select multiple roles by using CTRL+click on the role names.
+CMS_ADMIN_YOU_CAN_SELECT_CTRL_USERS=You may select multiple users by using CTRL+click on the user names.
\ No newline at end of file
Modified: branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_it.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_it.properties 2008-06-28 12:13:11 UTC (rev 11186)
+++ branches/JBoss_Portal_Branch_2_7/core-cms/src/resources/portal-cms-war/WEB-INF/classes/Resource_it.properties 2008-06-28 12:13:51 UTC (rev 11187)
@@ -33,7 +33,7 @@
TITLE_EDIT=Modifica File
TITLE_CREATE=Creazione File
TITLE_UPLOAD=Caricamento File
-TITLE_SECURECONFIRM=Nodo sicuro
+TITLE_SECURECONFIRM=Sicurezza sul Nodo
CMS_SEARCH=Ricerca
CMS_SEARCHNORESULT=Nessun risultato per questa ricerca
@@ -51,18 +51,20 @@
CMS_FOLDER=Cartella
CMS_FILE=File
CMS_CREATE=Crea
-CMS_CANCEL=annullamento
+CMS_CANCEL=Annulla
CMS_EDIT=Edita
CMS_UPLOAD=Caricamento
CMS_MODIFY=Modifica
CMS_CREATEFOLDER= Crea Cartella
CMS_CREATEFILE=Crea File
CMS_UPLOADARCHIVE=Carica Archivio
+CMS_UPLOADARCHIVE_ASYNC=Processione asincrona
CMS_BACKTOBROWSER=Torna al Navigatore delle Directory
CMS_TRANSFER=Importa/Esporta
CMS_EXPORTARCHIVE=Esporta Cartella
-CMS_SECURE=Sicurezza
+CMS_SECURE=Rendi sicuro
CMS_PREVIEW=Anteprima
+CMS_GO=Vai
CMS_CREATEFILEINDIR=Crea File nella Directory
CMS_FILENAME=Nome del File
@@ -97,6 +99,9 @@
CMS_EMPTY_FOLDER=Questa cartella \u00e8 vuota .
+CMS_ERROR_UPLOADARCHIVE_ASYNC=Si \u00e8 verificato un errore nel processare l\'archivio. Riprova attivando il servizio di processione asincrona
+CMS_MSG_UPLOADARCHIVE_ASYNC=Il tuo archivio sta per essere processato. Una volta terminato il processo le risorse appariranno nella tua cartella
+
CMS_REQUIRED=Obbligatorio
CMS_LINK_TO_RESOURCES=I link alle risorse all\'interno del portale devono essere assoluti. Per esempio: Un link a un\'immagine che si trova in in default/images/back.gif deve essere digitato esattamente come mostrato. Non iniziare mai il percorso con uno (/). Puoi verificare la correttezza del link cliccando sul bottone di anteprima dell1'editor
CMS_ERROR_PROCESSING=ERRORE nel processare l\'esportazione
@@ -116,4 +121,14 @@
CMS_HELP=La Portlet CMS visualizza e salva i contenuti di un file da dentro la finestra di una Portlet, o, nel caso di un contenuto binario, fuori della finestra
CMS_TO_MODIFY=Per modificare il comportamento di questa Portlet,
CMS_CLICK_HERE=clicca qui
-CMS_SELECT_ACTION=Seleziona un\'azione
\ No newline at end of file
+CMS_SELECT_ACTION=Seleziona un\'azione
+
+CMS_QUERYERROR=The query you entered is not valid
+
+CMS_ADMIN_SET_READ_PERMISSIONS=Configura i permessi in lettura
+CMS_ADMIN_SET_WRITE_PERMISSIONS=Configura i permessi in scrittura
+CMS_ADMIN_SET_MANAGE_PERMISSIONS=Configura i permessi in modalit\u00e0 amministrativa
+CMS_ADMIN_SELECT_ROLES=Seleziona i ruoli che hanno accesso a questo nodo.
+CMS_ADMIN_SELECT_USERS=Seleziona gli utenti che hanno accesso a questo nodo.
+CMS_ADMIN_YOU_CAN_SELECT_CTRL_ROLES=Puoi selezionare pi\u00F9 ruoli usando il CTRL+click sui nomi dei ruoli.
+CMS_ADMIN_YOU_CAN_SELECT_CTRL_USERS=Puoi selezionare pi\u00F9 utenti usando il CTRL+click sui nomi degli utenti.
\ No newline at end of file
17 years, 10 months
JBoss Portal SVN: r11186 - branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/classes.
by portal-commits@lists.jboss.org
Author: sviluppatorefico
Date: 2008-06-28 08:13:11 -0400 (Sat, 28 Jun 2008)
New Revision: 11186
Modified:
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/classes/Resource_it.properties
Log:
internationalization update
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/classes/Resource_it.properties
===================================================================
--- branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/classes/Resource_it.properties 2008-06-28 00:51:31 UTC (rev 11185)
+++ branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/WEB-INF/classes/Resource_it.properties 2008-06-28 12:13:11 UTC (rev 11186)
@@ -26,7 +26,7 @@
ACCOUNT_NOTASSIGNEDTOROLE=L\'utente non ha i giusti permessi
LOGIN_TITLE=JBoss Portal Login
-LOGIN_USERNAME=Nome utente
+LOGIN_USERNAME=Utente
LOGIN_PASSWORD=Password
LOGIN_CANCEL=Annulla
LOGIN_SUBMIT=Invia
17 years, 10 months
JBoss Portal SVN: r11185 - modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-27 20:51:31 -0400 (Fri, 27 Jun 2008)
New Revision: 11185
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
Log:
make the logger autoscroll to the bottom
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-06-28 00:22:22 UTC (rev 11184)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-06-28 00:51:31 UTC (rev 11185)
@@ -127,7 +127,7 @@
container = getElement();
//
- DOM.setStyleAttribute(container, "width", "auto");
+ // DOM.setStyleAttribute(container, "width", "auto");
DOM.setStyleAttribute(container, "height", "128px");
DOM.setStyleAttribute(container, "overflow", "scroll");
@@ -144,6 +144,10 @@
//
DOM.appendChild(container, div);
+
+ // Autoscroll to bottom
+ String height = DOM.getElementProperty(container, "scrollHeight");
+ DOM.setElementProperty(container, "scrollTop", height);
}
}
17 years, 10 months
JBoss Portal SVN: r11184 - in modules/presentation/trunk: ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model and 3 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-27 20:22:22 -0400 (Fri, 27 Jun 2008)
New Revision: 11184
Added:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Level.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
Removed:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java
Modified:
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Bootstrap.java
modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/Presentation.html
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
Log:
added logger in GWT to display what's going on
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/PresentationClientAgent.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -25,12 +25,19 @@
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwt.user.client.Window;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.AbsolutePanel;
+import com.google.gwt.user.client.ui.VerticalPanel;
+import com.google.gwt.user.client.DOM;
+import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.jboss.portal.presentation.ajax.client.model.update.ModelUpdate;
import org.jboss.portal.presentation.ajax.client.model.AjaxObject;
import org.jboss.portal.presentation.ajax.client.utils.Bootstrap;
+import org.jboss.portal.presentation.ajax.client.utils.Appender;
+import org.jboss.portal.presentation.ajax.client.utils.Level;
+import org.jboss.portal.presentation.ajax.client.utils.Logger;
import java.util.Map;
import java.util.HashMap;
@@ -42,8 +49,9 @@
public class PresentationClientAgent implements EntryPoint
{
+ /** . */
+ private static final Logger log = Logger.getLogger(PresentationClientAgent.class);
-
/** . */
private Map pages = new HashMap();
@@ -52,6 +60,22 @@
public void onModuleLoad()
{
+ VerticalPanel main = new VerticalPanel();
+
+ //
+ RootPanel.get().add(main);
+
+ //
+ SimpleAppender appender = new SimpleAppender();
+ main.add(appender);
+ Logger.registerAppender(appender);
+ log.info("Added logger");
+
+ //
+ final AbsolutePanel bottom = new AbsolutePanel();
+ main.add(bottom);
+
+ //
Bootstrap.init();
// Initialize the remote service
@@ -65,7 +89,7 @@
{
public void onFailure(Throwable throwable)
{
- Window.alert("Ping failed " + throwable.getMessage());
+ log.info("Ping failed " + throwable.getMessage());
}
public void onSuccess(Object o)
@@ -82,11 +106,45 @@
context.getRoot().refresh();
//
- RootPanel.get().add(context.getRoot().getWidget());
+ bottom.add(context.getRoot().getWidget());
}
};
//
remote.ping(callback);
}
+
+ private static class SimpleAppender extends FlowPanel implements Appender
+ {
+
+ // width:auto; height:100px; overflow:hidden;
+
+ /** . */
+ private Element container;
+
+ private SimpleAppender()
+ {
+ container = getElement();
+
+ //
+ DOM.setStyleAttribute(container, "width", "auto");
+ DOM.setStyleAttribute(container, "height", "128px");
+ DOM.setStyleAttribute(container, "overflow", "scroll");
+
+ //
+ setStylePrimaryName("log");
+ }
+
+ public void append(Level level, String category, String msg)
+ {
+ Element div = DOM.createDiv();
+
+ //
+ DOM.setInnerHTML(div, level + " " + category + " " + msg);
+
+ //
+ DOM.appendChild(container, div);
+ }
+ }
+
}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/model/AjaxWindow.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -40,6 +40,7 @@
import org.jboss.portal.presentation.ajax.client.protocol.AjaxRequest;
import org.jboss.portal.presentation.ajax.client.protocol.AjaxResponse;
import org.jboss.portal.presentation.ajax.client.utils.DOMTools;
+import org.jboss.portal.presentation.ajax.client.utils.Logger;
/**
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
@@ -49,6 +50,9 @@
{
/** . */
+ private static final Logger log = Logger.getLogger(AjaxWindow.class);
+
+ /** . */
private Label title;
/** . */
@@ -95,7 +99,7 @@
String uri = DOM.getElementAttribute(target, "href");
// This is a get
- Window.alert("This is link click " + uri);
+ log.info("This is link click " + uri);
//
OpaqueWindowAction windowAction = new OpaqueWindowAction(uri);
@@ -130,12 +134,12 @@
if (stale != null)
{
- Window.alert("Going to refresh portlet window " + staleObject);
+ log.info("Going to refresh portlet window " + staleObject);
stale.refresh();
}
else
{
- Window.alert("No stale window found for " + staleObject);
+ log.info("No stale window found for " + staleObject);
}
}
@@ -148,7 +152,7 @@
DOM.eventPreventDefault(event);
// This is maybe a form submit
- Window.alert("This is maybe a form submit");
+ log.info("This is maybe a form submit");
}
}
});
@@ -177,7 +181,7 @@
{
public void onFailure(Throwable throwable)
{
- Window.alert("Refresh failed " + throwable.getMessage());
+ log.info("Refresh failed " + throwable.getMessage());
}
public void onSuccess(Object o)
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Appender.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -0,0 +1,34 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.ajax.client.utils;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public interface Appender
+{
+
+ void append(Level level, String category, String msg);
+
+}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Bootstrap.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Bootstrap.java 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Bootstrap.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -38,6 +38,9 @@
{
/** . */
+ private static final Logger log = Logger.getLogger(Bootstrap.class);
+
+ /** . */
private static Bootstrap instance;
public static void init()
@@ -77,7 +80,7 @@
DOM.eventPreventDefault(event);
//
- Window.alert("Element " + element + " clicked");
+ log.info("Element " + element + " clicked");
// for (Iterator i = listeners.iterator();i.hasNext();)
// {
@@ -88,7 +91,7 @@
private static void handle(Element element)
{
- Window.alert("Element " + element + " clicked");
+ log.info("Element " + element + " clicked");
// for (Iterator i = listeners.iterator();i.hasNext();)
// {
// ElementListener listener = (ElementListener)i.next();
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Level.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Level.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Level.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.ajax.client.utils;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class Level
+{
+
+ /** . */
+ public static final Level TRACE = new Level("TRACE");
+
+ /** . */
+ public static final Level DEBUG = new Level("DEBUG");
+
+ /** . */
+ public static final Level INFO = new Level("INFO");
+
+ /** . */
+ public static final Level ERROR = new Level("ERROR");
+
+ /** . */
+ private final String name;
+
+ /** . */
+ private final String toString;
+
+ private Level(String name)
+ {
+ this.name = name;
+ this.toString = "[" + name + "]";
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public String toString()
+ {
+ return toString;
+ }
+}
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/client/utils/Logger.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -0,0 +1,138 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.ajax.client.utils;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public final class Logger
+{
+
+ /** . */
+ private static final Map loggers = new HashMap();
+
+ /** . */
+ private static final Set appenders = new HashSet();
+
+ /**
+ * Returns a logger.
+ *
+ * @param clazz the logger key
+ * @return the logger
+ * @throws IllegalArgumentException if the clazz argument is null
+ */
+ public static Logger getLogger(Class clazz) throws IllegalArgumentException
+ {
+ if (clazz == null)
+ {
+ throw new IllegalArgumentException("No null clazz accepted");
+ }
+
+ //
+ String name = clazz.toString();
+
+ //
+ Logger logger = (Logger)loggers.get(name);
+
+ //
+ if (logger == null)
+ {
+ loggers.put(name, logger = new Logger(name));
+ }
+
+ //
+ return logger;
+ }
+
+ public static void registerAppender(Appender appender)
+ {
+ if (appender == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ appenders.add(appender);
+ }
+
+ /** . */
+ private final String category;
+
+ private Logger(String category)
+ {
+ this.category = category;
+ }
+
+ public String getCategory()
+ {
+ return category;
+ }
+
+ public void log(Level level, String msg)
+ {
+ if (level == null)
+ {
+ throw new IllegalArgumentException("No null level");
+ }
+ if (msg == null)
+ {
+ throw new IllegalArgumentException("No null msg");
+ }
+
+ //
+ for (Iterator i = appenders.iterator();i.hasNext();)
+ {
+ Appender appender = (Appender)i.next();
+
+ //
+ appender.append(level, category, msg);
+ }
+ }
+
+ public void info(String msg)
+ {
+ log(Level.INFO, msg);
+ }
+
+ public void error(String msg)
+ {
+ log(Level.ERROR, msg);
+ }
+
+ public void debug(String msg)
+ {
+ log(Level.DEBUG, msg);
+ }
+
+ public void trace(String msg)
+ {
+ log(Level.TRACE, msg);
+ }
+}
Modified: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/Presentation.html
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/Presentation.html 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/Presentation.html 2008-06-28 00:22:22 UTC (rev 11184)
@@ -1,7 +1,8 @@
<html>
<head>
<title>Presentation</title>
- </head>
+ <link rel="stylesheet" href="style.css" type="text/css">
+ </head>
<body bgcolor="white">
<script language="javascript" src="org.jboss.portal.presentation.ajax.Presentation.nocache.js"></script>
</body>
Added: modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css
===================================================================
--- modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css (rev 0)
+++ modules/presentation/trunk/ajax/src/main/java/org/jboss/portal/presentation/ajax/public/style.css 2008-06-28 00:22:22 UTC (rev 11184)
@@ -0,0 +1,6 @@
+.log {
+ white-space:pre;
+ font-family:Courier New;
+ font-size:12px;
+ font-weight:bold;
+}
\ No newline at end of file
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -1,95 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-import org.jboss.portal.common.NotYetImplemented;
-
-import java.io.Serializable;
-
-/**
- * An item part of the layout system.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class LayoutItem
-{
-
- /** . */
- private LayoutItemContext context;
-
- /** The structure to which this element belongs. */
- LayoutStructure structure;
-
- protected LayoutItem()
- {
- }
-
- LayoutItemContext getContext()
- {
- return context;
- }
-
- void register(LayoutItemContext context)
- {
- this.context = context;
- }
-
- void unregister()
- {
- throw new NotYetImplemented("No need for now");
- }
-
- public final LayoutStructure getStructure()
- {
- return structure;
- }
-
- public final String getId()
- {
- if (context == null)
- {
- throw new IllegalStateException();
- }
-
- //
- return context.getId();
- }
-
- /**
- * Returns the state of the layout object.
- *
- * @return the state
- */
- public abstract LayoutItemState getState();
-
- public Serializable getProperty(String name)
- {
- return getState().getProperty(name);
- }
-
- public void setProperty(String name, Serializable value)
- {
- getState().setProperty(name, value);
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -1,64 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-/**
- * The context of a layout item that is not exposed.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-class LayoutItemContext
-{
-
- /** . */
- private final LayoutStore store;
-
- /** . */
- private final String id;
-
- /** . */
- private final LayoutItem item;
-
- LayoutItemContext(LayoutStore store, String id, LayoutItem item)
- {
- this.store = store;
- this.id = id;
- this.item = item;
- }
-
- LayoutItem getObject()
- {
- return item;
- }
-
- String getId()
- {
- return id;
- }
-
- void register(LayoutItem item)
- {
- store.register(item);
- }
-}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -1,84 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-import java.io.Serializable;
-import java.util.Map;
-import java.util.HashMap;
-import java.util.Collections;
-
-/**
- * A generic state of layout items.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class LayoutItemState
-{
-
- /** The properties. */
- private final Map<String, Serializable> properties;
-
- /** . */
- private final Map<String, Serializable> immutableProperties;
-
- LayoutItemState()
- {
- this.properties = new HashMap<String, Serializable>();
- this.immutableProperties = Collections.unmodifiableMap(properties);
- }
-
- public Map<String, Serializable> getProperties()
- {
- return immutableProperties;
- }
-
- public Serializable getProperty(String name)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- return properties.get(name);
- }
-
- public void setProperty(String name, Serializable value)
- {
- if (name == null)
- {
- throw new IllegalArgumentException();
- }
-
- //
- if (value != null)
- {
- properties.put(name, value);
- }
- else
- {
- properties.remove(name);
- }
- }
-}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -83,9 +83,4 @@
// Register and contextualize
getContext().register(element);
}
-
- public LayoutElementState getState()
- {
- return state;
- }
}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java 2008-06-27 22:38:06 UTC (rev 11183)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java 2008-06-28 00:22:22 UTC (rev 11184)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class SimpleItem extends LayoutItem
-{
-
- /** . */
- private final String ref;
-
- /** . */
- private final LayoutItemState state;
-
- SimpleItem(String ref)
- {
- this.ref = ref;
- this.state = new LayoutItemState();
- }
-
- public String getRef()
- {
- return ref;
- }
-
- public LayoutItemState getState()
- {
- return state;
- }
-}
17 years, 10 months
JBoss Portal SVN: r11183 - modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-27 18:38:06 -0400 (Fri, 27 Jun 2008)
New Revision: 11183
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java
Log:
a bit of javadoc
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-27 22:29:25 UTC (rev 11182)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-27 22:38:06 UTC (rev 11183)
@@ -38,24 +38,28 @@
/** . */
private LayoutElementContext context;
+ /** The state. */
+ final LayoutElementState state;
+
/** The structure to which this element belongs. */
LayoutStructure structure;
protected LayoutElement()
{
+ this.state = new LayoutElementState();
}
- LayoutElementContext getContext()
+ final LayoutElementContext getContext()
{
return context;
}
- void register(LayoutElementContext context)
+ final void register(LayoutElementContext context)
{
this.context = context;
}
- void unregister()
+ final void unregister()
{
throw new NotYetImplemented("No need for now");
}
@@ -76,20 +80,18 @@
return context.getId();
}
- /**
- * Returns the state of the layout object.
- *
- * @return the state
- */
- public abstract LayoutElementState getState();
+ public final LayoutElementState getState()
+ {
+ return state;
+ }
- public Serializable getProperty(String name)
+ public final Serializable getProperty(String name)
{
- return getState().getProperty(name);
+ return state.getProperty(name);
}
- public void setProperty(String name, Serializable value)
+ public final void setProperty(String name, Serializable value)
{
- getState().setProperty(name, value);
+ state.setProperty(name, value);
}
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java 2008-06-27 22:29:25 UTC (rev 11182)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java 2008-06-27 22:38:06 UTC (rev 11183)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.portal.model.layout;
/**
- * The context of a layout item that is not exposed.
+ * The context of a layout element that is not exposed.
*
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java 2008-06-27 22:29:25 UTC (rev 11182)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java 2008-06-27 22:38:06 UTC (rev 11183)
@@ -28,7 +28,7 @@
import java.util.Collections;
/**
- * A generic state of layout items.
+ * A generic state of layout element.
*
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27 22:29:25 UTC (rev 11182)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27 22:38:06 UTC (rev 11183)
@@ -26,7 +26,7 @@
import java.util.ArrayList;
/**
- * The structure of a layout.
+ * The structure of a layout is a layout element that contains other layout elements.
*
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
@@ -37,13 +37,9 @@
/** The elements of the structure. */
private final Collection<LayoutElement> elements;
- /** The state. */
- final LayoutElementState state;
-
LayoutStructure()
{
this.elements = new ArrayList<LayoutElement>();
- this.state = new LayoutElementState();
}
public Collection<LayoutElement> getElements()
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java 2008-06-27 22:29:25 UTC (rev 11182)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java 2008-06-27 22:38:06 UTC (rev 11183)
@@ -30,4 +30,5 @@
*/
public final class NestedStructure extends LayoutStructure
{
+ // Nothing added yet
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java 2008-06-27 22:29:25 UTC (rev 11182)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java 2008-06-27 22:38:06 UTC (rev 11183)
@@ -32,22 +32,13 @@
/** . */
private final String ref;
- /** . */
- private final LayoutElementState state;
-
SimpleElement(String ref)
{
this.ref = ref;
- this.state = new LayoutElementState();
}
public String getRef()
{
return ref;
}
-
- public LayoutElementState getState()
- {
- return state;
- }
}
17 years, 10 months
JBoss Portal SVN: r11182 - in modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal: model and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-27 18:29:25 -0400 (Fri, 27 Jun 2008)
New Revision: 11182
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
Log:
rename *Item to *Element finally
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27 22:25:57 UTC (rev 11181)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -27,7 +27,6 @@
import org.jboss.portal.presentation.portal.model.node.WindowNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
-import org.jboss.portal.presentation.portal.model.layout.SimpleItem;
import org.jboss.portal.presentation.portal.model.content.PageContentContextImpl;
import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27 22:25:57 UTC (rev 11181)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -27,8 +27,8 @@
import org.jboss.portal.presentation.portal.model.layout.NestedStructure;
import org.jboss.portal.presentation.portal.model.layout.SimpleStructure;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
-import org.jboss.portal.presentation.portal.model.layout.LayoutItem;
-import org.jboss.portal.presentation.portal.model.layout.SimpleItem;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
+import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.node.PortalNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
@@ -67,9 +67,9 @@
private Object unwrap(Object o)
{
- if (o instanceof SimpleItem)
+ if (o instanceof SimpleElement)
{
- SimpleItem item = (SimpleItem)o;
+ SimpleElement item = (SimpleElement)o;
String objectId = item.getRef();
return nodeManager.getNode(objectId);
}
@@ -109,7 +109,7 @@
{
parent = ((PortalNode)o).getParent();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
if (o instanceof SimpleStructure)
{
@@ -117,9 +117,9 @@
String objectId = simpleStructure.getObjectRef();
parent = nodeManager.getNode(objectId);
}
- else if (o instanceof SimpleItem)
+ else if (o instanceof SimpleElement)
{
- SimpleItem item = (SimpleItem)o;
+ SimpleElement item = (SimpleElement)o;
String objectId = item.getRef();
parent = nodeManager.getNode(objectId);
}
@@ -163,9 +163,9 @@
children = ((PortalNode)o).getChildren();
}
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
- if (o instanceof SimpleItem)
+ if (o instanceof SimpleElement)
{
children = Collections.emptyList();
}
@@ -200,9 +200,9 @@
{
return "node." + ((PortalNode)o).getId();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
- return "structure." + ((LayoutItem)o).getId();
+ return "structure." + ((LayoutElement)o).getId();
}
else
{
@@ -216,13 +216,13 @@
{
return ((PortalNode)o).getType();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
if (o instanceof NestedStructure)
{
return UIPane.class;
}
- else if (o instanceof SimpleItem)
+ else if (o instanceof SimpleElement)
{
return UIWindow.class;
}
@@ -243,10 +243,10 @@
{
return ((PortalNode)o).getName();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
// no natural name, for now use id
- return ((LayoutItem)o).getId();
+ return ((LayoutElement)o).getId();
}
else
{
@@ -276,11 +276,11 @@
{
return ((PortalNode)o).getProperties();
}
- else if (o instanceof LayoutItem)
+ else if (o instanceof LayoutElement)
{
- if (o instanceof SimpleItem)
+ if (o instanceof SimpleElement)
{
- SimpleItem item = (SimpleItem)o;
+ SimpleElement item = (SimpleElement)o;
//
String windowId = item.getRef();
@@ -299,7 +299,7 @@
}
else
{
- return ((LayoutItem)o).getState().getProperties();
+ return ((LayoutElement)o).getState().getProperties();
}
}
else
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-27 22:25:57 UTC (rev 11181)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -31,7 +31,7 @@
import org.jboss.portal.presentation.portal.content.Content;
import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
-import org.jboss.portal.presentation.portal.model.layout.LayoutItem;
+import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
import org.jboss.portal.presentation.portal.model.node.PortalNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
import org.jboss.portal.presentation.portal.model.node.WindowNode;
@@ -192,7 +192,7 @@
String childName = childElt.getNamespaceURI() == null ? childElt.getTagName() : childElt.getLocalName();
//
- LayoutItem structureElement;
+ LayoutElement structureElement;
if ("window-def".equals(childName))
{
WindowNode window = importWindowDef(page, childElt);
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java (from rev 11178, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -0,0 +1,95 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+import org.jboss.portal.common.NotYetImplemented;
+
+import java.io.Serializable;
+
+/**
+ * An item part of the layout system.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public abstract class LayoutElement
+{
+
+ /** . */
+ private LayoutElementContext context;
+
+ /** The structure to which this element belongs. */
+ LayoutStructure structure;
+
+ protected LayoutElement()
+ {
+ }
+
+ LayoutElementContext getContext()
+ {
+ return context;
+ }
+
+ void register(LayoutElementContext context)
+ {
+ this.context = context;
+ }
+
+ void unregister()
+ {
+ throw new NotYetImplemented("No need for now");
+ }
+
+ public final LayoutStructure getStructure()
+ {
+ return structure;
+ }
+
+ public final String getId()
+ {
+ if (context == null)
+ {
+ throw new IllegalStateException();
+ }
+
+ //
+ return context.getId();
+ }
+
+ /**
+ * Returns the state of the layout object.
+ *
+ * @return the state
+ */
+ public abstract LayoutElementState getState();
+
+ public Serializable getProperty(String name)
+ {
+ return getState().getProperty(name);
+ }
+
+ public void setProperty(String name, Serializable value)
+ {
+ getState().setProperty(name, value);
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java (from rev 11157, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemContext.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementContext.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -0,0 +1,64 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * The context of a layout item that is not exposed.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+class LayoutElementContext
+{
+
+ /** . */
+ private final LayoutStore store;
+
+ /** . */
+ private final String id;
+
+ /** . */
+ private final LayoutElement element;
+
+ LayoutElementContext(LayoutStore store, String id, LayoutElement element)
+ {
+ this.store = store;
+ this.id = id;
+ this.element = element;
+ }
+
+ LayoutElement getObject()
+ {
+ return element;
+ }
+
+ String getId()
+ {
+ return id;
+ }
+
+ void register(LayoutElement element)
+ {
+ store.register(element);
+ }
+}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java (from rev 11157, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItemState.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElementState.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -0,0 +1,84 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+/**
+ * A generic state of layout items.
+ *
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class LayoutElementState
+{
+
+ /** The properties. */
+ private final Map<String, Serializable> properties;
+
+ /** . */
+ private final Map<String, Serializable> immutableProperties;
+
+ LayoutElementState()
+ {
+ this.properties = new HashMap<String, Serializable>();
+ this.immutableProperties = Collections.unmodifiableMap(properties);
+ }
+
+ public Map<String, Serializable> getProperties()
+ {
+ return immutableProperties;
+ }
+
+ public Serializable getProperty(String name)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ return properties.get(name);
+ }
+
+ public void setProperty(String name, Serializable value)
+ {
+ if (name == null)
+ {
+ throw new IllegalArgumentException();
+ }
+
+ //
+ if (value != null)
+ {
+ properties.put(name, value);
+ }
+ else
+ {
+ properties.remove(name);
+ }
+ }
+}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-27 22:25:57 UTC (rev 11181)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -37,10 +37,10 @@
private final AtomicLong sequence = new AtomicLong();
/** . */
- private final Map<String, LayoutItemContext> contextsById = new ConcurrentHashMap<String, LayoutItemContext>();
+ private final Map<String, LayoutElementContext> contextsById = new ConcurrentHashMap<String, LayoutElementContext>();
/** . */
- private final Map<String, LayoutItemContext> contextsByObjectRef = new ConcurrentHashMap<String, LayoutItemContext>();
+ private final Map<String, LayoutElementContext> contextsByObjectRef = new ConcurrentHashMap<String, LayoutElementContext>();
public SimpleStructure createStructure(String objectRef)
{
@@ -59,9 +59,9 @@
* @param id the layout object id
* @return a layout object
*/
- public LayoutItem getItem(String id)
+ public LayoutElement getItem(String id)
{
- LayoutItemContext context = contextsById.get(id);
+ LayoutElementContext context = contextsById.get(id);
//
return context != null ? context.getObject() : null;
@@ -73,17 +73,17 @@
* @param ref the reference
* @return a layout object
*/
- public LayoutItem findItemByRef(String ref)
+ public LayoutElement findItemByRef(String ref)
{
- LayoutItemContext context = contextsByObjectRef.get(ref);
+ LayoutElementContext context = contextsByObjectRef.get(ref);
//
return context != null ? context.getObject() : null;
}
- void register(LayoutItem item)
+ void register(LayoutElement element)
{
- LayoutItemContext context = new LayoutItemContext(this, Long.toString(sequence.getAndIncrement()), item);
+ LayoutElementContext context = new LayoutElementContext(this, Long.toString(sequence.getAndIncrement()), element);
//
contextsById.put(context.getId(), context);
@@ -92,13 +92,13 @@
String objectRef = null;
//
- if (item instanceof SimpleStructure)
+ if (element instanceof SimpleStructure)
{
- objectRef = ((SimpleStructure)item).getObjectRef();
+ objectRef = ((SimpleStructure)element).getObjectRef();
}
- else if (item instanceof SimpleItem)
+ else if (element instanceof SimpleElement)
{
- objectRef = ((SimpleItem)item).getRef();
+ objectRef = ((SimpleElement)element).getRef();
}
//
@@ -108,6 +108,6 @@
}
//
- item.register(context);
+ element.register(context);
}
}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27 22:25:57 UTC (rev 11181)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -31,29 +31,29 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public abstract class LayoutStructure extends LayoutItem
+public abstract class LayoutStructure extends LayoutElement
{
/** The elements of the structure. */
- private final Collection<LayoutItem> elements;
+ private final Collection<LayoutElement> elements;
/** The state. */
- final LayoutItemState state;
+ final LayoutElementState state;
LayoutStructure()
{
- this.elements = new ArrayList<LayoutItem>();
- this.state = new LayoutItemState();
+ this.elements = new ArrayList<LayoutElement>();
+ this.state = new LayoutElementState();
}
- public Collection<LayoutItem> getElements()
+ public Collection<LayoutElement> getElements()
{
return elements;
}
- public SimpleItem addObjectElement(String objectRef)
+ public SimpleElement addObjectElement(String objectRef)
{
- SimpleItem item = new SimpleItem(objectRef);
+ SimpleElement item = new SimpleElement(objectRef);
//
addElement(item);
@@ -73,7 +73,7 @@
return element;
}
- private void addElement(LayoutItem element)
+ private void addElement(LayoutElement element)
{
if (element.structure != null)
{
@@ -88,7 +88,7 @@
getContext().register(element);
}
- public LayoutItemState getState()
+ public LayoutElementState getState()
{
return state;
}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java (from rev 11178, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java 2008-06-27 22:29:25 UTC (rev 11182)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class SimpleElement extends LayoutElement
+{
+
+ /** . */
+ private final String ref;
+
+ /** . */
+ private final LayoutElementState state;
+
+ SimpleElement(String ref)
+ {
+ this.ref = ref;
+ this.state = new LayoutElementState();
+ }
+
+ public String getRef()
+ {
+ return ref;
+ }
+
+ public LayoutElementState getState()
+ {
+ return state;
+ }
+}
17 years, 10 months
JBoss Portal SVN: r11181 - in modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal: model and 1 other directory.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-27 18:25:57 -0400 (Fri, 27 Jun 2008)
New Revision: 11181
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
Log:
present SimpleItem -> WindowNode
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27 22:23:39 UTC (rev 11180)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27 22:25:57 UTC (rev 11181)
@@ -90,10 +90,8 @@
public ContentFragment renderWindow(PresentationClient client, String windowId) throws PresentationServerException
{
- SimpleItem item = (SimpleItem)structuralAdapter.getNode(windowId);
+ WindowNode window = (WindowNode)structuralAdapter.getNode(windowId);
- WindowNode window = (WindowNode)portalNodeManager.getNode(item.getRef());
-
Content content = window.getContent();
String contentType = content.getType();
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27 22:23:39 UTC (rev 11180)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27 22:25:57 UTC (rev 11181)
@@ -43,6 +43,7 @@
import java.util.Map;
import java.util.HashMap;
import java.util.Collections;
+import java.util.ArrayList;
import java.io.Serializable;
/**
@@ -64,6 +65,20 @@
this.layoutStore = layoutStore;
}
+ private Object unwrap(Object o)
+ {
+ if (o instanceof SimpleItem)
+ {
+ SimpleItem item = (SimpleItem)o;
+ String objectId = item.getRef();
+ return nodeManager.getNode(objectId);
+ }
+ else
+ {
+ return o;
+ }
+ }
+
public String getRootId()
{
return "node." + nodeManager.getRoot().getId();
@@ -87,9 +102,12 @@
public Object getParent(Object o)
{
+ Object parent;
+
+ //
if (o instanceof PortalNode)
{
- return ((PortalNode)o).getParent();
+ parent = ((PortalNode)o).getParent();
}
else if (o instanceof LayoutItem)
{
@@ -97,17 +115,17 @@
{
SimpleStructure simpleStructure = (SimpleStructure)o;
String objectId = simpleStructure.getObjectRef();
- return nodeManager.getNode(objectId);
+ parent = nodeManager.getNode(objectId);
}
else if (o instanceof SimpleItem)
{
SimpleItem item = (SimpleItem)o;
String objectId = item.getRef();
- return nodeManager.getNode(objectId);
+ parent = nodeManager.getNode(objectId);
}
else if (o instanceof NestedStructure)
{
- return ((NestedStructure)o).getStructure();
+ parent = ((NestedStructure)o).getStructure();
}
else
{
@@ -118,10 +136,19 @@
{
throw new NotYetImplemented();
}
+
+ //
+ parent = unwrap(parent);
+
+ //
+ return parent;
}
public Collection<?> getChildren(Object o)
{
+ Collection<?> children;
+
+ //
if (o instanceof PortalNode)
{
if (o instanceof PageNode)
@@ -129,22 +156,22 @@
LayoutStructure layoutStructure = (LayoutStructure)layoutStore.findItemByRef(((PageNode)o).getId());
//
- return layoutStructure.getElements();
+ children = layoutStructure.getElements();
}
else
{
- return ((PortalNode)o).getChildren();
+ children = ((PortalNode)o).getChildren();
}
}
else if (o instanceof LayoutItem)
{
if (o instanceof SimpleItem)
{
- return Collections.emptyList();
+ children = Collections.emptyList();
}
else if (o instanceof LayoutStructure)
{
- return ((LayoutStructure)o).getElements();
+ children = ((LayoutStructure)o).getElements();
}
else
{
@@ -155,6 +182,16 @@
{
throw new NotYetImplemented();
}
+
+ //
+ Collection<Object> tmp = new ArrayList<Object>(children.size());
+ for (Object child : children)
+ {
+ tmp.add(unwrap(child));
+ }
+
+ //
+ return tmp;
}
public String getId(Object o)
17 years, 10 months
JBoss Portal SVN: r11180 - in branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal: wsrp and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-06-27 18:23:39 -0400 (Fri, 27 Jun 2008)
New Revision: 11180
Modified:
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPRenderURL.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java
branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
Log:
- JBPORTAL-2048: Allow extra URL parameters in relaxed validation mode. Added appropriate tests.
- Some generification and documentation.
- Removed unused WSRPPortletURL(Map) constructor.
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2008-06-27 22:23:07 UTC (rev 11179)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2008-06-27 22:23:39 UTC (rev 11180)
@@ -41,10 +41,17 @@
*/
public class WSRPPortletURLTestCase extends TestCase
{
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ WSRPPortletURL.setStrict(true);
+ }
+
public void testResource()
{
String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif" +
- "&wsrp-requiresRewrite=true/wsrp_rewrite";
+ "&wsrp-requiresRewrite=true/wsrp_rewrite";
WSRPPortletURL url = WSRPPortletURL.create(expected);
assertEquals("http://test.com/images/test.gif", url.toString());
@@ -54,7 +61,7 @@
public void testSecureInteraction()
{
String expected = "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-secureURL=true" +
- "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
+ "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
WSRPPortletURL url = WSRPPortletURL.create(expected);
assertTrue(url instanceof WSRPActionURL);
@@ -94,6 +101,35 @@
checkInvalidURL(invalid, message, "foo");
}
+ /** Relax validation and test that we now accept normally invalid URLs. */
+ public void testExtraParametersRelaxedValidation()
+ {
+ WSRPPortletURL.setStrict(false);
+
+ String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+
+ WSRPPortletURL url = WSRPPortletURL.create(validInRelaxedMode);
+ assertTrue(url instanceof WSRPRenderURL);
+ assertTrue(url.toString().contains("foo=bar"));
+
+ validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render/wsrp_rewrite&foo=bar";
+ url = WSRPPortletURL.create(validInRelaxedMode);
+ assertTrue(url instanceof WSRPRenderURL);
+ assertTrue(url.toString().endsWith("foo=bar"));
+
+ String stillInvalid = "wsrp_rewrite?wsrp-urlType=render&foo=bar";
+ checkInvalidURL(stillInvalid, "Should have detected missing end token", WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+
+ public void testExtraParameters()
+ {
+ String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+ checkInvalidURL(validInRelaxedMode, "Should have detected invalid parameter: ", "foo");
+
+ validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render/wsrp_rewrite&foo=bar";
+ checkInvalidURL(validInRelaxedMode, "Should have detected URL doesn't end with end token", WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+
public void testInvalidMode()
{
String message = "Should have detected invalid mode: ";
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java 2008-06-27 22:23:07 UTC (rev 11179)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java 2008-06-27 22:23:39 UTC (rev 11180)
@@ -47,31 +47,28 @@
this.interactionState = interactionState;
}
- protected WSRPActionURL(Map params)
- {
- super(params);
- }
-
-
protected WSRPActionURL()
{
}
- protected void setParams(Map params)
+ @Override
+ protected void dealWithSpecificParams(Map<String, String> params)
{
- super.setParams(params);
-
+ super.dealWithSpecificParams(params);
+
String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.INTERACTION_STATE);
if (paramValue != null)
{
interactionState = new OpaqueStateString(paramValue);
+ params.remove(WSRPRewritingConstants.INTERACTION_STATE);
}
paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.NAVIGATIONAL_STATE);
if (paramValue != null)
{
navigationalState = new OpaqueStateString(paramValue);
- }
+ params.remove(WSRPRewritingConstants.NAVIGATIONAL_STATE);
+ }
}
protected String getURLType()
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2008-06-27 22:23:07 UTC (rev 11179)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2008-06-27 22:23:39 UTC (rev 11180)
@@ -26,11 +26,13 @@
import org.jboss.logging.Logger;
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
+import org.jboss.portal.common.NotYetImplemented;
import org.jboss.portal.common.text.FastURLDecoder;
import org.jboss.portal.common.util.Tools;
import org.jboss.portal.portlet.ActionURL;
import org.jboss.portal.portlet.PortletURL;
import org.jboss.portal.portlet.RenderURL;
+import org.jboss.portal.portlet.ResourceURL;
import org.jboss.portal.portlet.StateString;
import java.util.Collections;
@@ -56,6 +58,21 @@
private Mode mode;
private WindowState windowState;
+ /** Are we using strict rewriting parameters validation mode? */
+ private static boolean strict = true;
+
+ /** Holds extra parameters if we are in relaxed validation mode */
+ private Map<String, String> extraParams;
+
+ /** Remember position of extra parameters wrt end token */
+ private boolean extraParamsAfterEndToken = false;
+
+ public static void setStrict(boolean strict)
+ {
+ WSRPPortletURL.strict = strict;
+ log.debug("Using " + (strict ? "strict" : "lenient") + " rewriting parameters validation mode.");
+ }
+
public static WSRPPortletURL create(PortletURL portletURL, boolean secure)
{
if (portletURL == null)
@@ -66,22 +83,37 @@
Mode mode = portletURL.getMode();
WindowState windowState = portletURL.getWindowState();
+ WSRPPortletURL url;
if (portletURL instanceof ActionURL)
{
StateString interactionState = ((ActionURL)portletURL).getInteractionState();
StateString navigationalState = ((ActionURL)portletURL).getNavigationalState();
- return new WSRPActionURL(mode, windowState, secure, navigationalState, interactionState);
+ url = new WSRPActionURL(mode, windowState, secure, navigationalState, interactionState);
}
else if (portletURL instanceof RenderURL)
{
StateString navigationalState = ((RenderURL)portletURL).getNavigationalState();
- return new WSRPRenderURL(mode, windowState, secure, navigationalState);
+ url = new WSRPRenderURL(mode, windowState, secure, navigationalState);
}
- else /*if(portletURL instanceof ResourceURL)*/
+ else if (portletURL instanceof ResourceURL)
{
- // return new WSRPResourceURL(mode, windowState, secure, ((ResourceURL) portletURL).getResourceURL(), false);
+// url = new WSRPResourceURL(mode, windowState, secure, ((ResourceURL) portletURL).getResourceURL(), false);
+ // todo: implement!
+ throw new NotYetImplemented("ResourceURL support not quite yet implemented!");
+ }
+ else
+ {
throw new IllegalArgumentException("Unknown PortletURL type: " + portletURL.getClass().getName());
}
+
+ // if we're in relaxed mode, we need to deal with extra params as well
+ if (strict && portletURL instanceof WSRPPortletURL)
+ {
+ WSRPPortletURL other = (WSRPPortletURL)portletURL;
+ url.setParams(other.extraParams);
+ }
+
+ return url;
}
public static WSRPPortletURL create(String encodedURL, Set<String> customModes, Set<String> customWindowStates)
@@ -94,21 +126,45 @@
}
String originalURL = encodedURL;
+ boolean extraAfterEnd = false;
- // URL needs to start wsrp_rewrite? and end with /wsrp_rewrite
+ // URL needs to start wsrp_rewrite? and end with /wsrp_rewrite in strict validation mode
if (!encodedURL.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
{
throw new IllegalArgumentException(encodedURL + " does not start with " + WSRPRewritingConstants.BEGIN_WSRP_REWRITE);
}
if (!encodedURL.endsWith(WSRPRewritingConstants.END_WSRP_REWRITE))
{
- throw new IllegalArgumentException(encodedURL + " does not end with " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ if (strict)
+ {
+ throw new IllegalArgumentException(encodedURL + " does not end with " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+ else
+ {
+ // first remove prefix only (as suffix is not at the end of the string)
+ encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH);
+
+ // find end token and extract it
+ int endTokenIndex = encodedURL.indexOf('/');
+ if(endTokenIndex < 0)
+ {
+ throw new IllegalArgumentException(originalURL + " does not contain " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+
+ encodedURL = encodedURL.substring(0, endTokenIndex)
+ + encodedURL.substring(endTokenIndex + WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
+
+ // remember that we should position the extra params after the end token
+ extraAfterEnd = true;
+ }
}
+ else
+ {
+ // remove prefix and suffix
+ encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH,
+ encodedURL.length() - WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
+ }
- // remove prefix and suffix
- encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH,
- encodedURL.length() - WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
-
// next param should be the url type
if (!encodedURL.startsWith(WSRPRewritingConstants.URL_TYPE_NAME + EQUALS))
{
@@ -145,7 +201,7 @@
}
// other parameters
- Map params = null;
+ Map<String, String> params = null;
int urlTypeLength = urlType.length();
if (encodedURL.length() > urlTypeLength)
{
@@ -158,10 +214,11 @@
else if (WSRPRewritingConstants.URL_TYPE_RESOURCE.equals(urlType))
{
throw new IllegalArgumentException("Both the 'wsrp-url' and 'wsrp-requiresRewrite' parameters MUST also be specified for resource URL '"
- + originalURL + "'");
+ + originalURL + "'");
}
url.setParams(params);
+ url.setExtraParamsAfterEndToken(extraAfterEnd);
return url;
}
@@ -175,7 +232,8 @@
* <code>wsrp_rewrite?wsrp-urlType=render&amp;wsrp-mode=help&amp;wsrp-windowState=maximized/wsrp_rewrite</code></li>
* </ul>
*
- * @param encodedURL
+ * @param encodedURL a String representation of the URL to create
+ * @return an appropriate WSRPPortletURL as built from parsing the specified String
*/
public static WSRPPortletURL create(String encodedURL)
{
@@ -189,40 +247,57 @@
this.secure = secure;
}
- protected WSRPPortletURL(Map params)
+ protected WSRPPortletURL()
{
- // populate values
- setParams(params);
}
- protected WSRPPortletURL()
+ protected final void setParams(Map<String, String> params)
{
+ // First extract specific parameters and remove them from the param map...
+ dealWithSpecificParams(params);
+
+ // ... then deal with extra params if in relaxed mode
+ if (!strict)
+ {
+ extraParams = new HashMap<String, String>();
+ extraParams.putAll(params);
+ }
}
- protected void setParams(Map params)
+ /**
+ * Deal with specific parameters first so that we can remove them before dealing with extra params. Sub-classes
+ * override to provide support for their specific parameters.
+ *
+ * @param params name-value map of the URL parameters
+ */
+ protected void dealWithSpecificParams(Map<String, String> params)
{
+ // mode
String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.MODE);
if (paramValue != null)
{
mode = WSRPUtils.getJSR168PortletModeFromWSRPName(paramValue);
+ params.remove(WSRPRewritingConstants.MODE);
}
- //
+ // window state
paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.WINDOW_STATE);
if (paramValue != null)
{
windowState = WSRPUtils.getJSR168WindowStateFromWSRPName(paramValue);
+ params.remove(WSRPRewritingConstants.WINDOW_STATE);
}
- //
+ // secure
paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.SECURE_URL);
if (paramValue != null)
{
secure = Boolean.valueOf(paramValue);
+ params.remove(WSRPRewritingConstants.SECURE_URL);
}
}
- public String getRawParameterValueFor(Map params, String parameterName)
+ protected String getRawParameterValueFor(Map params, String parameterName)
{
if (params != null)
{
@@ -257,7 +332,7 @@
//
sb.append(WSRPRewritingConstants.BEGIN_WSRP_REWRITE).append(WSRPRewritingConstants.URL_TYPE_NAME)
- .append(EQUALS).append(getURLType());
+ .append(EQUALS).append(getURLType());
//
if (secure)
@@ -277,13 +352,44 @@
createURLParameter(sb, WSRPRewritingConstants.WINDOW_STATE, windowState.toString());
}
- // fix-me: not sure how to deal with authenticated
+ // todo: not sure how to deal with authenticated
//
appendEnd(sb);
- //
- sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ // Finish the URL
+ if (strict)
+ {
+ sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+ else
+ {
+ // we're in relaxed mode so we need to deal with extra params if they exist
+ StringBuffer extras = null;
+ if (extraParams != null && !extraParams.isEmpty())
+ {
+ extras = new StringBuffer();
+ for (Map.Entry<String, String> entry : extraParams.entrySet())
+ {
+ createURLParameter(extras, entry.getKey(), entry.getValue());
+ }
+ }
+
+ // if we had extra params, we need to figure out where thwy should be positioned wrt end token
+ if (extras != null)
+ {
+ if (extraParamsAfterEndToken)
+ {
+ sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ sb.append(extras);
+ }
+ else
+ {
+ sb.append(extras);
+ sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+ }
+ }
return sb.toString();
}
@@ -297,7 +403,7 @@
}
}
- private static Map extractParams(String encodedURL, String originalURL, Set<String> customModes, Set<String> customWindowStates)
+ private static Map<String, String> extractParams(String encodedURL, String originalURL, Set<String> customModes, Set<String> customWindowStates)
{
Map<String, String> params = new HashMap<String, String>();
boolean finished = false;
@@ -324,7 +430,7 @@
// extract param name
String name = param.substring(0, equalsIndex);
- if (!name.startsWith("wsrp-"))
+ if (strict && !name.startsWith("wsrp-"))
{
throw new IllegalArgumentException("Invalid parameter name: '" + name + "'");
}
@@ -356,7 +462,7 @@
value = FastURLDecoder.getUTF8Instance().encode(value);
// Check if value is a standard one
- boolean standard = false;
+ boolean standard;
if (mode)
{
standard = WSRPUtils.isDefaultWSRPMode(value);
@@ -383,4 +489,8 @@
return value;
}
+ private void setExtraParamsAfterEndToken(boolean extraParamsAfterEndToken)
+ {
+ this.extraParamsAfterEndToken = extraParamsAfterEndToken;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPRenderURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPRenderURL.java 2008-06-27 22:23:07 UTC (rev 11179)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPRenderURL.java 2008-06-27 22:23:39 UTC (rev 11180)
@@ -45,20 +45,15 @@
this.navigationalState = navigationalState;
}
- protected WSRPRenderURL(Map params)
- {
- super(params);
- }
-
-
protected WSRPRenderURL()
{
}
- protected void setParams(Map params)
+ @Override
+ protected void dealWithSpecificParams(Map<String, String> params)
{
- super.setParams(params);
-
+ super.dealWithSpecificParams(params);
+
String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.NAVIGATIONAL_STATE);
if (paramValue != null)
{
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java 2008-06-27 22:23:07 UTC (rev 11179)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java 2008-06-27 22:23:39 UTC (rev 11180)
@@ -72,11 +72,6 @@
this.requiresRewrite = requiresRewrite;
}
- public WSRPResourceURL(Map params)
- {
- super(params);
- }
-
public WSRPResourceURL()
{
super();
@@ -100,11 +95,11 @@
}
}
-
- protected void setParams(Map params)
+ @Override
+ protected void dealWithSpecificParams(Map<String, String> params)
{
- super.setParams(params);
-
+ super.dealWithSpecificParams(params);
+
String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE);
if (paramValue != null)
{
Modified: branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
===================================================================
--- branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-06-27 22:23:07 UTC (rev 11179)
+++ branches/JBoss_Portal_Branch_2_7/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-06-27 22:23:39 UTC (rev 11180)
@@ -38,6 +38,7 @@
import org.jboss.portal.wsrp.ResponseDebugFactory;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPExceptionFactory;
+import org.jboss.portal.wsrp.WSRPPortletURL;
import org.jboss.portal.wsrp.WSRPProducer;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
@@ -535,5 +536,6 @@
{
RegistrationUtils.setStrict(strictMode);
WSRPUtils.setStrict(strictMode);
+ WSRPPortletURL.setStrict(strictMode);
}
}
17 years, 10 months
JBoss Portal SVN: r11179 - in branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal: wsrp and 1 other directories.
by portal-commits@lists.jboss.org
Author: chris.laprun(a)jboss.com
Date: 2008-06-27 18:23:07 -0400 (Fri, 27 Jun 2008)
New Revision: 11179
Modified:
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPRenderURL.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java
branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java
Log:
- JBPORTAL-2048: Allow extra URL parameters in relaxed validation mode. Added appropriate tests.
- Some generification and documentation.
- Removed unused WSRPPortletURL(Map) constructor.
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2008-06-27 22:14:10 UTC (rev 11178)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/test/wsrp/other/WSRPPortletURLTestCase.java 2008-06-27 22:23:07 UTC (rev 11179)
@@ -41,10 +41,17 @@
*/
public class WSRPPortletURLTestCase extends TestCase
{
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ WSRPPortletURL.setStrict(true);
+ }
+
public void testResource()
{
String expected = "wsrp_rewrite?wsrp-urlType=resource&wsrp-url=http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif" +
- "&wsrp-requiresRewrite=true/wsrp_rewrite";
+ "&wsrp-requiresRewrite=true/wsrp_rewrite";
WSRPPortletURL url = WSRPPortletURL.create(expected);
assertEquals("http://test.com/images/test.gif", url.toString());
@@ -54,7 +61,7 @@
public void testSecureInteraction()
{
String expected = "wsrp_rewrite?wsrp-urlType=blockingAction&wsrp-secureURL=true" +
- "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
+ "&wsrp-navigationalState=a8h4K5JD9&wsrp-interactionState=fg4h923mdk/wsrp_rewrite";
WSRPPortletURL url = WSRPPortletURL.create(expected);
assertTrue(url instanceof WSRPActionURL);
@@ -94,6 +101,35 @@
checkInvalidURL(invalid, message, "foo");
}
+ /** Relax validation and test that we now accept normally invalid URLs. */
+ public void testExtraParametersRelaxedValidation()
+ {
+ WSRPPortletURL.setStrict(false);
+
+ String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+
+ WSRPPortletURL url = WSRPPortletURL.create(validInRelaxedMode);
+ assertTrue(url instanceof WSRPRenderURL);
+ assertTrue(url.toString().contains("foo=bar"));
+
+ validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render/wsrp_rewrite&foo=bar";
+ url = WSRPPortletURL.create(validInRelaxedMode);
+ assertTrue(url instanceof WSRPRenderURL);
+ assertTrue(url.toString().endsWith("foo=bar"));
+
+ String stillInvalid = "wsrp_rewrite?wsrp-urlType=render&foo=bar";
+ checkInvalidURL(stillInvalid, "Should have detected missing end token", WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+
+ public void testExtraParameters()
+ {
+ String validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render&foo=bar/wsrp_rewrite";
+ checkInvalidURL(validInRelaxedMode, "Should have detected invalid parameter: ", "foo");
+
+ validInRelaxedMode = "wsrp_rewrite?wsrp-urlType=render/wsrp_rewrite&foo=bar";
+ checkInvalidURL(validInRelaxedMode, "Should have detected URL doesn't end with end token", WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+
public void testInvalidMode()
{
String message = "Should have detected invalid mode: ";
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java 2008-06-27 22:14:10 UTC (rev 11178)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPActionURL.java 2008-06-27 22:23:07 UTC (rev 11179)
@@ -25,6 +25,7 @@
import org.jboss.portal.Mode;
import org.jboss.portal.WindowState;
import org.jboss.portal.portlet.ActionURL;
+import org.jboss.portal.portlet.OpaqueStateString;
import org.jboss.portal.portlet.StateString;
import java.util.Map;
@@ -46,30 +47,27 @@
this.interactionState = interactionState;
}
- protected WSRPActionURL(Map params)
- {
- super(params);
- }
-
-
protected WSRPActionURL()
{
}
- protected void setParams(Map params)
+ @Override
+ protected void dealWithSpecificParams(Map<String, String> params)
{
- super.setParams(params);
+ super.dealWithSpecificParams(params);
String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.INTERACTION_STATE);
if (paramValue != null)
{
- interactionState = StateString.createFrom(paramValue);
+ interactionState = new OpaqueStateString(paramValue);
+ params.remove(WSRPRewritingConstants.INTERACTION_STATE);
}
paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.NAVIGATIONAL_STATE);
if (paramValue != null)
{
- navigationalState = StateString.createFrom(paramValue);
+ navigationalState = new OpaqueStateString(paramValue);
+ params.remove(WSRPRewritingConstants.NAVIGATIONAL_STATE);
}
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2008-06-27 22:14:10 UTC (rev 11178)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPPortletURL.java 2008-06-27 22:23:07 UTC (rev 11179)
@@ -56,6 +56,21 @@
private Mode mode;
private WindowState windowState;
+ /** Are we using strict rewriting parameters validation mode? */
+ private static boolean strict = true;
+
+ /** Holds extra parameters if we are in relaxed validation mode */
+ private Map<String, String> extraParams;
+
+ /** Remember position of extra parameters wrt end token */
+ private boolean extraParamsAfterEndToken = false;
+
+ public static void setStrict(boolean strict)
+ {
+ WSRPPortletURL.strict = strict;
+ log.debug("Using " + (strict ? "strict" : "lenient") + " rewriting parameters validation mode.");
+ }
+
public static WSRPPortletURL create(PortletURL portletURL, boolean secure)
{
if (portletURL == null)
@@ -66,22 +81,31 @@
Mode mode = portletURL.getMode();
WindowState windowState = portletURL.getWindowState();
+ WSRPPortletURL url;
if (portletURL instanceof ActionURL)
{
StateString interactionState = ((ActionURL)portletURL).getInteractionState();
StateString navigationalState = ((ActionURL)portletURL).getNavigationalState();
- return new WSRPActionURL(mode, windowState, secure, navigationalState, interactionState);
+ url = new WSRPActionURL(mode, windowState, secure, navigationalState, interactionState);
}
else if (portletURL instanceof RenderURL)
{
StateString navigationalState = ((RenderURL)portletURL).getNavigationalState();
- return new WSRPRenderURL(mode, windowState, secure, navigationalState);
+ url = new WSRPRenderURL(mode, windowState, secure, navigationalState);
}
- else /*if(portletURL instanceof ResourceURL)*/
+ else
{
- // return new WSRPResourceURL(mode, windowState, secure, ((ResourceURL) portletURL).getResourceURL(), false);
throw new IllegalArgumentException("Unknown PortletURL type: " + portletURL.getClass().getName());
}
+
+ // if we're in relaxed mode, we need to deal with extra params as well
+ if (strict && portletURL instanceof WSRPPortletURL)
+ {
+ WSRPPortletURL other = (WSRPPortletURL)portletURL;
+ url.setParams(other.extraParams);
+ }
+
+ return url;
}
public static WSRPPortletURL create(String encodedURL, Set<String> customModes, Set<String> customWindowStates)
@@ -94,21 +118,45 @@
}
String originalURL = encodedURL;
+ boolean extraAfterEnd = false;
- // URL needs to start wsrp_rewrite? and end with /wsrp_rewrite
+ // URL needs to start wsrp_rewrite? and end with /wsrp_rewrite in strict validation mode
if (!encodedURL.startsWith(WSRPRewritingConstants.BEGIN_WSRP_REWRITE))
{
throw new IllegalArgumentException(encodedURL + " does not start with " + WSRPRewritingConstants.BEGIN_WSRP_REWRITE);
}
if (!encodedURL.endsWith(WSRPRewritingConstants.END_WSRP_REWRITE))
{
- throw new IllegalArgumentException(encodedURL + " does not end with " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ if (strict)
+ {
+ throw new IllegalArgumentException(encodedURL + " does not end with " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+ else
+ {
+ // first remove prefix only (as suffix is not at the end of the string)
+ encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH);
+
+ // find end token and extract it
+ int endTokenIndex = encodedURL.indexOf('/');
+ if(endTokenIndex < 0)
+ {
+ throw new IllegalArgumentException(originalURL + " does not contain " + WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+
+ encodedURL = encodedURL.substring(0, endTokenIndex)
+ + encodedURL.substring(endTokenIndex + WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
+
+ // remember that we should position the extra params after the end token
+ extraAfterEnd = true;
+ }
}
+ else
+ {
+ // remove prefix and suffix
+ encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH,
+ encodedURL.length() - WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
+ }
- // remove prefix and suffix
- encodedURL = encodedURL.substring(WSRPRewritingConstants.WSRP_REWRITE_PREFIX_LENGTH,
- encodedURL.length() - WSRPRewritingConstants.WSRP_REWRITE_SUFFIX_LENGTH);
-
// next param should be the url type
if (!encodedURL.startsWith(WSRPRewritingConstants.URL_TYPE_NAME + EQUALS))
{
@@ -145,7 +193,7 @@
}
// other parameters
- Map params = null;
+ Map<String, String> params = null;
int urlTypeLength = urlType.length();
if (encodedURL.length() > urlTypeLength)
{
@@ -158,10 +206,11 @@
else if (WSRPRewritingConstants.URL_TYPE_RESOURCE.equals(urlType))
{
throw new IllegalArgumentException("Both the 'wsrp-url' and 'wsrp-requiresRewrite' parameters MUST also be specified for resource URL '"
- + originalURL + "'");
+ + originalURL + "'");
}
url.setParams(params);
+ url.setExtraParamsAfterEndToken(extraAfterEnd);
return url;
}
@@ -175,7 +224,8 @@
* <code>wsrp_rewrite?wsrp-urlType=render&amp;wsrp-mode=help&amp;wsrp-windowState=maximized/wsrp_rewrite</code></li>
* </ul>
*
- * @param encodedURL
+ * @param encodedURL a String representation of the URL to create
+ * @return an appropriate WSRPPortletURL as built from parsing the specified String
*/
public static WSRPPortletURL create(String encodedURL)
{
@@ -189,40 +239,57 @@
this.secure = secure;
}
- protected WSRPPortletURL(Map params)
+ protected WSRPPortletURL()
{
- // populate values
- setParams(params);
}
- protected WSRPPortletURL()
+ protected final void setParams(Map<String, String> params)
{
+ // First extract specific parameters and remove them from the param map...
+ dealWithSpecificParams(params);
+
+ // ... then deal with extra params if in relaxed mode
+ if (!strict)
+ {
+ extraParams = new HashMap<String, String>();
+ extraParams.putAll(params);
+ }
}
- protected void setParams(Map params)
+ /**
+ * Deal with specific parameters first so that we can remove them before dealing with extra params. Sub-classes
+ * override to provide support for their specific parameters.
+ *
+ * @param params name-value map of the URL parameters
+ */
+ protected void dealWithSpecificParams(Map<String, String> params)
{
+ // mode
String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.MODE);
if (paramValue != null)
{
mode = WSRPUtils.getJSR168PortletModeFromWSRPName(paramValue);
+ params.remove(WSRPRewritingConstants.MODE);
}
- //
+ // window state
paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.WINDOW_STATE);
if (paramValue != null)
{
windowState = WSRPUtils.getJSR168WindowStateFromWSRPName(paramValue);
+ params.remove(WSRPRewritingConstants.WINDOW_STATE);
}
- //
+ // secure
paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.SECURE_URL);
if (paramValue != null)
{
secure = Boolean.valueOf(paramValue);
+ params.remove(WSRPRewritingConstants.SECURE_URL);
}
}
- public String getRawParameterValueFor(Map params, String parameterName)
+ protected String getRawParameterValueFor(Map params, String parameterName)
{
if (params != null)
{
@@ -257,7 +324,7 @@
//
sb.append(WSRPRewritingConstants.BEGIN_WSRP_REWRITE).append(WSRPRewritingConstants.URL_TYPE_NAME)
- .append(EQUALS).append(getURLType());
+ .append(EQUALS).append(getURLType());
//
if (secure)
@@ -277,13 +344,44 @@
createURLParameter(sb, WSRPRewritingConstants.WINDOW_STATE, windowState.toString());
}
- // fix-me: not sure how to deal with authenticated
+ // todo: not sure how to deal with authenticated
//
appendEnd(sb);
- //
- sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ // Finish the URL
+ if (strict)
+ {
+ sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+ else
+ {
+ // we're in relaxed mode so we need to deal with extra params if they exist
+ StringBuffer extras = null;
+ if (extraParams != null && !extraParams.isEmpty())
+ {
+ extras = new StringBuffer();
+ for (Map.Entry<String, String> entry : extraParams.entrySet())
+ {
+ createURLParameter(extras, entry.getKey(), entry.getValue());
+ }
+ }
+
+ // if we had extra params, we need to figure out where thwy should be positioned wrt end token
+ if (extras != null)
+ {
+ if (extraParamsAfterEndToken)
+ {
+ sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ sb.append(extras);
+ }
+ else
+ {
+ sb.append(extras);
+ sb.append(WSRPRewritingConstants.END_WSRP_REWRITE);
+ }
+ }
+ }
return sb.toString();
}
@@ -297,7 +395,7 @@
}
}
- private static Map extractParams(String encodedURL, String originalURL, Set<String> customModes, Set<String> customWindowStates)
+ private static Map<String, String> extractParams(String encodedURL, String originalURL, Set<String> customModes, Set<String> customWindowStates)
{
Map<String, String> params = new HashMap<String, String>();
boolean finished = false;
@@ -324,7 +422,7 @@
// extract param name
String name = param.substring(0, equalsIndex);
- if (!name.startsWith("wsrp-"))
+ if (strict && !name.startsWith("wsrp-"))
{
throw new IllegalArgumentException("Invalid parameter name: '" + name + "'");
}
@@ -356,7 +454,7 @@
value = FastURLDecoder.getUTF8Instance().encode(value);
// Check if value is a standard one
- boolean standard = false;
+ boolean standard;
if (mode)
{
standard = WSRPUtils.isDefaultWSRPMode(value);
@@ -383,4 +481,8 @@
return value;
}
+ private void setExtraParamsAfterEndToken(boolean extraParamsAfterEndToken)
+ {
+ this.extraParamsAfterEndToken = extraParamsAfterEndToken;
+ }
}
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPRenderURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPRenderURL.java 2008-06-27 22:14:10 UTC (rev 11178)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPRenderURL.java 2008-06-27 22:23:07 UTC (rev 11179)
@@ -44,20 +44,15 @@
this.navigationalState = navigationalState;
}
- protected WSRPRenderURL(Map params)
- {
- super(params);
- }
-
-
protected WSRPRenderURL()
{
}
- protected void setParams(Map params)
+ @Override
+ protected void dealWithSpecificParams(Map<String, String> params)
{
- super.setParams(params);
-
+ super.dealWithSpecificParams(params);
+
String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.NAVIGATIONAL_STATE);
if (paramValue != null)
{
Modified: branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java
===================================================================
--- branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java 2008-06-27 22:14:10 UTC (rev 11178)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/WSRPResourceURL.java 2008-06-27 22:23:07 UTC (rev 11179)
@@ -72,11 +72,6 @@
this.requiresRewrite = requiresRewrite;
}
- public WSRPResourceURL(Map params)
- {
- super(params);
- }
-
public WSRPResourceURL()
{
super();
@@ -100,11 +95,11 @@
}
}
-
- protected void setParams(Map params)
+ @Override
+ protected void dealWithSpecificParams(Map<String, String> params)
{
- super.setParams(params);
-
+ super.dealWithSpecificParams(params);
+
String paramValue = getRawParameterValueFor(params, WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE);
if (paramValue != null)
{
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 2008-06-27 22:14:10 UTC (rev 11178)
+++ branches/JBoss_Portal_Branch_2_6/wsrp/src/main/org/jboss/portal/wsrp/producer/WSRPProducerImpl.java 2008-06-27 22:23:07 UTC (rev 11179)
@@ -37,6 +37,7 @@
import org.jboss.portal.wsrp.ResponseDebugFactory;
import org.jboss.portal.wsrp.WSRPConstants;
import org.jboss.portal.wsrp.WSRPExceptionFactory;
+import org.jboss.portal.wsrp.WSRPPortletURL;
import org.jboss.portal.wsrp.WSRPProducer;
import org.jboss.portal.wsrp.WSRPUtils;
import org.jboss.portal.wsrp.core.AccessDeniedFault;
@@ -274,6 +275,7 @@
{
RegistrationUtils.setStrict(strict);
WSRPUtils.setStrict(strict);
+ WSRPPortletURL.setStrict(strict);
}
protected void startService() throws Exception
17 years, 10 months
JBoss Portal SVN: r11178 - in modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal: model and 1 other directories.
by portal-commits@lists.jboss.org
Author: julien(a)jboss.com
Date: 2008-06-27 18:14:10 -0400 (Fri, 27 Jun 2008)
New Revision: 11178
Added:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java
Removed:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java
Modified:
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
Log:
simplify the layout backend structure
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/PresentationServerImpl.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -27,7 +27,7 @@
import org.jboss.portal.presentation.portal.model.node.WindowNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
-import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
+import org.jboss.portal.presentation.portal.model.layout.SimpleItem;
import org.jboss.portal.presentation.portal.model.content.PageContentContextImpl;
import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
import org.jboss.portal.presentation.portal.content.protocol.ContentAction;
@@ -90,9 +90,9 @@
public ContentFragment renderWindow(PresentationClient client, String windowId) throws PresentationServerException
{
- SimpleElement element = (SimpleElement)structuralAdapter.getNode(windowId);
+ SimpleItem item = (SimpleItem)structuralAdapter.getNode(windowId);
- WindowNode window = (WindowNode)portalNodeManager.getNode(element.getRef());
+ WindowNode window = (WindowNode)portalNodeManager.getNode(item.getRef());
Content content = window.getContent();
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelAdapter.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -24,13 +24,11 @@
import org.jboss.portal.presentation.impl.state.structural.adapter.StructuralAdapter;
import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
-import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
-import org.jboss.portal.presentation.portal.model.layout.StructureElement;
import org.jboss.portal.presentation.portal.model.layout.NestedStructure;
import org.jboss.portal.presentation.portal.model.layout.SimpleStructure;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
import org.jboss.portal.presentation.portal.model.layout.LayoutItem;
-import org.jboss.portal.presentation.portal.model.layout.SimpleElement;
+import org.jboss.portal.presentation.portal.model.layout.SimpleItem;
import org.jboss.portal.presentation.portal.model.node.PortalNodeManager;
import org.jboss.portal.presentation.portal.model.node.PortalNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
@@ -93,21 +91,28 @@
{
return ((PortalNode)o).getParent();
}
- else if (o instanceof LayoutElement)
+ else if (o instanceof LayoutItem)
{
- LayoutStructure layout = ((LayoutElement)o).getStructure();
-
- //
- if (layout instanceof NestedStructure)
+ if (o instanceof SimpleStructure)
{
- return ((NestedStructure)layout).getStructureElement();
+ SimpleStructure simpleStructure = (SimpleStructure)o;
+ String objectId = simpleStructure.getObjectRef();
+ return nodeManager.getNode(objectId);
}
- else
+ else if (o instanceof SimpleItem)
{
- SimpleStructure simpleStructure = (SimpleStructure)layout;
- String objectId = simpleStructure.getObjectRef();
+ SimpleItem item = (SimpleItem)o;
+ String objectId = item.getRef();
return nodeManager.getNode(objectId);
}
+ else if (o instanceof NestedStructure)
+ {
+ return ((NestedStructure)o).getStructure();
+ }
+ else
+ {
+ throw new NotYetImplemented("Cannot handle case with object class " + o.getClass().getName());
+ }
}
else
{
@@ -131,15 +136,19 @@
return ((PortalNode)o).getChildren();
}
}
- else if (o instanceof LayoutElement)
+ else if (o instanceof LayoutItem)
{
- if (o instanceof StructureElement)
+ if (o instanceof SimpleItem)
{
- return ((StructureElement)o).getNestedStructure().getElements();
+ return Collections.emptyList();
}
+ else if (o instanceof LayoutStructure)
+ {
+ return ((LayoutStructure)o).getElements();
+ }
else
{
- return Collections.emptyList();
+ throw new NotYetImplemented();
}
}
else
@@ -170,13 +179,13 @@
{
return ((PortalNode)o).getType();
}
- else if (o instanceof LayoutElement)
+ else if (o instanceof LayoutItem)
{
- if (o instanceof StructureElement)
+ if (o instanceof NestedStructure)
{
return UIPane.class;
}
- else if (o instanceof SimpleElement)
+ else if (o instanceof SimpleItem)
{
return UIWindow.class;
}
@@ -232,12 +241,12 @@
}
else if (o instanceof LayoutItem)
{
- if (o instanceof SimpleElement)
+ if (o instanceof SimpleItem)
{
- SimpleElement element = (SimpleElement)o;
+ SimpleItem item = (SimpleItem)o;
//
- String windowId = element.getRef();
+ String windowId = item.getRef();
//
WindowNode window = (WindowNode)nodeManager.getNode(windowId);
@@ -246,7 +255,7 @@
Map<String, Serializable> properties = new HashMap<String, Serializable>(window.getProperties());
//
- properties.putAll(element.getState().getProperties());
+ properties.putAll(item.getState().getProperties());
//
return properties;
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/ModelImporter.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -30,9 +30,8 @@
import org.jboss.portal.presentation.portal.content.portlet.PortletContent;
import org.jboss.portal.presentation.portal.content.Content;
import org.jboss.portal.presentation.portal.model.layout.LayoutStructure;
-import org.jboss.portal.presentation.portal.model.layout.LayoutElement;
-import org.jboss.portal.presentation.portal.model.layout.StructureElement;
import org.jboss.portal.presentation.portal.model.layout.LayoutStore;
+import org.jboss.portal.presentation.portal.model.layout.LayoutItem;
import org.jboss.portal.presentation.portal.model.node.PortalNode;
import org.jboss.portal.presentation.portal.model.node.PageNode;
import org.jboss.portal.presentation.portal.model.node.WindowNode;
@@ -193,7 +192,7 @@
String childName = childElt.getNamespaceURI() == null ? childElt.getTagName() : childElt.getLocalName();
//
- LayoutElement structureElement;
+ LayoutItem structureElement;
if ("window-def".equals(childName))
{
WindowNode window = importWindowDef(page, childElt);
@@ -203,10 +202,10 @@
}
else if ("simple-layout".equals(childName))
{
- StructureElement nestedLayout = layout.addStructureElement();
+ LayoutStructure nestedLayout = layout.addStructureElement();
//
- importLayout(page, nestedLayout.getNestedStructure(), childElt);
+ importLayout(page, nestedLayout, childElt);
//
structureElement = nestedLayout;
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutElement.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -1,45 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-/**
- * An element of a layout that belongs to a structure.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public abstract class LayoutElement extends LayoutItem
-{
-
- /** The structure to which this element belongs. */
- LayoutStructure structure;
-
- protected LayoutElement()
- {
- }
-
- public LayoutStructure getStructure()
- {
- return structure;
- }
-}
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutItem.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -38,6 +38,9 @@
/** . */
private LayoutItemContext context;
+ /** The structure to which this element belongs. */
+ LayoutStructure structure;
+
protected LayoutItem()
{
}
@@ -57,6 +60,11 @@
throw new NotYetImplemented("No need for now");
}
+ public final LayoutStructure getStructure()
+ {
+ return structure;
+ }
+
public final String getId()
{
if (context == null)
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStore.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -96,9 +96,9 @@
{
objectRef = ((SimpleStructure)item).getObjectRef();
}
- else if (item instanceof SimpleElement)
+ else if (item instanceof SimpleItem)
{
- objectRef = ((SimpleElement)item).getRef();
+ objectRef = ((SimpleItem)item).getRef();
}
//
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/LayoutStructure.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -31,40 +31,40 @@
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public class LayoutStructure extends LayoutItem
+public abstract class LayoutStructure extends LayoutItem
{
/** The elements of the structure. */
- private final Collection<LayoutElement> elements;
+ private final Collection<LayoutItem> elements;
/** The state. */
final LayoutItemState state;
LayoutStructure()
{
- this.elements = new ArrayList<LayoutElement>();
+ this.elements = new ArrayList<LayoutItem>();
this.state = new LayoutItemState();
}
- public Collection<LayoutElement> getElements()
+ public Collection<LayoutItem> getElements()
{
return elements;
}
- public SimpleElement addObjectElement(String objectRef)
+ public SimpleItem addObjectElement(String objectRef)
{
- SimpleElement element = new SimpleElement(objectRef);
+ SimpleItem item = new SimpleItem(objectRef);
//
- addElement(element);
+ addElement(item);
//
- return element;
+ return item;
}
- public StructureElement addStructureElement()
+ public LayoutStructure addStructureElement()
{
- StructureElement element = new StructureElement();
+ NestedStructure element = new NestedStructure();
//
addElement(element);
@@ -73,7 +73,7 @@
return element;
}
- private void addElement(LayoutElement element)
+ private void addElement(LayoutItem element)
{
if (element.structure != null)
{
Modified: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/NestedStructure.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -23,24 +23,11 @@
package org.jboss.portal.presentation.portal.model.layout;
/**
- * A structure nested in another structure through a {@link StructureElement}.
+ * A structure nested in another structure.
*
* @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
* @version $Revision: 630 $
*/
public final class NestedStructure extends LayoutStructure
{
-
- /** The corresponding structure element. */
- private final StructureElement structureElement;
-
- NestedStructure(StructureElement structureElement)
- {
- this.structureElement = structureElement;
- }
-
- public StructureElement getStructureElement()
- {
- return structureElement;
- }
}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -1,53 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public class SimpleElement extends LayoutElement
-{
-
- /** . */
- private final String ref;
-
- /** . */
- private final LayoutItemState state;
-
- SimpleElement(String ref)
- {
- this.ref = ref;
- this.state = new LayoutItemState();
- }
-
- public String getRef()
- {
- return ref;
- }
-
- public LayoutItemState getState()
- {
- return state;
- }
-}
Copied: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java (from rev 11157, modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleElement.java)
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java (rev 0)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/SimpleItem.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -0,0 +1,53 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2008, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.presentation.portal.model.layout;
+
+/**
+ * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
+ * @version $Revision: 630 $
+ */
+public class SimpleItem extends LayoutItem
+{
+
+ /** . */
+ private final String ref;
+
+ /** . */
+ private final LayoutItemState state;
+
+ SimpleItem(String ref)
+ {
+ this.ref = ref;
+ this.state = new LayoutItemState();
+ }
+
+ public String getRef()
+ {
+ return ref;
+ }
+
+ public LayoutItemState getState()
+ {
+ return state;
+ }
+}
Deleted: modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java
===================================================================
--- modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java 2008-06-27 20:29:07 UTC (rev 11177)
+++ modules/presentation/trunk/portal/src/main/java/org/jboss/portal/presentation/portal/model/layout/StructureElement.java 2008-06-27 22:14:10 UTC (rev 11178)
@@ -1,62 +0,0 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2008, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
-package org.jboss.portal.presentation.portal.model.layout;
-
-/**
- * A layout element that references a nested structure.
- *
- * @author <a href="mailto:julien@jboss-portal.org">Julien Viet</a>
- * @version $Revision: 630 $
- */
-public final class StructureElement extends LayoutElement
-{
-
- /** . */
- private final NestedStructure nestedStructure;
-
- StructureElement()
- {
- this.nestedStructure = new NestedStructure(this);
- }
-
- void register(LayoutItemContext context)
- {
- super.register(context);
-
- //
- context.register(nestedStructure);
- }
-
- public LayoutStructure getNestedStructure()
- {
- return nestedStructure;
- }
-
- /**
- * The implementation delegates the state to the nested structure.
- */
- public LayoutItemState getState()
- {
- return nestedStructure.state;
- }
-}
17 years, 10 months