You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by cl...@apache.org on 2005/05/23 20:51:33 UTC

svn commit: r178016 [1/2] - in /incubator/graffito/trunk/applications/framework-portlets: ./ src/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/portals/ src/java/org/apache/portals/graffito/ src/java/org/apache/portals/graffito/portlets/ src/java/org/apache/portals/graffito/portlets/bean/ src/java/org/apache/portals/graffito/portlets/page/ src/java/org/apache/portals/graffito/portlets/page/action/ src/java/org/apache/portals/graffito/portlets/page/manager/ src/java/org/apache/portals/graffito/portlets/page/tab/ src/java/org/apache/portals/graffito/portlets/upload/ src/java/org/apache/portals/graffito/portlets/util/ src/java/org/apache/portals/graffito/servlets/ src/test/ src/test/org/ src/test/org/apache/ src/test/org/apache/portals/ src/test/org/apache/portals/graffito/ src/test/org/apache/portals/graffito/portlets/ src/test/org/apache/portals/graffito/portlets/page/ src/test/org/apache/portals/graffito/portlets/page/manager/ test/

Author: clombart
Date: Mon May 23 13:51:31 2005
New Revision: 178016

URL: http://svn.apache.org/viewcvs?rev=178016&view=rev
Log:
Add a new subproject : Graffito portlet framework. See with David if the code can be donate to J2

Added:
    incubator/graffito/trunk/applications/framework-portlets/
    incubator/graffito/trunk/applications/framework-portlets/.classpath
    incubator/graffito/trunk/applications/framework-portlets/.project
    incubator/graffito/trunk/applications/framework-portlets/maven.xml
    incubator/graffito/trunk/applications/framework-portlets/project.properties
    incubator/graffito/trunk/applications/framework-portlets/project.xml
    incubator/graffito/trunk/applications/framework-portlets/src/
    incubator/graffito/trunk/applications/framework-portlets/src/java/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/GraffitoPortlet.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/bean/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/bean/BeanUtil.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/EditPortletPage.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPage.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPageRef.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPages.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/ViewPortletPage.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/action/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/action/PortletActionInfo.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageManager.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageReader.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/Tab.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/TabPage.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/upload/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/upload/PortletDiskFileUpload.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/upload/PortletFileUpload.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/upload/PortletFileUploadBase.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/ExpressionUtil.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/GraffitoTools.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/util/ServiceUtil.java
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/servlets/
    incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/servlets/GraffitoViewerServlet.java
    incubator/graffito/trunk/applications/framework-portlets/src/test/
    incubator/graffito/trunk/applications/framework-portlets/src/test/org/
    incubator/graffito/trunk/applications/framework-portlets/src/test/org/apache/
    incubator/graffito/trunk/applications/framework-portlets/src/test/org/apache/portals/
    incubator/graffito/trunk/applications/framework-portlets/src/test/org/apache/portals/graffito/
    incubator/graffito/trunk/applications/framework-portlets/src/test/org/apache/portals/graffito/portlets/
    incubator/graffito/trunk/applications/framework-portlets/src/test/org/apache/portals/graffito/portlets/page/
    incubator/graffito/trunk/applications/framework-portlets/src/test/org/apache/portals/graffito/portlets/page/manager/
    incubator/graffito/trunk/applications/framework-portlets/src/test/org/apache/portals/graffito/portlets/page/manager/TestPortletPage.java
    incubator/graffito/trunk/applications/framework-portlets/test/
    incubator/graffito/trunk/applications/framework-portlets/test/pages.xml
    incubator/graffito/trunk/applications/framework-portlets/test/pages_if.xml

Added: incubator/graffito/trunk/applications/framework-portlets/.classpath
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/.classpath?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/.classpath (added)
+++ incubator/graffito/trunk/applications/framework-portlets/.classpath Mon May 23 13:51:31 2005
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<classpath>
+  <classpathentry excluding="" kind="src" path="src/java">
+  </classpathentry>
+  <classpathentry output="target/test-classes" kind="src" path="src/test">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/junit/jars/junit-3.8.1.jar">
+  </classpathentry>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/servletapi/jars/servletapi-2.3.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/portlet-api/jars/portlet-api-1.0.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-api-2.0-M3-dev.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-commons-2.0-M3-dev.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/jetspeed2/jars/jetspeed-components-2.0-M3-dev.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/log4j/jars/log4j-1.2.8.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/commons-logging/jars/commons-logging-1.0.3.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/commons-beanutils/jars/commons-beanutils-1.6.1.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/commons-codec/jars/commons-codec-1.2.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/commons-collections/jars/commons-collections-2.1.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/commons-digester/jars/commons-digester-1.5.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/commons-fileupload/jars/commons-fileupload-1.0.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/commons-jexl/jars/commons-jexl-1.0.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/velocity/jars/velocity-1.4.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/velocity-tools/jars/velocity-tools-1.1.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/portals-bridges/jars/portals-bridges-common-0.1.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/portals-bridges/jars/portals-bridges-velocity-0.1.jar">
+  </classpathentry>
+  <classpathentry kind="var" path="MAVEN_REPO/graffito/jars/graffito-api-1.0-a1-dev.jar">
+  </classpathentry>
+  <classpathentry kind="output" path="target/classes">
+  </classpathentry>
+</classpath>
\ No newline at end of file

Added: incubator/graffito/trunk/applications/framework-portlets/.project
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/.project?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/.project (added)
+++ incubator/graffito/trunk/applications/framework-portlets/.project Mon May 23 13:51:31 2005
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<projectDescription>
+  <name>graffito-framework-portlets</name>
+  <comment>Graffito Framework Portlet</comment>
+  <projects>
+  </projects>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+      <arguments>
+      </arguments>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: incubator/graffito/trunk/applications/framework-portlets/maven.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/maven.xml?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/maven.xml (added)
+++ incubator/graffito/trunk/applications/framework-portlets/maven.xml Mon May 23 13:51:31 2005
@@ -0,0 +1,19 @@
+<!--
+Copyright 2004 The Apache Software Foundation
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project default="java:jar" xmlns:j="jelly:core" xmlns:define="jelly:define">
+
+  
+ </project>
\ No newline at end of file

Added: incubator/graffito/trunk/applications/framework-portlets/project.properties
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/project.properties?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/project.properties (added)
+++ incubator/graffito/trunk/applications/framework-portlets/project.properties Mon May 23 13:51:31 2005
@@ -0,0 +1,41 @@
+# Copyright 2004 The Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# $Id: project.properties,v 1.7 2004/12/01 01:28:47 taylor Exp $
+#
+
+#-----------------------------------------------------------------------------------------------------
+# MAVEN REPORISTORIES
+#-----------------------------------------------------------------------------------------------------
+maven.repo.remote = http://cvs.apache.org/repository, http://www.ibiblio.org/maven/, http://dist.codehaus.org/,  http://www.bluesunrise.com/maven/
+
+#-----------------------------------------------------------------------------------------------------
+# DOC : SITE & PDF DOC
+#-----------------------------------------------------------------------------------------------------
+maven.docs.dest=${basedir}/../../site/applications/framework-portlets
+# Display the date on the Maven web site
+maven.xdoc.date = left
+
+maven.xdoc.version = ${pom.currentVersion}
+maven.pdf.navigationFile=navigation_pdf.xml
+
+#-----------------------------------------------------------------------------------------------------
+# COMPILE
+#-----------------------------------------------------------------------------------------------------
+maven.compile.deprecation=on
+
+
+
+
+

