public class ConnectBroker extends Object
Modifier and Type | Field and Description |
---|---|
static String |
DISTRIBUTION_MP_DIR_DEFAULT |
protected static int |
LAUNCHER_CHANGED_EXIT_CODE |
protected static String |
LAUNCHER_CHANGED_PROPERTY |
static String |
OPTION_ACCEPT_DEFAULT |
static String |
OPTION_RELAX_DEFAULT |
static String |
PACKAGES_XML |
static String |
PARAM_MP_DIR |
static String[] |
POSITIVE_ANSWERS |
Constructor and Description |
---|
ConnectBroker(Environment env) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addDistributionPackage(String md5) |
boolean |
addDistributionPackages() |
protected 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.
|
protected List<String> |
getAllLocalPackageIdsFromName(String pkgName) |
protected String |
getBestIdForNameInList(String pkgName,
List<? extends org.nuxeo.connect.update.Package> pkgList) |
String |
getCLID() |
CommandSetInfo |
getCommandSet() |
protected Map<String,org.nuxeo.connect.update.model.PackageDefinition> |
getDistributionDefinitions(List<String> md5Filenames) |
protected List<String> |
getDistributionFilenames() |
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 id
|
protected File |
getLocalPackageFile(String pkgFile)
Looks for a package file from its path
|
protected 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 |
getPackageManager() |
List<org.nuxeo.connect.update.LocalPackage> |
getPkgList() |
protected String |
getRemotePackageId(String pkgNameOrId)
Looks for a remote package from its name or id
|
protected String |
getRemotePackageIdFromName(String pkgName) |
StandaloneUpdateService |
getUpdateService() |
protected boolean |
isInstalledPackage(String pkgName) |
protected boolean |
isLocalPackageFile(String pkgFile) |
protected boolean |
isLocalPackageId(String pkgId) |
protected boolean |
isRemotePackageId(String pkgId) |
boolean |
listPending(File commandsFile) |
static String |
parseAnswer(String answer) |
protected void |
performTask(org.nuxeo.connect.update.task.Task task) |
boolean |
pkgAdd(List<String> pkgsToAdd)
Deprecated.
Since 7.10. Use a method with an explicit value for
ignoreMissing . |
boolean |
pkgAdd(List<String> pkgsToAdd,
boolean ignoreMissing)
Add a list of packages into the cache, downloading them if needed and possible.
|
org.nuxeo.connect.update.LocalPackage |
pkgAdd(String packageFileName)
Deprecated.
Since 7.10. Use a method with an explicit value for
ignoreMissing . |
org.nuxeo.connect.update.LocalPackage |
pkgAdd(String packageFileName,
boolean ignoreMissing)
Add a package file into the cache
|
boolean |
pkgHotfix() |
boolean |
pkgInstall(List<String> packageIdsToInstall)
Deprecated.
Since 7.10. Use a method with an explicit value for
ignoreMissing . |
boolean |
pkgInstall(List<String> packageIdsToInstall,
boolean ignoreMissing)
Install a list of local packages.
|
org.nuxeo.connect.update.LocalPackage |
pkgInstall(String pkgId)
Deprecated.
Since 7.10. Use a method with an explicit value for
ignoreMissing . |
org.nuxeo.connect.update.LocalPackage |
pkgInstall(String pkgId,
boolean ignoreMissing)
Install a local package.
|
void |
pkgList() |
void |
pkgList(List<? extends org.nuxeo.connect.update.Package> packagesList) |
void |
pkgListAll() |
boolean |
pkgPurge() |
boolean |
pkgRemove(List<String> pkgsToRemove)
Remove a list of packages from cache.
|
org.nuxeo.connect.update.LocalPackage |
pkgRemove(String pkgId)
Remove a package from cache.
|
boolean |
pkgRequest(List<String> pkgsToAdd,
List<String> pkgsToInstall,
List<String> pkgsToUninstall,
List<String> pkgsToRemove)
Deprecated.
Since 7.10. Use
pkgRequest(List, List, List, List, boolean, boolean) instead. |
boolean |
pkgRequest(List<String> pkgsToAdd,
List<String> pkgsToInstall,
List<String> pkgsToUninstall,
List<String> pkgsToRemove,
boolean keepExisting)
Deprecated.
Since 7.10. Use
pkgRequest(List, List, List, List, boolean, boolean) instead. |
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 |
pkgSet(List<String> pkgList)
Deprecated.
Since 7.10. Use #pkgSet(List, boolean) instead.
|
boolean |
pkgSet(List<String> pkgList,
boolean ignoreMissing)
Installs a list of packages and uninstalls the rest (no dependency check)
|
boolean |
pkgShow(List<String> packages) |
boolean |
pkgUninstall(List<String> packageIdsToRemove)
Uninstall a list of packages.
|
org.nuxeo.connect.update.LocalPackage |
pkgUninstall(String pkgId)
Uninstall a local package.
|
boolean |
pkgUpgrade() |
protected String |
readConsole(String message,
String defaultValue,
Object... objects)
Prompt user for yes/no answer
|
void |
refreshCache() |
void |
saveCLID() |
void |
setAccept(String acceptValue) |
void |
setAllowSNAPSHOT(boolean allow) |
void |
setCLID(String file) |
void |
setRelax(String relaxValue)
Must be called after
setAccept(String) which overwrites its value. |
public static final String PARAM_MP_DIR
public static final String DISTRIBUTION_MP_DIR_DEFAULT
public static final String PACKAGES_XML
protected static final String LAUNCHER_CHANGED_PROPERTY
protected static final int LAUNCHER_CHANGED_EXIT_CODE
public static final String[] POSITIVE_ANSWERS
public static final String OPTION_RELAX_DEFAULT
public static final String OPTION_ACCEPT_DEFAULT
public ConnectBroker(Environment env) throws IOException, org.nuxeo.connect.update.PackageException
IOException
org.nuxeo.connect.update.PackageException
public String getCLID() throws org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
public void setCLID(String file) throws org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
- if the CLID is absent or invalidpublic void saveCLID() throws IOException, org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
IOException
org.nuxeo.connect.identity.LogicalInstanceIdentifier.NoCLID
public StandaloneUpdateService getUpdateService()
public org.nuxeo.connect.packages.PackageManager getPackageManager()
public void refreshCache()
public CommandSetInfo getCommandSet()
protected org.nuxeo.connect.update.LocalPackage getInstalledPackageByName(String pkgName)
protected boolean isInstalledPackage(String pkgName)
protected boolean isLocalPackageId(String pkgId)
protected boolean isRemotePackageId(String pkgId)
protected String getBestIdForNameInList(String pkgName, List<? extends org.nuxeo.connect.update.Package> pkgList)
protected String getLocalPackageIdFromName(String pkgName)
protected List<String> getAllLocalPackageIdsFromName(String pkgName)
protected String getInstalledPackageIdFromName(String pkgName)
protected String getRemotePackageIdFromName(String pkgName)
protected String getRemotePackageId(String pkgNameOrId)
protected org.nuxeo.connect.update.LocalPackage getLocalPackage(String pkgIdOrName) throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
protected File getLocalPackageFile(String pkgFile)
pkgFile
- Absolute or relative package file pathprotected String getLocalPackageFileId(File pkgFile)
protected boolean isLocalPackageFile(String pkgFile)
protected List<String> getDistributionFilenames()
protected Map<String,org.nuxeo.connect.update.model.PackageDefinition> getDistributionDefinitions(List<String> md5Filenames)
protected boolean addDistributionPackage(String md5)
public boolean addDistributionPackages()
public List<org.nuxeo.connect.update.LocalPackage> getPkgList()
public void pkgList()
public void pkgListAll()
protected void performTask(org.nuxeo.connect.update.task.Task task) throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
public boolean pkgReset()
public boolean pkgPurge() throws org.nuxeo.connect.update.PackageException
org.nuxeo.connect.update.PackageException
public boolean pkgUninstall(List<String> packageIdsToRemove)
packageIdsToRemove
- The list can contain package IDs and namespkgUninstall(String)
public org.nuxeo.connect.update.LocalPackage pkgUninstall(String pkgId)
pkgId
- Package ID or Namepublic boolean pkgRemove(List<String> pkgsToRemove)
pkgsToRemove
- The list can contain package IDs and namespkgRemove(String)
public org.nuxeo.connect.update.LocalPackage pkgRemove(String pkgId)
pkgId
- Package ID or Name@Deprecated public boolean pkgAdd(List<String> pkgsToAdd)
ignoreMissing
.pkgAdd(List, boolean)
,
pkgAdd(String, boolean)
public boolean pkgAdd(List<String> pkgsToAdd, boolean ignoreMissing)
pkgAdd(String, boolean)
@Deprecated public org.nuxeo.connect.update.LocalPackage pkgAdd(String packageFileName)
ignoreMissing
.pkgAdd(List, boolean)
,
pkgAdd(String, boolean)
public org.nuxeo.connect.update.LocalPackage pkgAdd(String packageFileName, boolean ignoreMissing)
pkgAdd(List, boolean)
@Deprecated public boolean pkgInstall(List<String> packageIdsToInstall)
ignoreMissing
.packageIdsToInstall
- The list can contain package IDs and namespkgInstall(List, boolean)
,
pkgInstall(String, boolean)
public boolean pkgInstall(List<String> packageIdsToInstall, boolean ignoreMissing)
packageIdsToInstall
- The list can contain package IDs and namesignoreMissing
- If true, doesn't throw an exception on unknown packagespkgInstall(String, boolean)
@Deprecated public org.nuxeo.connect.update.LocalPackage pkgInstall(String pkgId)
ignoreMissing
.pkgId
- Package ID or NamepkgInstall(List, boolean)
,
pkgInstall(String, boolean)
public org.nuxeo.connect.update.LocalPackage pkgInstall(String pkgId, boolean ignoreMissing)
pkgId
- Package ID or NameignoreMissing
- If true, doesn't throw an exception on unknown packagespkgInstall(List, boolean)
public boolean listPending(File commandsFile)
public boolean executePending(File commandsFile, boolean doExecute, boolean useResolver, boolean ignoreMissing)
commandsFile
- File containing the commands to executedoExecute
- Whether to execute or list the actionsuseResolver
- Whether to use full resolution or just execute individual actionsprotected boolean downloadPackages(List<String> packagesToDownload)
@Deprecated public boolean pkgRequest(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove)
pkgRequest(List, List, List, List, boolean, boolean)
instead.@Deprecated public boolean pkgRequest(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove, boolean keepExisting)
pkgRequest(List, List, List, List, boolean, boolean)
instead.keepExisting
- If false, the request will remove existing packages that are not part of the resolutionpublic boolean pkgRequest(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove, boolean keepExisting, boolean ignoreMissing)
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 restpublic boolean pkgRequest(List<String> pkgsToAdd, List<String> pkgsToInstall, List<String> pkgsToUninstall, List<String> pkgsToRemove, boolean keepExisting, boolean ignoreMissing, boolean upgradeMode)
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@Deprecated public boolean pkgSet(List<String> pkgList)
public boolean pkgSet(List<String> pkgList, boolean ignoreMissing)
protected String readConsole(String message, String defaultValue, Object... objects)
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 in String.format(String, Object...)
)"true"
if answer is in POSITIVE_ANSWERS
, else return "false"
public static String parseAnswer(String answer)
"true"
if answer is in POSITIVE_ANSWERS
, and "ask"
if answer values
"ask"
, else return "false"
public boolean pkgHotfix()
public boolean pkgUpgrade()
public void setRelax(String relaxValue)
setAccept(String)
which overwrites its value.relaxValue
- true, false or ask; ignored if nullpublic void setAccept(String acceptValue)
acceptValue
- true, false or ask; if true or ask, then calls setRelax(String)
with the same value;
ignored if nullpublic boolean pkgShow(List<String> packages)
packages
- List of packages identified by their ID, name or local filename.protected org.nuxeo.connect.update.Package findPackage(String pkg) throws org.nuxeo.connect.update.PackageException
pkg
- A ZIP filename or file path, or package ID or a package name.org.nuxeo.connect.update.PackageException
- If no package is found or if an issue occurred while searching.PackageDefinition
,
LocalPackage
,
DownloadablePackage
public void setAllowSNAPSHOT(boolean allow)
Copyright © 2018 Nuxeo. All rights reserved.