Interface JcrPackage
- All Superinterfaces:
AutoCloseable,Comparable<JcrPackage>
- All Known Implementing Classes:
JcrPackageImpl
A Vault package stored in the repository.
Needs to be closed in case
getPackage(), extract(ImportOptions) or install(ImportOptions) has been called.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this package and destroys all temporary data.voidextract(@NotNull ImportOptions opts) Extracts the package contents to the repository.@NotNull PackageId[]extractSubpackages(@NotNull ImportOptions opts) Processes this package and extracts all sub packages.@Nullable PropertygetData()Returns the jcr:data property of the package@Nullable JcrPackageDefinitionReturns the package definition of this package@Nullable NodeReturns the definition node ornullif not exists@Nullable NodegetNode()Returns the underlying node@NotNull VaultPackageReturns the vault package stored in the data of this package.@NotNull PackageId[]Returns a list of the installed packages that this package depends on.longgetSize()Returns the size of the underlying package.@Nullable JcrPackageReturns the snapshot that was taken when installing this package.@NotNull Dependency[]Returns the dependencies that are not resolved.voidinstall(@NotNull ImportOptions opts) Installs the package contents to the repository but creates a snapshot if necessary.booleanisEmpty()Checks if the package has content.booleanChecks if this package is installed.booleanisSealed()Checks if this package is sealed. this is the case, if it was not modified since it was unwrapped.booleanisValid()Checks if the underlying node contains the correct structure.@Nullable JcrPackagesnapshot(@NotNull ExportOptions opts, boolean replace) Creates a snapshot of this package.voiduninstall(@NotNull ImportOptions opts) Reverts the changes of a prior installation of this package.booleanverifyId(boolean autoFix, boolean autoSave) Deprecated.As of 3.1.42, the storage location is implementation details.Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
NT_VLT_PACKAGE
Node type name of a package node- See Also:
-
NT_VLT_PACKAGE_DEFINITION
Node type name of a package definition node- See Also:
-
NN_VLT_DEFINITION
Node name of the definition node- See Also:
-
MIME_TYPE
Default mime type of a package- See Also:
-
-
Method Details
-
getDefinition
Returns the package definition of this package- Returns:
- the package definition or
nullif this package is not valid. - Throws:
RepositoryException- if an error occurs
-
isValid
boolean isValid()Checks if the underlying node contains the correct structure.- Returns:
trueif this package is valid.
-
getNode
Returns the underlying node- Returns:
- the node
-
isSealed
boolean isSealed()Checks if this package is sealed. this is the case, if it was not modified since it was unwrapped.- Returns:
trueif this package is sealed.
-
getPackage
Returns the vault package stored in the data of this package. Opens the package implicitly thereforeclose()needs to be afterwards. This is potentially a costly operation as this requires uncompressing the ZIP stream (and potentially creating temporary files) therefore prefer usinggetDefinition()whenever possible to access meta data.- Returns:
- the package, this is closed when
close()is called on this package - Throws:
RepositoryException- if an error occursIOException- if an I/O error occurs
-
extract
void extract(@NotNull @NotNull ImportOptions opts) throws RepositoryException, PackageException, IOException Extracts the package contents to the repository. Opens the package implicitly thereforeclose()needs to be afterwards.- Parameters:
opts- import options- Throws:
RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occursIllegalStateException- if the package is not valid.IOException- if an I/O error occurs- Since:
- 2.3.14
-
install
void install(@NotNull @NotNull ImportOptions opts) throws RepositoryException, PackageException, IOException Installs the package contents to the repository but creates a snapshot if necessary. Opens the package implicitly thereforeclose()needs to be afterwards.- Parameters:
opts- import options- Throws:
RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occursIllegalStateException- if the package is not valid.IOException- if an I/O error occurs- Since:
- 2.3.14
-
extractSubpackages
@NotNull @NotNull PackageId[] extractSubpackages(@NotNull @NotNull ImportOptions opts) throws RepositoryException, PackageException, IOException Processes this package and extracts all sub packages. No content of this package or its sub packages is extracted and not snapshots are taken. IfImportOptions.isNonRecursive()istrue, then only the direct sub packages are extracted. The extraction ensures that the sub packages have a dependency to their parent package.- Parameters:
opts- import options- Returns:
- the list of subpackages that were extracted
- Throws:
RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occursIllegalStateException- if the package is not valid.IOException- if an I/O error occurs- Since:
- 3.1.32
-
getUnresolvedDependencies
Returns the dependencies that are not resolved. If theDependencyHandlingis set to strict, the package will not installed if any unresolved dependencies are listed.- Returns:
- the array of unresolved dependencies.
- Throws:
RepositoryException- if an error accessing the repository occurrs- Since:
- 3.1.32
-
getResolvedDependencies
Returns a list of the installed packages that this package depends on.- Returns:
- the array of resolved dependencies
- Throws:
RepositoryException- if an error accessing the repository occurrs- Since:
- 3.1.32
-
snapshot
@Nullable @Nullable JcrPackage snapshot(@NotNull @NotNull ExportOptions opts, boolean replace) throws RepositoryException, PackageException, IOException Creates a snapshot of this package.- Parameters:
opts- export optionsreplace- iftrueany existing snapshot is replaced.- Returns:
- a package that represents the snapshot of this package or
nullif it wasn't created. - Throws:
RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occursIllegalStateException- if the package is not valid.IOException- if an I/O error occurs- Since:
- 2.0
-
getSnapshot
Returns the snapshot that was taken when installing this package.- Returns:
- the snapshot package or
null - Throws:
RepositoryException- if an error occurs.- Since:
- 2.0
-
uninstall
void uninstall(@NotNull @NotNull ImportOptions opts) throws RepositoryException, PackageException, IOException Reverts the changes of a prior installation of this package.- Parameters:
opts- import options- Throws:
RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occurs or if no snapshot is available.IllegalStateException- if the package is not valid.PackageException- if no snapshot is present andImportOptions.isStrict(boolean)returnstrue.IOException- if an I/O error occurs- Since:
- 2.3.14
-
verifyId
Deprecated.As of 3.1.42, the storage location is implementation details.Checks if the package id is correct in respect to the installation path and adjusts it accordingly.- Parameters:
autoFix-trueto automatically fix the idautoSave-trueto save changes immediately- Returns:
trueif id is correct.- Throws:
RepositoryException- if an error occurs.- Since:
- 2.2.18
-
isInstalled
Checks if this package is installed. Note: the default implementation only checks theJcrPackageDefinition.getLastUnpacked()date. If the package is replaced since it was installed. this method will returnfalse.- Returns:
trueif this package is installed.- Throws:
RepositoryException- if an error occurs.- Since:
- 2.4.6
-
isEmpty
boolean isEmpty()Checks if the package has content.- Returns:
trueif this package doesn't have content- Since:
- 3.1.40
-
getSize
long getSize()Returns the size of the underlying package.- Returns:
- the size in bytes or -1 if not valid.
-
close
void close()Closes this package and destroys all temporary data. Only necessary to call whengetPackage(),extract(ImportOptions)orinstall(ImportOptions)has been called. Is a no-op when none of these methods have been called on this package.- Specified by:
closein interfaceAutoCloseable
-
getData
Returns the jcr:data property of the package- Returns:
- the jcr:data property
- Throws:
RepositoryException- if an error occurrs
-
getDefNode
Returns the definition node ornullif not exists- Returns:
- the definition node.
- Throws:
RepositoryException- if an error occurrs
-