Class OnDeployScriptBase
java.lang.Object
com.adobe.acs.commons.ondeploy.scripts.OnDeployScriptBase
- All Implemented Interfaces:
OnDeployScript
Base on-deploy script implementation.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidexecute()Execute the script.final voidexecute(org.apache.sling.api.resource.ResourceResolver resourceResolver) Execute the script, passing in a resourceResolver instance.protected final javax.jcr.NodegetOrCreateNode(String absolutePath) Retrieve a node, or create it if not present.protected final javax.jcr.NodegetOrCreateNode(String absolutePath, String nodeType) Retrieve a node, or create it if not present.protected final javax.jcr.NodegetOrCreateNode(String absolutePath, String intermediateNodeType, String nodeType) Retrieve a node, or create it if not present.protected final com.day.cq.wcm.api.PageManagerprotected final org.apache.sling.api.resource.ResourceResolverprotected final javax.jcr.Sessionprotected final javax.jcr.Workspaceprotected final voidremoveResource(String path) Remove node at a given path.protected final voidrenameProperty(javax.jcr.Node node, String oldPropertyName, String newPropertyName) Rename a property on a node.protected final voidrenameProperty(org.apache.sling.api.resource.Resource resource, String oldPropertyName, String newPropertyName) Rename a property on a resource.protected final voidsearchAndUpdateResourceType(String oldResourceType, String newResourceType) Searches for the current sling:resourceType under /content and replaces any nodes it finds with the newResourceType.protected final voidupdateResourceType(javax.jcr.Node node, String resourceType) Update the sling:resourceType of a node.
-
Field Details
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Details
-
OnDeployScriptBase
public OnDeployScriptBase()
-
-
Method Details
-
execute
public final void execute(org.apache.sling.api.resource.ResourceResolver resourceResolver) Description copied from interface:OnDeployScriptExecute the script, passing in a resourceResolver instance.- Specified by:
executein interfaceOnDeployScript- Parameters:
resourceResolver- Resource resolver.- See Also:
-
execute
Execute the script.This function must be implemented by all scripts.
- Throws:
Exception
-
getOrCreateNode
protected final javax.jcr.Node getOrCreateNode(String absolutePath) throws javax.jcr.RepositoryException Retrieve a node, or create it if not present.The node, as well as non-existent parent nodes, are created as type nt:unstructured.
- Parameters:
absolutePath- Path to fetch or create.- Returns:
- The fetched or created node.
- Throws:
javax.jcr.RepositoryException
-
getOrCreateNode
protected final javax.jcr.Node getOrCreateNode(String absolutePath, String nodeType) throws javax.jcr.RepositoryException Retrieve a node, or create it if not present.If the node does not exist, it is created as the specified nodeType.
Non-existent parent nodes are created as type nt:unstructured.
- Parameters:
absolutePath- Path to fetch or create.nodeType- The type of node to create.- Returns:
- The fetched or created node.
- Throws:
javax.jcr.RepositoryException
-
getOrCreateNode
protected final javax.jcr.Node getOrCreateNode(String absolutePath, String intermediateNodeType, String nodeType) throws javax.jcr.RepositoryException Retrieve a node, or create it if not present.If the node does not exist, it is created as the specified nodeType.
Non-existent parent nodes are created as the type specified by intermediateNodeType.
- Parameters:
absolutePath- Path to fetch or create.intermediateNodeType- The type of intermediate nodes to create.nodeType- The type of node to create.- Returns:
- The fetched or created node.
- Throws:
javax.jcr.RepositoryException
-
renameProperty
protected final void renameProperty(javax.jcr.Node node, String oldPropertyName, String newPropertyName) throws javax.jcr.RepositoryException Rename a property on a node.- Parameters:
node- Node to update the property name on.oldPropertyName- Old property name.newPropertyName- New property name.- Throws:
javax.jcr.RepositoryException
-
renameProperty
protected final void renameProperty(org.apache.sling.api.resource.Resource resource, String oldPropertyName, String newPropertyName) Rename a property on a resource.- Parameters:
resource- Resource to update the property name on.oldPropertyName- Old property name.newPropertyName- New property name.
-
removeResource
Remove node at a given path.- Parameters:
path- Path to the node to remove.- Throws:
javax.jcr.RepositoryException
-
searchAndUpdateResourceType
protected final void searchAndUpdateResourceType(String oldResourceType, String newResourceType) throws javax.jcr.RepositoryException Searches for the current sling:resourceType under /content and replaces any nodes it finds with the newResourceType.- Parameters:
oldResourceType- The current sling:resourceType.newResourceType- The new sling:resourceType to be used.- Throws:
javax.jcr.RepositoryException
-
updateResourceType
protected final void updateResourceType(javax.jcr.Node node, String resourceType) throws javax.jcr.RepositoryException Update the sling:resourceType of a node.- Parameters:
node- The node to update.resourceType- The new sling:resourceType to be used.- Throws:
javax.jcr.RepositoryException
-
getResourceResolver
protected final org.apache.sling.api.resource.ResourceResolver getResourceResolver() -
getPageManager
protected final com.day.cq.wcm.api.PageManager getPageManager() -
getSession
protected final javax.jcr.Session getSession() -
getWorkspace
protected final javax.jcr.Workspace getWorkspace()
-