org.apache.sling.resource.collection.ResourceCollectionManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aem-sdk-api Show documentation
Show all versions of aem-sdk-api Show documentation
The Adobe Experience Manager SDK
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.sling.resource.collection;
import java.util.Map;
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.osgi.annotation.versioning.ProviderType;
/**
* The {@link ResourceCollectionManager} defines the API to get, create and delete
* resource collections {@link org.apache.sling.resource.collection.ResourceCollection}.
*
* The ResourceCollectionManager service can be retrieved by looking it up from the
* service registry or by adapting a {@link ResourceResolver}.
*/
@ProviderType
public interface ResourceCollectionManager {
/**
* This method returns a resource collection for the given resource
* that represents a {@link ResourceCollection}.
*
* It returns null if given resource is not a collection
*
* @param resource resource that represents a collection
* @return The {@link org.apache.sling.resource.collection.ResourceCollection} representing the collection.
*
*/
ResourceCollection getCollection(Resource resource);
/**
* This method creates a resource collection with a given name under the parentResource
.
* The changes are transient and have to be saved by resourceResolver.commit()
*
* @param parentResource parent resource where collection needs to be created.
* @param name The name for collection.
*
* @return The {@link org.apache.sling.resource.collection.ResourceCollection} representing the created collection.
*
* @throws PersistenceException if the operation fails
*/
ResourceCollection createCollection(Resource parentResource, String name) throws PersistenceException;
/**
* This method creates a resource collection with a given name under the parentResource
.
* The changes are transient and have to be saved by resourceResolver.commit()
*
* @param parentResource parent resource where collection needs to be created.
* @param name The name for collection.
* @param properties The additional data for resource collection
*
* @return The {@link org.apache.sling.resource.collection.ResourceCollection} representing the created collection.
*
* @throws PersistenceException if the operation fails
*/
ResourceCollection createCollection(Resource parentResource, String name, Map properties) throws PersistenceException;
/**
* Removes the {@link org.apache.sling.resource.collection.ResourceCollection} corresponding to the collection represented by
* resource
.
* The changes are transient and have to be saved by resourceResolver.commit()
*
* @param resource resource representing a collection to be deleted.
* @return true
if the collection was successfully removed.
*
* @throws PersistenceException if the operation fails
*/
boolean deleteCollection(Resource resource) throws PersistenceException;
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy