com.adobe.cq.screens.offlinecontent.OfflineContentService Maven / Gradle / Ivy
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2017 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
************************************************************************/
package com.adobe.cq.screens.offlinecontent;
import aQute.bnd.annotation.ProviderType;
import org.apache.sling.api.resource.PersistenceException;
import org.apache.sling.api.resource.Resource;
import javax.annotation.Nonnull;
import javax.jcr.RepositoryException;
import java.util.Iterator;
/**
* Manages the offline content in the repository.
*/
@ProviderType
public interface OfflineContentService {
/**
* Retrieves the offline configuration node for that channel.
* @param channel The channel for which we want to get the offline config
* @return the offline config resources
*/
@Nonnull
Iterator getOfflineConfigs(@Nonnull Resource channel);
/**
* Get the offline timestamp value for the channel
*
* @param channel The channel
* @return The offline timestamp value, or {@code -1L} if not set
*/
long getOfflineTimestamp(@Nonnull Resource channel);
/**
* Update the offline timestamp property for the channel
*
* @param channel The channel to update
* @param timestamp The new timestamp
* @throws RepositoryException if there is a repository exception
*/
void updateOfflineTimestamp(@Nonnull Resource channel, @Nonnull long timestamp) throws RepositoryException;
/**
* Update the offline content in the context of the specified channel.
*
* @param channel The channel for which we want to recreate the offline content
* @param offlineConfig The offline config resource
* @return the last modification timestamp for the offline config cache
*/
long prepareOfflineContentForChannel(@Nonnull Resource channel, @Nonnull Resource offlineConfig);
/**
* Update the offline content in the context of the specified assignment.
*
* @param assignment The assignment for which we want to recreate the offline content
* @return the last modification timestamp for the offline config cache
* @throws PersistenceException if there was a error preparing the offline content
*/
long prepareOfflineContentForAssignment(@Nonnull Resource assignment) throws PersistenceException;
/**
* Returns the list of configs copied for the provided assignment.
* @param assignment The channel assignment
* @return A list of configs (might be empty)
*/
@Nonnull
Iterator getCopiedOfflineConfig(Resource assignment);
}