Added: incubator/graffito/trunk/applications/framework-portlets/project.xml
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/project.xml?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/project.xml (added)
+++ incubator/graffito/trunk/applications/framework-portlets/project.xml Mon May 23 13:51:31 2005
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+  <extend>${basedir}/./../../project.xml</extend>
+  <pomVersion>3</pomVersion>
+  <artifactId>graffito-framework-portlets</artifactId>
+  <name>Graffito Framework Portlet</name>
+  <groupId>graffito</groupId>
+  <description>Graffito Framework Portlet</description>
+  <shortDescription>Graffito Framework Portlet</shortDescription>
+  <repository>
+    <connection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/applications/framework-portlets</connection>
+    <developerConnection>scm:subversion:https://svn.apache.org/repos/asf/incubator/graffito/trunk/applications/framework-portlets</developerConnection>
+    <url>http://svn.apache.org/viewcvs</url>
+  </repository>
+  <dependencies>
+  		<dependency>
+			<id>servletapi</id>
+			<version>2.3</version>
+			<properties>
+				<war.bundle>false</war.bundle>
+			</properties>
+		</dependency>
+		<dependency>
+			<groupId>portlet-api</groupId>
+			<artifactId>portlet-api</artifactId>
+			<version>1.0</version>
+			<type>jar</type>
+			<properties>
+				<war.bundle>false</war.bundle>
+			</properties>
+		</dependency>
+		<dependency>
+			<groupId>jetspeed2</groupId>
+			<artifactId>jetspeed-api</artifactId>
+			<version>2.0-M3-dev</version>
+			<type>jar</type>
+			<properties>
+				<war.bundle>false</war.bundle>
+			</properties>
+		</dependency>
+		
+		<dependency>
+			<groupId>jetspeed2</groupId>
+			<artifactId>jetspeed-commons</artifactId>
+			<version>2.0-M3-dev</version>
+			<type>jar</type>
+			<properties>
+				<war.bundle>false</war.bundle>
+			</properties>
+		</dependency>
+		<dependency>
+			<groupId>jetspeed2</groupId>
+			<artifactId>jetspeed-components</artifactId>
+			<version>2.0-M3-dev</version>
+			<type>jar</type>
+			<properties>
+				<war.bundle>true</war.bundle>
+			</properties>
+		</dependency>
+  
+    <dependency>
+      <groupId>portlet-api</groupId>
+      <artifactId>portlet-api</artifactId>
+      <version>1.0</version>
+      <type>jar</type>
+      <properties>
+        <war.bundle>false</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>1.2.8</version>
+      <type>jar</type>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.0.3</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/commons/logging.html</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>commons-beanutils</groupId>
+      <artifactId>commons-beanutils</artifactId>
+      <version>1.6.1</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/commons/beanutils.html</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>commons-codec</groupId>
+      <artifactId>commons-codec</artifactId>
+      <version>1.2</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/commons/codec/</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>commons-collections</groupId>
+      <artifactId>commons-collections</artifactId>
+      <version>2.1</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/commons/collections.html</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>commons-digester</groupId>
+      <artifactId>commons-digester</artifactId>
+      <version>1.5</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/commons/digester.html</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>commons-fileupload</groupId>
+      <artifactId>commons-fileupload</artifactId>
+      <version>1.0</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/commons/fileupload/</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>commons-jexl</groupId>
+      <artifactId>commons-jexl</artifactId>
+      <version>1.0</version>
+      <type>jar</type>    
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>    
+    <dependency>
+      <groupId>velocity</groupId>
+      <artifactId>velocity</artifactId>
+      <version>1.4</version>
+      <type>jar</type>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>velocity-tools</groupId>
+      <artifactId>velocity-tools</artifactId>
+      <version>1.1</version>
+      <type>jar</type>
+      <url>http://jakarta.apache.org/velocity</url>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>portals-bridges</groupId>
+      <artifactId>portals-bridges-common</artifactId>
+      <version>0.1</version>
+      <type>jar</type>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>portals-bridges</groupId>
+      <artifactId>portals-bridges-velocity</artifactId>
+      <version>0.1</version>
+      <type>jar</type>
+      <properties>
+        <war.bundle>true</war.bundle>
+      </properties>
+    </dependency>
+    <dependency>
+      <groupId>graffito</groupId>
+      <artifactId>graffito-api</artifactId>
+      <version>1.0-a1-dev</version>
+      <type>jar</type>
+    </dependency>
+  </dependencies>
+    <build>
+    <sourceDirectory>src/java</sourceDirectory>
+
+    <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
+    <unitTest>
+      <resources>
+        <resource>
+          <directory>${basedir}/src/test</directory>
+          <excludes>
+           <exclude>**/*.java</exclude>
+          </excludes>
+        </resource>
+      </resources>
+    </unitTest>
+    
+    <resources>
+      <resource>
+        <directory>${basedir}/src/java</directory>
+        <excludes>
+          <exclude>**/*.java</exclude>
+        </excludes>
+      </resource>
+    </resources>
+
+  </build>
+  <reports>
+       <report>maven-javadoc-plugin</report>
+  </reports>
+</project>
+

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/GraffitoPortlet.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/GraffitoPortlet.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/GraffitoPortlet.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/GraffitoPortlet.java Mon May 23 13:51:31 2005
@@ -0,0 +1,117 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets;
+
+import java.io.IOException;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.ActionResponse;
+import javax.portlet.PortletConfig;
+import javax.portlet.PortletContext;
+import javax.portlet.PortletException;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.portals.bridges.velocity.GenericVelocityPortlet;
+import org.apache.portals.graffito.portlets.page.manager.PortletPageManager;
+import org.apache.portals.graffito.portlets.util.GraffitoTools;
+import org.apache.velocity.context.Context;
+
+/**
+ * Velocity portlet used for all Graffito Portlets
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Christophe Lombart</a>
+ * @version $Id:  Exp $
+ */
+public class GraffitoPortlet extends GenericVelocityPortlet
+{
+
+    private static final String VELOCITY_GRAFFITO_TOOLS = "graffitoTools";
+    private static final String VELOCITY_TABS = "tabs";
+        
+    private static final String PORTLET_PAGE_CONFIG = "PortletPageConfig";
+    private static final String VIEWER_SERVLET = "ViewerServlet";    
+           
+    protected PortletPageManager portletPageManager;
+    protected String viewerServlet;
+    
+    
+    protected Log log = LogFactory.getLog(GraffitoPortlet.class);
+
+    /**
+     * @see javax.portlet.Portlet#init(javax.portlet.PortletConfig)
+     */
+    public void init(PortletConfig config) throws PortletException
+    {
+        super.init(config);                        
+        PortletContext context = getPortletContext();
+                                
+        String portletPageConfig = config.getInitParameter(PORTLET_PAGE_CONFIG);
+        if (portletPageConfig != null)
+        {
+            String xmlFile = context.getRealPath(portletPageConfig);
+            try
+            {
+                portletPageManager = new PortletPageManager(this, xmlFile);            
+            }
+            catch (Exception e)
+            {
+                throw new PortletException("Impossible to read the portlet page xml file : " + xmlFile, e );            
+            }        
+
+        }
+        
+        viewerServlet = config.getInitParameter(VIEWER_SERVLET);
+                                 
+    }
+
+    /**
+     * @see javax.portlet.GenericPortlet#doView(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
+     */
+    public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException
+    {
+        portletPageManager.doView(request, response);
+        Context velocityContext = this.getContext(request);
+        velocityContext.put(VELOCITY_TABS, portletPageManager.getSelectedViewPage(request).getTabs());   
+        velocityContext.put(VELOCITY_GRAFFITO_TOOLS, new GraffitoTools(request.getContextPath() + "/" + viewerServlet));
+        
+        super.doView(request, response);
+    }
+
+    /**
+     * @see javax.portlet.GenericPortlet#doEdit(javax.portlet.RenderRequest, javax.portlet.RenderResponse)
+     */
+    public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException
+    {
+        portletPageManager.doEdit(request, response);  
+        Context velocityContext = this.getContext(request);
+        velocityContext.put(VELOCITY_TABS, portletPageManager.getSelectedEditPage(request).getTabs()); 
+        velocityContext.put(VELOCITY_GRAFFITO_TOOLS, new GraffitoTools(request.getContextPath() + "/" + viewerServlet));
+        super.doEdit(request, response);
+    }
+
+    /**
+     * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest, javax.portlet.ActionResponse)
+     */
+    public void processAction(ActionRequest request, ActionResponse response) throws PortletException, IOException
+    {
+        portletPageManager.processAction(this, request, response);
+                    
+    }
+    
+}
\ No newline at end of file

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/bean/BeanUtil.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/bean/BeanUtil.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/bean/BeanUtil.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/bean/BeanUtil.java Mon May 23 13:51:31 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.bean;
+
+
+import java.util.Enumeration;
+
+import javax.portlet.PortletRequest;
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.PropertyUtils;
+
+/**
+ * Utility class used to manage java beans
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class BeanUtil
+{
+     /**
+      * Update bean properties with the value found in the portlet request paramters
+      * 
+      * @param portletRequest
+      * @param bean The bean to update
+      * @return The updated bean
+      */
+     public static Object populate(PortletRequest portletRequest, Object bean)
+     {
+         Enumeration parameterNames = portletRequest.getParameterNames();
+         while(parameterNames.hasMoreElements())
+         {
+             String parameterName = (String) parameterNames.nextElement();
+             String parameterValue = portletRequest.getParameter(parameterName);
+             
+            try
+            {
+                PropertyUtils.setNestedProperty(bean, parameterName, ConvertUtils.convert(parameterValue, 
+                                                 PropertyUtils.getPropertyDescriptor(bean, parameterName).getPropertyType()));
+            }
+            catch (Exception e )
+            {
+                // Exception are ignored, this catch block is triggered 
+                // when a http request param doesn't match to a bean property            
+            }
+         }
+         
+         return bean;
+         
+         
+         
+     }
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/EditPortletPage.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/EditPortletPage.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/EditPortletPage.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/EditPortletPage.java Mon May 23 13:51:31 2005
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page;
+
+import java.util.ArrayList;
+
+/**
+ * Edit portlet page is a page used in the edit mode.
+ * When the end-user move to the view mode, this viewPortletPage will be used.
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class EditPortletPage extends PortletPage
+{
+ 
+    private ArrayList viewPortletPages = new ArrayList();
+    
+    public ArrayList getViewPortletPages()
+    {
+        return viewPortletPages;
+    }
+    
+    public void addViewPortletPageReference(PortletPageRef portletPageRef)
+    {
+        viewPortletPages.add(portletPageRef);
+    }
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPage.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPage.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPage.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPage.java Mon May 23 13:51:31 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.portals.graffito.portlets.page.tab.Tab;
+
+/**
+ * Portlet Page
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public abstract class PortletPage
+{
+    /** Page ID */
+    private String id;
+    
+    /** Template assigned to this portlet page */
+    private String template;
+    
+    /** Action used to retrieve/refresh the portlet page */
+    private String action;
+    
+    /** True if it is the default page */
+    private boolean isDefaultPage;
+    
+    /** Velocity tabs (empty map is no tabs are defined in this page */
+    private Map tabs = new HashMap();
+
+    
+    public String getId()
+    {
+        return id;
+    }
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+    public String getTemplate()
+    {
+        return template;
+    }
+    
+    public void setTemplate(String template)
+    {
+        this.template = template;
+    }
+        
+    public String getAction()
+    {
+        return action;
+    }
+    
+    public void setAction(String action)
+    {
+        this.action = action;
+    }
+
+    
+    public boolean isDefaultPage()
+    {
+        return isDefaultPage;
+    }
+    
+    public void setDefaultPage(boolean isDefaultPage)
+    {
+        this.isDefaultPage = isDefaultPage;
+    }
+    
+    public Map getTabs()
+    {
+        return tabs;
+    }
+    
+    public void addTab(Tab tab)
+    {
+        tabs.put(tab.getId(), tab);
+    }
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPageRef.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPageRef.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPageRef.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPageRef.java Mon May 23 13:51:31 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page;
+
+/**
+ * Reference to a portlet page
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class PortletPageRef
+{
+    private String condition;
+    private String portletPageId;
+    
+    
+    public String getCondition()
+    {
+        return condition;
+    }
+    
+    public void setCondition(String condition)
+    {
+        this.condition = condition;
+    }
+    
+    public String getPortletPageId()
+    {
+        return portletPageId;
+    }
+    
+    public void setPortletPageId(String portletPageId)
+    {
+        this.portletPageId = portletPageId;
+    }
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPages.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPages.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPages.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/PortletPages.java Mon May 23 13:51:31 2005
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * All page associated to a portlet   
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class PortletPages
+{
+    private Map viewPages = new HashMap();   
+    private String defaultViewPageId = null;
+    
+    private Map editPages = new HashMap();
+    private String defaultEditPageId = null;
+    
+    private HashMap actions = new HashMap();
+    private String forwardActionId;
+       
+    protected Log log = LogFactory.getLog(PortletPages.class);
+       
+    public Map getEditPages()
+    {
+        return editPages;
+    }
+
+    
+    public void addEditPage(EditPortletPage editPortletPage)
+    {
+        editPages.put(editPortletPage.getId(), editPortletPage);   
+        if (editPortletPage.isDefaultPage())
+        {
+            defaultEditPageId = editPortletPage.getId();
+        }
+    }
+    
+    public Map getViewPages()
+    {
+        return viewPages;
+    }
+    
+    public void addViewPage(ViewPortletPage viewPortletPage)
+    {
+        viewPages.put(viewPortletPage.getId(), viewPortletPage);
+        if (viewPortletPage.isDefaultPage())
+        {
+            defaultViewPageId = viewPortletPage.getId();
+        }
+        
+    }
+    
+    
+    public Map getActions()
+    {
+        return actions;
+    }
+    
+    public void addAction (String id, String className, boolean isForwardAction)
+    {
+        actions.put(id, className);
+        if (isForwardAction)
+        {
+            this.forwardActionId = id;
+        }
+    }
+    
+    public String getDefaultEditPageId()
+    {
+        return defaultEditPageId;
+    }
+    
+    public void setDefaultEditPageId(String defaultEditPageId)
+    {
+        this.defaultEditPageId = defaultEditPageId;
+    }
+    
+    public String getDefaultViewPageId()
+    {
+        return defaultViewPageId;
+    }
+    
+    public void setDefaultViewPageId(String defaultViewPageId)
+    {
+        this.defaultViewPageId = defaultViewPageId;
+    }
+    
+    public String getForwardActionId()
+    {
+        return forwardActionId;
+    }
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/ViewPortletPage.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/ViewPortletPage.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/ViewPortletPage.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/ViewPortletPage.java Mon May 23 13:51:31 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page;
+
+import java.util.ArrayList;
+
+/**
+ * View portlet page is a page used in the view mode.
+ * When the end-user move to the edit mode, the editPortletPage will be used.
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class ViewPortletPage extends PortletPage
+{
+    private ArrayList editPortletPages = new ArrayList();
+    
+   
+    public ArrayList getEditPortletPages()
+    {
+        return editPortletPages;
+    }
+    
+    public void addEditPortletPageReference(PortletPageRef portletPageRef)
+    {
+        editPortletPages.add(portletPageRef);
+    }
+
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/action/PortletActionInfo.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/action/PortletActionInfo.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/action/PortletActionInfo.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/action/PortletActionInfo.java Mon May 23 13:51:31 2005
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page.action;
+
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+
+import org.apache.portals.graffito.portlets.page.manager.PortletPageManager;
+import org.apache.portals.graffito.portlets.upload.PortletDiskFileUpload;
+
+/**
+ * This class contain information on the action to execute. 
+ *
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class PortletActionInfo
+{
+    private String ACTION_SEPARATOR = "\\.";
+
+    private String id;
+
+    private String actionMethod;
+
+    private PortletDiskFileUpload diskFileUpload;
+    
+    private PortletRequest request;
+    
+    private PortletResponse response;
+    
+    private PortletPageManager portletPageManager;
+        
+    /**
+     * Constructor 
+     *    
+     * @param actionExpression This expression contain the action name & action method method to execute (eg. : "document.save") 
+     * @param request The action request
+     * @param response The action response
+     */
+    public PortletActionInfo(PortletPageManager portletPageManager, String actionExpression, PortletRequest request, PortletResponse response)
+    {
+        this.portletPageManager = portletPageManager;
+        String[] split = actionExpression.split(ACTION_SEPARATOR);
+        id = split[0];
+        actionMethod = split[1];
+        
+        this.request = request;
+        this.response = response;
+        
+
+    }
+
+    /**
+     * Constructor 
+     * 
+     * @param actionExpression This expression contain the action name & action method method to execute (eg. : "document.save") 
+     * @param request The action request
+     * @param response The action response
+     * @param diskFileUpload The Portlet disk upload
+     */
+    public PortletActionInfo(PortletPageManager portletPageManager, String actionExpression,  PortletRequest request, PortletResponse response, PortletDiskFileUpload diskFileUpload)
+    {
+        this(portletPageManager, actionExpression, request, response);
+        this.diskFileUpload = diskFileUpload;
+    }
+
+    /**
+     * Get the action name
+     * @return the action name
+     */
+    public String getId()
+    {
+        return id;
+    }
+
+    /**
+     * Get the action method
+     * @return the action method
+     */
+    public String getActionMethod()
+    {
+        return actionMethod;
+    }
+
+    /**
+     * Get the Portlet Disk file uplodad
+     * @return the portlet disk file upload
+     */
+    public PortletDiskFileUpload getDiskFileUpload()
+    {
+        return diskFileUpload;
+    }
+    
+    /**
+     * Get the portlet  request 
+     * @return the portlet request
+     */
+    public PortletRequest getRequest()
+    {
+        return request;
+    }
+    
+    /**
+     * Get the portlet action response
+     * @return the portlet action response
+     */
+    public PortletResponse getResponse()
+    {
+        return response;
+    }
+    
+    
+    public PortletPageManager getPortletPageManager()
+    {
+        return portletPageManager;
+    }
+    public void setPortletPageManager(PortletPageManager portletPageManager)
+    {
+        this.portletPageManager = portletPageManager;
+    }
+}
\ No newline at end of file

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageManager.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageManager.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageManager.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageManager.java Mon May 23 13:51:31 2005
@@ -0,0 +1,435 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page.manager;
+
+
+
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.Portlet;
+import javax.portlet.PortletException;
+import javax.portlet.PortletMode;
+import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.jexl.Expression;
+import org.apache.commons.jexl.ExpressionFactory;
+import org.apache.commons.jexl.JexlContext;
+import org.apache.commons.jexl.JexlHelper;
+import org.apache.portals.graffito.portlets.GraffitoPortlet;
+import org.apache.portals.graffito.portlets.page.EditPortletPage;
+import org.apache.portals.graffito.portlets.page.PortletPageRef;
+import org.apache.portals.graffito.portlets.page.PortletPages;
+import org.apache.portals.graffito.portlets.page.ViewPortletPage;
+import org.apache.portals.graffito.portlets.page.action.PortletActionInfo;
+import org.apache.portals.graffito.portlets.page.tab.Tab;
+import org.apache.portals.graffito.portlets.page.tab.TabPage;
+import org.apache.portals.graffito.portlets.upload.PortletDiskFileUpload;
+import org.apache.portals.graffito.portlets.upload.PortletFileUploadBase;
+import org.apache.portals.graffito.portlets.util.ExpressionUtil;
+import org.apache.velocity.context.Context;
+
+
+/**
+ * Portlet Page Manager. This manager provides a more cleaner code when the number of possible pages increase. 
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class PortletPageManager
+{
+    private GraffitoPortlet portlet;
+    private static final String ACTION_PREFIX = "portletAction_";    
+    private static final String FORWARD_PREFIX = "portletForward_";
+    
+    /** name of the page to forward to */
+    public static final String FORWARD_TO_PAGE = "forwardToPage";
+    
+    private static final String SELECTED_VIEW_PAGE_ID = "selectedViewPageId";
+    private static final String SELECTED_EDIT_PAGE_ID = "selectedEditPageId";   
+    
+
+    private static final String REQUEST_PARAM_SELECT_PAGE = "selectPage";
+    private static final String REQUEST_PARAM_SELECT_TAB = "selectTab";
+    
+    PortletPages portletPages;   
+    
+    
+    /**
+     * Constructor. 
+     * 
+     * Build a Portlet Page Manager from an xml file. This xml file should contains all pages.
+     * 
+     * @param xmlFile the xml file used to initialise the portlet page manager
+     * 
+     * @throws PortletException
+     * 
+     */
+    public PortletPageManager(Portlet portlet, String xmlFile)  throws PortletException
+    {        
+           this.portlet = (GraffitoPortlet) portlet;    
+           portletPages = PortletPageReader.loadPages(xmlFile);
+    }
+    
+    
+    public GraffitoPortlet getPortlet()
+    {
+        return portlet;
+    }
+    
+    public void addContextObject(RenderRequest request, String objectName, Object object)
+    {
+        // Add the object in the velocity context in order to use it in the template
+        Context velocityContext = portlet.getContext(request);
+        velocityContext.put(objectName, object);
+        
+        request.setAttribute(objectName, object);
+    }
+    
+    public Object getContextObject(RenderRequest request, String objectName)
+    {
+        return request.getAttribute(objectName);
+    }
+    
+    public Enumeration getAllContextObjectNames(RenderRequest request)
+    {
+           return request.getAttributeNames();
+    }
+    
+    /**
+     * Process the action used for the view mode on the selected page
+     *  
+     * @param request The portlet request
+     * @param response The portlet response
+     *  
+     * @throws PortletException   
+     */
+    public void doView(RenderRequest request, RenderResponse response) throws PortletException
+    {
+        ViewPortletPage portletPage = this.getSelectedViewPage(request);
+        request.setAttribute( GraffitoPortlet.PARAM_VIEW_PAGE, portletPage.getTemplate());
+        String actionName = portletPage.getAction();                    
+        // process the portlet page action
+        this.processAction(portlet, actionName, request, response);
+        
+        // For each tab, process action on the select tab page
+        Map tabs = portletPage.getTabs();
+        Iterator tabsIterator = tabs.values().iterator();
+        while (tabsIterator.hasNext())
+        {
+            Tab tab = (Tab) tabsIterator.next();
+            TabPage tabPage = tab.getSelectedPage(request);
+            actionName = tabPage.getAction();
+            this.processAction(portlet, actionName, request, response);
+        }
+        
+        // Init the corresponding template used in the edit mode
+        Collection editPortlePageRefs = portletPage.getEditPortletPages();
+        Iterator editPortlePageRefsIterator = editPortlePageRefs.iterator();
+        while(editPortlePageRefsIterator.hasNext())
+        {
+            PortletPageRef portletPageRef = (PortletPageRef) editPortlePageRefsIterator.next();
+            String condition = portletPageRef.getCondition();
+            if ( condition == null || condition.equals("") || ExpressionUtil.checkCondition(request, condition))
+            {
+              this.setSelectedEditPageId(request, portletPageRef.getPortletPageId());
+              return ;
+            }
+        }
+        this.setSelectedEditPageId(request, portletPages.getDefaultEditPageId());
+        
+        
+    }
+    
+    /**
+     * Process the action used for the edit mode on the selected page
+     *     
+     * @param request The portlet request
+     * @param response The portlet response
+     *      
+     * @throws PortletException   
+     */
+    public void doEdit(RenderRequest request, RenderResponse response) throws PortletException
+    {
+        EditPortletPage portletPage = this.getSelectedEditPage(request);
+        String actionName = portletPage.getAction();            
+        request.setAttribute( GraffitoPortlet.PARAM_EDIT_PAGE, portletPage.getTemplate());
+        // process the portlet page action
+        this.processAction(portlet, actionName, request, response);
+        
+        // process action on each tab (selected paged in those tabs)
+        Map tabs = portletPage.getTabs();
+        Iterator tabsIterator = tabs.values().iterator();
+        while (tabsIterator.hasNext())
+        {
+            Tab tab = (Tab) tabsIterator.next();
+            TabPage tabPage = tab.getSelectedPage(request);
+            actionName = tabPage.getAction();
+            this.processAction(portlet, actionName, request, response);
+        }
+
+        // Init the corresponding template used in the edit mode
+        Collection viewPortlePageRefs = portletPage.getViewPortletPages();
+        Iterator viewPortlePageRefsIterator = viewPortlePageRefs.iterator();
+        while(viewPortlePageRefsIterator.hasNext())
+        {
+            PortletPageRef portletPageRef = (PortletPageRef) viewPortlePageRefsIterator.next();
+            String condition = portletPageRef.getCondition();
+            if ( condition == null || condition.equals("") || ExpressionUtil.checkCondition(request, condition))
+            {           
+                this.setSelectedViewPageId(request, portletPageRef.getPortletPageId());
+                return ;
+            }
+        }
+        this.setSelectedViewPageId(request, portletPages.getDefaultViewPageId());
+        
+    }
+    
+    
+    public EditPortletPage getSelectedEditPage(PortletRequest request)
+    {
+        String selectedEditPageId = (String) request.getPortletSession().getAttribute(SELECTED_EDIT_PAGE_ID);
+        if (selectedEditPageId == null)
+        {
+            selectedEditPageId = portletPages.getDefaultEditPageId();
+            request.getPortletSession().setAttribute(SELECTED_EDIT_PAGE_ID, selectedEditPageId);
+        }
+        return (EditPortletPage) portletPages.getEditPages().get(selectedEditPageId);
+    }
+    
+    public void setSelectedEditPageId(PortletRequest request, String selectedEdiPageId)
+    {
+        request.getPortletSession().setAttribute(SELECTED_EDIT_PAGE_ID, selectedEdiPageId);
+    }
+    
+    
+    public ViewPortletPage getSelectedViewPage(PortletRequest request)
+    {
+        String selectedViewPageId = (String) request.getPortletSession().getAttribute(SELECTED_VIEW_PAGE_ID);
+        if (selectedViewPageId == null)
+        {
+            selectedViewPageId = portletPages.getDefaultViewPageId();
+            request.getPortletSession().setAttribute(SELECTED_VIEW_PAGE_ID, selectedViewPageId);
+        }
+        return (ViewPortletPage) portletPages.getViewPages().get(selectedViewPageId);
+    }
+    
+    
+    public void setSelectedViewPageId(PortletRequest request, String selectedViewPageId)
+    {
+        request.getPortletSession().setAttribute(SELECTED_VIEW_PAGE_ID, selectedViewPageId);
+    }
+    
+    /**
+     * Process an action from a portlet. The action name is defined in the portlet request
+     * 
+     * @param portlet The portlet from which the action has been triggered
+     * @param request The portlet request
+     * @param response The portlet response
+     * 
+     * @return The portlet action info or null if no action has been executed 
+     * @throws PortletException   
+     */
+    public PortletActionInfo processAction(Portlet portlet, PortletRequest request, PortletResponse response) throws PortletException
+    {
+        
+        // Check if a new tab page has been selected
+        String tabId = request.getParameter(REQUEST_PARAM_SELECT_TAB);
+        if (tabId != null)
+        {
+
+            Map tabs = null;
+            if (request.getPortletMode().equals(PortletMode.VIEW))
+            {
+               tabs = this.getSelectedViewPage(request).getTabs();
+            }
+            else
+            {
+                tabs = this.getSelectedEditPage(request).getTabs();
+            }
+
+            Tab tab = (Tab) tabs.get(tabId);
+            if (tab == null)
+            {
+                throw new PortletException("Impossible to find the tab : " + tabId);
+            }
+
+            String pageId = request.getParameter(REQUEST_PARAM_SELECT_PAGE);
+
+            if (pageId == null)
+            {
+                throw new PortletException("Impossible to find the selected page : " + pageId);
+            }
+
+            tab.setSelectedPage(request, pageId);
+            
+        }            
+        
+        PortletActionInfo portletActionInfo = getSelectedAction(portlet, request, response);
+        if (executePortletAction(portletActionInfo))
+        {
+            return portletActionInfo;
+        }
+        else
+        {
+            return null;
+        }
+    }
+    
+    /**
+     * Process an action from a portlet
+     * 
+     * @param portlet The portlet from which the action has been triggered
+     * @param actionName the action to execute (eg. folder.retrieve)
+     * @param request The portlet request
+     * @param response The portlet response
+     * 
+     * @return The portlet action info or null if no action has been executed 
+     * @throws PortletException   
+     */
+    public PortletActionInfo processAction(Portlet portlet, String actionName, PortletRequest request, PortletResponse response) throws PortletException
+    {
+        if (actionName == null)
+        {
+            return null;
+        }
+        
+        PortletActionInfo portletActionInfo = new PortletActionInfo(this, actionName, request, response);
+        if (executePortletAction(portletActionInfo))
+        {
+            return portletActionInfo;
+        }
+        else
+        {
+            return null;
+        }
+    }
+    
+    /**
+     * Get information the selected action
+     * @param portlet The portlet from which the action has been triggered
+     * @param request The portlet request
+     * @param response The portlet response
+     * @return information on the selected action ({@link PortletActionInfo})
+     * 
+     * @throws PortletException
+     */
+    public PortletActionInfo getSelectedAction(Portlet portlet, PortletRequest request, PortletResponse response) throws PortletException
+    {
+        //-------------------------------------------------------------------------------------------
+        // ! MULTIPART REQUEST
+        //-------------------------------------------------------------------------------------------
+        if (request instanceof RenderRequest || !PortletFileUploadBase.isMultipartContent((ActionRequest)request))
+        {
+            Enumeration parameterNames = request.getParameterNames();
+            while (parameterNames.hasMoreElements())
+            {
+                String parameterName = (String) parameterNames.nextElement();
+                if (parameterName.startsWith(ACTION_PREFIX))
+                {
+                    String actionName = parameterName.substring(ACTION_PREFIX.length());
+                    return new PortletActionInfo(this, actionName, request, response);
+                }
+                
+                if (parameterName.startsWith(FORWARD_PREFIX))
+                {
+                    String forwardToPage = parameterName.substring(FORWARD_PREFIX.length());
+                    request.setAttribute(FORWARD_TO_PAGE, forwardToPage);
+                    return new PortletActionInfo(this, portletPages.getForwardActionId() + ".forward", request, response);
+                }
+                
+            }
+            return null;
+        }
+        
+        //-------------------------------------------------------------------------------------------
+        // MULTIPART REQUEST
+        // ------------------------------------------------------------------------------------------                
+        else
+        {
+            try
+            {
+                PortletDiskFileUpload diskFileUpload =  new PortletDiskFileUpload();
+                Iterator fileItemIterator = diskFileUpload.getFileItems((ActionRequest)request).iterator();
+                while(fileItemIterator.hasNext())
+                {
+                    FileItem fileItem = (FileItem) fileItemIterator.next();
+                    if( (fileItem.isFormField()) && (fileItem.getFieldName().startsWith(ACTION_PREFIX)))
+                    {
+                        String actionName = fileItem.getFieldName().substring(ACTION_PREFIX.length());
+                        return new PortletActionInfo(this, actionName, request, response, diskFileUpload);
+                    }
+                }
+                return null;
+            }
+            catch (FileUploadException e)
+            {
+                throw new PortletException("Impossible to select the action portlet", e);                
+            }
+            
+        }
+    }
+    
+    /**
+     * Execute the desised action 
+     * 
+     * @param portletActionInfo
+     * @return true if the action is executed correctly, false when portlet info is null or when the action class is not found
+     * @throws PortletException when mainly a method invocation exception occurs
+     */
+    private boolean executePortletAction(PortletActionInfo portletActionInfo) throws PortletException
+    {
+        try
+        {
+           if (portletActionInfo == null)
+           {
+               return false;    
+           }
+           
+           String className = (String)  portletPages.getActions().get(portletActionInfo.getId());
+           Class actionClass = Class.forName(className);
+
+           // No action found  
+           if (actionClass == null)
+           {
+               return false;
+           }
+           
+           Object action = actionClass.newInstance();
+           Class[] argClasses = {PortletActionInfo.class};
+           Object[] args = {portletActionInfo};
+           Method method = actionClass.getMethod(portletActionInfo.getActionMethod(), argClasses);           
+           method.invoke(action, args);
+           return true;
+        }
+        catch(Exception e)
+        {
+            throw new PortletException("Failed to execute method :" + portletActionInfo.getId() + '.' + portletActionInfo.getActionMethod(), e); 
+        }
+    }
+    
+    
+    
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageReader.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageReader.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageReader.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/manager/PortletPageReader.java Mon May 23 13:51:31 2005
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page.manager;
+
+import java.io.File;
+
+import javax.portlet.PortletException;
+
+import org.apache.commons.digester.Digester;
+
+import org.apache.portals.graffito.portlets.page.EditPortletPage;
+import org.apache.portals.graffito.portlets.page.PortletPageRef;
+import org.apache.portals.graffito.portlets.page.PortletPages;
+import org.apache.portals.graffito.portlets.page.ViewPortletPage;
+import org.apache.portals.graffito.portlets.page.tab.Tab;
+import org.apache.portals.graffito.portlets.page.tab.TabPage;
+
+/**
+ * This utility class build a {@link org.apache.portals.graffito.portlets.page.PortletPages}
+ * from a xml config file. 
+ * 
+ * @author <a href="mailto:christophe.lombart@gmail.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class PortletPageReader
+{
+
+    /**
+     * Load all edit/view pages found in the config file
+     * @param xmlFile
+     */
+    public static PortletPages loadPages(String xmlFile) throws PortletException
+    {
+        try {
+            Digester digester = new Digester();
+            digester.setValidating( false );
+
+            digester.addObjectCreate( "pages", PortletPages.class );
+
+            // --------------------------------------------------------------------------------
+            // Rules used for the actions
+            // --------------------------------------------------------------------------------
+            Class[] methodArgs = { String.class, String.class, Boolean.class};
+            digester.addCallMethod("pages/actions/action", "addAction", 3, methodArgs);
+            digester.addCallParam("pages/actions/action", 0, "id");
+            digester.addCallParam("pages/actions/action", 1, "class");
+            digester.addCallParam("pages/actions/action", 2, "forward");
+            
+            // --------------------------------------------------------------------------------
+            // Rules used for the view pages
+            // --------------------------------------------------------------------------------
+            digester.addObjectCreate( "pages/view/page", ViewPortletPage.class );
+            digester.addSetProperties( "pages/view/page", "id", "id" );
+            digester.addSetProperties( "pages/view/page", "action", "action" );
+            digester.addSetProperties( "pages/view/page", "template", "template" );
+            digester.addSetProperties( "pages/view/page", "defaultPage", "isDefaultPage" );
+            digester.addSetNext( "pages/view/page", "addViewPage" );
+            digester.addObjectCreate( "pages/view/page/tab", Tab.class );
+            digester.addSetProperties( "pages/view/page/tab", "id", "id" );
+            digester.addSetNext( "pages/view/page/tab", "addTab" );
+            
+            digester.addObjectCreate( "pages/view/page/tab/page", TabPage.class );
+            digester.addSetProperties( "pages/view/page/tab/page", "id", "id" );
+            digester.addSetProperties( "pages/view/page/tab/page", "label", "label" );
+            digester.addSetProperties( "pages/view/page/tab/page", "template", "template" );
+            digester.addSetProperties( "pages/view/page/tab/page", "action", "action" );
+            digester.addSetProperties( "pages/view/page/tab/page", "isDefaultTabPage", "defaultTabPage" );
+            digester.addSetProperties( "pages/view/page/tab/page", "condition", "condition" );
+            digester.addSetNext( "pages/view/page/tab/page", "addPage" );                                   
+            
+            digester.addObjectCreate( "pages/view/page/editpage", PortletPageRef.class );
+            digester.addSetProperties( "pages/view/page/editpage", "condition", "condition" );
+            digester.addSetProperties( "pages/view/page/editpage", "portletPageId", "portletPageId" );
+            digester.addSetNext( "pages/view/page/editpage", "addEditPortletPageReference" );
+
+            // --------------------------------------------------------------------------------
+            // Rules used for the edit pages
+            // --------------------------------------------------------------------------------            
+            digester.addObjectCreate( "pages/edit/page", EditPortletPage.class );
+            digester.addSetProperties( "pages/edit/page", "id", "id" );
+            digester.addSetProperties( "pages/edit/page", "action", "action" );
+            digester.addSetProperties( "pages/edit/page", "template", "template" );
+            digester.addSetProperties( "pages/edit/page", "defaultPage", "isDefaultPage" );
+            digester.addSetNext( "pages/edit/page", "addEditPage" );
+            
+            digester.addObjectCreate( "pages/edit/page/tab", Tab.class );
+            digester.addSetProperties( "pages/edit/page/tab", "id", "id" );
+            digester.addSetNext( "pages/edit/page/tab", "addTab" );
+            
+            digester.addObjectCreate( "pages/edit/page/tab/page", TabPage.class );
+            digester.addSetProperties( "pages/edit/page/tab/page", "id", "id" );
+            digester.addSetProperties( "pages/edit/page/tab/page", "label", "label" );
+            digester.addSetProperties( "pages/edit/page/tab/page", "template", "template" );
+            digester.addSetProperties( "pages/edit/page/tab/page", "action", "action" );
+            digester.addSetProperties( "pages/edit/page/tab/page", "isDefaultTabPage", "defaultTabPage" );
+            digester.addSetNext( "pages/edit/page/tab/page", "addPage" );                                   
+            
+            digester.addObjectCreate( "pages/edit/page/viewpage", PortletPageRef.class );
+            digester.addSetProperties( "pages/edit/page/viewpage", "condition", "condition" );
+            digester.addSetProperties( "pages/edit/page/viewpage", "portletPageId", "portletPageId" );
+            digester.addSetNext( "pages/edit/page/viewpage", "addViewPortletPageReference" );
+            
+
+            File input = new File(xmlFile);
+            PortletPages portletPages = (PortletPages)digester.parse( input );
+
+            return portletPages;
+
+         } catch( Exception e ) 
+         {
+            throw new PortletException("Impossible to read the portlet pages from : " + xmlFile, e);
+         }        
+        
+    }
+    
+   
+}
\ No newline at end of file

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/Tab.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/Tab.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/Tab.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/Tab.java Mon May 23 13:51:31 2005
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page.tab;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.portlet.PortletRequest;
+
+import org.apache.portals.graffito.portlets.util.ExpressionUtil;
+
+/**
+ * Velocity Tab contains a set of {@link org.apache.portals.graffito.portlets.page.tab.TabPage}
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class Tab
+{
+    
+     private static String SELECTED_TAB_PAGE_ID ="selectedTabPageId";
+     
+     private HashMap tabPages = new HashMap();    
+     private String id;
+     
+    
+     public String getId()
+     {
+         return id;
+     }
+     
+     public void setId(String id)
+     {
+         this.id = id;
+     }     
+     
+     public void addPage(TabPage page)
+     {         
+         tabPages.put(page.getId(), page);
+     }
+     
+     public TabPage[] getPages(PortletRequest request)
+     {       
+         ArrayList result = new ArrayList();
+         Iterator tabPageIterator =  tabPages.values().iterator();
+         while (tabPageIterator.hasNext())
+         {
+             TabPage tabPage = (TabPage) tabPageIterator.next();
+             String condition = tabPage.getCondition();
+             if ((condition == null) || (condition.equals("")) ||
+                  (ExpressionUtil.checkCondition(request, tabPage.getCondition())))
+             {
+                  result.add(tabPage);
+             }
+         }
+         
+         return (TabPage[]) result.toArray(new TabPage[result.size()]);
+     }
+     
+     public TabPage getSelectedPage(PortletRequest request)
+     {
+         TabPage tabPage = null;
+         
+         String selectedPageId = (String) request.getPortletSession().getAttribute(SELECTED_TAB_PAGE_ID);
+         if (selectedPageId != null)
+         {
+            // Check if the selected tab page can be display for the current cms object
+            tabPage = (TabPage) tabPages.get(selectedPageId);
+            if (tabPage != null)
+            {
+                String condition = tabPage.getCondition();
+                if ((condition != null) && (!condition.equals(""))
+                        && (!ExpressionUtil.checkCondition(request, tabPage.getCondition())))
+                {
+                    tabPage = null;
+                }
+            }
+
+         }
+                          
+         if (tabPage == null )    
+         {
+             TabPage[] tabPages = this.getPages(request);
+             for (int tabPageIndex =0; tabPageIndex <tabPages.length; tabPageIndex++)
+             {
+                 if (tabPages[tabPageIndex].isDefaultTabPage())
+                 {
+                     selectedPageId = tabPages[tabPageIndex].getId();
+                     tabPage = tabPages[tabPageIndex];
+                     break;
+                 }
+             }
+             
+             request.getPortletSession().setAttribute(SELECTED_TAB_PAGE_ID, selectedPageId);
+         }
+                  
+         return tabPage;
+     }
+     
+     public void setSelectedPage(PortletRequest request, String pageId)
+     {
+         request.getPortletSession().setAttribute(SELECTED_TAB_PAGE_ID, pageId);
+          
+     }
+     
+     public boolean isSelected(PortletRequest request, TabPage page)
+     {
+         return page.getId().equals(this.getSelectedPage(request).getId());   
+     }
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/TabPage.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/TabPage.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/TabPage.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/page/tab/TabPage.java Mon May 23 13:51:31 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.portals.graffito.portlets.page.tab;
+
+/**
+ * Information on one page in a Tab. See {@link org.apache.portals.graffito.portlets.page.tab.Tab}
+ * 
+ * @author <a href="mailto:christophe.lombart@sword-technologies.com">Lombart Christophe </a>
+ * @version $Id: Exp $
+ */
+public class TabPage
+{
+    private String id;
+    private String label;
+    private String template;    
+    private String action;
+    private String condition;
+    private boolean isDefaultTabPage;
+
+    
+    
+    public String getId()
+    {
+        return id;
+    }
+    public void setId(String id)
+    {
+        this.id = id;
+    }
+    
+    public String getLabel()
+    {
+        return label;
+    }
+    public void setLabel(String label)
+    {
+        this.label = label;
+    }
+    public String getTemplate()
+    {
+        return template;
+    }
+    public void setTemplate(String template)
+    {
+        this.template = template;
+    }
+    
+    
+    public String getAction()
+    {
+        return action;
+    }
+    public void setAction(String action)
+    {
+        this.action = action;
+    }
+    
+    
+    public boolean isDefaultTabPage()
+    {
+        return isDefaultTabPage;
+    }
+    
+    public void setDefaultTabPage(boolean isDefaultTabPage)
+    {
+        this.isDefaultTabPage = isDefaultTabPage;
+    }
+    
+    
+    public String getCondition()
+    {
+        return condition;
+    }
+    public void setCondition(String condition)
+    {
+        this.condition = condition;
+    }
+}

