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.
  • Constructor Details

    • JcrPackageDefinitionImpl

      public JcrPackageDefinitionImpl(@NotNull @NotNull Node definitionNode)
      Creates a new definition base on the underlying node.
      Parameters:
      definitionNode - the definition node
  • Method Details

    • getNode

      @NotNull public @NotNull Node getNode()
      Returns the underlying node
      Specified by:
      getNode in interface JcrPackageDefinition
      Returns:
      the node
    • getId

      public PackageId getId()
      Returns the id of this package or null if the id can't be determined.
      Specified by:
      getId in interface PackageProperties
      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 interface JcrPackageDefinition
      Parameters:
      id - the package id
      autoSave - if true 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 interface JcrPackageDefinition
      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 interface JcrPackageDefinition
      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 interface JcrPackageDefinition
      Parameters:
      pack - the package
      force - if true unwrapping is forced
      autoSave - if true modifications are saved automatically
      Throws:
      RepositoryException - if an error occurs
      IOException - 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 interface PackageProperties
      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 interface JcrPackageDefinition
      Parameters:
      dependencies - the package dependencies
      autoSave - if true 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 interface JcrPackageDefinition
      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 interface JcrPackageDefinition
      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 interface JcrPackageDefinition
      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 interface JcrPackageDefinition
      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 interface JcrPackageDefinition
      Parameters:
      name - the name of the property
      value - the value or null to clear the property
      autoSave - if true 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 interface JcrPackageDefinition
      Parameters:
      name - the name of the property
      value - the value or null to clear the property
      autoSave - if true 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 interface JcrPackageDefinition
      Parameters:
      name - the name of the property
      value - the value
      autoSave - if true 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 interface JcrPackageDefinition
      Parameters:
      now - calendar or null
      autoSave - if true 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 interface JcrPackageDefinition
      Parameters:
      filter - the filter to set
      autoSave - if true the modifications are saved automatically.
    • getLastModified

      public Calendar getLastModified()
      Returns the last modification date or null if n/a.
      Specified by:
      getLastModified in interface PackageProperties
      Returns:
      last modification date or null
    • getLastModifiedBy

      public String getLastModifiedBy()
      Returns the user that last modified the package or null if n/a.
      Specified by:
      getLastModifiedBy in interface PackageProperties
      Returns:
      the user or null
    • getCreated

      public Calendar getCreated()
      Returns the date when this package was built or null if n/a.
      Specified by:
      getCreated in interface PackageProperties
      Returns:
      the creation date
    • getCreatedBy

      public String getCreatedBy()
      Returns the user that built this package or null if n/a.
      Specified by:
      getCreatedBy in interface PackageProperties
      Returns:
      the creator
    • getGenerator

      public String getGenerator()
      Returns the name and version of the component that generated the package.
      Specified by:
      getGenerator in interface PackageProperties
      Returns:
      the generator or null if n/a
    • getLastUnwrapped

      public Calendar getLastUnwrapped()
      Returns the last unwrapped date
      Specified by:
      getLastUnwrapped in interface JcrPackageDefinition
      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 interface PackageProperties
      Returns:
      the wrapper
    • getLastWrapped

      public Calendar getLastWrapped()
      Returns the date when this package was wrapped or null if n/a.
      Specified by:
      getLastWrapped in interface PackageProperties
      Returns:
      the wrapped date
    • getLastUnwrappedBy

      public String getLastUnwrappedBy()
      Returns the last unwrapped user id
      Specified by:
      getLastUnwrappedBy in interface JcrPackageDefinition
      Returns:
      the last unwrapped user id
    • getLastUnpacked

      public Calendar getLastUnpacked()
      Returns the date when the package was unpacked
      Specified by:
      getLastUnpacked in interface JcrPackageDefinition
      Returns:
      the unpacked date
    • getLastUnpackedBy

      public String getLastUnpackedBy()
      Returns the user id who unpacked the package
      Specified by:
      getLastUnpackedBy in interface JcrPackageDefinition
      Returns:
      the unpacked user id
    • requiresRoot

      @Deprecated public boolean requiresRoot()
      Deprecated.
      Returns true if this package can only be extracted by a admin session.
      Specified by:
      requiresRoot in interface PackageProperties
      Returns:
      true if this package requires an admin session for extraction.
    • requiresRestart

      public boolean requiresRestart()
      Returns true if this package requires a restart after installation.
      Specified by:
      requiresRestart in interface PackageProperties
      Returns:
      true if this package requires a restart after installation.
    • getAccessControlHandling

      public AccessControlHandling getAccessControlHandling()
      Returns the access control handling defined in the definition, or null if not defined.
      Specified by:
      getAccessControlHandling in interface JcrPackageDefinition
      Returns:
      the access control handling or null
    • getDescription

      public String getDescription()
      Returns a description of this package or null if n/a
      Specified by:
      getDescription in interface PackageProperties
      Returns:
      a description
    • getBuildCount

      public long getBuildCount()
      Returns the build count of this package
      Specified by:
      getBuildCount in interface PackageProperties
      Returns:
      the build count.
    • getMetaInf

      public MetaInf getMetaInf() throws RepositoryException
      Returns the meta inf of this package
      Specified by:
      getMetaInf in interface JcrPackageDefinition
      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 interface PackageProperties
      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 interface PackageProperties
      Returns:
      the access control handling.
    • getSubPackageHandling

      public SubPackageHandling getSubPackageHandling()
      Description copied from interface: PackageProperties
      Returns the sub package handling configuration
      Specified by:
      getSubPackageHandling in interface PackageProperties
      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 or null if it does not exist or if the value cannot be converted to a date.
      Specified by:
      getDateProperty in interface PackageProperties
      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 or null if it does not exist.
      Specified by:
      getProperty in interface PackageProperties
      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 or null if no package type was specified for this package.
      Specified by:
      getPackageType in interface PackageProperties
      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 interface PackageProperties
      Returns:
      dependencies locations as map