JBoss PortletSwap SVN: r251 - in contrib/wikiPortlet/trunk: wiki-test and 1 other directories.
by portletswap-commits@lists.jboss.org
Author: piergiorgiolucidi
Date: 2009-03-03 14:23:14 -0500 (Tue, 03 Mar 2009)
New Revision: 251
Removed:
contrib/wikiPortlet/trunk/WebRoot/
contrib/wikiPortlet/trunk/lib/
contrib/wikiPortlet/trunk/wiki-test/WEB-INF/web.xml
Modified:
contrib/wikiPortlet/trunk/wiki-test/pom.xml
Log:
bugfix: changed webroot directory for wiki-test
Deleted: contrib/wikiPortlet/trunk/wiki-test/WEB-INF/web.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/WEB-INF/web.xml 2009-03-03 18:56:10 UTC (rev 250)
+++ contrib/wikiPortlet/trunk/wiki-test/WEB-INF/web.xml 2009-03-03 19:23:14 UTC (rev 251)
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
-
-
-
-
-</web-app>
-
Modified: contrib/wikiPortlet/trunk/wiki-test/pom.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/pom.xml 2009-03-03 18:56:10 UTC (rev 250)
+++ contrib/wikiPortlet/trunk/wiki-test/pom.xml 2009-03-03 19:23:14 UTC (rev 251)
@@ -53,8 +53,8 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
- <webappDirectory>${basedir}</webappDirectory>
- <warSourceDirectory>${basedir}</warSourceDirectory>
+ <webappDirectory>${basedir}/src/web/</webappDirectory>
+ <warSourceDirectory>${basedir}/src/web/</warSourceDirectory>
<warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
<excludes>**/.svn/**</excludes>
<warName>wiki-test</warName>
15 years, 2 months
JBoss PortletSwap SVN: r250 - contrib/wikiPortlet/trunk.
by portletswap-commits@lists.jboss.org
Author: piergiorgiolucidi
Date: 2009-03-03 13:56:10 -0500 (Tue, 03 Mar 2009)
New Revision: 250
Added:
contrib/wikiPortlet/trunk/.mymetadata
contrib/wikiPortlet/trunk/assembly.xml
Modified:
contrib/wikiPortlet/trunk/.classpath
contrib/wikiPortlet/trunk/.project
contrib/wikiPortlet/trunk/pom.xml
Log:
- Portal 2.7.x support: configuration files, TODO delete old Maven files
Modified: contrib/wikiPortlet/trunk/.classpath
===================================================================
--- contrib/wikiPortlet/trunk/.classpath 2009-03-03 18:54:59 UTC (rev 249)
+++ contrib/wikiPortlet/trunk/.classpath 2009-03-03 18:56:10 UTC (rev 250)
@@ -1,12 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="wiki-management/src/java"/>
- <classpathentry kind="src" path="wiki-test/src/java"/>
- <classpathentry kind="src" path="wiki-test/src/etc"/>
- <classpathentry kind="src" path="wiki-common/src/etc"/>
- <classpathentry kind="src" path="wiki-common/src/java"/>
- <classpathentry kind="src" path="wiki-management/src/test"/>
+ <classpathentry kind="src" output="WebRoot/WEB-INF/classes" path="wiki-management/src/java"/>
+ <classpathentry kind="src" output="WebRoot/WEB-INF/classes" path="forge-wiki/src/java"/>
+ <classpathentry kind="src" output="WebRoot/WEB-INF/classes" path="forge-wiki/src/test"/>
+ <classpathentry kind="src" output="WebRoot/WEB-INF/classes" path="wiki-test/src/java"/>
+ <classpathentry kind="src" output="WebRoot/WEB-INF/classes" path="wiki-test/src/etc"/>
+ <classpathentry kind="src" output="WebRoot/WEB-INF/classes" path="wiki-common/src/etc"/>
+ <classpathentry kind="src" output="WebRoot/WEB-INF/classes" path="wiki-common/src/java"/>
+ <classpathentry kind="src" output="WebRoot/WEB-INF/classes" path="wiki-management/src/test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="output" path="WebRoot/WEB-INF/classes"/>
</classpath>
Added: contrib/wikiPortlet/trunk/.mymetadata
===================================================================
--- contrib/wikiPortlet/trunk/.mymetadata (rev 0)
+++ contrib/wikiPortlet/trunk/.mymetadata 2009-03-03 18:56:10 UTC (rev 250)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project-module
+ type="WEB"
+ name="JBossWiki"
+ id="myeclipse.1235499040360"
+ context-root="/"
+ j2ee-spec="5.0"
+ archive="JBossWiki.war">
+ <attributes>
+ <attribute name="webrootdir" value="WebRoot" />
+ </attributes>
+</project-module>
+
Modified: contrib/wikiPortlet/trunk/.project
===================================================================
--- contrib/wikiPortlet/trunk/.project 2009-03-03 18:54:59 UTC (rev 249)
+++ contrib/wikiPortlet/trunk/.project 2009-03-03 18:56:10 UTC (rev 250)
@@ -6,17 +6,38 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>com.genuitec.eclipse.j2eedt.core.WebClasspathBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
+ <name>com.genuitec.eclipse.j2eedt.core.J2EEProjectValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>com.genuitec.eclipse.j2eedt.core.DeploymentDescriptorValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
+ <nature>com.genuitec.eclipse.j2eedt.core.webnature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
Added: contrib/wikiPortlet/trunk/assembly.xml
===================================================================
Modified: contrib/wikiPortlet/trunk/pom.xml
===================================================================
--- contrib/wikiPortlet/trunk/pom.xml 2009-03-03 18:54:59 UTC (rev 249)
+++ contrib/wikiPortlet/trunk/pom.xml 2009-03-03 18:56:10 UTC (rev 250)
@@ -1,13 +1,11 @@
-<!--
- JBoss, the OpenSource J2EE webOS Distributable under LGPL license. See
- terms of license at gnu.org.
- Maven manual install: portal-core-lib.jar
- portal-portlet-lib javax-servlet.jar javax-servlet-jsp.jar
- activation.jar jboss-ejb3x.jar jboss-ejb3.jar portal-identity-lib.jar
- jboss-portlet-api-lib.jar
-
- author: Piergiorgio Lucidi
--->
+
+ <!--
+ JBoss, the OpenSource J2EE webOS Distributable under LGPL license. See
+ terms of license at gnu.org. Maven manual install: portal-core-lib.jar
+ portal-portlet-lib javax-servlet.jar javax-servlet-jsp.jar
+ activation.jar jboss-ejb3x.jar jboss-ejb3.jar portal-identity-lib.jar
+ jboss-portlet-api-lib.jar author: Piergiorgio Lucidi
+ -->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -81,7 +79,7 @@
<dependency>
<groupId>jboss</groupId>
<artifactId>portal-identity-lib</artifactId>
- <version>1.0</version>
+ <version>2.7.1</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -138,5 +136,34 @@
<version>1.0</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>5.0-1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-api-lib</artifactId>
+ <version>2.7.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ </dependency>
</dependencies>
</project>
15 years, 2 months
JBoss PortletSwap SVN: r249 - in contrib/wikiPortlet/trunk: wiki-test and 11 other directories.
by portletswap-commits@lists.jboss.org
Author: piergiorgiolucidi
Date: 2009-03-03 13:54:59 -0500 (Tue, 03 Mar 2009)
New Revision: 249
Added:
contrib/wikiPortlet/trunk/wiki-test/
contrib/wikiPortlet/trunk/wiki-test/.classpath
contrib/wikiPortlet/trunk/wiki-test/.project
contrib/wikiPortlet/trunk/wiki-test/.settings/
contrib/wikiPortlet/trunk/wiki-test/.settings/org.hibernate.eclipse.console.prefs
contrib/wikiPortlet/trunk/wiki-test/META-INF/
contrib/wikiPortlet/trunk/wiki-test/WEB-INF/
contrib/wikiPortlet/trunk/wiki-test/WEB-INF/web.xml
contrib/wikiPortlet/trunk/wiki-test/maven.xml
contrib/wikiPortlet/trunk/wiki-test/pom.xml
contrib/wikiPortlet/trunk/wiki-test/project.properties
contrib/wikiPortlet/trunk/wiki-test/project.xml
contrib/wikiPortlet/trunk/wiki-test/src/
contrib/wikiPortlet/trunk/wiki-test/src/etc/
contrib/wikiPortlet/trunk/wiki-test/src/etc/testing-ideas.txt
contrib/wikiPortlet/trunk/wiki-test/src/java/
contrib/wikiPortlet/trunk/wiki-test/src/java/org/
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/AttachmentTest.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/DictionaryTest.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/FindPagesTest.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/GetSavePageTest.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/PageModsTest.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/PropsTest.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/SubPagesTest.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/TestCredentials.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/TestWikiSession.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/WikiTest.java
contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/WikiTestException.java
contrib/wikiPortlet/trunk/wiki-test/src/web/
contrib/wikiPortlet/trunk/wiki-test/src/web/WEB-INF/
contrib/wikiPortlet/trunk/wiki-test/src/web/WEB-INF/web.xml
Log:
- Portal 2.7.x support: wiki-test
Added: contrib/wikiPortlet/trunk/wiki-test/.classpath
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/.classpath (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/.classpath 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="lib" path="src/web/WEB-INF/lib/junitee.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: contrib/wikiPortlet/trunk/wiki-test/.project
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/.project (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/.project 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>wiki-test</name>
+ <comment></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>
Added: contrib/wikiPortlet/trunk/wiki-test/.settings/org.hibernate.eclipse.console.prefs
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/.settings/org.hibernate.eclipse.console.prefs (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/.settings/org.hibernate.eclipse.console.prefs 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,4 @@
+#Fri Mar 17 15:02:47 CET 2006
+default.configuration=
+eclipse.preferences.version=1
+hibernate3.enabled=false
Added: contrib/wikiPortlet/trunk/wiki-test/WEB-INF/web.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/WEB-INF/web.xml (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/WEB-INF/web.xml 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.5" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
+
+
+
+
+</web-app>
+
Added: contrib/wikiPortlet/trunk/wiki-test/maven.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/maven.xml (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/maven.xml 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,27 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util" >
+ <goal name="build">
+
+ <attainGoal name="jar" />
+
+ <ant:copy file="target/wiki-test.jar"
+ tofile="target/wiki-test/WEB-INF/lib/wiki-test.jar" />
+
+ <attainGoal name="war" />
+
+ </goal>
+
+ <goal name="deploy">
+
+ </goal>
+
+ <goal name="all">
+ <attainGoal name="build" />
+ <attainGoal name="deploy" />
+ </goal>
+
+</project>
Added: contrib/wikiPortlet/trunk/wiki-test/pom.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/pom.xml (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/pom.xml 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,135 @@
+<!--
+ JBoss, the OpenSource J2EE webOS Distributable under LGPL license. See
+ terms of license at gnu.org.
+ Maven manual install: portal-core-lib.jar
+ portal-portlet-lib javax-servlet.jar javax-servlet-jsp.jar
+ activation.jar jboss-ejb3x.jar jboss-ejb3.jar portal-identity-lib.jar
+ jboss-portlet-api-lib.jar
+
+ author: Piergiorgio Lucidi
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>jboss</groupId>
+ <artifactId>wiki</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>wiki-test</artifactId>
+ <name>JBoss Wiki Test</name>
+ <version>1.0</version>
+ <packaging>war</packaging>
+ <developers>
+ <developer>
+ <name>Tomasz Szymanski</name>
+ <url>http://mamut.net.pl</url>
+ <roles>
+ <role>Retired Project Lead</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Piergiorgio Lucidi</name>
+ <email>p.lucidi(a)sourcesense.com</email>
+ <url>http://www.open4dev.com/</url>
+ <organization>Sourcesense</organization>
+ <organizationUrl>http://www.sourcesense.com/</organizationUrl>
+ </developer>
+ </developers>
+ <build>
+
+ <sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/etc/</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ <include>**/*.types</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webappDirectory>${basedir}</webappDirectory>
+ <warSourceDirectory>${basedir}</warSourceDirectory>
+ <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
+ <excludes>**/.svn/**</excludes>
+ <warName>wiki-test</warName>
+ <outputDirectory>target</outputDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.9</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: contrib/wikiPortlet/trunk/wiki-test/project.properties
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/project.properties (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/project.properties 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,11 @@
+maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
+
+maven.final.name=${pom.artifactId}
+
+maven.jar.override=on
+
+maven.jar.shotoku-base=${ext.root.dir}/shotoku/shotoku-base/target/shotoku-base.jar
+
+maven.war.classes.excludes=**/test/*.class
Added: contrib/wikiPortlet/trunk/wiki-test/project.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/project.xml (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/project.xml 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,187 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../common.xml</extend>
+ <id>wiki-test</id>
+ <name>Wiki test</name>
+ <currentVersion>1.0</currentVersion>
+ <build>
+ <!-- <unitTestSourceDirectory>./src/test/java</unitTestSourceDirectory>
+ <unitTest>
+ <includes>
+ <include>**/*Test.java</include>
+ <include>**/Test*.java</include>
+ </includes>
+ </unitTest>-->
+ <sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.properties</include>
+ </resource>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.xml</include>
+ </resource>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.types</include>
+ </resource>
+ </resources>
+ </build>
+ <organization>
+ <name>Tomasz Szymanski</name>
+ <url>http://mamut.net.pl</url>
+ </organization>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>wiki-common</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ <properties>
+� � � � � � � � <ejb.manifest.classpath>true</ejb.manifest.classpath>
+� � � � � � </properties>
+ <jar>wiki-common.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>aslibs</groupId>
+ <artifactId>javax.servlet</artifactId>
+ <version>1.0</version>
+ <jar>javax.servlet.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>aslibs</groupId>
+ <artifactId>javax.servlet.jsp</artifactId>
+ <version>1.0</version>
+ <jar>javax.servlet.jsp.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>3.8.1</version>
+ <properties>
+ <war.bundle>true</war.bundle>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0</version>
+ <jar>activation.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload.jar</artifactId>
+ <version>1.0</version>
+ <jar>commons-fileupload-1.0.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <version>1.0</version>
+ <jar>jboss-ejb3x.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>1.0</version>
+ <jar>jboss-ejb3.jar</jar>
+ </dependency>
+
+ <dependency>
+ <id>portlet-api</id>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ <version>1.0</version>
+ <jar>jboss-jmx.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
+ <version>1.0</version>
+ <jar>jboss-common.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-common-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-common-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-core-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-core-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-portlet-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-portlet-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jbossall-client</artifactId>
+ <version>3.2.3</version>
+ </dependency>
+ </dependencies>
+</project>
Added: contrib/wikiPortlet/trunk/wiki-test/src/etc/testing-ideas.txt
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/etc/testing-ideas.txt (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/etc/testing-ideas.txt 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,32 @@
+What should wiki-test do:
+
+MediaDataSource:
+- deleting
+- edit -> save -> get -> pageExist
+- subpages
+ - list
+ - deleting
+- refreshing
+- finding
+- get page/content at version
+- all page names, add page, all page name - compare
+- get/set page mods. access pages
+- editing pages with session id (add / end) - try arePagesEdited; getPagesWaiting()
+- roles set
+- get/set meta properties
+- all pages check
+
+AttachmentDataSource:
+- add/check/delete attachments for page
+- delete mutliple attachments
+- last attachment version
+- attachment at version
+- attachment size
+
+Dictionary:
+- simple - add/remove translation / tranlsation exists
+- add translation Tomek -> Ziomek, then try adding page "Tomek"
+
+Plugins:
+
+InsidePlugins:
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/AttachmentTest.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/AttachmentTest.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/AttachmentTest.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,186 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.jboss.wiki.WikiAttachment;
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.exceptions.WikiException;
+
+public class AttachmentTest extends WikiTest {
+
+ private static final String ATT_CONTENT = "This is simple text attachment";
+
+ private static final String ATT_NAME = "testFile.txt";
+
+ private static final String ATT_CONTENT_2 = "This is simple text attachment, but second one";
+
+ private static final String ATT_NAME_2 = "testAnotherFile.txt";
+
+ public void testSaveGetDelete() throws WikiException, IOException {
+ String testPage = createTestPage(plainUser, PAGE_CONTENT);
+
+ WikiPage page = wikiEngine.getByName(testPage, null, langCode);
+
+ File att = createTempFile(ATT_CONTENT);
+
+ // add attachment
+ page.addAttachement(new FileInputStream(att), ATT_NAME, plainUser
+ .getName());
+
+ att = createTempFile(ATT_CONTENT_2);
+
+ // add attachment
+ page.addAttachement(new FileInputStream(att), ATT_NAME_2, plainUser
+ .getName());
+
+ // reload page
+ wikiEngine.refreshPage(testPage, langCode);
+
+ page = wikiEngine.getByName(testPage, null, langCode);
+
+ Set<String> attSet = page.getAttachementsSet();
+
+ // see if attSet has two attachemnt, we just added
+ Set<String> mySet = new HashSet<String>();
+ mySet.add(ATT_NAME);
+ mySet.add(ATT_NAME_2);
+
+ assertEquals(attSet, mySet);
+
+ // see if attachments contain our data
+ WikiAttachment wikiAttachment1 = wikiEngine.getAttachment(testPage,
+ ATT_NAME, langCode);
+ WikiAttachment wikiAttachment2 = wikiEngine.getAttachment(testPage,
+ ATT_NAME_2, langCode);
+
+ assertEquals(
+ loadContentFromAttachment(wikiAttachment1.getInputStream()),
+ ATT_CONTENT);
+
+ // load content for 2nd attachment
+
+ assertEquals(
+ loadContentFromAttachment(wikiAttachment2.getInputStream()),
+ ATT_CONTENT_2);
+
+ // delete attachments
+ wikiEngine.deleteAttachment(testPage, ATT_NAME, langCode);
+ wikiEngine.deleteAttachment(testPage, ATT_NAME_2, langCode);
+
+ // check atts for page
+ assertTrue(page.getAttachementsSet() == null);
+ }
+
+ public void testAttachmentVersions() throws WikiException, IOException {
+ String testPage = createTestPage(plainUser, PAGE_CONTENT);
+
+ WikiPage page = wikiEngine.getByName(testPage, null, langCode);
+
+ File att = createTempFile(ATT_CONTENT);
+
+ // add attachment
+ page.addAttachement(new FileInputStream(att), ATT_NAME, plainUser
+ .getName());
+
+ File att2 = createTempFile(ATT_CONTENT_2);
+
+ // add attachment with same name and different content
+ page.addAttachement(new FileInputStream(att2), ATT_NAME, plainUser
+ .getName());
+
+
+ // get attachment
+ WikiAttachment wikiAttachment = wikiEngine.getAttachment(testPage,
+ ATT_NAME, langCode);
+
+ // version should be "2"
+ assertEquals(wikiAttachment.getVersion(), 2);
+
+ // test att size
+ assertEquals(wikiEngine.getAttachmentSize(testPage, ATT_NAME, 1, langCode), att.length());
+ assertEquals(wikiEngine.getAttachmentSize(testPage, ATT_NAME, 2, langCode), att2.length());
+
+ // check content of last attachment
+ assertEquals(loadContentFromAttachment(wikiAttachment.getInputStream()), ATT_CONTENT_2);
+
+ //load att at version 1
+ wikiAttachment = wikiEngine.getAttachment(testPage, ATT_NAME, 1, langCode);
+
+ // version should be "1"
+ assertEquals(wikiAttachment.getVersion(), 1);
+
+ // check content of last attachment
+ assertEquals(loadContentFromAttachment(wikiAttachment.getInputStream()), ATT_CONTENT);
+
+ }
+
+ public void testDeleteMultipleAttachments() throws IOException, WikiException {
+ String testPage = createTestPage(plainUser, PAGE_CONTENT);
+
+ WikiPage page = wikiEngine.getByName(testPage, null, langCode);
+
+ File att = createTempFile(ATT_CONTENT);
+
+ // add attachment
+ page.addAttachement(new FileInputStream(att), ATT_NAME, plainUser
+ .getName());
+
+ File att2 = createTempFile(ATT_CONTENT_2);
+
+ // add attachment with same name and different content
+ page.addAttachement(new FileInputStream(att2), ATT_NAME_2, plainUser
+ .getName());
+
+ // see if attSet has two attachemnt, we just added
+ Set<String> mySet = new HashSet<String>();
+ mySet.add(ATT_NAME);
+ mySet.add(ATT_NAME_2);
+
+ assertEquals(page.getAttachementsSet(), mySet);
+
+ // delete all atts
+ wikiEngine.deleteAttachments(testPage, langCode);
+
+ // there should be no atts for page
+ assertTrue(page.getAttachementsSet() == null);
+ }
+
+ private String loadContentFromAttachment(InputStream is) throws IOException {
+ int chr;
+ String content = "";
+
+ while ((chr = is.read()) != -1) {
+ content += (char) chr;
+ }
+
+ is.close();
+
+ return content;
+ }
+}
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/DictionaryTest.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/DictionaryTest.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/DictionaryTest.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import java.util.Map;
+
+import org.jboss.wiki.WikiContext;
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.exceptions.WikiException;
+import org.jboss.wiki.plugins.ReTranslateUids;
+
+public class DictionaryTest extends WikiTest {
+
+ private static final String PAGE_W_LINK_PREF = "This page contains single [";
+
+ private static final String PAGE_W_LINK_SUFF = "] - that is very linky";
+
+ private static final String LINK1 = "TestLink";
+
+ private static final String LINK2 = "AnotherLink";
+
+ public void testDictionary() throws WikiException, InterruptedException{
+
+ WikiContext wikiContext = new WikiContext(plainUser, wikiEngine.getWikiType("html"), testWikiSession);
+
+ String page1 = createTestPage(plainUser, "1 page number 1");
+ String page2 = createTestPage(plainUser, "2 page number 2");
+
+ WikiPage wikiPage1 = wikiEngine.getByName(page1, null, langCode);
+ WikiPage wikiPage2 = wikiEngine.getByName(page2, null, langCode);
+
+ // set apropriate content of pages
+ wikiPage1.setContent("1 ["+page2+"]");
+ wikiPage1.setLastVersion(wikiPage1.getLastVersion()+1);
+ wikiPage1.save(plainUser, wikiEngine.getEditSessionId(), langCode, testWikiSession);
+
+ wikiPage2.setContent("1 ["+page2+"]");
+ wikiPage2.setLastVersion(wikiPage2.getLastVersion()+1);
+ wikiPage2.save(plainUser, wikiEngine.getEditSessionId(), langCode, testWikiSession);
+
+ int i = 0;
+ String newPage2Name = page2 + (i++);
+
+ while(wikiEngine.pageExists(newPage2Name, langCode)) {
+ newPage2Name = page2 + (i++);
+ }
+
+ log.info("New name for page2: "+newPage2Name);
+
+ addRenaming(page2, newPage2Name);
+
+ // wait for page to rename
+ while (!wikiEngine.getPagesWaiting(langCode).isEmpty()) {
+ Thread.sleep(5 * 1000);
+ }
+
+ Map<String,String> pageMapings = wikiEngine.getRenameMapings(langCode);
+ for (String uid : pageMapings.keySet()) {
+ System.out.println("Uid: "+uid+" Real: "+pageMapings.get(uid));
+ }
+
+ // add new page to deleting
+ pagesToDelete.remove(page2);
+ pagesToDelete.add(newPage2Name);
+
+ // see if page after translation exists
+ assertTrue(wikiEngine.pageExists(newPage2Name, langCode));
+
+ // get page with renamed reference
+ WikiPage afterRename = wikiEngine.getByName(page1, wikiContext, langCode);
+
+ String pageContentRenamed = afterRename.getContent();
+
+ log.info("page1 content: "+pageContentRenamed);
+
+ int link = -1;
+
+ // look if there is any link
+ if ((link = pageContentRenamed.lastIndexOf(hostURL+"/wiki/")) == -1) {
+ fail("There is no link in afterRename page.");
+ }
+ else {
+ // find link in page
+ String pageName = pageContentRenamed.substring(link + (hostURL+"/wiki/").length(), pageContentRenamed.indexOf("\"", link + (hostURL+"/wiki/").length()));
+ log.info("PAGENAME: "+pageName);
+
+
+ // check if the link is the one renamed in dictionary
+ assertEquals(pageName, newPage2Name);
+
+ }
+ }
+
+ public void testTranslating () throws WikiException {
+ WikiContext wikiContext = new WikiContext(plainUser, wikiEngine.getWikiType("edit"), testWikiSession);
+
+ // create first uniqueLink
+ String uniqueLink = getUniqueName(LINK1);
+
+ // create another uniqueLink, we'll make translation to
+ String uniqueLinkTo = getUniqueName(LINK2);
+
+ // create page with first link
+ String testPage = createTestPage(plainUser, PAGE_W_LINK_PREF + uniqueLink + PAGE_W_LINK_SUFF);
+
+ // add renaming
+ addRenaming(uniqueLink, uniqueLinkTo);
+
+ // sourcePage - will have link to first uniqueLink
+ WikiPage sourcePage = wikiEngine.getByName(testPage, null, langCode);
+
+ //page after translation - will have link to second uniqueLink
+ WikiPage page = wikiEngine.getByName(testPage, wikiContext, langCode);
+
+ // source page should have link to 1st uniqueLink
+ assertTrue(sourcePage.getContent().indexOf(uniqueLink) != -1);
+
+ // translated page should have link to 2nd uniqueLink
+ assertTrue(page.getContent().indexOf(uniqueLinkTo) != -1);
+
+ // page content should differ
+ assertFalse(page.getContent().equals(sourcePage.getContent()));
+
+ // retranslate uids
+ ReTranslateUids reTranslateUids = new ReTranslateUids(wikiEngine);
+
+ // get retranslated content
+ String reTranslated = reTranslateUids.getNewContent(page.getContent(), langCode);
+
+ // retranslated should be the same as sourcePage
+ assertEquals(reTranslated, sourcePage.getContent());
+ }
+}
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/FindPagesTest.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/FindPagesTest.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/FindPagesTest.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import java.util.Map;
+
+import org.jboss.wiki.exceptions.WikiException;
+
+public class FindPagesTest extends WikiTest {
+
+ private final static String CONTENT_MOD = "1234567890";
+
+ public void testFinding() throws WikiException {
+ String page1 = createTestPage(plainUser, PAGE_CONTENT);
+
+ String page2 = createTestPage(plainUser, PAGE_CONTENT + CONTENT_MOD);
+
+ String page3 = createTestPage(plainUser, CONTENT_MOD + PAGE_CONTENT + CONTENT_MOD);
+
+ // first search - just page content - all pages should be returned
+ Map<String, Integer> searchResult = wikiEngine.findPages(PAGE_CONTENT, langCode);
+
+ // look if pages are in results
+ assertTrue(searchResult.keySet().contains(page1));
+ assertTrue(searchResult.keySet().contains(page2));
+ assertTrue(searchResult.keySet().contains(page3));
+
+ // only content
+ Map<String, Integer> searchResult2 = wikiEngine.findPages(CONTENT_MOD, langCode);
+
+ // first page shouldn't be in results
+ assertFalse(searchResult2.keySet().contains(page1));
+
+ // 2 and 3 pages should be available
+ assertTrue(searchResult2.keySet().contains(page2));
+ assertTrue(searchResult2.keySet().contains(page3));
+
+ // page 3 should have bigger result
+
+ assertTrue(searchResult2.get(page3).compareTo(searchResult2.get(page2)) > 0);
+
+ // page2 name
+ Map<String, Integer> searchResult3 = wikiEngine.findPages(page2, langCode);
+
+ //this should return only page2
+ assertFalse(searchResult3.keySet().contains(page1));
+ assertTrue(searchResult3.keySet().contains(page2));
+ assertFalse(searchResult3.keySet().contains(page3));
+ }
+
+}
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/GetSavePageTest.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/GetSavePageTest.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/GetSavePageTest.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,149 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import java.util.Date;
+import java.util.Set;
+import java.util.Vector;
+
+import org.jboss.wiki.WikiContext;
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.exceptions.WikiException;
+
+public class GetSavePageTest extends WikiTest {
+
+ private final static String PAGE_CONTENT = "This is simple conten link Hello !";
+
+ private final static String PAGE_CONTENT_2 = "This is another content";
+
+ private final static String PAGE_VER_NAME = "TestVersionsPage";
+
+ private final static int NUM_OF_SESSIDS = 100;
+
+ public void testSaveGetPage() throws WikiException {
+ WikiContext wikiContext = new WikiContext(plainUser, wikiEngine
+ .getWikiType("html"), testWikiSession);
+
+ String testPageName = createTestPage(plainUser, PAGE_CONTENT);
+
+ assertTrue(wikiEngine.pageExists(testPageName, langCode));
+
+ WikiPage wikiPage2 = wikiEngine.getByName(testPageName, wikiContext,
+ langCode);
+
+ String pageContent = wikiPage2.getPageContent();
+
+ assertTrue(pageContent.indexOf(PAGE_CONTENT) != -1);
+
+ }
+
+ public void testGetAllPages() throws WikiException {
+ Set<String> pageNames = wikiEngine.getAllPageNames(langCode);
+
+ for (String pageName : pageNames) {
+ assertTrue(wikiEngine.pageExists(pageName, langCode));
+ }
+
+ String newPage = createTestPage(plainUser, PAGE_CONTENT);
+
+ Set<String> newPageNames = wikiEngine.getAllPageNames(langCode);
+
+ pageNames.add(newPage);
+
+ // check if the previous set is was just set after adding a page - this page
+ assertEquals(pageNames, newPageNames);
+ }
+
+ public void testLocking() throws WikiException {
+ WikiPage wikiPage = wikiEngine.getByName(createTestPage(plainUser,
+ "some page content"), null, langCode);
+
+ Vector<Integer> sessIds = new Vector<Integer>();
+
+ // genrate sess ids and lock pages
+ for (int i = 0; i < NUM_OF_SESSIDS; i++) {
+ sessIds.add(wikiEngine.getEditSessionId());
+
+ // check if lock gives a Date
+ if (i > 0) {
+ assertTrue(wikiPage.lock(plainUser, sessIds.get(i)) != null);
+ } else {
+ assertTrue(wikiPage.lock(plainUser, sessIds.get(i)) == null);
+ }
+ }
+
+ // try saving page with wrong sessionId
+ wikiPage.save(plainUser, NUM_OF_SESSIDS * 2, langCode, testWikiSession);
+
+ // check what wikiEngine thinks
+ assertTrue(wikiEngine.arePagesEdited());
+
+ // unlock
+ for (int i = 0; i < NUM_OF_SESSIDS; i++) {
+ wikiPage.unlock(plainUser, sessIds.get(i));
+ }
+
+ // check what wikiengine thinks
+ assertFalse(wikiEngine.arePagesEdited());
+ }
+
+ public void testVersions() throws WikiException {
+ String testPageName = getUniqueName(PAGE_VER_NAME);
+
+ // create page at version 1
+ WikiPage testPage = new WikiPage(testPageName, plainUser, PAGE_CONTENT,
+ 1, 1, new Date(), wikiEngine, true, true, null, null,
+ PAGE_CONTENT.length(), langCode);
+
+ // save page
+ wikiEngine.savePage(plainUser, testPage, langCode, testWikiSession);
+
+ // add testpage to to-delete list
+ pagesToDelete.add(testPageName);
+
+ // check if it exists
+ assertTrue(wikiEngine.pageExists(testPageName, langCode));
+
+ // get the page again
+ testPage = wikiEngine.getByName(testPageName, null, langCode);
+
+ // save next version
+ testPage.setContent(PAGE_CONTENT_2);
+ testPage.setLastVersion(testPage.getLastVersion() + 1);
+
+ wikiEngine.savePage(plainUser, testPage, langCode, testWikiSession);
+
+ // get page again at current version
+ testPage = wikiEngine.getByName(testPageName, null, langCode);
+
+ // check content and version
+ assertEquals(testPage.getContent(), PAGE_CONTENT_2);
+ assertEquals(testPage.getVersion(), 2);
+
+ // and at version 1
+ WikiPage prevVersionPage = wikiEngine.getByName(testPageName, null, 1, langCode);
+
+ // check content and version
+ assertEquals(prevVersionPage.getContent(), PAGE_CONTENT);
+ assertEquals(prevVersionPage.getVersion(), 1);
+ }
+}
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/PageModsTest.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/PageModsTest.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/PageModsTest.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,131 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import org.jboss.wiki.MediaDataSource;
+import org.jboss.wiki.WikiContext;
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.exceptions.EditingNotAllowedException;
+import org.jboss.wiki.exceptions.WikiException;
+
+public class PageModsTest extends WikiTest {
+
+ private final static String PAGE_CONTENT = "This is a simple page content.";
+
+ public void testGlobalMods() throws WikiException {
+ String testPage = createTestPage(plainUser, PAGE_CONTENT);
+
+ WikiPage page = wikiEngine.getByName(testPage, null, langCode);
+
+ // no mods - version is 1
+ assertEquals(page.getLastVersion(), 1);
+
+ // set page not editable
+ page.setEditable(false);
+
+ assertEquals(wikiEngine.getPageMod(testPage, langCode),
+ MediaDataSource.VIEWABLE);
+
+ // try to save page - it should throw an error
+ page.setContent(PAGE_CONTENT + PAGE_CONTENT);
+ page.setLastVersion(page.getLastVersion() + 1);
+
+ try {
+ wikiEngine.savePage(plainUser, page, langCode, testWikiSession);
+ fail("Saving should throw an exception - page isn't editable");
+ } catch (EditingNotAllowedException e) {
+ // it's ok - page isn't editable
+ }
+
+ // set page not viewable
+ page.setViewable(false);
+
+ // try to get the page
+ page = wikiEngine.getByName(testPage, new WikiContext(notLogedIn,
+ wikiEngine.getWikiType("html"), testWikiSession), langCode);
+
+ // if page wasn't viewable - it's version will be 0
+ assertEquals(page.getVersion(), 0);
+
+ // try the same with getMods - if page is not viewable and not editable - mod = 0
+ assertEquals(wikiEngine.getPageMod(testPage, langCode), 0);
+
+ // check if admin has access
+ page = wikiEngine.getByName(testPage, new WikiContext(adminUser,
+ wikiEngine.getWikiType("html"), testWikiSession), langCode);
+
+ assertEquals(page.getVersion(), 1);
+
+ }
+
+ public void testRolesSet() throws WikiException {
+ String testPage = createTestPage(plainUser, PAGE_CONTENT);
+
+ WikiPage page = wikiEngine.getByName(testPage, null, langCode);
+
+ page.setEditRoles(roles);
+ wikiEngine.saveRolesSet(page, roles, MediaDataSource.EDITABLE, langCode);
+
+ page.setViewRoles(roles);
+ wikiEngine.saveRolesSet(page, roles, MediaDataSource.VIEWABLE, langCode);
+
+ // reload the page from DS
+ wikiEngine.refreshPage(testPage, langCode);
+
+ // try to save page - it should throw an error
+ page.setContent(PAGE_CONTENT + PAGE_CONTENT);
+ page.setLastVersion(page.getLastVersion() + 1);
+
+ try {
+ wikiEngine.savePage(plainUser, page, langCode, testWikiSession);
+ fail("Saving should throw an exception - page isn't editable");
+ } catch (EditingNotAllowedException e) {
+ // it's ok - page isn't editable
+ }
+
+ // try to get the page with not allowed user
+ page = wikiEngine.getByName(testPage, new WikiContext(plainUser,
+ wikiEngine.getWikiType("html"), testWikiSession), langCode);
+
+ // if page wasn't viewable - it's version will be 0
+ assertEquals(page.getVersion(), 0);
+
+ // try to get the page with allowed user
+ page = wikiEngine.getByName(testPage, new WikiContext(plainUserRoles,
+ wikiEngine.getWikiType("html"), testWikiSession), langCode);
+
+ // if page is viewable - it's version will be 1
+ assertEquals(page.getVersion(), 1);
+
+ // look if page is editable
+ assertTrue(page.isEditable(plainUserRoles));
+ assertFalse(page.isEditable(plainUser));
+
+ // check if admin has access
+ page = wikiEngine.getByName(testPage, new WikiContext(adminUser,
+ wikiEngine.getWikiType("html"), testWikiSession), langCode);
+
+ assertEquals(page.getVersion(), 1);
+
+ }
+
+}
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/PropsTest.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/PropsTest.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/PropsTest.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.exceptions.WikiException;
+
+public class PropsTest extends WikiTest {
+
+ private final static String PROP1 = "property1";
+
+ private final static String KEY1 = "bim bom";
+
+ private final static String PROP2 = "pRoperty2";
+
+ private final static String KEY2 = "bele bele BYM";
+
+ private final static String PROP3 = "WielkaPropa";
+
+ private final static String KEY3 = "I don't like Yor";
+
+ public void testProperties() throws WikiException {
+ String testPage = createTestPage(plainUser, PAGE_CONTENT);
+
+ WikiPage page = wikiEngine.getByName(testPage, null, langCode);
+
+ // set some properties
+ page.setMetaDataProperty(PROP1, KEY1);
+ page.setMetaDataProperty(PROP2, KEY2);
+ page.setMetaDataProperty(PROP3, KEY3);
+
+ // refresh page
+ wikiEngine.refreshPage(testPage, langCode);
+
+ // reload page
+ page = wikiEngine.getByName(testPage, null, langCode);
+
+ // check properties
+ assertEquals(page.getMetaDataProperty(PROP1), KEY1);
+ assertEquals(page.getMetaDataProperty(PROP2), KEY2);
+ assertEquals(page.getMetaDataProperty(PROP3), KEY3);
+
+ // remove property
+ page.removeMetaDataProperty(PROP2);
+
+ // refresh page
+ wikiEngine.refreshPage(testPage, langCode);
+
+ // reload page
+ page = wikiEngine.getByName(testPage, null, langCode);
+
+ // it should be null now
+ assertNull(page.getMetaDataProperty(PROP2));
+ }
+}
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/SubPagesTest.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/SubPagesTest.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/SubPagesTest.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,137 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import java.util.Date;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.exceptions.WikiException;
+
+public class SubPagesTest extends WikiTest {
+
+ private static final String SUB_PAGE_1 = "SubPage1";
+
+ private static final String SUB_PAGE_2 = "SubPage2";
+
+ private static final String PAGE_CONTENT_2 = "Sub page content 1";
+
+ private static final String PAGE_CONTENT_3 = "Sub page content 2";
+
+ private static final String SUB_PAGE_PREFIX = "TestPageSubpages";
+
+ public void testSubpagesList() throws WikiException {
+ String page = createTestPage(plainUser, PAGE_CONTENT);
+
+ // create first subpage
+ WikiPage subPage1 = new WikiPage(page + "/" + SUB_PAGE_1, plainUser,
+ PAGE_CONTENT_2, 1, 1, new Date(), wikiEngine, true, true, null,
+ null, PAGE_CONTENT_2.length(), langCode);
+
+ wikiEngine.savePage(plainUser, subPage1, langCode, testWikiSession);
+
+ //add to "to-delete" list
+ pagesToDelete.add(page+"/"+SUB_PAGE_1);
+
+ // create second subpage
+ WikiPage subPage2 = new WikiPage(page + "/" + SUB_PAGE_2, plainUser,
+ PAGE_CONTENT_3, 1, 1, new Date(), wikiEngine, true, true, null,
+ null, PAGE_CONTENT_3.length(), langCode);
+
+ wikiEngine.savePage(plainUser, subPage2, langCode, testWikiSession);
+
+ //add to "to-delete" list
+ pagesToDelete.add(page+"/"+SUB_PAGE_2);
+
+ Set<String> subPagesList = wikiEngine.getPagesFor(page, langCode);
+
+ // construct new set with new subpages' names
+ Set<String> mySet = new TreeSet<String>();
+ mySet.add(page+"/"+SUB_PAGE_1); mySet.add(page+"/"+SUB_PAGE_2);
+
+ // check if both sets are the same
+ assertEquals(subPagesList, mySet);
+ }
+
+ public void testSubpagesDelete() throws WikiException {
+ Set<String> createdPages = new TreeSet<String>();
+
+ String page = getUniqueName(SUB_PAGE_PREFIX);
+
+ // create first page
+ WikiPage rootPage = new WikiPage(page, plainUser,
+ PAGE_CONTENT_2, 1, 1, new Date(), wikiEngine, true, true, null,
+ null, PAGE_CONTENT_2.length(), langCode);
+
+ wikiEngine.savePage(plainUser, rootPage, langCode, testWikiSession);
+ createdPages.add(page);
+
+ // create first subpage
+ WikiPage subPage1 = new WikiPage(page + "/" + SUB_PAGE_1, plainUser,
+ PAGE_CONTENT_2, 1, 1, new Date(), wikiEngine, true, true, null,
+ null, PAGE_CONTENT_2.length(), langCode);
+
+ wikiEngine.savePage(plainUser, subPage1, langCode, testWikiSession);
+ createdPages.add(page + "/" + SUB_PAGE_1);
+
+ // create second subpage
+ WikiPage subPage2 = new WikiPage(page + "/" + SUB_PAGE_2, plainUser,
+ PAGE_CONTENT_2, 1, 1, new Date(), wikiEngine, true, true, null,
+ null, PAGE_CONTENT_2.length(), langCode);
+
+ wikiEngine.savePage(plainUser, subPage2, langCode, testWikiSession);
+ createdPages.add(page + "/" + SUB_PAGE_2);
+
+ // create first subsubpage
+ WikiPage subSubPage1 = new WikiPage(page + "/" + SUB_PAGE_1 + "/" + SUB_PAGE_1, plainUser,
+ PAGE_CONTENT_2, 1, 1, new Date(), wikiEngine, true, true, null,
+ null, PAGE_CONTENT_2.length(), langCode);
+
+ wikiEngine.savePage(plainUser, subSubPage1, langCode, testWikiSession);
+ createdPages.add(page + "/" + SUB_PAGE_1 + "/" + SUB_PAGE_1);
+
+ // add a page that is more deep inside
+ String name = page + "/" + SUB_PAGE_1 + "/" + SUB_PAGE_1 + "/" + SUB_PAGE_2 + "/" + SUB_PAGE_2 + "/" + SUB_PAGE_1;
+ WikiPage subSubmultiple = new WikiPage(name, plainUser,
+ PAGE_CONTENT_2, 1, 1, new Date(), wikiEngine, true, true, null,
+ null, PAGE_CONTENT_2.length(), langCode);
+
+ wikiEngine.savePage(plainUser, subSubmultiple, langCode, testWikiSession);
+ createdPages.add(name);
+
+
+ // all pages should be there
+ for (String s : createdPages) {
+ assertTrue(wikiEngine.pageExists(s, langCode));
+ }
+
+ wikiEngine.deletePage(page, true, langCode);
+
+ // after deleting - no pages :)
+ for (String s : createdPages) {
+ assertFalse(wikiEngine.pageExists(s, langCode));
+ }
+
+ }
+}
+
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/TestCredentials.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/TestCredentials.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/TestCredentials.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import java.util.Set;
+
+import org.jboss.wiki.Credentials;
+
+public class TestCredentials extends Credentials {
+ private boolean logedIn = false;
+ private boolean admin = false;
+ private Set<String> roles;
+
+ public TestCredentials(boolean logedIn, boolean admin) {
+ init(logedIn, admin);
+ }
+
+ public TestCredentials(boolean logedIn, boolean admin, Set<String> roles) {
+ init(logedIn, admin);
+ this.roles = roles;
+ }
+
+ private void init(boolean logedIn, boolean admin) {
+ this.admin = admin;
+ this.logedIn = logedIn;
+ }
+
+ @Override
+ public String getName() {
+ return (isLoggedIn()) ? ((isAdmin()) ? "admin" : "test-user") : "Unknown";
+ }
+
+ @Override
+ public boolean isLoggedIn() {
+ return logedIn;
+ }
+
+ @Override
+ public boolean isAdmin() {
+ return admin;
+ }
+
+ @Override
+ public void setParam(Object param) {
+ // Do nothing
+
+ }
+
+ @Override
+ public boolean isUserInRole(String role) {
+ if (roles == null) {
+ return false;
+ }
+
+ return (roles.contains(role));
+ }
+
+ @Override
+ public Set<String> getAllRoles() {
+ return roles;
+ }
+
+ @Override
+ public String getEmail() {
+ return null;
+ }
+
+}
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/TestWikiSession.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/TestWikiSession.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/TestWikiSession.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import java.util.HashMap;
+
+import org.jboss.wiki.WikiSession;
+
+public class TestWikiSession implements WikiSession {
+
+ HashMap<String, Object> attributes;
+
+ public TestWikiSession() {
+ attributes = new HashMap<String, Object>();
+ }
+
+ public Object getAttribute(String attributeName) {
+ return attributes.get(attributeName);
+ }
+
+ public void setAttribute(String attributeName, Object attribute) {
+ attributes.put(attributeName, attribute);
+ }
+
+ public void removeAttribute(String attributeName) {
+ attributes.remove(attributeName);
+ }
+
+ public String getId() {
+ return toString();
+ }
+
+}
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/WikiTest.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/WikiTest.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/WikiTest.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,230 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.TreeSet;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+
+import org.jboss.wiki.Credentials;
+import org.jboss.wiki.WikiCommon;
+import org.jboss.wiki.WikiContext;
+import org.jboss.wiki.WikiEngine;
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.WikiSession;
+import org.jboss.wiki.exceptions.PageRenamingException;
+import org.jboss.wiki.exceptions.WikiException;
+import org.jboss.wiki.exceptions.WikiManagementNotFoundException;
+import org.jboss.wiki.management.WikiServiceManagement;
+
+public class WikiTest extends TestCase {
+ protected WikiEngine wikiEngine;
+
+ protected WikiSession testWikiSession;
+
+ protected Credentials notLogedIn = new TestCredentials(false, false);
+
+ protected Credentials adminUser = new TestCredentials(true, true);
+
+ protected Credentials plainUser = new TestCredentials(true, false);
+
+ protected Credentials plainUserRoles;
+
+ protected Set<String> pagesToDelete;
+
+ protected Set<File> filesToDelete;
+
+ protected Set<String> dictsToRemove;
+
+ protected final static String TEST_PAGE_BASE_NAME = "TestPage";
+
+ protected final static String hostURL = "http://localhost:8080";
+
+ protected final static String actionURL = "/Szimano";
+
+ protected final static String ROLE_NAME = "MyRole";
+
+ protected final static String PAGE_CONTENT = "This is a simple page content.";
+
+ protected final static String FILE_PREFIX = "wikiTestFile";
+
+ protected final static String FILE_SUFFIX = ".wikiFile";
+
+ protected Set<String> roles;
+
+ protected String langCode;
+
+ protected Logger log;
+
+ @Override
+ protected void setUp() throws Exception {
+ log = Logger.getLogger(WikiTest.class);
+
+ WikiCommon wikiCommon = new WikiCommon();
+
+ try {
+ WikiServiceManagement wikiServiceMenagement = wikiCommon
+ .getWikiManagement();
+ wikiEngine = wikiServiceMenagement.getWikiEngine();
+ } catch (WikiManagementNotFoundException e1) {
+ log.info("Couldn't find WikiManagement - probably u're executing tests outside AS");
+ wikiEngine = new WikiEngine();
+ }
+
+ testWikiSession = new TestWikiSession();
+ pagesToDelete = new HashSet<String>();
+ filesToDelete = new HashSet<File>();
+ dictsToRemove = new HashSet<String>();
+
+ // set session atributes
+ testWikiSession.setAttribute("credentials", plainUser);
+ testWikiSession.setAttribute("actionURL", actionURL);
+ testWikiSession.setAttribute("hostURL", hostURL);
+
+ langCode = wikiEngine.defaultLangugeCode;
+
+ roles = new TreeSet<String>();
+ roles.add(ROLE_NAME);
+
+ plainUserRoles = new TestCredentials(true, false, roles);
+ }
+
+ protected String createTestPage(Credentials user, String pageContent)
+ throws WikiException {
+ WikiContext wikiContext = new WikiContext(user, wikiEngine
+ .getWikiType("html"), testWikiSession);
+
+ if (wikiContext == null) {
+ fail("There is no html wikitype");
+ }
+
+ String testPageName = TEST_PAGE_BASE_NAME;
+ int i = 0;
+
+ while (wikiEngine.pageExists(testPageName, langCode)) {
+ testPageName = TEST_PAGE_BASE_NAME + (i++);
+ }
+
+ WikiPage wikiPage = new WikiPage(testPageName, user, pageContent, 1, 1,
+ new Date(), wikiEngine, true, true, null, null, pageContent
+ .length(), langCode);
+
+ wikiPage.save(plainUser, wikiEngine.getEditSessionId(), langCode, testWikiSession);
+
+ pagesToDelete.add(testPageName);
+
+ return testPageName;
+ }
+
+ protected String getUniqueName(String prefix) {
+
+ if (wikiEngine.pageExists(prefix, langCode)) {
+ int i = 0;
+
+ while (wikiEngine.pageExists(prefix + i, langCode)) {
+ i++;
+ }
+
+ return prefix + i;
+ }
+
+ return prefix;
+ }
+
+ private void deleteAllTestPages() {
+ boolean ret = true;
+
+ for (String pageName : pagesToDelete) {
+ if (!wikiEngine.deletePage(pageName, true, langCode)) {
+ ret = false;
+ log.error("Couldn't delete " + pageName);
+ }
+ }
+
+ if (!ret) {
+ // fail("Problems with deleting pages");
+ }
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ // at the end delete created testpages
+
+ deleteAllTestPages();
+
+ deleteAllTempFiles();
+
+ removeDicts();
+
+ super.tearDown();
+ }
+
+ private void removeDicts() throws PageRenamingException,
+ InterruptedException {
+ for (String dict : dictsToRemove) {
+ wikiEngine.removeDictForPage(dict, langCode);
+ System.out.println("Removed dict: "+dict);
+ }
+
+ // wait for all pages beeing deleted
+ while (!wikiEngine.getDictRemovesWaiting(langCode).isEmpty()) {
+ Thread.sleep(5 * 1000);
+ }
+ }
+
+ private void deleteAllTempFiles() {
+ for (File f : filesToDelete) {
+ f.delete();
+ }
+ }
+
+ protected File createTempFile(String content) throws IOException {
+ File attFile = File.createTempFile(FILE_PREFIX, FILE_SUFFIX);
+
+ FileOutputStream fos = new FileOutputStream(attFile);
+
+ for (int i = 0; i < content.length(); i++) {
+ fos.write(content.charAt(i));
+ }
+
+ fos.close();
+
+ return attFile;
+ }
+
+ protected void addRenaming(String uid, String newName)
+ throws PageRenamingException {
+ wikiEngine.rename(uid, newName, langCode);
+
+ System.out.println("Added renaming: "+uid+" -> "+newName);
+
+ dictsToRemove.add(newName);
+ }
+}
Added: contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/WikiTestException.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/WikiTestException.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/java/org/jboss/wiki/test/WikiTestException.java 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.test;
+
+public class WikiTestException extends Exception {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+
+ public WikiTestException() {
+ super();
+ }
+
+ public WikiTestException(Throwable t) {
+ super(t);
+ }
+
+ public WikiTestException(String msg) {
+ super(msg);
+ }
+}
Added: contrib/wikiPortlet/trunk/wiki-test/src/web/WEB-INF/web.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-test/src/web/WEB-INF/web.xml (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-test/src/web/WEB-INF/web.xml 2009-03-03 18:54:59 UTC (rev 249)
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd">
+<web-app>
+
+ <servlet>
+ <servlet-name>JUnitEETestServlet</servlet-name>
+ <description>JUnitEE test runner</description>
+ <servlet-class>org.junitee.servlet.JUnitEEThreadedServlet</servlet-class>
+ <init-param>
+ <param-name>searchResources</param-name>
+ <param-value>wiki-test.jar</param-value>
+ </init-param>
+ </servlet>
+
+ <servlet-mapping>
+ <servlet-name>JUnitEETestServlet</servlet-name>
+ <url-pattern>/test/*</url-pattern>
+ </servlet-mapping>
+</web-app>
15 years, 2 months
JBoss PortletSwap SVN: r248 - in contrib/wikiPortlet/trunk: wiki-management and 9 other directories.
by portletswap-commits@lists.jboss.org
Author: piergiorgiolucidi
Date: 2009-03-03 13:54:10 -0500 (Tue, 03 Mar 2009)
New Revision: 248
Added:
contrib/wikiPortlet/trunk/wiki-management/
contrib/wikiPortlet/trunk/wiki-management/.classpath
contrib/wikiPortlet/trunk/wiki-management/.project
contrib/wikiPortlet/trunk/wiki-management/.settings/
contrib/wikiPortlet/trunk/wiki-management/.settings/org.maven.ide.eclipse.prefs
contrib/wikiPortlet/trunk/wiki-management/maven.xml
contrib/wikiPortlet/trunk/wiki-management/pom.xml
contrib/wikiPortlet/trunk/wiki-management/project.properties
contrib/wikiPortlet/trunk/wiki-management/project.xml
contrib/wikiPortlet/trunk/wiki-management/src/
contrib/wikiPortlet/trunk/wiki-management/src/java/
contrib/wikiPortlet/trunk/wiki-management/src/java/bmsi/
contrib/wikiPortlet/trunk/wiki-management/src/java/org/
contrib/wikiPortlet/trunk/wiki-management/src/java/org/apache/
contrib/wikiPortlet/trunk/wiki-management/src/java/org/apache/commons/
contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/
contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/
contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/EMailNotifierSLSB.java
contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/MailNotificationBean.java
contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/management/
contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/management/WikiService.java
contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/taglib/
contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/test/
contrib/wikiPortlet/trunk/wiki-management/src/test/
contrib/wikiPortlet/trunk/wiki-management/src/web/
contrib/wikiPortlet/trunk/wiki-management/src/web/WEB-INF/
Log:
- Portal 2.7.x support: wiki-management
Added: contrib/wikiPortlet/trunk/wiki-management/.classpath
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/.classpath (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/.classpath 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/wiki-common"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: contrib/wikiPortlet/trunk/wiki-management/.project
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/.project (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/.project 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>wiki-management</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: contrib/wikiPortlet/trunk/wiki-management/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/.settings/org.maven.ide.eclipse.prefs 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,8 @@
+#Fri Jan 23 21:38:44 CET 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+version=1
Added: contrib/wikiPortlet/trunk/wiki-management/maven.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/maven.xml (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/maven.xml 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,24 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util" >
+ <goal name="build">
+ <attainGoal name="ejb" />
+ </goal>
+
+ <goal name="deploy">
+
+ <!--<ant:copy
+ tofile="${local.deploy.dir}/${wiki.ear.name}/wiki.ejb3"
+ file="target/wiki-management-1.0.jar" />-->
+
+ </goal>
+
+ <goal name="all">
+ <attainGoal name="build" />
+ <attainGoal name="deploy" />
+ </goal>
+
+</project>
Added: contrib/wikiPortlet/trunk/wiki-management/pom.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/pom.xml (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/pom.xml 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,132 @@
+<!--
+ JBoss, the OpenSource J2EE webOS Distributable under LGPL license. See
+ terms of license at gnu.org.
+ Maven manual install: portal-core-lib.jar
+ portal-portlet-lib javax-servlet.jar javax-servlet-jsp.jar
+ activation.jar jboss-ejb3x.jar jboss-ejb3.jar portal-identity-lib.jar
+ jboss-portlet-api-lib.jar
+
+ author: Piergiorgio Lucidi
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>jboss</groupId>
+ <artifactId>wiki</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>wiki-management</artifactId>
+ <name>JBoss Wiki Management</name>
+ <version>1.0</version>
+ <packaging>jar</packaging>
+ <developers>
+ <developer>
+ <name>Tomasz Szymanski</name>
+ <url>http://mamut.net.pl</url>
+ <roles>
+ <role>Retired Project Lead</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Piergiorgio Lucidi</name>
+ <email>p.lucidi(a)sourcesense.com</email>
+ <url>http://www.open4dev.com/</url>
+ <roles>
+ <role>Project Lead</role>
+ </roles>
+ <organization>Sourcesense</organization>
+ <organizationUrl>http://www.sourcesense.com/</organizationUrl>
+ </developer>
+ </developers>
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/etc/</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ <include>**/*.types</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.2</version>
+ <configuration>
+ <finalName>wiki-management</finalName>
+ <outputDirectory>../target/</outputDirectory>
+ <archive>
+ <manifest>
+ <addClasspath>true</addClasspath>
+ <addExtensions>true</addExtensions>
+ </manifest>
+ <manifestEntries>
+ <mode>development</mode>
+ <url>${pom.url}</url>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-mail</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-annotations-ejb3</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openejb</groupId>
+ <artifactId>javaee-api</artifactId>
+ <version>5.0-1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: contrib/wikiPortlet/trunk/wiki-management/project.properties
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/project.properties (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/project.properties 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,3 @@
+maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
Added: contrib/wikiPortlet/trunk/wiki-management/project.xml
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/project.xml (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/project.xml 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,144 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../common.xml</extend>
+ <id>wiki-management</id>
+ <name>Wiki Management(EJB3)</name>
+ <currentVersion>1.0</currentVersion>
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.properties</include>
+ </resource>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.xml</include>
+ </resource>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.types</include>
+ </resource>
+ </resources>
+ </build>
+ <organization>
+ <name>Tomasz Szymanski</name>
+ <url>http://mamut.net.pl</url>
+ </organization>
+
+ <dependencies>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-j2ee</artifactId>
+ <version>1.0</version>
+ <jar>jboss-j2ee.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>wiki-common</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ <properties>
+� � � � � � � � <ejb.manifest.classpath>true</ejb.manifest.classpath>
+� � � � � � </properties>
+ <jar>wiki-common.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-mail</artifactId>
+ <version>1.0</version>
+ <jar>mail.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0</version>
+ <jar>activation.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload.jar</artifactId>
+ <version>1.0</version>
+ <jar>commons-fileupload-1.0.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <version>1.0</version>
+ <jar>jboss-ejb3x.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>1.0</version>
+ <jar>jboss-ejb3.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-annotations-ejb3</artifactId>
+ <version>1.0</version>
+ <jar>jboss-annotations-ejb3.jar</jar>
+ </dependency>
+
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ <version>1.0</version>
+ <jar>jboss-jmx.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
+ <version>1.0</version>
+ <jar>jboss-common.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-common-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-common-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-core-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-core-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-portlet-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-portlet-lib.jar</jar>
+ </dependency>
+
+ </dependencies>
+</project>
Added: contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/EMailNotifierSLSB.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/EMailNotifierSLSB.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/EMailNotifierSLSB.java 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,78 @@
+package org.jboss.wiki;
+
+import java.util.Date;
+
+import javax.ejb.Stateless;
+import javax.mail.Address;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.Message.RecipientType;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.rmi.PortableRemoteObject;
+
+import org.jboss.logging.Logger;
+import org.jboss.wiki.management.EMailNotifier;
+import org.jboss.wiki.management.NotificationMsg;
+
+@Stateless
+public class EMailNotifierSLSB implements EMailNotifier {
+
+ private static final Logger log = Logger.getLogger(EMailNotifier.class);
+
+ public synchronized void sendNotification(NotificationMsg notifications) {
+
+ try {
+ Session session = (Session) PortableRemoteObject.narrow(
+ new InitialContext().lookup("java:Mail"), Session.class);
+
+ log.debug("Got email notification msg");
+
+ for (String email : notifications.getEmails()) {
+ log.debug("MDB for: " + email);
+
+ StringBuffer buffer = null;
+ Address[] to = null;
+ MimeMessage m = new MimeMessage(session);
+
+ if (email != null) {
+ m
+ .setFrom(new InternetAddress(notifications
+ .getFromEmail()));
+ to = new InternetAddress[] { new InternetAddress(email) };
+ m.setRecipients(RecipientType.TO, to);
+ m.setSubject("[JBossWiki] Page change notification: "
+ + notifications.getPageName());
+
+ m.setSentDate(new Date());
+ buffer = new StringBuffer();
+
+ buffer
+ .append(
+ "This message is generated automatically. Please do not reply. To remove yourself from the watch list please go to ")
+ .append(notifications.getPageLink()).append(
+ "<br />\n");
+ buffer.append(notifications.getPageContent());
+
+ m.setContent(buffer.toString(),
+ "text/html; charset=\"UTF-8\"");
+ Transport.send(m);
+ log.debug("Notification send to: "+email);
+ }
+ }
+ } catch (ClassCastException e) {
+ log.error(e);
+ } catch (NamingException e) {
+ log.error(e);
+ } catch (AddressException e) {
+ log.error(e);
+ } catch (MessagingException e) {
+ log.error(e);
+ }
+ }
+
+}
Added: contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/MailNotificationBean.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/MailNotificationBean.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/MailNotificationBean.java 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki;
+
+import java.util.Date;
+
+import javax.jms.Message;
+import javax.jms.MessageListener;
+import javax.jms.ObjectMessage;
+import javax.mail.Address;
+import javax.mail.Session;
+import javax.mail.Transport;
+import javax.mail.Message.RecipientType;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.naming.InitialContext;
+import javax.rmi.PortableRemoteObject;
+import javax.ejb.MessageDriven;
+
+import org.jboss.logging.Logger;
+import org.jboss.wiki.management.NotificationMsg;
+
+public @MessageDriven(activateConfig = {
+ @javax.ejb.ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
+ @javax.ejb.ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/wikiNotifications") })
+class MailNotificationBean implements MessageListener {
+
+ private Logger log = Logger.getLogger(this.getClass());
+
+ public void onMessage(Message msg) {
+
+ log.debug("Mail");
+
+ try {
+
+ ObjectMessage omsg = (ObjectMessage) msg;
+ Session session = null;
+
+ try {
+ session = (Session) PortableRemoteObject
+ .narrow(new InitialContext().lookup("java:Mail"),
+ Session.class);
+ try {
+ if (omsg.getObject() instanceof NotificationMsg) {
+ NotificationMsg notifications = (NotificationMsg) omsg
+ .getObject();
+
+ log.debug("Got email notification msg");
+
+ for (String email : notifications.getEmails()) {
+ log.debug("MDB for: " + email);
+
+ StringBuffer buffer = null;
+ Address[] to = null;
+ MimeMessage m = new MimeMessage(session);
+
+ if (email != null) {
+ m.setFrom(new InternetAddress(notifications.getFromEmail()));
+ to = new InternetAddress[] { new InternetAddress(
+ email) };
+ m.setRecipients(RecipientType.TO, to);
+ m.setSubject("[JBossWiki] Page change notification: " + notifications.getPageName());
+
+ m.setSentDate(new Date());
+ buffer = new StringBuffer();
+
+ buffer.append("This message is generated automaticcaly. Please do not reply. To remove yourself from the watch list please go to ").append(notifications.getPageLink()).append("<br />\n");
+ buffer.append(notifications.getPageContent());
+
+ m.setContent(buffer.toString(), "text/html; charset=\"UTF-8\"");
+ Transport.send(m);
+ }
+ }
+ }
+ } catch (javax.mail.MessagingException e) {
+ log.error(e);
+ }
+ } catch (javax.naming.NamingException e) {
+ log.error(e);
+ }
+ } catch (Exception e) {
+ log.error(e);
+ }
+
+ }
+}*/
Added: contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/management/WikiService.java
===================================================================
--- contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/management/WikiService.java (rev 0)
+++ contrib/wikiPortlet/trunk/wiki-management/src/java/org/jboss/wiki/management/WikiService.java 2009-03-03 18:54:10 UTC (rev 248)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.management;
+
+import javax.ejb.Local;
+import javax.ejb.Remote;
+
+import org.jboss.annotation.ejb.Management;
+import org.jboss.annotation.ejb.Service;
+import org.jboss.logging.Logger;
+import org.jboss.wiki.WikiCommon;
+import org.jboss.wiki.WikiEngine;
+import org.jboss.wiki.management.WikiServiceManagement;
+
+@Service(objectName = WikiCommon.WIKI_SERVICE_NAME)
+(a)Local(WikiServiceLocal.class)
+(a)Remote(WikiServiceRemote.class)
+(a)Management(WikiServiceManagement.class)
+public class WikiService implements WikiServiceLocal, WikiServiceRemote,
+ WikiServiceManagement {
+
+ private WikiEngine wikiEngine;
+
+ private Logger log = Logger.getLogger(WikiService.class);
+
+ public synchronized WikiEngine getWikiEngine() {
+ if (wikiEngine == null) {
+ wikiEngine = new WikiEngine();
+ }
+ return wikiEngine;
+ }
+
+ public void create() throws Exception {
+ log.info("WikiService - Creating");
+ }
+
+ public void start() throws Exception {
+ log.info("WikiService - Starting");
+ }
+
+ public void stop() {
+ log.info("WikiService - Stoping");
+ }
+
+ public void destroy() {
+ log.info("WikiService - Destroying");
+ }
+
+}
15 years, 2 months
JBoss PortletSwap SVN: r246 - in contrib/wikiPortlet/trunk: .settings and 14 other directories.
by portletswap-commits@lists.jboss.org
Author: piergiorgiolucidi
Date: 2009-03-03 13:51:31 -0500 (Tue, 03 Mar 2009)
New Revision: 246
Added:
contrib/wikiPortlet/trunk/.settings/
contrib/wikiPortlet/trunk/.settings/org.eclipse.jdt.core.prefs
contrib/wikiPortlet/trunk/.settings/org.maven.ide.eclipse.prefs
contrib/wikiPortlet/trunk/forge-wiki/
contrib/wikiPortlet/trunk/forge-wiki/.classpath
contrib/wikiPortlet/trunk/forge-wiki/.project
contrib/wikiPortlet/trunk/forge-wiki/maven.xml
contrib/wikiPortlet/trunk/forge-wiki/pom.xml
contrib/wikiPortlet/trunk/forge-wiki/project.properties
contrib/wikiPortlet/trunk/forge-wiki/project.xml
contrib/wikiPortlet/trunk/forge-wiki/src/
contrib/wikiPortlet/trunk/forge-wiki/src/etc/
contrib/wikiPortlet/trunk/forge-wiki/src/java/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/WikiRedirectFilter.java
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/taglib/
contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/test/
contrib/wikiPortlet/trunk/forge-wiki/src/test/
contrib/wikiPortlet/trunk/forge-wiki/src/web/
contrib/wikiPortlet/trunk/forge-wiki/src/web/META-INF/
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-app.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-portlet.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-web.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet-instances.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet_2_0.tld
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/web.xml
contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/wiki-object.xml
Log:
- Portal 2.7.x support: forge-wiki
Added: contrib/wikiPortlet/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- contrib/wikiPortlet/trunk/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ contrib/wikiPortlet/trunk/.settings/org.eclipse.jdt.core.prefs 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,12 @@
+#Mon Jan 26 16:44:32 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: contrib/wikiPortlet/trunk/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- contrib/wikiPortlet/trunk/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ contrib/wikiPortlet/trunk/.settings/org.maven.ide.eclipse.prefs 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,8 @@
+#Fri Jan 23 19:06:36 CET 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+version=1
Added: contrib/wikiPortlet/trunk/forge-wiki/.classpath
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/.classpath (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/.classpath 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: contrib/wikiPortlet/trunk/forge-wiki/.project
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/.project (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/.project 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>forge-wiki</name>
+ <comment></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>
Added: contrib/wikiPortlet/trunk/forge-wiki/maven.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/maven.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/maven.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,31 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util" >
+ <goal name="build">
+
+ <attainGoal name="war" />
+
+ </goal>
+
+ <goal name="deploy">
+
+ <!--<ant:copy todir="${local.deploy.dir}/wiki.ear" flatten="true">
+ <ant:fileset dir=".">
+ <ant:filename name="target/*.war" />
+ </ant:fileset>
+ </ant:copy>
+ <ant:copy
+ tofile="${local.deploy.dir}/${wiki.ear.name}/META-INF/application.xml"
+ file="src/etc/application.xml" />-->
+
+ </goal>
+
+ <goal name="all">
+ <attainGoal name="build" />
+ <attainGoal name="deploy" />
+ </goal>
+
+</project>
Added: contrib/wikiPortlet/trunk/forge-wiki/pom.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/pom.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/pom.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,125 @@
+<!--
+ JBoss, the OpenSource J2EE webOS Distributable under LGPL license. See
+ terms of license at gnu.org.
+ Maven manual install: portal-core-lib.jar
+ portal-portlet-lib javax-servlet.jar javax-servlet-jsp.jar
+ activation.jar jboss-ejb3x.jar jboss-ejb3.jar portal-identity-lib.jar
+ jboss-portlet-api-lib.jar
+
+ author: Piergiorgio Lucidi
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>jboss</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ </parent>
+ <artifactId>forge-wiki</artifactId>
+ <name>JBoss Wiki Forge</name>
+ <version>1.0</version>
+ <description>Wiki portlet and servlet</description>
+ <packaging>war</packaging>
+ <developers>
+ <developer>
+ <name>Tomasz Szymanski</name>
+ <url>http://mamut.net.pl</url>
+ <roles>
+ <role>Retired Project Lead</role>
+ </roles>
+ </developer>
+ <developer>
+ <name>Piergiorgio Lucidi</name>
+ <email>p.lucidi(a)sourcesense.com</email>
+ <url>http://www.open4dev.com/</url>
+ <organization>Sourcesense</organization>
+ <organizationUrl>http://www.sourcesense.com/</organizationUrl>
+ </developer>
+ </developers>
+ <build>
+ <sourceDirectory>${basedir}/src/java</sourceDirectory>
+ <outputDirectory>${basedir}/src/web/WEB-INF/classes</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/etc/</directory>
+ <includes>
+ <include>**/*.properties</include>
+ <include>**/*.xml</include>
+ <include>**/*.types</include>
+ </includes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <configuration>
+ <webappDirectory>${basedir}/src/web/</webappDirectory>
+ <warSourceDirectory>${basedir}/src/web/</warSourceDirectory>
+ <warSourceExcludes>WEB-INF/lib/*.jar</warSourceExcludes>
+ <excludes>**/.svn/**</excludes>
+ <warName>wiki</warName>
+ <outputDirectory>target</outputDirectory>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+</project>
Added: contrib/wikiPortlet/trunk/forge-wiki/project.properties
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/project.properties (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/project.properties 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,6 @@
+maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/
+maven.junit.fork=yes
+maven.war.src=${basedir}/src/web
+maven.jar.includes=**/WikiEngine.class
+maven.ejb.includes=**/WikiService*
+maven.ear.final.name=wiki.ear
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/forge-wiki/project.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/project.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/project.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,138 @@
+<?xml version='1.0' encoding='ISO-8859-1'?>
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../common.xml</extend>
+ <id>wiki</id>
+ <name>Wiki portlet and servlet</name>
+ <currentVersion>1.0</currentVersion>
+ <build>
+ <sourceDirectory>src/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.properties</include>
+ </resource>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.xml</include>
+ </resource>
+ <resource>
+ <directory>src/etc/</directory>
+ <include>**/*.types</include>
+ </resource>
+ </resources>
+ </build>
+ <organization>
+ <name>Tomasz Szymanski</name>
+ <url>http://mamut.net.pl</url>
+ </organization>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>aslibs</groupId>
+ <artifactId>javax.servlet</artifactId>
+ <version>1.0</version>
+ <jar>javax.servlet.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>wiki-common</groupId>
+ <artifactId>wiki-common</artifactId>
+ <version>1.0</version>
+ <jar>wiki-common.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>aslibs</groupId>
+ <artifactId>javax.servlet.jsp</artifactId>
+ <version>1.0</version>
+ <jar>javax.servlet.jsp.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>activation</artifactId>
+ <version>1.0</version>
+ <jar>activation.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload.jar</artifactId>
+ <version>1.0</version>
+ <jar>commons-fileupload-1.0.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jdom</groupId>
+ <artifactId>jdom</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3x</artifactId>
+ <version>1.0</version>
+ <jar>jboss-ejb3x.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>1.0</version>
+ <jar>jboss-ejb3.jar</jar>
+ </dependency>
+
+ <dependency>
+ <id>portlet-api</id>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-jmx</artifactId>
+ <version>1.0</version>
+ <jar>jboss-jmx.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
+ <version>1.0</version>
+ <jar>jboss-common.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-common-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-common-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-core-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-core-lib.jar</jar>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>portal-portlet-lib</artifactId>
+ <version>1.0</version>
+ <jar>portal-portlet-lib.jar</jar>
+ </dependency>
+ </dependencies>
+</project>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletDiskFileUpload.java 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,235 @@
+/*
+ * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $
+ * $Revision: 1.1 $
+ * $Date: 2003/10/01 22:21:43 $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.commons.fileupload;
+
+import java.io.File;
+import java.util.List;
+import javax.portlet.ActionRequest;
+import org.apache.commons.fileupload.DefaultFileItemFactory;
+
+/**
+ * <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: PortletDiskFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett
+ * 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 /* FileItem */parseRequest(ActionRequest req,
+ int sizeThreshold, long sizeMax, String path)
+ throws FileUploadException {
+ setSizeThreshold(sizeThreshold);
+ setSizeMax(sizeMax);
+ setRepositoryPath(path);
+ return parseRequest(req);
+ }
+
+}
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUpload.java 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,155 @@
+/*
+ * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $
+ * $Revision: 1.1 $
+ * $Date: 2003/10/01 22:21:43 $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.commons.fileupload;
+
+
+/**
+ * <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>How the data for individual parts is stored is determined by the factory
+ * used to create them; a given part may be in memory, on disk, or somewhere
+ * else.</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: PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $
+ */
+public class PortletFileUpload
+ extends PortletFileUploadBase
+ {
+
+ // ----------------------------------------------------------- Data members
+
+
+ /**
+ * The factory to use to create new form items.
+ */
+ private FileItemFactory fileItemFactory;
+
+
+ // ----------------------------------------------------------- Constructors
+
+
+ /**
+ * Constructs an instance of this class which uses the default factory to
+ * create <code>FileItem</code> instances.
+ *
+ * @see #FileUpload(FileItemFactory)
+ */
+ public PortletFileUpload()
+ {
+ super();
+ }
+
+
+ /**
+ * Constructs an instance of this class which uses the supplied factory to
+ * create <code>FileItem</code> instances.
+ *
+ * @see #FileUpload()
+ */
+ public PortletFileUpload(FileItemFactory 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.
+ *
+ * @param factory The factory class for new file items.
+ */
+ public void setFileItemFactory(FileItemFactory factory)
+ {
+ this.fileItemFactory = factory;
+ }
+
+
+}
+
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/java/org/apache/commons/fileupload/PortletFileUploadBase.java 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,685 @@
+/*
+ * $Header: /cvsroot/director168/director_standard_portlets/src/org/apache/commons/fileupload/PortletFileUpload.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $
+ * $Revision: 1.1 $
+ * $Date: 2003/10/01 22:21:43 $
+ *
+ * ====================================================================
+ *
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001-2003 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ * any, must include the following acknowlegement:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowlegement may appear in the software itself,
+ * if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ * Foundation" must not be used to endorse or promote products derived
+ * from this software without prior written permission. For written
+ * permission, please contact apache(a)apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ * nor may "Apache" appear in their names without prior written
+ * permission of the Apache Group.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+
+package org.apache.commons.fileupload;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.portlet.ActionRequest;
+
+
+/**
+ * <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>How the data for individual parts is stored is determined by the factory
+ * used to create them; a given part may be in memory, on disk, or somewhere
+ * else.</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: PortletFileUploadBase.java,v 1.1 2003/10/01 22:21:43 jsackett Exp $
+ */
+public abstract class PortletFileUploadBase
+{
+
+ // ---------------------------------------------------------- Class methods
+
+
+ /**
+ * Utility method that determines whether the request contains multipart
+ * content.
+ *
+ * @param req The servlet request to be evaluated. Must be non-null.
+ *
+ * @return <code>true</code> if the request is multipart;
+ * <code>false</code> otherwise.
+ */
+ public static final boolean isMultipartContent(ActionRequest req)
+ {
+ String contentType = req.getContentType();
+ if (contentType == null)
+ {
+ return false;
+ }
+ if (contentType.startsWith(MULTIPART))
+ {
+ return true;
+ }
+ return false;
+ }
+
+
+ // ----------------------------------------------------- Manifest constants
+
+
+ /**
+ * HTTP content type header name.
+ */
+ public static final String CONTENT_TYPE = "Content-type";
+
+
+ /**
+ * HTTP content disposition header name.
+ */
+ public static final String CONTENT_DISPOSITION = "Content-disposition";
+
+
+ /**
+ * Content-disposition value for form data.
+ */
+ public static final String FORM_DATA = "form-data";
+
+
+ /**
+ * Content-disposition value for file attachment.
+ */
+ public static final String ATTACHMENT = "attachment";
+
+
+ /**
+ * Part of HTTP content type header.
+ */
+ public static final String MULTIPART = "multipart/";
+
+
+ /**
+ * HTTP content type header for multipart forms.
+ */
+ public static final String MULTIPART_FORM_DATA = "multipart/form-data";
+
+
+ /**
+ * HTTP content type header for multiple uploads.
+ */
+ public static final String MULTIPART_MIXED = "multipart/mixed";
+
+
+ /**
+ * The maximum length of a single header line that will be parsed
+ * (1024 bytes).
+ */
+ public static final int MAX_HEADER_SIZE = 1024;
+
+
+ // ----------------------------------------------------------- Data members
+
+
+ /**
+ * The maximum size permitted for an uploaded file. A value of -1 indicates
+ * no maximum.
+ */
+ private long sizeMax = -1;
+
+
+ /**
+ * The content encoding to use when reading part headers.
+ */
+ private String headerEncoding;
+
+
+ // ----------------------------------------------------- Property accessors
+
+
+ /**
+ * Returns the factory class used when creating file items.
+ *
+ * @return The factory class for new file items.
+ */
+ public abstract FileItemFactory getFileItemFactory();
+
+
+ /**
+ * Sets the factory class to use when creating file items.
+ *
+ * @param factory The factory class for new file items.
+ */
+ public abstract void setFileItemFactory(FileItemFactory factory);
+
+
+ /**
+ * Returns the maximum allowed upload size.
+ *
+ * @return The maximum allowed size, in bytes.
+ *
+ * @see #setSizeMax(long)
+ *
+ */
+ public long getSizeMax()
+ {
+ return sizeMax;
+ }
+
+
+ /**
+ * Sets the maximum allowed upload size. If negative, there is no maximum.
+ *
+ * @param sizeMax The maximum allowed size, in bytes, or -1 for no maximum.
+ *
+ * @see #getSizeMax()
+ *
+ */
+ public void setSizeMax(long sizeMax)
+ {
+ this.sizeMax = sizeMax;
+ }
+
+
+ /**
+ * Retrieves the character encoding used when reading the headers of an
+ * individual part. When not specified, or <code>null</code>, the platform
+ * default encoding is used.
+ *
+ * @return The encoding used to read part headers.
+ */
+ public String getHeaderEncoding()
+ {
+ return headerEncoding;
+ }
+
+
+ /**
+ * Specifies the character encoding to be used when reading the headers of
+ * individual parts. When not specified, or <code>null</code>, the platform
+ * default encoding is used.
+ *
+ * @param encoding The encoding used to read part headers.
+ */
+ public void setHeaderEncoding(String encoding)
+ {
+ headerEncoding = encoding;
+ }
+
+
+ // --------------------------------------------------------- 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.
+ *
+ * @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 /* FileItem */ parseRequest(ActionRequest req)
+ throws FileUploadException
+ {
+ if (null == req)
+ {
+ throw new NullPointerException("req parameter");
+ }
+
+ ArrayList items = new ArrayList();
+ String contentType = req.getContentType();
+
+ if ((null == contentType) || (!contentType.startsWith(MULTIPART)))
+ {
+ throw new InvalidContentTypeException(
+ "the request doesn't contain a "
+ + MULTIPART_FORM_DATA
+ + " or "
+ + MULTIPART_MIXED
+ + " stream, content type header is "
+ + contentType);
+ }
+ int requestSize = req.getContentLength();
+
+ if (requestSize == -1)
+ {
+ throw new UnknownSizeException(
+ "the request was rejected because it's size is unknown");
+ }
+
+ if (sizeMax >= 0 && requestSize > sizeMax)
+ {
+ throw new SizeLimitExceededException(
+ "the request was rejected because "
+ + "it's size exceeds allowed range");
+ }
+
+ try
+ {
+ int boundaryIndex = contentType.indexOf("boundary=");
+ if (boundaryIndex < 0)
+ {
+ throw new FileUploadException(
+ "the request was rejected because "
+ + "no multipart boundary was found");
+ }
+ byte[] boundary = contentType.substring(
+ boundaryIndex + 9).getBytes();
+
+ InputStream input = req.getPortletInputStream();
+
+ MultipartStream multi = new MultipartStream(input, boundary);
+ multi.setHeaderEncoding(headerEncoding);
+
+ boolean nextPart = multi.skipPreamble();
+ while (nextPart)
+ {
+ Map headers = parseHeaders(multi.readHeaders());
+ String fieldName = getFieldName(headers);
+ if (fieldName != null)
+ {
+ String subContentType = getHeader(headers, CONTENT_TYPE);
+ if (subContentType != null && subContentType
+ .startsWith(MULTIPART_MIXED))
+ {
+ // Multiple files.
+ byte[] subBoundary =
+ subContentType.substring(
+ subContentType
+ .indexOf("boundary=") + 9).getBytes();
+ multi.setBoundary(subBoundary);
+ boolean nextSubPart = multi.skipPreamble();
+ while (nextSubPart)
+ {
+ headers = parseHeaders(multi.readHeaders());
+ if (getFileName(headers) != null)
+ {
+ FileItem item =
+ createItem(headers, false);
+ OutputStream os = item.getOutputStream();
+ try
+ {
+ multi.readBodyData(os);
+ }
+ finally
+ {
+ os.close();
+ }
+ items.add(item);
+ }
+ else
+ {
+ // Ignore anything but files inside
+ // multipart/mixed.
+ multi.discardBodyData();
+ }
+ nextSubPart = multi.readBoundary();
+ }
+ multi.setBoundary(boundary);
+ }
+ else
+ {
+ if (getFileName(headers) != null)
+ {
+ // A single file.
+ FileItem item = createItem(headers, false);
+ OutputStream os = item.getOutputStream();
+ try
+ {
+ multi.readBodyData(os);
+ }
+ finally
+ {
+ os.close();
+ }
+ items.add(item);
+ }
+ else
+ {
+ // A form field.
+ FileItem item = createItem(headers, true);
+ OutputStream os = item.getOutputStream();
+ try
+ {
+ multi.readBodyData(os);
+ }
+ finally
+ {
+ os.close();
+ }
+ items.add(item);
+ }
+ }
+ }
+ else
+ {
+ // Skip this part.
+ multi.discardBodyData();
+ }
+ nextPart = multi.readBoundary();
+ }
+ }
+ catch (IOException e)
+ {
+ throw new FileUploadException(
+ "Processing of " + MULTIPART_FORM_DATA
+ + " request failed. " + e.getMessage());
+ }
+
+ return items;
+ }
+
+
+ // ------------------------------------------------------ Protected methods
+
+
+ /**
+ * Retrieves the file name from the <code>Content-disposition</code>
+ * header.
+ *
+ * @param headers A <code>Map</code> containing the HTTP request headers.
+ *
+ * @return The file name for the current <code>encapsulation</code>.
+ */
+ protected String getFileName(Map /* String, String */ headers)
+ {
+ String fileName = null;
+ String cd = getHeader(headers, CONTENT_DISPOSITION);
+ if (cd.startsWith(FORM_DATA) || cd.startsWith(ATTACHMENT))
+ {
+ int start = cd.indexOf("filename=\"");
+ int end = cd.indexOf('"', start + 10);
+ if (start != -1 && end != -1)
+ {
+ fileName = cd.substring(start + 10, end).trim();
+ }
+ }
+ return fileName;
+ }
+
+
+ /**
+ * Retrieves the field name from the <code>Content-disposition</code>
+ * header.
+ *
+ * @param headers A <code>Map</code> containing the HTTP request headers.
+ *
+ * @return The field name for the current <code>encapsulation</code>.
+ */
+ protected String getFieldName(Map /* String, String */ headers)
+ {
+ String fieldName = null;
+ String cd = getHeader(headers, CONTENT_DISPOSITION);
+ if (cd != null && cd.startsWith(FORM_DATA))
+ {
+ int start = cd.indexOf("name=\"");
+ int end = cd.indexOf('"', start + 6);
+ if (start != -1 && end != -1)
+ {
+ fieldName = cd.substring(start + 6, end);
+ }
+ }
+ return fieldName;
+ }
+
+
+ /**
+ * Creates a new {@link FileItem} instance.
+ *
+ * @param headers A <code>Map</code> containing the HTTP request
+ * headers.
+ * @param isFormField Whether or not this item is a form field, as
+ * opposed to a file.
+ *
+ * @return A newly created <code>FileItem</code> instance.
+ *
+ * @exception FileUploadException if an error occurs.
+ */
+ protected FileItem createItem(Map /* String, String */ headers,
+ boolean isFormField)
+ throws FileUploadException
+ {
+ return getFileItemFactory().createItem(getFieldName(headers),
+ getHeader(headers, CONTENT_TYPE),
+ isFormField,
+ getFileName(headers));
+ }
+
+
+ /**
+ * <p> Parses the <code>header-part</code> and returns as key/value
+ * pairs.
+ *
+ * <p> If there are multiple headers of the same names, the name
+ * will map to a comma-separated list containing the values.
+ *
+ * @param headerPart The <code>header-part</code> of the current
+ * <code>encapsulation</code>.
+ *
+ * @return A <code>Map</code> containing the parsed HTTP request headers.
+ */
+ protected Map /* String, String */ parseHeaders(String headerPart)
+ {
+ Map headers = new HashMap();
+ char buffer[] = new char[MAX_HEADER_SIZE];
+ boolean done = false;
+ int j = 0;
+ int i;
+ String header, headerName, headerValue;
+ try
+ {
+ while (!done)
+ {
+ i = 0;
+ // Copy a single line of characters into the buffer,
+ // omitting trailing CRLF.
+ while (i < 2 || buffer[i - 2] != '\r' || buffer[i - 1] != '\n')
+ {
+ buffer[i++] = headerPart.charAt(j++);
+ }
+ header = new String(buffer, 0, i - 2);
+ if (header.equals(""))
+ {
+ done = true;
+ }
+ else
+ {
+ if (header.indexOf(':') == -1)
+ {
+ // This header line is malformed, skip it.
+ continue;
+ }
+ headerName = header.substring(0, header.indexOf(':'))
+ .trim().toLowerCase();
+ headerValue =
+ header.substring(header.indexOf(':') + 1).trim();
+ if (getHeader(headers, headerName) != null)
+ {
+ // More that one heder of that name exists,
+ // append to the list.
+ headers.put(headerName,
+ getHeader(headers, headerName) + ','
+ + headerValue);
+ }
+ else
+ {
+ headers.put(headerName, headerValue);
+ }
+ }
+ }
+ }
+ catch (IndexOutOfBoundsException e)
+ {
+ // Headers were malformed. continue with all that was
+ // parsed.
+ }
+ return headers;
+ }
+
+
+ /**
+ * Returns the header with the specified name from the supplied map. The
+ * header lookup is case-insensitive.
+ *
+ * @param headers A <code>Map</code> containing the HTTP request headers.
+ * @param name The name of the header to return.
+ *
+ * @return The value of specified header, or a comma-separated list if
+ * there were multiple headers of that name.
+ */
+ protected final String getHeader(Map /* String, String */ headers,
+ String name)
+ {
+ return (String) headers.get(name.toLowerCase());
+ }
+
+
+ /**
+ * Thrown to indicate that the request is not a multipart request.
+ */
+ public static class InvalidContentTypeException
+ extends FileUploadException
+ {
+ /**
+ * Constructs a <code>InvalidContentTypeException</code> with no
+ * detail message.
+ */
+ public InvalidContentTypeException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an <code>InvalidContentTypeException</code> with
+ * the specified detail message.
+ *
+ * @param message The detail message.
+ */
+ public InvalidContentTypeException(String message)
+ {
+ super(message);
+ }
+ }
+
+
+ /**
+ * Thrown to indicate that the request size is not specified.
+ */
+ public static class UnknownSizeException
+ extends FileUploadException
+ {
+ /**
+ * Constructs a <code>UnknownSizeException</code> with no
+ * detail message.
+ */
+ public UnknownSizeException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an <code>UnknownSizeException</code> with
+ * the specified detail message.
+ *
+ * @param message The detail message.
+ */
+ public UnknownSizeException(String message)
+ {
+ super(message);
+ }
+ }
+
+
+ /**
+ * Thrown to indicate that the request size exceeds the configured maximum.
+ */
+ public static class SizeLimitExceededException
+ extends FileUploadException
+ {
+ /**
+ * Constructs a <code>SizeExceededException</code> with no
+ * detail message.
+ */
+ public SizeLimitExceededException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs an <code>SizeExceededException</code> with
+ * the specified detail message.
+ *
+ * @param message The detail message.
+ */
+ public SizeLimitExceededException(String message)
+ {
+ super(message);
+ }
+ }
+
+}
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki;
+
+import javax.portlet.PortletSession;
+
+public class PortletWikiSession implements WikiSession {
+
+ PortletSession portletSession;
+
+ public Object getAttribute(String attributeName) {
+ return portletSession.getAttribute(attributeName);
+ }
+
+ public void setAttribute(String attributeName, Object attribute) {
+ portletSession.setAttribute(attributeName, attribute);
+ }
+
+ public void removeAttribute(String attributeName) {
+ portletSession.removeAttribute(attributeName);
+ }
+
+ public PortletWikiSession(PortletSession portletSession) {
+ this.portletSession = portletSession;
+ }
+
+ public String getId() {
+ return portletSession.getId();
+ }
+
+}
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/ServletWikiSession.java 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki;
+
+import javax.servlet.http.HttpSession;
+
+public class ServletWikiSession implements WikiSession {
+
+ HttpSession httpSession;
+
+ public Object getAttribute(String arg0) {
+ return httpSession.getAttribute(arg0);
+ }
+
+ public void setAttribute(String arg0, Object arg1) {
+ httpSession.setAttribute(arg0, arg1);
+ }
+
+ public void removeAttribute(String arg0) {
+ httpSession.removeAttribute(arg0);
+ }
+
+ public ServletWikiSession(HttpSession httpSession) {
+ this.httpSession = httpSession;
+ }
+
+ public String getId() {
+ return httpSession.getId();
+ }
+
+}
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,643 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.portlet.ActionRequest;
+import javax.portlet.PortletException;
+import javax.portlet.PortletSession;
+
+import org.apache.commons.fileupload.FileItem;
+import org.apache.commons.fileupload.FileUploadException;
+import org.apache.commons.fileupload.PortletDiskFileUpload;
+import org.jboss.logging.Logger;
+import org.jboss.portlet.JBossActionRequest;
+import org.jboss.portlet.JBossActionResponse;
+import org.jboss.portlet.JBossPortlet;
+import org.jboss.portlet.JBossRenderRequest;
+import org.jboss.portlet.JBossRenderResponse;
+import org.jboss.wiki.exceptions.EditSessionExpired;
+import org.jboss.wiki.exceptions.EditingNotAllowedException;
+import org.jboss.wiki.exceptions.WikiManagementNotFoundException;
+import org.jboss.wiki.exceptions.WikiSaveException;
+import org.jboss.wiki.management.WikiServiceManagement;
+
+/**
+ * The WikiPortlet.
+ * <p>
+ *
+ * @author <a href="mailto:dsicore@jboss.org">Damon Sicore</a>
+ * @author <a href="mailto:tomasz.szymanski@jboss.com">Tomasz Szymanski</a>
+ * @author <a href="mailto:piergiorgiolucidi@gmail.com">Piergiorgio Lucidi</a>
+ * @version $Id$
+ */
+
+public class WikiPortlet extends JBossPortlet {
+
+ final static String jspPath = "/WEB-INF/jsp/";
+
+ private static final String WINDOWS_FILE_NAME = "\\w:\\\\.+";
+
+ private String defaultPage = "Main";
+
+ private WikiEngine wikiEngine;
+
+ private Logger log;
+
+ public void init() {
+ log = Logger.getLogger(WikiPortlet.class);
+
+ WikiCommon wikiCommon = new WikiCommon();
+
+ try {
+ WikiServiceManagement wikiServiceMenagement = wikiCommon
+ .getWikiManagement();
+ wikiEngine = wikiServiceMenagement.getWikiEngine();
+ } catch (WikiManagementNotFoundException e1) {
+ log.error("Couldn't find WikiManagement", e1);
+ wikiEngine = new WikiEngine();
+ }
+ }
+
+ private Map<String, String> convertParameters(ActionRequest rReq) {
+ Map<String, String> convertedParameters = new HashMap<String, String>();
+
+ Map paramMap = rReq.getParameterMap();
+
+ for (Object key : paramMap.keySet()) {
+ try {
+ if (rReq.getParameter("editAction") != null) {
+ convertedParameters.put((String) key, new String(rReq
+ .getParameter((String) key).getBytes("ISO-8859-1"),
+ "UTF-8"));
+ } else {
+ convertedParameters.put((String) key, rReq
+ .getParameter((String) key));
+ }
+ } catch (UnsupportedEncodingException e) {
+ log.error(e);
+ convertedParameters.put((String) key, (String) paramMap
+ .get(key));
+ }
+ }
+
+ return convertedParameters;
+ }
+
+ public void processAction(JBossActionRequest rReq, JBossActionResponse rResp) {
+
+ Map<String, String> convertedParameters = convertParameters(rReq);
+
+ Credentials credentials = wikiEngine.getCredentialsInstance(rReq);
+
+
+
+
+ // wikiContext is null - to get refernece to actual page
+
+ WikiContext wikiContext = null;
+
+ if (PortletDiskFileUpload.isMultipartContent(rReq)) {
+ PortletDiskFileUpload dfu = new PortletDiskFileUpload();
+
+ // maximum allowed file upload size (10 MB)
+ dfu.setSizeMax(10 * 1000 * 1000);
+
+ // maximum size in memory (vs disk) (100 KB)
+ dfu.setSizeThreshold(100 * 1000);
+
+ try {
+ // get the FileItems
+ List fileItems = dfu.parseRequest(rReq);
+ Iterator iter = fileItems.iterator();
+ while (iter.hasNext()) {
+ FileItem item = (FileItem) iter.next();
+ if (item.isFormField()) {
+ // pass along to render request
+ String fieldName = item.getFieldName();
+ String value = item.getString();
+ rResp.setRenderParameter(fieldName, value);
+ } else {
+ // write the uploaded file to a new location
+ String fieldName = item.getFieldName();
+ String fileName = item.getName();
+
+ // change windows names (remove c:\bull\shit\)
+ if (fileName.matches(WINDOWS_FILE_NAME)) {
+ fileName = fileName.substring(fileName
+ .lastIndexOf('\\') + 1, fileName.length());
+ }
+
+ if (fileName.length() == 0) {
+ throw new FileUploadException("Wrong file name: "
+ + item.getName());
+ }
+
+ // delete spaces
+
+ while (fileName.indexOf(' ') != -1) {
+ Character chr = fileName.charAt(fileName
+ .indexOf(' ') + 1);
+
+ fileName = fileName.substring(0, fileName
+ .indexOf(' '))
+ + (char) Character.toUpperCase(chr)
+ + fileName.substring(
+ fileName.indexOf(' ') + 2, fileName
+ .length());
+ }
+
+ String tempDir = System.getProperty("java.io.tmpdir");
+ String serverFileName = fieldName + fileName
+ + "-portlet.tmp";
+
+ File serverFile = new File(tempDir, serverFileName);
+
+ item.write(serverFile);
+
+ log.info("serverFileName : " + tempDir + "/"
+ + serverFileName + " filename: " + fileName);
+
+ WikiPage pageWithAtt = wikiEngine.getByName(
+ convertedParameters.get("page"), null,
+ (String) convertedParameters.get("language"));
+
+ FileInputStream fis = new FileInputStream(serverFile);
+
+ pageWithAtt.addAttachement(fis, fileName, credentials
+ .getName());
+
+ // at the end delete the temp file
+ serverFile.delete();
+ }
+ }
+ } catch (FileUploadException fue) {
+ String msg = "File Upload Exception: " + fue.getMessage();
+ rResp.setRenderParameter("error", msg);
+ getPortletContext().log(msg, fue);
+ } catch (Exception e) {
+ String msg = "Exception: " + e.getMessage();
+ rResp.setRenderParameter("error", msg);
+ getPortletContext().log(msg, e);
+ }
+ }
+
+ if (convertedParameters.get("page") != null
+ && (convertedParameters.get("page").length() > 0)) {
+ StringBuffer sBuf = new StringBuffer(convertedParameters
+ .get("page"));
+
+ if (Character.isLowerCase(sBuf.charAt(0))) {
+ // change first letter to upper if it isn't
+ sBuf.setCharAt(0, Character.toUpperCase(sBuf.charAt(0)));
+ }
+
+ //
+ // Capitalise words in subpages
+ //
+
+ for (int i = 0; i < sBuf.length() - 1; i++) {
+ if ((sBuf.charAt(i) == '/')
+ && (Character.isLowerCase(sBuf.charAt(i + 1)))) {
+ sBuf.setCharAt(i + 1, Character.toUpperCase(sBuf
+ .charAt(i + 1)));
+ }
+ }
+
+ rResp.setRenderParameter("page", sBuf.toString());
+
+ }
+
+ if (convertedParameters.get("searchQuery") != null) {
+ Map<String, Integer> pages = wikiEngine.findPages(
+ convertedParameters.get("searchQuery"),
+ (String) convertedParameters.get("language"));
+
+ rReq.getPortletSession().setAttribute("findResult", pages);
+
+ // show the results
+ rResp.setRenderParameter("page", "FindResult");
+ }
+
+ int i = 1;
+
+ while (convertedParameters.get("var" + i) != null) {
+ rReq.getPortletSession().setAttribute("var" + i,
+ convertedParameters.get("var" + i));
+ i++;
+ }
+
+ if (convertedParameters.get("action") != null) {
+ rResp.setRenderParameter("action", convertedParameters
+ .get("action"));
+ }
+
+ if (convertedParameters.get("type") != null) {
+ rResp.setRenderParameter("type", convertedParameters.get("type"));
+ }
+
+ if (convertedParameters.get("version") != null) {
+ log.info("[process action]Getting page "
+ + convertedParameters.get("page") + " at version "
+ + convertedParameters.get("version"));
+ rResp.setRenderParameter("version", convertedParameters
+ .get("version"));
+ }
+
+ if (convertedParameters.get("language") != null) {
+ rResp.setRenderParameter("language", (String) convertedParameters
+ .get("language"));
+ } else {
+ rResp.setRenderParameter("language", wikiEngine.defaultLangugeCode);
+ }
+
+ if (convertedParameters.get("editAction") != null) {
+ log.debug("EDITING PAGE");
+
+ String editedPageName = convertedParameters.get("editedPage");
+
+ // unlock page
+ WikiPage edPage = wikiEngine.getByName(editedPageName, wikiContext,
+ (String) convertedParameters.get("language"));
+
+ if (edPage != null) { // it may be null if the page isn't saved
+ // yet
+ edPage.unlock(credentials, Integer
+ .valueOf((String) convertedParameters
+ .get("editSessionId")));
+ }
+
+ // saving, previewing or canceling
+
+ if (convertedParameters.get("editAction").equals("Save")) {
+
+ // save the page
+
+ if (edPage == null) {
+ edPage = new WikiPage(editedPageName, credentials, "", 0,
+ 0, new Date(), wikiEngine, true, true, null, null,
+ 0, (String) convertedParameters.get("language"));
+ }
+
+ // set new content
+ edPage.setContent(convertedParameters.get("wikiContent"));
+
+ // set author name for new version
+ edPage.setLastAuthor(credentials);
+
+ // increase page version
+ edPage.setLastVersion(edPage.getLastVersion() + 1);
+
+ // set new data
+ edPage.setEditDate(new Date());
+
+ // save the page
+ try {
+ edPage.save(credentials, Integer
+ .valueOf((String) convertedParameters
+ .get("editSessionId")),
+ (String) convertedParameters.get("language"),
+ new PortletWikiSession(rReq.getPortletSession()));
+ } catch (NumberFormatException e) {
+ log.error(e);
+ } catch (EditSessionExpired e) {
+ rReq.setAttribute("errorMsg", e.getMessage());
+ log.error(e);
+ } catch (WikiSaveException e) {
+ rReq.setAttribute("errorMsg", e.getMessage());
+ log.error(e);
+ } catch (EditingNotAllowedException e) {
+ rReq.setAttribute("errorMsg", e.getMessage());
+ log.error(e);
+ }
+
+ // and finally remove old page object from memory to force
+ // reloading it
+ wikiEngine.refreshPage(edPage.getName(), edPage.getLangCode());
+ }
+ }
+
+ }
+
+ public void doView(JBossRenderRequest rReq, JBossRenderResponse rRes)
+ throws PortletException, java.io.IOException {
+ try {
+ WikiSession wikiSession = new PortletWikiSession(rReq
+ .getPortletSession());
+
+ Credentials credentials = wikiEngine.getCredentialsInstance(rReq);
+
+ String langCode = rReq.getParameter("language");
+
+ if (langCode == null) {
+ langCode = wikiEngine.defaultLangugeCode;
+ }
+
+ String wikiURL = rRes.createActionURL().toString() + "&language=" + langCode;
+
+ rReq.setAttribute("actionURL", wikiURL);
+
+ if (langCode == null) {
+ langCode = wikiEngine.defaultLangugeCode;
+ }
+
+ boolean showPage = true;
+
+ // Create server host and put it into session for plugins
+ String hostURL = ((rReq.isSecure()) ? "https" : "http")
+ + "://"
+ + rReq.getServerName()
+ + ((rReq.getServerPort() == 80) ? "" : ":"
+ + rReq.getServerPort());
+
+ prepareSession(rReq.getPortletSession(), credentials, hostURL, wikiURL, rReq.isSecure());
+
+ /*
+ * WikiPage noSuchPage = new WikiPage("", credentials, "There is no
+ * such page. Click on EDIT to start it.", 0, 0, null,
+ * wikiEngine.getMediaDataSource(), wikiEngine
+ * .getAttachementDataSource(), true, true);
+ */
+
+ String page = "Wiki.jsp";
+
+ String wikiPage = defaultPage;
+
+ WikiPage pageToShow = null;
+
+ WikiContext wikiContext = null;
+
+ if (rReq.getParameter("page") != null) {
+ wikiPage = rReq.getParameter("page");
+ }
+
+ if ((rReq.getParameter("action") != null)
+ && (rReq.getParameter("action").equals("Attach"))) {
+ rReq.setAttribute("fileAttach", "true");
+ }
+
+ if ((rReq.getParameter("action") != null)
+ && (rReq.getParameter("action").equals("Edit"))
+ && (credentials.isLoggedIn())) {
+ page = "Edit.jsp";
+ showPage = false;
+
+ WikiContext editWikiContext = new WikiContext(credentials,
+ wikiEngine.getWikiType("edit"), wikiSession);
+
+ pageToShow = wikiEngine.getByName(wikiPage, editWikiContext,
+ langCode);
+
+ if ((pageToShow != null)
+ && (!pageToShow.isEditable(credentials))) {
+ if (!credentials.isAdmin()) {
+ showPage = true;
+ }
+ } else {
+ if (rReq.getParameter("version") != null) {
+ // show previous version of page
+
+ log.info("Getting page " + wikiPage + " at version "
+ + rReq.getParameter("version"));
+
+ if ((pageToShow.getLastVersion() > Integer.valueOf(rReq
+ .getParameter("version")))) {
+ pageToShow = wikiEngine
+ .getByName(wikiPage, editWikiContext,
+ Integer.valueOf(rReq
+ .getParameter("version")),
+ langCode);
+ }
+
+ if (pageToShow.getLastVersion() != pageToShow
+ .getVersion()) {
+ rReq.setAttribute("showedVersion", Integer
+ .valueOf(rReq.getParameter("version")));
+ }
+ } else {
+ pageToShow = wikiEngine.getByName(wikiPage,
+ editWikiContext, langCode);
+ }
+
+ if (pageToShow == null) {
+ // start editing new page
+ // wikiPage = defaultPage;
+
+ pageToShow = new WikiPage(wikiPage, credentials, "", 0,
+ 0, new Date(), wikiEngine, true, true, null,
+ null, 0, langCode);
+ // wikiEngine.getByName(wikiPage, wikiContext);
+ }
+
+ int editSessionId = wikiEngine.getEditSessionId();
+
+ Date dateLock = wikiEngine.getByName(wikiPage, null,
+ langCode).lock(credentials, editSessionId);
+
+ rReq.setAttribute("editSessionId", String
+ .valueOf(editSessionId));
+
+ if (dateLock != null) {
+ rReq
+ .setAttribute(
+ "lockMsg",
+ "Page is locked by "
+ + pageToShow.getLockUser()
+ + " from "
+ + dateLock
+ + ".<br> I won't stop you from saving, but you or he can erease each other changes. Lock will expire: ");
+ }
+ }
+ } else if ((rReq.getParameter("action") != null)
+ && (rReq.getParameter("action").equals("Info"))) {
+ page = "PageInfo.jsp";
+ showPage = false;
+
+ pageToShow = wikiEngine.getByName(wikiPage, null, langCode);
+
+ /*
+ * if (pageToShow == null) { // if somebody entered a link to
+ * info // non-existing page page = "Wiki.jsp"; try { pageToShow =
+ * (WikiPage) noSuchPage.clone(); } catch
+ * (CloneNotSupportedException cnse) { log.info(cnse); }
+ *
+ * pageToShow.setName(wikiPage); } else {
+ */
+ rReq.setAttribute("pageAtTop", pageToShow);
+
+ }
+
+ if (showPage) {
+ page = "Wiki.jsp";
+
+ String type = "html";
+
+ if (rReq.getParameter("type") != null) {
+ type = rReq.getParameter("type");
+ // log.info("Getting type: " + type);
+ }
+
+ wikiContext = new WikiContext(credentials, wikiEngine
+ .getWikiType(type), new PortletWikiSession(rReq
+ .getPortletSession()));
+
+ if (rReq.getParameter("version") != null) {
+ // show previous version of page
+ log.info("Getting page " + wikiPage + " at version "
+ + rReq.getParameter("version"));
+ pageToShow = wikiEngine.getByName(wikiPage, wikiContext,
+ Integer.valueOf(rReq.getParameter("version")),
+ langCode);
+
+ if (pageToShow.getLastVersion() != pageToShow.getVersion()) {
+ rReq.setAttribute("showedVersion", Integer.valueOf(rReq
+ .getParameter("version")));
+ }
+ } else {
+ pageToShow = wikiEngine.getByName(wikiPage, wikiContext,
+ langCode);
+ }
+
+ /*
+ * if (pageToShow == null) {
+ *
+ * try { pageToShow = (WikiPage) noSuchPage.clone(); } catch
+ * (CloneNotSupportedException cnse) { log.info(cnse); }
+ *
+ * pageToShow.setName(wikiPage); }
+ */
+
+ }
+
+ rReq
+ .setAttribute(
+ "wikiName",
+ "<img src=\""
+ + hostURL
+ + "/wiki/"
+ + WikiCommon.wikiButtons
+ + "/JBossWikiLogoMedium.png\" width=\"100\" border=\"0\" style=\"vertical-align: middle\"/>");
+
+ rReq.setAttribute("wikiContent", pageToShow.getContent());
+
+ rReq.setAttribute("wikiImagesUrl", hostURL + "/wiki/"
+ + WikiCommon.wikiButtons + "/");
+
+ rReq.setAttribute("wikiPage", pageToShow.getName());
+
+ rReq.setAttribute("editDate", pageToShow.getEditDate());
+
+ rReq.setAttribute("author", pageToShow.getLastAuthor());
+
+ rReq.setAttribute("logedIn", credentials.isLoggedIn());
+
+ rReq.setAttribute("defaultPage", defaultPage);
+
+ rReq.setAttribute("isEditable", pageToShow.isEditable(credentials));
+
+ rReq.setAttribute("isViewable", pageToShow.isViewable(credentials));
+
+ rReq.setAttribute("isAdmin", credentials.isAdmin());
+
+ rReq.setAttribute("usedLangs", wikiEngine.getUsedLanguageCodes());
+
+ rReq.setAttribute("currentLanguage", langCode);
+
+ rReq
+ .setAttribute(
+ "friendlyLink",
+ hostURL
+ + "/wiki/"
+ + ((!langCode
+ .equals(wikiEngine.defaultLangugeCode)) ? langCode
+ .toLowerCase()
+ + "/"
+ : "") + pageToShow.getName());
+ rReq
+ .setAttribute(
+ "rssLink",
+ hostURL
+ + "/wiki/"
+ + ((!langCode
+ .equals(wikiEngine.defaultLangugeCode)) ? langCode
+ .toLowerCase()
+ + "/"
+ : "") + "rss/"
+ + pageToShow.getName());
+ rReq
+ .setAttribute(
+ "rdfLink",
+ hostURL
+ + "/wiki/"
+ + ((!langCode
+ .equals(wikiEngine.defaultLangugeCode)) ? langCode
+ .toLowerCase()
+ + "/"
+ : "") + "rdf/"
+ + pageToShow.getName());
+ rReq
+ .setAttribute(
+ "atomLink",
+ hostURL
+ + "/wiki/"
+ + ((!langCode
+ .equals(wikiEngine.defaultLangugeCode)) ? langCode
+ .toLowerCase()
+ + "/"
+ : "") + "atom/"
+ + pageToShow.getName());
+
+ rRes.setTitle("Wiki");
+ if (javax.portlet.WindowState.NORMAL.equals(rReq.getWindowState())
+ || javax.portlet.WindowState.MAXIMIZED.equals(rReq
+ .getWindowState())) {
+ rRes.setContentType("text/html; charset=UTF-8");
+ javax.portlet.PortletRequestDispatcher pRD = this
+ .getPortletContext().getRequestDispatcher(
+ jspPath + page);
+ pRD.include(rReq, rRes);
+ return;
+ }
+ doDispatch((JBossRenderRequest)rReq, (JBossRenderResponse)rRes);
+ } catch (RuntimeException e) {
+ e.printStackTrace();
+ throw (e);
+ }
+ }
+
+ private void prepareSession(PortletSession portletSession,
+ Credentials credentials, String hostURL, String wikiURL, Boolean isSecure) {
+ // prepare some data for plugins in session
+ portletSession.setAttribute(WikiSession.CREDENTIALS, credentials);
+ portletSession.setAttribute(WikiSession.HOST_URL, hostURL);
+ portletSession.setAttribute(WikiSession.ACTION_URL, wikiURL);
+ portletSession.setAttribute(WikiSession.IS_SECURE, isSecure);
+ }
+}
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,394 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.fileaccess;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.net.URLDecoder;
+import java.net.URLEncoder;
+import java.util.Properties;
+
+import javax.activation.MimetypesFileTypeMap;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.jboss.logging.Logger;
+import org.jboss.wiki.FileMediaDataSource;
+import org.jboss.wiki.ServletWikiSession;
+import org.jboss.wiki.SimpleCredentials;
+import org.jboss.wiki.WikiAttachment;
+import org.jboss.wiki.WikiCommon;
+import org.jboss.wiki.WikiContext;
+import org.jboss.wiki.WikiEngine;
+import org.jboss.wiki.WikiPage;
+import org.jboss.wiki.WikiPlugin;
+import org.jboss.wiki.WikiSession;
+import org.jboss.wiki.exceptions.WikiManagementNotFoundException;
+import org.jboss.wiki.management.WikiServiceManagement;
+
+
+/**
+ * A filter that enables to download files form the jspwiki structure +
+ * redirects to pages by typing http://domain/wiki/Page
+ *
+ * @author tomek
+ */
+
+public class WikiFileAccessFilter implements Filter {
+ /**
+ * <code>BUF_SIZE</code> - size of a buffer, which is used while reading a
+ * file and sending it to the client.
+ */
+
+ private final int BUF_SIZE = 32768;
+
+ private String attachementsPath;
+
+ private String wikiHome;
+
+ private WikiEngine wikiEngine;
+
+ /*
+ * private ForgeHelper forgeHelper; private ContentManager contentManager;
+ */
+ private MimetypesFileTypeMap mimeTypes;
+
+ private Logger log;
+
+ public void init(FilterConfig conf) {
+ // get wikiEnigne form wikiMenagement
+
+ log = Logger.getLogger(WikiFileAccessFilter.class);
+
+ try {
+ WikiServiceManagement wikiServiceMenagement = WikiCommon
+ .getWikiManagement();
+ wikiEngine = wikiServiceMenagement.getWikiEngine();
+ } catch (WikiManagementNotFoundException e1) {
+ log.error("Couldn't find WikiManagement", e1);
+ wikiEngine = new WikiEngine();
+ }
+
+ // load mime types map
+
+ mimeTypes = new MimetypesFileTypeMap(WikiFileAccessFilter.class
+ .getResourceAsStream("mime.types"));
+
+ // load path to attachements from filedatasource.properties
+
+ Properties props = new Properties();
+
+ try {
+ props.load(FileMediaDataSource.class
+ .getResourceAsStream("filedatasource.properties"));
+
+ // get the path to attachment property
+ attachementsPath = props.getProperty("pathToAttachements");
+
+ props.load(WikiPlugin.class
+ .getResourceAsStream("wikiPlugins.properties"));
+
+ // get the host
+ wikiHome = props.getProperty("wikiHome");
+
+ } catch (IOException e) {
+ log.error(e);
+ }
+
+ log.info("Loaded attachements path: " + attachementsPath);
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+
+ String langCode = wikiEngine.defaultLangugeCode;
+
+ if (request instanceof HttpServletRequest) {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+
+ WikiSession wikiSession = new ServletWikiSession(httpRequest
+ .getSession());
+
+ String hostURL = ((request.isSecure()) ? "https" : "http")
+ + "://"
+ + request.getServerName()
+ + ((request.getServerPort() == 80) ? "" : ":"
+ + request.getServerPort());
+
+ wikiSession.setAttribute("hostURL", hostURL);
+
+ String requestURI = URLDecoder.decode(httpRequest.getRequestURI(),
+ "UTF-8");
+
+ // get off "/wiki/" from the begining
+ requestURI = requestURI.substring("/wiki/".length());
+
+ // support old type link with Wiki.jsp?page=
+ if (requestURI.equals("Wiki.jsp")) {
+ if (httpRequest.getParameter("page") != null)
+ httpResponse.sendRedirect(hostURL + wikiHome + "&page="
+ + httpRequest.getParameter("page"));
+ else
+ httpResponse.sendRedirect(hostURL + wikiHome);
+
+ return;
+ }
+
+ while (requestURI.endsWith("/")) {
+ // get rid of ending "/" character(s)
+ requestURI = requestURI.substring(0, requestURI.length() - 1);
+ }
+
+ int version = -1;
+
+ if (requestURI.matches(".*:\\d+")) {
+ // there is a ":" at the end of request uri - pick a version
+
+ int verStart = requestURI.lastIndexOf(":");
+ version = Integer.valueOf(requestURI.substring(verStart + 1));
+ requestURI = requestURI.substring(0, verStart);
+ }
+ // Parse URI to get filename and page name
+ String[] tokens = requestURI.split("[/]");
+
+ if ((tokens.length == 1) && (tokens[0].equals(""))) {
+ // show Main page - as there is no place to go specified :)
+ httpResponse.sendRedirect(hostURL + wikiHome);
+ return;
+ }
+
+ // check if user is browsing different then default language
+ if (wikiEngine.getUsedLanguageCodes().containsKey(
+ tokens[0].toUpperCase())) {
+ langCode = tokens[0].toUpperCase();
+ // redo tokens but without language
+ if (requestURI.startsWith(tokens[0] + "/")) {
+ requestURI = requestURI.substring((tokens[0] + "/")
+ .length());
+ } else {
+ requestURI = requestURI.substring((tokens[0]).length());
+ }
+
+ tokens = requestURI.split("[/]");
+
+ if ((tokens.length == 1) && (tokens[0].equals(""))) {
+ // show Main page - as there is no place to go specified :)
+ httpResponse.sendRedirect(hostURL + wikiHome + "&language="
+ + langCode);
+ return;
+ }
+ }
+
+ // check if all tokens are UpperCase (meanins they are all wiki
+ // pages)
+ boolean isAllUpperCase = true;
+
+ for (int i = 0; i < tokens.length; i++)
+ // uppercase or UTF character
+ if (!(Character.isUpperCase(tokens[i].charAt(0)) || (tokens[i]
+ .charAt(0) > 127 && Character.isLetter(tokens[i]
+ .charAt(0))))) {
+ isAllUpperCase = false;
+ break;
+ }
+
+ if (isAllUpperCase) {
+ String pageName = "";
+
+ for (int i = 0; i < tokens.length; i++) {
+ pageName += "/" + URLEncoder.encode(tokens[i], "UTF-8");
+ }
+
+ if (Character.isUpperCase(tokens[tokens.length - 1].charAt(0))
+ || (tokens[tokens.length - 1].charAt(0) > 127 && Character
+ .isLetter(tokens[tokens.length - 1].charAt(0)))) {
+ httpResponse.sendRedirect(hostURL + wikiHome + "&page="
+ + pageName.substring(1)
+ + ((version != -1) ? "&version=" + version : "")
+ + "&language=" + langCode);
+ } else {
+ PrintWriter out = httpResponse.getWriter();
+ httpResponse.setContentType("text/html");
+ out
+ .println("<html><body><h3>ERROR</h3><br />\nPage name must start with upper case letter.</body></html>");
+ }
+
+ } else if (tokens[0].equals(WikiCommon.wikiButtons)) {
+ // show apropriate buttons
+ InputStream imageIS = WikiFileAccessFilter.class
+ .getResourceAsStream("/images/"
+ + tokens[tokens.length - 1]);
+
+ ServletOutputStream os = response.getOutputStream();
+
+ response.setContentType(mimeTypes
+ .getContentType(tokens[tokens.length - 1]));
+
+ // Transferring the bytes
+ try {
+ byte[] buffer = new byte[BUF_SIZE];
+ int read;
+ while ((read = imageIS.read(buffer)) != -1)
+ os.write(buffer, 0, read);
+ } catch (Exception e2) {
+ // Nothing that we can really do. Just send an
+ // incomplete
+ // file.
+ } finally {
+ os.close();
+ imageIS.close();
+ }
+
+ } else if ((Character.isLowerCase(tokens[0].charAt(0)))
+ && (tokens.length > 1)) {
+ boolean isPageNameUC = true;
+
+ for (int i = 1; i < tokens.length; i++)
+ if (Character.isLowerCase(tokens[i].charAt(0))) {
+ isPageNameUC = false;
+ break;
+ }
+
+ if (isPageNameUC) {
+ // SHOW wikiType firstToken with page secondToken
+
+ String wikiTypeName = tokens[0];
+
+ if (wikiEngine.wikiTypeExists(wikiTypeName)) {
+
+ // get pageName
+ String pageName = "";
+ for (int i = 1; i < tokens.length; i++) {
+ pageName += "/" + tokens[i];
+ }
+
+ pageName = pageName.substring(1);
+
+ WikiPage page = wikiEngine.getByName(pageName,
+ new WikiContext(new SimpleCredentials(""),
+ wikiEngine.getWikiType(wikiTypeName),
+ wikiSession), langCode);
+
+ httpResponse.setContentType(wikiEngine.getWikiType(
+ wikiTypeName).getContentType());
+
+ httpResponse.setContentLength(page.getPageContent()
+ .length());
+
+ httpResponse.getWriter().print(page.getPageContent());
+
+ httpResponse.getWriter().flush();
+ } else {
+ // show error response
+ httpResponse.setContentType("text/html");
+ httpResponse.getWriter().println(
+ "<html><body><h3>ERROR</h3><br />\nThere is no such wikiType: "
+ + wikiTypeName + "</body></html>");
+ }
+ } else {
+ httpResponse.setContentType("text/html");
+ httpResponse
+ .getWriter()
+ .println(
+ "<html><body><h3>ERROR</h3><br />\nPage name must start with upper case letter.</body></html>");
+ }
+ } else if (tokens[tokens.length - 1].matches("file:.*")) {
+ // Show file of a page
+
+ // get pageName
+ String pageName = "";
+ for (int i = 0; i < tokens.length - 1; i++) {
+ pageName += ((i > 0) ? "/" : "") + tokens[i];
+ }
+
+ String fileName = tokens[tokens.length - 1].substring("file:"
+ .length());
+
+ WikiAttachment wikiAttachment;
+
+ if (version == -1) {
+ wikiAttachment = wikiEngine.getAttachment(pageName,
+ fileName, langCode);
+ } else {
+ wikiAttachment = wikiEngine.getAttachment(pageName,
+ fileName, version, langCode);
+ }
+
+ if (wikiAttachment != null) {
+ InputStream fileIS = wikiAttachment.getInputStream();
+
+ ServletOutputStream os = response.getOutputStream();
+
+ response.setContentType(mimeTypes.getContentType(fileName));
+ // response.setContentLength((int) fileIS.);
+
+ // Transferring the bytes
+ try {
+ byte[] buffer = new byte[BUF_SIZE];
+ int read;
+ while ((read = fileIS.read(buffer)) != -1)
+ os.write(buffer, 0, read);
+ } catch (Exception e2) {
+ // Nothing that we can really do. Just send an
+ // incomplete
+ // file.
+ } finally {
+ os.close();
+ fileIS.close();
+ }
+ } else {
+ ServletOutputStream os = response.getOutputStream();
+
+ response.setContentType("text/html");
+
+ os
+ .println("<html><body><h3>ERROR</h3><br />\nThere is no such file or there is no such version of file</body></html>");
+ }
+ } else {
+ ServletOutputStream os = response.getOutputStream();
+
+ response.setContentType("text/html");
+
+ os
+ .println("<html><body><h3>ERROR</h3><br />\nThere is lack of page name or page name should be uppercase</body></html>");
+ }
+ } else {
+ throw new IOException(
+ "This servlet should be called as HTTPServletRequest");
+ }
+ }
+
+ public void destroy() {
+
+ }
+}
Added: contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/WikiRedirectFilter.java
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/WikiRedirectFilter.java (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/java/org/jboss/wiki/redirect/WikiRedirectFilter.java 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., 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.wiki.redirect;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * A filter that redirects from /wiki/Wiki.jsp?page=PageToGo to
+ * http://labs.jboss.com/wiki/PageToGo (by default, but it's configurable)
+ *
+ * @author Tomasz Szymanski
+ */
+
+public class WikiRedirectFilter implements Filter {
+
+ /**
+ * Old link begginig
+ */
+ private static final String oldLink = "/wiki/Wiki.jsp";
+
+ /**
+ * Host with JBoss Wiki. This is configurable as initParameter
+ */
+ private static String redirectURI = "http://labs.jboss.org/wiki/";
+
+ /**
+ * Name of the initParameter to set redirectURI
+ */
+ private static final String REDIRECT_URI = "redirectURI";
+
+ /**
+ * Where to redirect when wrong uri is entered. This is configurable as
+ * initParameter
+ */
+ private static String errorURI = "/errors/404";
+
+ /**
+ * Name of the initParameter to set errorURI
+ */
+ private static final String ERROR_URI = "errorURI";
+
+ public void init(FilterConfig conf) {
+ // get REDIRECT_URI parameter
+ if (conf.getInitParameter(REDIRECT_URI) != null) {
+ redirectURI = conf.getInitParameter(REDIRECT_URI);
+ }
+
+ // get ERROR_URI parameter
+ if (conf.getInitParameter(ERROR_URI) != null) {
+ errorURI = conf.getInitParameter(ERROR_URI);
+ }
+ }
+
+ public void doFilter(ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+
+ if (request instanceof HttpServletRequest) {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+
+ String requestURI = httpRequest.getRequestURI();
+
+ // if requested URI starts with /wiki/Wiki.jsp?page=Page - do the redirection
+ if (requestURI.startsWith(oldLink)
+ && httpRequest.getParameter("page") != null) {
+
+ // sends redirection to REDIRECT_URI/Page
+ httpResponse.sendRedirect(redirectURI
+ + httpRequest.getParameter("page"));
+ } else {
+
+ // if link is wrong - redirect to error page (ERROR_URI)
+ httpResponse.sendRedirect(errorURI);
+ }
+
+ } else {
+ throw new IOException(
+ "This servlet should be called as HTTPServletRequest");
+ }
+ }
+
+ public void destroy() {
+
+ }
+}
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-app.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-app.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-app.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,3 @@
+<jboss-app>
+ <app-name>wikiportlet</app-name>
+</jboss-app>
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-portlet.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-portlet.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-portlet.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE portlet-app PUBLIC
+ "-//JBoss Portal//DTD JBoss Portlet 2.6//EN"
+ "http://www.jboss.org/portal/dtd/jboss-portlet_2_6.dtd">
+
+<portlet-app>
+
+ <portlet>
+ <portlet-name>WikiPortlet</portlet-name>
+ <transaction>
+ <trans-attribute>Required</trans-attribute>
+ </transaction>
+ </portlet>
+
+</portlet-app>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-web.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-web.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jboss-web.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<jboss-web>
+</jboss-web>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Edit.jsp 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,77 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
+<%@ page isELIgnored ="false" %>
+
+<%
+ String actionURL = (String)request.getAttribute("actionURL");
+ String wikiName = (String)request.getAttribute("wikiName");
+ String wikiContent = (String)request.getAttribute("wikiContent");
+ String wikiPage = (String)request.getAttribute("wikiPage");
+ String lockMsg = (String)request.getAttribute("lockMsg");
+ String defaultPage = (String)request.getAttribute("defaultPage");
+ String wikiImagesUrl = (String)request.getAttribute("wikiImagesUrl");
+ String editSessionId = (String)request.getAttribute("editSessionId");
+ java.util.Map usedLangs = (java.util.Map)request.getAttribute("usedLangs");
+ String curLang = (String)request.getAttribute("currentLanguage");
+
+ if (lockMsg == null)
+ lockMsg = "";
+
+%>
+
+<h2><a href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=wikiName%></a>/ <%=wikiPage%> [<%=curLang%>] </h2>
+<!--
+<br />
+<a href="<%=actionURL%>&page=<%=defaultPage%>"><%=defaultPage%></a><br />-->
+
+<hr />
+<div style="color:#FF0000"><%=lockMsg%></div>
+<form method="post" action="<%=actionURL%>" accept-charset="UTF-8">
+Language: <%=curLang %>
+<textarea name="wikiContent" rows="40" cols="80" style="width:100%;"><%=wikiContent%></textarea>
+<input type="hidden" name="editedPage" value="<%=wikiPage%>" />
+<input type="hidden" name="page" value="<%=wikiPage%>" />
+<input type="hidden" name="editSessionId" value="<%=editSessionId%>" />
+<input type="submit" value="Save" name="editAction" />
+<!--<input type="submit" value="Preview" name="editAction" />-->
+<input type="submit" value="Cancel" name="editAction" />
+<input type="button" value="Check Spelling" onClick="openSpellChecker();"/>
+</form>
+Here's a short reminder on what elements you have at your disposal:
+<PRE>
+---- Horizontal ruler
+\\ Forced line break
+[link] Create hyperlink to "link", where "link" can be either an internal
+ WikiName or an external link (http://)
+[text|link] Create a hyperlink where the link text is different from the actual
+ hyperlink link.
+[text|wiki:link] Create a hyperlink where the link text is different from the
+ actual hyperlink link, and the hyperlink points to a named Wiki.
+ This supports interWiki linking.
+
+* Make a bulleted list (must be in first column). Use more (**)
+ for deeper indentations.
+# Make a numbered list (must be in first column). Use more (##, ###)
+ for deeper indentations.
+
+!, !!, !!! Start a line with an exclamation mark (!) to make a heading.
+ More exclamation marks mean bigger headings.
+
+__text__ Makes text bold.
+''text'' Makes text in italics (notice that these are single quotes ('))
+{{text}} Makes text in monospaced font.
+;term:def Defines 'term' with 'def'. Use this with empty 'term' to make short comments.
+
+|text|more text| Makes a table. Double bars for a table heading.
+</PRE>
+<P>
+Don't try to use HTML, since it just won't work.
+<P>
+To embed images just put them available on the web using one of the approved formats, and they will get inlined automatically.
+
+<P>
+To make a code block, use triple {'s to open, and triple }'s to close.
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,72 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" contentType="text/html; charset=UTF-8"%>
+<%@ page isELIgnored ="false" %>
+
+<%
+ String actionURL = (String)request.getAttribute("actionURL");
+ String wikiName = (String)request.getAttribute("wikiName");
+ //String wikiContent = (String)request.getAttribute("wikiContent");
+ String wikiPage = (String)request.getAttribute("wikiPage");
+ String defaultPage = (String)request.getAttribute("defaultPage");
+ String wikiImagesUrl = (String)request.getAttribute("wikiImagesUrl");
+ String curLang = (String)request.getAttribute("currentLanguage");
+ //java.util.Date editDate = (java.util.Date)request.getAttribute("editDate");
+ //org.jboss.wiki.Credentials author = (org.jboss.wiki.Credentials)request.getAttribute("author");
+%>
+
+<h2><a href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=wikiName%></a>/ <%=wikiPage%> [<%=curLang%>] </h2>
+
+<!--<hr />
+<a href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=defaultPage%></a>
+<div class="wikiTrail">Your trail: <i>TODO</i></div>
+-->
+<hr />
+<h3>History of page: <a href="<%=actionURL%>&page=<%=wikiPage%>&language=<%=curLang%>"><%=wikiPage%></a></h3>
+<hr />
+
+<table>
+<tr>
+<td class="wikiContent">
+<table border="1">
+<%
+ org.jboss.wiki.WikiPage pageAtTop = (org.jboss.wiki.WikiPage)request.getAttribute("pageAtTop");
+ int topVersion = pageAtTop.getLastVersion();
+
+ out.println("<tr><td><b>Version</b></td><td><b>Date</b></td><td><b>Author</b></td><td><b>Size</b></td><td><b>Changes from previous</b></td></tr>");
+
+
+ for (int i = topVersion; i > 0; i--) {
+ org.jboss.wiki.WikiPage prevWikiPage = pageAtTop.getPageAtVersion(false,i);
+
+ String author;
+
+ if ((author = prevWikiPage.getLastAuthor().getName()) != null) {
+ }
+ else {
+ author = "<i>unknown</i>";
+ }
+
+ out.println("<tr><td><a href='"+actionURL+"&page="+wikiPage+"&language="+curLang+"&version="+i+"'>"+
+ i+
+ "</a></td><td>"+
+ prevWikiPage.getEditDate()+
+ "</td><td>"+
+ author +
+ "</td><td>"+prevWikiPage.getLength()+
+ "</td><td>"+ ((i > 1) ? "<a href='"+actionURL+"&type=diff&version="+i+"&page="+wikiPage+"&language="+curLang+"'>Changes from "+(i-1)+" to "+i+"</a>" : "") +"</td>");
+ }
+%>
+</table>
+<td>
+</tr>
+<tr>
+<td class="wikiFooter">
+</td>
+</tr>
+
+</table>
+
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,165 @@
+<!--
+ JBoss, the OpenSource J2EE webOS
+ Distributable under LGPL license.
+ See terms of license at gnu.org.
+ -->
+<%@ page language="java" extends="org.jboss.portal.core.servlet.jsp.PortalJsp" contentType="text/html; charset=UTF-8"%>
+<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
+<%@ page isELIgnored ="false" %>
+<portlet:defineObjects />
+
+<%
+ String actionURL = (String)request.getAttribute("actionURL");
+ String wikiName = (String)request.getAttribute("wikiName");
+ String wikiContent = (String)request.getAttribute("wikiContent");
+ String wikiPage = (String)request.getAttribute("wikiPage");
+ String defaultPage = (String)request.getAttribute("defaultPage");
+ String friendlyLink = (String)request.getAttribute("friendlyLink");
+ String rssLink = (String)request.getAttribute("rssLink");
+ String rdfLink = (String)request.getAttribute("rdfLink");
+ String atomLink = (String)request.getAttribute("atomLink");
+ String type = (String)request.getParameter("type");
+ java.util.Date editDate = (java.util.Date)request.getAttribute("editDate");
+ org.jboss.wiki.Credentials author = (org.jboss.wiki.Credentials)request.getAttribute("author");
+ String wikiImagesUrl = (String)request.getAttribute("wikiImagesUrl");
+ String curLang = (String)request.getAttribute("currentLanguage");
+ boolean isAdmin = ((Boolean)request.getAttribute("isAdmin")).booleanValue();
+ boolean isViewable = ((Boolean)request.getAttribute("isViewable")).booleanValue();
+ boolean isEditable = ((Boolean)request.getAttribute("isEditable")).booleanValue();
+ boolean logedIn = ((Boolean)request.getAttribute("logedIn")).booleanValue();
+%>
+
+<%
+ if (request.getUserPrincipal() != null) {
+ out.println("<meta name='gwt:property' content='tagMeSet/wiki/"+wikiPage+"=/wiki/"+wikiPage+"' />");
+ out.println("<meta name='gwt:property' content='tagMeDiv/wiki/"+wikiPage+"=tagMeWiki' />");
+ out.println("<meta name='gwt:property' content='tagMePath/wiki/"+wikiPage+"=/wiki/"+wikiPage+"' />");
+ out.println("<meta name='gwt:property' content='tagMeUser/wiki/"+wikiPage+"="+request.getUserPrincipal().getName()+"' />");
+ out.println("<meta name='gwt:property' content='tagMeClass/wiki/"+wikiPage+"=org.jboss.labs.tagme.services.ShotokuTaggingService' />");
+ out.println("<meta name='gwt:property' content='tagMeWebsite/wiki/"+wikiPage+"=true' />");
+ }
+%>
+
+<link rel="stylesheet" href="<%=wikiImagesUrl%>wikiStyle.css" type="text/css" media="all">
+
+<div id="tagMeWiki"><!-- tagme div --></div>
+
+<table style="width: 100%" border="0">
+<tr>
+<td style="font-size: large">
+<a href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=wikiName%></a> : <%=wikiPage%> [<%=curLang%>]
+</td>
+<td style="text-align: right;">
+<a href="<%=actionURL%>&type=recentChanges"><img alt="Recent Changes" src="<%=wikiImagesUrl%>recentChanges.gif" border="0" /></a>
+<a href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><img alt="<%=defaultPage%>" src="<%=wikiImagesUrl%>main.gif" border="0" /></a>
+</td>
+</table>
+
+<!--<a href="<%=actionURL%>&page=<%=defaultPage%>&language=<%=curLang%>"><%=defaultPage%></a><br />-->
+
+<form method="post" action="<%=actionURL%>&type=find">
+<table style="width: 100%" border="0">
+<tr style="vertical-align: bottom;">
+<td style="vertical-align: bottom; align-bottom: 0px;">
+<div><a href="<%=friendlyLink%>"><img style="vertical-align: middle" alt="PERM LINK" src="<%=wikiImagesUrl%>permaLinkButton.png" border="0"/></a> <a href="<%=friendlyLink%>"><%=friendlyLink%></a> </div>
+
+</td>
+<td style="text-align: right;vertical-align: bottom; align-bottom: 0px;" >
+
+<%
+
+
+ if ((type == null)||(type.equals("HTML"))) {
+ if ((isAdmin)||((logedIn)&&(isEditable)&&(isViewable))) {
+ out.print("<a href=\""+actionURL+"&action=Edit&page="+wikiPage+"&language="+curLang+"\"><img alt=\"EDIT\" src=\""+wikiImagesUrl+"editButton.png\" border=\"0\" /></a>\n"+
+ "<a href=\""+actionURL+"&action=Attach&page="+wikiPage+"&language="+curLang+"\"><img alt=\"ATTACH\" src=\""+wikiImagesUrl+"attachButton.png\" border=\"0\" /></a>");
+
+ }
+ else if (logedIn) {
+ out.print("<div style='font-size: xx-small'><i>This page IS NOT editable</i></div>");
+ }
+ else {
+ out.print("<div style='font-size: xx-small'><i>Login to edit pages and attach files</i></div>");
+ }
+ }
+
+%>
+
+<%
+if (((type == null)||(type.equals("HTML")))&&((isAdmin)||(isViewable))) {
+ out.println("<a href=\""+actionURL+"&action=Info&page="+wikiPage+"&language="+curLang+"\"><img alt=\"HISTORY\" src=\""+wikiImagesUrl+"historyButton.png\" border=\"0\" /></a>");
+ out.println("<a href=\""+rssLink+"\"><img alt=\"RSS\" src=\""+wikiImagesUrl+"RSSButton.gif\" border=\"0\" /></a>");
+ out.println("<a href=\""+rdfLink+"\"><img alt=\"RSS\" src=\""+wikiImagesUrl+"RDFButton.gif\" border=\"0\" /></a>");
+ out.println("<a href=\""+atomLink+"\"><img alt=\"RSS\" src=\""+wikiImagesUrl+"ATOMButton.gif\" border=\"0\" /></a><br />");
+ }
+ %>
+<input type="text" name="searchQuery" />
+<input type="hidden" name="language" value="<%=curLang%>" />
+<input type="submit" value="SEARCH" />
+</td>
+</tr>
+</table>
+</form>
+
+<hr />
+
+<%
+ String attachFile = (String)request.getAttribute("fileAttach");
+
+ if (((isEditable)||(isAdmin))&&(attachFile != null)&&(attachFile.equals("true"))) {
+ out.println("<h2><b>UPLOAD FILE:</b></h2>\n"+
+ "<FORM ACTION=\""+actionURL+"&page="+wikiPage+"&language="+curLang+"\" METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">"+
+ "<INPUT TYPE=\"file\" NAME=\"file_up\" />"+
+ "<INPUT TYPE=\"submit\" VALUE=\"Upload\" />"+
+ "</FORM><hr />");
+ }
+%>
+
+<%
+ Integer showedVersion = (Integer)request.getAttribute("showedVersion");
+
+ if (showedVersion != null) {
+ out.println("<table style='border-style: dashed; text-align: center; margin-left: auto; margin-right:auto; border-color: red'>"+
+ "<tr><td>This is <b>version "+showedVersion+"</b> of page "+wikiPage+".<br>"+
+ "You can go back to <a href='"+actionURL+"&page="+wikiPage+"&language="+curLang+"'>latest version</a> or ");
+
+ if (logedIn) {
+ out.println("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"&language="+curLang+"&version="+showedVersion+"'>rollback this version</a>");
+ }
+ else {
+ out.println("<i>rollback this version (after login)</i>");
+ }
+
+ out.println("</td></tr></table>");
+ }
+%>
+
+<%
+ String errorMsg = (String)request.getAttribute("errorMsg");
+
+ if (errorMsg != null) {
+ out.println("<table style='border-style: dashed; text-align: center; margin-left: auto; margin-right:auto; border-color: red'>");
+ out.println("<tr><td>"+errorMsg+"</td></tr>");
+ out.println("</table>");
+ }
+%>
+
+<table style="width: 100%; margin: 0px; padding: 0px;">
+<tr style="width: 100%; margin: 0px; padding: 0px;">
+
+<td class="wikiContent"><%=wikiContent%><td>
+</tr>
+<tr>
+<td class="wikiFooter">
+<hr />
+</td>
+</tr>
+</table>
+<br />
+
+<%
+if ((type == null)||(type.equals("HTML"))) {
+ out.println("<div>The page last changed on "+editDate+" by "+author+". </div>");
+}
+%>
+
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet-instances.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet-instances.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet-instances.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployments>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-id>WikiPortletInstance</instance-id>
+ <portlet-ref>wikiportlet.WikiPortlet</portlet-ref>
+ </instance>
+ </deployment>
+</deployments>
\ No newline at end of file
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd"
+ version="2.0">
+
+ <portlet>
+ <portlet-name>WikiPortlet</portlet-name>
+ <portlet-class>org.jboss.wiki.WikiPortlet</portlet-class>
+ <supports>
+ <mime-type>text/html</mime-type>
+ <portlet-mode>VIEW</portlet-mode>
+ <window-state>normal</window-state>
+ <window-state>minimized</window-state>
+ <window-state>maximized</window-state>
+ </supports>
+ <portlet-info>
+ <title>Wiki Portlet</title>
+ </portlet-info>
+ </portlet>
+
+ <filter>
+ <filter-name>JBossPortletFilter</filter-name>
+ <filter-class>org.jboss.portlet.filter.JBossPortletFilter</filter-class>
+ <lifecycle>ACTION_PHASE</lifecycle>
+ <lifecycle>RENDER_PHASE</lifecycle>
+ </filter>
+
+ <filter-mapping>
+ <filter-name>JBossPortletFilter</filter-name>
+ <portlet-name>WikiPortlet</portlet-name>
+ </filter-mapping>
+
+</portlet-app>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet_2_0.tld
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet_2_0.tld (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/portlet_2_0.tld 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <taglib xmlns="http://java.sun.com/xml/ns/j2ee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
+ version="2.0">
+
+ <description>Portlet 2.0 Tag Library</description>
+ <display-name>Portlet 2.0 Tags</display-name>
+ <tlib-version>2.0</tlib-version>
+ <short-name>portlet</short-name>
+ <uri>http://java.sun.com/portlet</uri>
+
+ <tag>
+
+ <name>param</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLParameter286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>property</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.URLProperty286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ <attribute>
+ <name>name</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>value</name>
+ <required>true</required>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>renderURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.RenderURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>portletMode</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>windowState</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>defineObjects</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.DefineObjects286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.DefineObjects286TagTEI</tei-class>
+ <body-content>empty</body-content>
+
+ </tag>
+ <tag>
+
+ <name>actionURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ActionURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.GenerateURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>portletMode</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>windowState</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>copyCurrentRenderParameters</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>name</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+
+ </tag>
+ <tag>
+
+ <name>resourceURL</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286Tag</tag-class>
+ <tei-class>org.jboss.portal.portlet.impl.jsr286.taglib.ResourceURL286TagTEI</tei-class>
+ <body-content>JSP</body-content>
+
+ <attribute>
+ <name>secure</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>var</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>escapeXml</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>cacheability</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+ <attribute>
+ <name>id</name>
+ <rtexprvalue>true</rtexprvalue>
+
+ </attribute>
+
+ </tag>
+ <tag>
+
+ <name>namespace</name>
+ <tag-class>org.jboss.portal.portlet.impl.jsr286.taglib.Namespace286Tag</tag-class>
+ <body-content>empty</body-content>
+
+ </tag>
+
+</taglib>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/web.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/web.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/web.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+
+ <filter>
+ <filter-name>wikiFileAccessFilter</filter-name>
+ <filter-class>org.jboss.wiki.fileaccess.WikiFileAccessFilter</filter-class>
+ </filter>
+
+ <!-- <filter>
+ <filter-name>wikiFileAccessFilter</filter-name>
+ <filter-class>org.jboss.wiki.redirect.WikiRedirectFilter</filter-class>
+ </filter> -->
+
+ <filter-mapping>
+ <filter-name>wikiFileAccessFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ <dispatcher>REQUEST</dispatcher>
+ </filter-mapping>
+
+</web-app>
Added: contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/wiki-object.xml
===================================================================
--- contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/wiki-object.xml (rev 0)
+++ contrib/wikiPortlet/trunk/forge-wiki/src/web/WEB-INF/wiki-object.xml 2009-03-03 18:51:31 UTC (rev 246)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deployments>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <parent-ref>default</parent-ref>
+ <page>
+ <page-name>wiki</page-name>
+ <window>
+ <window-name>WikiPortletWindow</window-name>
+ <instance-ref>WikiPortletInstance</instance-ref>
+ <region>center</region>
+ <height>0</height>
+ </window>
+ </page>
+ </deployment>
+ <deployment>
+ <if-exists>overwrite</if-exists>
+ <instance>
+ <instance-name>WikiPortletInstance</instance-name>
+ <component-ref>wikiportlet.WikiPortlet</component-ref>
+ </instance>
+ </deployment>
+</deployments>
15 years, 2 months