Some people requested a SubversionProvider. So there it is :-)
It is based on AbstractFileProvider and simply uses the page directory as a Subversion workspace. For page reads is fetches the latest version from the repository and for page writes it commits the page to the repository.
There is also an attachment provider. It simply keeps all attachments in a directory named after the parent page.
This is an update of the version posted earlier. It uses the latest SVNKit library (currently 1.1.0 standalone) and also comes with some performance improvements.
Installation is simple:
- Download the SVNKit library from TMate Software
.
- Download subversionprovider_latest.jar from the attachments (includes source code).
- Put svnkit.jar (try version 1.1.8 as it doesn't work with 1.2.1), ganymed.jar and subversionprovider_latest.jar into your classpath (e.g. by copying them into /WEB-INF/lib)
- Add the following lines to your jspwiki.properties:
# Tell jspwiki to use SubversionProvider for pages. jspwiki.pageProvider = de.treichels.jspwiki.providers.SubversionPageProvider # Tell jspwiki to use SubversionProvider for attachments. jspwiki.attachmentProvider = de.treichels.jspwiki.providers.SubversionAttachmentProvider # Location of the subversion repository # Note: SVNKit supports http, https, svn, svn+ssh, file (only FSFS repositories) # protocols jspwiki.subversionProvider.repoPath = file:///path/to/svn/JSPWiki/pages/ # Location of the subversion workarea. # All files form the repoPath will be checked out into this directory jspwiki.fileSystemProvider.pageDir = C:\\Temp\\svnwork\\Test # Username and password for the repository. Default is anonymous access jspwiki.subversionProvider.username = admin jspwiki.subversionProvider.password = secret # Tell SubversionProvier how often to update pages and attachments from the repository. Default is 60 seconds. # There is a trade-off between data consistency and speed (everything comes with a price :-)). # # With a large interval performance will be better, but you may get a conflict if someone else changed the page in # subversion in the meantime. # # With a small interval conflicts will be less likely, but performance will be worse. # # SubversionProvider will check the subversion repository for every page access if the interval is 0. With this setting # you will never get conflicts, but it is also the slowest setting. # # If you are sure that the subversion respository is ONLY updated by JSPWiki you can switch off update checking # by setting the updateInterval to -1. This is the fastest setting but nobody should ever touch the wiki pages in # the repository. jspwiki.subversionProvider.updateInterval = 60
Have fun! Oliver
Oliver, I modified your description as it has got a bit out of date. Alexander Sinyushkin
I added a modified Version of the SubversionProvider that works with 2.4.4 of JSPWiki. The code is not tested very well. I simply extended it to be compatible with the new Interfaces (WikiEngine parameter in calls) and implemented the move methods.
Anyway, use at own risk...
--Stefan Craatz
, 16-May-2006
I want to use Subversion provider with JSPWiki 2.4.53. With the subversionprovider for 2.4.4 I have the next error message: svn: Malformed network data detected in: de.treichels.jspwiki.providers.SubversionPageProvider.putPageText(), line 218 The provider for previous versions doesn't work.
I'm using svn protocol in a windows XP machine. I don't know if error is in the provider and I need to wait a stable one for this jspwiki version.
Can't you help my to know what's the matter?
--Migue, 23-Sep-2006
Oliver, Nice work on this provider, I'm using it quite a bit at work now for our documentation wiki. I have installed Stefan's update to get it running under 2.4.71 and noticed one issue so far - when showing a list of revisions for a page, it always stops at the first revision. I tracked it down to this line in the SubversionPageProvider.java:
clientManager.getLogClient().doLog(new File[] { file }, SVNRevision.create(0), SVNRevision.HEAD, false, false, Long.MAX_VALUE,
...
It seems that the HEAD parameter seems to be interpreted in a different way to what I expect. Changing it to UNDEFINED causes all revisions to be returned.
Also, using revision 0 as the start will cause an error in the new JavaSVN 1.1.0beta5 release. It complains if the file was not present in revision 0. The way to resolve this was to also use the UNDEFINED revision.
Finally, setting the limit to 0 apparently is a better way of not imposing a limit, rather than using Long.MAX_VALUE. It's not documented but I came across it in the mailing lists.
Here is what I use (and also in SUbversionAttachmentProvider.java):
clientManager.getLogClient().doLog(new File[] { file }, SVNRevision.UNDEFINED, SVNRevision.UNDEFINED, false, false, 0,
...
--DavidChandler, 11-Nov-2006
I encountered errors with the modification date when using the weblog plugin to display entries stored in Subversion. I tracked it down to the following line of code in AbstractSubversionProvider.java:
clientManager.getLogClient().doLog(new File[] { file }, rev, rev, false, false, 1, new SVNLogEntryHandler() {
...
The rev object is created for version "1", as for blog entries jspwiki attempts to display the create date as the modification date (for ordering / sorting, I suppose...). As both startRevision and endRevision parameters are set to version 1, the page modification date will not be found (as it is unlikely that the blog entry existed in revision 1). Anyway to correct the problem, modify the endRevision parameter as in the following code:
clientManager.getLogClient().doLog(new File[] { file }, rev, SVNRevision.HEAD, false, false, 1, new SVNLogEntryHandler() {
...
Using HEAD as the endRevision will allow the log client to find the earliest valid revision so that the modification date can be correctly displayed.
-pvs, 12.27.2006
We added some contributions to SubversionProvider. Now it's possible to keep wiki data in sync with a Subversion repository through the svn+ssh:// scheme using special keys in your jspwiki.properties file:
# Location of the subversion repository # Note: SVNKit supports http, https, svn, svn+ssh, file (only FSFS repositories) # protocols jspwiki.subversionProvider.repoPath = svn+ssh://host/path/to/svn/repos # ssh server login # if an ssh tunnel is successfully established, a Subversion repository # located on this server is accessed just like on a local machine jspwiki.subversionProvider.sshUser = username # path to the private key # this file is kept on the same server that JSPWiki runs on jspwiki.subversionProvider.sshKey = /path/to/ssh_private_key # passphrase to the private key # optional jspwiki.subversionProvider.sshKey.passphrase = password # port to connect to # if not set, port 22 is used jspwiki.subversionProvider.sshPort = 22
Also your change notes will be used as commit log messages. Commit author names are names of page modifiers. This feature is available in subversionprovider_latest.jar. Installation notes remain the same as listed above.
02.07.2007
de.treichels.jspwiki.providers.AbstractSubversionProvider - Can't conntect to Subversion repository!
org.tmatesoft.svn.core.SVNException: svn: PROPFIND of '/svn/elisa/jspwiki': 405 Method Not Allowed (http://elisa)
at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:43)
I have just spent quite some time finding the reason for this error.
I had moved the subversion repository to another machine and had changed jspwiki.subversionProvider.repoPath
but it seems this is not enough, somehow the path is stored in jspwiki.fileSystemProvider.pageDir, too.
After I had deleted everything from jspwiki.fileSystemProvider.pageDir, jspwiki worked again and the error message went away.
http://www.nabble.com/forum/ViewPost.jtp?post=1408966&framed=y
--Jürgen Weber, 14-Feb-2007
Has anybody gotten SubversionProvider to work with JSPWiki v.2.4.91? I keep getting errors:
Unable to load and setup properties from jspwiki.properties. Failed to start managers: null--Jeff Dahl, 16-Feb-2007
Am I right that the page history doesn't show the repository logmessages?
Using subversionprovider_latest.jar with above patches from pvs and David applied (on JSPWiki 2.4.87 and svn 1.4.2)
Thanks
FrankF, 04-Apr-2007
Is this possible --> Idea Subversion Provider Should Go Into Core?
--Dran Dane, 06-May-2007
Hi,
I have a Use Case where I want to use JSPWiki to use Subversion as the data store. But, the important part of requirement is that the location of the SVN repository is not pre-defined and needs to be configured dynamically.
If there a way that I can set these properties through Wiki context (at runtime) and still use the Subversion connector?
Cheers k.
--Kapil Viren Ahuja
, 22-Aug-2007
Uploaded version 3 of subversionprovider_latest.jar
Merged changes made by -DavidChandler, 11-Nov-2006 and -pvs, 12.27.2006 in subversionprovider_latest.jar
Fixed missing author information for first version 'This page was created on 25-Feb-2008 11:50 by unknown
--Fai, 26-02-2008
Uploaded version 4 of subversionprovider_latest.jar
SubversionProvider#getPageText(final String page, final int version) doesn't throw a ProviderException anymore when a certain (revi)/(ver)sion cannot be found.
It returns null as specified in the WikiPageProvider#getPageText(String, int)
--Fai, 29-02-2008
Uploaded new version 5 subversionprovider_latest.jar
(same, but obsolete: subversionprovider_20090112.jar
)
Fixes nasty bug with attachments when pages contains spaces or other special chars.
Also upgraded methods to be compatible with newer SVNKit 1.2.1
--Joerg Delker, 12-01-2009
I tried the provider, the latest version (5) that is supposed to fix problems with attachments and whitespace. However, when attaching a file with whitespace, a problem still occurs. The file is stored correctly in svn (whitespace replaced by +, I presume this is normal). Just opening the page with the attachment however (not even the attachment itself) leads to a NPE:
javax.servlet.jsp.JspException: WikiContext may not be NULL - serious internal problem!
at com.ecyrd.jspwiki.tags.WikiTagBase.doStartTag(WikiTagBase.java:86)
at org.apache.jsp.Error_jsp._jspx_meth_wiki_005fMessages_005f0(Error_jsp.java:178)
at org.apache.jsp.Error_jsp._jspService(Error_jsp.java:125)
...
--PeterMutsaers, 26-1-09
--PeterMutsaers, 26-Jan-2009 18:19
Habe in der Version 2.8.1 versucht von dem normalen FileProvider zum Subversionprovider umzustellen, doch leider bekomme ich dabei nur folgende Fehlermeldung: Hat jemand erfahrungen mit dem Umstieg, bzw eine Anleitung für den Subversionprovider?
2009-02-19 13:40:02 StandardContext[/FredWiki2]JSPWiki: Unable to load and setup properties from jspwiki.properties. Failed to start; please check log files for better information. 2009-02-19 13:40:02 StandardContext[/FredWiki2]ERROR: Failed to create a Wiki engine: JSPWiki: Unable to load and setup properties from jspwiki.properties. Failed to start; please check log files for better information. 2009-02-19 13:40:02 StandardContext[/FredWiki2]Exception starting filter WikiJSPFilter com.ecyrd.jspwiki.InternalWikiException: No wiki engine, check logs. at com.ecyrd.jspwiki.WikiEngine.getInstance(WikiEngine.java:346) at com.ecyrd.jspwiki.ui.WikiServletFilter.init(WikiServletFilter.java:79) at com.ecyrd.jspwiki.ui.WikiJSPFilter.init(WikiJSPFilter.java:76) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:225) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:308) at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:79) at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3698) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4349) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:823) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:807) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:595) at org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:277) at org.apache.catalina.core.StandardHost.install(StandardHost.java:832) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:701) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:432) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:983) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:349) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1091) at org.apache.catalina.core.StandardHost.start(StandardHost.java:789) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478) at org.apache.catalina.core.StandardService.start(StandardService.java:480) at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313) at org.apache.catalina.startup.Catalina.start(Catalina.java:556) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:287) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:425)
# Tell jspwiki to use SubversionProvider for pages. jspwiki.pageProvider = de.treichels.jspwiki.providers.SubversionPageProvider # Tell jspwiki to use SubversionProvider for attachments. jspwiki.attachmentProvider = de.treichels.jspwiki.providers.SubversionAttachmentProvider # Location of the subversion repository # Note: SVNKit supports http, https, svn, svn+ssh, file (only FSFS repositories) # protocols jspwiki.subversionProvider.repoPath = https://swd.bahn-net.db.de/svn/sagpo/common/trunk/docs/wiki/pages/ # Location of the subversion workarea. # All files form the repoPath will be checked out into this directory jspwiki.fileSystemProvider.pageDir = /fred/home/mweisser/java/fredwiki3/pages # Username and password for the repository. Default is anonymous access jspwiki.subversionProvider.username = username jspwiki.subversionProvider.password = password # Tell SubversionProvier how often to update pages and attachments from the repository. Default is 60 seconds. # There is a trade-off between data consistency and speed (everything comes with a price :-)). # # With a large interval performance will be better, but you may get a conflict if someone else changed the page in # subversion in the meantime. # # With a small interval conflicts will be less likely, but performance will be worse. # # SubversionProvider will check the subversion repository for every page access if the interval is 0. With this setting # you will never get conflicts, but it is also the slowest setting. # # If you are sure that the subversion respository is ONLY updated by JSPWiki you can switch off update checking # by setting the updateInterval to -1. This is the fastest setting but nobody should ever touch the wiki pages in # the repository. jspwiki.subversionProvider.updateInterval = 60
Hi,
try to create a SVN repository first:
svnadmin create <your repo path>
Your will get an empty main page if calling JSPWiki then. Now you can fill in your SVN repository with all pages you already have stored in your file system. Please be aware of your attachments.
I did it this way:
- configure tomcat to handle two wikis, the old file system based (/wiki) and the new svn based (/svnwiki)
- create the svn repository for the JSPWiki
svnadmin create /home/Projekte/Archiv/Wiki
- import all pages, for example LeftMenu.txt
svn import LeftMenu.txt file:///home/Projekte/Archiv/Wiki -m "Initial checkin"
- lock all accounts in /wiki
- if you can find some bad links in /svnwiki to the old /wiki, replace them on the fly
Ralph
I just upgraded from JSPWiki 2.4 to 2.8.2. I use the SubversionProvider and at the same time upgraded subversion to 1.6.1, the latest svnkit 1.3 and the latest subversion provider.
My page author at the bottom with the page revision is listed as unknown.
This worked before the upgrade.
Any ideas?
--Glenn Nielsen, 15:58:01 15-May-2009 EEST
Add new attachment
List of attachments
| Kind | Attachment Name | Size | Version | Date Modified | Author | Change note |
|---|---|---|---|---|---|---|
jar |
subversionprovider.jar | 27.2 kB | 2 | 02-Oct-2005 20:06 | OliverTreichel | |
jar |
subversionproviderFor2_4_4.jar | 29.4 kB | 1 | 16-May-2006 08:47 | 212.202.227.220 | |
jar |
subversionprovider_20090112.ja... | 95.0 kB | 1 | 12-Jan-2009 14:55 | joergd | attachment bugfix, upgraded for svnkit 1.2.1 |
jar |
subversionprovider_latest.jar | 32.6 kB | 5 | 12-Jan-2009 15:03 | joergd | attachment bugfix, upgraded for svnkit 1.2.1 |
jar |
subversionprovider_with_svnkit... | 27.2 kB | 1 | 18-Jan-2007 18:00 | alexander |