public class DistributionPackageUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
PACKAGE_INFO_PROPERTY_REQUEST_ID |
static String |
PACKAGE_INFO_PROPERTY_REQUEST_START_TIME |
static String |
PACKAGE_INFO_PROPERTY_REQUEST_USER
distribution request user
|
static String |
PROPERTY_REMOTE_PACKAGE_ID |
Constructor and Description |
---|
DistributionPackageUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
acquire(DistributionPackage distributionPackage,
String... queueNames)
Acquires the package if it's a
SharedDistributionPackage , via SharedDistributionPackage.acquire(String[]) |
static void |
acquire(File file,
@NotNull String[] holderNames) |
static void |
acquire(org.apache.sling.api.resource.Resource resource,
@NotNull String[] holderNames) |
static void |
closeSafely(DistributionPackage distributionPackage) |
static InputStream |
createStreamWithHeader(DistributionPackage distributionPackage) |
static boolean |
disposable(@NotNull org.apache.sling.api.resource.Resource resource) |
static void |
fillInfo(DistributionPackageInfo info,
org.apache.sling.distribution.DistributionRequest request) |
static DistributionPackageInfo |
fromQueueItem(DistributionQueueItem queueItem)
Create a
DistributionPackageInfo from a queue item |
static org.apache.sling.api.resource.Resource |
getPackagesRoot(org.apache.sling.api.resource.ResourceResolver resourceResolver,
String packagesRootPath) |
static String |
getQueueName(DistributionPackageInfo packageInfo) |
static InputStream |
getStream(org.apache.sling.api.resource.Resource resource) |
static void |
mergeQueueEntry(DistributionPackageInfo packageInfo,
DistributionQueueEntry entry) |
static void |
readInfo(InputStream inputStream,
Map<String,Object> info) |
static void |
release(DistributionPackage distributionPackage,
String... queueNames)
Releases the package if it's a
SharedDistributionPackage , via SharedDistributionPackage.release(String[]) |
static boolean |
release(File file,
@NotNull String[] holderNames) |
static void |
release(org.apache.sling.api.resource.Resource resource,
@NotNull String[] holderNames) |
static void |
releaseOrDelete(DistributionPackage distributionPackage,
String... queueNames)
Releases a distribution package if it's a
SharedDistributionPackage , otherwise deletes it. |
static DistributionQueueItem |
toQueueItem(DistributionPackage distributionPackage)
Create a queue item out of a package
|
static void |
uploadStream(org.apache.sling.api.resource.Resource resource,
InputStream stream) |
static void |
writeInfo(OutputStream outputStream,
Map<String,Object> info) |
public static final String PROPERTY_REMOTE_PACKAGE_ID
public static final String PACKAGE_INFO_PROPERTY_REQUEST_USER
public static final String PACKAGE_INFO_PROPERTY_REQUEST_ID
public static final String PACKAGE_INFO_PROPERTY_REQUEST_START_TIME
public static void acquire(DistributionPackage distributionPackage, String... queueNames)
SharedDistributionPackage
, via SharedDistributionPackage.acquire(String[])
distributionPackage
- a distribution packagequeueNames
- the name of the queue in which the package should be acquiredpublic static void release(DistributionPackage distributionPackage, String... queueNames)
SharedDistributionPackage
, via SharedDistributionPackage.release(String[])
distributionPackage
- a distribution packagequeueNames
- the name of the queue in which the package should be releasedpublic static void releaseOrDelete(DistributionPackage distributionPackage, String... queueNames)
SharedDistributionPackage
, otherwise deletes it.distributionPackage
- a distribution packagequeueNames
- the name of the queue from which it should be eventually releasedpublic static void closeSafely(DistributionPackage distributionPackage)
public static DistributionQueueItem toQueueItem(DistributionPackage distributionPackage)
distributionPackage
- a distribution packagepublic static DistributionPackageInfo fromQueueItem(DistributionQueueItem queueItem)
DistributionPackageInfo
from a queue itemqueueItem
- a distribution queue itemDistributionPackageInfo
public static String getQueueName(DistributionPackageInfo packageInfo)
public static void mergeQueueEntry(DistributionPackageInfo packageInfo, DistributionQueueEntry entry)
public static void fillInfo(DistributionPackageInfo info, org.apache.sling.distribution.DistributionRequest request)
public static InputStream createStreamWithHeader(DistributionPackage distributionPackage) throws IOException
IOException
public static void readInfo(InputStream inputStream, Map<String,Object> info)
public static void writeInfo(OutputStream outputStream, Map<String,Object> info)
public static org.apache.sling.api.resource.Resource getPackagesRoot(org.apache.sling.api.resource.ResourceResolver resourceResolver, String packagesRootPath) throws org.apache.sling.api.resource.PersistenceException
org.apache.sling.api.resource.PersistenceException
public static InputStream getStream(org.apache.sling.api.resource.Resource resource) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void uploadStream(org.apache.sling.api.resource.Resource resource, InputStream stream) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void acquire(org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String[] holderNames) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static boolean disposable(@NotNull @NotNull org.apache.sling.api.resource.Resource resource) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void release(org.apache.sling.api.resource.Resource resource, @NotNull @NotNull String[] holderNames) throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
public static void acquire(File file, @NotNull @NotNull String[] holderNames) throws IOException
IOException
public static boolean release(File file, @NotNull @NotNull String[] holderNames) throws IOException
IOException
Copyright © 2007–2018 The Apache Software Foundation. All rights reserved.