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 voidcheckAllowanceToInstallPackage(@NotNull Session session, @NotNull InstallHookProcessor hookProcessor, AbstractPackageRegistry.SecurityConfig securityConfig)voidclose()Closes this package and releases underlying data.voidextract(Session session, ImportOptions opts)Extracts the package contents to the repositoryvoidextract(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 voidextract(InstallContextImpl ctx, List<String> subPackages)Same as above but the given subPackages argument receives a list of potential sub packages.ArchivegetArchive()Returns the underlying package archive.FilegetFile()Returns the file this package is based on.MetaInfgetMetaInf()Returns the meta inf that was either loaded or specified during build.PackagePropertiesgetProperties()Returns the properties of this package.protected PropertiesgetPropertiesMap()longgetSize()Returns the size of the package or -1 if n/a.booleanisClosed()Checks if this package is closed.booleanisValid()Checks if this package is valid.protected InstallContextImplprepareExtract(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 underlyingArchiveif it has been opened. Only necessary to call if package has been opened viaVaultPackage.getArchive()orVaultPackage.getMetaInf().- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein 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:
getArchivein interfaceVaultPackage- Returns:
- the archive or
nullif already closed
-
isValid
public boolean isValid()
Checks if this package is valid.- Specified by:
isValidin interfaceVaultPackage- Returns:
trueif this package is valid.
-
isClosed
public boolean isClosed()
Checks if this package is closed.- Specified by:
isClosedin interfaceVaultPackage- Returns:
trueif this package is closed.
-
getFile
public File getFile()
Returns the file this package is based on.- Specified by:
getFilein 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:
getMetaInfin interfaceVaultPackage- Returns:
- the meta inf or
null.
-
getSize
public long getSize()
Returns the size of the package or -1 if n/a.- Specified by:
getSizein 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:
extractin 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:
getPropertiesin 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 defaultIdConflictPolicyto 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:
PackageExceptionRepositoryException
-
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:
getPropertiesMapin classPackagePropertiesImpl
-
-