Interface JcrPackage
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.lang.Comparable<JcrPackage>
@ProviderType public interface JcrPackage extends java.lang.Comparable<JcrPackage>, java.lang.AutoCloseable
Specifies the interface of a vault package stored in the repository.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
MIME_TYPE
default mime type of a packagestatic java.lang.String
NN_VLT_DEFINITION
Nodename of the definition nodestatic java.lang.String
NT_VLT_PACKAGE
Nodetype name of a package nodestatic java.lang.String
NT_VLT_PACKAGE_DEFINITION
Nodetype name of a definition node
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
close()
Closes this package and destroys all temporary data.void
extract(ImportOptions opts)
Extracts the package contents to the repositoryPackageId[]
extractSubpackages(ImportOptions opts)
Processes this package and extracts all sub packages.Property
getData()
Returns the jcr:data property of the packageJcrPackageDefinition
getDefinition()
Returns the package definition of this packageNode
getDefNode()
Returns the definition node ornull
if not existsNode
getNode()
Returns the underlying nodeVaultPackage
getPackage()
Returns the vault package stored in the data of this packagePackageId[]
getResolvedDependencies()
Returns a list of the installed packages that this package depends on.long
getSize()
Returns the size of the underlying package.JcrPackage
getSnapshot()
Returns the snapshot that was taken when installing this package.Dependency[]
getUnresolvedDependencies()
Returns the dependencies that are not resolved.void
install(ImportOptions opts)
Installs the package contents to the repository but creates a snapshot if necessary.boolean
isEmpty()
Checks if the package has content.boolean
isInstalled()
Checks if this package is installed.boolean
isSealed()
Checks if this package is sealed.boolean
isValid()
Checks if the underlying node contains the correct structure.JcrPackage
snapshot(ExportOptions opts, boolean replace)
Creates a snapshot of this package.void
uninstall(ImportOptions opts)
Reverts the changes of a prior installation of this package.boolean
verifyId(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
Nodetype name of a package node- See Also:
- Constant Field Values
-
NT_VLT_PACKAGE_DEFINITION
static final java.lang.String NT_VLT_PACKAGE_DEFINITION
Nodetype name of a definition node- See Also:
- Constant Field Values
-
NN_VLT_DEFINITION
static final java.lang.String NN_VLT_DEFINITION
Nodename 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
@CheckForNull JcrPackageDefinition getDefinition() throws RepositoryException
Returns the package definition of this package- Returns:
- the package definition or
null
if this package is not valid. - Throws:
RepositoryException
- if an error occurrs
-
isValid
boolean isValid()
Checks if the underlying node contains the correct structure.- Returns:
true
if this package is valid.
-
getNode
@CheckForNull 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:
true
if this package is sealed.
-
getPackage
@Nonnull VaultPackage getPackage() throws RepositoryException, java.io.IOException
Returns the vault package stored in the data of this package- Returns:
- the package
- Throws:
RepositoryException
- if an error occursjava.io.IOException
- if an I/O error occurs
-
extract
void extract(@Nonnull ImportOptions opts) throws RepositoryException, PackageException, java.io.IOException
Extracts the package contents to the repository- Parameters:
opts
- import options- Throws:
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(@Nonnull ImportOptions opts) throws RepositoryException, PackageException, java.io.IOException
Installs the package contents to the repository but creates a snapshot if necessary.- Parameters:
opts
- import options- Throws:
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
@Nonnull PackageId[] extractSubpackages(@Nonnull ImportOptions opts) throws 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:
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
@Nonnull Dependency[] getUnresolvedDependencies() throws RepositoryException
Returns the dependencies that are not resolved. If theDependencyHandling
is 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
@Nonnull PackageId[] getResolvedDependencies() throws RepositoryException
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
@CheckForNull JcrPackage snapshot(@Nonnull ExportOptions opts, boolean replace) throws RepositoryException, PackageException, java.io.IOException
Creates a snapshot of this package.- Parameters:
opts
- export optionsreplace
- iftrue
any existing snapshot is replaced.- Returns:
- a package that represents the snapshot of this package or
null
if it wasn't created. - Throws:
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
@CheckForNull JcrPackage getSnapshot() throws RepositoryException
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(@Nonnull ImportOptions opts) throws RepositoryException, PackageException, java.io.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.java.lang.IllegalStateException
- if the package is not valid.PackageException
- if no snapshot is present andImportOptions.isStrict()
istrue
.java.io.IOException
- if an I/O error occurs- Since:
- 2.3.14
-
verifyId
@Deprecated boolean verifyId(boolean autoFix, boolean autoSave) throws RepositoryException
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
-true
to automatically fix the idautoSave
-true
to save changes immediately- Returns:
true
if id is correct.- Throws:
RepositoryException
- if an error occurs.- Since:
- 2.2.18
-
isInstalled
boolean isInstalled() throws RepositoryException
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:
true
if this package is installed.- Throws:
RepositoryException
- if an error occurs.- Since:
- 2.4.6
-
isEmpty
boolean isEmpty()
Checks if the package has content.- Returns:
true
if 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.- Specified by:
close
in interfacejava.lang.AutoCloseable
-
getData
@CheckForNull Property getData() throws RepositoryException
Returns the jcr:data property of the package- Returns:
- the jcr:data property
- Throws:
RepositoryException
- if an error occurrs
-
getDefNode
@CheckForNull Node getDefNode() throws RepositoryException
Returns the definition node ornull
if not exists- Returns:
- the definition node.
- Throws:
RepositoryException
- if an error occurrs
-
-