[opencms-dev] Scheduled Synchronization

Uwe König u.koenig at ifu.com
Wed May 10 16:07:53 CEST 2006


Hello all, 

we have some folders in the RFS which are synchronized to the VFS. When done manually, this works perfectly. 

We want to run that synchronization as a scheduled Job. I wrote the following code, but it says it cannot lock a resource. Any hints welcome. 
Best regards, 

Uwe König 



The code:

public class SynchronizeJob implements I_CmsScheduledJob {

	public String launch(CmsObject cms, Map parameters) throws Exception {
		
		try {
			System.out.println("Start regular synchronization...");
			CmsSynchronizeSettings settings = new CmsUserSettings(cms).getSynchronizeSettings();
			Locale locale = new Locale("en");
			I_CmsReport report = new CmsLogReport(locale, null);
			CmsSynchronize sync = new CmsSynchronize(cms, settings, report);
			
			if (report.getErrors().size() > 0) {
				List errors = report.getErrors();
				Iterator iter = errors.iterator();
				while (iter.hasNext()) {
					Object error = iter.next();
					System.out.println(error.toString());
				}				
			}
			
			System.out.println("Regular synchronization finished!");
		}
		catch (Exception ex) {
			System.out.println("An exception occurred during the regular synchronization" + ex.getMessage());
		}
		return "return-value of my OpenCMS-cronjob";
	}
}




More information about the opencms-dev mailing list