Class InstallerPropertiesImpl

    • Field Detail

      • ANT_BASE_DIR

        public static final String ANT_BASE_DIR
        The base directory, inherited and shared with ant.
        See Also:
        Constant Field Values
      • 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:
        Constant Field Values
      • IDP_PROPERTIES_MERGE

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

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

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

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

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

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

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

        public static final String INITIAL_INSTALL_MODULES
        Which modules to enable on initial install.
        Since:
        4.1.0
        See Also:
        Constant Field Values
      • DEFAULT_KEY_SIZE

        public static final int DEFAULT_KEY_SIZE
        Whether to tidy up after ourselves.
        See Also:
        Constant Field Values
      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • 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 Detail

      • InstallerPropertiesImpl

        public InstallerPropertiesImpl​(boolean copiedDistribution)
        Constructor.
        Parameters:
        copiedDistribution - Has the distribution been copied? If no we don't need the source dir.
    • Method Detail

      • 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
      • 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
      • 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.
      • 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
      • defaultScope

        @Nonnull
        protected String defaultScope()
        Evaluate the default scope value.
        Returns:
        everything after the first '.' in getHostName()
      • 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
      • getSealerPassword

        @Nonnull
        public String getSealerPassword()
        Get the password for the sealer for this installation..
        Specified by:
        getSealerPassword in interface InstallerProperties
        Returns:
        the password.
      • 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