Package net.shibboleth.idp.installer.impl

# Class InstallerPropertiesImpl

java.lang.Object
net.shibboleth.idp.installer.impl.InstallerPropertiesImpl

public class InstallerPropertiesImpl extends Object
Class which encapsulated all the properties/UI driven configuration of an install. NOTE Updated to this properties should be reflected in the "PropertyDriverInstallation" wiki page."/

## Field Summary

Fields
Modifier and Type
Field
Description
`static final Set<String>`
`CORE_MODULES`
Those modules which are "core".
`private String`
`credentialsKeyFileMode`
credentials key file mode.
`static final Set<String>`
`DEFAULT_MODULES`
Those modules enabled by default.
`private String`
`entityID`
The entity ID.
`private String`
`hostname`
Hostname.
`static final String`
`INITIAL_INSTALL_MODULES`
Which modules to enable on initial install.
`private final org.apache.tools.ant.input.InputHandler`
`inputHandler`
Input handler from the prompting.
`private Properties`
`installerProperties`
The properties driving the install.
`private int`
`keySize`
Key Size.
`private String`
`keyStorePassword`
Keystore Password.
`private final org.slf4j.Logger`
`log`
Class logger.
`private boolean`
`noPrompt`
Do we allow prompting?
`private String`
`scope`
scope.
`private String`
`sealerAlias`
Sealer Alias.
`private String`
`sealerPassword`
Sealer Password.
`private boolean`
`setGroupAndMode`
whether to tidy up.
`private final Path`
`srcDir`
The sourceDirectory.
`private Path`
`targetDir`
The target Directory.
`private boolean`
`tidy`
whether to tidy up.

## Constructor Summary

Constructors
Constructor
Description
`InstallerPropertiesImpl(Path sourceDir)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected String`
`defaultScope()`
Evaluate the default scope value.
`protected void`
`doInitialize()`
Initialization routine.
`String`
`getContextPath()`
Get the context path URL for IdP endpoints.
`Set<String>`
`getCoreModules()`
Get the modules to enable before ant install.
`String`
`getCredentialsGroup()`
Group to set on all files in credentials and conf.
`String`
`getCredentialsKeyFileMode()`
Mode to set on all files in credentials.
`String`
`getEntityID()`
Get the EntityId for this install.
`String`
`getHostName()`
Get the host name for this install.
`Path`
`getIdPMergeProperties()`
Get the a file to merge with idp.properties or null.
`protected org.apache.tools.ant.input.InputHandler`
`getInputHandler()`
Get an `InputHandler` for the prompting.
`int`
`getKeySize()`
Get the key size for signing, encryption and backchannel.
`String`
`getKeyStorePassword()`
Get the password for the keystore for this installation.
`Path`
`getLDAPMergeProperties()`
Get the a file to merge with ldap.properties or null.
`String`
`getLDAPPassword()`
Get the LDAP password iff one was provided.
`protected Path`
`getMergeFile(String propName)`
Get the file specified as the property as a File, or null if it doesn't exist.
`Set<String>`
`getModulesToEnable()`
Get the modules to enable after first install.
`protected String`
`getPassword(String propertyName, String prompt)`
Lookup a property; if it isn't defined then ask the user (if we are allowed) via a no-echo interface.
`String`
`getScope()`
Get the scope for this installation.
`String`
`getSealerAlias()`
Get the alias for the sealer key.
`(package private) Integer`
`getSealerKeySize()`
Return the sealer key size, if this has been specified.
`String`
`getSealerPassword()`
Get the password for the sealer for this installation.
`Path`
`getSourceDir()`
Where is the install coming from?
`String`
`getSubjectAltName()`
Get the SubjectAltName for the certificates.
`Path`
`getTargetDir()`
Get where we are installing/updating/building the war.
`protected String`
`getValue(String propertyName, String prompt, NonnullSupplier<String> defaultSupplier)`
Lookup a property; if it isn't defined then ask the user (if we are allowed).
`boolean`
`isNoTidy()`
Does the user want us to *not* tidy up?
`boolean`
`isSetGroupAndMode()`
Do we set the mode?
`private void`
`setNoTidy()`
Set whether we tidy up behind ourselves.

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

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

