Package com.adobe.acs.commons.packaging
Interface PackageHelper
@ProviderType
public interface PackageHelper
Helper interface for dynamic package creation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumNone: If conflicting package exists; fail to create a new package. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidaddThumbnail(org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage, org.apache.sling.api.resource.Resource thumbnailResource) Adds the thumbnail resource to the package as the package thumbnail.org.apache.jackrabbit.vault.packaging.JcrPackagecreatePackage(Collection<org.apache.sling.api.resource.Resource> resources, javax.jcr.Session session, String groupName, String name, String version, PackageHelper.ConflictResolution conflictResolution, Map<String, String> packageDefinitionProperties) org.apache.jackrabbit.vault.packaging.JcrPackagecreatePackageForPaths(Collection<String> paths, javax.jcr.Session session, String groupName, String name, String version, PackageHelper.ConflictResolution conflictResolution, Map<String, String> packageDefinitionProperties) org.apache.jackrabbit.vault.packaging.JcrPackagecreatePackageFromPathFilterSets(Collection<org.apache.jackrabbit.vault.fs.api.PathFilterSet> pathFilterSets, javax.jcr.Session session, String groupName, String name, String version, PackageHelper.ConflictResolution conflictResolution, Map<String, String> packageDefinitionProperties) getContents(org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage) returns a list of the JCR resource paths includes in the built JcrPackagegetErrorJSON(String msg) Returns the JSON to return in the event of an unsuccessful packaging.org.apache.jackrabbit.vault.packaging.VersiongetNextVersion(org.apache.jackrabbit.vault.packaging.JcrPackageManager jcrPackageManager, String groupName, String name, String version) Derives the next package version to use based on the input params and the existing package versions matching the input Package group and name.getPathFilterSetPreviewJSON(Collection<org.apache.jackrabbit.vault.fs.api.PathFilterSet> pathFilterSets) Returns the JSON to return reporting what the packager definition will include for the filterSets.getPreviewJSON(Collection<org.apache.sling.api.resource.Resource> resources) Returns the JSON to return reporting what the packager definition will include for filterSet roots.getPreviewJSONForPaths(Collection<String> paths) Returns the JSON to return reporting what the packager definition will include for filterSet roots.getSuccessJSON(org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage) Returns the JSON to return in the event of a successful packaging.voidremovePackage(org.apache.jackrabbit.vault.packaging.JcrPackageManager jcrPackageManager, String groupName, String name, String version) Deletes the package node from the repository.
-
Field Details
-
DEFAULT_PACKAGE_THUMBNAIL_RESOURCE_PATH
JCR Path to default ACS thumbnail resource.- See Also:
-
-
Method Details
-
addThumbnail
void addThumbnail(org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage, org.apache.sling.api.resource.Resource thumbnailResource) Adds the thumbnail resource to the package as the package thumbnail. If the thumbnailResource is null or not a valid thumbnail resource, a default ACS Package thumbnail will be used.- Parameters:
jcrPackage- The package to add the thumbnail to.thumbnailResource- The JCR resource that is the thumbnail to be used as the package's thumbnail
-
getNextVersion
org.apache.jackrabbit.vault.packaging.Version getNextVersion(org.apache.jackrabbit.vault.packaging.JcrPackageManager jcrPackageManager, String groupName, String name, String version) throws javax.jcr.RepositoryException Derives the next package version to use based on the input params and the existing package versions matching the input Package group and name. Next version increments "minor" version only. Ex. 1.0.0 ~> 1.1.0 3.22.0 ~> 3.23.0 If the param version's major is greater than the largest existing package version in jcr, then the param version will be used. Ex. param ~> 2.0.0, largest in jcr ~> 1.40.0; returned version will be 2.0.0- Parameters:
jcrPackageManager- JcrPackageManager objectgroupName- package group namename- package nameversion- package version- Returns:
- the next version based on existing versions in the jcr
- Throws:
javax.jcr.RepositoryException
-
removePackage
void removePackage(org.apache.jackrabbit.vault.packaging.JcrPackageManager jcrPackageManager, String groupName, String name, String version) throws javax.jcr.RepositoryException Deletes the package node from the repository. This does NOT uninstall the package, rather deletes the package node under /etc/packages/[package-group]- Parameters:
jcrPackageManager- JcrPackageManager objectgroupName- package group namename- package nameversion- package version- Throws:
javax.jcr.RepositoryException
-
createPackageFromPathFilterSets
org.apache.jackrabbit.vault.packaging.JcrPackage createPackageFromPathFilterSets(Collection<org.apache.jackrabbit.vault.fs.api.PathFilterSet> pathFilterSets, javax.jcr.Session session, String groupName, String name, String version, PackageHelper.ConflictResolution conflictResolution, Map<String, String> packageDefinitionProperties) throws IOException, javax.jcr.RepositoryException- Parameters:
pathFilterSets- the pathFilterSets that define packagesession- JCR Session obj; must have access to create packages under /etc/packagesgroupName- package group namename- package nameversion- package versionconflictResolution- determines how package creation will be handled in the event of an existing package of the same package group, package name, and version classpackageDefinitionProperties- properties that will be added to the package definition- Returns:
- the jcr package that was created, or null
- Throws:
IOExceptionjavax.jcr.RepositoryException
-
createPackage
org.apache.jackrabbit.vault.packaging.JcrPackage createPackage(Collection<org.apache.sling.api.resource.Resource> resources, javax.jcr.Session session, String groupName, String name, String version, PackageHelper.ConflictResolution conflictResolution, Map<String, String> packageDefinitionProperties) throws IOException, javax.jcr.RepositoryException- Parameters:
resources- the resources to include in the packagesession- JCR Session obj; must have access to create packages under /etc/packagesgroupName- package group namename- package nameversion- package versionconflictResolution- determines how package creation will be handled in the event of an existing package of the same package group, package name, and version classpackageDefinitionProperties- properties that will be added to the package definition- Returns:
- the jcr package that was created, or null
- Throws:
IOExceptionjavax.jcr.RepositoryException
-
getContents
List<String> getContents(org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage) throws IOException, javax.jcr.RepositoryException, org.apache.jackrabbit.vault.packaging.PackageException returns a list of the JCR resource paths includes in the built JcrPackage- Parameters:
jcrPackage- the jcr package- Returns:
- a list of absolute (starting with /) paths of the JCR resources included in the package
- Throws:
IOExceptionjavax.jcr.RepositoryExceptionorg.apache.jackrabbit.vault.packaging.PackageException
-
getSuccessJSON
String getSuccessJSON(org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage) throws javax.jcr.RepositoryException Returns the JSON to return in the event of a successful packaging.- Parameters:
jcrPackage- the successfully created jcr package- Returns:
- a string representation of JSON to write to response
- Throws:
javax.jcr.RepositoryException
-
getPreviewJSON
Returns the JSON to return reporting what the packager definition will include for filterSet roots.- Parameters:
resources- the resources that represent the filterSet roots- Returns:
- a string representation of JSON to write to response
-
getPathFilterSetPreviewJSON
String getPathFilterSetPreviewJSON(Collection<org.apache.jackrabbit.vault.fs.api.PathFilterSet> pathFilterSets) Returns the JSON to return reporting what the packager definition will include for the filterSets.- Parameters:
pathFilterSets- the pathFilterSets of the package- Returns:
- a string representation of JSON to write to response
-
getErrorJSON
Returns the JSON to return in the event of an unsuccessful packaging.- Parameters:
msg- the error message to display- Returns:
- a string representation of JSON to write to response
-
getPreviewJSONForPaths
Returns the JSON to return reporting what the packager definition will include for filterSet roots.- Parameters:
paths- the paths that represent the filterSet roots- Returns:
- a string representation of JSON to write to response
-
createPackageForPaths
org.apache.jackrabbit.vault.packaging.JcrPackage createPackageForPaths(Collection<String> paths, javax.jcr.Session session, String groupName, String name, String version, PackageHelper.ConflictResolution conflictResolution, Map<String, String> packageDefinitionProperties) throws IOException, javax.jcr.RepositoryException- Parameters:
paths- the resources to include in the packagesession- JCR Session obj; must have access to create packages under /etc/packagesgroupName- package group namename- package nameversion- package versionconflictResolution- determines how package creation will be handled in the event of an existing package of the same package group, package name, and version classpackageDefinitionProperties- properties that will be added to the package definition- Returns:
- the jcr package that was created, or null
- Throws:
IOExceptionjavax.jcr.RepositoryException
-