use of org.apache.sling.caconfig.spi.ConfigurationPersistenceException in project sling by apache.
the class CustomConfigurationPersistenceStrategy method getOrCreateResource.
private Resource getOrCreateResource(ResourceResolver resourceResolver, String path, Map<String, Object> properties) {
try {
Resource resource = ResourceUtil.getOrCreateResource(resourceResolver, path, DEFAULT_RESOURCE_TYPE, DEFAULT_RESOURCE_TYPE, false);
replaceProperties(resource, properties);
return resource;
} catch (PersistenceException ex) {
throw new ConfigurationPersistenceException("Unable to persist configuration to " + path, ex);
}
}
use of org.apache.sling.caconfig.spi.ConfigurationPersistenceException in project sling by apache.
the class CustomConfigurationPersistenceStrategy2 method deleteConfiguration.
@Override
public boolean deleteConfiguration(ResourceResolver resourceResolver, String configResourcePath) {
Resource resource = resourceResolver.getResource(configResourcePath);
if (resource != null) {
try {
resourceResolver.delete(resource);
} catch (PersistenceException ex) {
throw new ConfigurationPersistenceException("Unable to delete configuration at " + configResourcePath, ex);
}
}
commit(resourceResolver);
return true;
}
use of org.apache.sling.caconfig.spi.ConfigurationPersistenceException in project sling by apache.
the class CustomConfigurationPersistenceStrategy method deleteConfiguration.
@Override
public boolean deleteConfiguration(ResourceResolver resourceResolver, String configResourcePath) {
Resource resource = resourceResolver.getResource(configResourcePath);
if (resource != null) {
try {
resourceResolver.delete(resource);
} catch (PersistenceException ex) {
throw new ConfigurationPersistenceException("Unable to delete configuration at " + configResourcePath, ex);
}
}
commit(resourceResolver);
return true;
}
use of org.apache.sling.caconfig.spi.ConfigurationPersistenceException in project sling by apache.
the class CustomConfigurationPersistenceStrategy2 method getOrCreateResource.
private Resource getOrCreateResource(ResourceResolver resourceResolver, String path, Map<String, Object> properties) {
try {
Resource resource = ResourceUtil.getOrCreateResource(resourceResolver, path, DEFAULT_RESOURCE_TYPE, DEFAULT_RESOURCE_TYPE, false);
replaceProperties(resource, properties);
return resource;
} catch (PersistenceException ex) {
throw new ConfigurationPersistenceException("Unable to persist configuration to " + path, ex);
}
}
Aggregations