You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(233) |
Sep
(199) |
Oct
(206) |
Nov
(185) |
Dec
(270) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(232) |
Feb
(426) |
Mar
(623) |
Apr
(592) |
May
(506) |
Jun
(389) |
Jul
(160) |
Aug
(3) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(5) |
2007 |
Jan
(1) |
Feb
(1) |
Mar
(2) |
Apr
(2) |
May
(4) |
Jun
(2) |
Jul
|
Aug
(3) |
Sep
(5) |
Oct
(9) |
Nov
(6) |
Dec
(6) |
2008 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
(3) |
May
(3) |
Jun
(5) |
Jul
(10) |
Aug
(2) |
Sep
(12) |
Oct
(10) |
Nov
(54) |
Dec
(49) |
2009 |
Jan
(19) |
Feb
(13) |
Mar
(20) |
Apr
(24) |
May
(44) |
Jun
(29) |
Jul
(32) |
Aug
(10) |
Sep
(7) |
Oct
(10) |
Nov
(4) |
Dec
(17) |
2010 |
Jan
(14) |
Feb
(5) |
Mar
(23) |
Apr
(50) |
May
(31) |
Jun
(9) |
Jul
(5) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(2) |
Dec
(3) |
2011 |
Jan
(12) |
Feb
(5) |
Mar
(5) |
Apr
(3) |
May
(4) |
Jun
(3) |
Jul
(2) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
(1) |
Feb
(2) |
Mar
|
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2015 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Author: szimano Date: 2005-08-22 18:54:39 -0400 (Mon, 22 Aug 2005) New Revision: 917 Added: trunk/forge/portal-extensions/wiki-file-access/ trunk/forge/portal-extensions/wiki-file-access/maven.xml trunk/forge/portal-extensions/wiki-file-access/project.properties trunk/forge/portal-extensions/wiki-file-access/project.xml trunk/forge/portal-extensions/wiki-file-access/src/ trunk/forge/portal-extensions/wiki-file-access/src/etc/ trunk/forge/portal-extensions/wiki-file-access/src/etc/org/ trunk/forge/portal-extensions/wiki-file-access/src/etc/org/jboss/ trunk/forge/portal-extensions/wiki-file-access/src/etc/org/jboss/wiki/ trunk/forge/portal-extensions/wiki-file-access/src/etc/org/jboss/wiki/fileaccess/ trunk/forge/portal-extensions/wiki-file-access/src/etc/org/jboss/wiki/fileaccess/mime.types trunk/forge/portal-extensions/wiki-file-access/src/java/ trunk/forge/portal-extensions/wiki-file-access/src/java/org/ trunk/forge/portal-extensions/wiki-file-access/src/java/org/jboss/ trunk/forge/portal-extensions/wiki-file-access/src/java/org/jboss/wiki/ trunk/forge/portal-extensions/wiki-file-access/src/java/org/jboss/wiki/fileaccess/ trunk/forge/portal-extensions/wiki-file-access/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java trunk/forge/portal-extensions/wiki-file-access/src/web/ trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/ trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/tld/ trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/tld/forge.tld trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/web.xml Log: wiki file access servlet Added: trunk/forge/portal-extensions/wiki-file-access/maven.xml =================================================================== --- trunk/forge/portal-extensions/wiki-file-access/maven.xml 2005-08-22 17:24:39 UTC (rev 916) +++ trunk/forge/portal-extensions/wiki-file-access/maven.xml 2005-08-22 22:54:39 UTC (rev 917) @@ -0,0 +1,32 @@ +<!-- + 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"> + <!-- Default war-project goals --> + + <goal name="all"> + <!--<attainGoal name="prj-all" />--> + <attainGoal name="build" /> + <attainGoal name="deploy" /> + </goal> + + <goal name="build"> + <!--<attainGoal name="prj-war-build" />--> + <attainGoal name="war" /> + </goal> + + <!--<goal name="deploy"> + <attainGoal name="prj-war-deploy" /> + </goal>--> + + <goal name="deploy"> + <ant:copy todir="${local.deploy.dir}" flatten="true"> + <ant:fileset dir="."> + <ant:filename name="target/*.war" /> + </ant:fileset> + </ant:copy> + </goal> + +</project> Added: trunk/forge/portal-extensions/wiki-file-access/project.properties =================================================================== --- trunk/forge/portal-extensions/wiki-file-access/project.properties 2005-08-22 17:24:39 UTC (rev 916) +++ trunk/forge/portal-extensions/wiki-file-access/project.properties 2005-08-22 22:54:39 UTC (rev 917) @@ -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: trunk/forge/portal-extensions/wiki-file-access/project.xml =================================================================== --- trunk/forge/portal-extensions/wiki-file-access/project.xml 2005-08-22 17:24:39 UTC (rev 916) +++ trunk/forge/portal-extensions/wiki-file-access/project.xml 2005-08-22 22:54:39 UTC (rev 917) @@ -0,0 +1,68 @@ +<?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-file-access</id> + <name>Wiki file access</name> + <currentVersion>1.0</currentVersion> + <organization> + <name>Tomasz Szymanski</name> + <url>http://mamut.net.pl</url> + </organization> + <organization> + <name>Adam Warski</name> + <url>http://mamut.net.pl</url> + </organization> + <description></description> + + <dependencies> + <dependency> + <groupId>tmate</groupId> + <artifactId>javasvn</artifactId> + <version>1.0</version> + <jar>javasvn.jar</jar> + </dependency> + + <dependency> + <groupId>tmate</groupId> + <artifactId>jsch</artifactId> + <version>1.0</version> + <jar>jsch.jar</jar> + </dependency> + + <dependency> + <groupId>jboss-forge</groupId> + <artifactId>forge-common</artifactId> + <version>1.0</version> + </dependency> + + <dependency> + <groupId>aslibs</groupId> + <artifactId>javax.servlet</artifactId> + <version>1.0</version> + <jar>javax.servlet.jar</jar> + </dependency> + + <dependency> + <groupId>jboss</groupId> + <artifactId>activation</artifactId> + <version>1.0</version> + <jar>activation.jar</jar> + </dependency> + </dependencies> + + <build> + <sourceDirectory>src/java</sourceDirectory> + <resources> + <resource> + <directory>src/etc/</directory> + <include>**/*.types</include> + </resource> + </resources> + </build> +</project> Added: trunk/forge/portal-extensions/wiki-file-access/src/etc/org/jboss/wiki/fileaccess/mime.types =================================================================== --- trunk/forge/portal-extensions/wiki-file-access/src/etc/org/jboss/wiki/fileaccess/mime.types 2005-08-22 17:24:39 UTC (rev 916) +++ trunk/forge/portal-extensions/wiki-file-access/src/etc/org/jboss/wiki/fileaccess/mime.types 2005-08-22 22:54:39 UTC (rev 917) @@ -0,0 +1,21 @@ +application/postscript ai eps ps +application/rtf rtf +application/slate +application/x-tex tex +application/x-texinfo texinfo texi +application/x-troff t tr roff +audio/basic au snd +audio/x-aiff aif aiff aifc +audio/x-wav wav +image/gif gif +image/ief ief +image/png png +image/jpeg jpeg jpg jpe +image/tiff tiff tif +image/x-xwindowdump xwd +text/html html +text/plain txt +video/mpeg mpeg mpg mpe +video/quicktime qt mov +video/x-msvideo avi +video/x-sgi-movie movie Added: trunk/forge/portal-extensions/wiki-file-access/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/wiki-file-access/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-22 17:24:39 UTC (rev 916) +++ trunk/forge/portal-extensions/wiki-file-access/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-08-22 22:54:39 UTC (rev 917) @@ -0,0 +1,114 @@ +/***************************************** + * * + * JBoss Portal: The OpenSource Portal * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *****************************************/ +package org.jboss.wiki.fileaccess; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; + + +import javax.activation.MimetypesFileTypeMap; +import javax.servlet.Filter; +import javax.servlet.FilterChain; +import javax.servlet.FilterConfig; +import javax.servlet.ServletOutputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; + +import javax.servlet.http.HttpServletRequest; + +// import org.jboss.forge.common.content.ContentManager; +// import org.jboss.forge.common.ForgeHelper; + +/** + * A filter that enables to download files which are stored in a working copy of + * a content repository. + * + * @author adamw + */ +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 final String attachementsPath = "/usr/local/forge/wiki"; + + /* + * private ForgeHelper forgeHelper; private ContentManager contentManager; + */ + private MimetypesFileTypeMap mimeTypes; + + + public void init(FilterConfig conf) { + /* + * forgeHelper = new ForgeHelper(); contentManager = + * forgeHelper.getContentManager(""); + */ + + mimeTypes = new MimetypesFileTypeMap(WikiFileAccessFilter.class.getResourceAsStream("mime.types")); + + } + + + public void doFilter(ServletRequest request, ServletResponse response, + FilterChain chain) throws IOException { + + if (request instanceof HttpServletRequest) { + HttpServletRequest httpRequest = (HttpServletRequest) request; + + String requestURI = httpRequest.getRequestURI(); + + // Parse URI to get filename and page name + String[] tokens = requestURI.split("[/]"); + + // get fileName of attachement and page which is connected to + String fileName = tokens[tokens.length - 1]; + String pageName = tokens[tokens.length - 2]; + + System.out.println("[WikiFileAccess]Getting file: "+fileName+" of page: "+pageName); + + tokens = fileName.split("\\."); + + System.out.println(attachementsPath+"/"+pageName+"-att/"+fileName+"-dir/1."+tokens[tokens.length - 1]); + + File file = new File(attachementsPath+"/"+pageName+"-att/"+fileName+"-dir/1."+tokens[tokens.length - 1]); + + FileInputStream fileIS = new FileInputStream(file); + + ServletOutputStream os = response.getOutputStream(); + + response.setContentType(mimeTypes.getContentType(file)); + response.setContentLength((int) file.length()); + + // 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 { + throw new IOException("This servlet should be called as HTTPServletRequest"); + } + } + + public void destroy() { + + } +} Added: trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/tld/forge.tld =================================================================== --- trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/tld/forge.tld 2005-08-22 17:24:39 UTC (rev 916) +++ trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/tld/forge.tld 2005-08-22 22:54:39 UTC (rev 917) @@ -0,0 +1,134 @@ +<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 web-jsptaglibrary_2_0.xsd" + version="2.0"> + <!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> + <tlib-version>1.1</tlib-version> + <jsp-version>2.0</jsp-version> + <shortname>forge</shortname> + <info>Forge tags</info> + + <tag> + <name>pageURL</name> + <tagclass>org.jboss.forge.common.taglib.PageURLTag</tagclass> + <attribute> + <name>page</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>form</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>param</name> + <tagclass>org.jboss.forge.common.taglib.ParamTag</tagclass> + <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>wikiparam</name> + <tagclass>org.jboss.forge.common.taglib.WikiParam</tagclass> + <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>projectURL</name> + <tagclass>org.jboss.forge.common.taglib.ProjectURLTag</tagclass> + <attribute> + <name>project</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>page</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>form</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>categoryURL</name> + <tagclass>org.jboss.forge.common.taglib.CategoryURLTag</tagclass> + <attribute> + <name>category</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>form</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>selectedProject</name> + <tagclass>org.jboss.forge.common.taglib.SelectedProjectTag</tagclass> + </tag> + + <tag> + <name>imagePath</name> + <tagclass>org.jboss.forge.common.taglib.ImagePathTag</tagclass> + <attribute> + <name>src</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + <attribute> + <name>project</name> + <required>false</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>attrValue</name> + <tagclass>org.jboss.forge.common.taglib.AttrValueTag</tagclass> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + + <tag> + <name>attrIf</name> + <tagclass>org.jboss.forge.common.taglib.AttrIfTag</tagclass> + <attribute> + <name>name</name> + <required>true</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> +</taglib> Added: trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/web.xml =================================================================== --- trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/web.xml 2005-08-22 17:24:39 UTC (rev 916) +++ trunk/forge/portal-extensions/wiki-file-access/src/web/WEB-INF/web.xml 2005-08-22 22:54:39 UTC (rev 917) @@ -0,0 +1,16 @@ +<?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> + <filter> + <filter-name>wikiFileAccessFilter</filter-name> + <filter-class>org.jboss.wiki.fileaccess.WikiFileAccessFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>wikiFileAccessFilter</filter-name> + <url-pattern>/*</url-pattern> + <dispatcher>REQUEST</dispatcher> + </filter-mapping> +</web-app> \ No newline at end of file |
From: <jbo...@li...> - 2005-08-22 17:24:49
|
Author: ral...@jb... Date: 2005-08-22 13:24:39 -0400 (Mon, 22 Aug 2005) New Revision: 916 Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties Log: something happened to the older version(Eclipse ate it) Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-22 16:56:09 UTC (rev 915) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-22 17:24:39 UTC (rev 916) @@ -1,6 +1,6 @@ # WikiPlugin properties. Use it wise. #specifies base URL for the portal htmlTranslatorURL = http://forge.sicore.org:8080/portal/ -#host:8080/portal/ +#htmlTranslatorURL = http://localhost:8080/portal/ #extensions for images to be inlined, coma-separated imagePatterns = .png , .jpeg , .gif , .bmp \ No newline at end of file |
From: <jbo...@li...> - 2005-08-22 16:56:14
|
Author: ral...@jb... Date: 2005-08-22 12:56:09 -0400 (Mon, 22 Aug 2005) New Revision: 915 Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java Log: plugin links removed from pages revision Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-22 14:04:36 UTC (rev 914) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-22 16:56:09 UTC (rev 915) @@ -1,4 +1,6 @@ # WikiPlugin properties. Use it wise. #specifies base URL for the portal htmlTranslatorURL = http://forge.sicore.org:8080/portal/ -# htmlTranslatorURL = http://loclahost:8080/portal/ \ No newline at end of file +#host:8080/portal/ +#extensions for images to be inlined, coma-separated +imagePatterns = .png , .jpeg , .gif , .bmp \ No newline at end of file Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-22 14:04:36 UTC (rev 914) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-22 16:56:09 UTC (rev 915) @@ -18,10 +18,8 @@ import java.util.regex.*; import java.util.ArrayList; import java.util.Collection; -//import java.util.Date; +import java.util.Iterator; import java.util.StringTokenizer; - -//import org.jboss.wiki.Credentials; import org.jboss.wiki.WikiEngine; import org.jboss.wiki.WikiPage; import org.jboss.wiki.WikiPlugin; @@ -29,10 +27,6 @@ public class HTMLTranslator extends WikiPlugin { - private Pattern myPattern; - - private Matcher myMatcher; - /* URL components, later to be configurable */ private String portalHome = ""; @@ -42,15 +36,10 @@ private String page = "&page="; - public ArrayList mediaPatterns; - - public ArrayList linkPatterns; - - public String[] textlinks; - - public String[] notextlinks; - + private String mediaPatterns; + private String[] mediaFormats = { "*.png", "*.jpeg", "*.gif" }; + /* formatting variables */ private boolean m_allowHTML = false; @@ -69,6 +58,7 @@ private int m_listlevel = 0; private int m_numlistlevel = 0; + private boolean m_camelCaseLinks = true; //camelCase enabled /** Tag that gets closed at EOL. */ @@ -77,8 +67,8 @@ /** Allow this many characters to be pushed back in the stream. */ private static final int PUSHBACK_BUFFER_SIZE = 8; /** - * These characters constitute word separators when trying - * to find CamelCase links. + * These characters constitute word separators when trying to find CamelCase + * links. */ private static final String WORD_SEPARATORS = ",.|:;+=&"; @@ -91,6 +81,8 @@ /** * Push back any character to the current input. Does not push back a read * EOF, though. + * + * @author Janne Jalkanen */ private void pushBack(int c) throws IOException { if (c != -1) { @@ -98,18 +90,22 @@ } } - /* - * compile all links to wiki pages or external pages of the form [...] or - * [...|...] + /** + * Wiki to HTML transformation method, plain URIs transformation not + * implemented + * + * @param page + * The String representation of a wiki page's content + * @return The final transformed into HTML string + * @author Janne Jalkanen + * @author Rali Genova */ public String parseLinks(String page) throws IOException { - m_in = new PushbackReader(new StringReader(page), PUSHBACK_BUFFER_SIZE); - String translatedContent = "";// = prepareText(text); + m_in = new PushbackReader(new StringReader(page), PUSHBACK_BUFFER_SIZE); StringBuffer buf = new StringBuffer(); StringBuffer word = null; int previousCh = -2; int start = 0; - boolean quitReading = false; boolean newLine = true; // FIXME: not true if reading starts in middle // of buffer @@ -117,6 +113,8 @@ while (!quitReading) { int ch = nextToken(); String s = null; + + //begin of HTML transformation if (m_isPre) { if (ch == '}') { buf.append(handleClosebrace()); @@ -135,7 +133,7 @@ // // CamelCase detection, a non-trivial endeavour. // We keep track of all white-space separated entities, which we - // hereby refer to as "words". We then check for an existence + // hereby refer to as "words". We then check for an existence // of a CamelCase format text string inside the "word", and // if one exists, we replace it with a proper link. // @@ -169,16 +167,11 @@ String camelCase = parseCamelCase(potentialLink); if( camelCase != null ) - { - // System.out.println("Buffer is "+buf); - - // System.out.println(" Replacing "+camelCase+" with proper link."); + { start = buf.toString().lastIndexOf( camelCase ); buf.replace(start, start+camelCase.length(), - handleHyperlinks(camelCase) ); - - // System.out.println(" Resulting with "+buf); + handleHyperlinks(camelCase) ); } // We've ended a word boundary, so time to reset. @@ -244,6 +237,10 @@ buf.append("\n"); newLine = true; } + /* + * wiki syntax handling, later to be refactored so multiple wiki + * syntax is supported + */ break; case '\\': @@ -330,10 +327,7 @@ case '\"': s = m_allowHTML ? "\"" : """; break; - - /* - * case '&': s = "&"; break; - */ + case '~': s = handleTilde(); break; @@ -353,13 +347,18 @@ } } - translatedContent = buf.toString(); - // translatedContent = translatedContent.replace("\n", "<BR>\n"); - // System.out.println("final string : "+ translatedContent); - - return translatedContent; + + + return buf.toString(); } - + /** + * @param link - + * potential camel case link to be tested + * @return the string itself if not a camel case, and a proper link + * otherwise + * @author Rali Genova + * @author Janne Jalkanen + */ public String parseCamelCase(String link) { String camelCasepattern = "^([^\\p{Alnum}]*|\\~)([\\p{Upper}]+[\\p{Lower}]+[\\p{Upper}]+[\\p{Alnum}]*)[^\\p{Alnum}]*$"; Pattern camelCase = Pattern.compile(camelCasepattern); @@ -382,14 +381,28 @@ /* a collection of all media formats allowed on wiki */ private Collection getImagePatterns() { - ArrayList patterns = new ArrayList(); - for (int i = 0; i < mediaFormats.length; i++) { - patterns.add(mediaFormats[i]); + ArrayList patt = new ArrayList(); + String imagepattern = mediaPatterns; + String[] elem = imagepattern.split(","); + for (int i = 0; i < elem.length; i++) { + patt.add(elem[i].trim()); } - return patterns; + return patt; } + + private boolean checkImageLink(String text) { + ArrayList ptrns = (ArrayList)getImagePatterns(); + for(int i = 0; i< ptrns.size(); i++) + { + if(text.endsWith((String)ptrns.get(i))) + {return true;} + } + + return false; + } + /** * Generic escape of next character or entity. */ @@ -719,19 +732,47 @@ return res; } + + /** + * Returns true if the link is really command to insert a plugin. + * <P> + * Currently we just check if the link starts with "{INSERT", or just plain + * "{" but not "{$". + * + * @author Janne Jalkanen + * + * @param link + * Link text, i.e. the contents of text between []. + * @return True, if this link seems to be a command to insert a plugin here. + */ + public static boolean isPluginLink( String link ) + { + return link.startsWith("{INSERT") || + (link.startsWith("{") && !link.startsWith("{$")); + } /** + * method to create links for external pages of Wiki pages + * * @param string - * @return + * @return the HTML link representation of the wiki page/external link + * @author Rali Genova */ private String handleHyperlinks(String link) { String result = ""; String pageName = ""; + if(isPluginLink(link)) + { + return null; //we do not include plugin links + } int border = link.indexOf('|'); if (border != -1) { if (isExternalLink(link.substring(border + 1)))//case // [...|externallink] - opens in new window { + //if(checkImageLink(link.substring(border + 1)) + //{result = "<img src=\""+link.substring(border + + // 1)+"\"alt=\"link.substring(0, border)\"";} result = "<a href=\"" + link.substring(border + 1) + "\"target=\"_blank\">" + link.substring(0, border) + "</a><img src=\"/file-access/default/members/jbosswiki/images/out.png\"/>"; } //case [...|wikipagelink] @@ -761,8 +802,7 @@ result = "<a href=\"" + link + "\"target=\"_blank\">" + link + "</a><img src=\"/file-access/default/members/jbosswiki/images/out.png\"/>"; } else { - pageName = cleanLink(link); - // System.out.println("********pageName is "+pageName); + pageName = cleanLink(link); if(wikiEngine.pageExists(pageName)) { result = "<a href=\"" + portalHome + wikiHome + actionType + "action" + page + cleanLink(link) + "\">" + link @@ -779,8 +819,10 @@ } /** * Figures out if a link is an off-site link. This recognizes the most - * common protocols by checking how it starts. - * (clears all white space in case the link starts with '\n' or [space] + * common protocols by checking how it starts. (clears all white space in + * case the link starts with '\n' or [space] + * + * @author Janne Jalkanen */ private boolean isExternalLink(String link) { link = link.trim(); @@ -808,6 +850,7 @@ * @return A cleaned link. * * @since 2.0 + * @author Janne Jalkanen */ public String cleanLink(String link) { StringBuffer clean = new StringBuffer(); @@ -857,11 +900,8 @@ public void next() {} - public WikiPage process(final WikiPage wikiPage, WikiSession wikiSession) { - //System.out.println("propertu: "+getProperty("htmlTranslatorURL")); - + public WikiPage process(final WikiPage wikiPage, WikiSession wikiSession) { WikiPage newPage = null; - try { newPage = (WikiPage) wikiPage.clone(); } catch (CloneNotSupportedException cnse) { @@ -884,33 +924,8 @@ @Override public void init() { portalHome = getProperty("htmlTranslatorURL"); + mediaPatterns = getProperty("imagePatterns"); } - - - // public static void main(String[] args) { - // String wikitext = "__Forge Portal__FORGE USER HOW TO:\\\\\n" - // + "[Add a new project and modify its - // data|http://www.NewProject.com]\\\\\n" - // + "[Add and manage project downloads|Project Downloads]\\\\\n" - // + "[Add and manage project freezone|Project *Freezone]\\\\\n" - // + "[Project Freezone]\\\\\n" - // + "[http://www.google.com]\\\\\n"; - // WikiContext wc = new WikiContext(); - // - // String elements = parseLinks(wikitext, wc); - // - // System.out.println(elements); - // } - - // public static void main(String[] args) { - // HTMLTranslator ht = new HTMLTranslator(); - // - // WikiPage wp = new WikiPage("name", new Credentials("tomek"), "content", - // 1, new Date()); - // - // wp = ht.process(wp); - // } - } \ No newline at end of file |
From: <jbo...@li...> - 2005-08-22 14:04:41
|
Author: szimano Date: 2005-08-22 10:04:36 -0400 (Mon, 22 Aug 2005) New Revision: 914 Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: not loged - cannot rollback Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-22 12:51:11 UTC (rev 913) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-22 14:04:36 UTC (rev 914) @@ -47,9 +47,18 @@ 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+"'>latest version</a> or <a href='"+actionURL+"&action=Edit&page="+wikiPage+"&version="+showedVersion+"'>rollback this version</a></td></tr></table>"); + 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+"'>latest version</a> or "); + + if (logedIn.equals("true")) { + out.println("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"&version="+showedVersion+"'>rollback this version</a>"); + } + else { + out.println("<i>rollback this version (after login)</i>"); + } + + out.println("</td></tr></table>"); } %> |
From: <jbo...@li...> - 2005-08-22 12:51:18
|
Author: szimano Date: 2005-08-22 08:51:11 -0400 (Mon, 22 Aug 2005) New Revision: 913 Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: new way of getting pages Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2005-08-22 12:50:52 UTC (rev 912) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2005-08-22 12:51:11 UTC (rev 913) @@ -41,7 +41,7 @@ for (int i = topVersion; i > 0; i--) { - org.jboss.wiki.WikiPage prevWikiPage = pageAtTop.getPageAtVersion(i); + org.jboss.wiki.WikiPage prevWikiPage = pageAtTop.getPageAtVersion(false,i); String author; @@ -57,7 +57,7 @@ prevWikiPage.getEditDate()+ "</td><td>"+ author + - "</td><td>"+prevWikiPage.getContent().length()+ + "</td><td>"+prevWikiPage.getLength()+ "</td><td>"+ ((i > 1) ? "<a href='"+actionURL+"&action=Diff&version="+i+"&page="+wikiPage+"'>Changes from "+(i-1)+" to "+i+"</a>" : "") +"</td>"); } %> Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-22 12:50:52 UTC (rev 912) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-22 12:51:11 UTC (rev 913) @@ -43,6 +43,16 @@ <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+"'>latest version</a> or <a href='"+actionURL+"&action=Edit&page="+wikiPage+"&version="+showedVersion+"'>rollback this version</a></td></tr></table>"); + } +%> + <table style="width: 100%"> <tr> <td class="wikiContent"><%=wikiContent%><td> |
From: <jbo...@li...> - 2005-08-22 12:50:57
|
Author: szimano Date: 2005-08-22 08:50:52 -0400 (Mon, 22 Aug 2005) New Revision: 912 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java Log: new way of geting pages Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-22 08:26:41 UTC (rev 911) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-22 12:50:52 UTC (rev 912) @@ -14,6 +14,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.lang.reflect.Array; +import java.util.Calendar; import java.util.Date; import java.util.Properties; @@ -75,7 +76,7 @@ boolean status = false; if (pageExists(page.getName())) { // page exists on harddisk - add new - // version + // version Properties pageProps = getPageProps(page.getName()); pageProps.setProperty(page.getLastVersion() + ".author", page @@ -243,8 +244,10 @@ System.err.println(ioe); } - page = new WikiPage(pageName, author, pageContent, i, i, new Date( - pageFile.lastModified()), this); + page = new WikiPage(pageName, author, pageContent, i, i, + new Date(pageFile.lastModified()), this); + + page.setLength(pageFile.length()); } } @@ -271,26 +274,32 @@ return false; } - public WikiPage getPageAtVersion(WikiPage originPage, String languageCode, - int version) { + public WikiPage getPageAtVersion(WikiPage originPage, boolean loadContent, + String languageCode, int version) { if (languageCode != null) { System.out .println("As for now, languages aren't supported in the wiki. Please do not use language codes"); } - return getPageAtVersion(originPage, version); + return getPageAtVersion(originPage, loadContent, version); } - public WikiPage getPageAtVersion(WikiPage originPage, int version) { + public WikiPage getPageAtVersion(WikiPage originPage, boolean loadContent, + int version) { + + /* + * Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); long + * oldMilis = cal.getTimeInMillis(); + */ + WikiPage page = null; - + try { - page = (WikiPage)originPage.clone(); - } - catch (CloneNotSupportedException e) { + page = (WikiPage) originPage.clone(); + } catch (CloneNotSupportedException e) { System.err.println(e); } - + if (page != null) { if (page.getLastVersion() < version) { System.out.println("There is no version " + version @@ -298,38 +307,56 @@ return null; } - page.setPageContent(getContentAtVersion(page.getName(), version)); + getContentAtVersion(page, loadContent, version); page.setLastAuthor(getAuthorAtVersion(page.getName(), version)); - + page.setVersion(version); page.setEditDate(getDateAtVersion(page.getName(), version)); } + + /* + * cal.setTime(new Date()); + * + * System.out.println("PAGE "+page.getName()+" loaded in: + * "+(cal.getTimeInMillis() - oldMilis)); + */ return page; } - public String getContentAtVersion(String pageName, int version) { + public void getContentAtVersion(WikiPage page, boolean loadContent, + int version) { String ret = null; - try { - FileInputStream input = new FileInputStream(new File(pathToMedia - + "/OLD/" + pageName + "/" + version + ".txt")); + File pageFile = new File(pathToMedia + "/OLD/" + page.getName() + "/" + + version + ".txt"); - int nextChr = input.read(); + if (loadContent) { + try { + FileInputStream input = new FileInputStream(pageFile); - ret = ""; + int nextChr = input.read(); - while (nextChr != -1) { - ret += (char) nextChr; - nextChr = input.read(); + ret = ""; + + while (nextChr != -1) { + ret += (char) nextChr; + nextChr = input.read(); + } + + page.setPageContent(ret); + page.setLength(ret.length()); + + } catch (IOException ioe) { + System.err.println(ioe); } - } catch (IOException ioe) { - System.err.println(ioe); + } else { + page.setLength(pageFile.length()); + page.setPageContent(null); } - - return ret; + } public Date getDateAtVersion(String pageName, int version) { @@ -348,49 +375,34 @@ version + ".author")); } - /*public static void main(String[] args) { - MediaDataSource fds = new FileDataSource(); + /* + * public static void main(String[] args) { MediaDataSource fds = new + * FileDataSource(); + * + * String[] pageName = { "Rali", "Tomek", "Adam", "Dupa", "WhatIsJBossForge" }; + * + * for (int i = 0; i < Array.getLength(pageName); i++) { WikiPage page = + * fds.getPage(pageName[i]); + * + * if (page != null) { page.showPage(); } else { System.out.println("Page " + + * pageName[i] + " doesn't exist"); } } + * + * WikiPage page = fds.getPageAtVersion("WhatIsJBossForge", 7); + * + * if (page != null) { page.showPage(); } else { System.out .println("Page + * WhatIsJBossForge doesn't exist at version 7"); } + * + * page = fds.getPageAtVersion("Dupa", 7); + * + * if (page != null) { page.showPage(); } else { System.out.println("Page + * Dupa doesn't exist at version 7"); } + * + * page = fds.getPageAtVersion("WhatIsJBossForge", 70); + * + * if (page != null) { page.showPage(); } else { System.out .println("Page + * WhatIsJBossForge doesn't exist at version 70"); } } + */ - String[] pageName = { "Rali", "Tomek", "Adam", "Dupa", - "WhatIsJBossForge" }; - - for (int i = 0; i < Array.getLength(pageName); i++) { - WikiPage page = fds.getPage(pageName[i]); - - if (page != null) { - page.showPage(); - } else { - System.out.println("Page " + pageName[i] + " doesn't exist"); - } - } - - WikiPage page = fds.getPageAtVersion("WhatIsJBossForge", 7); - - if (page != null) { - page.showPage(); - } else { - System.out - .println("Page WhatIsJBossForge doesn't exist at version 7"); - } - - page = fds.getPageAtVersion("Dupa", 7); - - if (page != null) { - page.showPage(); - } else { - System.out.println("Page Dupa doesn't exist at version 7"); - } - - page = fds.getPageAtVersion("WhatIsJBossForge", 70); - - if (page != null) { - page.showPage(); - } else { - System.out - .println("Page WhatIsJBossForge doesn't exist at version 70"); - } - }*/ - public boolean pageExists(String pageName) { File pageFile = new File(pathToMedia + "/" + pageName + ".txt"); Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java 2005-08-22 08:26:41 UTC (rev 911) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java 2005-08-22 12:50:52 UTC (rev 912) @@ -76,11 +76,14 @@ */ public WikiPage getPage(String pageName, String languageCode); - public WikiPage getPageAtVersion(WikiPage originPage, String languageCode, int version); + public WikiPage getPageAtVersion(WikiPage originPage, boolean loadContent, String languageCode, int version); - public WikiPage getPageAtVersion(WikiPage originPage, int version); + public WikiPage getPageAtVersion(WikiPage originPage, boolean loadContent, int version); public boolean pageExists(String pageName); + + public void getContentAtVersion(WikiPage page, boolean loadContent, + int version); } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java 2005-08-22 08:26:41 UTC (rev 911) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java 2005-08-22 12:50:52 UTC (rev 912) @@ -156,7 +156,7 @@ pages.put(pageName, ret); } - ret = ret.getPageAtVersion(version); + ret = ret.getPageAtVersion(true, version); if (ret != null) { if (wikiContext != null) { Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java 2005-08-22 08:26:41 UTC (rev 911) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java 2005-08-22 12:50:52 UTC (rev 912) @@ -39,6 +39,8 @@ private Date lockTime = null; private String lockUser; + + private long length = 0; /** * <p> @@ -191,12 +193,12 @@ * @return * @param version */ - public WikiPage getPageAtVersion(int version) { + public WikiPage getPageAtVersion(boolean loadContent, int version) { if (version == lastVersion) { return this; } else { - return mediaDataSource.getPageAtVersion(this,version); + return mediaDataSource.getPageAtVersion(this, loadContent, version); } } @@ -287,6 +289,10 @@ } public String getPageContent() { + if (pageContent == null) { + // page wasn't loaded with conent - lets do it + mediaDataSource.getContentAtVersion(this, true, version); + } return pageContent; } @@ -298,6 +304,9 @@ public Object clone() throws CloneNotSupportedException { WikiPage clonedPage = new WikiPage(getName(), getLastAuthor(), getPageContent(), getLastVersion(), getVersion(), getEditDate(), mediaDataSource); + + clonedPage.setLength(getLength()); + return clonedPage; } @@ -354,4 +363,16 @@ public void setVersion(int version) { this.version = version; } + + public long getLength() { + if ((length == 0)&&(getPageContent().length() != 0)) { + length = getPageContent().length(); + } + + return length; + } + + public void setLength(long length) { + this.length = length; + } } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-22 08:26:41 UTC (rev 911) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-22 12:50:52 UTC (rev 912) @@ -8,7 +8,9 @@ *************************************************/ package org.jboss.wiki; +import java.util.Calendar; import java.util.Date; +import java.util.HashMap; import javax.portlet.*; import org.jboss.portlet.*; Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java 2005-08-22 08:26:41 UTC (rev 911) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java 2005-08-22 12:50:52 UTC (rev 912) @@ -21,7 +21,7 @@ System.err.println(e); } - prevNewPage = newPage.getPageAtVersion(newPage.getVersion()-1); + prevNewPage = newPage.getPageAtVersion(true, newPage.getVersion()-1); String diff = differenceEngine.makeDiff(prevNewPage.getContent(), newPage.getContent()); |
From: <jbo...@li...> - 2005-08-22 08:26:45
|
Author: szimano Date: 2005-08-22 04:26:41 -0400 (Mon, 22 Aug 2005) New Revision: 911 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java Log: changed history Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-21 08:18:40 UTC (rev 910) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-22 08:26:41 UTC (rev 911) @@ -271,33 +271,40 @@ return false; } - public WikiPage getPageAtVersion(String pageName, String languageCode, + public WikiPage getPageAtVersion(WikiPage originPage, String languageCode, int version) { if (languageCode != null) { System.out .println("As for now, languages aren't supported in the wiki. Please do not use language codes"); } - return getPageAtVersion(pageName, version); + return getPageAtVersion(originPage, version); } - public WikiPage getPageAtVersion(String pageName, int version) { - WikiPage page = getPage(pageName); - + public WikiPage getPageAtVersion(WikiPage originPage, int version) { + WikiPage page = null; + + try { + page = (WikiPage)originPage.clone(); + } + catch (CloneNotSupportedException e) { + System.err.println(e); + } + if (page != null) { if (page.getLastVersion() < version) { System.out.println("There is no version " + version - + " of page " + pageName); + + " of page " + page.getName()); return null; } - page.setPageContent(getContentAtVersion(pageName, version)); + page.setPageContent(getContentAtVersion(page.getName(), version)); - page.setLastAuthor(getAuthorAtVersion(pageName, version)); + page.setLastAuthor(getAuthorAtVersion(page.getName(), version)); page.setVersion(version); - page.setEditDate(getDateAtVersion(pageName, version)); + page.setEditDate(getDateAtVersion(page.getName(), version)); } return page; @@ -341,7 +348,7 @@ version + ".author")); } - public static void main(String[] args) { + /*public static void main(String[] args) { MediaDataSource fds = new FileDataSource(); String[] pageName = { "Rali", "Tomek", "Adam", "Dupa", @@ -382,7 +389,7 @@ System.out .println("Page WhatIsJBossForge doesn't exist at version 70"); } - } + }*/ public boolean pageExists(String pageName) { File pageFile = new File(pathToMedia + "/" + pageName + ".txt"); Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java 2005-08-21 08:18:40 UTC (rev 910) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/MediaDataSource.java 2005-08-22 08:26:41 UTC (rev 911) @@ -76,9 +76,9 @@ */ public WikiPage getPage(String pageName, String languageCode); - public WikiPage getPageAtVersion(String pageName, String languageCode, int version); + public WikiPage getPageAtVersion(WikiPage originPage, String languageCode, int version); - public WikiPage getPageAtVersion(String pageName, int version); + public WikiPage getPageAtVersion(WikiPage originPage, int version); public boolean pageExists(String pageName); } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java 2005-08-21 08:18:40 UTC (rev 910) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java 2005-08-22 08:26:41 UTC (rev 911) @@ -196,7 +196,7 @@ return this; } else { - return mediaDataSource.getPageAtVersion(name,version); + return mediaDataSource.getPageAtVersion(this,version); } } |
From: <jbo...@li...> - 2005-08-21 08:18:47
|
Author: aron.gombas Date: 2005-08-21 04:18:40 -0400 (Sun, 21 Aug 2005) New Revision: 910 Added: trunk/labs/kosmos/deploy-portlet-liferay-portal.xml Removed: trunk/labs/kosmos/deploy-portlet-liferay.xml Modified: trunk/labs/kosmos/deploy-portlet-gridsphere.xml trunk/labs/kosmos/deploy-portlet-pluto.xml Log: Deployment updated to 0.1.0RC2 Modified: trunk/labs/kosmos/deploy-portlet-gridsphere.xml =================================================================== --- trunk/labs/kosmos/deploy-portlet-gridsphere.xml 2005-08-21 08:18:10 UTC (rev 909) +++ trunk/labs/kosmos/deploy-portlet-gridsphere.xml 2005-08-21 08:18:40 UTC (rev 910) @@ -4,6 +4,7 @@ <project basedir="." default="redeploy" name="Kosmos Portlet on Gridsphere"> <description>Kosmos Portlet Module deploy-file</description> + <!-- TODO for a fully automated deployment, this one should copy the gridsphere-ui-tags.jar and merge the Gridsphere-specific web.xml, too --> <property name="module.name" value="portlet"/> <property name="container.name" value="gridsphere"/> <import file="build/deploy.xml"/> Added: trunk/labs/kosmos/deploy-portlet-liferay-portal.xml =================================================================== --- trunk/labs/kosmos/deploy-portlet-liferay-portal.xml 2005-08-21 08:18:10 UTC (rev 909) +++ trunk/labs/kosmos/deploy-portlet-liferay-portal.xml 2005-08-21 08:18:40 UTC (rev 910) @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Kosmos Portlet deploy-script for Liferay Portal --> +<!-- $Id$ --> +<project basedir="." default="redeploy" name="Kosmos Portlet on Liferay Portal"> + <description>Kosmos Portlet Module deploy-file</description> + + <!-- TODO this is fairly useless at the moment, because the Liferay deployment is quite complicated! refer to the manual instead --> + <property name="module.name" value="portlet"/> + <property name="container.name" value="liferay-portal"/> + <import file="build/deploy.xml"/> +</project> Deleted: trunk/labs/kosmos/deploy-portlet-liferay.xml =================================================================== --- trunk/labs/kosmos/deploy-portlet-liferay.xml 2005-08-21 08:18:10 UTC (rev 909) +++ trunk/labs/kosmos/deploy-portlet-liferay.xml 2005-08-21 08:18:40 UTC (rev 910) @@ -1,10 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Kosmos Portlet deploy-script for Liferay --> -<!-- $Id$ --> -<project basedir="." default="redeploy" name="Kosmos Portlet on Liferay"> - <description>Kosmos Portlet Module deploy-file</description> - - <property name="module.name" value="portlet"/> - <property name="container.name" value="liferay"/> - <import file="build/deploy.xml"/> -</project> Modified: trunk/labs/kosmos/deploy-portlet-pluto.xml =================================================================== --- trunk/labs/kosmos/deploy-portlet-pluto.xml 2005-08-21 08:18:10 UTC (rev 909) +++ trunk/labs/kosmos/deploy-portlet-pluto.xml 2005-08-21 08:18:40 UTC (rev 910) @@ -4,6 +4,7 @@ <project basedir="." default="redeploy" name="Kosmos Portlet on Pluto"> <description>Kosmos Portlet Module deploy-file</description> + <!-- TODO for a fully automated deployment, this one should merge the 3 Pluto config-files from the distro to Pluto (what seems a bit dangerous!) --> <property name="module.name" value="portlet"/> <property name="container.name" value="pluto"/> <import file="build/deploy.xml"/> |
From: <jbo...@li...> - 2005-08-21 08:18:16
|
Author: aron.gombas Date: 2005-08-21 04:18:10 -0400 (Sun, 21 Aug 2005) New Revision: 909 Added: trunk/labs/kosmos/build/portlet-liferay-portal-deploy.properties Removed: trunk/labs/kosmos/build/portlet-liferay-deploy.properties Modified: trunk/labs/kosmos/build/portlet-gridsphere-deploy.properties Log: Deployment updated to 0.1.0RC2 Modified: trunk/labs/kosmos/build/portlet-gridsphere-deploy.properties =================================================================== --- trunk/labs/kosmos/build/portlet-gridsphere-deploy.properties 2005-08-21 08:17:50 UTC (rev 908) +++ trunk/labs/kosmos/build/portlet-gridsphere-deploy.properties 2005-08-21 08:18:10 UTC (rev 909) @@ -1 +1 @@ - +container.dir=${env.CATALINA_HOME}/webapps/${war.name} Deleted: trunk/labs/kosmos/build/portlet-liferay-deploy.properties =================================================================== --- trunk/labs/kosmos/build/portlet-liferay-deploy.properties 2005-08-21 08:17:50 UTC (rev 908) +++ trunk/labs/kosmos/build/portlet-liferay-deploy.properties 2005-08-21 08:18:10 UTC (rev 909) @@ -1 +0,0 @@ - Added: trunk/labs/kosmos/build/portlet-liferay-portal-deploy.properties =================================================================== --- trunk/labs/kosmos/build/portlet-liferay-portal-deploy.properties 2005-08-21 08:17:50 UTC (rev 908) +++ trunk/labs/kosmos/build/portlet-liferay-portal-deploy.properties 2005-08-21 08:18:10 UTC (rev 909) @@ -0,0 +1 @@ + |
From: <jbo...@li...> - 2005-08-21 08:17:56
|
Author: aron.gombas Date: 2005-08-21 04:17:50 -0400 (Sun, 21 Aug 2005) New Revision: 908 Added: trunk/labs/kosmos/conf-portlet/liferay-portal/portlet-deployer-3.5.0.xml Log: Deployment updated to 0.1.0RC2 Added: trunk/labs/kosmos/conf-portlet/liferay-portal/portlet-deployer-3.5.0.xml =================================================================== --- trunk/labs/kosmos/conf-portlet/liferay-portal/portlet-deployer-3.5.0.xml 2005-08-21 08:17:09 UTC (rev 907) +++ trunk/labs/kosmos/conf-portlet/liferay-portal/portlet-deployer-3.5.0.xml 2005-08-21 08:17:50 UTC (rev 908) @@ -0,0 +1,98 @@ +<?xml version="1.0"?> + +<project name="portlet-deployer" basedir="." default="deploy"> + <target name="init"> + <property environment="env" /> + + <!-- JBoss+Jetty --> + + <!--<property name="app.server.type" value="jboss-jetty" /> + <property name="app.server.dir" value="/CVSROOT/liferay/ext/servers/${app.server.type}" /> + <property name="app.server.deploy.dir" value="${app.server.dir}/server/default/deploy" /> + <path id="project.classpath"> + <pathelement location="${app.server.deploy.dir}/ext.ear/portal-ejb.jar" /> + <pathelement location="${env.ANT_HOME}/lib/ant.jar" /> + <fileset dir="${app.server.deploy.dir}/ext.ear/lib" /> + <pathelement location="${app.server.deploy.dir}/jbossweb-jetty.sar/javax.servlet.jar" /> + </path>--> + + <!-- JBoss+Tomcat --> + + <!--<property name="app.server.type" value="jboss-tomcat" /> + <property name="app.server.dir" value="/CVSROOT/liferay/ext/servers/${app.server.type}" /> + <property name="app.server.deploy.dir" value="${app.server.dir}/server/default/deploy" /> + <path id="project.classpath"> + <pathelement location="${app.server.deploy.dir}/ext.ear/portal-ejb.jar" /> + <pathelement location="${env.ANT_HOME}/lib/ant.jar" /> + <fileset dir="${app.server.deploy.dir}/ext.ear/lib" /> + <pathelement location="${app.server.deploy.dir}/../lib/javax.servlet.jar" /> + </path>--> + + <!-- Jetty --> + + <!-- + You cannot hot deploy portlets on Jetty because it does not come with + any native hot deployers. + + See http://www.jettyserver.org/jetty/faq?s=200-General&t=HotDeploy + --> + + <!--<property name="app.server.type" value="jetty" /> + <property name="app.server.dir" value="/CVSROOT/liferay/ext/servers/${app.server.type}" /> + <property name="app.server.deploy.dir" value="${app.server.dir}/webapps" /> + <path id="project.classpath"> + <pathelement location="${env.ANT_HOME}/lib/ant.jar" /> + <fileset dir="${app.server.dir}/lib/ext" /> + <pathelement location="${app.server.dir}/lib/javax.servlet.jar" /> + </path>--> + + <!-- Resin --> + + <!--<property name="app.server.type" value="resin" /> + <property name="app.server.dir" value="/CVSROOT/liferay/ext/servers/${app.server.type}" /> + <property name="app.server.deploy.dir" value="${app.server.dir}/webapps" /> + <path id="project.classpath"> + <pathelement location="${env.ANT_HOME}/lib/ant.jar" /> + <fileset dir="${app.server.dir}/common/lib/ext" /> + <pathelement location="${app.server.dir}/lib/jsdk-24.jar" /> + </path>--> + + <!-- Tomcat --> + + <property name="app.server.type" value="tomcat" /> + <property name="app.server.dir" value="${env.CATALINA_HOME}" /> + <property name="app.server.deploy.dir" value="${app.server.dir}/webapps" /> + <path id="project.classpath"> + <pathelement location="${env.ANT_HOME}/lib/ant.jar" /> + <fileset dir="${app.server.dir}/common/lib/ext" /> + <pathelement location="${app.server.dir}/common/lib/servlet-api.jar" /> + </path> + </target> + + <target name="deploy" depends="init"> + <java + classname="com.liferay.portal.tools.PortletDeployer" + classpathref="project.classpath" + fork="true" + newenvironment="true"> + + <!-- Required Arguments --> + + <jvmarg value="-Ddeployer.base.dir=./" /> + <jvmarg value="-Ddeployer.dest.dir=${app.server.deploy.dir}" /> + <jvmarg value="-Ddeployer.app.server.type=${app.server.type}" /> + <jvmarg value="-Ddeployer.portlet.taglib.dtd=${app.server.deploy.dir}/ext.ear/portal-web-complete.war/WEB-INF/tld/liferay-portlet.tld" /> + + <!-- Optional Arguments --> + + <jvmarg value="-Ddeployer.jboss.prefix=1" /> + <jvmarg value="-Ddeployer.tomcat.lib.dir=${app.server.dir}/common/lib/ext" /> + + <!-- Dependent Libraries --> + + <arg value="${app.server.deploy.dir}/ext.ear/portal-web-complete.war/WEB-INF/lib/util-taglib.jar" /> + <arg value="${app.server.deploy.dir}/ext.ear/lib/util-java.jar" /> + <!--<arg value="${app.server.deploy.dir}/ext.ear/lib/util-jsf.jar" />--> + </java> + </target> +</project> \ No newline at end of file |
From: <jbo...@li...> - 2005-08-21 08:17:20
|
Author: aron.gombas Date: 2005-08-21 04:17:09 -0400 (Sun, 21 Aug 2005) New Revision: 907 Added: trunk/labs/kosmos/conf-portlet/liferay-portal/ Log: Deployment updated to 0.1.0RC2 |
From: <jbo...@li...> - 2005-08-21 07:52:15
|
Author: aron.gombas Date: 2005-08-21 03:52:08 -0400 (Sun, 21 Aug 2005) New Revision: 906 Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml Log: Deployment guide updated to 0.1.0RC2 Modified: trunk/labs/kosmos/xdocs/reference/reference-manual.xml =================================================================== --- trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-08-21 07:51:36 UTC (rev 905) +++ trunk/labs/kosmos/xdocs/reference/reference-manual.xml 2005-08-21 07:52:08 UTC (rev 906) @@ -727,7 +727,7 @@ <section> - <title>Deployment scenarios</title> + <title>Deployment models</title> <para> @@ -793,7 +793,7 @@ </para> - <para>You can complicate all the scenarios by another important + <para>You can complicate all the models by another important decision: what RDBMS to use to support the portlet container and how to deploy it. Again, it's possible to use the same physical node or nodes which host the containers, or to have @@ -801,7 +801,7 @@ you, your needs and possibilities.</para> <para>In the following sections, we give detailed step-by-step instructions - for various deployment scenarios, but because of their huge variety, + for various deployment models, but because of their huge variety, we will cover just some of those. After reading these, it should be relatively easy to find out what to do in situations not listed here. </para> @@ -810,6 +810,91 @@ <section> + <title>Deployment step-by-step for Apache Tomcat and Gridsphere</title> + + <para> + + Follow these steps: + <orderedlist> + + <listitem> + + <para>Install Gridsphere as written in its manual + (<ulink url="http://www.gridsphere.org/gridsphere/docs/UsersGuide/UsersGuide.html">http://www.gridsphere.org/gridsphere/docs/UsersGuide/UsersGuide.html</ulink>). + You can find Gridsphere at <ulink url="http://www.gridsphere.org"> + http://www.gridsphere.org</ulink>.</para> + + </listitem> + + <listitem> + + <para>Deploy Jakarta Slide to the Tomcat instance used by Gridsphere + as written in the JBoss AS step-by-step.</para> + + </listitem> + + <listitem> + + <para>You can deploy the server component into the Apache Tomcat + instance used by Gridsphere, by running the server deploy script: + <programlisting>ant -f deploy-server-tomcat.xml</programlisting> + Please don't forget to set the <literal>CATALINA_HOME</literal> + environment variable before. + </para> + + </listitem> + + <listitem> + + <para>Run the portlet deploy script as: + <programlisting>ant -f deploy-portlet-gridsphere.xml</programlisting> + As an additional step, copy <filename>$GRIDSPHERE_HOME/build/lib/gridsphere-ui-tags.jar</filename> + to <filename>$CATALINA_HOME/webapps/kosmos-portlet.war/WEB-INF/lib</filename>. + </para> + + </listitem> + + <listitem> + + <para>Lauch Gridsphere, open the default portal page + (e.g. <literal>http://localhost:8080/gridsphere</literal>), and + login with the default account (<literal>root</literal> + and empty password). After this, there are couple of extra steps + that you can do using the Gridsphere admin portlets: + + <orderedlist> + <listitem> + <para>Deploy <literal>kosmos-portlet</literal> manually. + </para> + </listitem> + + <listitem> + <para>Create a new public group <literal>kosmos</literal> + that contains all the Kosmos portlets and add your user + to this new group. + </para> + </listitem> + + <listitem> + <para>Go to your new page and add the Kosmos portlets + to this. + </para> + </listitem> + + </orderedlist> + + </para> + + </listitem> + + </orderedlist> + + </para> + + </section> + + <section> + <title>Deployment step-by-step for JBoss AS and JBoss Portal</title> @@ -881,6 +966,103 @@ <section> + <title>Deployment step-by-step for Apache Tomcat and Liferay Portal</title> + + <para> + + Follow these steps: + <orderedlist> + + <listitem> + + <para>Install Liferay Portal as written in its manual. We recommend + using the bundle distribution, because that contains both the + Apache Tomcat servlet container and the Liferay Portal portlet container + in a single package. + You can find Liferay at <ulink url="http://www.liferay.com/web/guest/products"> + http://www.liferay.com/web/guest/products</ulink>.</para> + + </listitem> + + <listitem> + + <para>Deploy Jakarta Slide to the Tomcat instance used by Liferay + as written in the JBoss AS step-by-step.</para> + + </listitem> + + <listitem> + + <para>You can deploy the server component into the Apache Tomcat + instance used by Liferay, by running the server deploy script: + <programlisting>ant -f deploy-server-tomcat.xml</programlisting> + Please don't forget to set the <literal>CATALINA_HOME</literal> + environment variable before. + </para> + + </listitem> + + <listitem> + + <para> + Hot-deploy the portlets as written at <ulink url="http://www.liferay.com/web/guest/documentation/development/hot_deploy">http://www.liferay.com/web/guest/documentation/development/hot_deploy</ulink>. + The portlet distribution package of Kosmos contains a customized version of + <filename>portlet-deployer-3.5.0.xml</filename> which you might find convenient + as starting point. + </para> + + <para> + There are a couple of issues you can face while starting up your Liferay, depending on your JVM version: + + <orderedlist> + + <listitem> + <para>You have to downgrade the <filename>$LIFERAY_HOME/webapps/kosmos-portlet/WEB-INF/lib/commons-logging-1.0.4.jar</filename> to <filename>commons-logging-1.0.3.jar</filename> (downloadable from <ulink url="http://www.ibiblio.org/maven/commons-logging/jars/">http://www.ibiblio.org/maven/commons-logging/jars/</ulink>) if Liferay throws a <literal>java.lang.NoSuchMethodError: org.apache.log4j.Category.log(Ljava/lang/String;Lorg/apache/log4j/Level;Ljava/lang/Object;Ljava/lang/Throwable;)V</literal> + </para> + </listitem> + + <listitem> + <para>You have to delete <filename>$LIFERAY_HOME/common/endorsed/lib/xml-apis.jar</filename> if Liferay throws a <literal>javax.servlet.ServletException: Provider org.apache.xalan.processor.TransformerFactoryImpl not found</literal> exception + </para> + </listitem> + + <listitem> + <para>You have to copy <filename>$LIFERAY_HOME/liferay/WEB-INF/tld/liferay-portlet.tld</filename> to <filename>$LIFERAY_HOME/webapps/kosmos-portlet/WEB-INF/tld</filename> if Liferay throws a <literal>org.apache.jasper.JasperException: /pages/sf_monitoring.jsp(1,1) File "/WEB-INF/tld/liferay-portlet.tld" not found</literal> or similar exception + </para> + </listitem> + + <listitem> + <para>You have to copy <filename>$LIFERAY_HOME/liferay/WEB-INF/lib/util-taglib.jar</filename> to <filename>$LIFERAY_HOME/webapps/kosmos-portlet/WEB-INF/lib</filename> if Liferay throws a <literal>org.apache.jasper.JasperException: /pages/sf_monitoring.jsp(1,1) Failed to load or instantiate TagExtraInfo class: com.liferay.portlet.taglib.ActionURLTei</literal> or similar exception + </para> + </listitem> + + </orderedlist> + + </para> + + </listitem> + + <listitem> + + <para>Lauch Liferay, open the default portal page + (e.g. <literal>http://localhost:8080</literal>), + login with the default account (<literal>te...@li...</literal> + and <literal>test</literal>) and check whether you can see the + Kosmos portlets selectable in the combox boxes at the bottom of + the portal pages.</para> + + </listitem> + + </orderedlist> + + It is possible also to hot-deploy the components while JBoss AS + is running. + </para> + + </section> + + <section> + <title>Deployment step-by-step for Apache Tomcat and Apache Pluto</title> <para> @@ -901,16 +1083,26 @@ <listitem> + <para>Deploy Jakarta Slide to the Tomcat instance used by Pluto + as written in the JBoss AS step-by-step.</para> + + </listitem> + + <listitem> + <para>You can deploy the server component into the Apache Tomcat instance used by Pluto, by running the server deploy script: <programlisting>ant -f deploy-server-tomcat.xml</programlisting> + Please don't forget to set the <literal>CATALINA_HOME</literal> + environment variable before. </para> </listitem> <listitem> - <para>Pluto has a portlet to deploy other portlets. It makes the + <para>Pluto has a portlet called <literal>Deploy War Admin Portlet</literal> + to deploy other portlets. It makes the deployment process extremely easy: just select the portlet WAR and configure the pages, Pluto will take care of all the low-level details. Don't forget to restart Pluto after you've deployed @@ -920,10 +1112,26 @@ <para>If for some reason you decided to do an automated deployment instead of using the administrative portlet, run the portlet deploy script as: <programlisting>ant -f deploy-portlet-pluto.xml</programlisting> + After this, you have to manually update the following Pluto configuration + files: + <simplelist> + <member><filename>pageregistry.xml</filename></member> + <member><filename>portletcontexts.txt</filename></member> + <member><filename>portletentityregistry.xml</filename></member> + </simplelist> + You can use the sample files found in <literal>/conf/pluto</literal> of the + Kosmos portlet distribution package as starting point. </para> - </listitem> + + <listitem> + <para> + Launch Pluto and check the default portal page + (e.g. <literal>http://localhost:8080/pluto/portal</literal>), + whether you can see your new page in the page list. + </para> + </listitem> </orderedlist> @@ -1016,35 +1224,6 @@ <section> - <title>I18n</title> - - <para>The server component is completely locale-agnostic, you - don't have to do anything there.</para> - - <para> - - Setting the preferred locale is simply a change in the - <filename>web.xml</filename> - of the portlet module. You just have to change the - context-param which configures the JSTL library: - <programlisting><context-param> - <param-name>javax.servlet.jsp.jstl.fmt.locale</param-name> - <param-value><emphasis>en</emphasis></param-value> -</context-param></programlisting> - This parameter accepts the standard Java locale signs as value, - but please make sure that the property file of the selected - language is available in your distribution. At the moment, the - supported locales are: English ( - <literal>en</literal> - ) and Hungarian ( - <literal>hu</literal> - ). - </para> - - </section> - - <section> - <title>General portlet configuration</title> <para> @@ -1207,6 +1386,35 @@ </section> + <section> + + <title>I18n</title> + + <para>The server component is completely locale-agnostic, you + don't have to do anything there.</para> + + <para> + + Setting the preferred locale is simply a change in the + <filename>web.xml</filename> + of the portlet module. You just have to change the + context-param which configures the JSTL library: + <programlisting><context-param> + <param-name>javax.servlet.jsp.jstl.fmt.locale</param-name> + <param-value><emphasis>en</emphasis></param-value> +</context-param></programlisting> + This parameter accepts the standard Java locale signs as value, + but please make sure that the property file of the selected + language is available in your distribution. At the moment, the + supported locales are: English ( + <literal>en</literal> + ) and Hungarian ( + <literal>hu</literal> + ). + </para> + + </section> + </chapter> <chapter> |
From: <jbo...@li...> - 2005-08-21 07:51:49
|
Author: aron.gombas Date: 2005-08-21 03:51:36 -0400 (Sun, 21 Aug 2005) New Revision: 905 Added: trunk/labs/kosmos/conf-portlet/gridsphere/gridsphere-portlet.xml trunk/labs/kosmos/conf-portlet/gridsphere/web.xml trunk/labs/kosmos/conf-portlet/pluto/pageregistry.xml trunk/labs/kosmos/conf-portlet/pluto/portletcontexts.txt trunk/labs/kosmos/conf-portlet/pluto/portletentityregistry.xml Removed: trunk/labs/kosmos/conf-portlet/liferay/ Log: Deployment updated to 0.1.0RC2 Added: trunk/labs/kosmos/conf-portlet/gridsphere/gridsphere-portlet.xml =================================================================== --- trunk/labs/kosmos/conf-portlet/gridsphere/gridsphere-portlet.xml 2005-08-21 07:42:20 UTC (rev 904) +++ trunk/labs/kosmos/conf-portlet/gridsphere/gridsphere-portlet.xml 2005-08-21 07:51:36 UTC (rev 905) @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<portlet-app-collection> + <portlet-app-def> + <portlet-app id="org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet"> + <portlet-name>JSR Portlet Servlet</portlet-name> + <servlet-name>PortletServlet</servlet-name> + </portlet-app> + <concrete-portlet-app id="org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet.1"> + <concrete-portlet> + <portlet-name>Portlet Servlet</portlet-name> + <default-locale>en</default-locale> + <language locale="en"> + <title>Portlet Servlet</title> + <title-short>Portlet Servlet</title-short> + <description>A JSR Portlet Loader</description> + <keywords>portlet servlet</keywords> + </language> + </concrete-portlet> + </concrete-portlet-app> + </portlet-app-def> +</portlet-app-collection> Added: trunk/labs/kosmos/conf-portlet/gridsphere/web.xml =================================================================== --- trunk/labs/kosmos/conf-portlet/gridsphere/web.xml 2005-08-21 07:42:20 UTC (rev 904) +++ trunk/labs/kosmos/conf-portlet/gridsphere/web.xml 2005-08-21 07:51:36 UTC (rev 905) @@ -0,0 +1,29 @@ +<?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> + <!-- JSTL configuration --> + <context-param> + <param-name>javax.servlet.jsp.jstl.fmt.locale</param-name> + <param-value>en</param-value> + </context-param> + + <!-- JSP configuration --> + <taglib> + <taglib-uri>http://displaytag.sf.net/el</taglib-uri> + <taglib-location>/WEB-INF/tld/displaytag-el-12.tld</taglib-location> + </taglib> + + <!-- Gridsphere configuration --> + <servlet> + <servlet-name>PortletServlet</servlet-name> + <servlet-class>org.gridlab.gridsphere.provider.portlet.jsr.PortletServlet</servlet-class> + </servlet> + + <servlet-mapping> + <servlet-name>PortletServlet</servlet-name> + <url-pattern>/jsr/kosmos-portlet</url-pattern> + </servlet-mapping> +</web-app> Added: trunk/labs/kosmos/conf-portlet/pluto/pageregistry.xml =================================================================== --- trunk/labs/kosmos/conf-portlet/pluto/pageregistry.xml 2005-08-21 07:42:20 UTC (rev 904) +++ trunk/labs/kosmos/conf-portlet/pluto/pageregistry.xml 2005-08-21 07:51:36 UTC (rev 905) @@ -0,0 +1,32 @@ +<fragment name="kosmos-portlet" type="page" > + <navigation> + <title>kosmos-page</title> + <description>Kosmos page</description> + </navigation> + <fragment name="row1" type="row"> + <fragment name="col1" type="column"> + <fragment name="p1" type="portlet"> + <property name="portlet" value="6.2"/> + </fragment> + <fragment name="p2" type="portlet"> + <property name="portlet" value="6.0"/> + </fragment> + <fragment name="p3" type="portlet"> + <property name="portlet" value="6.5"/> + </fragment> + </fragment> + </fragment> + <fragment name="row2" type="row"> + <fragment name="col4" type="column"> + <fragment name="p4" type="portlet"> + <property name="portlet" value="6.3"/> + </fragment> + <fragment name="p5" type="portlet"> + <property name="portlet" value="6.1"/> + </fragment> + <fragment name="p6" type="portlet"> + <property name="portlet" value="6.4"/> + </fragment> + </fragment> + </fragment> +</fragment> Added: trunk/labs/kosmos/conf-portlet/pluto/portletcontexts.txt =================================================================== --- trunk/labs/kosmos/conf-portlet/pluto/portletcontexts.txt 2005-08-21 07:42:20 UTC (rev 904) +++ trunk/labs/kosmos/conf-portlet/pluto/portletcontexts.txt 2005-08-21 07:51:36 UTC (rev 905) @@ -0,0 +1 @@ +/kosmos-portlet \ No newline at end of file Added: trunk/labs/kosmos/conf-portlet/pluto/portletentityregistry.xml =================================================================== --- trunk/labs/kosmos/conf-portlet/pluto/portletentityregistry.xml 2005-08-21 07:42:20 UTC (rev 904) +++ trunk/labs/kosmos/conf-portlet/pluto/portletentityregistry.xml 2005-08-21 07:51:36 UTC (rev 905) @@ -0,0 +1,21 @@ +<application id="6"> + <definition-id>kosmos-portlet</definition-id> + <portlet id="0"> + <definition-id>kosmos-portlet.LocalCcMonitoringPortlet</definition-id> + </portlet> + <portlet id="1"> + <definition-id>kosmos-portlet.JBossJiraMonitoringPortlet</definition-id> + </portlet> + <portlet id="2"> + <definition-id>kosmos-portlet.KosmosDependenciesSfMonitoringPortlet</definition-id> + </portlet> + <portlet id="3"> + <definition-id>kosmos-portlet.KosmosToolsSfMonitoringPortlet</definition-id> + </portlet> + <portlet id="4"> + <definition-id>kosmos-portlet.JBossProductsSfMonitoringPortlet</definition-id> + </portlet> + <portlet id="5"> + <definition-id>kosmos-portlet.JBossSvnMonitoringPortlet</definition-id> + </portlet> +</application> |
From: <jbo...@li...> - 2005-08-21 07:42:29
|
Author: aron.gombas Date: 2005-08-21 03:42:20 -0400 (Sun, 21 Aug 2005) New Revision: 904 Modified: trunk/labs/kosmos/build/build.xml Log: Docbook XSL upgraded Modified: trunk/labs/kosmos/build/build.xml =================================================================== --- trunk/labs/kosmos/build/build.xml 2005-08-19 15:48:45 UTC (rev 903) +++ trunk/labs/kosmos/build/build.xml 2005-08-21 07:42:20 UTC (rev 904) @@ -11,7 +11,7 @@ <description>Kosmos build-script template used by the module-dependent build-scripts</description> <!-- external paths --> - <property name="docbook.dir" location="/Java/docbook-xsl-1.69.0"/> + <property name="docbook.dir" location="/Java/docbook-xsl-1.69.1"/> <property name="fop.dir" location="/Java/fop-0.20.5"/> <property name="saxon.dir" location="/Java/saxonb-8.5"/> |
Author: adamw Date: 2005-08-19 11:48:45 -0400 (Fri, 19 Aug 2005) New Revision: 903 Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/blog/BlogUpdater.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/ContentManager.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/FileBasedContentManager.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java trunk/forge/portal-extensions/forge-forums/project.xml trunk/forge/portal-extensions/forge-forums/to-copy/portal-forums.ear/portal-forums-lib.jar trunk/forge/portal-extensions/forge-forums/to-copy/portal-forums.ear/portal-forums.war Log: New forums & directories instead of catalogues Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/blog/BlogUpdater.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/blog/BlogUpdater.java 2005-08-18 19:48:21 UTC (rev 902) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/blog/BlogUpdater.java 2005-08-19 15:48:45 UTC (rev 903) @@ -38,7 +38,7 @@ this.blogPath = blogPath; forgeHelper = new ForgeHelper(); - portals = cm.getCatalogues(""); + portals = cm.getDirectories(""); } /** @@ -74,12 +74,12 @@ */ private void updatePortal(String portalName) { // Getting ids of all projects in the given portal - String projectIds[] = cm.getCatalogues(portalName + "/" + String projectIds[] = cm.getDirectories(portalName + "/" + ProjectsHelper.MEMBERS_DIR); for (int i = 0; i < projectIds.length; i++) { // Getting blog entries that are held in the repository. - String[] repoEntries = cm.getResourceNames(portalName + "/" + String[] repoEntries = cm.getResources(portalName + "/" + ProjectsHelper.MEMBERS_DIR + "/" + projectIds[i] + "/" + ProjectsHelper.BLOG_DIR); Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/ContentManager.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/ContentManager.java 2005-08-18 19:48:21 UTC (rev 902) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/ContentManager.java 2005-08-19 15:48:45 UTC (rev 903) @@ -57,20 +57,20 @@ throws IOException; /** - * Adds a new, empty catalogue to the content manager. + * Adds a new, empty directory to the content manager. * * @param parent - * Parent catalogue of the new catalogue. + * Parent directory of the new catalogue. * @param name - * Name of the resource to add. - * @throws IOException When the catalogue exists or there is + * Name of the directory to add. + * @throws IOException When the directory exists or there is * any other content-manager related error. */ - public abstract void addCatalogue(String parent, String name) + public abstract void addDirectory(String parent, String name) throws IOException; /** - * Deletes a given resource or catalogue from the content manager. + * Deletes a given resource or directory from the content manager. * * @param name * Name of the resource to delete. @@ -80,10 +80,11 @@ public abstract void delete(String name) throws IOException; /** - * Commits a resource (or catalogue) to the repository. + * Commits a resource (or directory) to the repository. All child + * resources and directories will also be commited. * * @param names - * Name of the resource/catalogue to commit. + * Name of the resource/directory to commit. * @throws IOException */ public void commit(String name) throws IOException { @@ -149,16 +150,16 @@ public abstract void update(); /** - * Gets names of all resources that can be found in the given catalogue. - * @param catalogue Catalogue from which to read resources. + * Gets names of all resources that can be found in the given directory. + * @param directory Directory from which to read resources. * @return An array of resource names. */ - public abstract String[] getResourceNames(String catalogue); + public abstract String[] getResources(String directory); /** - * Gets names of all sub-catalogues that can be found in the given catalogue. - * @param catalogue Catalogue from which to read sub-catalogues. + * Gets names of all sub-directories that can be found in the given catalogue. + * @param directory Directory from which to read sub-catalogues. * @return An array of catalogues names. */ - public abstract String[] getCatalogues(String catalogue); + public abstract String[] getDirectories(String directory); } Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/FileBasedContentManager.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/FileBasedContentManager.java 2005-08-18 19:48:21 UTC (rev 902) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/FileBasedContentManager.java 2005-08-19 15:48:45 UTC (rev 903) @@ -113,11 +113,11 @@ } /* (non-Javadoc) - * @see org.jboss.forge.common.content.ContentManager#getResourceNames(java.lang.String) + * @see org.jboss.forge.common.content.ContentManager#getResources(java.lang.String) */ @Override - public String[] getResourceNames(String catalogue) { - String[] ret = new File(getSystemFilePath(catalogue)) + public String[] getResources(String directory) { + String[] ret = new File(getSystemFilePath(directory)) .list(new FilenameFilter() { public boolean accept(File dir, String name) { if (new File(dir.getAbsolutePath() + File.separator @@ -130,11 +130,11 @@ } /* (non-Javadoc) - * @see org.jboss.forge.common.content.ContentManager#getCatalogues(java.lang.String) + * @see org.jboss.forge.common.content.ContentManager#getDirectories(java.lang.String) */ @Override - public String[] getCatalogues(String catalogue) { - String[] ret = new File(getSystemFilePath(catalogue)) + public String[] getDirectories(String directory) { + String[] ret = new File(getSystemFilePath(directory)) .list(new FilenameFilter() { public boolean accept(File dir, String name) { if (name.startsWith(".")) Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java 2005-08-18 19:48:21 UTC (rev 902) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java 2005-08-19 15:48:45 UTC (rev 903) @@ -165,10 +165,10 @@ } /* (non-Javadoc) - * @see org.jboss.forge.common.content.ContentManager#addCatalogue(java.lang.String, java.lang.String) + * @see org.jboss.forge.common.content.ContentManager#addDirectory(java.lang.String, java.lang.String) */ @Override - public void addCatalogue(String parent, String name) throws IOException { + public void addDirectory(String parent, String name) throws IOException { // Checking the name. if (!checkNewName(name)) throw new IOException("Invalid new catalogue name."); @@ -207,7 +207,7 @@ "rO@B5oPfff"); System.out.println("Adding cat"); - cm.addCatalogue("", "zzz"); + cm.addDirectory("", "zzz"); System.out.println("Adding res"); cm.addResource("zzz", "aaa"); cm.write("zzz/aaa", "bbb", false); Modified: trunk/forge/portal-extensions/forge-forums/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-forums/project.xml 2005-08-18 19:48:21 UTC (rev 902) +++ trunk/forge/portal-extensions/forge-forums/project.xml 2005-08-19 15:48:45 UTC (rev 903) @@ -6,6 +6,7 @@ --> <project> <pomVersion>3</pomVersion> + <extend>../common.xml</extend> <id>jbossforums</id> <name>JBoss Forums with forge fixes</name> <currentVersion>1.0</currentVersion> Modified: trunk/forge/portal-extensions/forge-forums/to-copy/portal-forums.ear/portal-forums-lib.jar =================================================================== (Binary files differ) Modified: trunk/forge/portal-extensions/forge-forums/to-copy/portal-forums.ear/portal-forums.war =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-08-18 19:48:56
|
Author: ral...@jb... Date: 2005-08-18 15:48:21 -0400 (Thu, 18 Aug 2005) New Revision: 902 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java Log: stupid me, regular expression for camelCase fixed Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-18 19:02:30 UTC (rev 901) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-18 19:48:21 UTC (rev 902) @@ -361,7 +361,7 @@ } public String parseCamelCase(String link) { - String camelCasepattern = "^([\\p{Alnum}]*|\\~)([\\p{Upper}]+[\\p{Lower}]+[\\p{Upper}]+[\\p{Alnum}]*)[^\\p{Alnum}]*$"; + String camelCasepattern = "^([^\\p{Alnum}]*|\\~)([\\p{Upper}]+[\\p{Lower}]+[\\p{Upper}]+[\\p{Alnum}]*)[^\\p{Alnum}]*$"; Pattern camelCase = Pattern.compile(camelCasepattern); Matcher camelMatch = camelCase.matcher(link); if (camelMatch.matches()) { |
From: <jbo...@li...> - 2005-08-18 19:02:40
|
Author: szimano Date: 2005-08-18 15:02:30 -0400 (Thu, 18 Aug 2005) New Revision: 901 Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: oh damon damon... Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-18 18:55:45 UTC (rev 900) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-18 19:02:30 UTC (rev 901) @@ -34,7 +34,7 @@ %> - <a href="<%=actionURL%>&action=History&page=<%=wikiPage%>"><img src="/file-access/default/members/jbosswiki/images/historyButton.png"</img></a> + <a href="<%=actionURL%>&action=Info&page=<%=wikiPage%>"><img src="/file-access/default/members/jbosswiki/images/historyButton.png"</img></a> <form method="post" action="<%=actionURL%>"> <input type="text" name="page" /> <input type="submit" value="GO" /> @@ -43,17 +43,9 @@ <hr /> -<div class="wikiTrail">Your trail: <i>TODO</i></div> - -<hr /> - -<table> +<table style="width: 100%"> <tr> -<td class="wikiContent"> - - <%=wikiContent%> - -<td> +<td class="wikiContent"><%=wikiContent%><td> </tr> <tr> <td class="wikiFooter"> |
Author: adamw Date: 2005-08-18 14:55:45 -0400 (Thu, 18 Aug 2005) New Revision: 900 Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/service/ForgeManagement.java trunk/forge/portal-extensions/forge-contributor/src/java/org/jboss/forge/contributor/ConServer.java trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java Log: Metod rename Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/service/ForgeManagement.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/service/ForgeManagement.java 2005-08-18 18:48:58 UTC (rev 899) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/service/ForgeManagement.java 2005-08-18 18:55:45 UTC (rev 900) @@ -48,10 +48,11 @@ */ public Object forceNodeUpdate(String portalName, String key); /** - * Adds a resource to commit queue. - * @param name Name of the resource to commit. The name must be root-relative. + * Adds a resource or catalogue to commit queue. + * @param name Name of the resource or catalogue to commit. The name must + * be root-relative. */ - public void addResourceToCommit(String name); + public void addToCommit(String name); /** * Updates the forge: * - updates the repo Modified: trunk/forge/portal-extensions/forge-contributor/src/java/org/jboss/forge/contributor/ConServer.java =================================================================== --- trunk/forge/portal-extensions/forge-contributor/src/java/org/jboss/forge/contributor/ConServer.java 2005-08-18 18:48:58 UTC (rev 899) +++ trunk/forge/portal-extensions/forge-contributor/src/java/org/jboss/forge/contributor/ConServer.java 2005-08-18 18:55:45 UTC (rev 900) @@ -77,7 +77,7 @@ } private void addToToCommit(String toAdd) { - forgeHelper.getForgeManagement().addResourceToCommit(toAdd); + forgeHelper.getForgeManagement().addToCommit(toAdd); } ResourceBundle getMessages() { Modified: trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java =================================================================== --- trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-08-18 18:48:58 UTC (rev 899) +++ trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-08-18 18:55:45 UTC (rev 900) @@ -60,7 +60,7 @@ return initialValue; } - public void addResourceToCommit(String name) { + public void addToCommit(String name) { synchronized (toCommit) { toCommit.add(name); } |
From: <jbo...@li...> - 2005-08-18 18:49:09
|
Author: ral...@jb... Date: 2005-08-18 14:48:58 -0400 (Thu, 18 Aug 2005) New Revision: 899 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java Log: camelCaseLinksAdded Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-18 18:35:12 UTC (rev 898) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-18 18:48:58 UTC (rev 899) @@ -69,12 +69,18 @@ private int m_listlevel = 0; private int m_numlistlevel = 0; + private boolean m_camelCaseLinks = true; //camelCase enabled /** Tag that gets closed at EOL. */ private String m_closeTag = null; /** Allow this many characters to be pushed back in the stream. */ private static final int PUSHBACK_BUFFER_SIZE = 8; + /** + * These characters constitute word separators when trying + * to find CamelCase links. + */ + private static final String WORD_SEPARATORS = ",.|:;+=&"; private PushbackReader m_in; @@ -127,6 +133,69 @@ continue; } // + // CamelCase detection, a non-trivial endeavour. + // We keep track of all white-space separated entities, which we + // hereby refer to as "words". We then check for an existence + // of a CamelCase format text string inside the "word", and + // if one exists, we replace it with a proper link. + // + + if( m_camelCaseLinks ) + { + // Quick parse of start of a word boundary. + + if( word == null && + (Character.isWhitespace( (char)previousCh ) || + WORD_SEPARATORS.indexOf( (char)previousCh ) != -1 || + newLine ) && + !Character.isWhitespace( (char) ch ) ) + { + word = new StringBuffer(); + } + + // Are we currently tracking a word? + if( word != null ) + { + // + // Check for the end of the word. + // + + if( Character.isWhitespace( (char)ch ) || + ch == -1 || + WORD_SEPARATORS.indexOf( (char) ch ) != -1 ) + { + String potentialLink = word.toString(); + + String camelCase = parseCamelCase(potentialLink); + + if( camelCase != null ) + { + // System.out.println("Buffer is "+buf); + + // System.out.println(" Replacing "+camelCase+" with proper link."); + start = buf.toString().lastIndexOf( camelCase ); + buf.replace(start, + start+camelCase.length(), + handleHyperlinks(camelCase) ); + + // System.out.println(" Resulting with "+buf); + } + + // We've ended a word boundary, so time to reset. + word = null; + } + else + { + // This should only be appending letters and digits. + word.append( (char)ch ); + } // if end of word + } // if word's not null + + // Always set the previous character to test for word starts. + previousCh = ch; + + } // if m_camelCaseLinks + // // Check if any lists need closing down. // @@ -290,7 +359,27 @@ return translatedContent; } + + public String parseCamelCase(String link) { + String camelCasepattern = "^([\\p{Alnum}]*|\\~)([\\p{Upper}]+[\\p{Lower}]+[\\p{Upper}]+[\\p{Alnum}]*)[^\\p{Alnum}]*$"; + Pattern camelCase = Pattern.compile(camelCasepattern); + Matcher camelMatch = camelCase.matcher(link); + if (camelMatch.matches()) { + String result = camelMatch.group(2); //get the camel case words + if (camelMatch.group(1) != null) + { + if ((camelMatch.group(1).equals("~")) + || (camelMatch.group(1).indexOf('[') != -1)) + { + return null; //this is camelCase escape or [...] link + } + } + return result; + }//if match + return null; + } + /* a collection of all media formats allowed on wiki */ private Collection getImagePatterns() { ArrayList patterns = new ArrayList(); |
From: <jbo...@li...> - 2005-08-18 18:35:23
|
Author: dam...@jb... Date: 2005-08-18 14:35:12 -0400 (Thu, 18 Aug 2005) New Revision: 898 Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: Added the Edit and History buttons. Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-18 18:05:11 UTC (rev 897) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-18 18:35:12 UTC (rev 898) @@ -1,9 +1,3 @@ -<!-- - 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" %> <%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="n" %> <%@ taglib uri="/WEB-INF/tld/forge.tld" prefix="forge" %> @@ -11,8 +5,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"); @@ -21,9 +15,26 @@ org.jboss.wiki.Credentials author = (org.jboss.wiki.Credentials)request.getAttribute("author"); %> -<h2><%=wikiName%>/ <%=wikiPage%></h2> +<h2><%=wikiName%>/<%=wikiPage%></h2> <div style="text-align: right;"> + +<% + + String logedIn = (String)request.getAttribute("logedIn"); + + + if (logedIn.equals("true")) { + out.print("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"'><img src=\"/file-access/default/members/jbosswiki/images/editButton.png\"</img></a>"); + + } + else { + out.print("<i>Login to edit pages</i>"); + } + +%> + + <a href="<%=actionURL%>&action=History&page=<%=wikiPage%>"><img src="/file-access/default/members/jbosswiki/images/historyButton.png"</img></a> <form method="post" action="<%=actionURL%>"> <input type="text" name="page" /> <input type="submit" value="GO" /> @@ -32,23 +43,16 @@ <hr /> -<% - Integer showedVersion = (Integer)request.getAttribute("showedVersion"); - - if (showedVersion != null) { - out.println("<table style='border-style: dashed; border-color: red; text-align:center; margin-right: auto; margin-left: auto;'><tr><td>"+ - "You are watching <b>VERSION "+showedVersion+" </b> of page "+wikiPage+".<br />\n"+ - "You can go to <a href='"+actionURL+"&page="+wikiPage+"'>latest version of "+wikiPage+"</a>"+ - " or <a href='"+actionURL+"&action=Edit&page="+wikiPage+"&version="+showedVersion+"'> rollback to this version</a>"+ - "<td></table>\n<hr />"); - } -%> -<table style="width: 100%"> +<div class="wikiTrail">Your trail: <i>TODO</i></div> + +<hr /> + +<table> <tr> -<td class="wikiContent"> +<td class="wikiContent"> <%=wikiContent%> - + <td> </tr> <tr> @@ -56,24 +60,8 @@ <hr /> -<% - String logedIn = (String)request.getAttribute("logedIn"); - - - if (logedIn.equals("true")) { - out.print("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"'>Edit page</a>"); - - } - else { - out.print("<i>Login to edit pages</i>"); - } - -%> - - - -<a href="<%=actionURL%>&action=Info&page=<%=wikiPage%>">More info...</a> <a href="<%=actionURL%>">Attach file...</a> +<a href="<%=actionURL%>&action=Info&page=<%=wikiPage%>">More info...</a> <a href="<%=actionURL%>">Attach file...</a> </td> </tr> </table> |
Author: adamw Date: 2005-08-18 14:05:11 -0400 (Thu, 18 Aug 2005) New Revision: 897 Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/ContentManager.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/FileBasedContentManager.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java Log: Repo adding/deleting Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/ContentManager.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/ContentManager.java 2005-08-18 17:43:48 UTC (rev 896) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/ContentManager.java 2005-08-18 18:05:11 UTC (rev 897) @@ -44,6 +44,42 @@ throws IOException; /** + * Adds a new, empty resource to the content manager. + * + * @param parent + * Parent catalogue of the new resource. + * @param name + * Name of the resource to add. + * @throws IOException When the resource exists or there is + * any other content-manager related error. + */ + public abstract void addResource(String parent, String name) + throws IOException; + + /** + * Adds a new, empty catalogue to the content manager. + * + * @param parent + * Parent catalogue of the new catalogue. + * @param name + * Name of the resource to add. + * @throws IOException When the catalogue exists or there is + * any other content-manager related error. + */ + public abstract void addCatalogue(String parent, String name) + throws IOException; + + /** + * Deletes a given resource or catalogue from the content manager. + * + * @param name + * Name of the resource to delete. + * @throws IOException When the resource/catalogue cannot be + * deleted or there is any other content-manager related error. + */ + public abstract void delete(String name) throws IOException; + + /** * Commits a resource (or catalogue) to the repository. * * @param names Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/FileBasedContentManager.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/FileBasedContentManager.java 2005-08-18 17:43:48 UTC (rev 896) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/FileBasedContentManager.java 2005-08-18 18:05:11 UTC (rev 897) @@ -45,6 +45,9 @@ return replaceSeparators(basePath + File.separator + name); } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#read(java.lang.String) + */ @Override public String read(String name) throws IOException { BufferedReader bf = new BufferedReader(new FileReader( @@ -65,21 +68,33 @@ return ret; } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#getLength(java.lang.String) + */ @Override public long getLength(String name) { return new File(getSystemFilePath(name)).length(); } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#getInputStream(java.lang.String) + */ @Override public InputStream getInputStream(String name) throws IOException { return new FileInputStream(getSystemFilePath(name)); } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#getLastModification(java.lang.String) + */ @Override public long getLastModification(String name) { return new File(getSystemFilePath(name)).lastModified(); } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#copyResourceToFile(java.lang.String, java.lang.String) + */ @Override public void copyResourceToFile(String name, String destination) throws IOException { // Create channel on the source @@ -97,6 +112,9 @@ dstChannel.close(); } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#getResourceNames(java.lang.String) + */ @Override public String[] getResourceNames(String catalogue) { String[] ret = new File(getSystemFilePath(catalogue)) @@ -111,6 +129,9 @@ return ret == null ? new String[0] : ret; } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#getCatalogues(java.lang.String) + */ @Override public String[] getCatalogues(String catalogue) { String[] ret = new File(getSystemFilePath(catalogue)) Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java 2005-08-18 17:43:48 UTC (rev 896) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java 2005-08-18 18:05:11 UTC (rev 897) @@ -30,8 +30,7 @@ public class SvnContentManager extends FileBasedContentManager { private String svnPath; private String localPath; - private String svnUsername; - private String svnPassword; + private SVNClientManager ourClientManager; /** * @param svnPath @@ -50,17 +49,19 @@ // for SVN (over svn and svn+ssh) SVNRepositoryFactoryImpl.setup(); + ISVNOptions options = SVNWCUtil.createDefaultOptions(true); + ourClientManager = + SVNClientManager.newInstance(options, svnUsername, svnPassword); + this.svnPath = svnPath; this.localPath = localPath; - this.svnUsername = svnUsername; - this.svnPassword = svnPassword; } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#update() + */ + @Override public synchronized void update() { - ISVNOptions options = SVNWCUtil.createDefaultOptions(true); - SVNClientManager ourClientManager = - SVNClientManager.newInstance(options, svnUsername, svnPassword); - try { SVNURL repositoryURL = SVNURL.parseURIEncoded(svnPath); @@ -85,15 +86,14 @@ } } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#commit(java.lang.String[]) + */ @Override public void commit(String[] names) throws IOException { - ISVNOptions options = SVNWCUtil.createDefaultOptions(true); - SVNClientManager ourClientManager = - SVNClientManager.newInstance(options, svnUsername, svnPassword); - File[] files = new File[names.length]; for (int i=0; i<names.length; i++) - files[i] = new File(localPath+File.separator+names[i]); + files[i] = new File(getSystemFilePath(names[i])); try { ourClientManager.getCommitClient().doCommit(files, false, @@ -104,6 +104,9 @@ } } + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#write(java.lang.String, java.lang.String, boolean) + */ @Override public void write(String name, String content, boolean commit) throws IOException { @@ -115,4 +118,102 @@ if (commit) commit(name); } + + /** + * Checks if the given name is a valid name for a new resource + * or catalogue, i.e. if it doesn't contain a \ or /, which would + * add a new directory to the fs. + * @param name Name to check. + * @return True iff the name is valid. + */ + private boolean checkNewName(String name) { + if (((name.indexOf('/') != -1) || ((name.indexOf('\\')) != -1))) + return false; + + return true; + } + + /** + * Common operations for adding resources/catalogues. + * @param file File to add to svn repository. + * @throws IOException + */ + private void addGeneric(File file) throws IOException { + // And adding the file. + try { + ourClientManager.getWCClient().doAdd(file, true, false, false, false); + } catch (SVNException e) { + throw new IOException("SVN error while adding the new file"); + } + } + + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#addResource(java.lang.String, java.lang.String) + */ + @Override + public void addResource(String parent, String name) throws IOException { + // Checking the name. + if (!checkNewName(name)) + throw new IOException("Invalid new resource name."); + + // Trying to create a new empty file. + File file = new File(getSystemFilePath(parent + "/" + name)); + if (!file.createNewFile()) + throw new IOException("Resource already exists."); + + addGeneric(file); + } + + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#addCatalogue(java.lang.String, java.lang.String) + */ + @Override + public void addCatalogue(String parent, String name) throws IOException { + // Checking the name. + if (!checkNewName(name)) + throw new IOException("Invalid new catalogue name."); + + // Trying to create a new empty file. + File file = new File(getSystemFilePath(parent + "/" + name)); + if (!file.mkdir()) + throw new IOException("Catalogue already exists."); + + addGeneric(file); + } + + /* (non-Javadoc) + * @see org.jboss.forge.common.content.ContentManager#delete(java.lang.String) + */ + @Override + public void delete(String name) throws IOException { + File file = new File(getSystemFilePath(name)); + if (!file.canWrite()) + throw new IOException("Can't delete resource/catalogue"); + + // And adding the file. + try { + ourClientManager.getWCClient().doDelete(file, true, false); + } catch (SVNException e) { + throw new IOException("SVN error while deleting the given " + + "resource/catalogue."); + } + } + + public static void main(String[] argv) throws IOException { + ContentManager cm = new SvnContentManager( + "https://cms.labs.jboss.com/trunk/forge/portal-content", + "/home/adamw/jboss/content/trunk/forge/portal-content", + "jbf...@jb...", + "rO@B5oPfff"); + + System.out.println("Adding cat"); + cm.addCatalogue("", "zzz"); + System.out.println("Adding res"); + cm.addResource("zzz", "aaa"); + cm.write("zzz/aaa", "bbb", false); + cm.commit("zzz"); + System.out.println("Deleting res"); + cm.delete("zzz"); + cm.commit("zzz"); + } } Modified: trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java =================================================================== --- trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-08-18 17:43:48 UTC (rev 896) +++ trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-08-18 18:05:11 UTC (rev 897) @@ -127,14 +127,12 @@ } public void create() throws Exception { - System.out.println("0"); } @EJB private ForgeTimerLocal timer; public void start() throws Exception { - System.out.println("1"); forgeHelper = new ForgeHelper(); // Getting a root-relative content manager. @@ -145,7 +143,6 @@ nodeWatchers = Collections.synchronizedMap( new HashMap<CacheKey, NodeWatcher>()); toCommit = new HashSet<String>(); - System.out.println("2"); // First repo update & possible checkout. try { cm.update(); @@ -153,17 +150,14 @@ log.warn(e); e.printStackTrace(); } - System.out.println("3"); // Adding blog updater node watcher. addNodeWatcher(null, BlogUpdaterNodeWatcher.class.getName(), new BlogUpdaterNodeWatcher()); // Setting the default timer interval. timerInterval = DEFAULT_TIMER_INTERVAL; - System.out.println("4"); // And starting the timer. timer.scheduleTimer(DEFAULT_TIMER_INTERVAL); - System.out.println("5"); } public void stop() { |
From: <jbo...@li...> - 2005-08-18 17:48:52
|
Author: szimano Date: 2005-08-18 13:43:48 -0400 (Thu, 18 Aug 2005) New Revision: 896 Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/TrailPlugin.java Log: for rali :) Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/TrailPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/TrailPlugin.java 2005-08-18 16:50:55 UTC (rev 895) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/TrailPlugin.java 2005-08-18 17:43:48 UTC (rev 896) @@ -31,7 +31,7 @@ wikiSession.setAttribute("TRAIL", trail); - newPage.setPageContent("Your trail: "+trail+"\n----"+newPage.getContent()); + newPage.setPageContent("Your trail: "+trail+"\n----\n"+newPage.getContent()); return newPage; } |
From: <jbo...@li...> - 2005-08-18 16:51:31
|
Author: adamw Date: 2005-08-18 12:44:30 -0400 (Thu, 18 Aug 2005) New Revision: 894 Added: trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn-cli.jar trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn-javahl.jar trunk/forge/portal-extensions/mysql-connector/mysql-connector-java-3.1.10-bin.jar Removed: trunk/forge/portal-extensions/mysql-connector/mysql-connector-java-3.1.8-bin.jar Modified: trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn.jar trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/jsch.jar trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/portlet/ContentPortlet.java trunk/forge/portal-extensions/forge-forums/maven.xml trunk/forge/portal-extensions/forge-forums/project.xml trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java trunk/forge/portal-extensions/maven.xml trunk/forge/portal-extensions/mysql-connector/maven.xml Log: New tmate svn lib Added: trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn-cli.jar =================================================================== (Binary files differ) Property changes on: trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn-cli.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn-javahl.jar =================================================================== (Binary files differ) Property changes on: trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn-javahl.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/javasvn.jar =================================================================== (Binary files differ) Modified: trunk/forge/portal-extensions/binaries/maven-repo-addons/tmate/jars/jsch.jar =================================================================== (Binary files differ) Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java 2005-08-18 15:43:12 UTC (rev 893) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/content/SvnContentManager.java 2005-08-18 16:44:30 UTC (rev 894) @@ -8,16 +8,15 @@ *****************************************/ package org.jboss.forge.common.content; -import org.tmatesoft.svn.core.ISVNWorkspace; -import org.tmatesoft.svn.core.SVNWorkspaceManager; +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; -import org.tmatesoft.svn.core.internal.ws.fs.FSEntryFactory; -import org.tmatesoft.svn.core.io.SVNException; -import org.tmatesoft.svn.core.io.SVNRepository; -import org.tmatesoft.svn.core.io.SVNRepositoryFactory; -import org.tmatesoft.svn.core.io.SVNRepositoryLocation; -import org.tmatesoft.svn.core.io.SVNSimpleCredentialsProvider; +import org.tmatesoft.svn.core.wc.ISVNOptions; +import org.tmatesoft.svn.core.wc.SVNClientManager; +import org.tmatesoft.svn.core.wc.SVNRevision; +import org.tmatesoft.svn.core.wc.SVNUpdateClient; +import org.tmatesoft.svn.core.wc.SVNWCUtil; import java.io.File; import java.io.IOException; @@ -51,66 +50,58 @@ // for SVN (over svn and svn+ssh) SVNRepositoryFactoryImpl.setup(); - // Working copy storage (default is file system). - FSEntryFactory.setup(); - this.svnPath = svnPath; this.localPath = localPath; this.svnUsername = svnUsername; this.svnPassword = svnPassword; } - private ISVNWorkspace updateWorkingCopy() throws SVNException { - SVNRepositoryLocation location = SVNRepositoryLocation - .parseURL(svnPath); - SVNRepository repository = SVNRepositoryFactory.create(location); - repository.setCredentialsProvider(new SVNSimpleCredentialsProvider( - svnUsername, svnPassword)); - - File directory = new File(localPath); - ISVNWorkspace workspace = SVNWorkspaceManager.createWorkspace("file", - directory.getAbsolutePath()); - workspace.setCredentials(svnUsername, svnPassword); - - try { - /* - * Trying to read location of the repository - this is a way to - * check if the content is already checked out and we may do an - * update, or if we have to do a full checkout. - */ - workspace.getLocation(); - workspace.update(repository.getLatestRevision()); - } catch (SVNException e) { - workspace.checkout(location, ISVNWorkspace.HEAD, false); - } - - return workspace; - } - public synchronized void update() { - try { - updateWorkingCopy(); - } catch (SVNException e) { - System.out.println(e.getMessage()); - } + ISVNOptions options = SVNWCUtil.createDefaultOptions(true); + SVNClientManager ourClientManager = + SVNClientManager.newInstance(options, svnUsername, svnPassword); + + try { + SVNURL repositoryURL = SVNURL.parseURIEncoded(svnPath); + + File wcPath = new File(localPath); + + SVNUpdateClient updateClient = ourClientManager.getUpdateClient(); + updateClient.setIgnoreExternals(false); + try { + /* + * Trying to do an update - if it does not succeed, then most + * probably the wc hasn't been checked out yet. That's why + * we try to do a check out in case of an error. + */ + updateClient.doUpdate(wcPath, SVNRevision.HEAD, + true); + } catch (SVNException e) { + updateClient.doCheckout(repositoryURL, wcPath, + SVNRevision.HEAD, SVNRevision.HEAD, true); + } + } catch (SVNException e) { + e.printStackTrace(); + } } @Override public void commit(String[] names) throws IOException { + ISVNOptions options = SVNWCUtil.createDefaultOptions(true); + SVNClientManager ourClientManager = + SVNClientManager.newInstance(options, svnUsername, svnPassword); + + File[] files = new File[names.length]; + for (int i=0; i<names.length; i++) + files[i] = new File(localPath+File.separator+names[i]); + try { - SVNRepositoryLocation location = SVNRepositoryLocation.parseURL(svnPath); - SVNRepository repository = SVNRepositoryFactory.create(location); - repository.setCredentialsProvider(new SVNSimpleCredentialsProvider( - svnUsername, svnPassword)); - - File directory = new File(localPath); - ISVNWorkspace workspace = SVNWorkspaceManager.createWorkspace("file", - directory.getAbsolutePath()); - workspace.setCredentials(svnUsername, svnPassword); - workspace.commit(names, "New content", true, true); - } catch (SVNException e) { - throw new IOException(e.getMessage()); - } + ourClientManager.getCommitClient().doCommit(files, false, + "New content", true, true); + } catch (SVNException e) { + e.printStackTrace(); + throw new IOException(e.getMessage()); + } } @Override Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/portlet/ContentPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/portlet/ContentPortlet.java 2005-08-18 15:43:12 UTC (rev 893) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/portlet/ContentPortlet.java 2005-08-18 16:44:30 UTC (rev 894) @@ -15,7 +15,6 @@ import org.jboss.portlet.JBossPortlet; import org.jboss.portlet.JBossRenderRequest; import org.jboss.portlet.JBossRenderResponse; -import org.tmatesoft.svn.core.io.SVNException; import javax.portlet.*; @@ -93,7 +92,7 @@ * @throws SVNException */ abstract protected Object generateContent(JBossRenderRequest rReq, - String portalName) throws IOException, SVNException; + String portalName) throws IOException; /** * Displays the portlet's content on its output. Modified: trunk/forge/portal-extensions/forge-forums/maven.xml =================================================================== --- trunk/forge/portal-extensions/forge-forums/maven.xml 2005-08-18 15:43:12 UTC (rev 893) +++ trunk/forge/portal-extensions/forge-forums/maven.xml 2005-08-18 16:44:30 UTC (rev 894) @@ -6,9 +6,7 @@ <project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util"> <goal name="prj-install"> <ant:copy todir="${local.deploy.dir}"> - <ant:fileset dir="to-copy"> - <ant:include name="portal-forums.ear/**" /> - </ant:fileset> + <ant:fileset dir="to-copy" /> </ant:copy> </goal> Modified: trunk/forge/portal-extensions/forge-forums/project.xml =================================================================== --- trunk/forge/portal-extensions/forge-forums/project.xml 2005-08-18 15:43:12 UTC (rev 893) +++ trunk/forge/portal-extensions/forge-forums/project.xml 2005-08-18 16:44:30 UTC (rev 894) @@ -7,7 +7,7 @@ <project> <pomVersion>3</pomVersion> <id>jbossforums</id> - <name>JBoss Forumsi with forge fixes</name> + <name>JBoss Forums with forge fixes</name> <currentVersion>1.0</currentVersion> <organization> <name>Jboss team</name> Modified: trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java =================================================================== --- trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-08-18 15:43:12 UTC (rev 893) +++ trunk/forge/portal-extensions/forge-service/src/java/org/jboss/forge/service/ForgeService.java 2005-08-18 16:44:30 UTC (rev 894) @@ -93,6 +93,7 @@ // Commiting. synchronized (toCommit) { cm.commit(toCommit.toArray(new String[0])); + toCommit.clear(); } synchronized (nodeWatchers) { @@ -126,12 +127,14 @@ } public void create() throws Exception { + System.out.println("0"); } @EJB private ForgeTimerLocal timer; public void start() throws Exception { + System.out.println("1"); forgeHelper = new ForgeHelper(); // Getting a root-relative content manager. @@ -142,7 +145,7 @@ nodeWatchers = Collections.synchronizedMap( new HashMap<CacheKey, NodeWatcher>()); toCommit = new HashSet<String>(); - + System.out.println("2"); // First repo update & possible checkout. try { cm.update(); @@ -150,16 +153,17 @@ log.warn(e); e.printStackTrace(); } - + System.out.println("3"); // Adding blog updater node watcher. addNodeWatcher(null, BlogUpdaterNodeWatcher.class.getName(), new BlogUpdaterNodeWatcher()); // Setting the default timer interval. timerInterval = DEFAULT_TIMER_INTERVAL; - + System.out.println("4"); // And starting the timer. timer.scheduleTimer(DEFAULT_TIMER_INTERVAL); + System.out.println("5"); } public void stop() { Modified: trunk/forge/portal-extensions/maven.xml =================================================================== --- trunk/forge/portal-extensions/maven.xml 2005-08-18 15:43:12 UTC (rev 893) +++ trunk/forge/portal-extensions/maven.xml 2005-08-18 16:44:30 UTC (rev 894) @@ -114,7 +114,8 @@ 1. build.properties 2. forge-common/src/etc/org/jboss/forge/common/forge.properties 3. blojsom/to-copy/blojsom.war/WEB-INF/blojsom.properties -4. federation-register/src/web/WEB-INF/faces-config (only for the JOSF portal). +4. forge-login/to-copy/portal-login-ds.xml +5. federation-register/src/web/WEB-INF/faces-config (only for the JOSF portal). Available goals: - help - prints this info Modified: trunk/forge/portal-extensions/mysql-connector/maven.xml =================================================================== --- trunk/forge/portal-extensions/mysql-connector/maven.xml 2005-08-18 15:43:12 UTC (rev 893) +++ trunk/forge/portal-extensions/mysql-connector/maven.xml 2005-08-18 16:44:30 UTC (rev 894) @@ -14,7 +14,7 @@ <goal name="prj-install"> <ant:copy - file="mysql-connector-java-3.1.8-bin.jar" + file="mysql-connector-java-3.1.10-bin.jar" todir="${local.deploy.dir}/../lib" overwrite="no" /> </goal> </project> \ No newline at end of file Added: trunk/forge/portal-extensions/mysql-connector/mysql-connector-java-3.1.10-bin.jar =================================================================== (Binary files differ) Property changes on: trunk/forge/portal-extensions/mysql-connector/mysql-connector-java-3.1.10-bin.jar ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: trunk/forge/portal-extensions/mysql-connector/mysql-connector-java-3.1.8-bin.jar =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-08-18 16:51:12
|
Author: szimano Date: 2005-08-18 12:50:55 -0400 (Thu, 18 Aug 2005) New Revision: 895 Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiSession.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/TrailPlugin.java Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiContext.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: added wiki session + trail plugin Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-18 16:50:55 UTC (rev 895) @@ -9,6 +9,10 @@ <name>HTML</name> <class>org.jboss.wiki.plugins.DefaultWikiType</class> <plugin> + <name>trail</name> + <class>org.jboss.wiki.plugins.TrailPlugin</class> + </plugin> + <plugin> <name>wikiToHtmlTranslator</name> <class>org.jboss.wiki.plugins.HTMLTranslator</class> </plugin> Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/wikiPlugins.properties 2005-08-18 16:50:55 UTC (rev 895) @@ -1,3 +1,4 @@ # WikiPlugin properties. Use it wise. #specifies base URL for the portal htmlTranslatorURL = http://forge.sicore.org:8080/portal/ +# htmlTranslatorURL = http://loclahost:8080/portal/ \ No newline at end of file Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/PortletWikiSession.java 2005-08-18 16:50:55 UTC (rev 895) @@ -0,0 +1,25 @@ +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; + } + +} Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiContext.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiContext.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiContext.java 2005-08-18 16:50:55 UTC (rev 895) @@ -40,10 +40,12 @@ * <p></p> * */ + private WikiSession wikiSession; - public WikiContext(User user, WikiType requestedType) { + public WikiContext(User user, WikiType requestedType, WikiSession wikiSession) { this.user = user; this.requestedType = requestedType; + this.wikiSession = wikiSession; } public WikiType getRequestedType() { @@ -57,7 +59,7 @@ public WikiPage process(WikiPage wikiPage) { - return requestedType.process(wikiPage); + return requestedType.process(wikiPage, wikiSession); } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java 2005-08-18 16:50:55 UTC (rev 895) @@ -312,7 +312,7 @@ WikiType wt = we.getWikiType("HTML"); - WikiContext wc = new WikiContext(null, wt); + WikiContext wc = new WikiContext(null, wt, null); WikiPage wp = new WikiPage("name", new Credentials("tomek"), "[content|ble sme]", 1, 1, new Date(), we.getMediaDataSource()); Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java 2005-08-18 16:50:55 UTC (rev 895) @@ -43,7 +43,7 @@ * @return * @param content */ - public abstract WikiPage process(final WikiPage wikiPage); + public abstract WikiPage process(final WikiPage wikiPage, WikiSession wikiSession); /** * <p>Does ...</p> Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-18 16:50:55 UTC (rev 895) @@ -131,8 +131,20 @@ && (rReq.getUser() != null)) { page = "Edit.jsp"; - pageToShow = wikiEngine.getByName(wikiPage, wikiContext); - + pageToShow = wikiEngine.getByName(wikiPage, null); + + if (rReq.getParameter("version") != null) { + // show previous version of page + System.out.println("Getting page " + wikiPage + " at version " + + rReq.getParameter("version")); + pageToShow = wikiEngine.getByName(wikiPage, null, + Integer.valueOf(rReq.getParameter("version"))); + rReq.setAttribute("showedVersion", Integer.valueOf(rReq + .getParameter("version"))); + } else { + pageToShow = wikiEngine.getByName(wikiPage, null); + } + if (pageToShow == null) { // start editing new page // wikiPage = defaultPage; @@ -182,10 +194,10 @@ if ((rReq.getParameter("action") != null) && (rReq.getParameter("action").equals("Diff"))) { wikiContext = new WikiContext(rReq.getUser(), wikiEngine - .getWikiType("DIFF")); + .getWikiType("DIFF"), new PortletWikiSession(rReq.getPortletSession())); } else { wikiContext = new WikiContext(rReq.getUser(), wikiEngine - .getWikiType("HTML")); + .getWikiType("HTML"), new PortletWikiSession(rReq.getPortletSession())); } if (rReq.getParameter("version") != null) { Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiSession.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiSession.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiSession.java 2005-08-18 16:50:55 UTC (rev 895) @@ -0,0 +1,9 @@ +package org.jboss.wiki; + +public interface WikiSession { + public Object getAttribute(String attributeName); + + public void setAttribute(String attributeName, Object attribute); + + public void removeAttribute(String attributeName); +} Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java 2005-08-18 16:50:55 UTC (rev 895) @@ -123,7 +123,7 @@ * @return * @param content */ - public WikiPage process(WikiPage wikiPage) { + public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { WikiPage newPage = null; try { @@ -135,7 +135,7 @@ for (int i = 0; i < plugins.size(); i++) { System.out.println("Executing plugin: "+plugins.get(i).getName()); - newPage = (plugins.get(i)).process(newPage); + newPage = (plugins.get(i)).process(newPage, wikiSession); } return newPage; Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java 2005-08-18 16:50:55 UTC (rev 895) @@ -4,13 +4,14 @@ import org.jboss.wiki.WikiPage; import org.jboss.wiki.WikiPlugin; +import org.jboss.wiki.WikiSession; public class DiffPlugin extends WikiPlugin { private DifferenceEngine differenceEngine; @Override - public WikiPage process(WikiPage wikiPage) { + public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { WikiPage newPage = null, prevNewPage = null; Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLTranslator.java 2005-08-18 16:50:55 UTC (rev 895) @@ -25,6 +25,7 @@ import org.jboss.wiki.WikiEngine; import org.jboss.wiki.WikiPage; import org.jboss.wiki.WikiPlugin; +import org.jboss.wiki.WikiSession; public class HTMLTranslator extends WikiPlugin { @@ -767,8 +768,9 @@ public void next() {} - public WikiPage process(final WikiPage wikiPage) { + public WikiPage process(final WikiPage wikiPage, WikiSession wikiSession) { //System.out.println("propertu: "+getProperty("htmlTranslatorURL")); + WikiPage newPage = null; try { Added: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/TrailPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/TrailPlugin.java 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/TrailPlugin.java 2005-08-18 16:50:55 UTC (rev 895) @@ -0,0 +1,51 @@ +package org.jboss.wiki.plugins; + +import org.jboss.wiki.WikiPage; +import org.jboss.wiki.WikiPlugin; +import org.jboss.wiki.WikiSession; + +public class TrailPlugin extends WikiPlugin { + + @Override + public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { + WikiPage newPage = null; + try { + newPage = (WikiPage) wikiPage.clone(); + } catch (CloneNotSupportedException e) { + System.err.println(e); + } + + String trail = "["+newPage.getName()+"] "; + + if (wikiSession.getAttribute("TRAIL") != null) { + String oldTrail = (String)wikiSession.getAttribute("TRAIL"); + + if (oldTrail.endsWith(trail)) { + // do not add trail if page reloads + trail = oldTrail; + } + else { + trail = oldTrail + trail; + } + } + + wikiSession.setAttribute("TRAIL", trail); + + newPage.setPageContent("Your trail: "+trail+"\n----"+newPage.getContent()); + + return newPage; + } + + @Override + public void next() { + // TODO Auto-generated method stub + + } + + @Override + public void init() { + // TODO Auto-generated method stub + + } + +} Modified: trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-18 16:44:30 UTC (rev 894) +++ trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-08-18 16:50:55 UTC (rev 895) @@ -32,9 +32,6 @@ <hr /> -<div class="wikiTrail">Your trail: <i>TODO</i></div> - -<hr /> <% Integer showedVersion = (Integer)request.getAttribute("showedVersion"); @@ -46,7 +43,7 @@ "<td></table>\n<hr />"); } %> -<table> +<table style="width: 100%"> <tr> <td class="wikiContent"> |
Author: szimano Date: 2005-08-18 11:43:12 -0400 (Thu, 18 Aug 2005) New Revision: 893 Added: trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/ trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/ trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/Diff.java trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/DiffPrint.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DefaultWikiType.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DiffPlugin.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/DifferenceEngine.java Removed: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/plugins/HTMLWikiType.java Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiType.java trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp trunk/forge/portal-extensions/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: diff tool as plugin + pageinfo Modified: trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-17 21:58:37 UTC (rev 892) +++ trunk/forge/portal-extensions/forge-wiki/src/etc/org/jboss/wiki/WikiTypes.xml 2005-08-18 15:43:12 UTC (rev 893) @@ -7,16 +7,18 @@ <wikiTypes> <wikiType> <name>HTML</name> - <class>org.jboss.wiki.plugins.HTMLWikiType</class> + <class>org.jboss.wiki.plugins.DefaultWikiType</class> <plugin> <name>wikiToHtmlTranslator</name> <class>org.jboss.wiki.plugins.HTMLTranslator</class> </plugin> - - <!--<plugin> - <name>trail</name> - <class>org.jboss.wiki.plugins.TrailPlugin</class> - </plugin>--> - </wikiType> + <wikiType> + <name>DIFF</name> + <class>org.jboss.wiki.plugins.DefaultWikiType</class> + <plugin> + <name>Diff</name> + <class>org.jboss.wiki.plugins.DiffPlugin</class> + </plugin> + </wikiType> </wikiTypes> \ No newline at end of file Added: trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/Diff.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/Diff.java 2005-08-17 21:58:37 UTC (rev 892) +++ trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/Diff.java 2005-08-18 15:43:12 UTC (rev 893) @@ -0,0 +1,823 @@ +/************************************************** + * * + * JBoss Labs: Creating Professional Open Source * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *************************************************/ + +package bmsi.util; + +import java.util.Hashtable; + +/** A class to compare vectors of objects. The result of comparison + is a list of <code>change</code> objects which form an + edit script. The objects compared are traditionally lines + of text from two files. Comparison options such as "ignore + whitespace" are implemented by modifying the <code>equals</code> + and <code>hashcode</code> methods for the objects compared. + <p> + The basic algorithm is described in: </br> + "An O(ND) Difference Algorithm and its Variations", Eugene Myers, + Algorithmica Vol. 1 No. 2, 1986, p 251. + <p> + This class outputs different results from GNU diff 1.15 on some + inputs. Our results are actually better (smaller change list, smaller + total size of changes), but it would be nice to know why. Perhaps + there is a memory overwrite bug in GNU diff 1.15. + + @author Stuart D. Gathman, translated from GNU diff 1.15 + Copyright (C) 2000 Business Management Systems, Inc. + <p> + This program 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 1, or (at your option) + any later version. + <p> + This program 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. + <p> + You should have received a copy of the <a href=COPYING.txt> + GNU Lesser General Public License</a> + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + */ + +public class Diff { + + /** Prepare to find differences between two arrays. Each element of + the arrays is translated to an "equivalence number" based on + the result of <code>equals</code>. The original Object arrays + are no longer needed for computing the differences. They will + be needed again later to print the results of the comparison as + an edit script, if desired. + */ + public Diff(Object[] a, Object[] b) { + Hashtable h = new Hashtable(a.length + b.length); + filevec[0] = new file_data(a, h); + filevec[1] = new file_data(b, h); + } + + /** 1 more than the maximum equivalence value used for this or its + sibling file. */ + private int equiv_max = 1; + + /** When set to true, the comparison uses a heuristic to speed it up. + With this heuristic, for files with a constant small density + of changes, the algorithm is linear in the file size. */ + public boolean heuristic = false; + + /** When set to true, the algorithm returns a guarranteed minimal + set of changes. This makes things slower, sometimes much slower. */ + public boolean no_discards = false; + + private int[] xvec, yvec; /* Vectors being compared. */ + private int[] fdiag; + /* Vector, indexed by diagonal, containing + the X coordinate of the point furthest + along the given diagonal in the forward + search of the edit matrix. */ + private int[] bdiag; + /* Vector, indexed by diagonal, containing + the X coordinate of the point furthest + along the given diagonal in the backward + search of the edit matrix. */ + private int fdiagoff, bdiagoff; + private final file_data[] filevec = new file_data[2]; + private int cost; + + /** Find the midpoint of the shortest edit script for a specified + portion of the two files. + + We scan from the beginnings of the files, and simultaneously from the ends, + doing a breadth-first search through the space of edit-sequence. + When the two searches meet, we have found the midpoint of the shortest + edit sequence. + + The value returned is the number of the diagonal on which the midpoint lies. + The diagonal number equals the number of inserted lines minus the number + of deleted lines (counting only lines before the midpoint). + The edit cost is stored into COST; this is the total number of + lines inserted or deleted (counting only lines before the midpoint). + + This function assumes that the first lines of the specified portions + of the two files do not match, and likewise that the last lines do not + match. The caller must trim matching lines from the beginning and end + of the portions it is going to specify. + + Note that if we return the "wrong" diagonal value, or if + the value of bdiag at that diagonal is "wrong", + the worst this can do is cause suboptimal diff output. + It cannot cause incorrect diff output. */ + + private int diag(int xoff, int xlim, int yoff, int ylim) { + final int[] fd = fdiag; // Give the compiler a chance. + final int[] bd = bdiag; // Additional help for the compiler. + final int[] xv = xvec; // Still more help for the compiler. + final int[] yv = yvec; // And more and more . . . + final int dmin = xoff - ylim; // Minimum valid diagonal. + final int dmax = xlim - yoff; // Maximum valid diagonal. + final int fmid = xoff - yoff; // Center diagonal of top-down search. + final int bmid = xlim - ylim; // Center diagonal of bottom-up search. + int fmin = fmid, fmax = fmid; // Limits of top-down search. + int bmin = bmid, bmax = bmid; // Limits of bottom-up search. + /* True if southeast corner is on an odd + diagonal with respect to the northwest. */ + final boolean odd = (fmid - bmid & 1) != 0; + + fd[fdiagoff + fmid] = xoff; + bd[bdiagoff + bmid] = xlim; + + for (int c = 1; ; ++c) { + int d; /* Active diagonal. */ + boolean big_snake = false; + + /* Extend the top-down search by an edit step in each diagonal. */ + if (fmin > dmin) + fd[fdiagoff + --fmin - 1] = -1; + else + ++fmin; + if (fmax < dmax) + fd[fdiagoff + ++fmax + 1] = -1; + else + --fmax; + for (d = fmax; d >= fmin; d -= 2) { + int x, y, oldx, tlo = fd[fdiagoff + d - 1], thi = fd[fdiagoff + d + 1]; + + if (tlo >= thi) + x = tlo + 1; + else + x = thi; + oldx = x; + y = x - d; + while (x < xlim && y < ylim && xv[x] == yv[y]) { + ++x; + ++y; + } + if (x - oldx > 20) + big_snake = true; + fd[fdiagoff + d] = x; + if (odd && bmin <= d && d <= bmax && bd[bdiagoff + d] <= fd[fdiagoff + d]) { + cost = 2 * c - 1; + return d; + } + } + + /* Similar extend the bottom-up search. */ + if (bmin > dmin) + bd[bdiagoff + --bmin - 1] = Integer.MAX_VALUE; + else + ++bmin; + if (bmax < dmax) + bd[bdiagoff + ++bmax + 1] = Integer.MAX_VALUE; + else + --bmax; + for (d = bmax; d >= bmin; d -= 2) { + int x, y, oldx, tlo = bd[bdiagoff + d - 1], thi = bd[bdiagoff + d + 1]; + + if (tlo < thi) + x = tlo; + else + x = thi - 1; + oldx = x; + y = x - d; + while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) { + --x; + --y; + } + if (oldx - x > 20) + big_snake = true; + bd[bdiagoff + d] = x; + if (!odd && fmin <= d && d <= fmax && bd[bdiagoff + d] <= fd[fdiagoff + d]) { + cost = 2 * c; + return d; + } + } + + /* Heuristic: check occasionally for a diagonal that has made + lots of progress compared with the edit distance. + If we have any such, find the one that has made the most + progress and return it as if it had succeeded. + + With this heuristic, for files with a constant small density + of changes, the algorithm is linear in the file size. */ + + if (c > 200 && big_snake && heuristic) { + int best = 0; + int bestpos = -1; + + for (d = fmax; d >= fmin; d -= 2) { + int dd = d - fmid; + if ((fd[fdiagoff + d] - xoff) * 2 - dd > 12 * (c + (dd > 0 ? dd : -dd))) { + if (fd[fdiagoff + d] * 2 - dd > best + && fd[fdiagoff + d] - xoff > 20 + && fd[fdiagoff + d] - d - yoff > 20) { + int k; + int x = fd[fdiagoff + d]; + + /* We have a good enough best diagonal; + now insist that it end with a significant snake. */ + for (k = 1; k <= 20; k++) + if (xvec[x - k] != yvec[x - d - k]) + break; + + if (k == 21) { + best = fd[fdiagoff + d] * 2 - dd; + bestpos = d; + } + } + } + } + if (best > 0) { + cost = 2 * c - 1; + return bestpos; + } + + best = 0; + for (d = bmax; d >= bmin; d -= 2) { + int dd = d - bmid; + if ((xlim - bd[bdiagoff + d]) * 2 + dd > 12 * (c + (dd > 0 ? dd : -dd))) { + if ((xlim - bd[bdiagoff + d]) * 2 + dd > best + && xlim - bd[bdiagoff + d] > 20 + && ylim - (bd[bdiagoff + d] - d) > 20) { + /* We have a good enough best diagonal; + now insist that it end with a significant snake. */ + int k; + int x = bd[bdiagoff + d]; + + for (k = 0; k < 20; k++) + if (xvec[x + k] != yvec[x - d + k]) + break; + if (k == 20) { + best = (xlim - bd[bdiagoff + d]) * 2 + dd; + bestpos = d; + } + } + } + } + if (best > 0) { + cost = 2 * c - 1; + return bestpos; + } + } + } + } + + /** Compare in detail contiguous subsequences of the two files + which are known, as a whole, to match each other. + + The results are recorded in the vectors filevec[N].changed_flag, by + storing a 1 in the element for each line that is an insertion or deletion. + + The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1. + + Note that XLIM, YLIM are exclusive bounds. + All line numbers are origin-0 and discarded lines are not counted. */ + + private void compareseq(int xoff, int xlim, int yoff, int ylim) { + /* Slide down the bottom initial diagonal. */ + while (xoff < xlim && yoff < ylim && xvec[xoff] == yvec[yoff]) { + ++xoff; + ++yoff; + } + /* Slide up the top initial diagonal. */ + while (xlim > xoff && ylim > yoff && xvec[xlim - 1] == yvec[ylim - 1]) { + --xlim; + --ylim; + } + + /* Handle simple cases. */ + if (xoff == xlim) + while (yoff < ylim) + filevec[1].changed_flag[1 + filevec[1].realindexes[yoff++]] = true; + else if (yoff == ylim) + while (xoff < xlim) + filevec[0].changed_flag[1 + filevec[0].realindexes[xoff++]] = true; + else { + /* Find a point of correspondence in the middle of the files. */ + + int d = diag(xoff, xlim, yoff, ylim); + int c = cost; + int f = fdiag[fdiagoff + d]; + int b = bdiag[bdiagoff + d]; + + if (c == 1) { + /* This should be impossible, because it implies that + one of the two subsequences is empty, + and that case was handled above without calling `diag'. + Let's verify that this is true. */ + throw new IllegalArgumentException("Empty subsequence"); + } else { + /* Use that point to split this problem into two subproblems. */ + compareseq(xoff, b, yoff, b - d); + /* This used to use f instead of b, + but that is incorrect! + It is not necessarily the case that diagonal d + has a snake from b to f. */ + compareseq(b, xlim, b - d, ylim); + } + } + } + + /** Discard lines from one file that have no matches in the other file. + */ + + private void discard_confusing_lines() { + filevec[0].discard_confusing_lines(filevec[1]); + filevec[1].discard_confusing_lines(filevec[0]); + } + + private boolean inhibit = false; + + /** Adjust inserts/deletes of blank lines to join changes + as much as possible. + */ + + private void shift_boundaries() { + if (inhibit) + return; + filevec[0].shift_boundaries(filevec[1]); + filevec[1].shift_boundaries(filevec[0]); + } + + /** Scan the tables of which lines are inserted and deleted, + producing an edit script in reverse order. */ + + private change build_reverse_script() { + change script = null; + final boolean[] changed0 = filevec[0].changed_flag; + final boolean[] changed1 = filevec[1].changed_flag; + final int len0 = filevec[0].buffered_lines; + final int len1 = filevec[1].buffered_lines; + + /* Note that changedN[len0] does exist, and contains 0. */ + + int i0 = 0, i1 = 0; + + while (i0 < len0 || i1 < len1) { + if (changed0[1 + i0] || changed1[1 + i1]) { + int line0 = i0, line1 = i1; + + /* Find # lines changed here in each file. */ + while (changed0[1 + i0]) ++i0; + while (changed1[1 + i1]) ++i1; + + /* Record this change. */ + script = new change(line0, line1, i0 - line0, i1 - line1, script); + } + + /* We have reached lines in the two files that match each other. */ + i0++; + i1++; + } + + return script; + } + + /** Scan the tables of which lines are inserted and deleted, + producing an edit script in forward order. */ + + private change build_script() { + change script = null; + final boolean[] changed0 = filevec[0].changed_flag; + final boolean[] changed1 = filevec[1].changed_flag; + final int len0 = filevec[0].buffered_lines; + final int len1 = filevec[1].buffered_lines; + int i0 = len0, i1 = len1; + + /* Note that changedN[-1] does exist, and contains 0. */ + + while (i0 >= 0 || i1 >= 0) { + if (changed0[i0] || changed1[i1]) { + int line0 = i0, line1 = i1; + + /* Find # lines changed here in each file. */ + while (changed0[i0]) --i0; + while (changed1[i1]) --i1; + + /* Record this change. */ + script = new change(i0, i1, line0 - i0, line1 - i1, script); + } + + /* We have reached lines in the two files that match each other. */ + i0--; + i1--; + } + + return script; + } + + /* Report the differences of two files. DEPTH is the current directory + depth. */ + public change diff_2(final boolean reverse) { + + /* Some lines are obviously insertions or deletions + because they don't match anything. Detect them now, + and avoid even thinking about them in the main comparison algorithm. */ + + discard_confusing_lines(); + + /* Now do the main comparison algorithm, considering just the + undiscarded lines. */ + + xvec = filevec[0].undiscarded; + yvec = filevec[1].undiscarded; + + int diags = + filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines + 3; + fdiag = new int[diags]; + fdiagoff = filevec[1].nondiscarded_lines + 1; + bdiag = new int[diags]; + bdiagoff = filevec[1].nondiscarded_lines + 1; + + compareseq(0, filevec[0].nondiscarded_lines, + 0, filevec[1].nondiscarded_lines); + fdiag = null; + bdiag = null; + + /* Modify the results slightly to make them prettier + in cases where that can validly be done. */ + + shift_boundaries(); + + /* Get the results of comparison in the form of a chain + of `struct change's -- an edit script. */ + + if (reverse) + return build_reverse_script(); + else + return build_script(); + } + + /** The result of comparison is an "edit script": a chain of change objects. + Each change represents one place where some lines are deleted + and some are inserted. + + LINE0 and LINE1 are the first affected lines in the two files (origin 0). + DELETED is the number of lines deleted here from file 0. + INSERTED is the number of lines inserted here in file 1. + + If DELETED is 0 then LINE0 is the number of the line before + which the insertion was done; vice versa for INSERTED and LINE1. */ + + public static class change { + /** Previous or next edit command. */ + public change link; + /** # lines of file 1 changed here. */ + public final int inserted; + /** # lines of file 0 changed here. */ + public final int deleted; + /** Line number of 1st deleted line. */ + public final int line0; + /** Line number of 1st inserted line. */ + public final int line1; + + /** Cons an additional entry onto the front of an edit script OLD. + LINE0 and LINE1 are the first affected lines in the two files (origin 0). + DELETED is the number of lines deleted here from file 0. + INSERTED is the number of lines inserted here in file 1. + + If DELETED is 0 then LINE0 is the number of the line before + which the insertion was done; vice versa for INSERTED and LINE1. */ + change(int line0, int line1, int deleted, int inserted, change old) { + this.line0 = line0; + this.line1 = line1; + this.inserted = inserted; + this.deleted = deleted; + this.link = old; + //System.err.println(line0+","+line1+","+inserted+","+deleted); + } + } + + /** Data on one input file being compared. + */ + + class file_data { + + /** Allocate changed array for the results of comparison. */ + void clear() { + /* Allocate a flag for each line of each file, saying whether that line + is an insertion or deletion. + Allocate an extra element, always zero, at each end of each vector. + */ + changed_flag = new boolean[buffered_lines + 2]; + } + + /** Return equiv_count[I] as the number of lines in this file + that fall in equivalence class I. + @return the array of equivalence class counts. + */ + int[] equivCount() { + int[] equiv_count = new int[equiv_max]; + for (int i = 0; i < buffered_lines; ++i) + ++equiv_count[equivs[i]]; + return equiv_count; + } + + /** Discard lines that have no matches in another file. + + A line which is discarded will not be considered by the actual + comparison algorithm; it will be as if that line were not in the file. + The file's `realindexes' table maps virtual line numbers + (which don't count the discarded lines) into real line numbers; + this is how the actual comparison algorithm produces results + that are comprehensible when the discarded lines are counted. + <p> + When we discard a line, we also mark it as a deletion or insertion + so that it will be printed in the output. + @param f the other file + */ + void discard_confusing_lines(file_data f) { + clear(); + /* Set up table of which lines are going to be discarded. */ + final byte[] discarded = discardable(f.equivCount()); + + /* Don't really discard the provisional lines except when they occur + in a run of discardables, with nonprovisionals at the beginning + and end. */ + filterDiscards(discarded); + + /* Actually discard the lines. */ + discard(discarded); + } + + /** Mark to be discarded each line that matches no line of another file. + If a line matches many lines, mark it as provisionally discardable. + @see equivCount() + @param counts The count of each equivalence number for the other file. + @return 0=nondiscardable, 1=discardable or 2=provisionally discardable + for each line + */ + + private byte[] discardable(final int[] counts) { + final int end = buffered_lines; + final byte[] discards = new byte[end]; + final int[] equivs = this.equivs; + int many = 5; + int tem = end / 64; + + /* Multiply MANY by approximate square root of number of lines. + That is the threshold for provisionally discardable lines. */ + while ((tem = tem >> 2) > 0) + many *= 2; + + for (int i = 0; i < end; i++) { + int nmatch; + if (equivs[i] == 0) + continue; + nmatch = counts[equivs[i]]; + if (nmatch == 0) + discards[i] = 1; + else if (nmatch > many) + discards[i] = 2; + } + return discards; + } + + /** Don't really discard the provisional lines except when they occur + in a run of discardables, with nonprovisionals at the beginning + and end. */ + + private void filterDiscards(final byte[] discards) { + final int end = buffered_lines; + + for (int i = 0; i < end; i++) { + /* Cancel provisional discards not in middle of run of discards. */ + if (discards[i] == 2) + discards[i] = 0; + else if (discards[i] != 0) { + /* We have found a nonprovisional discard. */ + int j; + int length; + int provisional = 0; + + /* Find end of this run of discardable lines. + Count how many are provisionally discardable. */ + for (j = i; j < end; j++) { + if (discards[j] == 0) + break; + if (discards[j] == 2) + ++provisional; + } + + /* Cancel provisional discards at end, and shrink the run. */ + while (j > i && discards[j - 1] == 2) { + discards[--j] = 0; + --provisional; + } + + /* Now we have the length of a run of discardable lines + whose first and last are not provisional. */ + length = j - i; + + /* If 1/4 of the lines in the run are provisional, + cancel discarding of all provisional lines in the run. */ + if (provisional * 4 > length) { + while (j > i) + if (discards[--j] == 2) + discards[j] = 0; + } else { + int consec; + int minimum = 1; + int tem = length / 4; + + /* MINIMUM is approximate square root of LENGTH/4. + A subrun of two or more provisionals can stand + when LENGTH is at least 16. + A subrun of 4 or more can stand when LENGTH >= 64. */ + while ((tem = tem >> 2) > 0) + minimum *= 2; + minimum++; + + /* Cancel any subrun of MINIMUM or more provisionals + within the larger run. */ + for (j = 0, consec = 0; j < length; j++) + if (discards[i + j] != 2) + consec = 0; + else if (minimum == ++consec) + /* Back up to start of subrun, to cancel it all. */ + j -= consec; + else if (minimum < consec) + discards[i + j] = 0; + + /* Scan from beginning of run + until we find 3 or more nonprovisionals in a row + or until the first nonprovisional at least 8 lines in. + Until that point, cancel any provisionals. */ + for (j = 0, consec = 0; j < length; j++) { + if (j >= 8 && discards[i + j] == 1) + break; + if (discards[i + j] == 2) { + consec = 0; + discards[i + j] = 0; + } else if (discards[i + j] == 0) + consec = 0; + else + consec++; + if (consec == 3) + break; + } + + /* I advances to the last line of the run. */ + i += length - 1; + + /* Same thing, from end. */ + for (j = 0, consec = 0; j < length; j++) { + if (j >= 8 && discards[i - j] == 1) + break; + if (discards[i - j] == 2) { + consec = 0; + discards[i - j] = 0; + } else if (discards[i - j] == 0) + consec = 0; + else + consec++; + if (consec == 3) + break; + } + } + } + } + } + + /** Actually discard the lines. + @param discards flags lines to be discarded + */ + private void discard(final byte[] discards) { + final int end = buffered_lines; + int j = 0; + for (int i = 0; i < end; ++i) + if (no_discards || discards[i] == 0) { + undiscarded[j] = equivs[i]; + realindexes[j++] = i; + } else + changed_flag[1 + i] = true; + nondiscarded_lines = j; + } + + file_data(Object[] data, Hashtable h) { + buffered_lines = data.length; + + equivs = new int[buffered_lines]; + undiscarded = new int[buffered_lines]; + realindexes = new int[buffered_lines]; + + for (int i = 0; i < data.length; ++i) { + Integer ir = (Integer) h.get(data[i]); + if (ir == null) + h.put(data[i], new Integer(equivs[i] = equiv_max++)); + else + equivs[i] = ir.intValue(); + } + } + + /** Adjust inserts/deletes of blank lines to join changes + as much as possible. + + We do something when a run of changed lines include a blank + line at one end and have an excluded blank line at the other. + We are free to choose which blank line is included. + `compareseq' always chooses the one at the beginning, + but usually it is cleaner to consider the following blank line + to be the "change". The only exception is if the preceding blank line + would join this change to other changes. + @param f the file being compared against + */ + + void shift_boundaries(file_data f) { + final boolean[] changed = changed_flag; + final boolean[] other_changed = f.changed_flag; + int i = 0; + int j = 0; + int i_end = buffered_lines; + int preceding = -1; + int other_preceding = -1; + + for (; ;) { + int start, end, other_start; + + /* Scan forwards to find beginning of another run of changes. + Also keep track of the corresponding point in the other file. */ + + while (i < i_end && !changed[1 + i]) { + while (other_changed[1 + j++]) + /* Non-corresponding lines in the other file + will count as the preceding batch of changes. */ + other_preceding = j; + i++; + } + + if (i == i_end) + break; + + start = i; + other_start = j; + + for (; ;) { + /* Now find the end of this run of changes. */ + + while (i < i_end && changed[1 + i]) i++; + end = i; + + /* If the first changed line matches the following unchanged one, + and this run does not follow right after a previous run, + and there are no lines deleted from the other file here, + then classify the first changed line as unchanged + and the following line as changed in its place. */ + + /* You might ask, how could this run follow right after another? + Only because the previous run was shifted here. */ + + if (end != i_end + && equivs[start] == equivs[end] + && !other_changed[1 + j] + && end != i_end + && !((preceding >= 0 && start == preceding) + || (other_preceding >= 0 + && other_start == other_preceding))) { + changed[1 + end++] = true; + changed[1 + start++] = false; + ++i; + /* Since one line-that-matches is now before this run + instead of after, we must advance in the other file + to keep in synch. */ + ++j; + } else + break; + } + + preceding = i; + other_preceding = j; + } + } + + /** Number of elements (lines) in this file. */ + final int buffered_lines; + + /** Vector, indexed by line number, containing an equivalence code for + each line. It is this vector that is actually compared with that + of another file to generate differences. */ + private final int[] equivs; + + /** Vector, like the previous one except that + the elements for discarded lines have been squeezed out. */ + final int[] undiscarded; + + /** Vector mapping virtual line numbers (not counting discarded lines) + to real ones (counting those lines). Both are origin-0. */ + final int[] realindexes; + + /** Total number of nondiscarded lines. */ + int nondiscarded_lines; + + /** Array, indexed by real origin-1 line number, + containing true for a line that is an insertion or a deletion. + The results of comparison are stored here. */ + boolean[] changed_flag; + + } +} Added: trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/DiffPrint.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/DiffPrint.java 2005-08-17 21:58:37 UTC (rev 892) +++ trunk/forge/portal-extensions/forge-wiki/src/java/bmsi/util/DiffPrint.java 2005-08-18 15:43:12 UTC (rev 893) @@ -0,0 +1,322 @@ +/************************************************** + * * + * JBoss Labs: Creating Professional Open Source * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *************************************************/ + +package bmsi.util; + +import java.io.*; +import java.util.Vector; + +import bmsi.util.Diff; + +//import com.objectspace.jgl.predicates.UnaryPredicate; + +interface UnaryPredicate { + boolean execute(Object obj); +} + +/** A simple framework for printing change lists produced by <code>Diff</code>. + @see bmsi.util.Diff + @author Stuart D. Gathman + Copyright (C) 2000 Business Management Systems, Inc. + <p> + This program 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 1, or (at your option) + any later version. + <p> + This program 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. + <p> + You should have received a copy of the GNU Lesser General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +public class DiffPrint { + /** A Base class for printing edit scripts produced by Diff. + This class divides the change list into "hunks", and calls + <code>print_hunk</code> for each hunk. Various utility methods + are provided as well. + */ + public static abstract class Base { + protected Base(Object[] a, Object[] b) { + outfile = new PrintWriter(new OutputStreamWriter(System.out)); + file0 = a; + file1 = b; + } + + /** Set to ignore certain kinds of lines when printing + an edit script. For example, ignoring blank lines or comments. + */ + protected UnaryPredicate ignore = null; + + /** Set to the lines of the files being compared. + */ + protected Object[] file0, file1; + + /** Divide SCRIPT into pieces by calling HUNKFUN and + print each piece with PRINTFUN. + Both functions take one arg, an edit script. + + PRINTFUN takes a subscript which belongs together (with a null + link at the end) and prints it. */ + public void print_script(Diff.change script) { + Diff.change next = script; + + while (next != null) { + Diff.change t, end; + + /* Find a set of changes that belong together. */ + t = next; + end = hunkfun(next); + + /* Disconnect them from the rest of the changes, + making them a hunk, and remember the rest for next iteration. */ + next = end.link; + end.link = null; + //if (DEBUG) + // debug_script(t); + + /* Print this hunk. */ + print_hunk(t); + + /* Reconnect the script so it will all be freed properly. */ + end.link = next; + } + outfile.flush(); + } + + /** Called with the tail of the script + and returns the last link that belongs together with the start + of the tail. */ + + protected Diff.change hunkfun(Diff.change hunk) { + return hunk; + } + + protected int first0, last0, first1, last1, deletes, inserts; + protected PrintWriter outfile; + + /** Look at a hunk of edit script and report the range of lines in each file + that it applies to. HUNK is the start of the hunk, which is a chain + of `struct change'. The first and last line numbers of file 0 are stored + in *FIRST0 and *LAST0, and likewise for file 1 in *FIRST1 and *LAST1. + Note that these are internal line numbers that count from 0. + + If no lines from file 0 are deleted, then FIRST0 is LAST0+1. + + Also set *DELETES nonzero if any lines of file 0 are deleted + and set *INSERTS nonzero if any lines of file 1 are inserted. + If only ignorable lines are inserted or deleted, both are + set to 0. */ + + protected void analyze_hunk(Diff.change hunk) { + int f0, l0 = 0, f1, l1 = 0, show_from = 0, show_to = 0; + int i; + Diff.change next; + boolean nontrivial = (ignore == null); + + show_from = show_to = 0; + + f0 = hunk.line0; + f1 = hunk.line1; + + for (next = hunk; next != null; next = next.link) { + l0 = next.line0 + next.deleted - 1; + l1 = next.line1 + next.inserted - 1; + show_from += next.deleted; + show_to += next.inserted; + for (i = next.line0; i <= l0 && !nontrivial; i++) + if (!ignore.execute(file0[i])) + nontrivial = true; + for (i = next.line1; i <= l1 && !nontrivial; i++) + if (!ignore.execute(file1[i])) + nontrivial = true; + } + + first0 = f0; + last0 = l0; + first1 = f1; + last1 = l1; + + /* If all inserted or deleted lines are ignorable, + tell the caller to ignore this hunk. */ + + if (!nontrivial) + show_from = show_to = 0; + + deletes = show_from; + inserts = show_to; + } + + protected abstract void print_hunk(Diff.change hunk); + + protected void print_1_line(String pre, Object linbuf) { + outfile.println(pre + linbuf.toString()); + } + + /** Print a pair of line numbers with SEPCHAR, translated for file FILE. + If the two numbers are identical, print just one number. + + Args A and B are internal line numbers. + We print the translated (real) line numbers. */ + + protected void print_number_range(char sepchar, int a, int b) { + /* Note: we can have B < A in the case of a range of no lines. + In this case, we should print the line number before the range, + which is B. */ + if (++b > ++a) + outfile.print("" + a + sepchar + b); + else + outfile.print(b); + } + + public static char change_letter(int inserts, int deletes) { + if (inserts == 0) + return 'd'; + else if (deletes == 0) + return 'a'; + else + return 'c'; + } + } + + /** Print a change list in the standard diff format. + */ + public static class NormalPrint extends Base { + + public NormalPrint(Object[] a, Object[] b) { + super(a, b); + } + + /** Print a hunk of a normal diff. + This is a contiguous portion of a complete edit script, + describing changes in consecutive lines. */ + + protected void print_hunk(Diff.change hunk) { + + /* Determine range of line numbers involved in each file. */ + analyze_hunk(hunk); + if (deletes == 0 && inserts == 0) + return; + + /* Print out the line number header for this hunk */ + print_number_range(',', first0, last0); + outfile.print(change_letter(inserts, deletes)); + print_number_range(',', first1, last1); + outfile.println(); + + /* Print the lines that the first file has. */ + if (deletes != 0) + for (int i = first0; i <= last0; i++) + print_1_line("< ", file0[i]); + + if (inserts != 0 && deletes != 0) + outfile.println("---"); + + /* Print the lines that the second file has. */ + if (inserts != 0) + for (int i = first1; i <= last1; i++) + print_1_line("> ", file1[i]); + } + } + + /** Prints an edit script in a format suitable for input to <code>ed</code>. + The edit script must be generated with the reverse option to + be useful as actual <code>ed</code> input. + */ + public static class EdPrint extends Base { + + public EdPrint(Object[] a, Object[] b) { + super(a, b); + } + + /** Print a hunk of an ed diff */ + protected void print_hunk(Diff.change hunk) { + + /* Determine range of line numbers involved in each file. */ + analyze_hunk(hunk); + if (deletes == 0 && inserts == 0) + return; + + /* Print out the line number header for this hunk */ + print_number_range(',', first0, last0); + outfile.println(change_letter(inserts, deletes)); + + /* Print new/changed lines from second file, if needed */ + if (inserts != 0) { + boolean inserting = true; + for (int i = first1; i <= last1; i++) { + /* Resume the insert, if we stopped. */ + if (!inserting) + outfile.println(i - first1 + first0 + "a"); + inserting = true; + + /* If the file's line is just a dot, it would confuse `ed'. + So output it with a double dot, and set the flag LEADING_DOT + so that we will output another ed-command later + to change the double dot into a single dot. */ + + if (".".equals(file1[i])) { + outfile.println(".."); + outfile.println("."); + /* Now change that double dot to the desired single dot. */ + outfile.println(i - first1 + first0 + 1 + "s/^\\.\\././"); + inserting = false; + } else + /* Line is not `.', so output it unmodified. */ + print_1_line("", file1[i]); + } + + /* End insert mode, if we are still in it. */ + if (inserting) + outfile.println("."); + } + } + } + + /** Read a text file into an array of String. This provides basic diff + functionality. A more advanced diff utility will use specialized + objects to represent the text lines, with options to, for example, + convert sequences of whitespace to a single space for comparison + purposes. + */ + public static String[] slurp(String file) throws IOException { + BufferedReader rdr = new BufferedReader(new FileReader(file)); + Vector s = new Vector(); + for (; ;) { + String line = rdr.readLine(); + if (line == null) break; + s.addElement(line); + } + String[] a = new String[s.size()]; + s.copyInto(a); + return a; + } + + public static void main(String[] argv) throws IOException { + String[] a = slurp(argv[argv.length - 2]); + String[] b = slurp(argv[argv.length - 1]); + Diff d = new Diff(a, b); + boolean edstyle = "-e".equals(argv[0]); + Diff.change script = d.diff_2(edstyle); + if (script == null) + System.err.println("No differences"); + else { + Base p; + if (edstyle) + p = new EdPrint(a, b); + else + p = new NormalPrint(a, b); + p.print_script(script); + } + } + +} Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-17 21:58:37 UTC (rev 892) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/FileDataSource.java 2005-08-18 15:43:12 UTC (rev 893) @@ -74,7 +74,8 @@ boolean status = false; - if (pageExists(page.getName())) { // page exists on harddisk - add new version + if (pageExists(page.getName())) { // page exists on harddisk - add new + // version Properties pageProps = getPageProps(page.getName()); pageProps.setProperty(page.getLastVersion() + ".author", page @@ -109,6 +110,8 @@ pageFileWriter.write(b); } + pageFile.setLastModified(pageOldFile.lastModified()); + pageFileWriter.close(); pageOldFile.delete(); @@ -131,40 +134,44 @@ + ioe.toString()); } - } else { // there is no page on disk. We have to create new one. - + } else { // there is no page on disk. We have to create new one. + try { - - // create needed dirs - File newPageFile = new File(pathToMedia+"/OLD/"+page.getName()); + + // create needed dirs + File newPageFile = new File(pathToMedia + "/OLD/" + + page.getName()); newPageFile.mkdirs(); - - //write the page - newPageFile = new File(pathToMedia+"/OLD/"+page.getName()+"/page.properties"); - + + // write the page + newPageFile = new File(pathToMedia + "/OLD/" + page.getName() + + "/page.properties"); + FileOutputStream pageWriter = new FileOutputStream(newPageFile); - + Properties properties = new Properties(); - properties.setProperty(page.getLastVersion()+".author", page.getLastAuthor().getName()); - - properties.store(pageWriter, "Saved by FileDataSource of JBoss Wiki"); - + properties.setProperty(page.getLastVersion() + ".author", page + .getLastAuthor().getName()); + + properties.store(pageWriter, + "Saved by FileDataSource of JBoss Wiki"); + pageWriter.close(); - - pageWriter = new FileOutputStream(new File(pathToMedia+"/"+page.getName()+".txt")); - + + pageWriter = new FileOutputStream(new File(pathToMedia + "/" + + page.getName() + ".txt")); + String pageContent = page.getContent(); for (int i = 0; i < pageContent.length(); i++) { pageWriter.write((int) pageContent.charAt(i)); } - + pageWriter.close(); - + status = true; - } - catch (Exception e) { - System.err.println("Cannot write new page: "+e); + } catch (Exception e) { + System.err.println("Cannot write new page: " + e); status = false; } } @@ -236,8 +243,8 @@ System.err.println(ioe); } - page = new WikiPage(pageName, author, pageContent, i, - new Date(), this); + page = new WikiPage(pageName, author, pageContent, i, i, new Date( + pageFile.lastModified()), this); } } @@ -287,7 +294,11 @@ page.setPageContent(getContentAtVersion(pageName, version)); page.setLastAuthor(getAuthorAtVersion(pageName, version)); + + page.setVersion(version); + page.setEditDate(getDateAtVersion(pageName, version)); + } return page; } @@ -314,6 +325,17 @@ return ret; } + public Date getDateAtVersion(String pageName, int version) { + Date ret = null; + + File pageFile = new File(pathToMedia + "/OLD/" + pageName + "/" + + version + ".txt"); + + ret = new Date(pageFile.lastModified()); + + return ret; + } + public Credentials getAuthorAtVersion(String pageName, int version) { return new Credentials(getPageProps(pageName).getProperty( version + ".author")); Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java 2005-08-17 21:58:37 UTC (rev 892) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiEngine.java 2005-08-18 15:43:12 UTC (rev 893) @@ -15,6 +15,7 @@ import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; +import org.jboss.wiki.plugins.DifferenceEngine; import org.xml.sax.SAXException; /** @@ -146,9 +147,17 @@ public WikiPage getByName(String pageName, WikiContext wikiContext, int version) { WikiPage ret = null; + + if (pages.containsKey(pageName)) { + ret = pages.get(pageName); + } else { + ret = mediaDataSource.getPage(pageName); - ret = mediaDataSource.getPageAtVersion(pageName, version); - + pages.put(pageName, ret); + } + + ret = ret.getPageAtVersion(version); + if (ret != null) { if (wikiContext != null) { return wikiContext.process(ret); @@ -172,6 +181,7 @@ mediaDataSource = new FileDataSource(); pages = new HashMap<String, WikiPage>(); wikiTypes = new HashMap<String, WikiType>(); + loadWikiTypes(); } @@ -185,6 +195,8 @@ */ protected void loadWikiTypes() { try { + wikiTypes.clear(); + SAXParser sp = (SAXParserFactory.newInstance()).newSAXParser(); sp.parse( WikiTypeHandler.class.getResourceAsStream("WikiTypes.xml"), @@ -202,19 +214,6 @@ * * * @return - */ - protected void loadWikiTypePlugins() { - // your code here - // return null; - } - - /** - * <p> - * Does ... - * </p> - * - * - * @return * @param pageName * @param wikiContext */ @@ -316,7 +315,7 @@ WikiContext wc = new WikiContext(null, wt); WikiPage wp = new WikiPage("name", new Credentials("tomek"), - "[content|ble sme]", 1, new Date(), we.getMediaDataSource()); + "[content|ble sme]", 1, 1, new Date(), we.getMediaDataSource()); wp = wc.process(wp); Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java 2005-08-17 21:58:37 UTC (rev 892) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPage.java 2005-08-18 15:43:12 UTC (rev 893) @@ -72,6 +72,8 @@ * */ private int lastVersion; + + private int version; /** * <p> @@ -107,11 +109,12 @@ public WikiPage(String pageName, Credentials pageAuthor, - String pageContent, int pageVersion, Date editDate, MediaDataSource mediaDataSource) { + String pageContent, int pageLastVersion, int thisVersion, Date editDate, MediaDataSource mediaDataSource) { name = pageName; lastAuthor = pageAuthor; this.pageContent = pageContent; - lastVersion = pageVersion; + lastVersion = pageLastVersion; + version = thisVersion; this.editDate = editDate; this.mediaDataSource = mediaDataSource; } @@ -189,7 +192,12 @@ * @param version */ public WikiPage getPageAtVersion(int version) { - return mediaDataSource.getPageAtVersion(name,version); + if (version == lastVersion) { + return this; + } + else { + return mediaDataSource.getPageAtVersion(name,version); + } } /** @@ -289,7 +297,7 @@ @Override public Object clone() throws CloneNotSupportedException { WikiPage clonedPage = new WikiPage(getName(), getLastAuthor(), - getPageContent(), getLastVersion(), getEditDate(), mediaDataSource); + getPageContent(), getLastVersion(), getVersion(), getEditDate(), mediaDataSource); return clonedPage; } @@ -338,4 +346,12 @@ public String getLockUser() { return lockUser; } + + public int getVersion() { + return version; + } + + public void setVersion(int version) { + this.version = version; + } } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java 2005-08-17 21:58:37 UTC (rev 892) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPlugin.java 2005-08-18 15:43:12 UTC (rev 893) @@ -28,6 +28,8 @@ private Properties pluginProps; + private String name; + final static String propFileName = "wikiPlugins.properties"; /** * <p></p> @@ -79,6 +81,14 @@ protected String getProperty(String propertyName) { return pluginProps.getProperty(propertyName); } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } Modified: trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-17 21:58:37 UTC (rev 892) +++ trunk/forge/portal-extensions/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-08-18 15:43:12 UTC (rev 893) @@ -9,9 +9,6 @@ package org.jboss.wiki; import java.util.Date; -import java.util.HashMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.portlet.*; import org.jboss.portlet.*; @@ -47,6 +44,13 @@ rResp.setRenderParameter("action", rReq.getParameter("action")); } + if (rReq.getParameter("version") != null) { + System.out.println("[process action]Getting page " + + rReq.getParameter("page") + " at version " + + rReq.getParameter("version")); + rResp.setRenderParameter("version", rReq.getParameter("version")); + } + if (rReq.getParameter("page") != null) { rResp.setRenderParameter("page", rReq.getParameter("page")); @@ -76,7 +80,7 @@ if (edPage == null) { edPage = new WikiPage(rReq.getParameter("editedPage"), - credentials, "", 0, new Date(), wikiEngine + credentials, "", 0, 0, new Date(), wikiEngine .getMediaDataSource()); } @@ -107,8 +111,8 @@ throws PortletException, java.io.IOException { WikiPage noSuchPage = new WikiPage("", new Credentials(""), - "There is no such page. Click on EDIT to start it.", 0, null, - wikiEngine.getMediaDataSource()); + "There is no such page. Click on EDIT to start it.", 0, 0, + null, wikiEngine.getMediaDataSource()); String page = "Wiki.jsp"; @@ -134,7 +138,7 @@ // wikiPage = defaultPage; pageToShow = new WikiPage(wikiPage, new Credentials(rReq - .getUser().getUserName()), "", 0, new Date(), + .getUser().getUserName()), "", 0, 0, new Date(), wikiEngine.getMediaDataSource()); // wikiEngine.getByName(wikiPage, wikiContext); } @@ -155,11 +159,11 @@ } else if ((rReq.getParameter("action") != null) && (rReq.getParameter("action").equals("Info"))) { page = "PageInfo.jsp"; - HashMap<Integer, WikiPage> pageVersions = new HashMap<Integer, WikiPage>(); - + pageToShow = wikiEngine.getByName(wikiPage, null); - - if (pageToShow == null) { //if somebody entered a link to info non-existing page + + if (pageToShow == null) { // if somebody entered a link to info + // non-existing page page = "Wiki.jsp"; try { pageToShow = (WikiPage) noSuchPage.clone(); @@ -168,18 +172,34 @@ } pageToShow.setName(wikiPage); - } - else { + } else { rReq.setAttribute("pageAtTop", pageToShow); } - + } else { - page = "Wiki.jsp"; - wikiContext = new WikiContext(rReq.getUser(), wikiEngine - .getWikiType("HTML")); - pageToShow = wikiEngine.getByName(wikiPage, wikiContext); + if ((rReq.getParameter("action") != null) + && (rReq.getParameter("action").equals("Diff"))) { + wikiContext = new WikiContext(rReq.getUser(), wikiEngine + .getWikiT... [truncated message content] |