Package org.nuxeo.launcher.connect
Class ConnectBroker
java.lang.Object
org.nuxeo.launcher.connect.ConnectBroker
- Since:
- 5.6
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
downloadPackages
(List<String> packagesToDownload) boolean
executePending
(File commandsFile, boolean doExecute, boolean useResolver, boolean ignoreMissing) protected org.nuxeo.connect.update.Package
findPackage
(String pkg) Looks for a package.getAllLocalPackageIdsFromName
(String pkgName) protected String
getBestIdForNameInList
(String pkgName, List<? extends org.nuxeo.connect.update.Package> pkgList) getCLID()
protected org.nuxeo.connect.update.LocalPackage
getInstalledPackageByName
(String pkgName) protected String
getInstalledPackageIdFromName
(String pkgName) protected org.nuxeo.connect.update.LocalPackage
getLocalPackage
(String pkgIdOrName) Looks for a local package from its name or idprotected File
getLocalPackageFile
(String pkgFile) Looks for a package file from its pathprotected String
getLocalPackageFileId
(File pkgFile) Load package definition from a local file or directory and get package Id from it.protected String
getLocalPackageIdFromName
(String pkgName) org.nuxeo.connect.packages.PackageManager
List<org.nuxeo.connect.update.LocalPackage>
protected String
getRemotePackageId
(String pkgNameOrId) Looks for a remote package from its name or idprotected String
getRemotePackageIdFromName
(String pkgName) protected boolean
isInstalledPackage
(String pkgName) protected boolean
isLocalPackageFile
(String pkgFile) protected boolean
isLocalPackageId
(String pkgId) protected boolean
isRemotePackageId
(String pkgId) protected boolean
boolean
listPending
(File commandsFile) static String
parseAnswer
(String answer) protected void
performTask
(org.nuxeo.connect.update.task.Task task) protected void
persistCommand
(String command) Persists the pending package operation into file system.org.nuxeo.connect.update.LocalPackage
Add a package file into the cacheboolean
Add a list of packages into the cache, downloading them if needed and possible.boolean
org.nuxeo.connect.update.LocalPackage
pkgInstall
(String pkgId, boolean ignoreMissing) Install a local package.boolean
pkgInstall
(List<String> packageIdsToInstall, boolean ignoreMissing) Install a list of local packages.void
pkgList()
void
void
boolean
pkgPurge()
org.nuxeo.connect.update.LocalPackage
Remove a package from cache.boolean
Remove a list of packages from cache.boolean
pkgRequest
(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove, boolean keepExisting, boolean ignoreMissing) boolean
pkgRequest
(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove, boolean keepExisting, boolean ignoreMissing, boolean upgradeMode) boolean
pkgReset()
boolean
Installs a list of packages and uninstalls the rest (no dependency check)boolean
org.nuxeo.connect.update.LocalPackage
pkgUninstall
(String pkgId) Uninstall a local package.boolean
pkgUninstall
(List<String> packageIdsToRemove) Uninstall a list of packages.boolean
protected String
readConsole
(String message, String defaultValue, Object... objects) Prompt user for yes/no answervoid
void
saveCLID()
void
void
setAllowSNAPSHOT
(boolean allow) void
void
setPendingFile
(Path pendingFile) void
Must 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:
IOException
org.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:
IOException
org.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:
-
PackageDefinition
LocalPackage
DownloadablePackage
-
setAllowSNAPSHOT
public void setAllowSNAPSHOT(boolean allow) - Since:
- 5.9.1
-