## Field Details

### INITIAL_INSTALL_MODULES

@Nonnull @NotEmpty public static final String INITIAL_INSTALL_MODULES
Which modules to enable on initial install.

Since:
  4.1.0
See Also:
  - Constant Field Values

### CORE_MODULES

@Nonnull public static final Set<String> CORE_MODULES
Those modules which are "core".

### DEFAULT_MODULES

@Nonnull public static final Set<String> DEFAULT_MODULES
Those modules enabled by default.

### log

@Nonnull private final org.slf4j.Logger log
Class logger.

### installerProperties

@NonnullAfterInit private Properties installerProperties
The properties driving the install.

### targetDir

@Nullable private Path targetDir
The target Directory.

### srcDir

@Nonnull private final Path srcDir
The sourceDirectory.

### noPrompt

private boolean noPrompt
Do we allow prompting?

### entityID

@Nullable private String entityID
The entity ID.

### hostname

@Nullable private String hostname
Hostname.

### scope

@Nullable private String scope
scope.

### keyStorePassword

@Nullable private String keyStorePassword
Keystore Password.

### sealerPassword

@Nullable private String sealerPassword
Sealer Password.

### sealerAlias

@Nullable private String sealerAlias
Sealer Alias.

### keySize

private int keySize
Key Size. (for signing, encryption and backchannel).

### tidy

private boolean tidy
whether to tidy up.

### setGroupAndMode

private boolean setGroupAndMode
whether to tidy up.

### credentialsKeyFileMode

@Nullable private String credentialsKeyFileMode
credentials key file mode.

### inputHandler

@Nonnull private final org.apache.tools.ant.input.InputHandler inputHandler
Input handler from the prompting.

## Constructor Details

### InstallerPropertiesImpl

public InstallerPropertiesImpl(@Nonnull Path sourceDir)
Constructor.

Parameters:
  `sourceDir` - Where the *source* installation is

## Method Details

### getInputHandler

@Nonnull protected org.apache.tools.ant.input.InputHandler getInputHandler()
Get an `InputHandler` for the prompting.

Returns:
  an input handler

### setNoTidy

private void setNoTidy()
Set whether we tidy up behind ourselves.

### doInitialize

protected void doInitialize() throws ComponentInitializationException
Initialization routine.

Throws:
  `ComponentInitializationException` - if initialization fails

### getValue

@Nonnull protected String getValue(String propertyName, String prompt, NonnullSupplier<String> defaultSupplier) throws org.apache.tools.ant.BuildException
Lookup a property; if it isn't defined then ask the user (if we are allowed).

This is used by most (but all) getters that redirect through a property.

Parameters:
  `propertyName` - the property to lookup
  `prompt` - what to say to the user
  `defaultSupplier` - how to get the default value. Using a Supplier allows this to be a reasonably heavyweight operation
Returns:
  the value
Throws:
  `org.apache.tools.ant.BuildException` - of anything goes wrong

### getPassword

@Nonnull protected String getPassword(String propertyName, String prompt) throws org.apache.tools.ant.BuildException
Lookup a property; if it isn't defined then ask the user (if we are allowed) via a no-echo interface.

Note that this does not work within a debugger.

Parameters:
  `propertyName` - the property to lookup
  `prompt` - what to say to the user
Returns:
  the value (this is not echoed to the terminal)
Throws:
  `org.apache.tools.ant.BuildException` - of anything goes wrong

### getTargetDir

@Nonnull public Path getTargetDir() throws org.apache.tools.ant.BuildException
Get where we are installing/updating/building the war.

This is slightly complicated because the default depends on what we are doing.

Returns:
  the target directory
