Package org.apache.sling.api.resource
Interface ModifyingResourceProvider
- All Superinterfaces:
ResourceProvider
Deprecated.
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:
-
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 TypeMethodDescriptionvoid
commit
(ResourceResolver resolver) Deprecated.Commit all transient changes: create, delete and updatesDeprecated.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 PersistenceExceptionDeprecated.Create a new resource at the given path. The new resource is put into the transient space of this provider untilcommit(ResourceResolver)
is called. A resource provider should valueResourceResolver.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
Deprecated.Delete the resource at the given path. This change is kept in the transient space of this provider untilcommit(ResourceResolver)
is called.- Parameters:
resolver
- The current resource resolver.path
- The resource path.- Throws:
PersistenceException
- If anything fails
-
revert
Deprecated.Revert all transient changes: create, delete and updates.- Parameters:
resolver
- The current resource resolver.
-
commit
Deprecated.Commit all transient changes: create, delete and updates- Parameters:
resolver
- The current resource resolver.- Throws:
PersistenceException
- If anything fails
-
hasChanges
Deprecated.Are there any transient changes?- Parameters:
resolver
- The current resource resolver.- Returns:
true
if there are pending changes.
-
ResourceProvider