Added: incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/upload/PortletDiskFileUpload.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/upload/PortletDiskFileUpload.java?rev=178016&view=auto
==============================================================================
--- incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/upload/PortletDiskFileUpload.java (added)
+++ incubator/graffito/trunk/applications/framework-portlets/src/java/org/apache/portals/graffito/portlets/upload/PortletDiskFileUpload.java Mon May 23 13:51:31 2005
@@ -0,0 +1,202 @@
+/*
+ * Copyright 2000-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
+ * License. You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
+ * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+package org.apache.portals.graffito.portlets.upload;
+
+
+import java.io.File;
+import java.util.List;
+import javax.portlet.ActionRequest;
+
+import org.apache.commons.fileupload.DefaultFileItemFactory;
+import org.apache.commons.fileupload.FileItemFactory;
+import org.apache.commons.fileupload.FileUploadException;
+
+
+
+/**
+ * <p>High level API for processing file uploads.</p>
+ *
+ * <p>This class handles multiple files per single HTML widget, sent using
+ * <code>multipart/mixed</code> encoding type, as specified by
+ * <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>.  Use {@link
+ * #parseRequest(HttpServletRequest)} to acquire a list of {@link
+ * org.apache.commons.fileupload.FileItem}s associated with a given HTML
+ * widget.</p>
+ *
+ * <p>Individual parts will be stored in temporary disk storage or in memory,
+ * depending on their size, and will be available as {@link
+ * org.apache.commons.fileupload.FileItem}s.</p>
+ *
+ * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
+ * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
+ * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
+ * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
+ * @author <a href="mailto:martinc@apache.org">Martin Cooper</a>
+ * @author Sean C. Sullivan
+ *
+ * @version $Id: Exp $
+ */
+public class PortletDiskFileUpload
+    extends PortletFileUploadBase
+ {
+
+    // ----------------------------------------------------------- Data members
+
+
+    /**
+     * The factory to use to create new form items.
+     */
+    private DefaultFileItemFactory fileItemFactory;
+
+
+    // ----------------------------------------------------------- Constructors
+
+
+    /**
+     * Constructs an instance of this class which uses the default factory to
+     * create <code>FileItem</code> instances.
+     *
+     * @see #DiskFileUpload(DefaultFileItemFactory fileItemFactory)
+     */
+    public PortletDiskFileUpload()
+    {
+        super();
+        this.fileItemFactory = new DefaultFileItemFactory();
+    }
+
+
+    /**
+     * Constructs an instance of this class which uses the supplied factory to
+     * create <code>FileItem</code> instances.
+     *
+     * @see #DiskFileUpload()
+     */
+    public PortletDiskFileUpload(DefaultFileItemFactory fileItemFactory)
+    {
+        super();
+        this.fileItemFactory = fileItemFactory;
+    }
+
+
+    // ----------------------------------------------------- Property accessors
+
+
+    /**
+     * Returns the factory class used when creating file items.
+     *
+     * @return The factory class for new file items.
+     */
+    public FileItemFactory getFileItemFactory()
+    {
+        return fileItemFactory;
+    }
+
+
+    /**
+     * Sets the factory class to use when creating file items. The factory must
+     * be an instance of <code>DefaultFileItemFactory</code> or a subclass
+     * thereof, or else a <code>ClassCastException</code> will be thrown.
+     *
+     * @param factory The factory class for new file items.
+     */
+    public void setFileItemFactory(FileItemFactory factory)
+    {
+        this.fileItemFactory = (DefaultFileItemFactory) factory;
+    }
+
+
+    /**
+     * Returns the size threshold beyond which files are written directly to
+     * disk.
+     *
+     * @return The size threshold, in bytes.
+     *
+     * @see #setSizeThreshold(int)
+     */
+    public int getSizeThreshold()
+    {
+        return fileItemFactory.getSizeThreshold();
+    }
+
+
+    /**
+     * Sets the size threshold beyond which files are written directly to disk.
+     *
+     * @param sizeThreshold The size threshold, in bytes.
+     *
+     * @see #getSizeThreshold()
+     */
+    public void setSizeThreshold(int sizeThreshold)
+    {
+        fileItemFactory.setSizeThreshold(sizeThreshold);
+    }
+
+
+    /**
+     * Returns the location used to temporarily store files that are larger
+     * than the configured size threshold.
+     *
+     * @return The path to the temporary file location.
+     *
+     * @see #setRepositoryPath(String)
+     */
+    public String getRepositoryPath()
+    {
+        return fileItemFactory.getRepository().getPath();
+    }
+
+
+    /**
+     * Sets the location used to temporarily store files that are larger
+     * than the configured size threshold.
+     *
+     * @param repositoryPath The path to the temporary file location.
+     *
+     * @see #getRepositoryPath()
+     */
+    public void setRepositoryPath(String repositoryPath)
+    {
+        fileItemFactory.setRepository(new File(repositoryPath));
+    }
+
+
+    // --------------------------------------------------------- Public methods
+
+
+    /**
+     * Processes an <a href="http://www.ietf.org/rfc/rfc1867.txt">RFC 1867</a>
+     * compliant <code>multipart/form-data</code> stream. If files are stored
+     * on disk, the path is given by <code>getRepository()</code>.
+     *
+     * @param req           The servlet request to be parsed. Must be non-null.
+     * @param sizeThreshold The max size in bytes to be stored in memory.
+     * @param sizeMax       The maximum allowed upload size, in bytes.
+     * @param path          The location where the files should be stored.
+     *
+     * @return A list of <code>FileItem</code> instances parsed from the
+     *         request, in the order that they were transmitted.
+     *
+     * @exception FileUploadException if there are problems reading/parsing
+     *                                the request or storing files.
+     */
+    public List parseRequest(ActionRequest req, int sizeThreshold, long sizeMax, String path)
+        throws FileUploadException
+    {
+        setSizeThreshold(sizeThreshold);
+        setSizeMax(sizeMax);
+        setRepositoryPath(path);
+        return parseRequest(req);
+    }
+
+}