[opencms-dev] Synchronize command in CmsShell
Jonathan Woods
jonathan.woods at scintillance.com
Fri Aug 18 22:40:16 CEST 2006
Stefan -
Jolly useful - thanks.
You don't have to wait until your code's included in the OpenCms code base.
You can create a class which implements I_CmsShellCommands, and use that in
the constructor for CmsShell in a static void main(String[] args) method
along the lines of CmsShell's equivalent, and lo! you'll have a custom
CmsShell in which you can implement any commands you like, including your
synchronisation stuff. I've found this particularly useful for
semi-automating module build updates.
Jon
_____
From: opencms-dev-bounces at opencms.org
[mailto:opencms-dev-bounces at opencms.org] On Behalf Of Stefan Uldum Grinsted
Sent: 18 August 2006 13:08
To: opencms-dev at opencms.org
Subject: [opencms-dev] Synchronize command in CmsShell
Hi there.
I've produced the following few, but quite useful lines of code for
org.opencms.main.CmsShellCommands allowing you to use the synchronize
functionality from the CmsShell. I was hoping it could become part of a
future OpenCMS release.
I created this in my build of OpenCMS 6_0_3, so I haven't created any patch,
but I assume that it would also work in the latest from head.
Here is the code:
/**
* This synchronizes an RFS folder with a number of VFS folders.
*
* @param rfsFolder the path to the folder in the "real" file system
* @param vfsFolders a semicolon separated list of VFS paths to
synchronize with
*
* @throws CmsSynchronizeException
* @throws CmsException
*/
public void synchronize(String rfsFolder, String vfsFolders) throws
CmsSynchronizeException, CmsException {
CmsSynchronizeSettings settings = new CmsSynchronizeSettings();
settings.setDestinationPathInRfs(rfsFolder);
settings.setEnabled(true);
String[] folders = vfsFolders.split(";");
settings.setSourceListInVfs(Arrays.asList(folders));
new CmsSynchronize(m_cms, settings, new
CmsShellReport(m_cms.getRequestContext().getLocale()));
}
Regards
Stefan Uldum Grinsted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20060818/87c920f9/attachment.htm>
More information about the opencms-dev
mailing list