Class Installer

  • All Implemented Interfaces:
    Runnable, ProgressNotifier

    public class Installer
    extends GuiApplication
    This is an abstract class that is in charge of actually performing the installation. It just takes a UserData object and based on that installs OpenDJ. When there is an update during the installation it will notify the ProgressUpdateListener objects that have been added to it. The notification will send a ProgressUpdateEvent. This class is supposed to be fully independent of the graphical layout. Note that we can use freely the class org.opends.server.util.SetupUtils as it is included in quicksetup.jar.
    • Field Detail

      • MIN_PORT_VALUE

        public static final int MIN_PORT_VALUE
        The minimum integer value that can be used for a port.
        See Also:
        Constant Field Values
      • MAX_PORT_VALUE

        public static final int MAX_PORT_VALUE
        The maximum integer value that can be used for a port.
        See Also:
        Constant Field Values
      • ROOT_BACKEND_NAME

        public static final String ROOT_BACKEND_NAME
        The name of the backend created on setup.
        See Also:
        Constant Field Values
      • THRESHOLD_CLOCK_DIFFERENCE_WARNING

        public static final int THRESHOLD_CLOCK_DIFFERENCE_WARNING
        The threshold in minutes used to know whether we must display a warning informing that there is a server clock difference between two servers whose contents are being replicated.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Installer

        public Installer()
        Creates a default instance.
    • Method Detail

      • run

        public void run()
        Actually performs the install in this thread. The thread is blocked.
      • getRatio

        public Integer getRatio​(ProgressStep status)
        Description copied from class: Application
        Gets an integer representing the amount of processing this application still needs to perform as a ratio out of 100.
        Specified by:
        getRatio in class Application
        Parameters:
        status - ProgressStop for which a summary is needed
        Returns:
        ProgressStep representing the current step
      • getSummary

        public org.forgerock.i18n.LocalizableMessage getSummary​(ProgressStep status)
        Description copied from class: Application
        Gets an i18n'd string representing the summary of a give ProgressStep.
        Specified by:
        getSummary in class Application
        Parameters:
        status - ProgressStop for which a summary is needed
        Returns:
        String representing the summary
      • getApplicationException

        public ApplicationException getApplicationException()
        Returns the exception from the run() method, if any.
        Returns:
        the ApplicationException raised during the run() method, if any. null otherwise.
      • isCancellable

        public boolean isCancellable()
        Description copied from class: Application
        Indicates whether this application is capable of cancelling the operation performed in the run method. A cancellable operation should leave its environment in the same state as it was prior to running the operation (files deleted, changes backed out etc.). Marking an Application as cancellable may control UI elements like the presense of a cancel button while the operation is being performed. Applications marked as cancellable should override the cancel method in such a way as to undo whatever actions have taken place in the run method up to that point.
        Specified by:
        isCancellable in class Application
        Returns:
        boolean where true inidcates that the operation is cancellable
      • createUserData

        public UserData createUserData()
        Description copied from class: Application
        Creates a set of user data with default values.
        Overrides:
        createUserData in class Application
        Returns:
        UserData empty set of UserData
      • forceToDisplay

        public void forceToDisplay()
        Description copied from class: GuiApplication
        This method is called when we detected that there is something installed we inform of this to the user and the user wants to proceed with the installation destroying the contents of the data and the configuration in the current installation.
        Overrides:
        forceToDisplay in class GuiApplication
      • canGoBack

        public boolean canGoBack​(WizardStep step)
        Description copied from class: GuiApplication
        Indicates whether the user is allowed to return to a previous step from step.
        Overrides:
        canGoBack in class GuiApplication
        Parameters:
        step - WizardStep for which the the return value indicates whether or not the user can return to a previous step
        Returns:
        boolean where true indicates the user can return to a previous step from step
      • canGoForward

        public boolean canGoForward​(WizardStep step)
        Description copied from class: GuiApplication
        Indicates whether the user is allowed to move to a new step from step.
        Overrides:
        canGoForward in class GuiApplication
        Parameters:
        step - WizardStep for which the the return value indicates whether or not the user can move to a new step
        Returns:
        boolean where true indicates the user can move to a new step from step
      • canFinish

        public boolean canFinish​(WizardStep step)
        Description copied from class: GuiApplication
        Indicates whether the user is allowed to finish the wizard from step.
        Specified by:
        canFinish in class GuiApplication
        Parameters:
        step - WizardStep for which the the return value indicates whether or not the user can finish the wizard
        Returns:
        boolean where true indicates the user can finish the wizard
      • isSubStep

        public boolean isSubStep​(WizardStep step)
        Description copied from class: GuiApplication
        Indicates whether the provided step is a sub step or not.
        Overrides:
        isSubStep in class GuiApplication
        Parameters:
        step - WizardStep for which the return value indicates whether or not is a sub step.
        Returns:
        boolean where true indicates the provided step is a substep.
      • isVisible

        public boolean isVisible​(WizardStep step,
                                 UserData userData)
        Description copied from class: GuiApplication
        Indicates whether the provided step is visible or not depending on the contents of the UserData object that is provided.
        Overrides:
        isVisible in class GuiApplication
        Parameters:
        step - WizardStep for which the return value indicates whether or not is visible.
        userData - the UserData to be used to determine if the step is visible or not.
        Returns:
        boolean where true indicates the provided step is visible.
      • isVisible

        public boolean isVisible​(WizardStep step,
                                 QuickSetup qs)
        Description copied from class: GuiApplication
        Indicates whether the provided step is visible or not depending on the contents of the QuickSetup object that is provided.
        Overrides:
        isVisible in class GuiApplication
        Parameters:
        step - WizardStep for which the return value indicates whether or not is visible.
        qs - the QuickSetup to be used to determine if the step is visible or not.
        Returns:
        boolean where true indicates the provided step is visible.
      • finishClicked

        public boolean finishClicked​(WizardStep cStep,
                                     QuickSetup qs)
        Description copied from class: GuiApplication
        Called when the user has clicked the 'finish' button.
        Specified by:
        finishClicked in class GuiApplication
        Parameters:
        cStep - WizardStep at which the user clicked the previous button
        qs - QuickSetup controller
        Returns:
        boolean that the application uses to indicate the the application should be launched. If false, the application is responsible for updating the user data for the final screen and launching the application if this is the desired behavior.
      • nextClicked

        public void nextClicked​(WizardStep cStep,
                                QuickSetup qs)
        Description copied from class: GuiApplication
        Called when the user has clicked the 'next' button.
        Specified by:
        nextClicked in class GuiApplication
        Parameters:
        cStep - WizardStep at which the user clicked the next button
        qs - QuickSetup controller
      • closeClicked

        public void closeClicked​(WizardStep cStep,
                                 QuickSetup qs)
        Description copied from class: GuiApplication
        Called when the user has clicked the 'close' button.
        Overrides:
        closeClicked in class GuiApplication
        Parameters:
        cStep - WizardStep at which the user clicked the close button
        qs - QuickSetup controller
      • isFinished

        public boolean isFinished()
        Description copied from class: Application
        Returns whether the installer has finished or not.
        Specified by:
        isFinished in class Application
        Returns:
        true if the install is finished or false if not.
      • cancel

        public void cancel()
        Description copied from class: Application
        Signals that the application should cancel a currently running operation as soon as possible and return the environment to the state prior to running the operation. When finished backing out changes the application should make sure that isFinished returns true so that the application can complete.
        Specified by:
        cancel in class Application
      • quitClicked

        public void quitClicked​(WizardStep cStep,
                                QuickSetup qs)
        Description copied from class: GuiApplication
        Called when the user has clicked the 'quit' button.
        Overrides:
        quitClicked in class GuiApplication
        Parameters:
        cStep - WizardStep at which the user clicked the quit button
        qs - QuickSetup controller
      • getWizardSteps

        public Set<? extends WizardStep> getWizardSteps()
        Description copied from class: GuiApplication
        Returns the set of wizard steps used in this application's wizard.
        Specified by:
        getWizardSteps in class GuiApplication
        Returns:
        Set of Step objects representing wizard steps
      • windowClosing

        public void windowClosing​(QuickSetupDialog dlg,
                                  WindowEvent evt)
        Description copied from class: GuiApplication
        Called by the controller when the window is closing. The application can take application specific actions here.
        Specified by:
        windowClosing in class GuiApplication
        Parameters:
        dlg - QuickSetupDialog that will be closing
        evt - The event from the Window indicating closing
      • getCloseButtonToolTip

        public org.forgerock.i18n.LocalizableMessage getCloseButtonToolTip()
        Description copied from class: GuiApplication
        Gets the key for the close button's tool tip text.
        Overrides:
        getCloseButtonToolTip in class GuiApplication
        Returns:
        String key of the text in the resource bundle
      • getQuitButtonToolTip

        public org.forgerock.i18n.LocalizableMessage getQuitButtonToolTip()
        Description copied from class: GuiApplication
        Gets the key for the quit button's tool tip text.
        Overrides:
        getQuitButtonToolTip in class GuiApplication
        Returns:
        String key of the text in the resource bundle
      • getFinishButtonToolTip

        public org.forgerock.i18n.LocalizableMessage getFinishButtonToolTip()
        Description copied from class: GuiApplication
        Gets the key for the finish button's tool tip text.
        Overrides:
        getFinishButtonToolTip in class GuiApplication
        Returns:
        String key of the text in the resource bundle
      • getExtraDialogHeight

        public int getExtraDialogHeight()
        Description copied from class: GuiApplication
        Gets the amount of addition pixels added to the height of the tallest panel in order to size the wizard for asthetic reasons.
        Overrides:
        getExtraDialogHeight in class GuiApplication
        Returns:
        int height to add
      • previousClicked

        public void previousClicked​(WizardStep cStep,
                                    QuickSetup qs)
        Description copied from class: GuiApplication
        Called when the user has clicked the 'previous' button.
        Specified by:
        previousClicked in class GuiApplication
        Parameters:
        cStep - WizardStep at which the user clicked the previous button
        qs - QuickSetup controller
      • getFrameTitle

        public org.forgerock.i18n.LocalizableMessage getFrameTitle()
        Description copied from class: GuiApplication
        Gets the frame title of the GUI application that will be used in some operating systems.
        Specified by:
        getFrameTitle in class GuiApplication
        Returns:
        internationalized String representing the frame title
      • setWizardDialogState

        public void setWizardDialogState​(QuickSetupDialog dlg,
                                         UserData userData,
                                         WizardStep step)
        Description copied from class: GuiApplication
        Called when the user advances to new step in the wizard. Applications are expected to manipulate the QuickSetupDialog to reflect the current step.
        Specified by:
        setWizardDialogState in class GuiApplication
        Parameters:
        dlg - QuickSetupDialog hosting the wizard
        userData - UserData representing the data specified by the user
        step - Step indicating the new current step
      • getOrderedSteps

        public LinkedHashSet<WizardStep> getOrderedSteps()
        Description copied from class: GuiApplication
        Returns the list of all the steps in an ordered manner. This is required because in the case of an application with substeps the user of the other interfaces is not enough. This is a default implementation that uses the getNextWizardStep method to calculate the list that work for applications with no substeps.
        Overrides:
        getOrderedSteps in class GuiApplication
        Returns:
        a list containing ALL the steps (including substeps) in an ordered manner.
      • getTrustManager

        public ApplicationTrustManager getTrustManager()
        Description copied from class: Application
        Returns the trust manager that can be used to establish secure connections.
        Overrides:
        getTrustManager in class Application
        Returns:
        the trust manager that can be used to establish secure connections.
      • checkAbort

        public void checkAbort()
                        throws ApplicationException
        Checks the value of canceled field and throws an ApplicationException if true. This indicates that the user has canceled this operation and the process of aborting should begin as soon as possible.
        Overrides:
        checkAbort in class Application
        Throws:
        ApplicationException - thrown if canceled
      • updateUserData

        public void updateUserData​(WizardStep cStep,
                                   QuickSetup qs)
                            throws UserDataException
        These methods validate the data provided by the user in the panels and update the userData object according to that content.
        Specified by:
        updateUserData in class GuiApplication
        Parameters:
        cStep - the current step of the wizard
        qs - QuickStart controller
        Throws:
        UserDataException - if the data provided by the user is not valid.
      • initializeSuffix

        public void initializeSuffix​(ConnectionWrapper conn,
                                     int replicaServerId,
                                     DN suffixDn,
                                     boolean displayProgress,
                                     HostPort sourceServerDisplay)
                              throws ApplicationException,
                                     PeerNotFoundException
        Initializes a suffix with the contents of a replica that has a given replication id.
        Parameters:
        conn - the connection to the server whose suffix we want to initialize.
        replicaServerId - the server ID of the replica we want to use to initialize the contents of the suffix.
        suffixDn - the dn of the suffix.
        displayProgress - whether we want to display progress or not.
        sourceServerDisplay - the string to be used to represent the server that contains the data that will be used to initialize the suffix.
        Throws:
        ApplicationException - if an unexpected error occurs.
        PeerNotFoundException - if the replication mechanism cannot find a peer.
      • applicationPrintStreamReceived

        protected void applicationPrintStreamReceived​(String message)
        Description copied from class: Application
        Method that is invoked by the printstreams with the messages received on operations such as start or import. This is done so that the application can parse this messages and display them.
        Overrides:
        applicationPrintStreamReceived in class Application
        Parameters:
        message - the message that has been received