Class SecureAdminBootstrapHelper


  • public abstract class SecureAdminBootstrapHelper
    extends Object
    Bootstraps the secure admin-related files, either over ssh (copying files from the current runtime environment to the remote system via secure ftp) or locally (using more straightforward file-copying).
    Author:
    Tim Quinn
    • Constructor Detail

      • SecureAdminBootstrapHelper

        public SecureAdminBootstrapHelper()
    • Method Detail

      • getRemoteHelper

        public static SecureAdminBootstrapHelper getRemoteHelper​(org.glassfish.hk2.api.ServiceLocator habitat,
                                                                 File DASInstanceDir,
                                                                 String remoteNodeDir,
                                                                 String instance,
                                                                 Node node,
                                                                 Logger logger)
                                                          throws SecureAdminBootstrapHelper.BootstrapException
        Creates a new helper for delivering files needed for secure admin to the remote instance.
        Parameters:
        habitat - hk2 habitat
        DASInstanceDir - directory of the local instance - source for the required files
        remoteNodeDir - directory of the remote node on the remote system
        instance - name of the instance on the remote node to bootstrap
        node - Node from the domain configuration for the target node
        logger - Logger to use
        Returns:
        the remote helper
        Throws:
        SecureAdminBootstrapHelper.BootstrapException
      • getLocalHelper

        public static SecureAdminBootstrapHelper getLocalHelper​(File existingInstanceDir,
                                                                File newInstanceDir)
        Creates a new helper for delivering files needed for secure admin to the local instance (local meaning on the same node as the DAS).
        Parameters:
        existingInstanceDir - directory of an existing instance (typically the DAS) from where the files can be copied
        newInstanceDir - directory of the new instance to where the files will be copied
        Returns:
        the local helper
      • close

        protected abstract void close()
      • copyBootstrapFiles

        protected abstract void copyBootstrapFiles()
                                            throws FileNotFoundException,
                                                   IOException
        Copies the bootstrap files from their origin to their destination.

        Concrete subclasses implement this differently, depending on exactly how they actually transfer the files.

        Throws:
        FileNotFoundException
        IOException
      • backdateInstanceDomainXML

        protected abstract void backdateInstanceDomainXML()
                                                   throws SecureAdminBootstrapHelper.BootstrapException
        Adjusts the date on the new instance's domain.xml so it looks older than the original one on the DAS.

        We have copied the domain.xml and a small number of other files to the instance, but not all the files needed for the instance to be fully sync-ed. The sync logic decides if an instance is up-to-date by comparing the timestamp of the instance's domain.xml with that of the DAS. If those timestamps match then the sync logic judges the instance to be up-to-date. When we copy the DAS domain.xml to the instance to deliver the secure admin configuration (so the start-local-instance command and the instance will know how to connect to the DAS) it is left with the same timestamp as the DAS copy. To make sure sync works when start-local-instance runs, we backdate the instance's copy of domain.xml.

        Throws:
        SecureAdminBootstrapHelper.BootstrapException