Package org.apache.sling.api.resource

# Interface ModifyingResourceProvider

All Superinterfaces:
  `ResourceProvider`

@Deprecated @ConsumerType public interface ModifyingResourceProvider extends ResourceProvider
Deprecated.
Use the `ResourceProvider`
A modifying resource provider is an extension of a resource provider which is only supported if the resource provider has been created through a `ResourceProviderFactory`. A modifying resource provider allows to create, update, and delete resources. Update is handled through `ModifiableValueMap`. All changes should be kept in a transient store until `commit(ResourceResolver)` is called. `revert(ResourceResolver)` discards all transient changes. If the modifying resource provider needs to clean up resources when it is discarded like removing objects from the transient state which are not committed etc., it should also implement the `DynamicResourceProvider` interface.

Since:
  2.2 (Sling API Bundle 2.2.0)
See Also:
  - `ResourceProviderFactory.getResourceProvider(java.util.Map)`
  - `ResourceProviderFactory.getAdministrativeResourceProvider(java.util.Map)`

## Field Summary

### Fields inherited from interface org.apache.sling.api.resource.ResourceProvider

`OWNS_ROOTS, RESOURCE_TYPE_SYNTHETIC, ROOTS, SERVICE_NAME, USE_RESOURCE_ACCESS_SECURITY`

## Method Summary

Modifier and Type
Method
Description
`void`
`commit(ResourceResolver resolver)`
Deprecated.
Commit all transient changes: create, delete and updates
`Resource`
`create(ResourceResolver resolver, String path, Map<String,Object> properties)`
Deprecated.
Create a new resource at the given path.
`void`
`delete(ResourceResolver resolver, String path)`
Deprecated.
Delete the resource at the given path.
`boolean`
`hasChanges(ResourceResolver resolver)`
Deprecated.
Are there any transient changes?
`void`
`revert(ResourceResolver resolver)`
Deprecated.
Revert all transient changes: create, delete and updates.

### Methods inherited from interface org.apache.sling.api.resource.ResourceProvider

`getResource, getResource, listChildren`

## Method Details

### create

Resource create(ResourceResolver resolver, String path, Map<String,Object> properties) throws PersistenceException
Deprecated.
Create a new resource at the given path. The new resource is put into the transient space of this provider until `commit(ResourceResolver)` is called. A resource provider should value `ResourceResolver.PROPERTY_RESOURCE_TYPE` to set the resource type of a resource.

Parameters:
  `resolver` - The current resource resolver.
  `path` - The resource path.
  `properties` - Optional properties
Returns:
  The new resource.
Throws:
  `PersistenceException` - If anything fails

### delete

void delete(ResourceResolver resolver, String path) throws PersistenceException
Deprecated.
Delete the resource at the given path. This change is kept in the transient space of this provider until `commit(ResourceResolver)` is called.

Parameters:
  `resolver` - The current resource resolver.
  `path` - The resource path.
Throws:
  `PersistenceException` - If anything fails

### revert

void revert(ResourceResolver resolver)
Deprecated.
Revert all transient changes: create, delete and updates.

Parameters:
  `resolver` - The current resource resolver.

### commit

void commit(ResourceResolver resolver) throws PersistenceException
Deprecated.
Commit all transient changes: create, delete and updates

Parameters:
  `resolver` - The current resource resolver.
Throws:
  `PersistenceException` - If anything fails

### hasChanges

boolean hasChanges(ResourceResolver resolver)
Deprecated.
Are there any transient changes?

Parameters:
  `resolver` - The current resource resolver.
Returns:
  `true` if there are pending changes.