public abstract class AbstractDistributionPackageBuilder extends Object implements DistributionPackageBuilder
DistributionPackageBuilder
Modifier | Constructor and Description |
---|---|
protected |
AbstractDistributionPackageBuilder(String type) |
Modifier and Type | Method and Description |
---|---|
DistributionPackage |
createPackage(org.apache.sling.api.resource.ResourceResolver resourceResolver,
org.apache.sling.distribution.DistributionRequest request)
creates a
DistributionPackage for a specific DistributionRequest |
protected abstract DistributionPackage |
createPackageForAdd(org.apache.sling.api.resource.ResourceResolver resourceResolver,
org.apache.sling.distribution.DistributionRequest request) |
DistributionPackage |
getPackage(org.apache.sling.api.resource.ResourceResolver resourceResolver,
String id)
get an already created (and saved into the repository)
DistributionPackage by its id |
protected abstract DistributionPackage |
getPackageInternal(org.apache.sling.api.resource.ResourceResolver resourceResolver,
String id) |
protected javax.jcr.Session |
getSession(org.apache.sling.api.resource.ResourceResolver resourceResolver) |
String |
getType()
returns the type of a package.
|
boolean |
installPackage(org.apache.sling.api.resource.ResourceResolver resourceResolver,
DistributionPackage distributionPackage)
Installs the given distributionPackage into the repository
|
DistributionPackageInfo |
installPackage(org.apache.sling.api.resource.ResourceResolver resourceResolver,
InputStream stream)
install a stream and returns the associated to a
DistributionPackageInfo this provider can read and install |
protected abstract boolean |
installPackageInternal(org.apache.sling.api.resource.ResourceResolver resourceResolver,
InputStream stream) |
DistributionPackage |
readPackage(org.apache.sling.api.resource.ResourceResolver resourceResolver,
InputStream stream)
reads a stream and tries to convert it to a
DistributionPackage this provider can read and install |
protected abstract DistributionPackage |
readPackageInternal(org.apache.sling.api.resource.ResourceResolver resourceResolver,
InputStream stream) |
protected void |
ungetSession(javax.jcr.Session session) |
protected AbstractDistributionPackageBuilder(String type)
public String getType()
DistributionPackageBuilder
getType
in interface DistributionPackageBuilder
@Nonnull public DistributionPackage createPackage(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull org.apache.sling.distribution.DistributionRequest request) throws DistributionException
DistributionPackageBuilder
DistributionPackage
for a specific DistributionRequest
createPackage
in interface DistributionPackageBuilder
resourceResolver
- the resource resolver used to access the resources to be packagedrequest
- the DistributionRequest
to create the package forDistributionPackage
or null
if it could not be createdDistributionException
- if any error occurs while creating the package, or if the resource resolver is not authorized to do that@Nonnull public DistributionPackage readPackage(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull InputStream stream) throws DistributionException
DistributionPackageBuilder
DistributionPackage
this provider can read and installreadPackage
in interface DistributionPackageBuilder
resourceResolver
- resource resolver used to store the eventually created packagestream
- the InputStream
of the package to readDistributionPackage
if it can read it from the streamDistributionException
- when the stream cannot be read as a DistributionPackage
public boolean installPackage(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull DistributionPackage distributionPackage) throws DistributionException
DistributionPackageBuilder
installPackage
in interface DistributionPackageBuilder
resourceResolver
- the resource resolver used to install the packaged resourcesdistributionPackage
- the distribution package to installtrue
if the package was installed successfullyDistributionException
@Nonnull public DistributionPackageInfo installPackage(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull InputStream stream) throws DistributionException
DistributionPackageBuilder
DistributionPackageInfo
this provider can read and installinstallPackage
in interface DistributionPackageBuilder
resourceResolver
- resource resolver used to store the eventually created packagestream
- the InputStream
of the package to readDistributionPackage
if it can read it from the streamDistributionException
- when the stream cannot be read as a DistributionPackage
@CheckForNull public DistributionPackage getPackage(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull String id)
DistributionPackageBuilder
DistributionPackage
by its idgetPackage
in interface DistributionPackageBuilder
resourceResolver
- resource resolver used to access the package with the given idid
- the unique identifier of an already created DistributionPackage
DistributionPackage
if one with such an id exists, null
otherwiseprotected javax.jcr.Session getSession(org.apache.sling.api.resource.ResourceResolver resourceResolver) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
protected void ungetSession(javax.jcr.Session session)
@CheckForNull protected abstract DistributionPackage createPackageForAdd(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull org.apache.sling.distribution.DistributionRequest request) throws DistributionException
DistributionException
@CheckForNull protected abstract DistributionPackage readPackageInternal(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull InputStream stream) throws DistributionException
DistributionException
protected abstract boolean installPackageInternal(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull InputStream stream) throws DistributionException
DistributionException
@CheckForNull protected abstract DistributionPackage getPackageInternal(@Nonnull org.apache.sling.api.resource.ResourceResolver resourceResolver, @Nonnull String id)
Copyright © 2007–2016 The Apache Software Foundation. All rights reserved.