Class ZipVaultPackage
- java.lang.Object
-
- org.apache.jackrabbit.vault.packaging.impl.PackagePropertiesImpl
-
- org.apache.jackrabbit.vault.packaging.impl.ZipVaultPackage
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,PackageProperties
,VaultPackage
public class ZipVaultPackage extends PackagePropertiesImpl implements VaultPackage, Closeable
Implements a vault package that is a zipped representation of a file vault export.
-
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.vault.packaging.PackageProperties
MF_KEY_IMPORT_PACKAGE, MF_KEY_PACKAGE_DEPENDENCIES, MF_KEY_PACKAGE_DEPENDENCIES_LOCATIONS, MF_KEY_PACKAGE_DESC, MF_KEY_PACKAGE_ID, MF_KEY_PACKAGE_ROOTS, MF_KEY_PACKAGE_TYPE, NAME_AC_HANDLING, NAME_ALLOW_INDEX_DEFINITIONS, NAME_BUILD_COUNT, NAME_CND_PATTERN, NAME_CREATED, NAME_CREATED_BY, NAME_DEPENDENCIES, NAME_DEPENDENCIES_LOCATIONS, NAME_DESCRIPTION, NAME_DISABLE_INTERMEDIATE_SAVE, NAME_GENERATOR, NAME_GROUP, NAME_LAST_MODIFIED, NAME_LAST_MODIFIED_BY, NAME_LAST_WRAPPED, NAME_LAST_WRAPPED_BY, NAME_NAME, NAME_PACKAGE_TYPE, NAME_REQUIRES_RESTART, NAME_REQUIRES_ROOT, NAME_SUB_PACKAGE_HANDLING, NAME_USE_BINARY_REFERENCES, NAME_VERSION, PREFIX_INSTALL_HOOK
-
-
Constructor Summary
Constructors Constructor Description ZipVaultPackage(File file, boolean isTmpFile)
ZipVaultPackage(File file, boolean isTmpFile, boolean strict)
ZipVaultPackage(Path file, boolean isTmpFile, boolean strict)
ZipVaultPackage(Archive archive, boolean strict)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
checkAllowanceToInstallPackage(@NotNull Session session, @NotNull InstallHookProcessor hookProcessor, AbstractPackageRegistry.SecurityConfig securityConfig)
void
close()
Closes this package and releases underlying data.void
extract(Session session, ImportOptions opts)
Extracts the package contents to the repositoryvoid
extract(Session session, ImportOptions opts, AbstractPackageRegistry.SecurityConfig securityConfig, boolean isStrict, boolean isOverwritePrimaryTypesOfFolders, IdConflictPolicy defaultIdConflictPolicy)
Extracts the current package allowing additional users to do that in case the package contains hooks or requires the root userprotected void
extract(InstallContextImpl ctx, List<String> subPackages)
Same as above but the given subPackages argument receives a list of potential sub packages.Archive
getArchive()
Returns the underlying package archive.File
getFile()
Returns the file this package is based on.MetaInf
getMetaInf()
Returns the meta inf that was either loaded or specified during build.PackageProperties
getProperties()
Returns the properties of this package.protected Properties
getPropertiesMap()
long
getSize()
Returns the size of the package or -1 if n/a.boolean
isClosed()
Checks if this package is closed.boolean
isValid()
Checks if this package is valid.protected InstallContextImpl
prepareExtract(Session session, ImportOptions opts, AbstractPackageRegistry.SecurityConfig securityConfig, boolean isStrictByDefault, boolean overwritePrimaryTypesOfFoldersByDefault, IdConflictPolicy defaultIdConflictPolicy)
Prepares extraction.-
Methods inherited from class org.apache.jackrabbit.vault.packaging.impl.PackagePropertiesImpl
getACHandling, getBuildCount, getCachedId, getCreated, getCreatedBy, getDateProperty, getDependencies, getDependenciesLocations, getDescription, getExternalHooks, getGenerator, getId, getLastModified, getLastModifiedBy, getLastWrapped, getLastWrappedBy, getPackageType, getProperty, getSubPackageHandling, requiresRestart, requiresRoot
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.jackrabbit.vault.packaging.PackageProperties
getACHandling, getBuildCount, getCreated, getCreatedBy, getDateProperty, getDependencies, getDependenciesLocations, getDescription, getExternalHooks, getGenerator, getLastModified, getLastModifiedBy, getLastWrapped, getLastWrappedBy, getPackageType, getProperty, getSubPackageHandling, requiresRestart, requiresRoot
-
Methods inherited from interface org.apache.jackrabbit.vault.packaging.VaultPackage
getId
-
-
-
-
Constructor Detail
-
ZipVaultPackage
public ZipVaultPackage(File file, boolean isTmpFile) throws IOException
- Throws:
IOException
-
ZipVaultPackage
public ZipVaultPackage(File file, boolean isTmpFile, boolean strict) throws IOException
- Throws:
IOException
-
ZipVaultPackage
public ZipVaultPackage(Path file, boolean isTmpFile, boolean strict) throws IOException
- Throws:
IOException
-
ZipVaultPackage
public ZipVaultPackage(Archive archive, boolean strict) throws IOException
- Throws:
IOException
-
-
Method Detail
-
close
public void close()
Closes this package and releases underlying data. This will also close the underlyingArchive
if it has been opened. Only necessary to call if package has been opened viaVaultPackage.getArchive()
orVaultPackage.getMetaInf()
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceVaultPackage
-
getArchive
public Archive getArchive()
Returns the underlying package archive. Opens the archive when called for the first time. This does not need to be closed explicitly but rather is implicitly closed via a call toVaultPackage.close()
.- Specified by:
getArchive
in interfaceVaultPackage
- Returns:
- the archive or
null
if already closed
-
isValid
public boolean isValid()
Checks if this package is valid.- Specified by:
isValid
in interfaceVaultPackage
- Returns:
true
if this package is valid.
-
isClosed
public boolean isClosed()
Checks if this package is closed.- Specified by:
isClosed
in interfaceVaultPackage
- Returns:
true
if this package is closed.
-
getFile
public File getFile()
Returns the file this package is based on.- Specified by:
getFile
in interfaceVaultPackage
- Returns:
- the file of this package or
null
.
-
getMetaInf
public MetaInf getMetaInf()
Returns the meta inf that was either loaded or specified during build.- Specified by:
getMetaInf
in interfaceVaultPackage
- Returns:
- the meta inf or
null
.
-
getSize
public long getSize()
Returns the size of the package or -1 if n/a.- Specified by:
getSize
in interfaceVaultPackage
- Returns:
- the size
-
extract
public void extract(Session session, ImportOptions opts, @NotNull AbstractPackageRegistry.SecurityConfig securityConfig, boolean isStrict, boolean isOverwritePrimaryTypesOfFolders, IdConflictPolicy defaultIdConflictPolicy) throws PackageException, RepositoryException
Extracts the current package allowing additional users to do that in case the package contains hooks or requires the root user- Parameters:
session
- the session to useropts
- import optionssecurityConfig
- configuration for the security during package extraction- Throws:
PackageException
- if an error during packaging occursRepositoryException
- if a repository error during installation occurs.
-
extract
public void extract(Session session, ImportOptions opts) throws RepositoryException, PackageException
Extracts the package contents to the repository- Specified by:
extract
in interfaceVaultPackage
- Parameters:
session
- repository sessionopts
- import options- Throws:
RepositoryException
- if a repository error during installation occurs.PackageException
- if an error during packaging occurs
-
getProperties
public PackageProperties getProperties()
Returns the properties of this package.- Specified by:
getProperties
in interfaceVaultPackage
- Returns:
- the properties.
-
prepareExtract
protected InstallContextImpl prepareExtract(Session session, ImportOptions opts, @NotNull AbstractPackageRegistry.SecurityConfig securityConfig, boolean isStrictByDefault, boolean overwritePrimaryTypesOfFoldersByDefault, IdConflictPolicy defaultIdConflictPolicy) throws PackageException, RepositoryException
Prepares extraction.- Parameters:
session
- repository sessionopts
- import optionssecurityConfig
- the security configuration determining e.g. the install hook limitationsisStrictByDefault
- is true if packages should be installed in strict mode by default (if not set otherwise inopts
)overwritePrimaryTypesOfFoldersByDefault
- if folder aggregates' JCR primary type should be changed if the node is already existing or notdefaultIdConflictPolicy
- the defaultIdConflictPolicy
to use if no policy is set inopts
. May benull
.- Returns:
- installation context
- Throws:
RepositoryException
- if a repository error during installation occurs.PackageException
- if an error during packaging occursIllegalStateException
- if the package is not valid.
-
checkAllowanceToInstallPackage
protected void checkAllowanceToInstallPackage(@NotNull @NotNull Session session, @NotNull @NotNull InstallHookProcessor hookProcessor, @NotNull AbstractPackageRegistry.SecurityConfig securityConfig) throws PackageException, RepositoryException
- Throws:
PackageException
RepositoryException
-
extract
protected void extract(InstallContextImpl ctx, List<String> subPackages) throws RepositoryException, PackageException
Same as above but the given subPackages argument receives a list of potential sub packages.- Parameters:
ctx
- install contextsubPackages
- receives the list of potential sub packages- Throws:
RepositoryException
- if a repository error during installation occurs.PackageException
- if an error during packaging occursIllegalStateException
- if the package is not valid.
-
getPropertiesMap
protected Properties getPropertiesMap()
- Specified by:
getPropertiesMap
in classPackagePropertiesImpl
-
-