Package net.shibboleth.idp.installer
Class InstallerPropertiesImpl
java.lang.Object
net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
net.shibboleth.idp.installer.InstallerPropertiesImpl
- All Implemented Interfaces:
InstallerProperties
,Component
,DestructableComponent
,InitializableComponent
public class InstallerPropertiesImpl
extends AbstractInitializableComponent
implements InstallerProperties
Class implement
InstallerProperties
with properties/UI driven values.
NOTE Updated to this properties should be reflected in the "PropertyDriverInstallation" wiki page."/-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The base directory, inherited and shared with ant.private Path
The base directory.static final String
The name of a directory to overlay "under" the distribution conf.private String
credentials key file mode.static final int
Whether to tidy up after ourselves.static final String
The entity ID.private String
The entity ID.static final String
Group to set on files in the credential and conf directories.static final String
What is the installer host name?private String
Hostname.static final String
The name of a property file to merge with idp.properties.Local overload of properties (to deal with nested calling).static final String
The name of a directory to use to populate the initial webapp.static final String
Which modules to enable on initial install.private final org.apache.tools.ant.input.InputHandler
Input handler from the prompting.private Properties
The properties driving the install.static final String
The the key size to generate.static final String
The keystore password to use.private int
Key Size.private String
Keystore Password.static final String
The LDAP Password (usually associated with a username in ldap.properties).static final String
The name of a property file to merge with ldap.properties.private final org.slf4j.Logger
Class logger.static final String
Mode to set on credential *key files.private final boolean
Is a source Dir needed?static final String
Do we cause a failure rather than a prompt.static final String
Whether to tidy up after ourselves.private boolean
Do we allow prompting?static final String
Do we do any chgrp/chmod work?static final String
The name of a property file to fill in some or all of the above.private String
scope.static final String
The scope to assert.static final String
The sealer alias to use.static final String
The sealer password to use.private String
Sealer Alias.private String
Sealer Password.private boolean
whether to tidy up.static final String
Where to install from (installs only).private Path
The sourceDirectory.static final String
Where to install to.private Path
The target Directory.private boolean
whether to tidy up.Fields inherited from interface net.shibboleth.idp.installer.InstallerProperties
DEFAULT_MODULES
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate String
Find the most apposite network connector.protected String
Evaluate the default scope value.protected void
Get a directory to use to "pre-overlay" the conf directory.Group to set on all files in credentials and conf.Mode to set on all files in credentials.Get the EntityId for this install.Get the host name for this install.Get the a file to merge with idp.properties or null.Get a path to use to do the initial edit-webapp populate.protected org.apache.tools.ant.input.InputHandler
Get anInputHandler
for the prompting.int
Get the key size for signing, encryption and backchannel.Get the password for the keystore for this installation.Get the a file to merge with ldap.properties or null.Get the LDAP password iff one was provided.protected Path
getMergeDir
(String propName) Get the directory specified as the property as a File, or null if it doesn't exist.protected Path
getMergeFile
(String propName) Get the file specified as the property as a File, or null if it doesn't exist.private Path
getMergePath
(String propName, Boolean mustBeDir) Get thePath
specified as the property as a File, or null if it doesn't exist.Get the modules to enable after first install.protected String
getPassword
(String propertyName, String prompt) Lookup a property.getScope()
Get the scope for this installation.Get the alias for the sealer key.Get the password for the sealer for this installation.Where is the install coming from?Get the SubjectAltName for the certificates.Get where we are installing/updating/building the war.protected String
Lookup a property.private boolean
hasHostName
(InetAddress addr) Is this address named? Helper method forbestHostName()
boolean
isNoTidy()
Does the user want us to *not* tidy up.boolean
Do we set the mode?void
setInheritedProperties
(Map<String, String> props) Set any properties inherited from the base environment.Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, doDestroy, initialize, isDestroyed, isInitialized
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
ANT_BASE_DIR
The base directory, inherited and shared with ant.- See Also:
-
PROPERTY_SOURCE_FILE
The name of a property file to fill in some or all of the above. This file is deleted after processing.- See Also:
-
IDP_PROPERTIES_MERGE
The name of a property file to merge with idp.properties.- See Also:
-
LDAP_PROPERTIES_MERGE
The name of a property file to merge with ldap.properties.- See Also:
-
LDAP_PASSWORD
The LDAP Password (usually associated with a username in ldap.properties).- See Also:
-
CONF_PRE_OVERLAY
The name of a directory to overlay "under" the distribution conf.- See Also:
-
INITIAL_EDIT_WEBAPP
The name of a directory to use to populate the initial webapp.- See Also:
-
TARGET_DIR
Where to install to. Default is basedir- See Also:
-
SOURCE_DIR
Where to install from (installs only).- See Also:
-
ENTITY_ID
The entity ID.- See Also:
-
NO_PROMPT
Do we cause a failure rather than a prompt.- See Also:
-
HOST_NAME
What is the installer host name?- See Also:
-
SCOPE
The scope to assert.- See Also:
-
KEY_STORE_PASSWORD
The keystore password to use.- See Also:
-
SEALER_PASSWORD
The sealer password to use.- See Also:
-
SEALER_ALIAS
The sealer alias to use.- See Also:
-
KEY_SIZE
The the key size to generate.- See Also:
-
MODE_CREDENTIAL_KEYS
Mode to set on credential *key files.- See Also:
-
GROUP_CONF_CREDENTIALS
Group to set on files in the credential and conf directories.- See Also:
-
PERFORM_SET_MODE
Do we do any chgrp/chmod work?- See Also:
-
NO_TIDY
Whether to tidy up after ourselves.- See Also:
-
INITIAL_INSTALL_MODULES
Which modules to enable on initial install.- Since:
- 4.1.0
- See Also:
-
DEFAULT_KEY_SIZE
public static final int DEFAULT_KEY_SIZEWhether to tidy up after ourselves.- See Also:
-
log
@Nonnull private final org.slf4j.Logger logClass logger. -
baseDir
The base directory. -
installerProperties
The properties driving the install. -
targetDir
The target Directory. -
srcDir
The sourceDirectory. -
noPrompt
private boolean noPromptDo we allow prompting? -
needSourceDir
private final boolean needSourceDirIs a source Dir needed? -
entityID
The entity ID. -
hostname
Hostname. -
scope
scope. -
keyStorePassword
Keystore Password. -
sealerPassword
Sealer Password. -
sealerAlias
Sealer Alias. -
keySize
private int keySizeKey Size. (for signing, encryption and backchannel). -
tidy
private boolean tidywhether to tidy up. -
setGroupAndMode
private boolean setGroupAndModewhether to tidy up. -
credentialsKeyFileMode
credentials key file mode. -
inheritedProperties
Local overload of properties (to deal with nested calling). -
inputHandler
private final org.apache.tools.ant.input.InputHandler inputHandlerInput handler from the prompting.
-
-
Constructor Details
-
InstallerPropertiesImpl
public InstallerPropertiesImpl(boolean copiedDistribution) Constructor.- Parameters:
copiedDistribution
- Has the distribution been copied? If no we don't need the source dir.
-
-
Method Details
-
getInputHandler
protected org.apache.tools.ant.input.InputHandler getInputHandler()Get anInputHandler
for the prompting.- Returns:
- an input handler
-
setInheritedProperties
Set any properties inherited from the base environment.- Parameters:
props
- what to set
-
doInitialize
- Overrides:
doInitialize
in classAbstractInitializableComponent
- Throws:
ComponentInitializationException
-
getValue
protected String getValue(String propertyName, String prompt, Supplier<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 userdefaultSupplier
- 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
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 repeated to the screen
- Throws:
org.apache.tools.ant.BuildException
- of anything goes wrong
-
getTargetDir
Get where we are installing/updating/building the war. This is slightly complicated because the default depends on what we are doing.- Specified by:
getTargetDir
in interfaceInstallerProperties
- Returns:
- the target directory
- Throws:
org.apache.tools.ant.BuildException
- if something goes awry.
-
getSourceDir
Where is the install coming from?- Specified by:
getSourceDir
in interfaceInstallerProperties
- Returns:
- the source directory
-
getEntityID
Get the EntityId for this install. Defaults to information pulled from {getHostName()
.- Specified by:
getEntityID
in interfaceInstallerProperties
- Returns:
- the name.
-
isNoTidy
public boolean isNoTidy()Does the user want us to *not* tidy up.- Specified by:
isNoTidy
in interfaceInstallerProperties
- Returns:
- do we not tidy up?
-
hasHostName
Is this address named? Helper method forbestHostName()
- Parameters:
addr
- what to look at- Returns:
- true unless the name is the canonical name...
-
bestHostName
Find the most apposite network connector. Taken from Ant.- Returns:
- the best name we can work out
-
getHostName
Get the host name for this install. Defaults to information pulled from the network.- Specified by:
getHostName
in interfaceInstallerProperties
- Returns:
- the host name.
-
getCredentialsKeyFileMode
Mode to set on all files in credentials.- Specified by:
getCredentialsKeyFileMode
in interfaceInstallerProperties
- Returns:
- the mode
-
getCredentialsGroup
Group to set on all files in credentials and conf.- Specified by:
getCredentialsGroup
in interfaceInstallerProperties
- Returns:
- the mode or null if none to be set
-
isSetGroupAndMode
public boolean isSetGroupAndMode()Do we set the mode?- Specified by:
isSetGroupAndMode
in interfaceInstallerProperties
- Returns:
- do we the mode
-
defaultScope
Evaluate the default scope value.- Returns:
- everything after the first '.' in
getHostName()
-
getScope
Get the scope for this installation..- Specified by:
getScope
in interfaceInstallerProperties
- Returns:
- The scope.
-
getLDAPPassword
Get the LDAP password iff one was provided. DO NOT PROMPT.- Specified by:
getLDAPPassword
in interfaceInstallerProperties
- Returns:
- the password if provided by a properties
- Throws:
org.apache.tools.ant.BuildException
- if badness happens
-
getSubjectAltName
Get the SubjectAltName for the certificates..- Specified by:
getSubjectAltName
in interfaceInstallerProperties
- Returns:
- the SubjectAltName
-
getKeyStorePassword
Get the password for the keystore for this installation..- Specified by:
getKeyStorePassword
in interfaceInstallerProperties
- Returns:
- the password.
-
getSealerPassword
Get the password for the sealer for this installation..- Specified by:
getSealerPassword
in interfaceInstallerProperties
- Returns:
- the password.
-
getModulesToEnable
Get the modules to enable after first install.- Specified by:
getModulesToEnable
in interfaceInstallerProperties
- Returns:
- the modules
-
getSealerAlias
Get the alias for the sealer key..- Specified by:
getSealerAlias
in interfaceInstallerProperties
- Returns:
- the alias
-
getKeySize
public int getKeySize()Get the key size for signing, encryption and backchannel.. default is 3072.- Specified by:
getKeySize
in interfaceInstallerProperties
- Returns:
- the keysize
-
getMergeDir
Get the directory 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
File
otherwise - Throws:
org.apache.tools.ant.BuildException
- if the property is supplied but the file doesn't exist.
-
getMergeFile
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
File
otherwise - Throws:
org.apache.tools.ant.BuildException
- if the property is supplied but the file doesn't exist.
-
getMergePath
private Path getMergePath(String propName, Boolean mustBeDir) throws org.apache.tools.ant.BuildException Get thePath
specified as the property as a File, or null if it doesn't exist. Police for type if required- Parameters:
propName
- the name to lookup;mustBeDir
- if null do not policy. Otherwise policy according to value- Returns:
- null if the property is not provided a
File
otherwise - Throws:
org.apache.tools.ant.BuildException
- if the property is supplied but the file doesn't exist.
-
getIdPMergeProperties
Get the a file to merge with idp.properties or null..- Specified by:
getIdPMergeProperties
in interfaceInstallerProperties
- Returns:
- the file or null if it none required.
- Throws:
org.apache.tools.ant.BuildException
- if badness happens
-
getLDAPMergeProperties
Get the a file to merge with ldap.properties or null..- Specified by:
getLDAPMergeProperties
in interfaceInstallerProperties
- Returns:
- the path or null if it none required.
- Throws:
org.apache.tools.ant.BuildException
- if badness happens
-
getConfPreOverlay
Get a directory to use to "pre-overlay" the conf directory. Files will be copied from here if they don't already exist in conf, before the files are copied from the distribution..- Specified by:
getConfPreOverlay
in interfaceInstallerProperties
- Returns:
- the path or null if non specified.
- Throws:
org.apache.tools.ant.BuildException
- if badness happens
-
getInitialEditWeb
Get a path to use to do the initial edit-webapp populate..- Specified by:
getInitialEditWeb
in interfaceInstallerProperties
- Returns:
- the path or null if non specified.
- Throws:
org.apache.tools.ant.BuildException
- if badness happens
-