repository = engine.getRepository(repositoryName);
} catch (NoSuchRepositoryException e) {
throw new StartException(e);
}
RepositoryConfiguration repositoryConfig = repository.getConfiguration();
Editor configEditor = repositoryConfig.edit();
EditableDocument textExtracting = configEditor.getOrCreateDocument(FieldName.TEXT_EXTRACTION);
EditableDocument extractors = textExtracting.getOrCreateDocument(FieldName.EXTRACTORS);
EditableDocument extractor = Schematic.newDocument();
String extractorName = extractorProperties.getProperty(FieldName.NAME);
for (Object key : extractorProperties.keySet()) {
String keyStr = (String)key;
if (FieldName.NAME.equals(keyStr)) continue;
Object value = extractorProperties.get(keyStr);
if (value instanceof List<?>) {
for (Object val : (List<?>)value) {
extractor.getOrCreateArray(keyStr).addValue(val);
}
} else {
// Just set the value as a field
extractor.set(keyStr, value);
}
}
extractors.set(extractorName, extractor);
// Get the changes and validate them ...
Changes changes = configEditor.getChanges();
Problems validationResults = repositoryConfig.validate(changes);
if (validationResults.hasErrors()) {
String msg = JcrI18n.errorsInRepositoryConfiguration.text(this.repositoryName,
validationResults.errorCount(),
validationResults.toString());