Class JcrPackageDefinitionImpl
- java.lang.Object
-
- org.apache.jackrabbit.vault.packaging.impl.JcrPackageDefinitionImpl
-
- All Implemented Interfaces:
JcrPackageDefinition
,PackageProperties
public class JcrPackageDefinitionImpl extends Object implements JcrPackageDefinition
The JCR package definition is used to operate with a unwrapped package in the repository.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JcrPackageDefinitionImpl.State
-
Field Summary
-
Fields inherited from interface org.apache.jackrabbit.vault.packaging.JcrPackageDefinition
NN_FILTER, PN_AC_HANDLING, PN_BUILD_COUNT, PN_CND_PATTERN, PN_CREATED, PN_CREATED_BY, PN_DEPENDENCIES, PN_DESCRIPTION, PN_DISABLE_INTERMEDIATE_SAVE, PN_GROUP, PN_LAST_UNPACKED, PN_LAST_UNPACKED_BY, PN_LAST_UNWRAPPED, PN_LAST_UNWRAPPED_BY, PN_LAST_WRAPPED, PN_LAST_WRAPPED_BY, PN_LASTMODIFIED, PN_LASTMODIFIED_BY, PN_MODE, PN_NAME, PN_PATTERN, PN_PROPERTY_RULES, PN_REQUIRES_RESTART, PN_REQUIRES_ROOT, PN_ROOT, PN_RULES, PN_SUB_PACKAGES, PN_TYPE, PN_VERSION
-
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 JcrPackageDefinitionImpl(@NotNull Node definitionNode)
Creates a new definition base on the underlying node.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
dumpCoverage(ProgressTrackerListener listener)
Dumps the coverage of this definition to the given listenerString
get(String name)
Generic method to retrieve a string property of this definition.AccessControlHandling
getAccessControlHandling()
Returns the access control handling defined in the definition, ornull
if not defined.AccessControlHandling
getACHandling()
Returns the access control handling defined in this package.boolean
getBoolean(String name)
Generic method to retrieve a boolean property of this definition.long
getBuildCount()
Returns the build count of this packageCalendar
getCalendar(String name)
Generic method to retrieve a date property of this definition.Calendar
getCreated()
Returns the date when this package was built ornull
if n/a.String
getCreatedBy()
Returns the user that built this package or null if n/a.Calendar
getDateProperty(String name)
Returns the date property with the given name ornull
if it does not exist or if the value cannot be converted to a date.Dependency[]
getDependencies()
Returns an unmodifiable list of dependencies@NotNull Map<PackageId,URI>
getDependenciesLocations()
Returns a map of dependency locations where key = package id and value = uri of package dependency with that id.String
getDescription()
Returns a description of this package ornull
if n/aMap<String,String>
getExternalHooks()
String
getGenerator()
Returns the name and version of the component that generated the package.PackageId
getId()
Returns the id of this package ornull
if the id can't be determined.Calendar
getLastModified()
Returns the last modification date ornull
if n/a.String
getLastModifiedBy()
Returns the user that last modified the package ornull
if n/a.Calendar
getLastUnpacked()
Returns the date when the package was unpackedString
getLastUnpackedBy()
Returns the user id who unpacked the packageCalendar
getLastUnwrapped()
Returns the last unwrapped dateString
getLastUnwrappedBy()
Returns the last unwrapped user idCalendar
getLastWrapped()
Returns the date when this package was wrapped ornull
if n/a.String
getLastWrappedBy()
Returns the user that wrapped this package or null if n/a.MetaInf
getMetaInf()
Returns the meta inf of this package@NotNull Node
getNode()
Returns the underlying node@Nullable PackageType
getPackageType()
Returns the package type ornull
if no package type was specified for this package.String
getProperty(String name)
Returns the property with the given name ornull
if it does not exist.JcrPackageDefinitionImpl.State
getState()
Returns a new state object that can be used to save modification information.SubPackageHandling
getSubPackageHandling()
Returns the sub package handling configurationboolean
isModified()
Checks if the definition was modified since it was last wrapped.boolean
isUnwrapped()
Checks if this definition is unwrapped, i.e.boolean
requiresRestart()
Returnstrue
if this package requires a restart after installation.boolean
requiresRoot()
Deprecated.void
set(String name, boolean value, boolean autoSave)
Generic method to set a boolean property to this definition.void
set(String name, String value, boolean autoSave)
Generic method to set a string property to this definition.void
set(String name, Calendar value, boolean autoSave)
Generic method to set a date property to this definition.void
setDependencies(@NotNull Dependency[] dependencies, boolean autoSave)
Sets the dependencies to this definition and stores it in a node representation.void
setFilter(WorkspaceFilter filter, boolean autoSave)
Sets the filter to this definition and stores it in a node representation.void
setId(PackageId id, boolean autoSave)
Writes the properties derived from the package id to the contentvoid
setState(JcrPackageDefinitionImpl.State state)
Sets the information stored in the state object back to this definition.void
touch(Calendar now, boolean autoSave)
Touches the last modified and last modified by property.void
unwrap(Archive archive, boolean autoSave)
void
unwrap(VaultPackage pack, boolean force)
void
unwrap(VaultPackage pack, boolean force, boolean autoSave)
Unwraps the package definition to the underlying node.
-
-
-
Constructor Detail
-
JcrPackageDefinitionImpl
public JcrPackageDefinitionImpl(@NotNull @NotNull Node definitionNode)
Creates a new definition base on the underlying node.- Parameters:
definitionNode
- the definition node
-
-
Method Detail
-
getNode
@NotNull public @NotNull Node getNode()
Returns the underlying node- Specified by:
getNode
in interfaceJcrPackageDefinition
- Returns:
- the node
-
getId
public PackageId getId()
Returns the id of this package ornull
if the id can't be determined.- Specified by:
getId
in interfacePackageProperties
- Returns:
- the id of this package.
-
setId
public void setId(PackageId id, boolean autoSave)
Writes the properties derived from the package id to the content- Specified by:
setId
in interfaceJcrPackageDefinition
- Parameters:
id
- the package idautoSave
- iftrue
the changes are saved automatically.
-
isUnwrapped
public boolean isUnwrapped()
Checks if this definition is unwrapped, i.e. if the definition structured was extracted from a VaultPackage.- Specified by:
isUnwrapped
in interfaceJcrPackageDefinition
- Returns:
true
if unwrapped.
-
isModified
public boolean isModified()
Checks if the definition was modified since it was last wrapped. new packages are considered modified.- Specified by:
isModified
in interfaceJcrPackageDefinition
- Returns:
true
if modified
-
unwrap
public void unwrap(VaultPackage pack, boolean force) throws RepositoryException, IOException
- Throws:
RepositoryException
IOException
-
unwrap
public void unwrap(VaultPackage pack, boolean force, boolean autoSave) throws RepositoryException, IOException
Unwraps the package definition to the underlying node.- Specified by:
unwrap
in interfaceJcrPackageDefinition
- Parameters:
pack
- the packageforce
- iftrue
unwrapping is forcedautoSave
- iftrue
modifications are saved automatically- Throws:
RepositoryException
- if an error occursIOException
- if an I/O error occurs
-
unwrap
public void unwrap(Archive archive, boolean autoSave) throws RepositoryException, IOException
- Throws:
RepositoryException
IOException
-
getDependencies
public Dependency[] getDependencies()
Returns an unmodifiable list of dependencies- Specified by:
getDependencies
in interfacePackageProperties
- Returns:
- list of dependencies
-
setDependencies
public void setDependencies(@NotNull @NotNull Dependency[] dependencies, boolean autoSave)
Sets the dependencies to this definition and stores it in a node representation.- Specified by:
setDependencies
in interfaceJcrPackageDefinition
- Parameters:
dependencies
- the package dependenciesautoSave
- iftrue
the modifications are saved automatically.
-
dumpCoverage
public void dumpCoverage(ProgressTrackerListener listener) throws RepositoryException
Dumps the coverage of this definition to the given listener- Specified by:
dumpCoverage
in interfaceJcrPackageDefinition
- Parameters:
listener
- the listener- Throws:
RepositoryException
- if an error occurrs
-
get
public String get(String name)
Generic method to retrieve a string property of this definition.- Specified by:
get
in interfaceJcrPackageDefinition
- Parameters:
name
- the name of the property.- Returns:
- the property value or
null
if it does not exist.
-
getBoolean
public boolean getBoolean(String name)
Generic method to retrieve a boolean property of this definition.- Specified by:
getBoolean
in interfaceJcrPackageDefinition
- Parameters:
name
- the name of the property.- Returns:
- the property value or
null
if it does not exist.
-
getCalendar
public Calendar getCalendar(String name)
Generic method to retrieve a date property of this definition.- Specified by:
getCalendar
in interfaceJcrPackageDefinition
- Parameters:
name
- the name of the property.- Returns:
- the property value or
null
if it does not exist.
-
set
public void set(String name, String value, boolean autoSave)
Generic method to set a string property to this definition.- Specified by:
set
in interfaceJcrPackageDefinition
- Parameters:
name
- the name of the propertyvalue
- the value ornull
to clear the propertyautoSave
- iftrue
the modifications are saved automatically.
-
set
public void set(String name, Calendar value, boolean autoSave)
Generic method to set a date property to this definition.- Specified by:
set
in interfaceJcrPackageDefinition
- Parameters:
name
- the name of the propertyvalue
- the value ornull
to clear the propertyautoSave
- iftrue
the modifications are saved automatically.
-
set
public void set(String name, boolean value, boolean autoSave)
Generic method to set a boolean property to this definition.- Specified by:
set
in interfaceJcrPackageDefinition
- Parameters:
name
- the name of the propertyvalue
- the valueautoSave
- iftrue
the modifications are saved automatically.
-
touch
public void touch(Calendar now, boolean autoSave)
Touches the last modified and last modified by property.- Specified by:
touch
in interfaceJcrPackageDefinition
- Parameters:
now
- calendar ornull
autoSave
- iftrue
the modifications are saved automatically.
-
setFilter
public void setFilter(WorkspaceFilter filter, boolean autoSave)
Sets the filter to this definition and stores it in a node representation.- Specified by:
setFilter
in interfaceJcrPackageDefinition
- Parameters:
filter
- the filter to setautoSave
- iftrue
the modifications are saved automatically.
-
getLastModified
public Calendar getLastModified()
Returns the last modification date ornull
if n/a.- Specified by:
getLastModified
in interfacePackageProperties
- Returns:
- last modification date or
null
-
getLastModifiedBy
public String getLastModifiedBy()
Returns the user that last modified the package ornull
if n/a.- Specified by:
getLastModifiedBy
in interfacePackageProperties
- Returns:
- the user or
null
-
getCreated
public Calendar getCreated()
Returns the date when this package was built ornull
if n/a.- Specified by:
getCreated
in interfacePackageProperties
- Returns:
- the creation date
-
getCreatedBy
public String getCreatedBy()
Returns the user that built this package or null if n/a.- Specified by:
getCreatedBy
in interfacePackageProperties
- Returns:
- the creator
-
getGenerator
public String getGenerator()
Returns the name and version of the component that generated the package.- Specified by:
getGenerator
in interfacePackageProperties
- Returns:
- the generator or
null
if n/a
-
getLastUnwrapped
public Calendar getLastUnwrapped()
Returns the last unwrapped date- Specified by:
getLastUnwrapped
in interfaceJcrPackageDefinition
- Returns:
- the last unwrapped date
-
getLastWrappedBy
public String getLastWrappedBy()
Returns the user that wrapped this package or null if n/a.- Specified by:
getLastWrappedBy
in interfacePackageProperties
- Returns:
- the wrapper
-
getLastWrapped
public Calendar getLastWrapped()
Returns the date when this package was wrapped ornull
if n/a.- Specified by:
getLastWrapped
in interfacePackageProperties
- Returns:
- the wrapped date
-
getLastUnwrappedBy
public String getLastUnwrappedBy()
Returns the last unwrapped user id- Specified by:
getLastUnwrappedBy
in interfaceJcrPackageDefinition
- Returns:
- the last unwrapped user id
-
getLastUnpacked
public Calendar getLastUnpacked()
Returns the date when the package was unpacked- Specified by:
getLastUnpacked
in interfaceJcrPackageDefinition
- Returns:
- the unpacked date
-
getLastUnpackedBy
public String getLastUnpackedBy()
Returns the user id who unpacked the package- Specified by:
getLastUnpackedBy
in interfaceJcrPackageDefinition
- Returns:
- the unpacked user id
-
requiresRoot
@Deprecated public boolean requiresRoot()
Deprecated.Returnstrue
if this package can only be extracted by a admin session.- Specified by:
requiresRoot
in interfacePackageProperties
- Returns:
true
if this package requires an admin session for extraction.
-
requiresRestart
public boolean requiresRestart()
Returnstrue
if this package requires a restart after installation.- Specified by:
requiresRestart
in interfacePackageProperties
- Returns:
true
if this package requires a restart after installation.
-
getAccessControlHandling
public AccessControlHandling getAccessControlHandling()
Returns the access control handling defined in the definition, ornull
if not defined.- Specified by:
getAccessControlHandling
in interfaceJcrPackageDefinition
- Returns:
- the access control handling or
null
-
getDescription
public String getDescription()
Returns a description of this package ornull
if n/a- Specified by:
getDescription
in interfacePackageProperties
- Returns:
- a description
-
getBuildCount
public long getBuildCount()
Returns the build count of this package- Specified by:
getBuildCount
in interfacePackageProperties
- Returns:
- the build count.
-
getMetaInf
public MetaInf getMetaInf() throws RepositoryException
Returns the meta inf of this package- Specified by:
getMetaInf
in interfaceJcrPackageDefinition
- Returns:
- the meta inf
- Throws:
RepositoryException
- if an error occurs.
-
getState
public JcrPackageDefinitionImpl.State getState()
Returns a new state object that can be used to save modification information.- Returns:
- a new state object.
-
setState
public void setState(JcrPackageDefinitionImpl.State state)
Sets the information stored in the state object back to this definition.- Parameters:
state
- the sate
-
getExternalHooks
public Map<String,String> getExternalHooks()
- Specified by:
getExternalHooks
in interfacePackageProperties
- Returns:
- all external hooks registered in a package (key = name, value = fully qualified class name)
-
getACHandling
public AccessControlHandling getACHandling()
Description copied from interface:PackageProperties
Returns the access control handling defined in this package.- Specified by:
getACHandling
in interfacePackageProperties
- Returns:
- the access control handling.
-
getSubPackageHandling
public SubPackageHandling getSubPackageHandling()
Description copied from interface:PackageProperties
Returns the sub package handling configuration- Specified by:
getSubPackageHandling
in interfacePackageProperties
- Returns:
- the sub package handling configuration.
-
getDateProperty
public Calendar getDateProperty(String name)
Description copied from interface:PackageProperties
Returns the date property with the given name ornull
if it does not exist or if the value cannot be converted to a date.- Specified by:
getDateProperty
in interfacePackageProperties
- Parameters:
name
- the property name- Returns:
- the property value or
null
-
getProperty
public String getProperty(String name)
Description copied from interface:PackageProperties
Returns the property with the given name ornull
if it does not exist.- Specified by:
getProperty
in interfacePackageProperties
- Parameters:
name
- the property name- Returns:
- the property value or
null
-
getPackageType
@Nullable public @Nullable PackageType getPackageType()
Description copied from interface:PackageProperties
Returns the package type ornull
if no package type was specified for this package.- Specified by:
getPackageType
in interfacePackageProperties
- Returns:
- the package type
-
getDependenciesLocations
@NotNull public @NotNull Map<PackageId,URI> getDependenciesLocations()
Description copied from interface:PackageProperties
Returns a map of dependency locations where key = package id and value = uri of package dependency with that id.- Specified by:
getDependenciesLocations
in interfacePackageProperties
- Returns:
- dependencies locations as map
-
-