* @param metaModule the metamodule whose metadata to save.
* @param status the tracking status object.
*/
private void saveMetadata(MetaModule metaModule, Status status) {
MetadataManager metadataManager = resourceManagerRegistry.getMetadataManager();
if (metadataManager == null) {
status.add(new Status(Status.Severity.WARNING, "No registered metadata manager for this vault: " + toString(), null));
return;
}
MetadataStore metadataStore = (MetadataStore)metadataManager.getResourceStore();
// Clear old metadata.
metadataStore.removeModuleResources(metaModule.getName(), status);
// Get the features in the module.
Set<CALFeatureName> moduleFeatureNames = metaModule.getFeatureNames();
// Save metadata for each of the features.
for (final CALFeatureName featureName : moduleFeatureNames) {
List<ResourceName> metadataResourceNames = metaModule.getMetadataResourceNamesForAllLocales(featureName);
for (int i = 0, n = metadataResourceNames.size(); i < n; i++) {
ResourceName resourceName = metadataResourceNames.get(i);
Locale locale = LocalizedResourceName.localeOf(resourceName);
if (!metadataManager.saveMetadata(metaModule.getMetadata(featureName, locale), status)) {
status.add(new Status(Status.Severity.WARNING, "Could not save metadata for feature: " + featureName.toString(), null));
}
}
}
}