Class PackageUtil
- java.lang.Object
-
- com.composum.sling.core.pckgmgr.jcrpckg.util.PackageUtil
-
public class PackageUtil extends Object
Helper methods for Package handling (VLT Package Manager)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PackageUtil.DefinitionSetter<T>
static class
PackageUtil.ViewType
-
Field Summary
Fields Modifier and Type Field Description static String
DATE_FORMAT
static String
DEF_AC_HANDLING
static String
DEF_DEPENDENCIES
static String
DEF_DESCRIPTION
static String
DEF_DISABLE_INTERMEDIATE_SAVE
static String
DEF_INCLUDE_VERSIONS
static String
DEF_PROVIDER_LINK
static String
DEF_PROVIDER_NAME
static String
DEF_PROVIDER_URL
static String
DEF_REPLACES
static String
DEF_REQUIRES_RESTART
static String
DEF_REQUIRES_ROOT
static String
DEF_TESTED_WITH
static Map<String,PackageUtil.DefinitionSetter>
DEFINITION_SETTERS
static Pattern
IMPORT_DONE
static String
THUMBNAIL_PNG
-
Constructor Summary
Constructors Constructor Description PackageUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
equals(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String key, String value)
static void
getCoverage(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, javax.jcr.Session session, org.apache.jackrabbit.vault.fs.api.ProgressTrackerListener listener)
static Calendar
getCreated(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
static String
getCreatedBy(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
static <T> T
getDefAttr(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String key, T defaultValue)
static String
getDownloadUrl(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
static String
getFilename(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
static org.apache.jackrabbit.vault.fs.api.WorkspaceFilter
getFilter(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef)
static List<org.apache.jackrabbit.vault.fs.api.PathFilterSet>
getFilterList(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef)
static String
getGroupPath(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
static String
getGroupPath(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef)
static org.apache.jackrabbit.vault.packaging.JcrPackage
getJcrPackage(org.apache.jackrabbit.vault.packaging.JcrPackageManager manager, String group, String name)
static org.apache.jackrabbit.vault.packaging.JcrPackage
getJcrPackage(org.apache.jackrabbit.vault.packaging.JcrPackageManager manager, org.apache.sling.api.resource.Resource resource)
static Calendar
getLastModified(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
static String
getLastModifiedBy(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
static String[]
getMultiProperty(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String key)
static org.apache.jackrabbit.vault.packaging.PackageId
getPackageId(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
Returns thePackageId
; null in case of errors.static org.apache.jackrabbit.vault.packaging.JcrPackageManager
getPackageManager(org.apache.jackrabbit.vault.packaging.Packaging packaging, org.apache.sling.api.SlingHttpServletRequest request)
Retrieves a package manager for the JCR session.static String
getPackagePath(org.apache.jackrabbit.vault.packaging.JcrPackageManager pckgMgr, org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
static String
getPath(org.apache.sling.api.SlingHttpServletRequest request)
static org.apache.sling.api.resource.Resource
getResource(org.apache.jackrabbit.vault.packaging.JcrPackageManager manager, org.apache.sling.api.SlingHttpServletRequest request, String path)
static String
getThumbnailPath(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef)
static TreeNode
getTreeNode(org.apache.jackrabbit.vault.packaging.JcrPackageManager manager, org.apache.sling.api.SlingHttpServletRequest request)
static PackageUtil.ViewType
getViewType(com.composum.sling.core.BeanContext context, org.apache.sling.api.SlingHttpServletRequest request, String path)
static boolean
isGroup(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String group)
static boolean
isName(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String name)
static boolean
isVersion(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String version)
static String
packageToXMLResponse(org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage)
static void
setLastModified(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef)
static void
setLastModified(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, Calendar time)
static void
setThumbnail(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, org.apache.sling.api.resource.ResourceResolver resolver, InputStream pngStream)
static void
toJson(com.google.gson.stream.JsonWriter writer, org.apache.jackrabbit.vault.packaging.JcrPackageDefinition definition)
static void
toJson(com.google.gson.stream.JsonWriter writer, org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage, Map<String,Object> additionalAttributes)
-
-
-
Field Detail
-
DATE_FORMAT
public static final String DATE_FORMAT
- See Also:
- Constant Field Values
-
THUMBNAIL_PNG
public static final String THUMBNAIL_PNG
- See Also:
- Constant Field Values
-
DEF_AC_HANDLING
public static final String DEF_AC_HANDLING
- See Also:
- Constant Field Values
-
DEF_DEPENDENCIES
public static final String DEF_DEPENDENCIES
- See Also:
- Constant Field Values
-
DEF_DESCRIPTION
public static final String DEF_DESCRIPTION
- See Also:
- Constant Field Values
-
DEF_DISABLE_INTERMEDIATE_SAVE
public static final String DEF_DISABLE_INTERMEDIATE_SAVE
- See Also:
- Constant Field Values
-
DEF_PROVIDER_LINK
public static final String DEF_PROVIDER_LINK
- See Also:
- Constant Field Values
-
DEF_PROVIDER_NAME
public static final String DEF_PROVIDER_NAME
- See Also:
- Constant Field Values
-
DEF_PROVIDER_URL
public static final String DEF_PROVIDER_URL
- See Also:
- Constant Field Values
-
DEF_REPLACES
public static final String DEF_REPLACES
- See Also:
- Constant Field Values
-
DEF_REQUIRES_RESTART
public static final String DEF_REQUIRES_RESTART
- See Also:
- Constant Field Values
-
DEF_REQUIRES_ROOT
public static final String DEF_REQUIRES_ROOT
- See Also:
- Constant Field Values
-
DEF_TESTED_WITH
public static final String DEF_TESTED_WITH
- See Also:
- Constant Field Values
-
DEF_INCLUDE_VERSIONS
public static final String DEF_INCLUDE_VERSIONS
- See Also:
- Constant Field Values
-
IMPORT_DONE
public static final Pattern IMPORT_DONE
-
DEFINITION_SETTERS
public static final Map<String,PackageUtil.DefinitionSetter> DEFINITION_SETTERS
-
-
Method Detail
-
getPackageManager
@Nonnull public static org.apache.jackrabbit.vault.packaging.JcrPackageManager getPackageManager(@Nonnull org.apache.jackrabbit.vault.packaging.Packaging packaging, @Nonnull org.apache.sling.api.SlingHttpServletRequest request) throws javax.jcr.RepositoryException
Retrieves a package manager for the JCR session.- Throws:
javax.jcr.RepositoryException
-
getPath
public static String getPath(org.apache.sling.api.SlingHttpServletRequest request)
-
getResource
public static org.apache.sling.api.resource.Resource getResource(org.apache.jackrabbit.vault.packaging.JcrPackageManager manager, org.apache.sling.api.SlingHttpServletRequest request, String path) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getJcrPackage
public static org.apache.jackrabbit.vault.packaging.JcrPackage getJcrPackage(org.apache.jackrabbit.vault.packaging.JcrPackageManager manager, String group, String name) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getJcrPackage
public static org.apache.jackrabbit.vault.packaging.JcrPackage getJcrPackage(org.apache.jackrabbit.vault.packaging.JcrPackageManager manager, org.apache.sling.api.resource.Resource resource) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getPackagePath
public static String getPackagePath(org.apache.jackrabbit.vault.packaging.JcrPackageManager pckgMgr, org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
-
getPackageId
@Nullable public static org.apache.jackrabbit.vault.packaging.PackageId getPackageId(@Nullable org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
Returns thePackageId
; null in case of errors.
-
getViewType
public static PackageUtil.ViewType getViewType(com.composum.sling.core.BeanContext context, org.apache.sling.api.SlingHttpServletRequest request, String path)
-
getGroupPath
@Nullable public static String getGroupPath(@Nullable org.apache.jackrabbit.vault.packaging.JcrPackage pckg) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getGroupPath
@Nullable public static String getGroupPath(@Nullable org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef)
-
isGroup
public static boolean isGroup(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String group)
-
isName
public static boolean isName(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String name)
-
isVersion
public static boolean isVersion(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String version)
-
equals
public static boolean equals(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String key, String value)
-
getFilename
public static String getFilename(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
-
getDownloadUrl
public static String getDownloadUrl(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
-
getDefAttr
public static <T> T getDefAttr(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, String key, T defaultValue)
-
getLastModified
public static Calendar getLastModified(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
-
setLastModified
public static void setLastModified(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, Calendar time)
-
setLastModified
public static void setLastModified(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef)
-
getLastModifiedBy
public static String getLastModifiedBy(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
-
getCreated
public static Calendar getCreated(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
-
getCreatedBy
public static String getCreatedBy(org.apache.jackrabbit.vault.packaging.JcrPackage pckg)
-
getCoverage
public static void getCoverage(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, javax.jcr.Session session, org.apache.jackrabbit.vault.fs.api.ProgressTrackerListener listener)
-
getFilter
public static org.apache.jackrabbit.vault.fs.api.WorkspaceFilter getFilter(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getFilterList
public static List<org.apache.jackrabbit.vault.fs.api.PathFilterSet> getFilterList(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
getThumbnailPath
public static String getThumbnailPath(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
setThumbnail
public static void setThumbnail(org.apache.jackrabbit.vault.packaging.JcrPackageDefinition pckgDef, org.apache.sling.api.resource.ResourceResolver resolver, InputStream pngStream) throws org.apache.sling.api.resource.PersistenceException, javax.jcr.RepositoryException
- Throws:
org.apache.sling.api.resource.PersistenceException
javax.jcr.RepositoryException
-
getTreeNode
public static TreeNode getTreeNode(org.apache.jackrabbit.vault.packaging.JcrPackageManager manager, org.apache.sling.api.SlingHttpServletRequest request) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
toJson
public static void toJson(@Nonnull com.google.gson.stream.JsonWriter writer, @Nonnull org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage, @Nullable Map<String,Object> additionalAttributes) throws javax.jcr.RepositoryException, IOException
- Throws:
javax.jcr.RepositoryException
IOException
-
toJson
public static void toJson(com.google.gson.stream.JsonWriter writer, org.apache.jackrabbit.vault.packaging.JcrPackageDefinition definition) throws IOException
- Throws:
IOException
-
packageToXMLResponse
public static String packageToXMLResponse(org.apache.jackrabbit.vault.packaging.JcrPackage jcrPackage) throws javax.jcr.RepositoryException
- Throws:
javax.jcr.RepositoryException
-
-