Package org.nuxeo.launcher.connect
Class ConnectBroker
java.lang.Object
org.nuxeo.launcher.connect.ConnectBroker
- Since:
- 5.6
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleandownloadPackages(List<String> packagesToDownload) booleanexecutePending(File commandsFile, boolean doExecute, boolean useResolver, boolean ignoreMissing) protected org.nuxeo.connect.update.PackagefindPackage(String pkg) Looks for a package.getAllLocalPackageIdsFromName(String pkgName) protected StringgetBestIdForNameInList(String pkgName, List<? extends org.nuxeo.connect.update.Package> pkgList) getCLID()protected org.nuxeo.connect.update.LocalPackagegetInstalledPackageByName(String pkgName) protected StringgetInstalledPackageIdFromName(String pkgName) protected org.nuxeo.connect.update.LocalPackagegetLocalPackage(String pkgIdOrName) Looks for a local package from its name or idprotected FilegetLocalPackageFile(String pkgFile) Looks for a package file from its pathprotected StringgetLocalPackageFileId(File pkgFile) Load package definition from a local file or directory and get package Id from it.protected StringgetLocalPackageIdFromName(String pkgName) org.nuxeo.connect.packages.PackageManagerList<org.nuxeo.connect.update.LocalPackage>protected StringgetRemotePackageId(String pkgNameOrId) Looks for a remote package from its name or idprotected StringgetRemotePackageIdFromName(String pkgName) protected booleanisInstalledPackage(String pkgName) protected booleanisLocalPackageFile(String pkgFile) protected booleanisLocalPackageId(String pkgId) protected booleanisRemotePackageId(String pkgId) protected booleanbooleanlistPending(File commandsFile) static StringparseAnswer(String answer) protected voidperformTask(org.nuxeo.connect.update.task.Task task) protected voidpersistCommand(String command) Persists the pending package operation into file system.org.nuxeo.connect.update.LocalPackageAdd a package file into the cachebooleanAdd a list of packages into the cache, downloading them if needed and possible.booleanorg.nuxeo.connect.update.LocalPackagepkgInstall(String pkgId, boolean ignoreMissing) Install a local package.booleanpkgInstall(List<String> packageIdsToInstall, boolean ignoreMissing) Install a list of local packages.voidpkgList()voidvoidbooleanpkgPurge()org.nuxeo.connect.update.LocalPackageRemove a package from cache.booleanRemove a list of packages from cache.booleanpkgRequest(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove, boolean keepExisting, boolean ignoreMissing) booleanpkgRequest(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove, boolean keepExisting, boolean ignoreMissing, boolean upgradeMode) booleanpkgReset()booleanInstalls a list of packages and uninstalls the rest (no dependency check)booleanorg.nuxeo.connect.update.LocalPackagepkgUninstall(String pkgId) Uninstall a local package.booleanpkgUninstall(List<String> packageIdsToRemove) Uninstall a list of packages.booleanprotected StringreadConsole(String message, String defaultValue, Object... objects) Prompt user for yes/no answervoidvoidsaveCLID()voidvoidsetAllowSNAPSHOT(boolean allow) voidvoidsetPendingFile(Path pendingFile) voidMust be called aftersetAccept(String)which overwrites its value.
-
Field Details
-
POSITIVE_ANSWERS
-
LAUNCHER_CHANGED_PROPERTY
- See Also:
-
OPTION_RELAX_DEFAULT
- See Also:
-
OPTION_ACCEPT_DEFAULT
- See Also:
-
-
Constructor Details
-
ConnectBroker
- Throws:
IOExceptionorg.nuxeo.connect.update.PackageException
-
-
Method Details
-
getPendingFile
- Since:
- 10.2
-
setPendingFile
- Since:
- 10.2
-
getCLID
- Throws:
org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
-
setCLID
- 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:
IOExceptionorg.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID- Since:
- 8.10-HF15
-
getUpdateService
-
getPackageManager
public org.nuxeo.connect.packages.PackageManager getPackageManager() -
refreshCache
public void refreshCache() -
getCommandSet
-
getInstalledPackageByName
-
isInstalledPackage
-
isLocalPackageId
-
isRemotePackageId
-
getBestIdForNameInList
-
getLocalPackageIdFromName
-
getAllLocalPackageIdsFromName
-
getInstalledPackageIdFromName
-
getRemotePackageIdFromName
-
getRemotePackageId
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
Looks for a package file from its path- Parameters:
pkgFile- Absolute or relative package file path- Returns:
- the file if found, else null
-
getLocalPackageFileId
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
-
isLocalPackageFile
-
getPkgList
-
pkgList
public void pkgList() -
pkgListAll
public void pkgListAll() -
pkgList
-
performTask
protected void performTask(org.nuxeo.connect.update.task.Task task) throws org.nuxeo.connect.update.PackageException - Throws:
org.nuxeo.connect.update.PackageException
-
pkgReset
public boolean pkgReset() -
pkgPurge
public boolean pkgPurge() throws org.nuxeo.connect.update.PackageException- Throws:
org.nuxeo.connect.update.PackageException
-
pkgUninstall
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
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
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
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
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
Add a package file into the cache- Returns:
- The added LocalPackage or null if failed
- Since:
- 6.0
- See Also:
-
pkgInstall
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 namesignoreMissing- If true, doesn't throw an exception on unknown packages- Since:
- 6.0
- See Also:
-
persistCommand
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
-
isRestartRequired
protected boolean isRestartRequired()- Since:
- 10.2
-
pkgInstall
Install a local package.- Parameters:
pkgId- Package ID or NameignoreMissing- If true, doesn't throw an exception on unknown packages- Returns:
- The installed LocalPackage or null if failed
- Since:
- 6.0
- See Also:
-
listPending
-
executePending
public boolean executePending(File commandsFile, boolean doExecute, boolean useResolver, boolean ignoreMissing) - Parameters:
commandsFile- File containing the commands to executedoExecute- Whether to execute or list the actionsuseResolver- Whether to use full resolution or just execute individual actions- Since:
- 5.6
-
downloadPackages
-
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 resolutionignoreMissing- 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 resolutionignoreMissing- Do not error out on missing packages, just handle the restupgradeMode- If true, all packages will be upgraded to their last compliant version- Throws:
LauncherRestartException- if launcher is required to restart- Since:
- 8.4
-
pkgSet
Installs a list of packages and uninstalls the rest (no dependency check)- Since:
- 6.0
-
readConsole
Prompt user for yes/no answer- Parameters:
message- The message to displaydefaultValue- The default answer if there's no console or if "Enter" key is pressed.objects- Parameters to use in the message (like inString.format(String, Object...))- Returns:
"true"if answer is inPOSITIVE_ANSWERS, else return"false"
-
parseAnswer
- Returns:
"true"if answer is inPOSITIVE_ANSWERS, and"ask"if answer values"ask", else return"false"- Since:
- 6.0
-
pkgHotfix
public boolean pkgHotfix() -
pkgUpgrade
public boolean pkgUpgrade() -
setRelax
Must be called aftersetAccept(String)which overwrites its value.- Parameters:
relaxValue- true, false or ask; ignored if null
-
setAccept
- Parameters:
acceptValue- true, false or ask; if true or ask, then callssetRelax(String)with the same value; ignored if null
-
pkgShow
- 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:
-
PackageDefinitionLocalPackageDownloadablePackage
-
setAllowSNAPSHOT
public void setAllowSNAPSHOT(boolean allow) - Since:
- 5.9.1
-