Interface JcrPackage
-
- All Superinterfaces:
java.lang.AutoCloseable,java.lang.Comparable<JcrPackage>
@ProviderType public interface JcrPackage extends java.lang.Comparable<JcrPackage>, java.lang.AutoCloseable
A Vault package stored in the repository. Needs to be closed in casegetPackage(),extract(ImportOptions)orinstall(ImportOptions)has been called.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringMIME_TYPEDefault mime type of a packagestatic java.lang.StringNN_VLT_DEFINITIONNode name of the definition nodestatic java.lang.StringNT_VLT_PACKAGENode type name of a package nodestatic java.lang.StringNT_VLT_PACKAGE_DEFINITIONNode type name of a package definition node
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidclose()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 javax.jcr.PropertygetData()Returns the jcr:data property of the package@Nullable JcrPackageDefinitiongetDefinition()Returns the package definition of this package@Nullable javax.jcr.NodegetDefNode()Returns the definition node ornullif not exists@Nullable javax.jcr.NodegetNode()Returns the underlying node@NotNull VaultPackagegetPackage()Returns the vault package stored in the data of this package.@NotNull PackageId[]getResolvedDependencies()Returns a list of the installed packages that this package depends on.longgetSize()Returns the size of the underlying package.@Nullable JcrPackagegetSnapshot()Returns the snapshot that was taken when installing this package.@NotNull Dependency[]getUnresolvedDependencies()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.booleanisInstalled()Checks if this package is installed.booleanisSealed()Checks if this package is sealed.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.
-
-
-
Field Detail
-
NT_VLT_PACKAGE
static final java.lang.String NT_VLT_PACKAGE
Node type name of a package node- See Also:
- Constant Field Values
-
NT_VLT_PACKAGE_DEFINITION
static final java.lang.String NT_VLT_PACKAGE_DEFINITION
Node type name of a package definition node- See Also:
- Constant Field Values
-
NN_VLT_DEFINITION
static final java.lang.String NN_VLT_DEFINITION
Node name of the definition node- See Also:
- Constant Field Values
-
MIME_TYPE
static final java.lang.String MIME_TYPE
Default mime type of a package- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefinition
@Nullable @Nullable JcrPackageDefinition getDefinition() throws javax.jcr.RepositoryException
Returns the package definition of this package- Returns:
- the package definition or
nullif this package is not valid. - Throws:
javax.jcr.RepositoryException- if an error occurs
-
isValid
boolean isValid()
Checks if the underlying node contains the correct structure.- Returns:
trueif this package is valid.
-
getNode
@Nullable @Nullable javax.jcr.Node 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
@NotNull @NotNull VaultPackage getPackage() throws javax.jcr.RepositoryException, java.io.IOException
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:
javax.jcr.RepositoryException- if an error occursjava.io.IOException- if an I/O error occurs
-
extract
void extract(@NotNull @NotNull ImportOptions opts) throws javax.jcr.RepositoryException, PackageException, java.io.IOExceptionExtracts the package contents to the repository. Opens the package implicitly thereforeclose()needs to be afterwards.- Parameters:
opts- import options- Throws:
javax.jcr.RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occursjava.lang.IllegalStateException- if the package is not valid.java.io.IOException- if an I/O error occurs- Since:
- 2.3.14
-
install
void install(@NotNull @NotNull ImportOptions opts) throws javax.jcr.RepositoryException, PackageException, java.io.IOExceptionInstalls 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:
javax.jcr.RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occursjava.lang.IllegalStateException- if the package is not valid.java.io.IOException- if an I/O error occurs- Since:
- 2.3.14
-
extractSubpackages
@NotNull @NotNull PackageId[] extractSubpackages(@NotNull @NotNull ImportOptions opts) throws javax.jcr.RepositoryException, PackageException, java.io.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:
javax.jcr.RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occursjava.lang.IllegalStateException- if the package is not valid.java.io.IOException- if an I/O error occurs- Since:
- 3.1.32
-
getUnresolvedDependencies
@NotNull @NotNull Dependency[] getUnresolvedDependencies() throws javax.jcr.RepositoryException
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:
javax.jcr.RepositoryException- if an error accessing the repository occurrs- Since:
- 3.1.32
-
getResolvedDependencies
@NotNull @NotNull PackageId[] getResolvedDependencies() throws javax.jcr.RepositoryException
Returns a list of the installed packages that this package depends on.- Returns:
- the array of resolved dependencies
- Throws:
javax.jcr.RepositoryException- if an error accessing the repository occurrs- Since:
- 3.1.32
-
snapshot
@Nullable @Nullable JcrPackage snapshot(@NotNull @NotNull ExportOptions opts, boolean replace) throws javax.jcr.RepositoryException, PackageException, java.io.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:
javax.jcr.RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occursjava.lang.IllegalStateException- if the package is not valid.java.io.IOException- if an I/O error occurs- Since:
- 2.0
-
getSnapshot
@Nullable @Nullable JcrPackage getSnapshot() throws javax.jcr.RepositoryException
Returns the snapshot that was taken when installing this package.- Returns:
- the snapshot package or
null - Throws:
javax.jcr.RepositoryException- if an error occurs.- Since:
- 2.0
-
uninstall
void uninstall(@NotNull @NotNull ImportOptions opts) throws javax.jcr.RepositoryException, PackageException, java.io.IOExceptionReverts the changes of a prior installation of this package.- Parameters:
opts- import options- Throws:
javax.jcr.RepositoryException- if a repository error during installation occurs.PackageException- if an error during packaging occurs or if no snapshot is available.java.lang.IllegalStateException- if the package is not valid.PackageException- if no snapshot is present andImportOptions.isStrict(boolean)returnstrue.java.io.IOException- if an I/O error occurs- Since:
- 2.3.14
-
verifyId
@Deprecated boolean verifyId(boolean autoFix, boolean autoSave) throws javax.jcr.RepositoryExceptionDeprecated.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:
javax.jcr.RepositoryException- if an error occurs.- Since:
- 2.2.18
-
isInstalled
boolean isInstalled() throws javax.jcr.RepositoryExceptionChecks 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:
javax.jcr.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 interfacejava.lang.AutoCloseable
-
getData
@Nullable @Nullable javax.jcr.Property getData() throws javax.jcr.RepositoryExceptionReturns the jcr:data property of the package- Returns:
- the jcr:data property
- Throws:
javax.jcr.RepositoryException- if an error occurrs
-
getDefNode
@Nullable @Nullable javax.jcr.Node getDefNode() throws javax.jcr.RepositoryExceptionReturns the definition node ornullif not exists- Returns:
- the definition node.
- Throws:
javax.jcr.RepositoryException- if an error occurrs
-
-