Package net.shibboleth.idp.installer.plugin.impl

# Class PluginInstallerCLI

java.lang.Object
net.shibboleth.shared.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/interfaces inherited from class net.shibboleth.shared.cli.AbstractCommandLine

`AbstractCommandLine.TerminalCodes`

## Field Summary

Fields
Modifier and Type
Field
Description
`private InstallableComponentVersion`
`determinedIdpVersion`
The IdP Version (or a suitable default).
`private PluginInstaller`
`installer`
A Plugin Installer to use.
`private org.slf4j.Logger`
`log`
Class logger.
`private List<URL>`
`updateURLs`
Update URLs.

### Fields inherited from class net.shibboleth.shared.cli.AbstractCommandLine

`ARGS_PROPERTY, RC_INIT, RC_IO, RC_MODULE, RC_OK, RC_UNKNOWN`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`PluginInstallerCLI()`
Constrained Constructor.

## Method Summary

Modifier and Type
Method
Description
`private int`
`autoPluginFromId(String pluginId, boolean checkVersion)`
Given the pluginId find the best version and install.
`private void`
`constructPluginInstaller(PluginInstaller inst, PluginInstallerArguments args)`
Build the installer.
`private void`
`doContentList(String pluginId)`
List the contents for the detailed plugin.
`private int`
`doList(boolean fullList, String pluginId)`
List all installed plugins (or just one if provided).
`private int`
`doListAvailable()`
Go to the well known url (or the provided one) and list all the available plugin ids.
`protected int`
`doRun(PluginInstallerArguments args)`
`private boolean`
`doUpdate(String pluginId, InstallableComponentVersion pluginVersion, boolean checkVersion)`
Update the plugin.
`private List<URL>`
`ensureUpdateURLs()`
Null-safe getter for `updateURLs`.
`protected List<Resource>`
`getAdditionalSpringResources()`
`protected Class<PluginInstallerArguments>`
`getArgumentClass()`
`InstallableComponentVersion`
`getBestVersion(InstallableComponentVersion pluginVersion, InstallableComponentInfo pluginInfo)`
Find the best update version.
`private InstallableComponentVersion`
`getIdPVersion()`
Get The IdP Version (or a suitable default).
`protected org.slf4j.Logger`
`getLogger()`
`protected String`
`getVersion()`
`private Properties`
`loadAllPluginInfo()`
Download all plugin info from the provide or "known" location.
`static void`
`main(String[] args)`
CLI entry point.
`private void`
`outOrLog(String message)`
Emit the line to System.out or the log if not present.
`private void`
`outputLicense(String pluginId)`
Print the license file for the specified plugin.
`private void`
`printDetails(IdPPlugin plugin)`
Print our more information about a plugin.
`static int`
`runMain(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.shared.cli.AbstractCommandLine

`getApplicationContext, initLogging, run, setCaseSensitiveOptions, setContextInitializer`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

private org.slf4j.Logger log
Class logger.

### installer

@Nullable private PluginInstaller installer
A Plugin Installer to use.

### updateURLs

private List<URL> updateURLs
Update URLs.

### determinedIdpVersion

@Nullable private InstallableComponentVersion determinedIdpVersion
The IdP Version (or a suitable default).

## Constructor Details

### PluginInstallerCLI

private PluginInstallerCLI()
Constrained Constructor.

## Method Details

### getLogger

@Nonnull protected org.slf4j.Logger getLogger()

Specified by:
  `getLogger` in class `AbstractCommandLine<PluginInstallerArguments>`

### getArgumentClass

@Nonnull protected Class<PluginInstallerArguments> getArgumentClass()

Specified by:
  `getArgumentClass` in class `AbstractCommandLine<PluginInstallerArguments>`

### getVersion

@Nonnull protected String getVersion()

Specified by:
  `getVersion` in class `AbstractCommandLine<PluginInstallerArguments>`

### getAdditionalSpringResources

@Nonnull protected List<Resource> getAdditionalSpringResources()

Overrides:
  `getAdditionalSpringResources` in class `AbstractCommandLine<PluginInstallerArguments>`

### ensureUpdateURLs

@Nonnull private List<URL> ensureUpdateURLs()
Null-safe getter for `updateURLs`.

Returns:
  `updateURLs`, which is guaranteed to be non null.

### doRun

protected int doRun(@Nonnull PluginInstallerArguments args)

Overrides:
  `doRun` in class `AbstractIdPHomeAwareCommandLine<PluginInstallerArguments>`

### constructPluginInstaller

private void constructPluginInstaller(PluginInstaller inst, PluginInstallerArguments args) throws ComponentInitializationException
Build the installer.

Parameters:
  `inst` - the newly created installed
  `args` - 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 for `doList(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 int doList(boolean fullList, @Nullable String pluginId)
List all installed plugins (or just one if provided).

Parameters:
  `fullList` - whether to do full deatils
  `pluginId` - the pluginId or null.
Returns:
  `AbstractCommandLine.RC_MODULE` if we hit a module issue, otherwise `AbstractCommandLine.RC_OK`

### doContentList

private void doContentList(@Nonnull String pluginId)
List the contents for the detailed plugin.

Parameters:
  `pluginId` - the pluginId

### getIdPVersion

@Nonnull private InstallableComponentVersion getIdPVersion()
Get The IdP Version (or a suitable default).

Returns:
  the version.

### getBestVersion

@Nullable public InstallableComponentVersion getBestVersion(@Nonnull InstallableComponentVersion pluginVersion, @Nonnull InstallableComponentInfo pluginInfo)
Find the best update version.

Parameters:
  `pluginVersion` - The Plugin versionget
  `pluginInfo` - all about the plugin
Returns:
  the best version (or null)

### 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

### autoPluginFromId

private int autoPluginFromId(@Nonnull String pluginId, boolean checkVersion)
Given the pluginId find the best version and install. If already installed whine

Parameters:
  `pluginId` - what to install
  `checkVersion` - are we checking the version.
Returns:
  installation status

### loadAllPluginInfo

private Properties loadAllPluginInfo()
Download all plugin info from the provide or "known" location.

Returns:
  the properties.

### doUpdate

private boolean doUpdate(@Nonnull String pluginId, @Nullable InstallableComponentVersion 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.
Returns:
  if the installation did any work.

### 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_OK` or `AbstractCommandLine.RC_UNKNOWN`

### main

public static void main(@Nonnull String[] args)
CLI entry point.

Parameters:
  `args` - arguments