Class ConnectBroker

    • Method Detail

      • getCLID

        public String getCLID()
                       throws org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
        Throws:
        org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
      • setCLID

        public void setCLID​(String file)
                     throws org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
        Throws:
        org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID - if the CLID is absent or invalid
        Since:
        6.0
      • saveCLID

        public void saveCLID()
                      throws IOException,
                             org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
        Throws:
        IOException
        org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
        Since:
        8.10-HF15
      • getPackageManager

        public org.nuxeo.connect.packages.PackageManager getPackageManager()
      • getRemotePackageId

        protected String getRemotePackageId​(String pkgNameOrId)
        Looks for a remote package from its name or id
        Returns:
        the remote package Id; null if not found
        Since:
        5.7
      • getLocalPackage

        protected org.nuxeo.connect.update.LocalPackage getLocalPackage​(String pkgIdOrName)
                                                                 throws org.nuxeo.connect.update.PackageException
        Looks for a local package from its name or id
        Returns:
        the local package Id; null if not found
        Throws:
        org.nuxeo.connect.update.PackageException
        Since:
        5.7
      • getLocalPackageFile

        protected File getLocalPackageFile​(String pkgFile)
        Looks for a package file from its path
        Parameters:
        pkgFile - Absolute or relative package file path
        Returns:
        the file if found, else null
      • getLocalPackageFileId

        protected String getLocalPackageFileId​(File pkgFile)
        Load package definition from a local file or directory and get package Id from it.
        Returns:
        null the package definition cannot be loaded for any reason.
        Since:
        8.4
      • getPkgList

        public List<org.nuxeo.connect.update.LocalPackage> getPkgList()
      • pkgList

        public void pkgList​(List<? extends org.nuxeo.connect.data.DownloadablePackage> packagesList)
      • performTask

        protected void performTask​(org.nuxeo.connect.update.task.Task task)
                            throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
      • pkgPurge

        public boolean pkgPurge()
                         throws org.nuxeo.connect.update.PackageException
        Throws:
        org.nuxeo.connect.update.PackageException
      • pkgUninstall

        public boolean pkgUninstall​(List<String> packageIdsToRemove)
        Uninstall a list of packages. If the list contains a package name (versus an ID), only the considered as best matching package is uninstalled.
        Parameters:
        packageIdsToRemove - The list can contain package IDs and names
        See Also:
        pkgUninstall(String)
      • pkgUninstall

        public org.nuxeo.connect.update.LocalPackage pkgUninstall​(String pkgId)
        Uninstall a local package. The package is not removed from cache.
        Parameters:
        pkgId - Package ID or Name
        Returns:
        The uninstalled LocalPackage or null if failed
      • pkgRemove

        public boolean pkgRemove​(List<String> pkgsToRemove)
        Remove a list of packages from cache. If the list contains a package name (versus an ID), all matching packages are removed.
        Parameters:
        pkgsToRemove - The list can contain package IDs and names
        See Also:
        pkgRemove(String)
      • pkgRemove

        public org.nuxeo.connect.update.LocalPackage pkgRemove​(String pkgId)
        Remove a package from cache. If it was installed, the package is uninstalled then removed.
        Parameters:
        pkgId - Package ID or Name
        Returns:
        The removed LocalPackage or null if failed
      • pkgAdd

        public boolean pkgAdd​(List<String> pkgsToAdd,
                              boolean ignoreMissing)
        Add a list of packages into the cache, downloading them if needed and possible.
        Returns:
        true if command succeeded
        Since:
        6.0
        See Also:
        pkgAdd(String, boolean)
      • pkgAdd

        public org.nuxeo.connect.update.LocalPackage pkgAdd​(String packageFileName,
                                                            boolean ignoreMissing)
        Add a package file into the cache
        Returns:
        The added LocalPackage or null if failed
        Since:
        6.0
        See Also:
        pkgAdd(List, boolean)
      • pkgInstall

        public boolean pkgInstall​(List<String> packageIdsToInstall,
                                  boolean ignoreMissing)
        Install a list of local packages. If the list contains a package name (versus an ID), only the considered as best matching package is installed.
        Parameters:
        packageIdsToInstall - The list can contain package IDs and names
        ignoreMissing - If true, doesn't throw an exception on unknown packages
        Since:
        6.0
        See Also:
        pkgInstall(String, boolean)
      • persistCommand

        protected void persistCommand​(String command)
        Persists the pending package operation into file system. It's useful when Nuxeo launcher is about to exit. Empty command line won't be persisted.

        The given command will be appended as a new line into target file pendingFile. NOTE: the command line options are not serialized. Therefore, they should be provided by nuxeoctl again after launcher's restart.

        Parameters:
        command - command to persist (appended as a new line)
        Throws:
        IllegalStateException - if any exception occurs
        Since:
        10.2
        See Also:
        pendingFile
      • pkgInstall

        public org.nuxeo.connect.update.LocalPackage pkgInstall​(String pkgId,
                                                                boolean ignoreMissing)
        Install a local package.
        Parameters:
        pkgId - Package ID or Name
        ignoreMissing - If true, doesn't throw an exception on unknown packages
        Returns:
        The installed LocalPackage or null if failed
        Since:
        6.0
        See Also:
        pkgInstall(List, boolean)
      • executePending

        public boolean executePending​(File commandsFile,
                                      boolean doExecute,
                                      boolean useResolver,
                                      boolean ignoreMissing)
        Parameters:
        commandsFile - File containing the commands to execute
        doExecute - Whether to execute or list the actions
        useResolver - Whether to use full resolution or just execute individual actions
        Since:
        5.6
      • pkgRequest

        public boolean pkgRequest​(List<String> pkgsToAdd,
                                  List<String> pkgsToInstall,
                                  List<String> pkgsToUninstall,
                                  List<String> pkgsToRemove,
                                  boolean keepExisting,
                                  boolean ignoreMissing)
        Parameters:
        keepExisting - If false, the request will remove existing packages that are not part of the resolution
        ignoreMissing - Do not error out on missing packages, just handle the rest
        Since:
        5.9.2
      • pkgRequest

        public boolean pkgRequest​(List<String> pkgsToAdd,
                                  List<String> pkgsToInstall,
                                  List<String> pkgsToUninstall,
                                  List<String> pkgsToRemove,
                                  boolean keepExisting,
                                  boolean ignoreMissing,
                                  boolean upgradeMode)
        Parameters:
        keepExisting - If false, the request will remove existing packages that are not part of the resolution
        ignoreMissing - Do not error out on missing packages, just handle the rest
        upgradeMode - If true, all packages will be upgraded to their last compliant version
        Throws:
        LauncherRestartException - if launcher is required to restart
        Since:
        8.4
      • pkgSet

        public boolean pkgSet​(List<String> pkgList,
                              boolean ignoreMissing)
        Installs a list of packages and uninstalls the rest (no dependency check)
        Since:
        6.0
      • readConsole

        protected String readConsole​(String message,
                                     String defaultValue,
                                     Object... objects)
        Prompt user for yes/no answer
        Parameters:
        message - The message to display
        defaultValue - The default answer if there's no console or if "Enter" key is pressed.
        objects - Parameters to use in the message (like in String.format(String, Object...))
        Returns:
        "true" if answer is in POSITIVE_ANSWERS, else return "false"
      • setRelax

        public void setRelax​(String relaxValue)
        Must be called after setAccept(String) which overwrites its value.
        Parameters:
        relaxValue - true, false or ask; ignored if null
      • setAccept

        public void setAccept​(String acceptValue)
        Parameters:
        acceptValue - true, false or ask; if true or ask, then calls setRelax(String) with the same value; ignored if null
      • pkgShow

        public boolean pkgShow​(List<String> packages)
        Parameters:
        packages - List of packages identified by their ID, name or local filename.
        Since:
        5.7
      • findPackage

        protected org.nuxeo.connect.update.Package findPackage​(String pkg)
                                                        throws org.nuxeo.connect.update.PackageException
        Looks for a package. First look if it's a local ZIP file, second if it's a local package and finally if it's a remote package.
        Parameters:
        pkg - A ZIP filename or file path, or package ID or a package name.
        Returns:
        The first package found matching the given string.
        Throws:
        org.nuxeo.connect.update.PackageException - If no package is found or if an issue occurred while searching.
        See Also:
        PackageDefinition, LocalPackage, DownloadablePackage
      • setAllowSNAPSHOT

        public void setAllowSNAPSHOT​(boolean allow)
        Since:
        5.9.1