CVS View Plugin#
By RoyPhillipsOverview#
CVSViewPlugin loads a file from a named CVS repository and displays it in the wiki pageExample:#
[{CVSViewPlugin cvsview.pserver='scott/tiger@delphi:2401/export/cvsroot' cvsview.module='Scarab' cvsview.filepath='/src/java/org/tigris/scarab/actions/MoveIssue.java' cvsview.colorcode='true' cvsview.range='90,100' colorcode.line.number='90' }] Lines [{$cvsview.range.lower}] thru [{$cvsview.range.upper}] of __[{$cvsview.filename}]__ version [{$cvsview.version}]\\ (Module: {{[{$cvsview.module}]}} path: {{[{$cvsview.path}]}})
This example will attempt to retrieve the current version of the required file from the CVS repository specified. It will call the ColorCodePlugin to render the file (it will detect the syntax type from the file name), and display only lines 90 thru 100.
The example also demonstrates the use of variables temporarily injected into the page context (may be used after the plugin invocation only).
![]() |
In the absence of either colorcode or plugin parameters, the source is rendered using a version of MaxVoelkel's FormatCodePlugin, to get <tt> style and CamelCase support.
Rendering with other plugins#
To use another plugin to the render the file, such as Java2HtmlPlugin, use the cvsview.plugin parameter to name the plugin, and pass its parameters prefixed with the plugin name:[{CVSViewPlugin cvsview.pserver='scott/tiger@delphi:2401/export/cvsroot'
cvsview.module='XStore'
cvsview.filepath='org/spleensoft/tools/BuildDatabase.java'
cvsview.title='!FILENAME\nPATH \'\'Version\'\': VERSION'
cvsview.plugin='Java2HtmlPlugin'
Java2HtmlPlugin.lineNumbers='true'
Java2HtmlPlugin.style='Kawa'
}]
This example also demonstrates the cvsview.title facility, which precedes the file inclusion with the specified JSPWiki markup, substituting the strings FILENAME, VERSION, MODULE, PATH with the values returned from CVS.
Parameters#
cvsview.pserver | Conection string to CVS via pserver |
cvsview.module | Name of module in CVS repository |
cvsview.filepath | Full path and filename to be retrieved |
cvsview.colorcode | 'true' if the ColorCode plugin should be used |
cvsview.title | JSPWiki markup for title or heading |
cvsview.plugin | Name of plugin to use to render source |
Security#
As the plugin requires both username and password for the cvs repository to be specified in a publicly-editable page, the plugin should be used for anonymous-accessible repositories, or internal intranets. This plugin only allows file viewing, but the user ID and password can be used in other tools, so it's best to use an Id that isn't in the writers file. Having said that, pserver passwords aren't exactly the most secure...TODO#
- Specify required version, ID, etc. for resource
- Other CVS protocols than pserver
- Safer authentication (use Wiki ID/password? Use certs?)
- Wrap text returned in specified plugin (e.g., Java2HtmlPlugin) (done, use: cvsview.plugin='name')
- Name method to extract from source or line number range (done for range)
Note#
If the cvsview.colorcode='true' parameter setting is used, the Color Code plugin should be installed, likewise for cvsview.java2html.Installing#
- Download the distribution jar
into the local JSPWiki/WEB-INF/lib directory.
- Either invoke with full package name, or add to JSPWiki/WEB-INF/jspwiki.properties plugin search path:
- jspwiki.plugin.searchPath = ...,lu.intrasoft.jspwiki.plugin, ...
Building#
- Unpack the source jar
into some convenient directory
- Edit the build.properties file to set the local webserver path
- E.g., webserver.dir=C:/Program Files/Apache Software Foundation/Tomcat 5.5
- Run the ant task deploy
Implementation#
CVSViewPlugin.java | A WikiPlugin wrapper around CVSFile |
CVSFile.java | Non-plugin specific code to check-out a single named file from CVS |
CVSItem.java | Representation of a CVS entry, incudes filename, version, size and contents |
CVSPassword.java | CVS's trivial password algorithm |
Back
Add new attachment
List of attachments
Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
---|---|---|---|---|---|---|
jar |
cvsfile-plugin.jar | 0.0 kB | 2 | 04-Oct-2006 13:15 | Sothach | |
bmp |
cvsview-eg1.bmp | 494.8 kB | 2 | 04-Oct-2006 13:14 | Sothach | |
jar |
cvsview-plugin-src.jar | 8.3 kB | 4 | 04-Oct-2006 14:30 | Sothach | |
jar |
cvsview-plugin.jar | 10.6 kB | 4 | 04-Oct-2006 14:30 | Sothach |