String canonicalDirPath,
DirectoryMonitorCallback callback,
TimestampPersistenceFactory persistenceFactory,
boolean recursive) throws RegistrationException {
if (null == callback) {
throw new RegistrationException("argument-must-not-be",
new Object[]{"callback", "null"});
}
synchronized(lock) {
boolean found = isRegistered(canonicalDirPath);
// we didn't find the filename so we can add it
if (found) {
throw new RegistrationException(
"directory-already-registered", canonicalDirPath);
} else {
final MonitoredDirectoryInfo mdi = new MonitoredDirectoryInfo(
canonicalDirPath, bundleId, callback,
persistenceFactory, recursive);