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 classJcrPackageDefinitionImpl.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 voiddumpCoverage(ProgressTrackerListener listener)Dumps the coverage of this definition to the given listenerStringget(String name)Generic method to retrieve a string property of this definition.AccessControlHandlinggetAccessControlHandling()Returns the access control handling defined in the definition, ornullif not defined.AccessControlHandlinggetACHandling()Returns the access control handling defined in this package.booleangetBoolean(String name)Generic method to retrieve a boolean property of this definition.longgetBuildCount()Returns the build count of this packageCalendargetCalendar(String name)Generic method to retrieve a date property of this definition.CalendargetCreated()Returns the date when this package was built ornullif n/a.StringgetCreatedBy()Returns the user that built this package or null if n/a.CalendargetDateProperty(String name)Returns the date property with the given name ornullif 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.StringgetDescription()Returns a description of this package ornullif n/aMap<String,String>getExternalHooks()StringgetGenerator()Returns the name and version of the component that generated the package.PackageIdgetId()Returns the id of this package ornullif the id can't be determined.CalendargetLastModified()Returns the last modification date ornullif n/a.StringgetLastModifiedBy()Returns the user that last modified the package ornullif n/a.CalendargetLastUnpacked()Returns the date when the package was unpackedStringgetLastUnpackedBy()Returns the user id who unpacked the packageCalendargetLastUnwrapped()Returns the last unwrapped dateStringgetLastUnwrappedBy()Returns the last unwrapped user idCalendargetLastWrapped()Returns the date when this package was wrapped ornullif n/a.StringgetLastWrappedBy()Returns the user that wrapped this package or null if n/a.MetaInfgetMetaInf()Returns the meta inf of this package@NotNull NodegetNode()Returns the underlying node@Nullable PackageTypegetPackageType()Returns the package type ornullif no package type was specified for this package.StringgetProperty(String name)Returns the property with the given name ornullif it does not exist.JcrPackageDefinitionImpl.StategetState()Returns a new state object that can be used to save modification information.SubPackageHandlinggetSubPackageHandling()Returns the sub package handling configurationbooleanisModified()Checks if the definition was modified since it was last wrapped.booleanisUnwrapped()Checks if this definition is unwrapped, i.e. if the definition structured was extracted from a VaultPackage.booleanrequiresRestart()Returnstrueif this package requires a restart after installation.booleanrequiresRoot()Deprecated.voidset(String name, boolean value, boolean autoSave)Generic method to set a boolean property to this definition.voidset(String name, String value, boolean autoSave)Generic method to set a string property to this definition.voidset(String name, Calendar value, boolean autoSave)Generic method to set a date property to this definition.voidsetDependencies(@NotNull Dependency[] dependencies, boolean autoSave)Sets the dependencies to this definition and stores it in a node representation.voidsetFilter(WorkspaceFilter filter, boolean autoSave)Sets the filter to this definition and stores it in a node representation.voidsetId(PackageId id, boolean autoSave)Writes the properties derived from the package id to the contentvoidsetState(JcrPackageDefinitionImpl.State state)Sets the information stored in the state object back to this definition.voidtouch(Calendar now, boolean autoSave)Touches the last modified and last modified by property.voidunwrap(Archive archive, boolean autoSave)voidunwrap(VaultPackage pack, boolean force)voidunwrap(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:
getNodein interfaceJcrPackageDefinition- Returns:
- the node
-
getId
public PackageId getId()
Returns the id of this package ornullif the id can't be determined.- Specified by:
getIdin 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:
setIdin interfaceJcrPackageDefinition- Parameters:
id- the package idautoSave- iftruethe 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:
isUnwrappedin interfaceJcrPackageDefinition- Returns:
trueif unwrapped.
-
isModified
public boolean isModified()
Checks if the definition was modified since it was last wrapped. new packages are considered modified.- Specified by:
isModifiedin interfaceJcrPackageDefinition- Returns:
trueif modified
-
unwrap
public void unwrap(VaultPackage pack, boolean force) throws RepositoryException, IOException
- Throws:
RepositoryExceptionIOException
-
unwrap
public void unwrap(VaultPackage pack, boolean force, boolean autoSave) throws RepositoryException, IOException
Unwraps the package definition to the underlying node.- Specified by:
unwrapin interfaceJcrPackageDefinition- Parameters:
pack- the packageforce- iftrueunwrapping is forcedautoSave- iftruemodifications 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:
RepositoryExceptionIOException
-
getDependencies
public Dependency[] getDependencies()
Returns an unmodifiable list of dependencies- Specified by:
getDependenciesin 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:
setDependenciesin interfaceJcrPackageDefinition- Parameters:
dependencies- the package dependenciesautoSave- iftruethe modifications are saved automatically.
-
dumpCoverage
public void dumpCoverage(ProgressTrackerListener listener) throws RepositoryException
Dumps the coverage of this definition to the given listener- Specified by:
dumpCoveragein 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:
getin interfaceJcrPackageDefinition- Parameters:
name- the name of the property.- Returns:
- the property value or
nullif it does not exist.
-
getBoolean
public boolean getBoolean(String name)
Generic method to retrieve a boolean property of this definition.- Specified by:
getBooleanin interfaceJcrPackageDefinition- Parameters:
name- the name of the property.- Returns:
- the property value or
nullif it does not exist.
-
getCalendar
public Calendar getCalendar(String name)
Generic method to retrieve a date property of this definition.- Specified by:
getCalendarin interfaceJcrPackageDefinition- Parameters:
name- the name of the property.- Returns:
- the property value or
nullif 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:
setin interfaceJcrPackageDefinition- Parameters:
name- the name of the propertyvalue- the value ornullto clear the propertyautoSave- iftruethe 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:
setin interfaceJcrPackageDefinition- Parameters:
name- the name of the propertyvalue- the value ornullto clear the propertyautoSave- iftruethe 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:
setin interfaceJcrPackageDefinition- Parameters:
name- the name of the propertyvalue- the valueautoSave- iftruethe modifications are saved automatically.
-
touch
public void touch(Calendar now, boolean autoSave)
Touches the last modified and last modified by property.- Specified by:
touchin interfaceJcrPackageDefinition- Parameters:
now- calendar ornullautoSave- iftruethe 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:
setFilterin interfaceJcrPackageDefinition- Parameters:
filter- the filter to setautoSave- iftruethe modifications are saved automatically.
-
getLastModified
public Calendar getLastModified()
Returns the last modification date ornullif n/a.- Specified by:
getLastModifiedin interfacePackageProperties- Returns:
- last modification date or
null
-
getLastModifiedBy
public String getLastModifiedBy()
Returns the user that last modified the package ornullif n/a.- Specified by:
getLastModifiedByin interfacePackageProperties- Returns:
- the user or
null
-
getCreated
public Calendar getCreated()
Returns the date when this package was built ornullif n/a.- Specified by:
getCreatedin interfacePackageProperties- Returns:
- the creation date
-
getCreatedBy
public String getCreatedBy()
Returns the user that built this package or null if n/a.- Specified by:
getCreatedByin interfacePackageProperties- Returns:
- the creator
-
getGenerator
public String getGenerator()
Returns the name and version of the component that generated the package.- Specified by:
getGeneratorin interfacePackageProperties- Returns:
- the generator or
nullif n/a
-
getLastUnwrapped
public Calendar getLastUnwrapped()
Returns the last unwrapped date- Specified by:
getLastUnwrappedin interfaceJcrPackageDefinition- Returns:
- the last unwrapped date
-
getLastWrappedBy
public String getLastWrappedBy()
Returns the user that wrapped this package or null if n/a.- Specified by:
getLastWrappedByin interfacePackageProperties- Returns:
- the wrapper
-
getLastWrapped
public Calendar getLastWrapped()
Returns the date when this package was wrapped ornullif n/a.- Specified by:
getLastWrappedin interfacePackageProperties- Returns:
- the wrapped date
-
getLastUnwrappedBy
public String getLastUnwrappedBy()
Returns the last unwrapped user id- Specified by:
getLastUnwrappedByin interfaceJcrPackageDefinition- Returns:
- the last unwrapped user id
-
getLastUnpacked
public Calendar getLastUnpacked()
Returns the date when the package was unpacked- Specified by:
getLastUnpackedin interfaceJcrPackageDefinition- Returns:
- the unpacked date
-
getLastUnpackedBy
public String getLastUnpackedBy()
Returns the user id who unpacked the package- Specified by:
getLastUnpackedByin interfaceJcrPackageDefinition- Returns:
- the unpacked user id
-
requiresRoot
@Deprecated public boolean requiresRoot()
Deprecated.Returnstrueif this package can only be extracted by a admin session.- Specified by:
requiresRootin interfacePackageProperties- Returns:
trueif this package requires an admin session for extraction.
-
requiresRestart
public boolean requiresRestart()
Returnstrueif this package requires a restart after installation.- Specified by:
requiresRestartin interfacePackageProperties- Returns:
trueif this package requires a restart after installation.
-
getAccessControlHandling
public AccessControlHandling getAccessControlHandling()
Returns the access control handling defined in the definition, ornullif not defined.- Specified by:
getAccessControlHandlingin interfaceJcrPackageDefinition- Returns:
- the access control handling or
null
-
getDescription
public String getDescription()
Returns a description of this package ornullif n/a- Specified by:
getDescriptionin interfacePackageProperties- Returns:
- a description
-
getBuildCount
public long getBuildCount()
Returns the build count of this package- Specified by:
getBuildCountin interfacePackageProperties- Returns:
- the build count.
-
getMetaInf
public MetaInf getMetaInf() throws RepositoryException
Returns the meta inf of this package- Specified by:
getMetaInfin 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:
getExternalHooksin interfacePackageProperties- Returns:
- all external hooks registered in a package (key = name, value = fully qualified class name)
-
getACHandling
public AccessControlHandling getACHandling()
Description copied from interface:PackagePropertiesReturns the access control handling defined in this package.- Specified by:
getACHandlingin interfacePackageProperties- Returns:
- the access control handling.
-
getSubPackageHandling
public SubPackageHandling getSubPackageHandling()
Description copied from interface:PackagePropertiesReturns the sub package handling configuration- Specified by:
getSubPackageHandlingin interfacePackageProperties- Returns:
- the sub package handling configuration.
-
getDateProperty
public Calendar getDateProperty(String name)
Description copied from interface:PackagePropertiesReturns the date property with the given name ornullif it does not exist or if the value cannot be converted to a date.- Specified by:
getDatePropertyin interfacePackageProperties- Parameters:
name- the property name- Returns:
- the property value or
null
-
getProperty
public String getProperty(String name)
Description copied from interface:PackagePropertiesReturns the property with the given name ornullif it does not exist.- Specified by:
getPropertyin interfacePackageProperties- Parameters:
name- the property name- Returns:
- the property value or
null
-
getPackageType
@Nullable public @Nullable PackageType getPackageType()
Description copied from interface:PackagePropertiesReturns the package type ornullif no package type was specified for this package.- Specified by:
getPackageTypein interfacePackageProperties- Returns:
- the package type
-
getDependenciesLocations
@NotNull public @NotNull Map<PackageId,URI> getDependenciesLocations()
Description copied from interface:PackagePropertiesReturns a map of dependency locations where key = package id and value = uri of package dependency with that id.- Specified by:
getDependenciesLocationsin interfacePackageProperties- Returns:
- dependencies locations as map
-
-