Class 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 Details

    • ANT_BASE_DIR

      public static final String ANT_BASE_DIR
      The base directory, inherited and shared with ant.
      See Also:
    • PROPERTY_SOURCE_FILE

      public static final String 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

      public static final String IDP_PROPERTIES_MERGE
      The name of a property file to merge with idp.properties.
      See Also:
    • LDAP_PROPERTIES_MERGE

      public static final String LDAP_PROPERTIES_MERGE
      The name of a property file to merge with ldap.properties.
      See Also:
    • LDAP_PASSWORD

      public static final String LDAP_PASSWORD
      The LDAP Password (usually associated with a username in ldap.properties).
      See Also:
    • CONF_PRE_OVERLAY

      public static final String CONF_PRE_OVERLAY
      The name of a directory to overlay "under" the distribution conf.
      See Also:
    • INITIAL_EDIT_WEBAPP

      public static final String INITIAL_EDIT_WEBAPP
      The name of a directory to use to populate the initial webapp.
      See Also:
    • TARGET_DIR

      public static final String TARGET_DIR
      Where to install to. Default is basedir
      See Also:
    • SOURCE_DIR

      public static final String SOURCE_DIR
      Where to install from (installs only).
      See Also:
    • ENTITY_ID

      public static final String ENTITY_ID
      The entity ID.
      See Also:
    • NO_PROMPT

      public static final String NO_PROMPT
      Do we cause a failure rather than a prompt.
      See Also:
    • HOST_NAME

      public static final String HOST_NAME
      What is the installer host name?
      See Also:
    • SCOPE

      public static final String SCOPE
      The scope to assert.
      See Also:
    • KEY_STORE_PASSWORD

      public static final String KEY_STORE_PASSWORD
      The keystore password to use.
      See Also:
    • SEALER_PASSWORD

      public static final String SEALER_PASSWORD
      The sealer password to use.
      See Also:
    • SEALER_ALIAS

      public static final String SEALER_ALIAS
      The sealer alias to use.
      See Also:
    • KEY_SIZE

      public static final String KEY_SIZE
      The the key size to generate.
      See Also:
    • MODE_CREDENTIAL_KEYS

      public static final String MODE_CREDENTIAL_KEYS
      Mode to set on credential *key files.
      See Also:
    • GROUP_CONF_CREDENTIALS

      public static final String GROUP_CONF_CREDENTIALS
      Group to set on files in the credential and conf directories.
      See Also:
    • PERFORM_SET_MODE

      public static final String PERFORM_SET_MODE
      Do we do any chgrp/chmod work?
      See Also:
    • NO_TIDY

      public static final String NO_TIDY
      Whether to tidy up after ourselves.
      See Also:
    • INITIAL_INSTALL_MODULES

      public static final String 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_SIZE
      Whether to tidy up after ourselves.
      See Also:
    • log

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

      @NonnullAfterInit private Path baseDir
      The base directory.
    • installerProperties

      @NonnullAfterInit private Properties installerProperties
      The properties driving the install.
    • targetDir

      private Path targetDir
      The target Directory.
    • srcDir

      private Path srcDir
      The sourceDirectory.
    • noPrompt

      private boolean noPrompt
      Do we allow prompting?
    • needSourceDir

      private final boolean needSourceDir
      Is a source Dir needed?
    • entityID

      private String entityID
      The entity ID.
    • hostname

      private String hostname
      Hostname.
    • scope

      private String scope
      scope.
    • keyStorePassword

      private String keyStorePassword
      Keystore Password.
    • sealerPassword

      private String sealerPassword
      Sealer Password.
    • sealerAlias

      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

      private String credentialsKeyFileMode
      credentials key file mode.
    • inheritedProperties

      private Map<String,String> inheritedProperties
      Local overload of properties (to deal with nested calling).
    • inputHandler

      private final org.apache.tools.ant.input.InputHandler inputHandler
      Input 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 an InputHandler for the prompting.
      Returns:
      an input handler
    • setInheritedProperties

      public void setInheritedProperties(Map<String,String> props)
      Set any properties inherited from the base environment.
      Parameters:
      props - what to set
    • doInitialize

      protected void doInitialize() throws ComponentInitializationException
      Overrides:
      doInitialize in class AbstractInitializableComponent
      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 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

      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

      @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.
      Specified by:
      getTargetDir in interface InstallerProperties
      Returns:
      the target directory
      Throws:
      org.apache.tools.ant.BuildException - if something goes awry.
    • getSourceDir

      @Nullable public Path getSourceDir()
      Where is the install coming from?
      Specified by:
      getSourceDir in interface InstallerProperties
      Returns:
      the source directory
    • getEntityID

      @Nonnull public String getEntityID()
      Get the EntityId for this install. Defaults to information pulled from {getHostName().
      Specified by:
      getEntityID in interface InstallerProperties
      Returns:
      the name.
    • isNoTidy

      public boolean isNoTidy()
      Does the user want us to *not* tidy up.
      Specified by:
      isNoTidy in interface InstallerProperties
      Returns:
      do we not tidy up?
    • hasHostName

      private boolean hasHostName(InetAddress addr)
      Is this address named? Helper method for bestHostName()
      Parameters:
      addr - what to look at
      Returns:
      true unless the name is the canonical name...
    • bestHostName

      private String bestHostName()
      Find the most apposite network connector. Taken from Ant.
      Returns:
      the best name we can work out
    • getHostName

      @Nonnull public String getHostName()
      Get the host name for this install. Defaults to information pulled from the network.
      Specified by:
      getHostName in interface InstallerProperties
      Returns:
      the host name.
    • getCredentialsKeyFileMode

      @Nonnull public String getCredentialsKeyFileMode()
      Mode to set on all files in credentials.
      Specified by:
      getCredentialsKeyFileMode in interface InstallerProperties
      Returns:
      the mode
    • getCredentialsGroup

      @Nullable public String getCredentialsGroup()
      Group to set on all files in credentials and conf.
      Specified by:
      getCredentialsGroup in interface InstallerProperties
      Returns:
      the mode or null if none to be set
    • isSetGroupAndMode

      public boolean isSetGroupAndMode()
      Do we set the mode?
      Specified by:
      isSetGroupAndMode in interface InstallerProperties
      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..
      Specified by:
      getScope in interface InstallerProperties
      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.
      Specified by:
      getLDAPPassword in interface InstallerProperties
      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..
      Specified by:
      getSubjectAltName in interface InstallerProperties
      Returns:
      the SubjectAltName
    • getKeyStorePassword

      @Nonnull public String getKeyStorePassword()
      Get the password for the keystore for this installation..
      Specified by:
      getKeyStorePassword in interface InstallerProperties
      Returns:
      the password.
    • getSealerPassword

      @Nonnull public String getSealerPassword()
      Get the password for the sealer for this installation..
      Specified by:
      getSealerPassword in interface InstallerProperties
      Returns:
      the password.
    • getModulesToEnable

      @Nonnull public Set<String> getModulesToEnable()
      Get the modules to enable after first install.
      Specified by:
      getModulesToEnable in interface InstallerProperties
      Returns:
      the modules
    • getSealerAlias

      @Nonnull public String getSealerAlias()
      Get the alias for the sealer key..
      Specified by:
      getSealerAlias in interface InstallerProperties
      Returns:
      the alias
    • getKeySize

      public int getKeySize()
      Get the key size for signing, encryption and backchannel.. default is 3072.
      Specified by:
      getKeySize in interface InstallerProperties
      Returns:
      the keysize
    • getMergeDir

      protected Path getMergeDir(String propName) throws org.apache.tools.ant.BuildException
      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

      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 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 the Path 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

      public Path getIdPMergeProperties() throws org.apache.tools.ant.BuildException
      Get the a file to merge with idp.properties or null..
      Specified by:
      getIdPMergeProperties in interface InstallerProperties
      Returns:
      the file or null if it none required.
      Throws:
      org.apache.tools.ant.BuildException - if badness happens
    • getLDAPMergeProperties

      public Path getLDAPMergeProperties() throws org.apache.tools.ant.BuildException
      Get the a file to merge with ldap.properties or null..
      Specified by:
      getLDAPMergeProperties in interface InstallerProperties
      Returns:
      the path or null if it none required.
      Throws:
      org.apache.tools.ant.BuildException - if badness happens
    • getConfPreOverlay

      public Path getConfPreOverlay() throws org.apache.tools.ant.BuildException
      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 interface InstallerProperties
      Returns:
      the path or null if non specified.
      Throws:
      org.apache.tools.ant.BuildException - if badness happens
    • getInitialEditWeb

      public Path getInitialEditWeb() throws org.apache.tools.ant.BuildException
      Get a path to use to do the initial edit-webapp populate..
      Specified by:
      getInitialEditWeb in interface InstallerProperties
      Returns:
      the path or null if non specified.
      Throws:
      org.apache.tools.ant.BuildException - if badness happens