Class JcrPackageDefinitionImpl

    • Constructor Detail

      • JcrPackageDefinitionImpl

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

      • getNode

        @NotNull
        public @NotNull javax.jcr.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,
                           boolean autoSave)
                    throws javax.jcr.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:
        javax.jcr.RepositoryException - if an error occurs
        IOException - if an I/O error occurs
      • unwrap

        public void unwrap​(Archive archive,
                           boolean autoSave)
                    throws javax.jcr.RepositoryException,
                           IOException
        Throws:
        javax.jcr.RepositoryException
        IOException
      • 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 javax.jcr.RepositoryException
        Dumps the coverage of this definition to the given listener
        Specified by:
        dumpCoverage in interface JcrPackageDefinition
        Parameters:
        listener - the listener
        Throws:
        javax.jcr.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
      • 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
      • 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.
      • 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 javax.jcr.RepositoryException
        Returns the meta inf of this package
        Specified by:
        getMetaInf in interface JcrPackageDefinition
        Returns:
        the meta inf
        Throws:
        javax.jcr.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
      • 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 not 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