Class PackagePersistence


  • public class PackagePersistence
    extends Object
    The file nxserver/data/packages/.packages stores the state of all local features.

    Each local package have a corresponding directory in nxserver/data/features/store which is named: <package_uid> ("id-version")

    Author:
    Bogdan Stefanescu
    • Field Detail

      • root

        protected final File root
      • store

        protected final File store
      • temp

        protected final File temp
      • RANDOM

        protected static final Random RANDOM
      • states

        protected Map<String,​org.nuxeo.connect.update.PackageState> states
    • Constructor Detail

      • PackagePersistence

        public PackagePersistence​(org.nuxeo.connect.update.PackageUpdateService pus)
                           throws IOException
        Throws:
        IOException
    • Method Detail

      • getRoot

        public File getRoot()
      • getStore

        public File getStore()
        Since:
        7.1
      • getStates

        public Map<String,​org.nuxeo.connect.update.PackageState> getStates()
      • getPackage

        public org.nuxeo.connect.update.LocalPackage getPackage​(String id)
                                                         throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
      • addPackage

        public org.nuxeo.connect.update.LocalPackage addPackage​(File file)
                                                         throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
      • addPackageFromDir

        protected org.nuxeo.connect.update.LocalPackage addPackageFromDir​(File file)
                                                                   throws org.nuxeo.connect.update.PackageException
        Add unzipped packaged to local cache. It replaces SNAPSHOT packages if not installed
        Throws:
        org.nuxeo.connect.update.AlreadyExistsPackageException - If not replacing a SNAPSHOT or if the existing package is installed
        org.nuxeo.connect.update.PackageException
      • getState

        public org.nuxeo.connect.update.PackageState getState​(String packageId)
      • getActivePackage

        public org.nuxeo.connect.update.LocalPackage getActivePackage​(String name)
                                                               throws org.nuxeo.connect.update.PackageException
        Get the local package having the given name and which is in either one of the following states:
        • PackageState.INSTALLING
        • PackageState.INSTALLED
        • PackageState.STARTED
        Throws:
        org.nuxeo.connect.update.PackageException
      • getActivePackageId

        public String getActivePackageId​(String name)
                                  throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
      • getPackages

        public List<org.nuxeo.connect.update.LocalPackage> getPackages()
                                                                throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
      • removePackage

        public void removePackage​(String id)
                           throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
      • updateState

        public void updateState​(String id,
                                org.nuxeo.connect.update.PackageState state)
                         throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
        Since:
        5.7
      • reset

        public void reset()
                   throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
      • newTempDir

        protected File newTempDir​(String id)
      • getInstallDate

        public FileTime getInstallDate​(String id)
        Since:
        5.8