Author: sohil.shah(a)jboss.com
Date: 2007-07-05 18:03:29 -0400 (Thu, 05 Jul 2007)
New Revision: 7672
Added:
trunk/core/src/main/org/jboss/portal/core/controller/handler/UIServerResponse.java
trunk/uiserver/
trunk/uiserver/build.bat
trunk/uiserver/build.sh
trunk/uiserver/build.xml
trunk/uiserver/src/
trunk/uiserver/src/main/
trunk/uiserver/src/main/org/
trunk/uiserver/src/main/org/jboss/
trunk/uiserver/src/main/org/jboss/portal/
trunk/uiserver/src/main/org/jboss/portal/uiserver/
trunk/uiserver/src/main/org/jboss/portal/uiserver/ClassicUI.java
trunk/uiserver/src/main/org/jboss/portal/uiserver/ClientUI.java
trunk/uiserver/src/main/org/jboss/portal/uiserver/PartialRefreshUI.java
trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServer.java
trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerImpl.java
trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerPageRendition.java
trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerRequest.java
trunk/uiserver/src/resources/
Modified:
trunk/build/build.xml
trunk/core/build.xml
trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
trunk/core/src/main/org/jboss/portal/core/theme/PageRendition.java
trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
Log:
First cut at the UIServer prototype.
Modified: trunk/build/build.xml
===================================================================
--- trunk/build/build.xml 2007-07-05 21:50:44 UTC (rev 7671)
+++ trunk/build/build.xml 2007-07-05 22:03:29 UTC (rev 7672)
@@ -127,6 +127,7 @@
<module name="bridge"/>
<module name="cms"/>
<module name="format"/>
+ <module name="uiserver"/>
<module name="core"/>
<module name="core-cms"/>
<module name="core-management"/>
@@ -136,14 +137,14 @@
<module name="wsrp"/>
<module name="registration"/>
<module name="workflow"/>
- <module name="widget"/>
+ <module name="widget"/>
<!--<module name="core-admin"/>-->
<!-- Module groups -->
<group name="portal">
<include
- modules="common, test, api, web, jems, server, security, identity,
search, format, portlet, portlet-server, bridge, faces, portlet-federation, theme,
workflow, cms, registration, core, wsrp, core-admin, core-cms, core-management,
core-samples, widget"/>
+ modules="common, test, api, web, jems, server, security, identity,
search, format, portlet, portlet-server, bridge, faces, portlet-federation, theme,
workflow, cms, registration, uiserver, core, wsrp, core-admin, core-cms, core-management,
core-samples, widget"/>
</group>
<group name="cms">
Modified: trunk/core/build.xml
===================================================================
--- trunk/core/build.xml 2007-07-05 21:50:44 UTC (rev 7671)
+++ trunk/core/build.xml 2007-07-05 22:03:29 UTC (rev 7672)
@@ -134,6 +134,7 @@
<path refid="jboss.portal-theme.classpath"/>
<path refid="jboss.portal-security.classpath"/>
<path refid="jboss.portal-test.classpath"/>
+ <path refid="jboss.portal-uiserver.classpath"/>
</path>
<!--+=======================================+-->
@@ -334,6 +335,7 @@
<fileset dir="${jboss.portal-search.root}/lib"
includes="portal-search-lib.jar"/>
<fileset dir="${jboss.portal-identity.root}/lib"
includes="portal-identity-lib.jar"/>
<fileset dir="${jboss.portal-registration.root}/lib"
includes="portal-registration-lib.jar"/>
+ <fileset dir="${jboss.portal-uiserver.root}/lib"
includes="portal-uiserver-lib.jar"/>
<fileset dir="${ehcache.ehcache.lib}"
includes="ehcache.jar"/>
<fileset dir="${apache.collections.lib}"
includes="commons-collections.jar"/>
<fileset dir="${javassist.javassist.lib}"
includes="javassist.jar"/>
Modified: trunk/core/src/main/org/jboss/portal/core/controller/Controller.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-07-05
21:50:44 UTC (rev 7671)
+++ trunk/core/src/main/org/jboss/portal/core/controller/Controller.java 2007-07-05
22:03:29 UTC (rev 7672)
@@ -46,6 +46,10 @@
import org.jboss.portal.server.ServerException;
import org.jboss.portal.web.spi.ServletContainerContext;
+import org.jboss.portal.uiserver.UIServer;
+import org.jboss.portal.uiserver.UIServerRequest;
+import org.jboss.portal.core.controller.handler.UIServerResponse;
+
import javax.servlet.ServletException;
import java.io.IOException;
@@ -92,6 +96,12 @@
/** . */
protected PageControlPolicy pageControlPolicy;
+
+ /**
+ *
+ */
+ protected UIServer uiServer = null;
+
public ContentRendererRegistry getContentRendererRegistry()
{
@@ -207,7 +217,25 @@
{
this.pageControlPolicy = pageControlPolicy;
}
+
+ /**
+ *
+ * @return
+ */
+ public UIServer getUIServer()
+ {
+ return uiServer;
+ }
+ /**
+ *
+ * @param uiServer
+ */
+ public void setUIServer(UIServer uiServer)
+ {
+ this.uiServer = uiServer;
+ }
+
public final void handle(ServerInvocation invocation) throws ServerException
{
// Create controller context
@@ -317,6 +345,19 @@
AjaxResponse ar = (AjaxResponse)handlerResponse;
sendResponse(controllerContext, ar);
}
+
+ //This condition hands over UI aggregation function to the
+ //UI Server, regardless of what type of UI is being catered to
+ else if(handlerResponse instanceof UIServerResponse)
+ {
+ //Create a request to be handled by the UIServer
+ UIServerRequest request = new UIServerRequest();
+ request.setAttribute(UIServerRequest.SERVER_INVOCATION,
controllerContext.getServerInvocation());
+ request.setAttribute(UIServerRequest.UI_INDICATOR,
((UIServerResponse)handlerResponse).getUiIndicator());
+
+ //Perform aggregation of the UI to be sent back to the client
+ this.uiServer.aggregate(request);
+ }
}
/**
Modified:
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-07-05
21:50:44 UTC (rev 7671)
+++
trunk/core/src/main/org/jboss/portal/core/controller/ajax/AjaxResponseHandler.java 2007-07-05
22:03:29 UTC (rev 7672)
@@ -68,6 +68,8 @@
import org.jboss.portal.theme.page.Region;
import org.apache.log4j.Logger;
+import org.jboss.portal.core.controller.handler.UIServerResponse;
+
import java.io.StringWriter;
import java.util.Set;
import java.util.HashSet;
@@ -174,7 +176,7 @@
ViewPageCommand rpc = new ViewPageCommand(upr.getPageId());
String url = controllerContext.renderURL(rpc, null, null);
UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
- return new AjaxResponse(dresp);
+ return new UIServerResponse(dresp);
}
else if (controllerResponse instanceof UpdateWindowResponse)
{
@@ -366,7 +368,7 @@
//
if (!fullRefresh)
{
- return new AjaxResponse(updatePage);
+ return new UIServerResponse(updatePage);
}
}
@@ -374,7 +376,7 @@
ViewPageCommand rpc = new ViewPageCommand(page.getId());
String url = controllerContext.renderURL(rpc, null, null);
UpdatePageLocationResponse dresp = new UpdatePageLocationResponse(url);
- return new AjaxResponse(dresp);
+ return new UIServerResponse(dresp);
}
else
{
Added: trunk/core/src/main/org/jboss/portal/core/controller/handler/UIServerResponse.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/controller/handler/UIServerResponse.java
(rev 0)
+++
trunk/core/src/main/org/jboss/portal/core/controller/handler/UIServerResponse.java 2007-07-05
22:03:29 UTC (rev 7672)
@@ -0,0 +1,83 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.core.controller.handler;
+
+import org.jboss.portal.core.controller.handler.HandlerResponse;
+import org.jboss.portal.server.ServerInvocationContext;
+
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ *
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIServerResponse extends HandlerResponse
+{
+ /**
+ *
+ */
+ private Object uiIndicator = null;
+
+ /**
+ *
+ * @param controllerResponse
+ */
+ public UIServerResponse(Object uiIndicator)
+ {
+ this.uiIndicator = uiIndicator;
+ }
+
+
+ /**
+ *
+ * @return
+ */
+ public Object getUiIndicator()
+ {
+ return uiIndicator;
+ }
+
+
+ /**
+ *
+ * @param uiIndicator
+ */
+ public void setUiIndicator(Object uiIndicator)
+ {
+ this.uiIndicator = uiIndicator;
+ }
+
+ /**
+ * Leave this empty.....The UIServer will take care of sending the response
+ *
+ *
+ * @param ctx
+ * @throws IOException
+ * @throws ServletException
+ */
+ public void sendResponse(ServerInvocationContext ctx) throws IOException,
ServletException
+ {
+ }
+}
Modified:
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java
===================================================================
---
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-07-05
21:50:44 UTC (rev 7671)
+++
trunk/core/src/main/org/jboss/portal/core/model/portal/PortalObjectResponseHandler.java 2007-07-05
22:03:29 UTC (rev 7672)
@@ -41,6 +41,9 @@
import org.jboss.portal.web.ServletContextDispatcher;
import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.core.controller.handler.UIServerResponse;
+import org.jboss.portal.uiserver.UIServerPageRendition;
+
import javax.servlet.ServletException;
import java.io.IOException;
@@ -76,17 +79,11 @@
//
if (resp instanceof PageRendition)
{
- final PageRendition rendition = (PageRendition)resp;
- final ServerInvocation invocation =
controllerContext.getServerInvocation();
- return new HTTPResponse()
- {
- public void sendResponse(ServerInvocationContext ctx) throws
IOException, ServletException
- {
- ServletContextDispatcher dispatcher = new
ServletContextDispatcher(invocation.getServerContext().getClientRequest(),
invocation.getServerContext().getClientResponse(),
invocation.getRequest().getServer().getServletContainerContext());
- MarkupInfo markupInfo =
(MarkupInfo)invocation.getResponse().getContentInfo();
- rendition.render(markupInfo, dispatcher);
- }
- };
+ PageRendition pageRendition = (PageRendition)resp;
+ UIServerPageRendition uiServerPageRendition = new UIServerPageRendition(
+
pageRendition.getLayout(),pageRendition.getTheme(),pageRendition.getPageResult(),pageRendition.getPageService()
+ );
+ return new UIServerResponse(uiServerPageRendition);
}
else
{
Modified: trunk/core/src/main/org/jboss/portal/core/theme/PageRendition.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/theme/PageRendition.java 2007-07-05 21:50:44
UTC (rev 7671)
+++ trunk/core/src/main/org/jboss/portal/core/theme/PageRendition.java 2007-07-05 22:03:29
UTC (rev 7672)
@@ -68,7 +68,7 @@
this.pageResult = markupResult;
this.pageService = pageService;
}
-
+
/** Performs the page rendition. */
public void render(MarkupInfo markupInfo, ServletContextDispatcher dispatcher) throws
IOException, ServletException
{
@@ -102,4 +102,19 @@
{
return pageResult;
}
+
+ public PortalLayout getLayout()
+ {
+ return this.layout;
+ }
+
+ public PortalTheme getTheme()
+ {
+ return this.theme;
+ }
+
+ public PageService getPageService()
+ {
+ return this.pageService;
+ }
}
Modified: trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml
===================================================================
--- trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-07-05
21:50:44 UTC (rev 7671)
+++ trunk/core/src/resources/portal-core-sar/META-INF/jboss-service.xml 2007-07-05
22:03:29 UTC (rev 7672)
@@ -1090,6 +1090,9 @@
<depends
optional-attribute-name="PageControlPolicy"
proxy-type="attribute">portal:service=ControlPolicy,type=Page</depends>
+ <depends
+ optional-attribute-name="UIServer"
+ proxy-type="attribute">portal:service=UIServer</depends>
</mbean>
<!-- The controller factory -->
@@ -1286,5 +1289,24 @@
optional-attribute-name="JBossAppEntityResolver"
proxy-type="attribute">portal:service=EntityResolver</depends>
</mbean>
-
+
+ <!-- Using the new UIServer -->
+ <mbean
+ code="org.jboss.portal.uiserver.UIServerImpl"
+ name="portal:service=UIServer"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <!--
+ A map of some UIIndicator object provided from the Controller Layer to the
corresponding Client Side
+ UI technology which will be used to handle the UI related tasks
+ -->
+ <attribute name="ClientUiConfig">
+ <properties>
+ <entry
key="org.jboss.portal.uiserver.UIServerPageRendition">org.jboss.portal.uiserver.ClassicUI</entry>
+ <entry
key="org.jboss.portal.theme.impl.render.dynamic.response.UpdatePageStateResponse">org.jboss.portal.uiserver.PartialRefreshUI</entry>
+ <entry
key="org.jboss.portal.theme.impl.render.dynamic.response.UpdatePageLocationResponse">org.jboss.portal.uiserver.PartialRefreshUI</entry>
+ </properties>
+ </attribute>
+ </mbean>
</server>
Added: trunk/uiserver/build.bat
===================================================================
--- trunk/uiserver/build.bat (rev 0)
+++ trunk/uiserver/build.bat 2007-07-05 22:03:29 UTC (rev 7672)
@@ -0,0 +1,54 @@
+@echo off
+rem
+rem Invokes a script of the same name in the 'tools' module.
+rem
+rem The 'tools' module is expected to be a peer directory of the directory
+rem in which this script lives.
+rem
+rem @author Jason Dillon <jason(a)planet57.com>
+rem
+
+rem $Id: build.bat 1015 2005-11-04 20:15:13Z mholzner $
+
+setlocal
+
+set PROGNAME=%~nx0
+set DIRNAME=%~dp0
+
+rem Legacy shell support
+if x%PROGNAME%==x set PROGNAME=build.bat
+if x%DIRNAME%==x set DIRNAME=.\
+
+set MODULE_ROOT=%DIRNAME%
+if x%TOOLS_ROOT%==x set TOOLS_ROOT=%DIRNAME%..\tools
+set TARGET=%TOOLS_ROOT%\bin\build.bat
+set ARGS=%*
+
+rem Start'er up yo
+goto main
+
+:debug
+if not x%DEBUG%==x echo %PROGNAME%: %*
+goto :EOF
+
+:main
+call :debug PROGNAME=%PROGNAME%
+call :debug DIRNAME=%DIRNAME%
+call :debug TOOLS_ROOT=%TOOLS_ROOT%
+call :debug TARGET=%TARGET%
+
+if exist %TARGET% call :call-script & goto :EOF
+rem else fail, we can not go on
+
+echo %PROGNAME%: *ERROR* The target executable does not exist:
+echo %PROGNAME%:
+echo %PROGNAME%: %TARGET%
+echo %PROGNAME%:
+echo %PROGNAME%: Please make sure you have checked out the 'tools' module
+echo %PROGNAME%: and make sure it is up to date.
+goto :EOF
+
+:call-script
+call :debug Executing %TARGET% %ARGS%
+call %TARGET% %ARGS%
+goto :EOF
Property changes on: trunk/uiserver/build.bat
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/uiserver/build.sh
===================================================================
--- trunk/uiserver/build.sh (rev 0)
+++ trunk/uiserver/build.sh 2007-07-05 22:03:29 UTC (rev 7672)
@@ -0,0 +1,49 @@
+#!/bin/sh
+##
+## Invokes a script of the same name in the 'tools' module.
+##
+## The 'tools' module is expected to be a peer directory of the directory
+## in which this script lives.
+##
+## @author Jason Dillon <jason(a)planet57.com>
+##
+
+# $Id: build.sh 1015 2005-11-04 20:15:13Z mholzner $
+
+PROGNAME=`basename $0`
+DIRNAME=`dirname $0`
+
+# Buss it yo
+main() {
+ if [ "x$TOOLS_ROOT" = "x" ]; then
+ TOOLS_ROOT=`cd $DIRNAME/../tools && pwd`
+ fi
+
+ MODULE_ROOT=`cd $DIRNAME; pwd`
+ export TOOLS_ROOT MODULE_ROOT DEBUG TRACE
+
+ # Where is the target script?
+ target="$TOOLS_ROOT/bin/$PROGNAME"
+ if [ ! -f "$target" ]; then
+ echo "${PROGNAME}: *ERROR* The target executable does not exist:"
+ echo "${PROGNAME}:"
+ echo "${PROGNAME}: $target"
+ echo "${PROGNAME}:"
+ echo "${PROGNAME}: Please make sure you have checked out the 'tools'
module"
+ echo "${PROGNAME}: and make sure it is up to date."
+ exit 2
+ fi
+
+ # Get busy yo!
+ if [ "x$DEBUG" != "x" ]; then
+ echo "${PROGNAME}: Executing: /bin/sh $target $@"
+ fi
+ if [ "x$TRACE" = "x" ]; then
+ exec /bin/sh $target "$@"
+ else
+ exec /bin/sh -x $target "$@"
+ fi
+}
+
+# Lets get ready to rumble!
+main "$@"
Property changes on: trunk/uiserver/build.sh
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/uiserver/build.xml
===================================================================
--- trunk/uiserver/build.xml (rev 0)
+++ trunk/uiserver/build.xml 2007-07-05 22:03:29 UTC (rev 7672)
@@ -0,0 +1,246 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This is free software; you can redistribute it and/or modify it ~
+ ~ under the terms of the GNU Lesser General Public License as ~
+ ~ published by the Free Software Foundation; either version 2.1 of ~
+ ~ the License, or (at your option) any later version. ~
+ ~ ~
+ ~ This software is distributed in the hope that it will be useful, ~
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
+ ~ Lesser General Public License for more details. ~
+ ~ ~
+ ~ You should have received a copy of the GNU Lesser General Public ~
+ ~ License along with this software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<!DOCTYPE project [
+ <!ENTITY libraries SYSTEM "../thirdparty/libraries.ent">
+ <!ENTITY buildmagic SYSTEM
"../tools/etc/buildfragments/buildmagic.ent">
+ <!ENTITY tools SYSTEM "../tools/etc/buildfragments/tools.ent">
+ <!ENTITY modules SYSTEM "../tools/etc/buildfragments/modules.ent">
+ <!ENTITY defaults SYSTEM
"../tools/etc/buildfragments/defaults.ent">
+ <!ENTITY targets SYSTEM "../tools/etc/buildfragments/targets.ent">
+ ]>
+
+<!--+======================================================================+-->
+<!--| JBoss Portal (The OpenSource Portal) Build File |-->
+<!--| |-->
+<!--| Distributable under LGPL license. |-->
+<!--| See terms of license at
http://www.gnu.org. |-->
+<!--| |-->
+<!--| This file has been designed to work with the 'tools' module and
|-->
+<!--| Buildmagic extentions. |-->
+<!--+======================================================================+-->
+
+<project default="main" name="JBoss Portal">
+
+ <!--+====================================================================+-->
+ <!--| Setup |-->
+ <!--| |-->
+ <!--| Include the common build elements. |-->
+ <!--| |-->
+ <!--| This defines several different targets, properties and paths. |-->
+ <!--| It also sets up the basic extention tasks amoung other things. |-->
+ <!--+====================================================================+-->
+
+ &buildmagic;
+ &modules;
+ &defaults;
+ &tools;
+ &targets;
+
+ <!-- ================================================================== -->
+ <!-- Initialization -->
+ <!-- ================================================================== -->
+
+ <!--
+ | Initialize the build system. Must depend on '_buildmagic:init'.
+ | Other targets should depend on 'init' or things will mysteriously fail.
+ -->
+
+ <target name="init" unless="init.disable"
depends="_buildmagic:init">
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Configuration |-->
+ <!--| |-->
+ <!--| This target is invoked by the Buildmagic initialization logic |-->
+ <!--| and should contain module specific configuration elements. |-->
+ <!--+====================================================================+-->
+
+ <target name="configure" unless="configure.disable">
+
+ <!-- Configure some properties -->
+ <property name="jboss-junit-configuration" value=""/>
+ <property name="junit.formatter.usefile" value="true"/>
+
+ <!-- Configure thirdparty libraries -->
+ &libraries;
+
+ <path id="library.classpath">
+ <path refid="jbossas/core.libs.classpath"/>
+ <path refid="sun.servlet.classpath"/>
+ <path refid="apache.log4j.classpath"/>
+ </path>
+
+ <!-- Configure modules -->
+ <call target="configure-modules"/>
+ <path id="dependentmodule.classpath">
+ <path refid="jboss.portal-common.classpath"/>
+ <path refid="jboss.portal-jems.classpath"/>
+ <path refid="jboss.portal-server.classpath"/>
+ <path refid="jboss.portal-theme.classpath"/>
+ <path refid="jboss.portal-web.classpath"/>
+ </path>
+
+ <!--+=======================================+-->
+ <!--| Override any default properties here. |-->
+ <!--+=======================================+-->
+
+ <!-- Configure defaults & build tools -->
+ <call target="configure-defaults"/>
+ <call target="configure-tools"/>
+ <call target="configure-explode"/>
+ <call target="configure-jbossaop"/>
+
+ <!--+=======================================+-->
+ <!--| Define module specific elements here. |-->
+ <!--+=======================================+-->
+ <property name="javadoc.private" value="true"/>
+ <property name="javadoc.protected" value="false"/>
+
+ <path id="hibernate.classpath">
+ <path refid="apache.commons.classpath"/>
+ <path refid="asm.asm.classpath"/>
+ <path refid="cglib.cglib.classpath"/>
+ <path refid="antlr.antlr.classpath"/>
+ <path refid="odmg.odmg.classpath"/>
+ <path refid="ehcache.ehcache.classpath"/>
+ <path refid="hibernate.hibernate.classpath"/>
+ </path>
+
+ <path id="aop.classpath">
+ <pathelement
path="${jbossas/core.libs.lib}/jboss-aspect-library.jar"/>
+ <pathelement path="${jboss.aop.lib}/jboss-aop.jar"/>
+ <path refid="javassist.javassist.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="trove.trove.classpath"/>
+ <path refid="qdox.qdox.classpath"/>
+ </path>
+
+ <taskdef name="explode"
+ classname="org.jboss.portal.common.ant.Explode"
+ classpathref="explode.task.classpath"/>
+ <taskdef name="implode"
+ classname="org.jboss.portal.common.ant.Implode"
+ classpathref="explode.task.classpath"/>
+
+ </target>
+
+ <target name="configure-explode">
+ <path id="explode.task.classpath">
+ <pathelement location="${project.tools}/lib/explode.jar"/>
+ <path refid="apache.ant.classpath"/>
+ </path>
+ <taskdef
+ name="explode"
+ classname="org.jboss.portal.common.ant.Explode"
+ classpathref="explode.task.classpath"/>
+ </target>
+
+ <target name="configure-jbossaop">
+ <path id="jbossaop.task.classpath">
+ <path refid="jboss.aop.classpath"/>
+ <path refid="javassist.javassist.classpath"/>
+ <path refid="oswego.concurrent.classpath"/>
+ <path refid="trove.trove.classpath"/>
+ <path refid="qdox.qdox.classpath"/>
+ </path>
+ <taskdef
+ name="aopc"
+ classname="org.jboss.aop.ant.AopC"
+ classpathref="jbossaop.task.classpath"/>
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Compile |-->
+ <!--| |-->
+ <!--| This target should depend on other compile-* targets for each |-->
+ <!--| different type of compile that needs to be performed, short of |-->
+ <!--| documentation compiles. |-->
+ <!--+====================================================================+-->
+
+ <target name="compile"
+ description="Compile all source files."
+ depends="_default:compile-classes,
+ _default:compile-etc,
+ _default:compile-resources">
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Generate Output |-->
+ <!--| |-->
+ <!--| Generates the target output for this module. Target output is |-->
+ <!--| the output which is ment to be released or used by external |-->
+ <!--| modules. |-->
+ <!--+====================================================================+-->
+
+ <target name="artifacts"
+ description="Generate all target output."
+ depends="compile">
+
+ <mkdir dir="${build.lib}"/>
+
+ <!-- portal-uiserver-lib.jar -->
+ <jar jarfile="${build.lib}/portal-uiserver-lib.jar">
+ <fileset dir="${build.classes}">
+ </fileset>
+ <fileset dir="../portlet/output/classes">
+ </fileset>
+ </jar>
+ </target>
+
+ <target name="output" depends="artifacts">
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Cleaning -->
+ <!-- ================================================================== -->
+
+ <!-- Clean up all build output -->
+ <target name="clean" depends="_default:clean">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!--+====================================================================+-->
+ <!--| Documents |-->
+ <!--| |-->
+ <!--| Generate all documentation for this module. |-->
+ <!--+====================================================================+-->
+
+ <target name="docs" depends="_default:docs">
+ <!-- Add module specific elements here. -->
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Misc. -->
+ <!-- ================================================================== -->
+
+ <target name="main" depends="most"/>
+ <target name="all" depends="_default:all"/>
+ <target name="most" depends="_default:most"/>
+ <target name="help" depends="_default:help"/>
+
+ <!-- ================================================================== -->
+ <!-- Deployment -->
+ <!-- ================================================================== -->
+</project>
Property changes on: trunk/uiserver/build.xml
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/uiserver/src/main/org/jboss/portal/uiserver/ClassicUI.java
===================================================================
--- trunk/uiserver/src/main/org/jboss/portal/uiserver/ClassicUI.java
(rev 0)
+++ trunk/uiserver/src/main/org/jboss/portal/uiserver/ClassicUI.java 2007-07-05 22:03:29
UTC (rev 7672)
@@ -0,0 +1,52 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver;
+
+import org.jboss.portal.server.ServerInvocation;
+import org.jboss.portal.web.ServletContextDispatcher;
+import org.jboss.portal.common.util.MarkupInfo;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class ClassicUI implements ClientUI
+{
+ /**
+ *
+ * @param request
+ */
+ public void sendResponse(UIServerRequest request) throws Exception
+ {
+ ServerInvocation invocation =
(ServerInvocation)request.getAttribute(UIServerRequest.SERVER_INVOCATION);
+ UIServerPageRendition rendition =
(UIServerPageRendition)request.getAttribute(UIServerRequest.UI_INDICATOR);
+
+ ServletContextDispatcher dispatcher = new
ServletContextDispatcher(invocation.getServerContext().getClientRequest(),
+ invocation.getServerContext().getClientResponse(),
+ invocation.getRequest().getServer().getServletContainerContext());
+
+ MarkupInfo markupInfo = (MarkupInfo)invocation.getResponse().getContentInfo();
+
+ rendition.render(markupInfo, dispatcher);
+ }
+}
Added: trunk/uiserver/src/main/org/jboss/portal/uiserver/ClientUI.java
===================================================================
--- trunk/uiserver/src/main/org/jboss/portal/uiserver/ClientUI.java
(rev 0)
+++ trunk/uiserver/src/main/org/jboss/portal/uiserver/ClientUI.java 2007-07-05 22:03:29
UTC (rev 7672)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface ClientUI
+{
+ /**
+ *
+ * @param request
+ */
+ public void sendResponse(UIServerRequest request) throws Exception;
+}
Added: trunk/uiserver/src/main/org/jboss/portal/uiserver/PartialRefreshUI.java
===================================================================
--- trunk/uiserver/src/main/org/jboss/portal/uiserver/PartialRefreshUI.java
(rev 0)
+++ trunk/uiserver/src/main/org/jboss/portal/uiserver/PartialRefreshUI.java 2007-07-05
22:03:29 UTC (rev 7672)
@@ -0,0 +1,55 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.portal.server.ServerInvocation;
+
+import org.jboss.portal.theme.impl.render.dynamic.JSONMarshaller;
+import org.jboss.portal.theme.impl.render.dynamic.DynaResponse;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class PartialRefreshUI implements ClientUI
+{
+ /**
+ *
+ */
+ private static final JSONMarshaller marshaller = new JSONMarshaller();
+
+ /**
+ *
+ */
+ public void sendResponse(UIServerRequest request) throws Exception
+ {
+ ServerInvocation serverInvocation =
(ServerInvocation)request.getAttribute(UIServerRequest.SERVER_INVOCATION);
+ HttpServletResponse resp =
serverInvocation.getServerContext().getClientResponse();
+ DynaResponse dynaResponse =
(DynaResponse)request.getAttribute(UIServerRequest.UI_INDICATOR);
+
+ resp.setContentType("text/html");
+ marshaller.write(dynaResponse, resp.getWriter());
+ }
+}
Added: trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServer.java
===================================================================
--- trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServer.java
(rev 0)
+++ trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServer.java 2007-07-05 22:03:29
UTC (rev 7672)
@@ -0,0 +1,36 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public interface UIServer
+{
+ /**
+ *
+ * @param uiServerContext
+ */
+ public void aggregate(UIServerRequest uiServerRequest);
+}
Added: trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerImpl.java
===================================================================
--- trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerImpl.java
(rev 0)
+++ trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerImpl.java 2007-07-05
22:03:29 UTC (rev 7672)
@@ -0,0 +1,141 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver;
+
+import java.util.Map;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.Properties;
+
+import org.w3c.dom.Element;
+import org.apache.log4j.Logger;
+
+import org.jboss.portal.common.xml.XMLTools;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIServerImpl extends AbstractJBossService implements UIServer
+{
+ /**
+ *
+ */
+ private static Logger log = Logger.getLogger(UIServerImpl.class);
+
+ /**
+ * A map of some UIIndicator object provided from the Controller Layer to the
corresponding Client Side
+ * UI technology which will be used to handle the UI related tasks
+ */
+ private Map clientUiConfig = null;
+
+
+ /**
+ *
+ *
+ */
+ public UIServerImpl()
+ {
+ this.clientUiConfig = new HashMap();
+ }
+
+ /**
+ *
+ */
+ protected void startService() throws Exception
+ {
+ super.startService();
+ }
+
+ /**
+ *
+ */
+ protected void stopService() throws Exception
+ {
+ super.stopService();
+ this.clientUiConfig = null;
+ }
+
+
+ /**
+ * Used to register the different Client side UI technologies supported by the Portal
+ *
+ * @param clientUiConfig
+ */
+ public void setClientUiConfig(Element clientUiConfigElement)
+ {
+ try
+ {
+ Properties properties = XMLTools.loadXMLProperties(clientUiConfigElement);
+ if(properties != null)
+ {
+ for(Iterator itr=properties.keySet().iterator();itr.hasNext();)
+ {
+ String key = (String)itr.next();
+ String value = (String)properties.get(key);
+
+ this.clientUiConfig.put(key,
+
Thread.currentThread().getContextClassLoader().loadClass(value).newInstance());
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ log.error(this,e);
+ try
+ {
+ this.stopService();
+ }
+ catch(Exception ex)
+ {
+ //Dont worry about it...we tried to stop it..
+ //Just cleanup now and proceed
+ this.clientUiConfig = null;
+ }
+ throw new RuntimeException(e);
+ }
+ }
+ //--------UIServer
implementation----------------------------------------------------------------------------------------------------
+ /**
+ *
+ */
+ public void aggregate(UIServerRequest uiServerRequest)
+ {
+ try
+ {
+ Object uiIndicator =
uiServerRequest.getAttribute(UIServerRequest.UI_INDICATOR);
+
+ //Lookup the client UI that should be used to handle the aggregation/response
back to the Client
+ ClientUI clientUI =
(ClientUI)this.clientUiConfig.get(uiIndicator.getClass().getName());
+
+ //Actually send an aggregated response back to the Client
+ clientUI.sendResponse(uiServerRequest);
+ }
+ catch(Exception e)
+ {
+ log.error(this,e);
+ throw new RuntimeException(e);
+ }
+ }
+}
Added: trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerPageRendition.java
===================================================================
--- trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerPageRendition.java
(rev 0)
+++
trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerPageRendition.java 2007-07-05
22:03:29 UTC (rev 7672)
@@ -0,0 +1,104 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver;
+
+import org.jboss.portal.theme.PageService;
+import org.jboss.portal.theme.render.RendererContext;
+import org.jboss.portal.theme.render.RenderException;
+import org.jboss.portal.theme.render.ThemeContext;
+import org.jboss.portal.theme.PortalLayout;
+import org.jboss.portal.theme.PortalTheme;
+import org.jboss.portal.theme.page.PageResult;
+import org.jboss.portal.common.util.MarkupInfo;
+import org.jboss.portal.web.ServletContextDispatcher;
+
+import javax.servlet.ServletException;
+import java.io.IOException;
+
+/**
+ * Should not be a controller response, but it comes from legacy design.
+ *
+ * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
+ * @version $Revision: 1.1 $
+ */
+public class UIServerPageRendition
+{
+
+ /** . */
+ private PortalLayout layout;
+
+ /** . */
+ private PageResult pageResult;
+
+ /** . */
+ private PortalTheme theme;
+
+ /** . */
+ private PageService pageService;
+
+ public UIServerPageRendition(
+ PortalLayout layout,
+ PortalTheme theme,
+ PageResult markupResult,
+ PageService pageService)
+ {
+ this.layout = layout;
+ this.theme = theme;
+ this.pageResult = markupResult;
+ this.pageService = pageService;
+ }
+
+ /** Performs the page rendition. */
+ public void render(MarkupInfo markupInfo, ServletContextDispatcher dispatcher) throws
IOException, ServletException
+ {
+ // Compute correct content type response header
+// String contentType = rendererContext.getContentType() + "; charset=" +
rendererContext.getCharset();
+ String contentType = markupInfo.getContentType() + "; charset=" +
markupInfo.getCharset();
+
+ // Set charset and content type on the response
+ dispatcher.getResponse().setContentType(contentType);
+ dispatcher.getResponse().setCharacterEncoding(markupInfo.getCharset());
+
+
+ //
+ ThemeContext themeContext = new ThemeContext(theme,
pageService.getThemeService());
+
+ //
+ RendererContext rendererContext = layout.getRenderContext(themeContext, markupInfo,
dispatcher);
+
+ //
+ try
+ {
+ rendererContext.render(pageResult);
+ }
+ catch (RenderException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public PageResult getPageResult()
+ {
+ return pageResult;
+ }
+}
Added: trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerRequest.java
===================================================================
--- trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerRequest.java
(rev 0)
+++ trunk/uiserver/src/main/org/jboss/portal/uiserver/UIServerRequest.java 2007-07-05
22:03:29 UTC (rev 7672)
@@ -0,0 +1,94 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Lesser General Public License as *
+ * published by the Free Software Foundation; either version 2.1 of *
+ * the License, or (at your option) any later version. *
+ * *
+ * This software is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.uiserver;
+
+import java.io.Serializable;
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * @author <a href="mailto:sshah@redhat.com">Sohil Shah</a>
+ *
+ */
+public class UIServerRequest implements Serializable
+{
+ public static final String UI_INDICATOR = "uiIndicator";
+ public static final String SERVER_INVOCATION = "serverInvocation";
+
+ /**
+ *
+ */
+ private Map attributes = null;
+
+ /**
+ *
+ *
+ */
+ public UIServerRequest()
+ {
+ this.attributes = new HashMap();
+ }
+
+ /**
+ *
+ * @param name
+ * @param value
+ */
+ public void setAttribute(String name,Object value)
+ {
+ if(name == null)
+ {
+ throw new IllegalArgumentException("Attribute Name cannot be null");
+ }
+
+ if(value == null)
+ {
+ this.removeAttribute(name);
+ return;
+ }
+
+ this.attributes.put(name, value);
+ }
+
+ /**
+ *
+ * @param name
+ * @return
+ */
+ public Object getAttribute(String name)
+ {
+ return this.attributes.get(name);
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void removeAttribute(String name)
+ {
+ if(this.attributes.containsKey(name))
+ {
+ this.attributes.remove(name);
+ }
+ }
+}