Class ICalendarEventSynchronization
- java.lang.Object
-
- org.silverpeas.core.calendar.ICalendarEventSynchronization
-
- All Implemented Interfaces:
Initialization
@Service @Singleton public class ICalendarEventSynchronization extends Object implements Initialization
A processor of synchronization of calendar events from a remote calendar into the Silverpeas Calendar Engine. The synchronization works only with remote calendars providing an iCalendar source and only with synchronized-flagged Silverpeas calendars.The synchronization is an import process of calendar events from a remote iCalendar source accessible through the Web in which events can be added, updated but also removed in a Silverpeas calendar. A Silverpeas calendar can be synchronized only if it is marked as a synchronized one ; a synchronized calendar in Silverpeas is the exact copy or image of a remote calendar at one given instant. So, the synchronization follows the rules below:
- any events in the iCalendar source that aren't in the Silverpeas calendar are added;
- any events in the iCalendar source that are yet in the Silverpeas calendar replace their counterpart in the Silverpeas calendar;
- any events in the Silverpeas calendar that aren't in the iCalendar source are deleted.
As consequently, any changes done by hand in a synchronized calendar will be lost at the end of its synchronization.
- Author:
- mmoquillon
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ICalendarEventSynchronization.CalendarBatchSynchronizationErrorEvent
Event notified on a synchronization error by batch.
-
Field Summary
Fields Modifier and Type Field Description static String
REPORT_NAMESPACE
The namespace of the logger used to report the synchronization of a calendar.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ICalendarEventSynchronization
get()
Gets an instance of a synchronization processor.void
init()
Initializes some resources required by the services or performs some initialization processes at Silverpeas startup.void
release()
Releases the previously initialized resources at Silverpeas shutdown.ICalendarImportResult
synchronize(Calendar calendar)
Synchronizes the specified calendar in Silverpeas with the calendar events coming from its external counterpart (its origin).void
synchronizeAll()
Synchronizes all the synchronized calendars in Silverpeas with their remote external counterpart.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.silverpeas.core.initialization.Initialization
getPriority
-
-
-
-
Field Detail
-
REPORT_NAMESPACE
public static final String REPORT_NAMESPACE
The namespace of the logger used to report the synchronization of a calendar.- See Also:
- Constant Field Values
-
-
Method Detail
-
get
public static ICalendarEventSynchronization get()
Gets an instance of a synchronization processor.- Returns:
- a calendar synchronization processor.
-
init
public void init() throws Exception
Description copied from interface:Initialization
Initializes some resources required by the services or performs some initialization processes at Silverpeas startup.- Specified by:
init
in interfaceInitialization
- Throws:
Exception
- if an error occurs during the initialization process. In this case the Silverpeas startup fails.
-
release
public void release() throws Exception
Description copied from interface:Initialization
Releases the previously initialized resources at Silverpeas shutdown. The implementation of this method is optional. By default it does nothing.- Specified by:
release
in interfaceInitialization
- Throws:
Exception
- if an error occurs during the shutdown process. In this case, a log will be outputed and the shutdown goes one.
-
synchronize
public ICalendarImportResult synchronize(Calendar calendar) throws ImportException
Synchronizes the specified calendar in Silverpeas with the calendar events coming from its external counterpart (its origin).If the specified calendar isn't a synchronized one, then an
IllegalArgumentException
is thrown.The calendar must exist in Silverpeas otherwise an
IllegalArgumentException
is thrown.- Parameters:
calendar
- a synchronized calendar in Silverpeas.- Returns:
- the result of the synchronization with the number of events that was added, updated and deleted in the calendar.
- Throws:
ImportException
- exception thrown if the synchronization fails.
-
synchronizeAll
public void synchronizeAll() throws ImportException
Synchronizes all the synchronized calendars in Silverpeas with their remote external counterpart. Each synchronization of a calendar will be done as they were requested by their creator.The synchronized calendars will be synchronized in a fixed pool of threads whose the size is provided by the
calendar.synchronization.processors
property in theorg.silverpeas.calendar.settings.calendar.properties
properties file. If no such number is set in the settings, then the size of the pool is computed by this method according to the number of available processors in the runtime. This will ensure that only a subset of calendars are synchronized simultaneously to avoid of overloading Silverpeas.- Throws:
ImportException
- if the synchronization fails to start for at least one of the calendar.
-
-