Class PluginInstallerCLI
- java.lang.Object
-
- net.shibboleth.ext.spring.cli.AbstractCommandLine<T>
-
- net.shibboleth.idp.cli.AbstractIdPHomeAwareCommandLine<PluginInstallerArguments>
-
- net.shibboleth.idp.installer.plugin.impl.PluginInstallerCLI
-
public final class PluginInstallerCLI extends AbstractIdPHomeAwareCommandLine<PluginInstallerArguments>
Command line for Plugin Installation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classPluginInstallerCLI.InstallerQueryPredicate to ask the user if they want to install the trust store provided.-
Nested classes/interfaces inherited from class net.shibboleth.ext.spring.cli.AbstractCommandLine
AbstractCommandLine.TerminalCodes
-
-
Field Summary
Fields Modifier and Type Field Description private PluginInstallerinstallerA Plugin Installer to use.private org.slf4j.LoggerlogClass logger.private List<URL>updateURLsUpdate URLs.-
Fields inherited from class net.shibboleth.ext.spring.cli.AbstractCommandLine
ARGS_PROPERTY, RC_INIT, RC_IO, RC_OK, RC_UNKNOWN
-
-
Constructor Summary
Constructors Modifier Constructor Description privatePluginInstallerCLI()Constrained Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private intautoPluginFromId(String pluginId, boolean checkVersion)Given the pluginId find the best version and install.private voidconstructPluginInstaller(PluginInstaller inst, PluginInstallerArguments args)Build the installer.private voiddoContentList(String pluginId)List the contents for the detailed plugin.private voiddoList(boolean fullList, String pluginId)List all installed plugins (or just one if provided).private intdoListAvailable()Go to the well known url (or the provided one) and list all the available plugin ids.protected intdoRun(PluginInstallerArguments args)private voiddoUpdate(String pluginId, PluginVersion pluginVersion, boolean checkVersion)Update the plugin.protected List<Resource>getAdditionalSpringResources()protected Class<PluginInstallerArguments>getArgumentClass()private PluginVersiongetBestVersion(PluginVersion pluginVersion, PluginInfo pluginInfo)Find the best update version.protected org.slf4j.LoggergetLogger()protected StringgetVersion()private PropertiesloadPluginInfo()Load the property file describing all the plugin we know about from a known location.static voidmain(String[] args)CLI entry point.private voidoutOrLog(String message)Emit the line to System.out or the log if not present.private voidoutputLicense(String pluginId)Print the license file for the specified plugin.private voidprintDetails(IdPPlugin plugin)Print our more information about a plugin.static intrunMain(String[] args)Shim for CLI entry point: Allows the code to be run from a test.-
Methods inherited from class net.shibboleth.idp.cli.AbstractIdPHomeAwareCommandLine
getHttpClient, getHttpClientSecurityParameters
-
Methods inherited from class net.shibboleth.ext.spring.cli.AbstractCommandLine
getApplicationContext, initLogging, run, setContextInitializer
-
-
-
-
Field Detail
-
log
@Nullable private org.slf4j.Logger log
Class logger.
-
installer
@Nullable private PluginInstaller installer
A Plugin Installer to use.
-
-
Method Detail
-
getLogger
@Nonnull protected org.slf4j.Logger getLogger()
- Specified by:
getLoggerin classAbstractCommandLine<PluginInstallerArguments>
-
getArgumentClass
@Nonnull protected Class<PluginInstallerArguments> getArgumentClass()
- Specified by:
getArgumentClassin classAbstractCommandLine<PluginInstallerArguments>
-
getVersion
@Nullable protected String getVersion()
- Specified by:
getVersionin classAbstractCommandLine<PluginInstallerArguments>
-
getAdditionalSpringResources
@Nonnull @NonnullElements protected List<Resource> getAdditionalSpringResources()
- Overrides:
getAdditionalSpringResourcesin classAbstractCommandLine<PluginInstallerArguments>
-
doRun
protected int doRun(PluginInstallerArguments args)
- Overrides:
doRunin classAbstractIdPHomeAwareCommandLine<PluginInstallerArguments>
-
constructPluginInstaller
private void constructPluginInstaller(PluginInstaller inst, PluginInstallerArguments args) throws ComponentInitializationException
Build the installer.- Parameters:
inst- the newly created installedargs- the arguments- Throws:
ComponentInitializationException- as required
-
outOrLog
private void outOrLog(String message)
Emit the line to System.out or the log if not present.- Parameters:
message- what to emit.
-
printDetails
private void printDetails(IdPPlugin plugin)
Print our more information about a plugin. Helper method fordoList(boolean, String)- Parameters:
plugin- what we are interested in.
-
outputLicense
private void outputLicense(@Nonnull String pluginId)Print the license file for the specified plugin.- Parameters:
pluginId- what to list
-
doList
private void doList(boolean fullList, @Nullable String pluginId)List all installed plugins (or just one if provided).- Parameters:
fullList- whether to do full deatilspluginId- the pluginId or null.
-
doContentList
private void doContentList(@Nonnull String pluginId)List the contents for the detailed plugin.- Parameters:
pluginId- the pluginId
-
doListAvailable
private int doListAvailable()
Go to the well known url (or the provided one) and list all the available plugin ids.- Returns:
- whether it worked
-
loadPluginInfo
private Properties loadPluginInfo()
Load the property file describing all the plugin we know about from a known location.- Returns:
- the property files plugins.
-
autoPluginFromId
private int autoPluginFromId(String pluginId, boolean checkVersion)
Given the pluginId find the best version and install. If already installed whine- Parameters:
pluginId- what to installcheckVersion- are we checking the version.- Returns:
- installation status
-
getBestVersion
@Nullable private PluginVersion getBestVersion(PluginVersion pluginVersion, PluginInfo pluginInfo)
Find the best update version. Helper function for doUpdate(String, PluginVersion, boolean).- Parameters:
pluginVersion- The Plugin versionpluginInfo- all about the plugin- Returns:
- the best version (or null)
-
doUpdate
private void doUpdate(@Nonnull String pluginId, @Nullable PluginVersion pluginVersion, boolean checkVersion)Update the plugin.- Parameters:
pluginId- the pluginId or null.pluginVersion- (optionally) the version to update to.checkVersion- are we checking the version.
-
runMain
public static int runMain(@Nonnull String[] args)Shim for CLI entry point: Allows the code to be run from a test.- Parameters:
args- arguments- Returns:
- one of the predefines
AbstractCommandLine.RC_INIT,AbstractCommandLine.RC_IO,AbstractCommandLine.RC_OKorAbstractCommandLine.RC_UNKNOWN
-
main
public static void main(@Nonnull String[] args)CLI entry point.- Parameters:
args- arguments
-
-