Throws:
  `org.apache.tools.ant.BuildException` - if something goes awry

### getSourceDir

@Nonnull public Path getSourceDir()
Where is the install coming from?

Returns:
  the source directory

### getEntityID

@Nonnull public String getEntityID()
Get the EntityId for this install.

Returns:
  the name

### isNoTidy

public boolean isNoTidy()
Does the user want us to *not* tidy up?

Returns:
  do we not tidy up?

### getHostName

@Nonnull public String getHostName()
Get the host name for this install.

Defaults to information pulled from the network.

Returns:
  the host name.

### getCredentialsKeyFileMode

@Nonnull public String getCredentialsKeyFileMode()
Mode to set on all files in credentials.

Returns:
  the mode

### getCredentialsGroup

@Nullable public String getCredentialsGroup()
Group to set on all files in credentials and conf.

Returns:
  the mode or null if none to be set

### isSetGroupAndMode

public boolean isSetGroupAndMode()
Do we set the mode?

Returns:
  do we the mode

### defaultScope

@Nonnull protected String defaultScope()
Evaluate the default scope value.

Returns:
  everything after the first '.' in `getHostName()`

### getScope

@Nonnull public String getScope()
Get the scope for this installation.

Returns:
  the scope

### getLDAPPassword

@Nullable public String getLDAPPassword() throws org.apache.tools.ant.BuildException
Get the LDAP password iff one was provided. DO NOT PROMPT

Returns:
  the password if provided by a properties
Throws:
  `org.apache.tools.ant.BuildException` - if badness happens

### getSubjectAltName

@Nonnull public String getSubjectAltName()
Get the SubjectAltName for the certificates.

Returns:
  the SubjectAltName

### getContextPath

@Nonnull public String getContextPath()
Get the context path URL for IdP endpoints.

Returns:
  the base URL

### getKeyStorePassword

@Nonnull public String getKeyStorePassword()
Get the password for the keystore for this installation.

Returns:
  the password.

### getSealerPassword

@Nonnull public String getSealerPassword()
Get the password for the sealer for this installation.

Returns:
  the password.

### getModulesToEnable

@Nonnull @NotLive @Unmodifiable public Set<String> getModulesToEnable()
Get the modules to enable after first install.

Returns:
  the modules

### getCoreModules

@Nonnull @NotLive @Unmodifiable public Set<String> getCoreModules()
Get the modules to enable before ant install.

Returns:
  the modules

### getSealerKeySize

@Nullable Integer getSealerKeySize() throws org.apache.tools.ant.BuildException
Return the sealer key size, if this has been specified.

Returns:
  the key size or null if non specified
Throws:
  `org.apache.tools.ant.BuildException` - if the size was not an integer

### getSealerAlias

@Nonnull public String getSealerAlias()
Get the alias for the sealer key.

Returns:
  the alias

### getKeySize

public int getKeySize()
Get the key size for signing, encryption and backchannel.

Returns:
  the keysize, default is {link #DEFAULT_KEY_SIZE}.

### getMergeFile

@Nullable protected Path getMergeFile(String propName) throws org.apache.tools.ant.BuildException
Get the file specified as the property as a File, or null if it doesn't exist.

Parameters:
  `propName` - the name to lookup
Returns:
  null if the property is not provided a `Path` otherwise
Throws:
  `org.apache.tools.ant.BuildException` - if the property is supplied but the file doesn't exist.

### getIdPMergeProperties

@Nullable public Path getIdPMergeProperties() throws org.apache.tools.ant.BuildException
Get the a file to merge with idp.properties or null.

Returns:
  the file or null if it none required
Throws:
  `org.apache.tools.ant.BuildException` - if badness happens

### getLDAPMergeProperties

@Nullable public Path getLDAPMergeProperties() throws org.apache.tools.ant.BuildException
Get the a file to merge with ldap.properties or null.

Returns:
  the path or null if it none required
Throws:
  `org.apache.tools.ant.BuildException` - if badness happens