Author: julien(a)jboss.com
Date: 2008-04-18 08:01:57 -0400 (Fri, 18 Apr 2008)
New Revision: 10642
Added:
modules/presentation/trunk/presentation/src/main/java/org/jboss/portal/presentation/impl/server/
Removed:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
Modified:
modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
Log:
move presentation server impl to presentation package so it can be reused by ajax client
Modified: modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml
===================================================================
--- modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml 2008-04-18
11:49:40 UTC (rev 10641)
+++ modules/presentation/trunk/ajax/src/main/config/war/WEB-INF/jboss-beans.xml 2008-04-18
12:01:57 UTC (rev 10642)
@@ -31,7 +31,7 @@
</bean>
<bean
name="PresentationServer"
- class="org.jboss.portal.presentation.PresentationServerImpl">
+
class="org.jboss.portal.presentation.impl.server.PresentationServerImpl">
<constructor>
<parameter><inject
bean="StructuralStateContext"/></parameter>
</constructor>
Deleted:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-18
11:49:40 UTC (rev 10641)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/PresentationServerImpl.java 2008-04-18
12:01:57 UTC (rev 10642)
@@ -1,119 +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;
-
-import org.jboss.portal.presentation.client.PresentationClient;
-import org.jboss.portal.presentation.impl.state.structural.StructuralNode;
-import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;
-import org.jboss.portal.presentation.impl.state.structural.WindowNode;
-import org.jboss.portal.presentation.model.content.WindowContent;
-import org.jboss.portal.presentation.protocol.ErrorResponse;
-import org.jboss.portal.presentation.protocol.ProtocolAction;
-import org.jboss.portal.presentation.protocol.ShowUIObjectResponse;
-import org.jboss.portal.presentation.protocol.UIObjectAction;
-import org.jboss.portal.presentation.protocol.ViewUIObjectAction;
-import org.jboss.portal.presentation.server.PresentationRequest;
-import org.jboss.portal.presentation.server.PresentationResponse;
-import org.jboss.portal.presentation.server.PresentationServer;
-import org.jboss.portal.presentation.server.PresentationServerException;
-import org.jboss.portal.presentation.state.structural.StructuralStateContext;
-
-/**
- * @author <a href="mailto:julien@jboss-portal.org">Julien
Viet</a>
- * @version $Revision: 630 $
- */
-public class PresentationServerImpl implements PresentationServer
-{
-
- /** . */
- private StructuralStateContextImpl structuralStateContext;
-
- public PresentationServerImpl(StructuralStateContextImpl structuralStateContext)
- {
- this.structuralStateContext = structuralStateContext;
- }
-
- public StructuralStateContext getStructuralStateContext()
- {
- return structuralStateContext;
- }
-
- public String render(ProtocolAction action) throws IllegalArgumentException
- {
- throw new UnsupportedOperationException();
- }
-
- public WindowContent renderWindow(PresentationClient client, String windowId) throws
PresentationServerException
- {
- StructuralNode node = structuralStateContext.getNode(windowId);
-
- //
- if (node instanceof WindowNode)
- {
- WindowNode window = (WindowNode)node;
-
-
-
-
-
-
-
- return new WindowContent(0, "Window " + window.getName(),
window.getContent());
- }
- else
- {
- throw new PresentationServerException("No such window " + windowId);
- }
- }
-
- public PresentationResponse process(PresentationClient client, PresentationRequest
request) throws PresentationServerException
- {
- ProtocolAction action = request.getProtocolAction();
-
- if (action instanceof UIObjectAction)
- {
- UIObjectAction objectAction = (UIObjectAction)action;
-
- //
- String targetId = objectAction.getTargetId();
-
- //
- StructuralNode targetNode = structuralStateContext.getNode(targetId);
-
- //
- if (targetNode == null)
- {
- return new PresentationResponse(new ErrorResponse(404));
- }
-
- //
- if (objectAction instanceof ViewUIObjectAction)
- {
- return new PresentationResponse(new ShowUIObjectResponse(targetId));
- }
- }
-
- //
- throw new UnsupportedOperationException();
- }
-}
Modified:
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java
===================================================================
---
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-18
11:49:40 UTC (rev 10641)
+++
modules/presentation/trunk/classic/src/main/java/org/jboss/portal/presentation/classic/ClassicPresentationServlet.java 2008-04-18
12:01:57 UTC (rev 10642)
@@ -23,7 +23,7 @@
package org.jboss.portal.presentation.classic;
import org.jboss.portal.common.io.IOTools;
-import org.jboss.portal.presentation.PresentationServerImpl;
+import org.jboss.portal.presentation.impl.server.PresentationServerImpl;
import org.jboss.portal.presentation.impl.state.structural.ContextNode;
import org.jboss.portal.presentation.impl.state.structural.NodeImporter;
import org.jboss.portal.presentation.impl.state.structural.StructuralStateContextImpl;