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
|
From: <jbo...@li...> - 2005-09-24 08:50:53
|
Author: adamw Date: 2005-09-24 04:50:39 -0400 (Sat, 24 Sep 2005) New Revision: 1193 Added: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/app/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/app/META-INF/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/app/META-INF/application.xml trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/etc/repositories.xml trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java Removed: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/etc/META-INF/ Modified: trunk/forge/portal-extensions/shotoku/maven.xml trunk/forge/portal-extensions/shotoku/project.properties trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/AbstractResource.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Directory.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/History.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java Log: Skeleton improvements Modified: trunk/forge/portal-extensions/shotoku/maven.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/maven.xml 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/maven.xml 2005-09-24 08:50:39 UTC (rev 1193) @@ -23,8 +23,9 @@ <goal name="clean"> <attainGoal name="prj-clean" /> - - <!--<j:set var="goal" value="clean" /> - <attainGoal name="multiproject:goal" />--> + <ant:delete dir="shotoku-base/target" /> + <ant:delete dir="shotoku-svn/target" /> + <ant:delete dir="shotoku-svn-service/target" /> + <ant:delete dir="${local.deploy.dir}/${shotoku.ear.dir}" /> </goal> </project> Modified: trunk/forge/portal-extensions/shotoku/project.properties =================================================================== --- trunk/forge/portal-extensions/shotoku/project.properties 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/project.properties 2005-09-24 08:50:39 UTC (rev 1193) @@ -2,4 +2,4 @@ maven.junit.fork=yes maven.war.src=${basedir}/src/web -maven.multiproject.includes=shotoku-base/project.xml,shotoku-svn/project.xml,shotoku-svn-service/project.xml \ No newline at end of file +maven.multiproject.includes=shotoku-base/project.xml,shotoku-svn/project.xml,shotoku-svn-service/project.xml Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/AbstractResource.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/AbstractResource.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/AbstractResource.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -1,10 +1,40 @@ package org.jboss.shotoku; +/** + * @author adamw + * Common parts of nodes and directories interface. + */ public interface AbstractResource { + /** + * Gets the value of a given property. + * @param propertyName Name of the property to get. + * @return Value of the given property. + */ public String getProperty(String propertyName); + /** + * Sets the value of a given property. + * @param propertyName Name of the property to set. + * @param propertyValue Value of the property to set. + */ public void setProperty(String propertyName, String propertyValue); + /** + * Gets a directory to which this node/ directory belongs. + * @return A directory to which this node/ directory belongs. Null + * if this directory is already the root directory. + */ public Directory getParent(); + /** + * Saves modified properties and possibly content (in case of nodes). + * @param logMessage Log message for saving this node/ directory. + */ public void save(String logMessage); + /** + * Gets a log message with which this node/ directory was saved. + * @return Log message with which this node/ directory was saved. + */ public String getLogMessage(); + /** + * Deletes this node or directory. + */ public void delete(); } Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -11,15 +11,37 @@ import org.w3c.dom.Document; import org.xml.sax.InputSource; +/** + * @author adamw + * A base class which provides access to nodes and directories. + */ public abstract class ContentManager { - private static final Logger log = Logger.getLogger(ContentManager.class); - + /** + * Gets a root directory that is represented by this content manager. + * @return A directory that is the root directory of this content + * manager. + */ public abstract Directory getRootDirectory(); + /** + * Gets a node which can be found under the given path. + * @param Path for which to get the node. + * @return A node corresponding to the gien path. + */ public abstract Node getNode(String path); + /** + * Gets a directory which can be found under the given path. + * @param Path for which to get the directory. + * @return A directory corresponding to the gien path. + */ public abstract Directory getDirectory(String path); + /** + * Performs a search with the given parameters. + * @param parameters Parameters for the search. + * @return A list of found nodes. + */ public abstract NodeList search(SearchParameters parameters); - public ContentManager(String id, String prefix) { + protected ContentManager(String id, String prefix) { } @@ -27,11 +49,23 @@ * Content manager loading. */ + private static final Logger log = Logger.getLogger(ContentManager.class); + + /** + * <code>defaultId</code> - id of the default content manager. May + * be overriden by a setting in the xml configuration file. + */ private static String defaultId = "default"; + /** + * <code>contentManagers</code> - map (content manager id -> + * content manager constructor). + */ private static Map<String, Constructor> contentManagers; static { + // Configuring the logger. BasicConfigurator.configure(); + contentManagers = new HashMap<String, Constructor>(); // Loading configuration file. @@ -50,10 +84,13 @@ if (n.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) { if ("default-id".equals(n.getNodeName())) { + // Overriding the default content manager id. defaultId = Tools.unmarshallText(n); log.info("Set default id to: " + defaultId); } else if ("content-manager".equals(n.getNodeName())) { + // Creating a new content manager (getting its + // constructor). String id = Tools.getAttributeValue(n, "id"); String implementation = Tools.getAttributeValue(n, "implementation"); @@ -74,10 +111,25 @@ } } + /** + * Gets a content manager with a default id and the given prefix. + * @param prefix Prefix for the new content manager (all paths will + * have this prepended). + * @return A prefixed, default content manager, or null, if a default + * content manager is not registered. + */ public static ContentManager getContentManager(String prefix) { return getContentManager(defaultId, prefix); } + /** + * Gets a content manager with the given id and prefix. + * @param id Id of the content manager. + * @param prefix Prefix for the new content manager (all paths will + * have this prepended). + * @return A prefixed content manager with the given id or null, if a + * content manager with the given id registers. + */ public static ContentManager getContentManager(String id, String prefix) { Constructor constructor = contentManagers.get(id); Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Directory.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Directory.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Directory.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -2,11 +2,51 @@ import java.util.List; +/** + * @author adamw + * Interface that must be implemented by classes which represent + * directories, that is resources, which can contain other + * directories and nodes. + */ public interface Directory extends AbstractResource { + /** + * Gets a list of nodes that are contained in this directory. + * @return A list of nodes that are contained in this directory. + */ public NodeList getNodes(); + /** + * Gets a list of directories that are contained in this directory. + * @return A list of directories that are contained in this directory. + */ public List<Directory> getDirectories(); + /** + * Creates and returns a new node in this directory. Only after saving, + * this node will be visible by other functions. + * @param name Name of the new node. + * @return A new node with the given name. + */ public Node newNode(String name); + /** + * Creates a new directory in this directory. Only after saving this + * directory, it will be visible by other functions. Also, new nodes/ + * directories in it will be possible to create only after saving. + * @param name Name of the directory to create. + * @return A new directory with the given name. + */ public Directory newDirectory(String name); + /** + * Checks if an index is created on the given property. + * @param propertyName Name of the property for which to check the + * index. + * @return True iff an index is created for the given property. + */ public boolean hasIndex(String propertyName); - public boolean setIndex(String propertyName, boolean index); + /** + * Creates or deletes an index on a property. + * @param propertyName Name of the property for which to create/ delete + * an index. + * @param index True if and index should be created, false in an index + * should be deleted. + */ + public void setIndex(String propertyName, boolean index); } Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/History.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/History.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/History.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -1,7 +1,25 @@ package org.jboss.shotoku; +/** + * @author adamw + * An interface that should be implemented by classes which represent + * a node's history. + */ public interface History { + /** + * Gets the number of revisions for this node's history. + * @return + */ public int getRevisionsCount(); + /** + * Gets a node with a given revision. + * @param revision Revision number to get. + * @return A node at the given revision. + */ public Node getNodeAtRevision(int revision); + /** + * Gets a list of all nodes in this history. + * @return A list of all nodes in this history. + */ public NodeList getAllRevisions(); } Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -2,13 +2,50 @@ import java.io.InputStream; +/** + * @author adamw + * An interface which should be implemented by classes representing a node, + * that is a resource, which is versionable and has some text content. + */ public interface Node extends AbstractResource { + /** + * Gets the content of this node. + * @return Content of this node. + */ public String getContent(); + /** + * Sets the content of this node. + * @param content New content of this node. + */ public void setContent(String content); + /** + * Gets a history of this node. + * @return A history of this node. + */ public History getHistory(); + /** + * Gets the revision number of this node. + * @return Revision number of this node. + */ public int getRevisionNumber(); - public void copyToFile(String fielname); + /** + * Copies this node's content to the given file. + * @param filename Name of the file to which to copy this node's content. + */ + public void copyToFile(String filename); + /** + * Gets the content of this node as an input stream. + * @return Content of this node as an input stream. + */ public InputStream getContentInputStream(); + /** + * Gets the length of this node's content. + * @return Length of this node's content. + */ public long getLength(); + /** + * Gets the last modification time of this node. + * @return Last modification time of this node. + */ public long getLastModfication(); } Modified: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -14,10 +14,18 @@ nodeList = new ArrayList<Node>(); } + public NodeList(List<Node> nodeList) { + this.nodeList = nodeList; + } + public void add(Node node) { nodeList.add(node); } + public List toList() { + return nodeList; + } + /* * public InputStream getFeed(Template velocityTemplate); */ Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -7,8 +7,8 @@ import org.jboss.shotoku.search.SearchParameters; public class SvnContentManager extends ContentManager { - public SvnContentManager(String arg0, String arg1) { - super(arg0, arg1); + public SvnContentManager(String id, String prefix) { + super(id, prefix); } @Override Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -27,8 +27,8 @@ return false; } - public boolean setIndex(String arg0, boolean arg1) { - return false; + public void setIndex(String arg0, boolean arg1) { + } public String getProperty(String arg0) { Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -1,24 +1,20 @@ package org.jboss.shotoku.svn; -import java.util.Map; - import javax.management.MalformedObjectNameException; import org.jboss.mx.util.MBeanProxyExt; import org.jboss.mx.util.MBeanServerLocator; public abstract class SvnService { - public abstract void update(); - public abstract void saveNode(String path, - Map<String, String> newProperties, - String newContent, boolean create); - public abstract void saveDirectory(String path, - Map<String, String> newProperties, boolean create); - public abstract String getProperty(String path, String name); - public abstract String getNodeAtRevision(String path, int revision); - public abstract String getLogMessage(String revision); - public abstract int getRevisionCount(String path); - public abstract void delete(String path); + public abstract void commit(String id, String path); + public abstract void setProperty(String id, String path, String name, + String value); + public abstract String getProperty(String id, String path, String name); + public abstract String getNodeAtRevision(String id, String path, + int revision); + public abstract String getLogMessage(String id, String revision); + public abstract int getRevisionCount(String id, String path); + public abstract void delete(String id, String path); public final static String SVN_SERVICE_NAME = "shotoku:service=svn"; Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml 2005-09-24 08:50:39 UTC (rev 1193) @@ -13,6 +13,7 @@ </goal> <goal name="deploy"> + <!-- Constructing the ear. --> <ant:copy overwrite="true" tofile="target/${shotoku.ear.dir}/shotoku-svn-service.ejb3" file="target/shotoku-svn-service-1.0.jar" /> @@ -23,9 +24,16 @@ todir="target/${shotoku.ear.dir}" overwrite="true" file="${maven.repo.local}/shotoku/jars/shotoku-base.jar" /> <ant:copy todir="target/${shotoku.ear.dir}"> - <ant:fileset dir="src/etc" flatten="true" overwrite="true"> + <ant:fileset dir="src/app" flatten="true" overwrite="true"> <ant:filename name="**" /> </ant:fileset> </ant:copy> + + <!-- Copying the ear to the deploy directory. --> + <ant:copy todir="${local.deploy.dir}"> + <ant:fileset dir="target" flatten="true" overwrite="true"> + <ant:filename name="**" /> + </ant:fileset> + </ant:copy> </goal> </project> Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml 2005-09-24 08:50:39 UTC (rev 1193) @@ -83,4 +83,14 @@ <jar>jboss-j2ee.jar</jar> </dependency> </dependencies> + + <build> + <sourceDirectory>src/java</sourceDirectory> + <resources> + <resource> + <directory>src/etc/</directory> + <include>**/*.xml</include> + </resource> + </resources> + </build> </project> Added: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/app/META-INF/application.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/app/META-INF/application.xml 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/app/META-INF/application.xml 2005-09-24 08:50:39 UTC (rev 1193) @@ -0,0 +1,6 @@ +<application> + <display-name>Shotoku service</display-name> + <module> + <ejb>shotoku-svn-service.ejb3</ejb> + </module> +</application> Added: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/etc/repositories.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/etc/repositories.xml 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/etc/repositories.xml 2005-09-24 08:50:39 UTC (rev 1193) @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="iso-8859-1"?> + +<repositories> + <repository + id="default" + url="https://cms.labs.jboss.com/trunk/forge/portal-content" + username="jbf...@jb..." + password="rO@B5oPfff" + localpath="/home/adamw/jboss/content/trunk/forge/portal-contet" /> +</repositories> \ No newline at end of file Added: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnRepository.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -0,0 +1,62 @@ +package org.jboss.shotoku.svn.service; + +import java.io.File; + +import org.tmatesoft.svn.core.SVNException; +import org.tmatesoft.svn.core.SVNURL; +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; + +public class SvnRepository { + private SVNClientManager ourClientManager; + private String url; + private String localpath; + private File wc; + + public SvnRepository(String username, String password, + String url, String localpath) { + ISVNOptions options = SVNWCUtil.createDefaultOptions(true); + ourClientManager = + SVNClientManager.newInstance(options, username, password); + + this.url = url; + this.localpath = localpath; + + wc = new File(localpath); + } + + private void tryCleanup() { + try { + ourClientManager.getWCClient().doCleanup(wc); + } catch (SVNException e) { + + } + } + + public synchronized void update() { + try { + SVNURL repositoryURL = SVNURL.parseURIEncoded(url); + + 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(wc, SVNRevision.HEAD, + true); + } catch (SVNException e) { + updateClient.doCheckout(repositoryURL, wc, + SVNRevision.HEAD, SVNRevision.HEAD, true); + } + } catch (SVNException e) { + e.printStackTrace(); + tryCleanup(); + } + } +} Modified: trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java 2005-09-23 19:59:23 UTC (rev 1192) +++ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java 2005-09-24 08:50:39 UTC (rev 1193) @@ -1,14 +1,25 @@ package org.jboss.shotoku.svn.service; +import java.util.HashMap; import java.util.Map; import javax.annotation.EJB; +import org.apache.log4j.Logger; +import org.apache.xerces.parsers.DOMParser; import org.jboss.annotation.ejb.Service; +import org.jboss.shotoku.ContentManager; +import org.jboss.shotoku.Tools; import org.jboss.shotoku.svn.SvnService; +import org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory; +import org.tmatesoft.svn.core.internal.io.svn.SVNRepositoryFactoryImpl; +import org.w3c.dom.Document; +import org.xml.sax.InputSource; @Service(objectName=SvnService.SVN_SERVICE_NAME) public class SvnServiceImpl extends SvnService { + private static final Logger log = Logger.getLogger(SvnServiceImpl.class); + /** * <code>DEFAULT_TIMER_INTERVAL</code> - default interval lenght of the * timer. @@ -19,7 +30,55 @@ @EJB private SvnServiceTimer timer; + private Map<String, SvnRepository> repositories; + + /* + * Service lifecycle methods. + */ + public void create() throws Exception { + // Set up connection protocols support: + // for DAV (over http and https) + DAVRepositoryFactory.setup(); + + // for SVN (over svn and svn+ssh) + SVNRepositoryFactoryImpl.setup(); + + repositories = new HashMap<String, SvnRepository>(); + + // Reading repositories information. + try { + DOMParser parser = new DOMParser(); + parser.parse(new InputSource( + ContentManager.class.getResourceAsStream( + "/repositories.xml"))); + Document doc = parser.getDocument(); + + org.w3c.dom.Node node = doc.getDocumentElement(); + org.w3c.dom.NodeList nodes = node.getChildNodes(); + org.w3c.dom.Node n; + + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + + if ((n.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) && + ("repository".equals(n.getNodeName()))) { + String id = Tools.getAttributeValue(n, "id"); + String url = Tools.getAttributeValue(n, "url"); + + repositories.put(id, new SvnRepository( + Tools.getAttributeValue(n, "username"), + Tools.getAttributeValue(n, "password"), + url, + Tools.getAttributeValue(n, "localpath"))); + + log.info("Added svn repository: " + id + ": " + url); + } + } + } catch (Exception e) { + log.warn("Error while loading repositories information: " + + e); + } } public void start() throws Exception { @@ -35,7 +94,10 @@ public void destroy() { } - + /* + * Timer-handling functions. + */ + public void setTimerInterval(long timerInterval) { this.timerInterval = timerInterval; } @@ -44,35 +106,46 @@ return timerInterval; } - public void update() { + void update() { } - - public void saveNode(String arg0, Map arg1, String arg2, boolean arg3) { + + /* + * SvnService implementation. + */ + + @Override + public void commit(String id, String path) { } - public void saveDirectory(String arg0, Map arg1, boolean arg2) { + @Override + public void setProperty(String id, String arg1, String arg2, String arg3) { } - public String getProperty(String arg0, String arg1) { + @Override + public String getProperty(String id, String arg0, String arg1) { return null; } - public String getNodeAtRevision(String arg0, int arg1) { + @Override + public String getNodeAtRevision(String id, String arg0, int arg1) { return null; } - public String getLogMessage(String arg0) { + @Override + public String getLogMessage(String id, String arg0) { return null; } - public int getRevisionCount(String arg0) { + @Override + public int getRevisionCount(String id, String arg0) { return 0; } - public void delete(String arg0) { + @Override + public void delete(String id, String arg0) { } } |
From: <jbo...@li...> - 2005-09-23 19:59:28
|
Author: adamw Date: 2005-09-23 15:59:23 -0400 (Fri, 23 Sep 2005) New Revision: 1192 Modified: trunk/forge/portal-extensions/project.properties Log: Shotoku build turned off Modified: trunk/forge/portal-extensions/project.properties =================================================================== --- trunk/forge/portal-extensions/project.properties 2005-09-23 19:53:07 UTC (rev 1191) +++ trunk/forge/portal-extensions/project.properties 2005-09-23 19:59:23 UTC (rev 1192) @@ -7,6 +7,8 @@ forge.ear.name=jboss-forge.ear forge.ear.dir=forge-ear +maven.multiproject.excludes=shotoku/project.xml + ## Specify these properties if you are behind a proxy server ##maven.proxy.host ##maven.proxy.port |
From: <jbo...@li...> - 2005-09-23 19:53:15
|
Author: adamw Date: 2005-09-23 15:53:07 -0400 (Fri, 23 Sep 2005) New Revision: 1191 Modified: trunk/forge/portal-extensions/shotoku/maven.xml Log: Build fix Modified: trunk/forge/portal-extensions/shotoku/maven.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/maven.xml 2005-09-23 15:12:01 UTC (rev 1190) +++ trunk/forge/portal-extensions/shotoku/maven.xml 2005-09-23 19:53:07 UTC (rev 1191) @@ -7,7 +7,6 @@ <!-- Default war-project goals --> <goal name="all"> - <attainGoal name="clean" /> <attainGoal name="build" /> <attainGoal name="deploy" /> </goal> @@ -25,7 +24,7 @@ <goal name="clean"> <attainGoal name="prj-clean" /> - <j:set var="goal" value="clean" /> - <attainGoal name="multiproject:goal" /> + <!--<j:set var="goal" value="clean" /> + <attainGoal name="multiproject:goal" />--> </goal> </project> |
From: <jbo...@li...> - 2005-09-23 15:12:07
|
Author: aron.gombas Date: 2005-09-23 11:12:01 -0400 (Fri, 23 Sep 2005) New Revision: 1190 Modified: trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml Log: More testfiles added Modified: trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml =================================================================== --- trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml 2005-09-23 15:11:34 UTC (rev 1189) +++ trunk/labs/kosmos/web-portlet/WEB-INF/portlet.xml 2005-09-23 15:12:01 UTC (rev 1190) @@ -14,11 +14,16 @@ <value>http://localhost:8080/kosmos-server/kosmos-services/cc-service</value> </init-param> <init-param> - <name>monitored.dirs</name><!-- replace these with your local paths --> + <name>monitored.dirs</name><!-- replace these with your local CruiseControl log dir paths --> <value> - /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/AIS, - /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/various, - /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/various-2 + /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/ais, + /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/cargo-m2-trunk, + /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/commons-math, + /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/jboss-3.2, + /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/log4rss, + /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/mobicents-dailytckrun, + /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/mock-apis-trunk, + /!Usr/Aron/Own/midori/projects/kosmos/testdata/cc-log/openpacs </value> </init-param> <supports> |
From: <jbo...@li...> - 2005-09-23 15:12:00
|
Author: aron.gombas Date: 2005-09-23 11:11:34 -0400 (Fri, 23 Sep 2005) New Revision: 1189 Modified: trunk/labs/kosmos/build/build.xml trunk/labs/kosmos/web-portlet/pages/includes/table_footer.jsp Log: Dateformats standardized Modified: trunk/labs/kosmos/build/build.xml =================================================================== --- trunk/labs/kosmos/build/build.xml 2005-09-23 14:11:28 UTC (rev 1188) +++ trunk/labs/kosmos/build/build.xml 2005-09-23 15:11:34 UTC (rev 1189) @@ -48,7 +48,7 @@ <echo message="Copyright 2005 (C) Midori"/> <echo message="============================================================"/> <tstamp> - <format pattern="yyyy MMM dd HH:mm:ss" property="build.date"/> + <format pattern="dd/MMM/yy HH:mm:ss" property="build.date"/> </tstamp> <path id="full.classpath"> <fileset dir="${web.dir}/WEB-INF/lib" includes="**/*.jar"/> Modified: trunk/labs/kosmos/web-portlet/pages/includes/table_footer.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/includes/table_footer.jsp 2005-09-23 14:11:28 UTC (rev 1188) +++ trunk/labs/kosmos/web-portlet/pages/includes/table_footer.jsp 2005-09-23 15:11:34 UTC (rev 1189) @@ -1,5 +1,5 @@ <tr> <td class="portlet-section-footer" colspan="5"> - <fmt:message key="lastupdate"/>: <strong><fmt:formatDate value="${timestamp}" pattern="yyyy/MM/dd hh:mm:ss"/></strong> | <a href="<portlet:renderURL portletMode="help"/>"><fmt:message key="legend.title"/></a> + <fmt:message key="lastupdate"/>: <strong><fmt:formatDate value="${timestamp}" pattern="dd/MMM/yy hh:mm:ss"/></strong> | <a href="<portlet:renderURL portletMode="help"/>"><fmt:message key="legend.title"/></a> </td> </tr> |
Author: adamw Date: 2005-09-23 10:11:28 -0400 (Fri, 23 Sep 2005) New Revision: 1188 Added: trunk/forge/portal-extensions/empty.xml trunk/forge/portal-extensions/shotoku/ trunk/forge/portal-extensions/shotoku/maven.xml trunk/forge/portal-extensions/shotoku/project.properties trunk/forge/portal-extensions/shotoku/project.xml trunk/forge/portal-extensions/shotoku/shotoku-base/ trunk/forge/portal-extensions/shotoku/shotoku-base/maven.xml trunk/forge/portal-extensions/shotoku/shotoku-base/project.properties trunk/forge/portal-extensions/shotoku/shotoku-base/project.xml trunk/forge/portal-extensions/shotoku/shotoku-base/src/ trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/ trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/shotoku.xml trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/AbstractResource.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Directory.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/History.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Tools.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/CustomPropertyValueParameter.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/DirectoryIncludeParameter.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/HistoryIncludeParameter.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/LimitParameter.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/Qualificator.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/SearchParameter.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/SearchParameters.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/SimplePropertyValueParameter.java trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/search/SortParameter.java trunk/forge/portal-extensions/shotoku/shotoku-svn-service/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/maven.xml trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.properties trunk/forge/portal-extensions/shotoku/shotoku-svn-service/project.xml trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/etc/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/etc/META-INF/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/etc/META-INF/application.xml trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/ trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnServiceImpl.java trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnServiceTimer.java trunk/forge/portal-extensions/shotoku/shotoku-svn-service/src/java/org/jboss/shotoku/svn/service/SvnServiceTimerLocal.java trunk/forge/portal-extensions/shotoku/shotoku-svn/ trunk/forge/portal-extensions/shotoku/shotoku-svn/maven.xml trunk/forge/portal-extensions/shotoku/shotoku-svn/project.properties trunk/forge/portal-extensions/shotoku/shotoku-svn/project.xml trunk/forge/portal-extensions/shotoku/shotoku-svn/src/ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/ trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/AbstractSvnResource.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnContentManager.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnDirectory.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnHistory.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnNode.java trunk/forge/portal-extensions/shotoku/shotoku-svn/src/java/org/jboss/shotoku/svn/SvnService.java Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java Log: Shotoku skeleton Added: trunk/forge/portal-extensions/empty.xml =================================================================== --- trunk/forge/portal-extensions/empty.xml 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/empty.xml 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,8 @@ +<?xml version='1.0' encoding='ISO-8859-1'?> +<project> + <pomVersion>3</pomVersion> + + <build> + <sourceDirectory>src/java</sourceDirectory> + </build> +</project> Modified: trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java =================================================================== --- trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/forge-common/src/java/org/jboss/forge/common/projects/ProjectsDescriptor.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -41,110 +41,118 @@ /** * Holds information about all projects. + * * @author adamw */ -public class ProjectsDescriptor extends AbstractDescriptor { +public class ProjectsDescriptor extends AbstractDescriptor { /** - * <code>INFO_PAGE_ATTRIBUTE</code> - name of an xml attribute in which information - * on whether a freezone info page should be displayed instead of the standard one. + * <code>INFO_PAGE_ATTRIBUTE</code> - name of an xml attribute in which + * information on whether a freezone info page should be displayed instead + * of the standard one. */ - static final String INFO_PAGE_ATTRIBUTE = "info-page"; - static final String LINK_ELEMENT = "link"; - static final String TYPE_ATTRIBUTE = "type"; - - private static final Logger log = Logger.getLogger(ProjectsDescriptor.class); - - /** - * Project id --> Corresponding project descriptor object - */ - private Map<String, ProjectDescriptor> projects; - - /** - * Permissions descriptor --> Corresponding global context - */ - private Map<String, DelegateContext> contexts; - /** - * Project id + permissions descriptor --> Corresponding project context - */ - private Map<String, DelegateContext> projectsContexts; - - private OutsidePropertiesMap opm; - - /** - * <code>projectWithErrorsDescriptors</code> - A set of paths to - * project descriptors that couldn't be added becouse they contain - * errors. - */ - private Set<String> projectWithErrorsDescriptors; + static final String INFO_PAGE_ATTRIBUTE = "info-page"; - /** - * Parses project xml descriptors and stores information about the - * projects. - * @param isf A factory of xml files. - * @param portalName Name of the portal to which projects belongs to. - */ - public ProjectsDescriptor(XmlInputFactory isf, String portalName) { - projects = new LinkedHashMap<String, ProjectDescriptor>(); - projectWithErrorsDescriptors = new HashSet<String>(); - - projectsContexts = Collections.synchronizedMap( - new LinkedHashMap<String, DelegateContext>()); - contexts = Collections.synchronizedMap( - new HashMap<String, DelegateContext>()); + static final String LINK_ELEMENT = "link"; - try { - DomToXmlTransformer xht = new DomToXmlTransformer(); - - opm = getProjectOutsidePropertiesMap(isf, xht, portalName); - - DOMParser parser = new DOMParser(); - parser.parse(isf.getInputSource(ProjectsHelper.PROJECTS_DESC)); - Document doc = parser.getDocument(); - - Node node = doc.getDocumentElement(); - - unmarshallProjects(node, isf, xht, portalName); - - fillContext(new NullPermissionsChecker()); - } catch (Exception e) { - log.warn("Projects descriptor contructor: "+e); - } - } - - private final static String PROJECT_EL = "project"; - - private final static String PROJECTS_PROP_KEY = "projects"; - private final static String PROJECTS_CTX_KEY = PROJECTS_PROP_KEY; - - /** - * Array of properties of outside properties: each element consists of - * a XML file name, element name in XML files, context name, properties - * handler. - */ - private final static Object[][] OUTSIDE_PROPERTIES = { - { ProjectsHelper.SERVICES_DESC, "service", "services", - getOPDefaultPropertiesHandler() }, - { ProjectsHelper.CATEGORIES_DESC, "category", "categories", - getOPDefaultPropertiesHandler() }, - { ProjectsHelper.JEMS_DESC, "jems", "jems", - getOPDefaultPropertiesHandler() }, - { ProjectsHelper.PAGES_DESC, "page", "pages", - getPagesPropertiesHandler() } - }; - - private static PropertiesHandler getOPDefaultPropertiesHandler() { - PropertiesHandlerStack phs = new PropertiesHandlerStack(); - phs.addHandler(new PropertiesHandlerDefault()); - - return phs; - } - - private static PropertiesHandler getLevelsPropertiesHandler(final String portalName) { - PropertiesHandlerStack phs = new PropertiesHandlerStack(); - phs.addHandler(new PropertiesHandlerDefault()); - phs.addHandler(new PropertiesHandler() { - public void fillContext(PropertiesMap properties, DelegateContext context, - PermissionsChecker pc) { + static final String TYPE_ATTRIBUTE = "type"; + + private static final Logger log = Logger + .getLogger(ProjectsDescriptor.class); + + /** + * Project id --> Corresponding project descriptor object + */ + private Map<String, ProjectDescriptor> projects; + + /** + * Permissions descriptor --> Corresponding global context + */ + private Map<String, DelegateContext> contexts; + + /** + * Project id + permissions descriptor --> Corresponding project context + */ + private Map<String, DelegateContext> projectsContexts; + + private OutsidePropertiesMap opm; + + /** + * <code>projectWithErrorsDescriptors</code> - A set of paths to project + * descriptors that couldn't be added becouse they contain errors. + */ + private Set<String> projectWithErrorsDescriptors; + + /** + * Parses project xml descriptors and stores information about the projects. + * + * @param isf + * A factory of xml files. + * @param portalName + * Name of the portal to which projects belongs to. + */ + public ProjectsDescriptor(XmlInputFactory isf, String portalName) { + projects = new LinkedHashMap<String, ProjectDescriptor>(); + projectWithErrorsDescriptors = new HashSet<String>(); + + projectsContexts = Collections + .synchronizedMap(new LinkedHashMap<String, DelegateContext>()); + contexts = Collections + .synchronizedMap(new HashMap<String, DelegateContext>()); + + try { + DomToXmlTransformer xht = new DomToXmlTransformer(); + + opm = getProjectOutsidePropertiesMap(isf, xht, portalName); + + DOMParser parser = new DOMParser(); + parser.parse(isf.getInputSource(ProjectsHelper.PROJECTS_DESC)); + Document doc = parser.getDocument(); + + Node node = doc.getDocumentElement(); + + unmarshallProjects(node, isf, xht, portalName); + + fillContext(new NullPermissionsChecker()); + } catch (Exception e) { + log.warn("Projects descriptor contructor: " + e); + } + } + + private final static String PROJECT_EL = "project"; + + private final static String PROJECTS_PROP_KEY = "projects"; + + private final static String PROJECTS_CTX_KEY = PROJECTS_PROP_KEY; + + /** + * Array of properties of outside properties: each element consists of a + * XML file name, element name in XML files, context name, properties + * handler. + */ + private final static Object[][] OUTSIDE_PROPERTIES = { + { ProjectsHelper.SERVICES_DESC, "service", "services", + getOPDefaultPropertiesHandler() }, + { ProjectsHelper.CATEGORIES_DESC, "category", "categories", + getOPDefaultPropertiesHandler() }, + { ProjectsHelper.JEMS_DESC, "jems", "jems", + getOPDefaultPropertiesHandler() }, + { ProjectsHelper.PAGES_DESC, "page", "pages", + getPagesPropertiesHandler() } }; + + private static PropertiesHandler getOPDefaultPropertiesHandler() { + PropertiesHandlerStack phs = new PropertiesHandlerStack(); + phs.addHandler(new PropertiesHandlerDefault()); + + return phs; + } + + private static PropertiesHandler getLevelsPropertiesHandler( + final String portalName) { + PropertiesHandlerStack phs = new PropertiesHandlerStack(); + phs.addHandler(new PropertiesHandlerDefault()); + phs.addHandler(new PropertiesHandler() { + public void fillContext(PropertiesMap properties, + DelegateContext context, PermissionsChecker pc) { context.put("link", ForgeHelper.createLink(portalName, properties.get(TYPE_ATTRIBUTE).getFirstValue(), properties.get(LINK_ELEMENT).getFirstValue())); @@ -154,296 +162,325 @@ if (LINK_ELEMENT.equals(node.getNodeName())) { // Adding the type attribute to the properties. PropertiesMap pm = new PropertiesMap(); - - String type = XmlTools.getAttributeValue(node, TYPE_ATTRIBUTE); - + + String type = XmlTools.getAttributeValue(node, + TYPE_ATTRIBUTE); + pm.add(TYPE_ATTRIBUTE, type == null ? "" : null); thisElement.addProperties(pm, false); } - } + } public void collect(PropertiesMap properties, Object data, PermissionsChecker pc) { } - }); - - return phs; - } - - private static PropertiesHandler getPagesPropertiesHandler() { - PropertiesHandlerStack phs = new PropertiesHandlerStack(); - phs.addHandler(new PropertiesHandlerDefault()); - phs.addHandler(new PropertiesHandler() { - public void fillContext(PropertiesMap properties, DelegateContext context, - PermissionsChecker pc) { + }); + + return phs; + } + + private static PropertiesHandler getPagesPropertiesHandler() { + PropertiesHandlerStack phs = new PropertiesHandlerStack(); + phs.addHandler(new PropertiesHandlerDefault()); + phs.addHandler(new PropertiesHandler() { + public void fillContext(PropertiesMap properties, + DelegateContext context, PermissionsChecker pc) { if (properties.get("id").getFirstValue().equals("wiki")) { context.next("useForgeWiki"); - } else context.next("normalPage"); + } else + context.next("normalPage"); } public void processNode(ElementDescriptor thisElement, Node node) { - } + } public void collect(PropertiesMap properties, Object data, PermissionsChecker pc) { } - }); - - return phs; - } - - private void addOutsideProperty(XmlInputFactory isf, DomToXmlTransformer xht, - OutsidePropertiesMap opm, Object[] data) - throws SAXException, IOException, XmlNotFoundException { - opm.addPropertySupport((String) data[1], - new ElementsDescriptor( - isf.getInputSource((String) data[0]), isf, - xht, (String) data[1], - (PropertiesHandler) data[3]), - new BindingsHandlerIterSingleKey((String) data[1], - (String) data[2], new Boolean(false)), - PROJECTS_PROP_KEY, - new BindingsHandlerIterSingleKey(PROJECTS_PROP_KEY, - PROJECTS_CTX_KEY, new Boolean(true))); - } - - private OutsidePropertiesMap getProjectOutsidePropertiesMap(XmlInputFactory isf, - DomToXmlTransformer xht, String portalName) - throws SAXException, IOException, XmlNotFoundException { - OutsidePropertiesMap opm = new OutsidePropertiesMap(); - - for (int i=0; i<OUTSIDE_PROPERTIES.length; i++) - addOutsideProperty(isf, xht, opm, OUTSIDE_PROPERTIES[i]); - - addOutsideProperty(isf, xht, opm, new Object[] { ProjectsHelper.LEVELS_DESC, - "level", "levels", getLevelsPropertiesHandler(portalName) }); - - return opm; - } - - private DelegateContext fillContext(PermissionsChecker pc) { - String permDesc = pc.getPermissionsDescriptor(); - - DelegateContext context = new DelegateContext(); - - for (Iterator iter = projects.keySet().iterator(); iter.hasNext();) { - String projectId = (String) iter.next(); - - ProjectDescriptor pd = (ProjectDescriptor) projects.get(projectId); - - /// Checking if we can read data from this project. - if (!pd.permissionAllowed(pc)) continue; - - DelegateContext projectContext = context.next(PROJECTS_CTX_KEY); - - pd.fillContext(projectContext, pc); - projectsContexts.put( - ElementsDescriptor.getContextMapKey(projectId, permDesc), - projectContext); - } - - for (int i=0; i<OUTSIDE_PROPERTIES.length; i++) { - opm.getElementsDescriptor((String) OUTSIDE_PROPERTIES[i][1]).fillContext( - context, (String) OUTSIDE_PROPERTIES[i][2], pc); - } - - contexts.put(permDesc, context); - - return context; - } - - /** - * Reads information about all projects contained in the given document root, - * and fills the projects list with that information. - */ - private void unmarshallProjects(Node root, XmlInputFactory isf, - DomToXmlTransformer xht, String portalName) { - Node n; - NodeList nodes = root.getChildNodes(); - - for (int i=0; i<nodes.getLength(); i++) { - n = nodes.item(i); - - if ((n.getNodeType() == Node.ELEMENT_NODE) && - (n.getNodeName().equals(PROJECT_EL))) { - PropertiesMap adminProperties = null; - - adminProperties = XmlTools.getPropertiesFromNodeAttributes(n); - - String projectId = XmlTools.unmarshallText(n); - ProjectDescriptor pd = null; - try { - pd = new ProjectDescriptor(projectId, - isf, xht, opm, portalName, - adminProperties); - - projects.put(projectId, pd); - } catch (Exception e) { - // In case of any exception, we just don't put the - // project into the map. We only add its descriptor - // to the set of projects with errors to monitor - // any changes in it. - projectWithErrorsDescriptors.add( - projectId + "/" + ProjectsHelper.PROJECT_DESC); - - log.warn("Project "+projectId+" parse error: "+e); - } - } - } - } - - /** - * Searches for the given string in project's names and descriptions. - * @param pc Permissions checker to use. - * @param searchFor String to search for. - * @return A context containing under the key "projects" contexts of - * found projects. - */ - public DelegateContext search(PermissionsChecker pc, String searchFor) { - boolean found = false; - DelegateContext context = new DelegateContext(); - - String[] tokens = SearchTools.prepareTokens(searchFor, "+"); - - for (Iterator iter = projects.keySet().iterator(); iter.hasNext();) { - String projectId = (String) iter.next(); - ProjectDescriptor project = (ProjectDescriptor) projects.get(projectId); - - if (!project.permissionAllowed(pc)) continue; - - if ((SearchTools.searchInString(project.getProperty("name"), tokens) || - (SearchTools.searchInString(project.getProperty("description"), - tokens)) || - (SearchTools.searchInString(project.getProperty("companyname"), - tokens)))) { - found = true; - project.fillContextShallow(context.next("projects"), pc); - } - } - - return found ? context : null; - } - - /** - * Gets a descriptor of a specified project. - * @param projectId Id of the project for which to get the descriptor. - * @return A descriptor of the given project. - */ - public ProjectDescriptor getProjectDescriptor(String projectId) { - return (ProjectDescriptor) projects.get(projectId); - } + }); - - /** - * Transforms the given permissions checker for internal use. If a user, who's - * permissions are represented by <code>pc</code>, isn't a project manager, then - * he won't be able to get customized contexts, and a <code>NullPermissionsChecker</code> - * is returned. Otherwise, <code>pc</code> is returned. - * - * @param pc Permissions checker to transform. - * @return A new null permissions checker or the given permissions checker. - */ - private PermissionsChecker transformPermissionsChecker(PermissionsChecker pc) { - if (!pc.hasPermission("project-manager")) - return new NullPermissionsChecker(); - - return pc; - } - - /** - * Gets a context holding information about all projects. - * @param pc Permissions checker to use. - * @return A context holding information about all projects. - */ - public DelegateContext getContext(PermissionsChecker pc) { - PermissionsChecker pcToUse = transformPermissionsChecker(pc); - DelegateContext context = contexts.get(pcToUse.getPermissionsDescriptor()); - - // If no context for the given permissions set is yet defined, we create a new one - // and return it. - if (context == null) { - return fillContext(pcToUse); - } - - return context; - } - - /** - * Gets a context for a project with the given id. - * @param pc Permissions checker to use. - * @param id Id of the project for which to get the context. - * @return A context holding information about a specified project. - */ - public DelegateContext getProjectContext(PermissionsChecker pc, String id) { - PermissionsChecker pcToUse = transformPermissionsChecker(pc); - String permDesc = pcToUse.getPermissionsDescriptor(); - - if (contexts.get(permDesc) == null) - fillContext(pcToUse); - - return (DelegateContext) projectsContexts.get( - ElementsDescriptor.getContextMapKey(id, permDesc)); - } - - /** - * Gets a context of an outside property of projects. - * @param pc Permissions checker to use. - * @param propertyName Name of the outside property - * @param id Id of the element for which to get the context. - * @return A context desciribing an outside property with the given id. - */ - public DelegateContext getOutsidePropertyContext(PermissionsChecker pc, - String propertyName, String id) { - return opm.getContextForElement(propertyName, id, pc); - } - - /** - * Gets the name of the project with the given id. - * @param projectId Id of the project. - * @return Name of the given project or an empty string if no such - * project exists. - */ - public String getProjectName(String projectId) { - ProjectDescriptor pd = (ProjectDescriptor) projects.get(projectId); - if (pd == null) return ""; - - return pd.getProperty("name"); - } - - /** - * Gets a link to the project witht he given id. - * @param projectId Id of the project. - * @return A link to the given project's main page. - */ - public String getProjectLink(String projectId) { - ProjectDescriptor pd = (ProjectDescriptor) projects.get(projectId); - if (pd == null) return ""; - - return pd.getProjectLink(); - } - - /** - * Gets a set of names of resources which are descriptors of projects - * represented by this ProjectsDescriptor instance. - * @return - */ - public Set<String> getAllDescriptorsNames() { - Set<String> toFill = new HashSet<String>(); - - toFill.add(ProjectsHelper.PROJECTS_DESC); - - for (int i=0; i<OUTSIDE_PROPERTIES.length; i++) - toFill.add((String) OUTSIDE_PROPERTIES[i][0]); - - for (ProjectDescriptor pd : projects.values()) - pd.getAllDescriptorsNames(toFill); - - toFill.addAll(projectWithErrorsDescriptors); - - return toFill; - } + return phs; + } + + private void addOutsideProperty(XmlInputFactory isf, + DomToXmlTransformer xht, OutsidePropertiesMap opm, Object[] data) + throws SAXException, IOException, XmlNotFoundException { + opm + .addPropertySupport((String) data[1], new ElementsDescriptor( + isf.getInputSource((String) data[0]), isf, xht, + (String) data[1], (PropertiesHandler) data[3]), + new BindingsHandlerIterSingleKey((String) data[1], + (String) data[2], new Boolean(false)), + PROJECTS_PROP_KEY, new BindingsHandlerIterSingleKey( + PROJECTS_PROP_KEY, PROJECTS_CTX_KEY, + new Boolean(true))); + } + + private OutsidePropertiesMap getProjectOutsidePropertiesMap( + XmlInputFactory isf, DomToXmlTransformer xht, String portalName) + throws SAXException, IOException, XmlNotFoundException { + OutsidePropertiesMap opm = new OutsidePropertiesMap(); + + for (int i = 0; i < OUTSIDE_PROPERTIES.length; i++) + addOutsideProperty(isf, xht, opm, OUTSIDE_PROPERTIES[i]); + + addOutsideProperty(isf, xht, opm, new Object[] { + ProjectsHelper.LEVELS_DESC, "level", "levels", + getLevelsPropertiesHandler(portalName) }); + + return opm; + } + + private DelegateContext fillContext(PermissionsChecker pc) { + String permDesc = pc.getPermissionsDescriptor(); + + DelegateContext context = new DelegateContext(); + + for (Iterator iter = projects.keySet().iterator(); iter.hasNext();) { + String projectId = (String) iter.next(); + + ProjectDescriptor pd = (ProjectDescriptor) projects.get(projectId); + + // / Checking if we can read data from this project. + if (!pd.permissionAllowed(pc)) + continue; + + DelegateContext projectContext = context.next(PROJECTS_CTX_KEY); + + pd.fillContext(projectContext, pc); + projectsContexts.put(ElementsDescriptor.getContextMapKey(projectId, + permDesc), projectContext); + } + + for (int i = 0; i < OUTSIDE_PROPERTIES.length; i++) { + opm + .getElementsDescriptor((String) OUTSIDE_PROPERTIES[i][1]) + .fillContext(context, (String) OUTSIDE_PROPERTIES[i][2], pc); + } + + contexts.put(permDesc, context); + + return context; + } + + /** + * Reads information about all projects contained in the given document + * root, and fills the projects list with that information. + */ + private void unmarshallProjects(Node root, XmlInputFactory isf, + DomToXmlTransformer xht, String portalName) { + Node n; + NodeList nodes = root.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + + if ((n.getNodeType() == Node.ELEMENT_NODE) + && (n.getNodeName().equals(PROJECT_EL))) { + PropertiesMap adminProperties = null; + + adminProperties = XmlTools.getPropertiesFromNodeAttributes(n); + + String projectId = XmlTools.unmarshallText(n); + ProjectDescriptor pd = null; + try { + pd = new ProjectDescriptor(projectId, isf, xht, opm, + portalName, adminProperties); + + projects.put(projectId, pd); + } catch (Exception e) { + // In case of any exception, we just don't put the + // project into the map. We only add its descriptor + // to the set of projects with errors to monitor + // any changes in it. + projectWithErrorsDescriptors.add(projectId + "/" + + ProjectsHelper.PROJECT_DESC); + + log.warn("Project " + projectId + " parse error: " + e); + } + } + } + } + + /** + * Searches for the given string in project's names and descriptions. + * + * @param pc + * Permissions checker to use. + * @param searchFor + * String to search for. + * @return A context containing under the key "projects" contexts of found + * projects. + */ + public DelegateContext search(PermissionsChecker pc, String searchFor) { + boolean found = false; + DelegateContext context = new DelegateContext(); + + String[] tokens = SearchTools.prepareTokens(searchFor, "+"); + + for (Iterator iter = projects.keySet().iterator(); iter.hasNext();) { + String projectId = (String) iter.next(); + ProjectDescriptor project = (ProjectDescriptor) projects + .get(projectId); + + if (!project.permissionAllowed(pc)) + continue; + + if ((SearchTools + .searchInString(project.getProperty("name"), tokens) + || (SearchTools.searchInString(project + .getProperty("description"), tokens)) || (SearchTools + .searchInString(project.getProperty("companyname"), tokens)))) { + found = true; + project.fillContextShallow(context.next("projects"), pc); + } + } + + return found ? context : null; + } + + /** + * Gets a descriptor of a specified project. + * + * @param projectId + * Id of the project for which to get the descriptor. + * @return A descriptor of the given project. + */ + public ProjectDescriptor getProjectDescriptor(String projectId) { + return (ProjectDescriptor) projects.get(projectId); + } + + /** + * Transforms the given permissions checker for internal use. If a user, + * who's permissions are represented by <code>pc</code>, isn't a project + * manager, then he won't be able to get customized contexts, and a + * <code>NullPermissionsChecker</code> is returned. Otherwise, + * <code>pc</code> is returned. + * + * @param pc + * Permissions checker to transform. + * @return A new null permissions checker or the given permissions checker. + */ + private PermissionsChecker transformPermissionsChecker(PermissionsChecker pc) { + if (!pc.hasPermission("project-manager")) + return new NullPermissionsChecker(); + + return pc; + } + + /** + * Gets a context holding information about all projects. + * + * @param pc + * Permissions checker to use. + * @return A context holding information about all projects. + */ + public DelegateContext getContext(PermissionsChecker pc) { + PermissionsChecker pcToUse = transformPermissionsChecker(pc); + DelegateContext context = contexts.get(pcToUse + .getPermissionsDescriptor()); + + // If no context for the given permissions set is yet defined, we create + // a new one + // and return it. + if (context == null) { + return fillContext(pcToUse); + } + + return context; + } + + /** + * Gets a context for a project with the given id. + * + * @param pc + * Permissions checker to use. + * @param id + * Id of the project for which to get the context. + * @return A context holding information about a specified project. + */ + public DelegateContext getProjectContext(PermissionsChecker pc, String id) { + PermissionsChecker pcToUse = transformPermissionsChecker(pc); + String permDesc = pcToUse.getPermissionsDescriptor(); + + if (contexts.get(permDesc) == null) + fillContext(pcToUse); + + return (DelegateContext) projectsContexts.get(ElementsDescriptor + .getContextMapKey(id, permDesc)); + } + + /** + * Gets a context of an outside property of projects. + * + * @param pc + * Permissions checker to use. + * @param propertyName + * Name of the outside property + * @param id + * Id of the element for which to get the context. + * @return A context desciribing an outside property with the given id. + */ + public DelegateContext getOutsidePropertyContext(PermissionsChecker pc, + String propertyName, String id) { + return opm.getContextForElement(propertyName, id, pc); + } + + /** + * Gets the name of the project with the given id. + * + * @param projectId + * Id of the project. + * @return Name of the given project or an empty string if no such project + * exists. + */ + public String getProjectName(String projectId) { + ProjectDescriptor pd = (ProjectDescriptor) projects.get(projectId); + if (pd == null) + return ""; + + return pd.getProperty("name"); + } + + /** + * Gets a link to the project witht he given id. + * + * @param projectId + * Id of the project. + * @return A link to the given project's main page. + */ + public String getProjectLink(String projectId) { + ProjectDescriptor pd = (ProjectDescriptor) projects.get(projectId); + if (pd == null) + return ""; + + return pd.getProjectLink(); + } + + /** + * Gets a set of names of resources which are descriptors of projects + * represented by this ProjectsDescriptor instance. + * + * @return + */ + public Set<String> getAllDescriptorsNames() { + Set<String> toFill = new HashSet<String>(); + + toFill.add(ProjectsHelper.PROJECTS_DESC); + + for (int i = 0; i < OUTSIDE_PROPERTIES.length; i++) + toFill.add((String) OUTSIDE_PROPERTIES[i][0]); + + toFill.add(ProjectsHelper.LEVELS_DESC); + + for (ProjectDescriptor pd : projects.values()) + pd.getAllDescriptorsNames(toFill); + + toFill.addAll(projectWithErrorsDescriptors); + + return toFill; + } } - Modified: trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java =================================================================== --- trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/forge-freezone/src/java/org/jboss/forge/projects/freezone/Freezone.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -30,23 +30,27 @@ * page is selected. */ private final static String DEFAULT_PAGE = "index.html"; - + private final static String ANCHOR_PATTERN = "<a[^<]*href[^>]*>"; + private final static String IMG_PATTERN = "<img[^<]*src[^>]*>"; - - private final static String ATTRIBUTE_PATTERN = " *= *[\"']? ?[^ \"'>]* ?[\"']?"; + + private final static String ATTRIBUTE_PATTERN = + " *= *[\"']? ?[^ \"'>]* ?[\"']?"; + private final static String HREF_PATTERN = "href" + ATTRIBUTE_PATTERN; + private final static String SRC_PATTERN = "src" + ATTRIBUTE_PATTERN; - + private ContentManager cm; - + public void init() { cm = ForgeHelper.getContentManager(""); } - + /** - * Figures out if a link shouldn't be changed: this is the case when - * either it is an off-site link, or it starts with '/'. This recognizes the most + * Figures out if a link shouldn't be changed: this is the case when either + * it is an off-site link, or it starts with '/'. This recognizes the most * common protocols by checking how it starts (clears all white space in * case the link starts with '\n' or [space]). * @@ -57,18 +61,18 @@ link = link.trim(); return link.startsWith("/") || ForgeHelper.isOutsideLink(link); } - + // modifies path to page/resource so folder structure can be supported private String modifyPath(String path, String element) { int start, end; String mainPath = ""; if (element.startsWith("#")) { return path + element; - + } else if (element.startsWith("./")) { element = element.substring(2); }// ignore ./ only clutters the code - + int pre = path.lastIndexOf('/'); if (pre == -1)// we are in root dir { @@ -76,10 +80,10 @@ } else { mainPath = path.substring(0, pre); }// main path to page - + if (element.startsWith("/")) return element.substring(1); // base path, start with WEB-root - + if (element.indexOf('/') != -1) { if (element.indexOf("../") != -1)// need to go up a few levels { @@ -94,57 +98,59 @@ end = 0; } // we have reached last level element = element.substring(0, start) - + element - .substring(start + 3, element.length()); + + element.substring(start + 3, + element.length()); mainPath = mainPath.substring(0, end); - + }// else - + }// while - + }// if ../ - + } - + return mainPath + '/' + element; } - + /** * Prepares a link for transforming - cuts off unnecessary spaces and * removes any ' or " around it. - * @param link Link to prepare. + * + * @param link + * Link to prepare. * @return A trimmed link with ' and " cut off from the beginning/end. */ private String prepareLink(String link) { link = link.trim(); - + // Cutting off the ' or " from the beginning and end of // the link. if (('\'' == link.charAt(0)) || ('\"' == link.charAt(0))) link = link.substring(1); - + int linkLength = link.length(); - if ((linkLength >= 1) && - (('\'' == link.charAt(linkLength-1)) || - ('\"' == link.charAt(linkLength-1)))) - link = link.substring(0, linkLength-1); - + if ((linkLength >= 1) + && (('\'' == link.charAt(linkLength - 1)) || ('\"' == link + .charAt(linkLength - 1)))) + link = link.substring(0, linkLength - 1); + link = link.trim(); - + return link; } - + public void doView(JBossRenderRequest request, JBossRenderResponse response) - throws IOException { + throws IOException { response.setContentType("text/html"); - + try { String portalName = ForgeHelper.getPortalName(request); - + // Getting the selected project String projectId = ProjectsHelper.getSelectedProjectId(request, true); - + // Getting the name of the requested page String pagePath = ForgeHelper.getRequestParameter(request, "page"); if (pagePath == null) @@ -152,142 +158,142 @@ else pagePath = ForgeHelper.replace(pagePath, ForgeHelper.FREEZONE_SEPARATOR, "/"); - - // If the user tried to break into other files, denying access to him. + + // If the user tried to break into other files, denying access to + // him. if (pagePath.indexOf("..") != -1) throw new Exception(); - + // Reading the file. String pageContent = cm.read(portalName + "/" + ProjectsHelper.MEMBERS_DIR + "/" + projectId + "/" + ProjectsHelper.FREEZONE_DIR + "/" + pagePath); if (pageContent == null) throw new Exception(); - - int patternFlags = - Pattern.CASE_INSENSITIVE | - Pattern.DOTALL | - Pattern.MULTILINE; - + + int patternFlags = Pattern.CASE_INSENSITIVE | Pattern.DOTALL + | Pattern.MULTILINE; + Pattern anchor = Pattern.compile(ANCHOR_PATTERN, patternFlags); Pattern href = Pattern.compile(HREF_PATTERN, patternFlags); Pattern img = Pattern.compile(IMG_PATTERN, patternFlags); Pattern src = Pattern.compile(SRC_PATTERN, patternFlags); - + // This should be prepended to all links that want to read // from file-access. String fileAccessPrepend = "/file-access/" + portalName + "/" - + ProjectsHelper.MEMBERS_DIR + "/" + projectId + "/" - + ProjectsHelper.FREEZONE_DIR + "/"; - + + ProjectsHelper.MEMBERS_DIR + "/" + projectId + "/" + + ProjectsHelper.FREEZONE_DIR + "/"; + // REPLACING ANCHORS Matcher anchorMatcher = anchor.matcher(pageContent); // Here we will build the freezone-parsed page content. StringBuffer replacedPageContent = new StringBuffer(); - + // First we iterate over all anchors. (<a ...>) while (anchorMatcher.find()) { String nextAnchor = pageContent.substring( anchorMatcher.start(), anchorMatcher.end()); - + StringBuffer nextAnchorReplacement; - + // Parsing the anchor to get the href element. Matcher hrefMatcher = href.matcher(nextAnchor); if (hrefMatcher.find()) { // Now we have the href attribute. We must get the // link from it, and if it is not an outside or / // link, then transform it to a freezone one. - String nextHref = nextAnchor.substring( - hrefMatcher.start(), hrefMatcher.end()); - + String nextHref = nextAnchor.substring(hrefMatcher.start(), + hrefMatcher.end()); + // Getting the proper link from the href. - String link = nextHref.substring(nextHref.indexOf('=')+1); - + String link = + nextHref.substring(nextHref.indexOf('=') + 1); + link = prepareLink(link); - + // Prepending necessary things to the link. if (!isOutsideLink(link)) { link = modifyPath(pagePath, link); if (link.endsWith(".css")) { link = fileAccessPrepend + link; - } else if (!((link.contains(".html")) - || (link.contains(".htm")))) { + } else if (!((link.contains(".html")) || (link + .contains(".htm")))) { // Must be an image or other media. link = fileAccessPrepend + link - + "\" target=\"_blank"; + + "\" target=\"_blank"; } else // Must be a html page. - link = ProjectsHelper - .createFreezonePageLink(portalName, projectId, - link); + link = ProjectsHelper.createFreezonePageLink( + portalName, projectId, link); } - + // Replacing the old link with a new one. nextAnchorReplacement = new StringBuffer(); - hrefMatcher.appendReplacement(nextAnchorReplacement, + hrefMatcher.appendReplacement(nextAnchorReplacement, "href=\"" + link + "\""); hrefMatcher.appendTail(nextAnchorReplacement); } else { nextAnchorReplacement = new StringBuffer(nextAnchor); } - - anchorMatcher.appendReplacement(replacedPageContent, + + anchorMatcher.appendReplacement(replacedPageContent, nextAnchorReplacement.toString()); } - + anchorMatcher.appendTail(replacedPageContent); - + // REPLACING IMAGES pageContent = replacedPageContent.toString(); Matcher imgMatcher = img.matcher(pageContent); - + replacedPageContent = new StringBuffer(); - + // Iterating over all image references (<img ...>). while (imgMatcher.find()) { - String nextImg = pageContent.substring( - imgMatcher.start(), imgMatcher.end()); - + String nextImg = pageContent.substring(imgMatcher.start(), + imgMatcher.end()); + StringBuffer nextImgReplacement; - + // Parsing the image to get the src element. Matcher srcMatcher = src.matcher(nextImg); if (srcMatcher.find()) { - String nextSrc = nextImg.substring( - srcMatcher.start(), srcMatcher.end()); - + String nextSrc = nextImg.substring(srcMatcher.start(), + srcMatcher.end()); + // Getting the proper link from the src. - String link = nextSrc.substring(nextSrc.indexOf('=')+1); - + String link = nextSrc.substring(nextSrc.indexOf('=') + 1); + link = prepareLink(link); - + // Modifying the link. if (!isOutsideLink(link)) { link = modifyPath(pagePath, link); link = fileAccessPrepend + link; } - + // Replacing the old link with a new one. nextImgReplacement = new StringBuffer(); - srcMatcher.appendReplacement(nextImgReplacement, - "src=\"" + link + "\""); + srcMatcher.appendReplacement(nextImgReplacement, "src=\"" + + link + "\""); srcMatcher.appendTail(nextImgReplacement); } else { nextImgReplacement = new StringBuffer(nextImg); } - - imgMatcher.appendReplacement(replacedPageContent, + + imgMatcher.appendReplacement(replacedPageContent, nextImgReplacement.toString()); } - + imgMatcher.appendTail(replacedPageContent); - + response.getWriter().write(replacedPageContent.toString()); } catch (Exception e) { e.printStackTrace(); - response.getWriter().write("The page you requested cannot be accessed"); + response.getWriter().write( + "The page you requested cannot be accessed"); } } } Added: trunk/forge/portal-extensions/shotoku/maven.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/maven.xml 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/maven.xml 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,31 @@ +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util"> + <!-- Default war-project goals --> + + <goal name="all"> + <attainGoal name="clean" /> + <attainGoal name="build" /> + <attainGoal name="deploy" /> + </goal> + + <goal name="build"> + <j:set var="goal" value="build" /> + <attainGoal name="multiproject:goal" /> + </goal> + + <goal name="deploy"> + <j:set var="goal" value="deploy" /> + <attainGoal name="multiproject:goal" /> + </goal> + + <goal name="clean"> + <attainGoal name="prj-clean" /> + + <j:set var="goal" value="clean" /> + <attainGoal name="multiproject:goal" /> + </goal> +</project> Added: trunk/forge/portal-extensions/shotoku/project.properties =================================================================== --- trunk/forge/portal-extensions/shotoku/project.properties 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/project.properties 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,5 @@ +maven.repo.remote=http://repository.atlassian.com,http://www.ibiblio.org/maven,http://dist.codehaus.org/ +maven.junit.fork=yes +maven.war.src=${basedir}/src/web + +maven.multiproject.includes=shotoku-base/project.xml,shotoku-svn/project.xml,shotoku-svn-service/project.xml \ No newline at end of file Added: trunk/forge/portal-extensions/shotoku/project.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/project.xml 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/project.xml 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,44 @@ +<?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>../empty.xml</extend> + <id>shotoku</id> + <name>Shotoku</name> + <currentVersion>1.0</currentVersion> + <organization> + <name>Adam Warski</name> + <url>http://mamut.net.pl</url> + </organization> + <description></description> + + <dependencies> + <dependency> + <groupId>xerces</groupId> + <artifactId>xercesImpl</artifactId> + <version>2.6.2</version> + </dependency> + + <dependency> + <groupId>xerces</groupId> + <artifactId>xmlParserAPIs</artifactId> + <version>2.6.2</version> + </dependency> + + <dependency> + <groupId>xalan</groupId> + <artifactId>xalan</artifactId> + <version>2.6.0</version> + </dependency> + + <dependency> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.9</version> + </dependency> + </dependencies> +</project> Property changes on: trunk/forge/portal-extensions/shotoku/shotoku-base ___________________________________________________________________ Name: svn:ignore + target .project .settings .classpath Added: trunk/forge/portal-extensions/shotoku/shotoku-base/maven.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/maven.xml 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/maven.xml 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,23 @@ +<!-- + JBoss, the OpenSource J2EE webOS + Distributable under LGPL license. + See terms of license at gnu.org. + --> +<project xmlns:j="jelly:core" xmlns:ant="jelly:ant" xmlns:u="jelly:util"> + <goal name="clean"> + <attainGoal name="prj-clean" /> + </goal> + + <goal name="build"> + <attainGoal name="jar" /> + + <ant:copy + file="target/shotoku-base-1.0.jar" + tofile="${maven.repo.local}/shotoku/jars/shotoku-base.jar" + flatten="true" + overwrite="true" /> + </goal> + + <goal name="deploy"> + </goal> +</project> Added: trunk/forge/portal-extensions/shotoku/shotoku-base/project.properties =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/project.properties 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/project.properties 2005-09-23 14:11:28 UTC (rev 1188) @@ -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/shotoku/shotoku-base/project.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/project.xml 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/project.xml 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,31 @@ +<?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>../project.xml</extend> + <id>shotoku-base</id> + <name>Shotoku base</name> + <currentVersion>1.0</currentVersion> + <organization> + <name>Adam Warski</name> + <url>http://mamut.net.pl</url> + </organization> + <description></description> + + <dependencies> + </dependencies> + + <build> + <sourceDirectory>src/java</sourceDirectory> + <resources> + <resource> + <directory>src/etc/</directory> + <include>**/*.xml</include> + </resource> + </resources> + </build> +</project> Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/shotoku.xml =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/shotoku.xml 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/etc/shotoku.xml 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="iso-8859-1"?> + +<content-managers> + <default-id id="default" /> + <content-manager + id="default" + implementation="SvnContentManager" /> +</content-managers> \ No newline at end of file Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/AbstractResource.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/AbstractResource.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/AbstractResource.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,10 @@ +package org.jboss.shotoku; + +public interface AbstractResource { + public String getProperty(String propertyName); + public void setProperty(String propertyName, String propertyValue); + public Directory getParent(); + public void save(String logMessage); + public String getLogMessage(); + public void delete(); +} Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/ContentManager.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,94 @@ +package org.jboss.shotoku; + +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.Map; + +import org.apache.log4j.BasicConfigurator; +import org.apache.log4j.Logger; +import org.apache.xerces.parsers.DOMParser; +import org.jboss.shotoku.search.SearchParameters; +import org.w3c.dom.Document; +import org.xml.sax.InputSource; + +public abstract class ContentManager { + private static final Logger log = Logger.getLogger(ContentManager.class); + + public abstract Directory getRootDirectory(); + public abstract Node getNode(String path); + public abstract Directory getDirectory(String path); + public abstract NodeList search(SearchParameters parameters); + + public ContentManager(String id, String prefix) { + + } + + /* + * Content manager loading. + */ + + private static String defaultId = "default"; + private static Map<String, Constructor> contentManagers; + + static { + BasicConfigurator.configure(); + contentManagers = new HashMap<String, Constructor>(); + + // Loading configuration file. + try { + DOMParser parser = new DOMParser(); + parser.parse(new InputSource( + ContentManager.class.getResourceAsStream("/shotoku.xml"))); + Document doc = parser.getDocument(); + + org.w3c.dom.Node node = doc.getDocumentElement(); + org.w3c.dom.NodeList nodes = node.getChildNodes(); + org.w3c.dom.Node n; + + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + + if (n.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) { + if ("default-id".equals(n.getNodeName())) { + defaultId = Tools.unmarshallText(n); + + log.info("Set default id to: " + defaultId); + } else if ("content-manager".equals(n.getNodeName())) { + String id = Tools.getAttributeValue(n, "id"); + String implementation = + Tools.getAttributeValue(n, "implementation"); + + contentManagers.put(id, + Class.forName(implementation).getConstructor( + new Class[] { String.class, + String.class })); + + log.info("Added content manager: " + id + ", " + + implementation); + } + } + } + } catch (Exception e) { + log.warn("Error while loading content manager configuration: " + + e); + } + } + + public static ContentManager getContentManager(String prefix) { + return getContentManager(defaultId, prefix); + } + + public static ContentManager getContentManager(String id, String prefix) { + Constructor constructor = contentManagers.get(id); + + if (constructor == null) + return null; + + try { + return (ContentManager) + constructor.newInstance(new Object[] { id, prefix }); + } catch (Exception e) { + return null; + } + } +} Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Directory.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Directory.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Directory.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,12 @@ +package org.jboss.shotoku; + +import java.util.List; + +public interface Directory extends AbstractResource { + public NodeList getNodes(); + public List<Directory> getDirectories(); + public Node newNode(String name); + public Directory newDirectory(String name); + public boolean hasIndex(String propertyName); + public boolean setIndex(String propertyName, boolean index); +} Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/History.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/History.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/History.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,7 @@ +package org.jboss.shotoku; + +public interface History { + public int getRevisionsCount(); + public Node getNodeAtRevision(int revision); + public NodeList getAllRevisions(); +} Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Node.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,14 @@ +package org.jboss.shotoku; + +import java.io.InputStream; + +public interface Node extends AbstractResource { + public String getContent(); + public void setContent(String content); + public History getHistory(); + public int getRevisionNumber(); + public void copyToFile(String fielname); + public InputStream getContentInputStream(); + public long getLength(); + public long getLastModfication(); +} Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/NodeList.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,24 @@ +package org.jboss.shotoku; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author adamw + * TODO + */ +public class NodeList { + private List<Node> nodeList; + + public NodeList() { + nodeList = new ArrayList<Node>(); + } + + public void add(Node node) { + nodeList.add(node); + } + + /* + * public InputStream getFeed(Template velocityTemplate); + */ +} Added: trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Tools.java =================================================================== --- trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Tools.java 2005-09-23 12:51:45 UTC (rev 1187) +++ trunk/forge/portal-extensions/shotoku/shotoku-base/src/java/org/jboss/shotoku/Tools.java 2005-09-23 14:11:28 UTC (rev 1188) @@ -0,0 +1,41 @@ +package org.jboss.shotoku; + +public class Tools { + /** + * Reads text contained in a tag of the form <tag>text</tag>. + * @param textNode Node to read text from. + * @return Text contained in the given node. + */ + public static String unmarshallText(org.w3c.dom.Node textNode) { + StringBuffer buf = new StringBuffer(); + + org.w3c.dom.Node n; + org.w3c.dom.NodeList nodes = textNode.getChildNodes(); + + for (int i = 0; i < nodes.getLength(); i++) { + n = nodes.item(i); + + if (n.getNodeType() == org.w3c.dom.Node.TEXT_NODE) { + buf.append(n.getNodeValue()); + } + } + + return buf.toString(); + } + + /** + * From the given node, gets the value of the specified attribute. + * @param root Node to read the attribute from. + * @param attrName Name of the attribute to read. + * @return Value of the given attribute or null, if no such attribute + * is present. + */ + public static String getAttributeValue(org.w3c.dom.Node root, + St... [truncated message content] |
From: <jbo...@li...> - 2005-09-23 12:52:10
|
Author: mla...@jb... Date: 2005-09-23 08:51:45 -0400 (Fri, 23 Sep 2005) New Revision: 1187 Added: trunk/labs/jbossweb/xdocs/images/design/procdiag.png trunk/labs/jbossweb/xdocs/sources/procdiag.vsd Modified: trunk/labs/jbossweb/xdocs/reference/arch.xml Log: Add process block diagram Added: trunk/labs/jbossweb/xdocs/images/design/procdiag.png =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/design/procdiag.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/labs/jbossweb/xdocs/reference/arch.xml =================================================================== --- trunk/labs/jbossweb/xdocs/reference/arch.xml 2005-09-23 10:20:02 UTC (rev 1186) +++ trunk/labs/jbossweb/xdocs/reference/arch.xml 2005-09-23 12:51:45 UTC (rev 1187) @@ -127,6 +127,11 @@ NativeProxy has integrated advanced application load balancer that offers both high availability and application segmantation for remotely based subsystems. </p> + <figure src="/images/design/procdiag.png" name="Figure 3" text="Native Proxy"/> + <p>Out of process mosules are accessed using Native proxy. Each of the module + is run as a daemon either on the local or remote machine. This gives much higer + security and stabilty in case of faulty modules. + </p> </subsection> <subsection name="Proxy Stream"> <p>Proxy stream is a protocol very much similar to the Tomcat AJP/1.3 protocol, Added: trunk/labs/jbossweb/xdocs/sources/procdiag.vsd =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/sources/procdiag.vsd ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
From: <jbo...@li...> - 2005-09-23 10:20:40
|
Author: mla...@jb... Date: 2005-09-23 06:20:02 -0400 (Fri, 23 Sep 2005) New Revision: 1186 Added: trunk/labs/jbossweb/xdocs/images/downs.gif trunk/labs/jbossweb/xdocs/images/downsl.gif trunk/labs/jbossweb/xdocs/images/excl.gif trunk/labs/jbossweb/xdocs/images/lock.gif trunk/labs/jbossweb/xdocs/images/ok.gif trunk/labs/jbossweb/xdocs/images/rank0.gif trunk/labs/jbossweb/xdocs/images/rank1.gif trunk/labs/jbossweb/xdocs/images/rank2.gif trunk/labs/jbossweb/xdocs/images/rank3.gif trunk/labs/jbossweb/xdocs/images/rank4.gif trunk/labs/jbossweb/xdocs/images/rank5.gif trunk/labs/jbossweb/xdocs/images/rank6.gif trunk/labs/jbossweb/xdocs/images/ups.gif trunk/labs/jbossweb/xdocs/images/x.gif Modified: trunk/labs/jbossweb/xdocs/news/roadmap.xml trunk/labs/jbossweb/xdocs/style.css trunk/labs/jbossweb/xdocs/style.xsl Log: Add images and style for status section and roadmap Added: trunk/labs/jbossweb/xdocs/images/downs.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/downs.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/downsl.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/downsl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/excl.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/excl.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/lock.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/lock.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/ok.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/ok.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/rank0.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/rank0.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/rank1.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/rank1.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/rank2.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/rank2.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/rank3.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/rank3.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/rank4.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/rank4.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/rank5.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/rank5.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/rank6.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/rank6.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/ups.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/ups.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/x.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/x.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/labs/jbossweb/xdocs/news/roadmap.xml =================================================================== --- trunk/labs/jbossweb/xdocs/news/roadmap.xml 2005-09-23 06:58:20 UTC (rev 1185) +++ trunk/labs/jbossweb/xdocs/news/roadmap.xml 2005-09-23 10:20:02 UTC (rev 1186) @@ -13,10 +13,37 @@ <body> -<section name="Introduction"> -<br /> +<section name="Status"> +<p> This document details the current high level plans for the JBossWeb project as a whole. More information can be found in JIRA under the JBWEB project. +</p> +<br /> +<status> + <item priority="done" estimate="Sep 2005" progress="6" owner="mturk"> + Crete SVN Repository inside labs.jboss.com + </item> + <item priority="done" estimate="Sep 2005" progress="6" owner="mturk"> + Build documentation build system using simple xdocs templates. + </item> + <item priority="block" estimate="Sep 2005" progress="5" owner="mturk"> + Create Native build scripts and integrate them with ant build system + </item> + <item priority="block" estimate="Sep 2005" progress="1" owner="mturk"> + CGI module + </item> + <item priority="hi" estimate="Oct 2005" progress="0" owner="mturk"> + PHP Module + </item> + <item priority="hi" estimate="Oct 2005" progress="0" owner="mturk"> + .NET Module + </item> + <item priority="hi" estimate="Q4 2005" progress="0" owner="remm"> + Build URL Rewrite module. + </item> +</status> + </section> + </body> </document> Modified: trunk/labs/jbossweb/xdocs/style.css =================================================================== --- trunk/labs/jbossweb/xdocs/style.css 2005-09-23 06:58:20 UTC (rev 1185) +++ trunk/labs/jbossweb/xdocs/style.css 2005-09-23 10:20:02 UTC (rev 1186) @@ -189,6 +189,13 @@ font-size: 1em; } +th.attribute { + background-color: #e5ecf3; + color: #405871; + font-weight: bold; + font-size: 1em; +} + table.screen { background-color: #000000; border: 1px solid; Modified: trunk/labs/jbossweb/xdocs/style.xsl =================================================================== --- trunk/labs/jbossweb/xdocs/style.xsl 2005-09-23 06:58:20 UTC (rev 1185) +++ trunk/labs/jbossweb/xdocs/style.xsl 2005-09-23 10:20:02 UTC (rev 1186) @@ -442,23 +442,93 @@ <!-- Process an attributes list with nested attribute elements --> <xsl:template match="status"> - <table border="1" cellpadding="5"> + <table border="1" cellpadding="5" width="100%"> <tr> - <th width="15%" class="attribute"> + <th class="attribute"> Priority </th> - <th width="50%" class="attribute"> + <th class="attribute"> + Progress + </th> + <th class="attribute"> + Estimated + </th> + <th width="75%" class="attribute"> Action Item </th> - <th width="25%" class="attribute"> + <th width="75%" class="attribute"> Volunteers </th> <xsl:for-each select="item"> <tr> <td align="left" valign="center"> - <xsl:value-of select="@priority"/> + <xsl:choose> + <xsl:when test="@priority = 'hi'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/ups.gif</xsl:variable> + <img alt="High" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@priority = 'low'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/downs.gif</xsl:variable> + <img alt="Low" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@priority = 'done'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/ok.gif</xsl:variable> + <img alt="Done" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@priority = 'del'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/x.gif</xsl:variable> + <img alt="Removed" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@priority = 'lock'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/lock.gif</xsl:variable> + <img alt="Locked" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@priority = 'block'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/excl.gif</xsl:variable> + <img alt="Blocker" class="icon" src="{$src}"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="@priority"/> + </xsl:otherwise> + </xsl:choose> </td> <td align="left" valign="center"> + <xsl:choose> + <xsl:when test="@progress = '1'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/rank1.gif</xsl:variable> + <img alt="10%" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@progress = '2'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/rank2.gif</xsl:variable> + <img alt="20%" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@progress = '3'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/rank3.gif</xsl:variable> + <img alt="30%" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@progress = '4'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/rank4.gif</xsl:variable> + <img alt="55%" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@progress = '5'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/rank5.gif</xsl:variable> + <img alt="75%" class="icon" src="{$src}"/> + </xsl:when> + <xsl:when test="@progress = '6'"> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/rank6.gif</xsl:variable> + <img alt="100%" class="icon" src="{$src}"/> + </xsl:when> + <xsl:otherwise> + <xsl:variable name="src"><xsl:value-of select="$relative-path"/>/images/rank0.gif</xsl:variable> + <img alt="0%" class="icon" src="{$src}"/> + </xsl:otherwise> + </xsl:choose> + </td> + + <td align="left" valign="center"> + <xsl:value-of select="@estimate"/> + </td> + <td align="left" valign="center"> <xsl:apply-templates/> </td> <td align="left" valign="center"> |
From: <jbo...@li...> - 2005-09-23 06:58:28
|
Author: aron.gombas Date: 2005-09-23 02:58:20 -0400 (Fri, 23 Sep 2005) New Revision: 1185 Modified: trunk/labs/kosmos/build/kosmos-project.properties Log: Verno inced Modified: trunk/labs/kosmos/build/kosmos-project.properties =================================================================== --- trunk/labs/kosmos/build/kosmos-project.properties 2005-09-23 06:57:45 UTC (rev 1184) +++ trunk/labs/kosmos/build/kosmos-project.properties 2005-09-23 06:58:20 UTC (rev 1185) @@ -1,3 +1,3 @@ project.name=Kosmos project.name.short=kosmos -project.version=0.1.0RC4 +project.version=0.1.0RC5 |
From: <jbo...@li...> - 2005-09-23 06:57:51
|
Author: aron.gombas Date: 2005-09-23 02:57:45 -0400 (Fri, 23 Sep 2005) New Revision: 1184 Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcTest.java trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcTestResult.java Log: 2 files left out Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcTest.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcTest.java 2005-09-23 06:57:07 UTC (rev 1183) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcTest.java 2005-09-23 06:57:45 UTC (rev 1184) @@ -0,0 +1,48 @@ +/* + * Kosmos. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package hu.midori.kosmos.model; + +/** + * Wraps a <i>CruiseControl</i> continuous integration project. + * + * @author <a href="mailto:aro...@mi...">Aron Gombas</a> + * @version $Id$ + */ +public class CcTest { + /** + * Its result. + * @see CcTestResult + */ + private int result; + /** Class name of the test class. */ + private String className; + /** Method name of the testcase method. */ + private String testCaseName; + + public CcTest(int result, String className, String testCaseName) { + this.result = result; + this.className = className; + this.testCaseName = testCaseName; + } + + public int getResult() { + return result; + } + + public String getClassName() { + return className; + } + + public String getTestCaseName() { + return testCaseName; + } + + @Override + public String toString() { + return String.format("[%d] %s, %s", result, className, testCaseName); + } +} Added: trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcTestResult.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcTestResult.java 2005-09-23 06:57:07 UTC (rev 1183) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcTestResult.java 2005-09-23 06:57:45 UTC (rev 1184) @@ -0,0 +1,22 @@ +/* + * Kosmos. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package hu.midori.kosmos.model; + +/** + * Represent the result of a <i>CruiseControl</i> unit test. + * <p>This should be a Java 5 enum, but enumerated types can't be serialized + * and sent through Hessian, so it's a plain old-style Java constant for now. + * + * @author <a href="mailto:aro...@mi...">Aron Gombas</a> + * @version $Id$ + */ +public class CcTestResult { + public static final int UNKNOWN = 0; + public static final int SUCCEEDED = 1; + public static final int FAILED = -1; + public static final int ERROR = -2; +} |
Author: aron.gombas Date: 2005-09-23 02:57:07 -0400 (Fri, 23 Sep 2005) New Revision: 1183 Added: trunk/labs/kosmos/web-portlet/pages/images/failure.gif Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcProject.java trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp Log: Initial checking for unit test details monitoring Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcProject.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcProject.java 2005-09-22 21:13:59 UTC (rev 1182) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/model/CcProject.java 2005-09-23 06:57:07 UTC (rev 1183) @@ -7,6 +7,7 @@ package hu.midori.kosmos.model; import java.util.Date; +import java.util.List; /** * Wraps a <i>CruiseControl</i> continuous integration project. @@ -28,13 +29,15 @@ private int modifications; /** Duration of the build as String (e.g. "33 minutes 16 seconds"). */ private String buildTime;// TODO should not be stored as String, because it's not localizable - + /** Number of all unit test cases. */ private int tests; /** Number of unit test case failures. */ private int failures; /** Number of unit test case errors. */ private int errors; + /** All testcases run during this build. */ + private List<CcTest> testcases;// TODO better name? /** URL of the tests-per-category chart image. */ private String testsPerCategoryChartUrl; @@ -49,7 +52,7 @@ public CcProject(String name, String buildLabel, int status, Date timestamp, int modifications, String buildTime, - int tests, int errors, int failures, + int tests, int errors, int failures, List<CcTest> testcases, String testsPerCategoryChartUrl) { super(name + buildLabel + timestamp.getTime()); @@ -64,6 +67,7 @@ this.tests = tests; this.errors = errors; this.failures = failures; + this.testcases = testcases; this.testsPerCategoryChartUrl = testsPerCategoryChartUrl; } @@ -107,8 +111,12 @@ public int getErrors() { return errors; } + + public List<CcTest> getTestcases() { + return testcases; + } - public String getTestsPerCategoryChartUrl() { + public String getTestsPerCategoryChartUrl() { return testsPerCategoryChartUrl; } Modified: trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java =================================================================== --- trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-09-22 21:13:59 UTC (rev 1182) +++ trunk/labs/kosmos/src/java/hu/midori/kosmos/server/cc/CcServiceImpl.java 2005-09-23 06:57:07 UTC (rev 1183) @@ -8,6 +8,8 @@ import hu.midori.kosmos.model.CcBuildStatus; import hu.midori.kosmos.model.CcProject; +import hu.midori.kosmos.model.CcTest; +import hu.midori.kosmos.model.CcTestResult; import hu.midori.kosmos.protocol.CcService; import hu.midori.kosmos.server.AbstractKosmosService; import hu.midori.kosmos.server.CachedDataHandler; @@ -23,9 +25,14 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.StringTokenizer; +import net.sf.saxon.expr.Tokenizer; +import net.sf.saxon.om.NodeInfo; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; @@ -101,11 +108,46 @@ int tests = ScrapingUtils.runXQueryInt(dom, "<dummy> { data(count(//testcase)) } </dummy>"); int errors = ScrapingUtils.runXQueryInt(dom, "<dummy> { data(count(//testcase/error)) } </dummy>"); int failures = ScrapingUtils.runXQueryInt(dom, "<dummy> { data(count(//testcase/failure)) } </dummy>"); - + +// TODO process testcases here +// TODO nevezektant rendberak +List<CcTest> testCases = new ArrayList(); +String query = + "for " + + "$d in //testcase " + + "return " + + "<dummy>" + + "{ data($d/@classname) }|" + + "{ data($d/@name) }|" + + "{ count($d/failure) }|" + + "{ count($d/error) }" + + "</dummy>"; + +List result = ScrapingUtils.runXQuery(dom, query); +for(Iterator it = result.iterator(); it.hasNext();) { + String value = ((NodeInfo)it.next()).getStringValue(); +if(value.charAt(0) == '|') + value = " " + value;// TODO kiemel es '-'-re cserel? JIRA-bol uezt hasznalni +System.out.println("value: " + value); + + StringTokenizer tokenizer = new StringTokenizer(value, "|"); + String className = tokenizer.nextToken(); + String testCaseName = tokenizer.nextToken(); + int result_ = CcTestResult.SUCCEEDED;//!!! + if(!tokenizer.nextToken().equals("0")) + result_ = CcTestResult.FAILED; + else if(!tokenizer.nextToken().equals("0")) + result_ = CcTestResult.ERROR; + + System.out.println(" ===> className: '" + className + "', testCaseName: '" + testCaseName + "', result: " + result_); + testCases.add(new CcTest(result_, className, testCaseName)); +} +// === // generate chart Map<Integer, Integer> testsPerCategory = new HashMap<Integer, Integer>(); - if((tests - errors - failures) > 0) - testsPerCategory.put(SUCCESS_COLOR, tests - errors - failures); + int success = tests - errors - failures; + if(success > 0) + testsPerCategory.put(SUCCESS_COLOR, success); if(failures > 0) testsPerCategory.put(FAILURE_COLOR, failures); if(errors > 0) @@ -119,7 +161,7 @@ previousLatestLogModified = latestLog.lastModified(); CcProject project = new CcProject(name, buildLabel, status, timestamp, modifications, buildTime, - tests, errors, failures, + tests, errors, failures, testCases, testsPerCategoryChartUrl); log.debug(String.format("Adding %s...", project)); projects.add(project); Modified: trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp =================================================================== --- trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp 2005-09-22 21:13:59 UTC (rev 1182) +++ trunk/labs/kosmos/web-portlet/pages/cc_monitoring_test_details.jsp 2005-09-23 06:57:07 UTC (rev 1183) @@ -45,8 +45,37 @@ <td><fmt:message key="ccproject.testsPerCategory"/>:</td> <td><img src="<c:out value="${project.testsPerCategoryChartUrl}"/>" title="<fmt:message key="ccproject.testsPerCategory"/>"/></td> <td valign="top"> - TODO SOME TEST DETAILS SHOULD COME HERE? - MAYBE FAILED TESTS? OR ALL OF THEM? + <table> + <c:forEach var="testcase" items="${project.testcases}" varStatus="status"> + <c:if test="${status.index < 138}"><!-- TODO 8, tooltips, result ordered by type? --> + <tr class="portlet-section-body"> + <td> + <c:choose> + <c:when test="${testcase.result == 1}"> + <img src="<%= renderRequest.getContextPath() %>/pages/images/success.gif" title="<fmt:message key="legend.success"/>"/> + </c:when> + <c:when test="${testcase.result == -1}"> + <img src="<%= renderRequest.getContextPath() %>/pages/images/failure.gif" title="<fmt:message key="legend.failure"/>"/> + </c:when> + <c:otherwise> + <img src="<%= renderRequest.getContextPath() %>/pages/images/error.gif" title="<fmt:message key="legend.error"/>"/> + </c:otherwise> + </c:choose> + </td> + <td> + <c:if test="${testcase.result != 1}"><span class="portlet-msg-error"></c:if> + <c:out value="${testcase.className}"/> + <c:if test="${testcase.result != 1}"></span></c:if> + </td> + <td> + <c:if test="${testcase.result != 1}"><span class="portlet-msg-error"></c:if> + <c:out value="${testcase.testCaseName}"/> + <c:if test="${testcase.result != 1}"></span></c:if> + </td> + </tr> + </c:if> + </c:forEach> + </table> </td> </tr> <%@include file="includes/table_footer.jsp"%> Added: trunk/labs/kosmos/web-portlet/pages/images/failure.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/kosmos/web-portlet/pages/images/failure.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
From: <jbo...@li...> - 2005-09-22 21:14:07
|
Author: szimano Date: 2005-09-22 17:13:59 -0400 (Thu, 22 Sep 2005) New Revision: 1182 Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/out.png Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java Log: added out.png image (for externals links) inside wiki. Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/out.png =================================================================== (Binary files differ) Property changes on: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/out.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java 2005-09-22 21:05:22 UTC (rev 1181) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java 2005-09-22 21:13:59 UTC (rev 1182) @@ -59,6 +59,7 @@ import java.util.Collection; import java.util.StringTokenizer; +import org.jboss.wiki.WikiCommon; import org.jboss.wiki.WikiPage; import org.jboss.wiki.WikiPlugin; import org.jboss.wiki.WikiSession; @@ -828,7 +829,7 @@ + link + "\" target=\"_blank\">" + text - + "</a><img src=\"/file-access/default/members/jbosswiki/images/out.png\" />"; + + "</a><img src=\""+imagePath+"/"+WikiCommon.wikiButtons+"/out.png\" />"; } // internal link else { |
From: <jbo...@li...> - 2005-09-22 21:05:38
|
Author: szimano Date: 2005-09-22 17:05:22 -0400 (Thu, 22 Sep 2005) New Revision: 1181 Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiInsidePlugins.xml trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiInsidePlugin.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/TomekInsidePlugin.java Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java Log: Added inside page plugins http://jira.jboss.com/jira/browse/JBWIKI-36 Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiInsidePlugins.xml =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiInsidePlugins.xml 2005-09-22 19:38:10 UTC (rev 1180) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiInsidePlugins.xml 2005-09-22 21:05:22 UTC (rev 1181) @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>tak do zajebania</comment> +<entry key="tomek">org.jboss.wiki.plugins.TomekInsidePlugin</entry> +</properties> \ No newline at end of file Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java 2005-09-22 19:38:10 UTC (rev 1180) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java 2005-09-22 21:05:22 UTC (rev 1181) @@ -8,14 +8,20 @@ *************************************************/ package org.jboss.wiki; +import java.io.IOException; import java.util.Arrays; import java.util.Comparator; import java.util.Date; import java.util.HashMap; +import java.util.InvalidPropertiesFormatException; +import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; +import java.util.Properties; import java.util.Set; import java.util.Map.Entry; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; @@ -41,6 +47,8 @@ */ private HashMap<String, WikiPage> pages; + private HashMap<String, WikiInsidePlugin> insidePlugins; + private HashMap<String, WikiType> wikiTypes; private MediaDataSource mediaDataSource; @@ -128,7 +136,7 @@ pages.put(pageName, ret); } - if ((wikiContext != null)&&(ret != null) && (!ret.isViewable()) + if ((wikiContext != null) && (ret != null) && (!ret.isViewable()) && (!wikiContext.getUser().equals(adminUserName))) { return new WikiPage(pageName, null, "I am sorry, but you are not allowed to see this page", 0, @@ -215,6 +223,7 @@ null, mediaDataSource, attachementDataSource, true, true); loadWikiTypes(); + loadInsidePlugins(); } /** @@ -225,7 +234,7 @@ * * @return */ - protected void loadWikiTypes() { + private void loadWikiTypes() { try { wikiTypes.clear(); @@ -239,6 +248,52 @@ } } + private void loadInsidePlugins() { + insidePlugins = new HashMap<String, WikiInsidePlugin>(); + + Properties props = new Properties(); + + try { + props.loadFromXML(WikiTypeHandler.class + .getResourceAsStream("WikiInsidePlugins.xml")); + } catch (InvalidPropertiesFormatException e) { + System.err.println("WikiInsidePlugins.xml has bad format !"); + e.printStackTrace(); + } catch (IOException e) { + System.err.println("There is no WikiInsidePlugins.xml file !"); + e.printStackTrace(); + } + + Iterator it = props.keySet().iterator(); + + while (it.hasNext()) { + String pluginName = (String) it.next(); + System.out.println("[WIKIENGINE]: Loading inside plugin: " + + pluginName + " class: " + props.getProperty(pluginName)); + + WikiInsidePlugin wikiInsidePlugin = null; + + try { + wikiInsidePlugin = (WikiInsidePlugin) Class.forName( + props.getProperty(pluginName)).newInstance(); + + wikiInsidePlugin.setWikiEngine(this); + + insidePlugins.put(pluginName, wikiInsidePlugin); + } catch (InstantiationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ClassNotFoundException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } + /** * <p> * Does ... @@ -399,4 +454,45 @@ public Set<String> getPagesFor(String pageName) { return mediaDataSource.getPagesFor(pageName); } + + public String executeInsidePlugin(String pluginLink, WikiPage wikiPage, + WikiSession wikiSession) { + String pluginName = null; + + if (!pluginLink + .matches("\\{[\\w]+([\\s]+[\\w]+='[\\d\\w\\s]+')*\\s*\\}")) { + // this is not a proper inside plugin link + + return "<i>INSIDE PLUGIN ERROR: " + pluginLink + + " is not a proper plugin link</i>"; + } + + pluginName = pluginLink.substring(1, + (pluginLink.indexOf(" ") != -1) ? pluginLink.indexOf(" ") + : pluginLink.indexOf("}")); + + // get attributes + HashMap<String, String> attributes = new HashMap<String, String>(); + + Matcher matcher = Pattern.compile("[\\w]+='[\\d\\w\\s]+'").matcher( + pluginLink); + + while (matcher.find()) { + String attrib = pluginLink + .substring(matcher.start(), matcher.end()); + + String attribName = attrib.substring(0, attrib.indexOf("'")-1); + String attribValue = attrib.substring(attrib.indexOf("'") + 1, + attrib.lastIndexOf("'")); + + attributes.put(attribName, attribValue); + } + + if (insidePlugins.containsKey(pluginName)) + return insidePlugins.get(pluginName).process(wikiPage, wikiSession, + attributes); + else + return "<i>INSIDE PLUGIN ERROR: There is no plugin: " + pluginName + + "</i>"; + } } Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiInsidePlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiInsidePlugin.java 2005-09-22 19:38:10 UTC (rev 1180) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiInsidePlugin.java 2005-09-22 21:05:22 UTC (rev 1181) @@ -0,0 +1,89 @@ +/************************************************** + * * + * JBoss Labs: Creating Professional Open Source * + * * + * Distributable under LGPL license. * + * See terms of license at gnu.org. * + * * + *************************************************/ +package org.jboss.wiki; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Properties; + +/** + * <p></p> + * + */ +/** + * + * @author <a href="mailto:ds...@jb...">Damon Sicore</a> + * @author <a href="mailto:tom...@jb...">Tomasz Szymanski</a> + * @version $Id$ + */ +public abstract class WikiInsidePlugin { + + protected WikiEngine wikiEngine; + + private Properties pluginProps; + + private String name; + + final static String propFileName = "wikiPlugins.properties"; +/** + * <p></p> + * + */ + +/** + * <p>Does ...</p> + * + * + * @return + * @param content + */ + public abstract String process(final WikiPage wikiPage, WikiSession wikiSession, HashMap<String, String> attributes); + +/** + * <p>Does ...</p> + * + * + * @return + */ + + public abstract void init(); + + public void setWikiEngine(WikiEngine wikiEngine) { + this.wikiEngine = wikiEngine; + + // we can treat it as "init" function - it's executed after creating instance of plugin + // load props + + pluginProps = new Properties(); + + try { + + InputStream propsStream = FileDataSource.class.getResourceAsStream(propFileName); + + pluginProps.load(propsStream); + } + catch (Exception e) { + System.err.println("[WikiPlugin]: Cannot load WikiInsidePlugin property file: "+e); + } + } + + 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/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java 2005-09-22 19:38:10 UTC (rev 1180) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/HTMLTranslatorParts.java 2005-09-22 21:05:22 UTC (rev 1181) @@ -57,11 +57,8 @@ import java.util.regex.*; import java.util.ArrayList; import java.util.Collection; -import java.util.Iterator; import java.util.StringTokenizer; -import java.util.Vector; -import org.jboss.wiki.WikiEngine; import org.jboss.wiki.WikiPage; import org.jboss.wiki.WikiPlugin; import org.jboss.wiki.WikiSession; @@ -85,8 +82,6 @@ private String imagePath; - private String[] mediaFormats = { "*.png", "*.jpeg", "*.gif" }; - /* formatting variables */ private boolean m_allowHTML = false; @@ -152,7 +147,7 @@ * @author Janne Jalkanen * @author Rali Genova */ - public String parseLinks(String page) throws IOException { + public String parseLinks(String page, WikiSession wikiSession, WikiPage wikiPage) throws IOException { m_in = new PushbackReader(new StringReader(page), PUSHBACK_BUFFER_SIZE); StringBuffer buf = new StringBuffer(); StringBuffer word = null; @@ -215,7 +210,7 @@ if (camelCase != null) { start = buf.toString().lastIndexOf(camelCase); buf.replace(start, start + camelCase.length(), - handleHyperlinks(camelCase)); + handleHyperlinks(camelCase, wikiSession, wikiPage)); } // We've ended a word boundary, so time to reset. @@ -335,7 +330,7 @@ break; case '[': - s = handleOpenbracket(); + s = handleOpenbracket(wikiSession, wikiPage); break; case '*': @@ -680,7 +675,7 @@ return "\\"; } - private String handleOpenbracket() throws IOException { + private String handleOpenbracket(WikiSession wikiSession, WikiPage wikiPage) throws IOException { StringBuffer sb = new StringBuffer(); int ch; boolean isPlugin = false; @@ -717,7 +712,7 @@ return sb.toString(); } - return handleHyperlinks(sb.toString()); + return handleHyperlinks(sb.toString(), wikiSession,wikiPage); } private String handleOpenbrace() throws IOException { @@ -802,13 +797,14 @@ * @return the HTML link representation of the wiki page/external link * @author Rali Genova */ - private String handleHyperlinks(String link) { + private String handleHyperlinks(String link, WikiSession wikiSession, WikiPage wPage) { String result = ""; String text = ""; String wikiPage = ""; if (isPluginLink(link)) { - return null; // we do not include plugin links for now + //return null; // we do not include plugin links for now + return wikiEngine.executeInsidePlugin(link, wPage, wikiSession); } int border = link.indexOf('|'); if (border != -1) // [text|link] case @@ -1006,14 +1002,14 @@ } pageName = newPage.getName(); - String newContent = parseParts(newPage.getContent()); + String newContent = parseParts(newPage.getContent(), wikiSession, wikiPage); newPage.setPageContent(newContent); return newPage; } - private String parseParts(String pageContent) { + private String parseParts(String pageContent, WikiSession wikiSession, WikiPage wikiPage) { String newPageContent = pageContent; try { @@ -1029,7 +1025,7 @@ if (endIndx != -1) { String pagePart = newPageContent.substring(lastBegIndx + pagePartRegexStart.length(), endIndx); - String replace = parseLinks(pagePart)/*.replaceAll("&", "&")*/; + String replace = parseLinks(pagePart, wikiSession, wikiPage)/*.replaceAll("&", "&")*/; newPageContent = newPageContent.substring(0, lastBegIndx) + replace Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/TomekInsidePlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/TomekInsidePlugin.java 2005-09-22 19:38:10 UTC (rev 1180) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/TomekInsidePlugin.java 2005-09-22 21:05:22 UTC (rev 1181) @@ -0,0 +1,27 @@ +package org.jboss.wiki.plugins; + +import java.util.HashMap; + +import org.jboss.wiki.WikiInsidePlugin; +import org.jboss.wiki.WikiPage; +import org.jboss.wiki.WikiSession; + +public class TomekInsidePlugin extends WikiInsidePlugin { + + @Override + public String process(WikiPage wikiPage, WikiSession wikiSession,HashMap<String, String> attributes) { + String atriby = ""; + + for (String s : attributes.keySet()) { + atriby += s + " = " + attributes.get(s) + " "; + } + return "\n\n\n\nTOMEK TOMEK TOMEK TOMEK TOMEK TOMEK TOMEK\n\n\n\n\n"+atriby; + } + + @Override + public void init() { + // TODO Auto-generated method stub + + } + +} |
Author: szimano Date: 2005-09-22 15:38:10 -0400 (Thu, 22 Sep 2005) New Revision: 1180 Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/AttachmentDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java Log: cleaning up source code Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-09-22 19:33:17 UTC (rev 1179) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-09-22 19:38:10 UTC (rev 1180) @@ -15,14 +15,11 @@ import java.util.Map; import javax.portlet.*; -import org.jboss.portlet.*; -import org.jboss.wiki.fileaccess.WikiFileAccessFilter; import org.jboss.wiki.management.WikiServiceMenagement; import org.apache.commons.fileupload.PortletDiskFileUpload; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.FileItem; -import sun.security.krb5.internal.crypto.w; /** * The WikiPortlet. @@ -37,8 +34,6 @@ final static String jspPath = "/WEB-INF/jsp/"; - private String adminUserName = "admin"; - private String defaultPage = "Main"; private WikiEngine wikiEngine; Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-09-22 19:33:17 UTC (rev 1179) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/fileaccess/WikiFileAccessFilter.java 2005-09-22 19:38:10 UTC (rev 1180) @@ -8,8 +8,6 @@ *****************************************/ package org.jboss.wiki.fileaccess; -import java.io.File; -import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; @@ -300,11 +298,6 @@ } } - private void doServletDispatch(HttpServletRequest rReq, - HttpServletResponse rResp) { - - } - public void destroy() { } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/AttachmentDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/AttachmentDataSource.java 2005-09-22 19:33:17 UTC (rev 1179) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/AttachmentDataSource.java 2005-09-22 19:38:10 UTC (rev 1180) @@ -9,7 +9,6 @@ package org.jboss.wiki; import java.io.File; -import java.io.InputStream; import java.util.Set; /** Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-09-22 19:33:17 UTC (rev 1179) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-09-22 19:38:10 UTC (rev 1180) @@ -13,8 +13,6 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; import java.util.Date; import java.util.HashSet; import java.util.Properties; Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java 2005-09-22 19:33:17 UTC (rev 1179) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java 2005-09-22 19:38:10 UTC (rev 1180) @@ -8,7 +8,6 @@ *************************************************/ package org.jboss.wiki; -import java.io.File; import java.util.Set; /** Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java 2005-09-22 19:33:17 UTC (rev 1179) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java 2005-09-22 19:38:10 UTC (rev 1180) @@ -9,15 +9,12 @@ package org.jboss.wiki; import java.util.Arrays; -import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; -import java.util.TreeMap; -import java.util.TreeSet; import java.util.Map.Entry; import javax.xml.parsers.SAXParser; Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java 2005-09-22 19:33:17 UTC (rev 1179) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java 2005-09-22 19:38:10 UTC (rev 1180) @@ -411,7 +411,7 @@ public void setEditable(boolean editable) { this.editable = editable; - mediaDataSource.setPageMod(getName(), ((isViewable()) ? mediaDataSource.VIEWABLE : 0) + ((isEditable()) ? mediaDataSource.EDITABLE : 0)); + mediaDataSource.setPageMod(getName(), ((isViewable()) ? MediaDataSource.VIEWABLE : 0) + ((isEditable()) ? MediaDataSource.EDITABLE : 0)); } public boolean isViewable() { @@ -421,6 +421,6 @@ public void setViewable(boolean viewable) { this.viewable = viewable; - mediaDataSource.setPageMod(getName(), ((isViewable()) ? mediaDataSource.VIEWABLE : 0) + ((isEditable()) ? mediaDataSource.EDITABLE : 0)); + mediaDataSource.setPageMod(getName(), ((isViewable()) ? MediaDataSource.VIEWABLE : 0) + ((isEditable()) ? MediaDataSource.EDITABLE : 0)); } } |
Author: szimano Date: 2005-09-22 15:33:17 -0400 (Thu, 22 Sep 2005) New Revision: 1179 Added: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/JBossPortalCredentials.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/SimpleCredentials.java Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/Credentials.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java Log: user authorization made by abstract class Credentials - WikiPortlet at least become GenericPortlet Added: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/JBossPortalCredentials.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/JBossPortalCredentials.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/JBossPortalCredentials.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -0,0 +1,62 @@ +package org.jboss.wiki; + +import javax.portlet.ActionRequest; +import javax.portlet.RenderRequest; + +import org.jboss.portlet.JBossActionRequest; +import org.jboss.portlet.JBossRenderRequest; + +public class JBossPortalCredentials extends Credentials { + + private String admin_user_name = "admin"; + + private String name = null; + private boolean logedIn = false; + private boolean isAdmin = false; + + public JBossPortalCredentials(RenderRequest rReq) { + if (rReq instanceof JBossRenderRequest) { + JBossRenderRequest jrReq = (JBossRenderRequest)rReq; + + if (jrReq.getUser() != null) { + name = jrReq.getUser().getUserName(); + logedIn = true; + isAdmin = (name.equals(admin_user_name)); + } + else { + name = "Unknown"; + } + + } + else { + System.err.println("You are not running JBoss Portal"); + } + } + + public JBossPortalCredentials(ActionRequest rReq) { + if (rReq instanceof JBossActionRequest) { + JBossActionRequest jrReq = (JBossActionRequest)rReq; + + if (jrReq.getUser() != null) { + name = jrReq.getUser().getUserName(); + logedIn = true; + isAdmin = (name.equals(admin_user_name)); + } + + } + else { + System.err.println("You are not running JBoss Portal"); + } + } + + public String getName() { + return name; + } + public boolean isAdmin() { + return isAdmin; + } + public boolean isLogedIn() { + return logedIn; + } + +} Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -33,7 +33,7 @@ * @version $Id$ */ -public class WikiPortlet extends JBossPortlet { +public class WikiPortlet extends GenericPortlet { final static String jspPath = "/WEB-INF/jsp/"; @@ -52,8 +52,10 @@ wikiEngine = wikiServiceMenagement.getWikiEngine(); } - public void processAction(JBossActionRequest rReq, JBossActionResponse rResp) { + public void processAction(ActionRequest rReq, ActionResponse rResp) { + Credentials credentials = new JBossPortalCredentials(rReq); + // wikiContext is null - to get refernece to actual page WikiContext wikiContext = null; @@ -106,8 +108,7 @@ WikiPage pageWithAtt = wikiEngine.getByName(rReq .getParameter("page"), null); - pageWithAtt.addAttachement(serverFile, fileName, rReq - .getUser().getUserName()); + pageWithAtt.addAttachement(serverFile, fileName, credentials.getName()); // at the end delete the temp file serverFile.delete(); @@ -177,17 +178,13 @@ if (edPage != null) { // it may be null if the page isn't saved // yet - edPage.unlock(rReq.getUser()); + edPage.unlock(credentials); } // saving, previewing or canceling if (rReq.getParameter("editAction").equals("Save")) { - Credentials credentials = new Credentials( - (rReq.getUser() != null) ? rReq.getUser().getUserName() - : "Unknown"); - System.out.println("SAVING PAGE"); - + // save the page if (edPage == null) { @@ -220,9 +217,11 @@ } - public void doView(JBossRenderRequest rReq, JBossRenderResponse rRes) + public void doView(RenderRequest rReq, RenderResponse rRes) throws PortletException, java.io.IOException { + Credentials credentials = new JBossPortalCredentials(rReq); + PortletURL wikiURL = rRes.createActionURL(); rReq.setAttribute("actionURL", wikiURL.toString()); @@ -237,16 +236,14 @@ + rReq.getServerPort()); // prepare some data for plugins in session - rReq.getPortletSession().setAttribute("user", - (rReq.getUser() != null) ? rReq.getUser().getUserName() : null); + rReq.getPortletSession().setAttribute("credentials", credentials); rReq.getPortletSession().setAttribute("hostURL", hostURL); rReq.getPortletSession().setAttribute("actionURL", wikiURL.toString()); - rReq.getPortletSession().setAttribute("isAdmin", ((rReq.getUser() != null) && (rReq - .getUser().getUserName().equals(adminUserName))) ? true : false); rReq.getPortletSession().setAttribute("isSecure", new Boolean(rReq.isSecure())); - WikiPage noSuchPage = new WikiPage("", new Credentials(""), + WikiPage noSuchPage = new WikiPage("", + credentials, "There is no such page. Click on EDIT to start it.", 0, 0, null, wikiEngine.getMediaDataSource(), wikiEngine .getAttachementDataSource(), true, true); @@ -270,19 +267,14 @@ if ((rReq.getParameter("action") != null) && (rReq.getParameter("action").equals("Edit")) - && (rReq.getUser() != null)) { + && (credentials.isLogedIn())) { page = "Edit.jsp"; showPage = false; pageToShow = wikiEngine.getByName(wikiPage, null); - System.out.println(" Page editable: "+pageToShow.isEditable()+" access by "+((rReq.getUser() != null) ? rReq.getUser() - .getUserName() : "noone")); - if ((pageToShow != null) && (!pageToShow.isEditable())) { - if ((rReq.getUser() == null) - || ((rReq.getUser() != null) && (!rReq.getUser() - .getUserName().equals(adminUserName)))) { + if (!credentials.isAdmin()) { showPage = true; } } else { @@ -310,14 +302,13 @@ // start editing new page // wikiPage = defaultPage; - pageToShow = new WikiPage(wikiPage, new Credentials(rReq - .getUser().getUserName()), "", 0, 0, new Date(), - wikiEngine.getMediaDataSource(), wikiEngine - .getAttachementDataSource(), true, true); + pageToShow = new WikiPage(wikiPage,credentials, "", 0, 0, + new Date(), wikiEngine.getMediaDataSource(), + wikiEngine.getAttachementDataSource(), true, true); // wikiEngine.getByName(wikiPage, wikiContext); } - Date dateLock = pageToShow.lock(rReq.getUser()); + Date dateLock = pageToShow.lock(credentials); if (dateLock != null) { rReq @@ -363,8 +354,7 @@ // System.out.println("Getting type: " + type); } - wikiContext = new WikiContext((rReq.getUser() != null) ? rReq - .getUser().getUserName() : "", + wikiContext = new WikiContext(credentials.getName(), wikiEngine.getWikiType(type), new PortletWikiSession(rReq .getPortletSession())); @@ -416,18 +406,17 @@ rReq.setAttribute("author", pageToShow.getLastAuthor()); - rReq.setAttribute("logedIn", (rReq.getUser() != null) ? "true" - : "false"); + rReq.setAttribute("logedIn", credentials.isLogedIn()); rReq.setAttribute("defaultPage", defaultPage); rReq.setAttribute("isEditable", pageToShow.isEditable()); rReq.setAttribute("isViewable", pageToShow.isViewable()); - - rReq.setAttribute("isAdmin", ((rReq.getUser() != null) && (rReq - .getUser().getUserName().equals(adminUserName))) ? true : false); + rReq + .setAttribute("isAdmin", credentials.isAdmin()); + // FIXME make this more elegant (ie. plugin) // pass friendly link /* Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/PageInfo.jsp 2005-09-22 19:33:17 UTC (rev 1179) @@ -43,7 +43,7 @@ String author; - if ((author = prevWikiPage.getLastAuthor().toString()) != null) { + if ((author = prevWikiPage.getLastAuthor().getName()) != null) { } else { author = "<i>unknown</i>"; Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-09-22 19:33:17 UTC (rev 1179) @@ -23,6 +23,7 @@ boolean isAdmin = ((Boolean)request.getAttribute("isAdmin")).booleanValue(); boolean isViewable = ((Boolean)request.getAttribute("isViewable")).booleanValue(); boolean isEditable = ((Boolean)request.getAttribute("isEditable")).booleanValue(); + boolean logedIn = ((Boolean)request.getAttribute("logedIn")).booleanValue(); %> <table style="width: 100%" border="0"> @@ -49,16 +50,14 @@ <% - String logedIn = (String)request.getAttribute("logedIn"); - if ((type == null)||(type.equals("HTML"))) { - if ((isAdmin)||(logedIn.equals("true")&&(isEditable)&&(isViewable))) { + if ((isAdmin)||((logedIn)&&(isEditable)&&(isViewable))) { out.print("<a href=\""+actionURL+"&action=Edit&page="+wikiPage+"\"><img alt=\"EDIT\" src=\""+wikiImagesUrl+"editButton.png\" border=\"0\" /></a>\n"+ "<a href=\""+actionURL+"&action=Attach&page="+wikiPage+"\"><img alt=\"ATTACH\" src=\""+wikiImagesUrl+"attachButton.png\" border=\"0\" /></a>"); } - else if (logedIn.equals("true")) { + else if (logedIn) { out.print("<div style='font-size: xx-small'><i>This page IS NOT editable</i></div>"); } else { @@ -105,7 +104,7 @@ "<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")) { + if (logedIn) { out.println("<a href='"+actionURL+"&action=Edit&page="+wikiPage+"&version="+showedVersion+"'>rollback this version</a>"); } else { Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/Credentials.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/Credentials.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/Credentials.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -13,22 +13,15 @@ * <p></p> * */ -public class Credentials { - private String name; - - public Credentials(String name) { - this.name = name; - } +public abstract class Credentials { - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } + public abstract String getName(); + public abstract boolean isLogedIn(); + + public abstract boolean isAdmin(); + public String toString() { - return name; + return getName(); } } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -356,7 +356,7 @@ i++; } - Credentials author = new Credentials(pageProps + Credentials author = new SimpleCredentials(pageProps .getProperty(String.valueOf(i) + ".author")); StringBuilder pageContent = new StringBuilder(); @@ -496,7 +496,7 @@ } public Credentials getAuthorAtVersion(String pageName, int version) { - return new Credentials(getPageProps(pageName).getProperty( + return new SimpleCredentials(getPageProps(pageName).getProperty( version + ".author")); } Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/SimpleCredentials.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/SimpleCredentials.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/SimpleCredentials.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -0,0 +1,26 @@ +package org.jboss.wiki; + +import org.jboss.wiki.Credentials; + +public class SimpleCredentials extends Credentials { + + private String name; + + public SimpleCredentials(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public boolean isLogedIn() { + return false; + } + + public boolean isAdmin() { + return false; + } + + +} Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -213,7 +213,7 @@ pages = new HashMap<String, WikiPage>(); wikiTypes = new HashMap<String, WikiType>(); - noSuchPage = new WikiPage("", new Credentials(""), + noSuchPage = new WikiPage("", new SimpleCredentials(""), "There is no such page. Click on EDIT to start it.", 0, 0, null, mediaDataSource, attachementDataSource, true, true); Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -15,8 +15,6 @@ import java.util.HashMap; import java.util.Set; -import org.jboss.portal.core.model.User; - /** * <p> * </p> @@ -331,17 +329,17 @@ return clonedPage; } - public void unlock(User user) { - System.out.println("UNLOCK: " + user.getUserName() + " save user: " + public void unlock(Credentials user) { + System.out.println("UNLOCK: " + user.getName() + " save user: " + lockUser); - if ((user.getUserName()).equals(lockUser)) { + if ((user.getName()).equals(lockUser)) { System.out.println("Unlocking page"); lockTime = null; lockUser = null; } } - public Date lock(User user) { + public Date lock(Credentials user) { Date now = new Date(); Date expDate = null; Date retDate = lockTime; @@ -362,11 +360,11 @@ } if (this.lockTime == null) { - System.out.println("LOCK: " + user.getUserName()); + System.out.println("LOCK: " + user.getName()); // page isn't locked or lock expired. Lets lock it. this.lockTime = now; - this.lockUser = user.getUserName(); + this.lockUser = user.getName(); System.out.println("LOCK: " + lockUser); retDate = null; } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -1,5 +1,6 @@ package org.jboss.wiki.plugins; +import org.jboss.wiki.Credentials; import org.jboss.wiki.WikiPage; import org.jboss.wiki.WikiPlugin; import org.jboss.wiki.WikiSession; @@ -8,8 +9,9 @@ @Override public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { - boolean isAdmin = (Boolean) wikiSession.getAttribute("isAdmin"); - if (isAdmin) { + Credentials credentials = (Credentials) wikiSession.getAttribute("credentials"); + + if (credentials.isAdmin()) { String actionURL = (String) wikiSession.getAttribute("actionURL"); boolean editable = wikiPage.isEditable(); Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java 2005-09-22 17:38:12 UTC (rev 1178) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java 2005-09-22 19:33:17 UTC (rev 1179) @@ -1,5 +1,6 @@ package org.jboss.wiki.plugins; +import org.jboss.wiki.Credentials; import org.jboss.wiki.WikiAttachment; import org.jboss.wiki.WikiPage; import org.jboss.wiki.WikiPlugin; @@ -9,18 +10,17 @@ @Override public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { - String userName = (String) wikiSession.getAttribute("user"); + Credentials credentials = (Credentials) wikiSession.getAttribute("credentials"); StringBuilder history = new StringBuilder(); String attachementName = (String) wikiSession.getAttribute("var1"); Object rollbackToVer = wikiSession.getAttribute("var2"); - boolean isAdmin = (Boolean) wikiSession.getAttribute("isAdmin"); String attURL = (String) wikiSession.getAttribute("hostURL") + "/wiki/" + wikiPage.getName() + "/file:"; String actionURL = (String) wikiSession.getAttribute("actionURL"); - if (((wikiPage.isEditable())||(isAdmin))&&(rollbackToVer != null) - && (userName != null) + if (((wikiPage.isEditable())||(credentials.isAdmin()))&&(rollbackToVer != null) + && (credentials.isLogedIn()) && (Integer.valueOf((String) rollbackToVer) < wikiEngine .getAttachementDataSource().getLastAttachmentVersion( wikiPage.getName(), attachementName))) { @@ -57,22 +57,22 @@ if (i != lastVer) { history.append("<td>"); - if ((userName != null)&&((wikiPage.isEditable())||(isAdmin))) + if ((credentials.isLogedIn())&&((wikiPage.isEditable())||(credentials.isAdmin()))) history.append("<a href=\"").append(actionURL).append( "&type=fileInfo&page=").append(wikiPage.getName()) .append("&var1=").append(attachementName).append( "&var2=").append(i).append("\" >"); if (wikiPage.isEditable()) { - history.append((userName == null) ? "<i>" : "").append( + history.append((!credentials.isLogedIn()) ? "<i>" : "").append( "Rollback version ").append(i).append( - (userName == null) ? " (after login)</i>" : ""); + (!credentials.isLogedIn()) ? " (after login)</i>" : ""); } else { history.append("<i>This page IS NOT editable</i>"); } - if ((userName != null)&&((wikiPage.isEditable())||(isAdmin))) + if ((credentials.isLogedIn())&&((wikiPage.isEditable())||(credentials.isAdmin()))) history.append("</a>"); history.append("<td>"); |
From: <jbo...@li...> - 2005-09-22 17:38:34
|
Author: szimano Date: 2005-09-22 13:38:12 -0400 (Thu, 22 Sep 2005) New Revision: 1178 Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/ATOMButton.gif trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/RDFButton.gif Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp Log: buttons for atom and rdf feed (to be changed) Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-09-22 15:27:59 UTC (rev 1177) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-09-22 17:38:12 UTC (rev 1178) @@ -446,6 +446,10 @@ + pageToShow.getName()); rReq.setAttribute("rssLink", hostURL + "/wiki/rss/" + pageToShow.getName()); + rReq.setAttribute("rdfLink", hostURL + "/wiki/rdf/" + + pageToShow.getName()); + rReq.setAttribute("atomLink", hostURL + "/wiki/atom/" + + pageToShow.getName()); rRes.setTitle("Wiki"); if (javax.portlet.WindowState.NORMAL.equals(rReq.getWindowState()) Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-09-22 15:27:59 UTC (rev 1177) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-09-22 17:38:12 UTC (rev 1178) @@ -14,6 +14,8 @@ String defaultPage = (String)request.getAttribute("defaultPage"); String friendlyLink = (String)request.getAttribute("friendlyLink"); String rssLink = (String)request.getAttribute("rssLink"); + String rdfLink = (String)request.getAttribute("rdfLink"); + String atomLink = (String)request.getAttribute("atomLink"); String type = (String)request.getParameter("type"); java.util.Date editDate = (java.util.Date)request.getAttribute("editDate"); org.jboss.wiki.Credentials author = (org.jboss.wiki.Credentials)request.getAttribute("author"); @@ -69,7 +71,9 @@ <% if (((type == null)||(type.equals("HTML")))&&((isAdmin)||(isViewable))) { out.println("<a href=\""+actionURL+"&action=Info&page="+wikiPage+"\"><img alt=\"HISTORY\" src=\""+wikiImagesUrl+"historyButton.png\" border=\"0\" /></a>"); - out.println("<a href=\""+rssLink+"\"><img alt=\"RSS\" src=\""+wikiImagesUrl+"RSSButton.gif\" border=\"0\" /></a><br />"); + out.println("<a href=\""+rssLink+"\"><img alt=\"RSS\" src=\""+wikiImagesUrl+"RSSButton.gif\" border=\"0\" /></a>"); + out.println("<a href=\""+rdfLink+"\"><img alt=\"RSS\" src=\""+wikiImagesUrl+"RDFButton.gif\" border=\"0\" /></a>"); + out.println("<a href=\""+atomLink+"\"><img alt=\"RSS\" src=\""+wikiImagesUrl+"ATOMButton.gif\" border=\"0\" /></a><br />"); } %> <input type="text" name="searchQuery" /> Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/ATOMButton.gif =================================================================== (Binary files differ) Property changes on: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/ATOMButton.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/RDFButton.gif =================================================================== (Binary files differ) Property changes on: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/RDFButton.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream |
From: <jbo...@li...> - 2005-09-22 15:28:25
|
Author: szimano Date: 2005-09-22 11:27:59 -0400 (Thu, 22 Sep 2005) New Revision: 1177 Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/ATOMPlugin.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/ATOMWikiType.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/RDFPlugin.java Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiTypes.xml Log: ATOM and RDF plugins http://jira.jboss.com/jira/browse/JBWIKI-2 Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiTypes.xml =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiTypes.xml 2005-09-22 12:52:01 UTC (rev 1176) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiTypes.xml 2005-09-22 15:27:59 UTC (rev 1177) @@ -66,6 +66,22 @@ </plugin> </wikiType> <wikiType> + <name>rdf</name> + <class>org.jboss.wiki.plugins.RSSWikiType</class> + <plugin> + <name>RSSPlugin</name> + <class>org.jboss.wiki.plugins.RDFPlugin</class> + </plugin> + </wikiType> + <wikiType> + <name>atom</name> + <class>org.jboss.wiki.plugins.ATOMWikiType</class> + <plugin> + <name>ATOMPlugin</name> + <class>org.jboss.wiki.plugins.ATOMPlugin</class> + </plugin> + </wikiType> + <wikiType> <name>fileInfo</name> <class>org.jboss.wiki.plugins.DefaultWikiType</class> <plugin> Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/ATOMPlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/ATOMPlugin.java 2005-09-22 12:52:01 UTC (rev 1176) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/ATOMPlugin.java 2005-09-22 15:27:59 UTC (rev 1177) @@ -0,0 +1,108 @@ +package org.jboss.wiki.plugins; + +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Date; + +import org.jboss.wiki.WikiPage; + +import org.jboss.wiki.WikiPlugin; +import org.jboss.wiki.WikiSession; + +public class ATOMPlugin extends WikiPlugin { + + private DifferenceEngine differenceEngine; + + private void addItem(StringBuilder atomFeed, String title, String link, + String description, Date modified, String hostURL) { + atomFeed.append("<entry>\n"); + atomFeed.append("<title>").append(title).append("</title>\n"); + atomFeed.append("<link rel=\"alternate\" type=\"text/html\" href=\"") + .append(link).append("\" />\n"); + atomFeed.append("<modified>").append(modified.toString()).append( + "</modified>\n"); + atomFeed.append("<issued>").append(modified.toString()).append( + "</issued>\n"); + atomFeed.append("<id>").append(title).append("</id>\n"); + atomFeed.append("<created>").append(modified.toString()).append( + "</created>\n"); + atomFeed + .append( + "<content type=\"text/html\" mode=\"escaped\" xml:lang=\"en\" xml:base=\"") + .append(hostURL).append("\" >"); + atomFeed.append(description).append("\n"); + atomFeed.append("</content>\n</entry>\n"); + } + + @Override + public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { + StringBuilder atomFeed = new StringBuilder( + "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet href=\"http://forge.jboss.com/blojsom/atom.css\" type=\"text/css\"?>\n<!-- name=\"generator\" content=\"JBoss Wiki ATOMPlugin\" -->\n"); + atomFeed + .append("<feed version=\"0.3\" xmlns=\"http://purl.org/atom/ns#\" xml:lang=\"en\">\n"); + + atomFeed.append("<title mode=\"escaped\">JBoss Forge Wiki: ").append( + wikiPage.getName()).append("</title>\n"); + + atomFeed.append("<link rel=\"alternate\" type=\"text/xml\" href=\"") + .append((String) wikiSession.getAttribute("hostURL")).append( + "/wiki/atom/").append(wikiPage.getName()).append( + "\" />"); + + atomFeed.append("<link href=\"").append( + (String) wikiSession.getAttribute("hostURL")).append("/wiki/") + .append(wikiPage.getName()).append("\" />\n"); + + atomFeed.append("<tagline>").append(wikiPage.getName()).append( + "</tagline>\n"); + atomFeed + .append("<generator url=\"http://labs.jboss.com/products/jbosswiki\" version=\"JBoss Wiki beta\">JBoss Wiki</generator>\n"); + atomFeed + .append("<copyright mode=\"escaped\">Copyright © 2005 Tomasz Szymanski (tomasz-dot-szymanski-at-jboss-dot-com)</copyright>"); + + /* + * atomFeed.append("<description>JBoss Wiki: " + wikiPage.getName() + "</description>\n"); + * atomFeed.append("<language>en</language>\n"); + */ + + for (int i = wikiPage.getLastVersion(); i > 0; i--) { + String content; + + if (i > 1) { + content = differenceEngine + .makeDiff( + wikiPage.getPageAtVersion(true, i) + .getPageContent(), + wikiPage.getPageAtVersion(true, i - 1) + .getPageContent()).replaceAll("&", + "&").replaceAll("<", "<").replaceAll( + ">", ">").replaceAll("\n", "<br />\n"); + } else { + content = "This is first version of the page so it doesn't have diff yet"; + } + + addItem(atomFeed, wikiPage.getName() + " rev: " + i, + (String) wikiSession.getAttribute("hostURL") + + getProperty("wikiHome").replaceAll("&", "&") + + "&page=" + wikiPage.getName() + + "&version=" + i, content, wikiPage + .getEditDate(), (String) wikiSession + .getAttribute("hostURL")); + } + + atomFeed.append("</feed>\n"); + + wikiPage.setPageContent(atomFeed.toString()); + + return wikiPage; + } + + @Override + public void init() { + differenceEngine = new DifferenceEngine("ISO-8859-1"); + } + +} Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/ATOMWikiType.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/ATOMWikiType.java 2005-09-22 12:52:01 UTC (rev 1176) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/ATOMWikiType.java 2005-09-22 15:27:59 UTC (rev 1177) @@ -0,0 +1,10 @@ +package org.jboss.wiki.plugins; + +import org.jboss.wiki.WikiType; + +public class ATOMWikiType extends WikiType { + + public String getContentType() { + return "application/atom+xml"; + } +} Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/RDFPlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/RDFPlugin.java 2005-09-22 12:52:01 UTC (rev 1176) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/RDFPlugin.java 2005-09-22 15:27:59 UTC (rev 1177) @@ -0,0 +1,75 @@ +package org.jboss.wiki.plugins; + +import java.util.Date; + +import org.jboss.wiki.WikiPage; + +import org.jboss.wiki.WikiPlugin; +import org.jboss.wiki.WikiSession; + +public class RDFPlugin extends WikiPlugin { + + private DifferenceEngine differenceEngine; + + private void addItem(StringBuilder rdfFeed, String title, String link, + String description, Date date) { + rdfFeed.append("<item rdf:about=\"").append(link).append("\" >\n"); + rdfFeed.append("<title>").append(title).append("</title>\n"); + rdfFeed.append("<link>").append(link).append("</link>\n"); + rdfFeed.append("<description>").append(description).append( + "</description>\n"); + rdfFeed.append("<dc:date>").append(date.toString()).append("</dc:date>\n"); + rdfFeed.append("</item>\n"); + } + + @Override + public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { + StringBuilder rdfFeed = new StringBuilder( + "<!-- name=\"generator\" content=\"JBoss Wiki RDFPlugin\" -->\n"); + rdfFeed.append("<rdf:RDF>\n"); + rdfFeed.append("<channel rdf:about=\"").append((String) wikiSession.getAttribute("hostURL") + + "/wiki/" + wikiPage.getName()).append("\">\n"); + rdfFeed.append("<title>JBoss Forge Wiki: "+wikiPage.getName()+"</title>\n"); + rdfFeed.append("<link>" + (String) wikiSession.getAttribute("hostURL") + + "/wiki/" + wikiPage.getName() + "</link>\n"); + rdfFeed.append("<description>JBoss Wiki: " + wikiPage.getName() + + "</description>\n"); + rdfFeed.append("<dc:language>en</dc:language>\n"); + rdfFeed.append("<items>\n<rdf:Seq>\n"); + + StringBuilder items = new StringBuilder(); + + for (int i = wikiPage.getLastVersion(); i > 0; i--) { + String content; + + if (i > 1) { + content = differenceEngine.makeDiff(wikiPage.getPageAtVersion(true, i).getPageContent(), wikiPage.getPageAtVersion(true, i-1).getPageContent()).replaceAll("&", "&").replaceAll("<","<").replaceAll(">",">").replaceAll("\n","<br />\n"); + } + else { + content = "This is first version of the page so it doesn't have diff yet"; + } + + String url = (String) wikiSession.getAttribute("hostURL") + + getProperty("wikiHome").replaceAll("&", "&") + + "&page=" + wikiPage.getName() + + "&version=" + i; + + addItem(items, wikiPage.getName() + " rev: " + i, + url, content, wikiPage.getEditDate()); + + rdfFeed.append("<rdf:li rdf:resource=\"").append(url).append("\" />\n"); + } + + rdfFeed.append("</rdf:Seq>\n</items>\n</channel>\n").append(items).append("</rdf:RDF>\n"); + + wikiPage.setPageContent(rdfFeed.toString()); + + return wikiPage; + } + + @Override + public void init() { + differenceEngine = new DifferenceEngine("ISO-8859-1"); + } + +} |
From: <jbo...@li...> - 2005-09-22 12:52:14
|
Author: mla...@jb... Date: 2005-09-22 08:52:01 -0400 (Thu, 22 Sep 2005) New Revision: 1176 Added: trunk/labs/jbossweb/xdocs/modules/ trunk/labs/jbossweb/xdocs/modules/modules.xml trunk/labs/jbossweb/xdocs/modules/php/ trunk/labs/jbossweb/xdocs/modules/php/index.xml trunk/labs/jbossweb/xdocs/modules/php/project.xml trunk/labs/jbossweb/xdocs/modules/project.xml Modified: trunk/labs/jbossweb/xdocs/build.xml trunk/labs/jbossweb/xdocs/project.xml Log: Add modules to build Modified: trunk/labs/jbossweb/xdocs/build.xml =================================================================== --- trunk/labs/jbossweb/xdocs/build.xml 2005-09-22 11:50:45 UTC (rev 1175) +++ trunk/labs/jbossweb/xdocs/build.xml 2005-09-22 12:52:01 UTC (rev 1176) @@ -137,6 +137,44 @@ <param name="project-menu" expression="nomenu"/> </style> + <style basedir="modules" + destdir="${build.dir}/${dist.name}/modules" + extension=".html" + style="style.xsl" + excludes="project.xml" + includes="*.xml"> + <param name="relative-path" expression=".."/> + </style> + <mkdir dir="${build.dir}/${dist.name}/modules/printer"/> + <style basedir="modules" + destdir="${build.dir}/${dist.name}/modules/printer" + extension=".html" + style="style.xsl" + excludes="project.xml" + includes="*.xml"> + <param name="relative-path" expression="../.."/> + <param name="project-menu" expression="nomenu"/> + </style> + <!-- Modules --> + <style basedir="modules/php" + destdir="${build.dir}/${dist.name}/modules/php" + extension=".html" + style="style.xsl" + excludes="project.xml" + includes="*.xml"> + <param name="relative-path" expression="../.."/> + </style> + <mkdir dir="${build.dir}/${dist.name}/modules/php/printer"/> + <style basedir="modules/php" + destdir="${build.dir}/${dist.name}/modules/php/printer" + extension=".html" + style="style.xsl" + excludes="project.xml" + includes="*.xml"> + <param name="relative-path" expression="../../.."/> + <param name="project-menu" expression="nomenu"/> + </style> + <!-- <style basedir="common" destdir="${build.dir}/${dist.name}/common" Added: trunk/labs/jbossweb/xdocs/modules/modules.xml =================================================================== --- trunk/labs/jbossweb/xdocs/modules/modules.xml 2005-09-22 11:50:45 UTC (rev 1175) +++ trunk/labs/jbossweb/xdocs/modules/modules.xml 2005-09-22 12:52:01 UTC (rev 1176) @@ -0,0 +1,27 @@ +<?xml version="1.0"?> +<!DOCTYPE document [ + <!ENTITY project SYSTEM "project.xml"> +]> +<document url="modules.html"> + + &project; + + <properties> + <author email="mla...@jb...">Mladen Turk</author> + <title>Overview</title> + </properties> + +<body> + +<section name="Introduction"> +<p>This is the top-level entry point of the Modules documentation bundle for the +<strong>JBossWeb server</strong>. + +</p> +<p>Select one of the links from the navigation menu (to the left) to drill +down to the more detailed documentation that is available.</p> +<todo note="Work in progress"/> + +</section> +</body> +</document> Added: trunk/labs/jbossweb/xdocs/modules/php/index.xml =================================================================== --- trunk/labs/jbossweb/xdocs/modules/php/index.xml 2005-09-22 11:50:45 UTC (rev 1175) +++ trunk/labs/jbossweb/xdocs/modules/php/index.xml 2005-09-22 12:52:01 UTC (rev 1176) @@ -0,0 +1,26 @@ +<?xml version="1.0"?> +<!DOCTYPE document [ + <!ENTITY project SYSTEM "project.xml"> +]> +<document url="index.html"> + + &project; + + <properties> + <author email="mla...@jb...">Mladen Turk</author> + <title>Overview</title> + </properties> + +<body> + +<section name="Introduction"> +<p>This is the top-level entry point of the PHP Module documentation bundle for the +<strong>JBossWeb server</strong>. + +</p> +<p>Select one of the links from the navigation menu (to the left) to drill +down to the more detailed documentation that is available.</p> +<todo note="Work in progress"/> +</section> +</body> +</document> Added: trunk/labs/jbossweb/xdocs/modules/php/project.xml =================================================================== --- trunk/labs/jbossweb/xdocs/modules/php/project.xml 2005-09-22 11:50:45 UTC (rev 1175) +++ trunk/labs/jbossweb/xdocs/modules/php/project.xml 2005-09-22 12:52:01 UTC (rev 1176) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<project name="JBossWeb Documentation - Modules"> + <title>PHP Module</title> + <logo href="/images/jbossweblogo.gif">JBossWeb @ JBoss labs</logo> +<body> + + <menu name="Links"> + <item name="PHP Module" href="index.html"/> + <item name="Modules" href="../modules.html"/> + <item name="Documentation Home" href="../../index.html"/> + </menu> +</body> +</project> Added: trunk/labs/jbossweb/xdocs/modules/project.xml =================================================================== --- trunk/labs/jbossweb/xdocs/modules/project.xml 2005-09-22 11:50:45 UTC (rev 1175) +++ trunk/labs/jbossweb/xdocs/modules/project.xml 2005-09-22 12:52:01 UTC (rev 1176) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<project name="JBossWeb Documentation - Modules"> + <title>Modules</title> + <logo href="/images/jbossweblogo.gif">JBossWeb @ JBoss labs</logo> +<body> + <menu name="PHP Module"> + <item name="Overview" href="php/index.html"/> + </menu> + <menu name="Links"> + <item name="Modules" href="modules.html"/> + <item name="Documentation Home" href="../index.html"/> + </menu> +</body> +</project> Modified: trunk/labs/jbossweb/xdocs/project.xml =================================================================== --- trunk/labs/jbossweb/xdocs/project.xml 2005-09-22 11:50:45 UTC (rev 1175) +++ trunk/labs/jbossweb/xdocs/project.xml 2005-09-22 12:52:01 UTC (rev 1176) @@ -16,6 +16,12 @@ <item name="Tutorial" href="resources/tut.html"/> <item name="Lists & Forums" href="resources/mail.html"/> </menu> + <!-- + <menu name="Modules"> + <item name="Overview" href="modules/modules.html"/> + <item name="PHP Module" href="modules/php/index.html"/> + </menu> + --> <menu name="News"> <item name="News & Status" href="news/2005.html"/> <item name="Roadmap" href="news/roadmap.html"/> |
From: <jbo...@li...> - 2005-09-22 11:50:55
|
Author: mla...@jb... Date: 2005-09-22 07:50:45 -0400 (Thu, 22 Sep 2005) New Revision: 1175 Modified: trunk/labs/jbossweb/xdocs/reference/arch.xml trunk/labs/jbossweb/xdocs/reference/arch01.xml Log: Arch changes Modified: trunk/labs/jbossweb/xdocs/reference/arch.xml =================================================================== --- trunk/labs/jbossweb/xdocs/reference/arch.xml 2005-09-22 09:36:30 UTC (rev 1174) +++ trunk/labs/jbossweb/xdocs/reference/arch.xml 2005-09-22 11:50:45 UTC (rev 1175) @@ -96,8 +96,66 @@ <section name="Modules"> <p>JBoss Web Server comes with various extension modules that extends the core functionality of both Apache Tomcat standalone, and standard JBoss Application Server. + Some modules are platform specific like Microsoft .NET module, and the others are + cross platform, and requires a designated platform binaries. </p> <figure src="/images/design/jbosswebblockda.png" name="Figure 2" text="JBossWeb extensions"/> + <p>Figure 2. shows the JBoss Web Server extions modules. + </p> + <subsection name="Tomcat Native"> + <p>Tomcat Native is JNI based library for Operating System Abstraction. The core + functionality of Tomcat Native is provided by using <a href="http://apr.apache.org"> + Apache Portable Runtime (APR)</a>. The primary goal of APR is to provide an API to + which software developers may code and be assured of predictable if not identical + behavior regardless of the platform on which their software is built, relieving them + of the need to code special-case conditions to work around or take advantage of + platform-specific deficiencies or features. + </p> + <p>SSL support is enabled by using the <a href="http://www.openssl.org">OpenSSL</a> + library. This gives much higher performance as well as hardware encryption software + support then standard Java offers. It also gives exixting users of + <a href="http://httpd.apache.org">Apache HTTPD</a> a seamless transition from mod_ssl. + </p> + <p>See the <a href="arch01.html">Native</a> section for the more details about + Tomcat Native and additional libraries used. + </p> + </subsection> + <subsection name="Native Proxy"> + <p>NativeProxy is Servlet abstraction that enables both in-process and + out-of-process access to the legacy subsystems regardless of the method that is + used for the integrated within the JBoss Web Server. + NativeProxy has integrated advanced application load balancer that offers both + high availability and application segmantation for remotely based subsystems. + </p> + </subsection> + <subsection name="Proxy Stream"> + <p>Proxy stream is a protocol very much similar to the Tomcat AJP/1.3 protocol, + with additions for using Operating system advanced connection mechanisms like + Unix Domain Sockets or Microsoft Windows Named Pipes. It offers both connection + reuse and connection multiplexing. Unlike AJP/1.3 the data transferred can be + encrypted, thus rising the security without the need for special network + hardware and topology. + </p> + <p>The main purpose for Proxy Steam Protocol is to give transparent access to + the out-of-process legacy subsystems that can be hosted on the remote machine. + </p> + </subsection> + <subsection name="Native Module API"> + <p>This componet is JNI based native abstraction layer for various http centic + legacy subsystem. It is responsible for loading the legacy applications inside the + process address space of the running JVM. + </p> + </subsection> + <subsection name="URL Rewrite"> + <p>This module uses a rule-based rewriting engine (based on a regular-expression parser) + to rewrite requested URLs on the fly. It supports an unlimited number of rules and an + unlimited number of attached rule conditions for each rule to provide a really flexible + and powerful URL manipulation mechanism. The URL manipulations can depend on various tests, + for instance server variables, environment variables, HTTP headers, time stamps and even + external database lookups in various formats can be used to achieve a really + granular URL matching. + </p> + </subsection> </section> </body> </document> Modified: trunk/labs/jbossweb/xdocs/reference/arch01.xml =================================================================== --- trunk/labs/jbossweb/xdocs/reference/arch01.xml 2005-09-22 09:36:30 UTC (rev 1174) +++ trunk/labs/jbossweb/xdocs/reference/arch01.xml 2005-09-22 11:50:45 UTC (rev 1175) @@ -15,9 +15,26 @@ <section name="Design"> <p>Tomcat Native uses <a href="http://apr.apache.org">APR</a> and - <a href="http://www.openssl.org">OpenSSL</a> + <a href="http://www.openssl.org">OpenSSL</a> to + provide superior scalability, performance, and better integration with native server + technologies. The Apache Portable Runtime is a highly portable library that is at + the heart of Apache HTTP Server 2.x. APR has many uses, including access to advanced IO + functionality (such as sendfile, epoll and TCP corking), + OS level functionality (random number generation, system status, etc), + and native process handling (shared memory, NT pipes and Unix domain sockets). </p> <figure src="/images/design/tcnativeblockda.png" name="Figure 3" text="Tomcat Native"/> + <p>Tomcat Native comes as a set of libraries compiled for the designated Operating System. + JBoss Web Server download comes with prebuild native libraries for the following platforms: + <ul> + <li>WIN32</li> + <li>WIN64/AMD64</li> + <li>WIN64/IA64</li> + <li>Linux i386</li> + <li>Linux amd64</li> + <li>Sun Solaris Sparc</li> + </ul> + </p> </section> </body> </document> |
From: <jbo...@li...> - 2005-09-22 09:36:44
|
Author: adamw Date: 2005-09-22 05:36:30 -0400 (Thu, 22 Sep 2005) New Revision: 1174 Modified: trunk/forge/portal-extensions/forge-forums/scripts/conv.sql trunk/forge/portal-extensions/forge-forums/scripts/fix.sql trunk/forge/portal-extensions/forge-forums/scripts/portal-keys.sql trunk/forge/portal-extensions/forge-forums/scripts/portal-pure.sql Log: Updated migrate scripts Modified: trunk/forge/portal-extensions/forge-forums/scripts/conv.sql =================================================================== --- trunk/forge/portal-extensions/forge-forums/scripts/conv.sql 2005-09-22 09:32:45 UTC (rev 1173) +++ trunk/forge/portal-extensions/forge-forums/scripts/conv.sql 2005-09-22 09:36:30 UTC (rev 1174) @@ -23,13 +23,13 @@ -- Copying data from forums. INSERT INTO jbp_forums_forums (jbp_id, jbp_category_id, jbp_description, - jbp_last_post_id, jbp_name, jbp_order, jbp_topic_count, + jbp_name, jbp_order, jbp_topic_count, jbp_post_count, jbp_prune_enable, jbp_prune_next, - jbp_status, jbp_type) - SELECT n.forum_id, n.cat_id, n.forum_desc, n.forum_last_post_id, + jbp_status) + SELECT n.forum_id, n.cat_id, n.forum_desc, n.forum_name, n.forum_order, n.forum_topics, n.forum_posts, n.prune_enable, n.prune_next, - n.forum_status, 0 FROM phpbb_forums n; + n.forum_status FROM phpbb_forums n; -- Copying data from forumswatch - two tables required here. -- First inserting user+mode data. @@ -44,20 +44,19 @@ -- Copying topics. INSERT INTO jbp_forums_topics (jbp_id, jbp_forum_id, jbp_view_count, - jbp_replies, jbp_first_post_id, jbp_last_post_id, + jbp_replies, jbp_last_post_date, jbp_poster, jbp_type, jbp_status, jbp_subject, jbp_poll) SELECT n.topic_id, n.forum_id, n.topic_views, n.topic_replies, - n.topic_first_post_id, n.topic_last_post_id, n.topic_last_post_time, n.topic_poster, n.topic_type, n.topic_status, n.topic_title, NULL FROM phpbb_topics n; -- Copying posts. INSERT INTO jbp_forums_posts (jbp_id, jbp_topic_id, jbp_edit_count, jbp_edit_date, jbp_create_date, jbp_subject, jbp_text, - jbp_htmlenabled, jbp_poster_id) + jbp_poster_id) SELECT n.post_id, n.topic_id, n.post_edit_count, n.post_edit_time, - n.post_time, n.post_subject, n.post_text, n.enable_html, + n.post_time, n.post_subject, n.post_text, n.poster_id FROM phpbb_posts n; -- Copying pools @@ -82,6 +81,11 @@ SELECT n.vote_desc_id, n.vote_user_id FROM phpbb_vote_voters n; +-- Copying topics watch +INSERT INTO jbp_forums_topicswatch (jbp_id, jbp_topic_id) + SELECT n.user_id, n.topic_id + FROM phpbb_topics_watch n; + -- Updating the "admin" account to be the same as on labs. UPDATE jbp_users SET jbp_password = "21232f297a57a5a743894a0e4a801fc3" WHERE jbp_uname = "admin"; Modified: trunk/forge/portal-extensions/forge-forums/scripts/fix.sql =================================================================== --- trunk/forge/portal-extensions/forge-forums/scripts/fix.sql 2005-09-22 09:32:45 UTC (rev 1173) +++ trunk/forge/portal-extensions/forge-forums/scripts/fix.sql 2005-09-22 09:36:30 UTC (rev 1174) @@ -30,14 +30,6 @@ -- created. UPDATE jbp_forums_posts SET jbp_poster_id = @dummy_user_id WHERE jbp_poster_id IS NULL; --- Updating topics without a first post so they have the youngest post as a first post. -UPDATE jbp_forums_topics t SET t.jbp_first_post_id = - (SELECT MIN(p.jbp_create_date) FROM jbp_forums_posts p WHERE p.jbp_topic_id = t.jbp_id) - WHERE t.jbp_first_post_id IS NULL; - --- Deleting the topics without a first posts which haven't been successfully updated. -DELETE FROM jbp_forums_topics WHERE jbp_first_post_id IS NULL; - -- Updating topics that have been created by a null user to be created by the dummy user. UPDATE jbp_forums_topics SET jbp_poster = @dummy_user_id WHERE jbp_poster IS NULL; Modified: trunk/forge/portal-extensions/forge-forums/scripts/portal-keys.sql =================================================================== --- trunk/forge/portal-extensions/forge-forums/scripts/portal-keys.sql 2005-09-22 09:32:45 UTC (rev 1173) +++ trunk/forge/portal-extensions/forge-forums/scripts/portal-keys.sql 2005-09-22 09:36:30 UTC (rev 1174) @@ -15,9 +15,7 @@ ALTER TABLE jbp_forums_forums MODIFY jbp_id int(11) NOT NULL auto_increment, ADD PRIMARY KEY (jbp_id), ADD INDEX (jbp_category_id), - ADD INDEX (jbp_last_post_id), - ADD FOREIGN KEY (jbp_category_id) REFERENCES jbp_forums_categories (jbp_id), - ADD FOREIGN KEY (jbp_last_post_id) REFERENCES jbp_forums_posts (jbp_id); + ADD FOREIGN KEY (jbp_category_id) REFERENCES jbp_forums_categories (jbp_id); -- -- Table structure for table `jbp_forums_forumswatch` @@ -85,20 +83,20 @@ ADD PRIMARY KEY (jbp_id), ADD INDEX (jbp_forum_id), ADD INDEX (jbp_poll), - ADD INDEX (jbp_last_post_id), - ADD INDEX (jbp_first_post_id), ADD INDEX (jbp_poster), ADD FOREIGN KEY (jbp_forum_id) REFERENCES jbp_forums_forums (jbp_id), ADD FOREIGN KEY (jbp_poll) REFERENCES jbp_forums_polls (jbp_id), - ADD FOREIGN KEY (jbp_last_post_id) REFERENCES jbp_forums_posts (jbp_id), - ADD FOREIGN KEY (jbp_first_post_id) REFERENCES jbp_forums_posts (jbp_id), ADD FOREIGN KEY (jbp_poster) REFERENCES jbp_forums_posters (jbp_id); -- -- Table structure for table `jbp_forums_topicswatch` -- --- AS THIS FEATURE IS NOT YET IMPLEMENTED, LEAVING IT OUT. +ALTER TABLE jbp_forums_topicswatch + ADD INDEX (jbp_id), + ADD INDEX (jbp_topic_id), + ADD FOREIGN KEY (jbp_id) REFERENCES jbp_forums_posters (jbp_id), + ADD FOREIGN KEY (jbp_topic_id) REFERENCES jbp_forums_topics (jbp_id); -- -- Table structure for table `jbp_forums_watch` Modified: trunk/forge/portal-extensions/forge-forums/scripts/portal-pure.sql =================================================================== --- trunk/forge/portal-extensions/forge-forums/scripts/portal-pure.sql 2005-09-22 09:32:45 UTC (rev 1173) +++ trunk/forge/portal-extensions/forge-forums/scripts/portal-pure.sql 2005-09-22 09:36:30 UTC (rev 1174) @@ -20,15 +20,13 @@ `jbp_id` int(11) NOT NULL, `jbp_category_id` int(11) default NULL, `jbp_description` varchar(255) default NULL, - `jbp_last_post_id` int(11) default NULL, `jbp_name` varchar(255) default NULL, `jbp_order` int(11) default NULL, `jbp_topic_count` int(11) default NULL, `jbp_post_count` int(11) default NULL, `jbp_prune_enable` tinyint(1) default NULL, `jbp_prune_next` int(11) default NULL, - `jbp_status` int(11) default NULL, - `jbp_type` int(11) default NULL + `jbp_status` int(11) default NULL ) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1; -- @@ -98,7 +96,6 @@ `jbp_create_date` datetime default NULL, `jbp_subject` varchar(255) default NULL, `jbp_text` text, - `jbp_htmlenabled` tinyint(1) default NULL, `jbp_poster_id` int(11) default NULL ) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1; @@ -112,8 +109,6 @@ `jbp_forum_id` int(11) default NULL, `jbp_view_count` int(11) default NULL, `jbp_replies` int(11) default NULL, - `jbp_first_post_id` int(11) default NULL, - `jbp_last_post_id` int(11) default NULL, `jbp_last_post_date` datetime default NULL, `jbp_poster` int(11) default NULL, `jbp_type` int(11) default NULL, |
From: <jbo...@li...> - 2005-09-22 09:32:53
|
Author: mla...@jb... Date: 2005-09-22 05:32:45 -0400 (Thu, 22 Sep 2005) New Revision: 1173 Modified: trunk/labs/jbossweb/xdocs/images/design/jbosswebarch.png Log: Fix image commit Modified: trunk/labs/jbossweb/xdocs/images/design/jbosswebarch.png =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-09-22 09:29:54
|
Author: mla...@jb... Date: 2005-09-22 05:29:40 -0400 (Thu, 22 Sep 2005) New Revision: 1172 Modified: trunk/labs/jbossweb/xdocs/images/design/jbosswebarch.png trunk/labs/jbossweb/xdocs/reference/arch.xml trunk/labs/jbossweb/xdocs/sources/jbosswebarch.vsd Log: Arch changes Modified: trunk/labs/jbossweb/xdocs/images/design/jbosswebarch.png =================================================================== (Binary files differ) Modified: trunk/labs/jbossweb/xdocs/reference/arch.xml =================================================================== --- trunk/labs/jbossweb/xdocs/reference/arch.xml 2005-09-22 09:17:51 UTC (rev 1171) +++ trunk/labs/jbossweb/xdocs/reference/arch.xml 2005-09-22 09:29:40 UTC (rev 1172) @@ -78,6 +78,20 @@ legacy systems or JMS Servers </p> </subsection> + <subsection name="JBoss Microkernel"> + <p>The JBoss Microkernel is a set of MBeans that runs on top of JBossMX. + It has been designed to be totally modular from the ground up. + Support classes exists to extend the notion of an MBean into a Service or Deployer. + </p> + <p>JBossMX isJBoss implementation of the JMX technology. JBoss includes a clean + room implementation of the JMX API's published by Sun Microsystems. + While implementing all the required management functions it is also geared towards + acting as a core library of the JBoss Microkernel. + JBoss MX supports version 1.2 of the JMX specification + (<a href="http://jcp.org/en/jsr/detail?id=3">JSR 003</a>) since JBoss versions 3.2.5 + and 4.0.0. Support for the JMX Remote API (JSR 160) is under development. + </p> + </subsection> </section> <section name="Modules"> <p>JBoss Web Server comes with various extension modules that extends the core Modified: trunk/labs/jbossweb/xdocs/sources/jbosswebarch.vsd =================================================================== (Binary files differ) |
From: <jbo...@li...> - 2005-09-22 09:18:10
|
Author: mla...@jb... Date: 2005-09-22 05:17:51 -0400 (Thu, 22 Sep 2005) New Revision: 1171 Modified: trunk/labs/jbossweb/xdocs/images/design/jbosswebarch.png trunk/labs/jbossweb/xdocs/reference/arch.xml trunk/labs/jbossweb/xdocs/sources/jbosswebarch.vsd trunk/labs/jbossweb/xdocs/style.xsl Log: Arch changes Modified: trunk/labs/jbossweb/xdocs/images/design/jbosswebarch.png =================================================================== (Binary files differ) Modified: trunk/labs/jbossweb/xdocs/reference/arch.xml =================================================================== --- trunk/labs/jbossweb/xdocs/reference/arch.xml 2005-09-22 07:36:43 UTC (rev 1170) +++ trunk/labs/jbossweb/xdocs/reference/arch.xml 2005-09-22 09:17:51 UTC (rev 1171) @@ -14,11 +14,75 @@ <body> <section name="Design"> - <p>JBoss Web Server is based on the + <p>The core functionality of JBoss Web Server is provided by the <a href="http://tomcat.apache.org">Apache Tomcat</a>. + Apache Tomcat is embedded inside JBoss Application Server using + Embedded Engine. This allows the seamless integration with JBoss components + by using underlaying Microkernel system. </p> + <p>Additional modules allows to use the JBoss Web Server as drop-in replacement + for standard native web servers, while offering the Reference Implementation for + the <a href="http://java.sun.com/products/servlets">Java Servlet</a> and + <a href="http://java.sun.com/products/jsp">JavaServer Pages</a> technologies. + The Java Servlet and JavaServer Pages specifications are developed by Sun + under the <a href="http://jcp.org/en/introduction/overview">Java Community Process</a>. + </p> <figure src="/images/design/jbosswebarch.png" name="Figure 1" text="JBossWeb architecture"/> - <br/> + <p>Figure 1. shows the JBoss Web Server architecture. The brief description of + architecture components is described in the following sections. + </p> + <subsection name="Tomcat"> + <p>JBoss Web Server currently uses the <strong>Apache Tomcat 5.5.x</strong> + branch. While it supports the same Servlet and JSP + Specification versions as Apache Tomcat 5.0.x, there are significant changes + in many areas under the hood, resulting in improved performance, stability, + and total cost of ownership. + </p> + <attributes name="Servlet/JSP Spec" value="Apache Tomcat version"> + <attribute name="2.5/2.1" required="false"><strong>6.0.X</strong> - Planned for Q4/2005</attribute> + <attribute name="2.4/2.0" required="false"><strong>5.5.X</strong> - Apache Tomcat 5.5 is + the current focus of development. + </attribute> + </attributes> + </subsection> + <subsection name="JBossCache"> + <p>JBossCache is a replicated and transactional cache. + It is replicated since multiple JBossCache instances can be distributed + (within the same JVM or across several JVMs whether they reside on the same + machine or on different machines on a network) and data is replicated across + the whole group. It is transactional because a user can configure a JTA + transaction manager and make the cache operation transactional. + Note that the cache can also be run without any replication; this is the local mode. + </p> + <p>Currently, it consists of two components: <code>TreeCache</code> and + <code>TreeCacheAop</code>. TreeCache is a tree-structured cache that provides + replication and transaction context, while TreeCacheAop extends the functionality + of TreeCache but behaves as a true object cache providing transparent and + finer-grained object mapping into internal cache. + </p> + </subsection> + <subsection name="JBossJTA"> + <p>A clean room implementation of the <a href="http://java.sun.com/products/jta/"> + Java Transaction API</a> part of the <a href="http://java.sun.com/j2ee/">J2EE specification.</a> + JBossJTA is made up of a number of a components and interfaces. + The interfaces can be used when you change the transaction manager implementation, + i.e. plugin a thirdparty implementation. + </p> + </subsection> + <subsection name="JBossJCA"> + <p>A clean room implementation of the + <a href="http://java.sun.com/j2ee/connector/index.jsp">J2EE Connector API</a> part of the + <a href="http://java.sun.com/j2ee/">J2EE specification</a>. + JCA handles the deployment of resource adapters. These include <code>DataSources</code> and + <code>ConnectionFactorys</code> and <code>MessageListeners</code> to and from databases, + legacy systems or JMS Servers + </p> + </subsection> +</section> +<section name="Modules"> + <p>JBoss Web Server comes with various extension modules that extends the core + functionality of both Apache Tomcat standalone, and standard JBoss Application Server. + </p> <figure src="/images/design/jbosswebblockda.png" name="Figure 2" text="JBossWeb extensions"/> </section> </body> Modified: trunk/labs/jbossweb/xdocs/sources/jbosswebarch.vsd =================================================================== (Binary files differ) Modified: trunk/labs/jbossweb/xdocs/style.xsl =================================================================== --- trunk/labs/jbossweb/xdocs/style.xsl 2005-09-22 07:36:43 UTC (rev 1170) +++ trunk/labs/jbossweb/xdocs/style.xsl 2005-09-22 09:17:51 UTC (rev 1171) @@ -233,6 +233,7 @@ <xsl:apply-templates/> </td></tr> </table> + <br/> </xsl:template> |
From: <jbo...@li...> - 2005-09-22 07:36:51
|
Author: mla...@jb... Date: 2005-09-22 03:36:43 -0400 (Thu, 22 Sep 2005) New Revision: 1170 Added: trunk/labs/jbossweb/xdocs/images/jboss_ics.gif trunk/labs/jbossweb/xdocs/images/jbweb_pb.gif Modified: trunk/labs/jbossweb/xdocs/index.xml Log: Add jboss and jbossweb small logos Added: trunk/labs/jbossweb/xdocs/images/jboss_ics.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/jboss_ics.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/labs/jbossweb/xdocs/images/jbweb_pb.gif =================================================================== (Binary files differ) Property changes on: trunk/labs/jbossweb/xdocs/images/jbweb_pb.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/labs/jbossweb/xdocs/index.xml =================================================================== --- trunk/labs/jbossweb/xdocs/index.xml 2005-09-21 21:10:15 UTC (rev 1169) +++ trunk/labs/jbossweb/xdocs/index.xml 2005-09-22 07:36:43 UTC (rev 1170) @@ -39,8 +39,10 @@ and most scalable web servers in the market. </p> <p> +<image src="/images/jboss_ics.gif"/> <image src="/images/tomcat_pb.gif"/> <image src="/images/openssl_ics.gif"/> +<image src="/images/jbweb_pb.gif"/> </p> </section> </body> |
From: <jbo...@li...> - 2005-09-21 20:26:08
|
Author: szimano Date: 2005-09-21 16:25:36 -0400 (Wed, 21 Sep 2005) New Revision: 1168 Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiTypes.xml trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java Log: Admin can now make page editable or not. http://jira.jboss.com/jira/browse/JBWIKI-1 http://jira.jboss.com/jira/browse/JBWIKI-17 http://jira.jboss.com/jira/browse/JBWIKI-3 Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/java/org/jboss/wiki/WikiPortlet.java 2005-09-21 20:25:36 UTC (rev 1168) @@ -37,6 +37,8 @@ final static String jspPath = "/WEB-INF/jsp/"; + private String adminUserName = "admin"; + private String defaultPage = "Main"; private WikiEngine wikiEngine; @@ -192,7 +194,7 @@ edPage = new WikiPage(rReq.getParameter("editedPage"), credentials, "", 0, 0, new Date(), wikiEngine .getMediaDataSource(), wikiEngine - .getAttachementDataSource()); + .getAttachementDataSource(), true, true); } // set new content @@ -225,6 +227,8 @@ rReq.setAttribute("actionURL", wikiURL.toString()); + boolean showPage = true; + // Create server host and put it into session for plugins String hostURL = ((rReq.isSecure()) ? "https" : "http") + "://" @@ -233,17 +237,19 @@ + rReq.getServerPort()); // prepare some data for plugins in session - rReq.getPortletSession().setAttribute("user", (rReq.getUser() != null) ? rReq.getUser().getUserName() : null); + rReq.getPortletSession().setAttribute("user", + (rReq.getUser() != null) ? rReq.getUser().getUserName() : null); rReq.getPortletSession().setAttribute("hostURL", hostURL); rReq.getPortletSession().setAttribute("actionURL", wikiURL.toString()); - + rReq.getPortletSession().setAttribute("isAdmin", ((rReq.getUser() != null) && (rReq + .getUser().getUserName().equals(adminUserName))) ? true : false); rReq.getPortletSession().setAttribute("isSecure", new Boolean(rReq.isSecure())); WikiPage noSuchPage = new WikiPage("", new Credentials(""), "There is no such page. Click on EDIT to start it.", 0, 0, null, wikiEngine.getMediaDataSource(), wikiEngine - .getAttachementDataSource()); + .getAttachementDataSource(), true, true); String page = "Wiki.jsp"; @@ -266,56 +272,68 @@ && (rReq.getParameter("action").equals("Edit")) && (rReq.getUser() != null)) { page = "Edit.jsp"; + showPage = false; pageToShow = wikiEngine.getByName(wikiPage, null); - if (rReq.getParameter("version") != null) { - // show previous version of page + System.out.println(" Page editable: "+pageToShow.isEditable()+" access by "+((rReq.getUser() != null) ? rReq.getUser() + .getUserName() : "noone")); + + if ((pageToShow != null) && (!pageToShow.isEditable())) { + if ((rReq.getUser() == null) + || ((rReq.getUser() != null) && (!rReq.getUser() + .getUserName().equals(adminUserName)))) { + showPage = true; + } + } else { + if (rReq.getParameter("version") != null) { + // show previous version of page - System.out.println("Getting page " + wikiPage + " at version " - + rReq.getParameter("version")); + System.out.println("Getting page " + wikiPage + + " at version " + rReq.getParameter("version")); - if ((pageToShow.getLastVersion() > Integer.valueOf(rReq - .getParameter("version")))) { - pageToShow = wikiEngine.getByName(wikiPage, null, Integer - .valueOf(rReq.getParameter("version"))); - } + if ((pageToShow.getLastVersion() > Integer.valueOf(rReq + .getParameter("version")))) { + pageToShow = wikiEngine.getByName(wikiPage, null, + Integer.valueOf(rReq.getParameter("version"))); + } - if (pageToShow.getLastVersion() != pageToShow.getVersion()) { - rReq.setAttribute("showedVersion", Integer.valueOf(rReq - .getParameter("version"))); + if (pageToShow.getLastVersion() != pageToShow.getVersion()) { + rReq.setAttribute("showedVersion", Integer.valueOf(rReq + .getParameter("version"))); + } + } else { + pageToShow = wikiEngine.getByName(wikiPage, null); } - } else { - pageToShow = wikiEngine.getByName(wikiPage, null); - } - if (pageToShow == null) { - // start editing new page - // wikiPage = defaultPage; + if (pageToShow == null) { + // start editing new page + // wikiPage = defaultPage; - pageToShow = new WikiPage(wikiPage, new Credentials(rReq - .getUser().getUserName()), "", 0, 0, new Date(), - wikiEngine.getMediaDataSource(), wikiEngine - .getAttachementDataSource()); - // wikiEngine.getByName(wikiPage, wikiContext); - } + pageToShow = new WikiPage(wikiPage, new Credentials(rReq + .getUser().getUserName()), "", 0, 0, new Date(), + wikiEngine.getMediaDataSource(), wikiEngine + .getAttachementDataSource(), true, true); + // wikiEngine.getByName(wikiPage, wikiContext); + } - Date dateLock = pageToShow.lock(rReq.getUser()); + Date dateLock = pageToShow.lock(rReq.getUser()); - if (dateLock != null) { - rReq - .setAttribute( - "lockMsg", - "Page is locked by " - + pageToShow.getLockUser() - + " from " - + dateLock - + ".<br> I won't stop you from saving, but you or he can erease each other changes. Lock will expire: "); + if (dateLock != null) { + rReq + .setAttribute( + "lockMsg", + "Page is locked by " + + pageToShow.getLockUser() + + " from " + + dateLock + + ".<br> I won't stop you from saving, but you or he can erease each other changes. Lock will expire: "); + } } - } else if ((rReq.getParameter("action") != null) && (rReq.getParameter("action").equals("Info"))) { page = "PageInfo.jsp"; + showPage = false; pageToShow = wikiEngine.getByName(wikiPage, null); @@ -333,7 +351,9 @@ rReq.setAttribute("pageAtTop", pageToShow); } - } else { + } + + if (showPage) { page = "Wiki.jsp"; String type = "html"; @@ -398,9 +418,16 @@ rReq.setAttribute("logedIn", (rReq.getUser() != null) ? "true" : "false"); - + rReq.setAttribute("defaultPage", defaultPage); + rReq.setAttribute("isEditable", pageToShow.isEditable()); + + rReq.setAttribute("isViewable", pageToShow.isViewable()); + + rReq.setAttribute("isAdmin", ((rReq.getUser() != null) && (rReq + .getUser().getUserName().equals(adminUserName))) ? true : false); + // FIXME make this more elegant (ie. plugin) // pass friendly link /* @@ -432,5 +459,4 @@ } doDispatch(rReq, rRes); } - } \ No newline at end of file Modified: trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp =================================================================== --- trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/forge-wiki/src/web/WEB-INF/jsp/Wiki.jsp 2005-09-21 20:25:36 UTC (rev 1168) @@ -18,6 +18,9 @@ java.util.Date editDate = (java.util.Date)request.getAttribute("editDate"); org.jboss.wiki.Credentials author = (org.jboss.wiki.Credentials)request.getAttribute("author"); String wikiImagesUrl = (String)request.getAttribute("wikiImagesUrl"); + boolean isAdmin = ((Boolean)request.getAttribute("isAdmin")).booleanValue(); + boolean isViewable = ((Boolean)request.getAttribute("isViewable")).booleanValue(); + boolean isEditable = ((Boolean)request.getAttribute("isEditable")).booleanValue(); %> <table style="width: 100%" border="0"> @@ -48,11 +51,14 @@ if ((type == null)||(type.equals("HTML"))) { - if (logedIn.equals("true")) { + if ((isAdmin)||(logedIn.equals("true")&&(isEditable)&&(isViewable))) { out.print("<a href=\""+actionURL+"&action=Edit&page="+wikiPage+"\"><img alt=\"EDIT\" src=\""+wikiImagesUrl+"editButton.png\" border=\"0\" /></a>\n"+ "<a href=\""+actionURL+"&action=Attach&page="+wikiPage+"\"><img alt=\"ATTACH\" src=\""+wikiImagesUrl+"attachButton.png\" border=\"0\" /></a>"); } + else if (logedIn.equals("true")) { + out.print("<div style='font-size: xx-small'><i>This page IS NOT editable</i></div>"); + } else { out.print("<div style='font-size: xx-small'><i>Login to edit pages and attach files</i></div>"); } @@ -61,7 +67,7 @@ %> <% -if ((type == null)||(type.equals("HTML"))) { +if (((type == null)||(type.equals("HTML")))&&((isAdmin)||(isViewable))) { out.println("<a href=\""+actionURL+"&action=Info&page="+wikiPage+"\"><img alt=\"HISTORY\" src=\""+wikiImagesUrl+"historyButton.png\" border=\"0\" /></a>"); out.println("<a href=\""+rssLink+"\"><img alt=\"RSS\" src=\""+wikiImagesUrl+"RSSButton.gif\" border=\"0\" /></a><br />"); } @@ -78,7 +84,7 @@ <% String attachFile = (String)request.getAttribute("fileAttach"); - if ((attachFile != null)&&(attachFile.equals("true"))) { + if (((isEditable)||(isAdmin))&&(attachFile != null)&&(attachFile.equals("true"))) { out.println("<h2><b>UPLOAD FILE:</b></h2>\n"+ "<FORM ACTION=\""+actionURL+"&page="+wikiPage+"\" METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">"+ "<INPUT TYPE=\"file\" NAME=\"file_up\" />"+ Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiTypes.xml =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiTypes.xml 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/etc/org/jboss/wiki/WikiTypes.xml 2005-09-21 20:25:36 UTC (rev 1168) @@ -28,6 +28,10 @@ <name>wikiToHtmlTranslator</name> <class>org.jboss.wiki.plugins.HTMLTranslatorParts</class> </plugin> + <plugin> + <name>adminConsole</name> + <class>org.jboss.wiki.plugins.AdminConsolePlugin</class> + </plugin> </wikiType> <wikiType> <name>diff</name> Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/FileDataSource.java 2005-09-21 20:25:36 UTC (rev 1168) @@ -14,6 +14,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.OutputStream; import java.util.Date; import java.util.HashSet; import java.util.Properties; @@ -37,6 +38,8 @@ public static final String propFileName = "filedatasource.properties"; + public static final String propModFileName = "fileMod.properties"; + private String pathToMedia; private String pathToAttachments; @@ -45,6 +48,10 @@ private final int BUF_SIZE = 32768; + private Properties pageModProps; + + private File modFile; + public FileDataSource() { System.out.println("Looking for props file !"); @@ -62,6 +69,30 @@ loadProperties(fileDSProps); + pageModProps = new Properties(); + modFile = new File(pathToMedia + "/" + propModFileName); + + FileInputStream fis = null; + + try { + if (!modFile.exists()) { + modFile.createNewFile(); + } + + fis = new FileInputStream(modFile); + + pageModProps.load(fis); + + } catch (IOException ioe) { + System.err.println("Can't load the file " + propModFileName + "\n" + + ioe); + } finally { + try { + fis.close(); + } catch (IOException ioe) { + System.err.println("Can't close input stream \n" + ioe); + } + } } public void loadProperties(Properties fileDSProps) { @@ -78,8 +109,7 @@ } public boolean preSave() { - // TODO Auto-generated method stub - return false; + return true; } public boolean savePage(WikiPage page, String languageCode) { @@ -203,13 +233,11 @@ } public boolean postSave() { - // TODO Auto-generated method stub - return false; + return true; } public boolean preGet() { - // TODO Auto-generated method stub - return false; + return true; } public Properties getPageProps(String pageName) { @@ -346,8 +374,10 @@ System.err.println(ioe); } + int pageMods = getPageMod(pageName); + page = new WikiPage(pageName, author, pageContent.toString(), - i, i, new Date(pageFile.lastModified()), this, this); + i, i, new Date(pageFile.lastModified()), this, this, (pageMods & VIEWABLE) == VIEWABLE, (pageMods & EDITABLE) == EDITABLE); page.setLength(pageFile.length()); } @@ -358,8 +388,7 @@ } public boolean postGet() { - // TODO Auto-generated method stub - return false; + return true; } public WikiPage getPage(String pageName, String languageCode) { @@ -582,17 +611,20 @@ for (int i = 0; i < pageFiles.length; i++) { if ((pageFiles[i].isFile()) && (pageFiles[i].getName().endsWith(".txt"))) { - //String[] tokens = pageFiles[i].getName().split("/"); - attSet.add((directory+"/"+pageFiles[i].getName().substring(0, pageFiles[i].getName().length() - ".txt".length())).substring(1)); + // String[] tokens = pageFiles[i].getName().split("/"); + attSet.add((directory + "/" + pageFiles[i].getName().substring( + 0, pageFiles[i].getName().length() - ".txt".length())) + .substring(1)); } } for (int i = 0; i < pageFiles.length; i++) { if ((pageFiles[i].isDirectory()) && (!pageFiles[i].getName().endsWith("-att"))) { - + // do not take dirs from OLD - if (!pageFiles[i].getAbsolutePath().equals(pathToMedia + "/OLD")) { + if (!pageFiles[i].getAbsolutePath() + .equals(pathToMedia + "/OLD")) { // get names for subpages getPageNamesFor(directory + "/" + pageFiles[i].getName(), attSet); @@ -696,4 +728,36 @@ return pages; } + public int getPageMod(String pageName) { + if (pageModProps.getProperty(pageName) == null) { + return (EDITABLE + VIEWABLE); + } else { + return Integer.valueOf(pageModProps.getProperty(pageName)); + } + } + + public synchronized void setPageMod(String pageName, int mods) { + + if (mods != (EDITABLE + VIEWABLE)) { + pageModProps.setProperty(pageName, String.valueOf(mods)); + } + else { + pageModProps.remove(pageName); + } + + FileOutputStream fos = null; + + try { + fos = new FileOutputStream(modFile); + pageModProps.store(fos, SAVE_COMMENT); + } catch (IOException ioe) { + System.err.println("Couldn't store mod props: " + ioe); + } finally { + try { + fos.close(); + } catch (IOException ioe) { + System.err.println("Can't close input stream \n" + ioe); + } + } + } } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/MediaDataSource.java 2005-09-21 20:25:36 UTC (rev 1168) @@ -16,6 +16,9 @@ * */ public interface MediaDataSource { + + public final static int EDITABLE = 100; + public final static int VIEWABLE = 1; /** * <p>Does ...</p> * @@ -85,6 +88,10 @@ public Set<String> getAllPageNames(); public Set<String> getPagesFor(String pageName); + + public int getPageMod(String pageName); + + public void setPageMod(String pageName, int mods); } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiEngine.java 2005-09-21 20:25:36 UTC (rev 1168) @@ -50,6 +50,8 @@ private AttchementDataSource attachementDataSource; + private String adminUserName = "admin"; + WikiPage noSuchPage; /** @@ -116,6 +118,11 @@ WikiPage ret = null; + if (!mediaDataSource.preGet()) { + System.err.println("Couldn't get page"); + return null; + } + if (pages.containsKey(pageName)) { ret = pages.get(pageName); } else { @@ -124,6 +131,18 @@ pages.put(pageName, ret); } + if ((wikiContext != null)&&(ret != null) && (!ret.isViewable()) + && (!wikiContext.getUser().equals(adminUserName))) { + return new WikiPage(pageName, null, + "I am sorry, but you are not allowed to see this page", 0, + 0, new Date(), getMediaDataSource(), + getAttachementDataSource(), false, false); + } + + if (!mediaDataSource.postGet()) { + System.err.println("Problems with postGet"); + } + if (ret != null) { if (wikiContext != null) { return wikiContext.process(ret); @@ -196,7 +215,7 @@ noSuchPage = new WikiPage("", new Credentials(""), "There is no such page. Click on EDIT to start it.", 0, 0, - null, mediaDataSource, attachementDataSource); + null, mediaDataSource, attachementDataSource, true, true); loadWikiTypes(); } @@ -323,22 +342,6 @@ return mediaDataSource; } - public static void main(String[] args) { - WikiEngine we = new WikiEngine(); - - WikiType wt = we.getWikiType("HTML"); - - WikiContext wc = new WikiContext(null, wt, null); - - WikiPage wp = new WikiPage("name", new Credentials("tomek"), - "[content|ble sme]", 1, 1, new Date(), we.getMediaDataSource(), - we.getAttachementDataSource()); - - wp = wc.process(wp); - - System.out.println(wp.getContent()); - } - public void refreshPage(String pageName) { if (pages.containsKey(pageName)) { pages.remove(pageName); @@ -359,8 +362,10 @@ if (temp != null) { int searchScore; - if ((searchScore = wikiSearch.matches(temp.getPageContent() - .toLowerCase())) > 0) { + // search for pages (add pagename at the beginig of each page so + // it can be found) + if ((searchScore = wikiSearch.matches((name + " " + temp + .getPageContent()).toLowerCase())) > 0) { resPages.put(name, searchScore); } } Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiPage.java 2005-09-21 20:25:36 UTC (rev 1168) @@ -41,7 +41,7 @@ private Date lockTime = null; private String lockUser; - + private long length = 0; /** @@ -76,7 +76,7 @@ * */ private int lastVersion; - + private int version; /** @@ -94,7 +94,7 @@ * */ private MediaDataSource mediaDataSource; - + private AttchementDataSource attachementDataSource; /** @@ -113,9 +113,15 @@ private String pageContent; + private boolean editable; + private boolean viewable; + public WikiPage(String pageName, Credentials pageAuthor, - String pageContent, int pageLastVersion, int thisVersion, Date editDate, MediaDataSource mediaDataSource, AttchementDataSource attachementDataSource) { + String pageContent, int pageLastVersion, int thisVersion, + Date editDate, MediaDataSource mediaDataSource, + AttchementDataSource attachementDataSource, boolean viewable, + boolean editable) { name = pageName; lastAuthor = pageAuthor; this.pageContent = pageContent; @@ -124,6 +130,8 @@ this.editDate = editDate; this.mediaDataSource = mediaDataSource; this.attachementDataSource = attachementDataSource; + this.viewable = viewable; + this.editable = editable; } /** @@ -145,8 +153,16 @@ * </p> * */ - public void save() { + public synchronized void save() { + if (!mediaDataSource.preSave()) { + System.err.println("Couldn't save page"); + return; + } mediaDataSource.savePage(this, null); + + if (!mediaDataSource.postSave()) { + System.err.println("Problems with postSave"); + } } /** @@ -201,8 +217,7 @@ public WikiPage getPageAtVersion(boolean loadContent, int version) { if (version == lastVersion) { return this; - } - else { + } else { return mediaDataSource.getPageAtVersion(this, loadContent, version); } } @@ -308,15 +323,17 @@ @Override public Object clone() throws CloneNotSupportedException { WikiPage clonedPage = new WikiPage(getName(), getLastAuthor(), - getPageContent(), getLastVersion(), getVersion(), getEditDate(), mediaDataSource, attachementDataSource); - + getPageContent(), getLastVersion(), getVersion(), + getEditDate(), mediaDataSource, attachementDataSource,isViewable(),isEditable()); + clonedPage.setLength(getLength()); - + return clonedPage; } public void unlock(User user) { - System.out.println("UNLOCK: "+user.getUserName()+" save user: "+lockUser); + System.out.println("UNLOCK: " + user.getUserName() + " save user: " + + lockUser); if ((user.getUserName()).equals(lockUser)) { System.out.println("Unlocking page"); lockTime = null; @@ -345,12 +362,12 @@ } if (this.lockTime == null) { - System.out.println("LOCK: "+user.getUserName()); - + System.out.println("LOCK: " + user.getUserName()); + // page isn't locked or lock expired. Lets lock it. this.lockTime = now; this.lockUser = user.getUserName(); - System.out.println("LOCK: "+lockUser); + System.out.println("LOCK: " + lockUser); retDate = null; } @@ -370,22 +387,42 @@ } public long getLength() { - if ((length == 0)&&(getPageContent().length() != 0)) { + if ((length == 0) && (getPageContent().length() != 0)) { length = getPageContent().length(); } - + return length; } public void setLength(long length) { this.length = length; } - + public void addAttachement(File attFile, String attName, String user) { attachementDataSource.addAtachement(attFile, attName, this, user); } - + public Set<String> getAttachementsSet() { return attachementDataSource.getAttachementsSet(this); } + + public boolean isEditable() { + return editable; + } + + public void setEditable(boolean editable) { + this.editable = editable; + + mediaDataSource.setPageMod(getName(), ((isViewable()) ? mediaDataSource.VIEWABLE : 0) + ((isEditable()) ? mediaDataSource.EDITABLE : 0)); + } + + public boolean isViewable() { + return viewable; + } + + public void setViewable(boolean viewable) { + this.viewable = viewable; + + mediaDataSource.setPageMod(getName(), ((isViewable()) ? mediaDataSource.VIEWABLE : 0) + ((isEditable()) ? mediaDataSource.EDITABLE : 0)); + } } Added: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AdminConsolePlugin.java 2005-09-21 20:25:36 UTC (rev 1168) @@ -0,0 +1,71 @@ +package org.jboss.wiki.plugins; + +import org.jboss.wiki.WikiPage; +import org.jboss.wiki.WikiPlugin; +import org.jboss.wiki.WikiSession; + +public class AdminConsolePlugin extends WikiPlugin { + + @Override + public WikiPage process(WikiPage wikiPage, WikiSession wikiSession) { + boolean isAdmin = (Boolean) wikiSession.getAttribute("isAdmin"); + if (isAdmin) { + String actionURL = (String) wikiSession.getAttribute("actionURL"); + + boolean editable = wikiPage.isEditable(); + boolean viewable = wikiPage.isViewable(); + + if ((wikiSession.getAttribute("var1") != null) + && (wikiSession.getAttribute("var1").equals("chmod"))) { + WikiPage editingPage = wikiEngine.getByName(wikiPage.getName(), null); + + if (wikiSession.getAttribute("var2") != null) { + editingPage.setEditable(Boolean.valueOf((String) wikiSession + .getAttribute("var2"))); + editable = editingPage.isEditable(); + } + if (wikiSession.getAttribute("var3") != null) { + editingPage.setViewable(Boolean.valueOf((String) wikiSession + .getAttribute("var3"))); + viewable = editingPage.isViewable(); + } + } + + StringBuilder adminConsole = new StringBuilder(wikiPage + .getPageContent()); + + adminConsole.append("\n<hr><h3>Admin console</h3>\n"); + adminConsole.append("This page ").append( + (editable) ? "is" : "isn't").append( + " editable "); + adminConsole.append("<a href=\"").append(actionURL) + .append("&page=").append(wikiPage.getName()).append( + "&var1=chmod").append("&var2=").append( + !editable).append("&var3=").append( + viewable).append("\" >SWITCH IT ") + .append((editable) ? "NOT" : "").append( + " EDITABLE</a><br />\n"); + + adminConsole.append("This page ").append( + (viewable) ? "is" : "isn't").append( + " viewable "); + + adminConsole.append("<a href=\"").append(actionURL) + .append("&page=").append(wikiPage.getName()).append( + "&var1=chmod").append("&var2=").append( + editable).append("&var3=").append( + !viewable).append("\" >SWITCH IT ") + .append((viewable) ? "NOT" : "").append( + " VIEWABLE</a><br />\n"); + + wikiPage.setPageContent(adminConsole.toString()); + } + return wikiPage; + } + + @Override + public void init() { + + } + +} Modified: trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java =================================================================== --- trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java 2005-09-21 17:05:21 UTC (rev 1167) +++ trunk/forge/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/plugins/AttachementInfoPlugin.java 2005-09-21 20:25:36 UTC (rev 1168) @@ -13,12 +13,13 @@ StringBuilder history = new StringBuilder(); String attachementName = (String) wikiSession.getAttribute("var1"); Object rollbackToVer = wikiSession.getAttribute("var2"); + boolean isAdmin = (Boolean) wikiSession.getAttribute("isAdmin"); String attURL = (String) wikiSession.getAttribute("hostURL") + "/wiki/" + wikiPage.getName() + "/file:"; String actionURL = (String) wikiSession.getAttribute("actionURL"); - if ((rollbackToVer != null) + if (((wikiPage.isEditable())||(isAdmin))&&(rollbackToVer != null) && (userName != null) && (Integer.valueOf((String) rollbackToVer) < wikiEngine .getAttachementDataSource().getLastAttachementVersion( @@ -56,17 +57,22 @@ if (i != lastVer) { history.append("<td>"); - if (userName != null) + if ((userName != null)&&((wikiPage.isEditable())||(isAdmin))) history.append("<a href=\"").append(actionURL).append( "&type=fileInfo&page=").append(wikiPage.getName()) .append("&var1=").append(attachementName).append( "&var2=").append(i).append("\" >"); + if (wikiPage.isEditable()) { history.append((userName == null) ? "<i>" : "").append( "Rollback version ").append(i).append( (userName == null) ? " (after login)</i>" : ""); + } + else { + history.append("<i>This page IS NOT editable</i>"); + } - if (userName != null) + if ((userName != null)&&((wikiPage.isEditable())||(isAdmin))) history.append("</a>"); history.append("<td>"); |