Skip to content

Instantly share code, notes, and snippets.

@yupadhyay
Created January 29, 2016 19:25
Show Gist options
  • Save yupadhyay/1fada42d3b2bef239e5d to your computer and use it in GitHub Desktop.
Save yupadhyay/1fada42d3b2bef239e5d to your computer and use it in GitHub Desktop.
ReplicationUtilService.java
package com.wemblog.utility;
import java.util.List;
import org.apache.sling.api.resource.ResourceResolver;
import com.day.cq.replication.Agent;
import com.day.cq.replication.ReplicationActionType;
/**
* Replication Utility Method for some common replication task
* All task are performed using ADMIN user, use
* @author Yogesh Upadhyay
* @since 1.0.12
*
*/
public interface ReplicationUtilService {
/**
* Tree replicate based on given path.
* It is recommended to use more refined path rather than activating parent with a lot of nodes
* Note that all resources under this tree will get activated. Use other settings to make sure that only modified is activated.
* @param parent_path
* @param {@link ResourceResolver}
*/
public void treeReplicate(String parent_path,ResourceResolver resolver);
/**
* Tree replication with {@link ReplicationActionType}
* This will activate or deactivate entire tree
* @param parent_path
* @param {@link ReplicationActionType}
* @param {@link ResourceResolver}
*/
public void treeReplicate(String parent_path, ReplicationActionType actionType, ResourceResolver resolver);
/**
* Tree activation for only modified content
* @param parent_path
* @param onlyModified
* @param {@link ResourceResolver}
*/
public void treeReplicate(String parent_path,boolean onlyModified, ResourceResolver resolver);
/**
* Tree activation for modified and ignore deactivate setting.
* @param parent_path
* @param onlyModified
* @param ignoreDeactivated
* @param {@link ResourceResolver}
*/
public void treeReplicate(String parent_path,boolean onlyModified, boolean ignoreDeactivated, ResourceResolver resolver);
/**
* Method to get all Active Agents
* This include both replication and dispatcher agent
* @return {@link List<Agent>}
*/
public List<Agent> getAllActiveAgents();
/**
* Method to get all active publish agents
* @return
*/
public List<Agent> getAllPublishAgent();
/**
* Method to get all active dispatcher agents
* @return
*/
public List<Agent> getAllDispatcherAgent();
/**
* Simple method to activate a content path
* @param resource_path
* @param {@link ResourceResolver}
*/
public void activate(String resource_path, ResourceResolver resolver);
/**
* Method to deactive a path
* @param resource_path
* @param {@link ResourceResolver}
*/
public void deactivate(String resource_path, ResourceResolver resolver);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment