001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2014 ForgeRock AS.
016 */
017
018package org.opends.quicksetup.event;
019
020import org.forgerock.i18n.LocalizableMessage;
021import org.opends.quicksetup.ProgressStep;
022
023/**
024 * The event that is generated when there is a change during the installation
025 * process (we get a new log message when starting the server, or we finished
026 * configuring the server for instance).
027 *
028 * In the current implementation this events are generated by the Installer
029 * objects and are notified to the objects implementing
030 * ProgressUpdateListener (QuickSetup object).
031 *
032 */
033public class ProgressUpdateEvent {
034  private ProgressStep step;
035
036  private Integer progressRatio;
037
038  private LocalizableMessage currentPhaseSummary;
039
040  private LocalizableMessage newLogs;
041
042  /**
043   * Constructor of the ProgressUpdateEvent.
044   * @param step the ProgressStep object describing in which step
045   * of the installation we are (configuring server, starting server, etc.)
046   * @param progressRatio the integer that specifies which percentage of
047 * the whole installation has been completed.
048   * @param currentPhaseSummary the localized summary message for the
049* current installation progress.
050   * @param newLogs the new log messages that we have for the installation.
051   */
052  public ProgressUpdateEvent(ProgressStep step,
053      Integer progressRatio, LocalizableMessage currentPhaseSummary, LocalizableMessage newLogs)
054  {
055    this.step = step;
056    this.progressRatio = progressRatio;
057    this.currentPhaseSummary = currentPhaseSummary;
058    this.newLogs = newLogs;
059  }
060
061  /**
062   * Gets a localized message summary describing the install progress
063   * status.
064   * @return the localized message summary describing the progress status.
065   */
066  public LocalizableMessage getCurrentPhaseSummary()
067  {
068    return currentPhaseSummary;
069  }
070
071  /**
072   * Gets the new logs for the install progress.
073   * @return the new logs for the current install progress.
074   */
075  public LocalizableMessage getNewLogs()
076  {
077    return newLogs;
078  }
079
080  /**
081   * Gets the progress ratio for the install progress.
082   * @return the progress ratio for the install progress.
083   */
084  public Integer getProgressRatio()
085  {
086    return progressRatio;
087  }
088
089  /**
090   * Gets the current progress step.
091   * @return the current progress step.
092   */
093  public ProgressStep getProgressStep()
094  {
095    return step;
096  }
097}