public abstract class Application extends Object implements ProgressNotifier, Runnable
Modifier and Type | Class and Description |
---|---|
class |
Application.ErrorPrintStream
This class is used to notify the ProgressUpdateListeners of events
that are written to the standard error.
|
class |
Application.OutputPrintStream
This class is used to notify the ProgressUpdateListeners of events
that are written to the standard output.
|
protected class |
Application.PointAdder
Class used to add points periodically to the end of the logs.
|
Modifier and Type | Field and Description |
---|---|
protected ProgressMessageFormatter |
formatter
Formats progress messages.
|
protected CurrentInstallStatus |
installStatus
Represents current install state.
|
protected TempLogFile |
tempLogFile
Temporary log file where messages will be logged.
|
Constructor and Description |
---|
Application() |
Modifier and Type | Method and Description |
---|---|
void |
addProgressUpdateListener(ProgressUpdateListener l)
Adds a ProgressUpdateListener that will be notified of updates in
the install progress.
|
protected void |
applicationPrintStreamReceived(String message)
Method that is invoked by the printstreams with the messages received
on operations such as start or import.
|
abstract void |
cancel()
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.
|
void |
checkAbort()
Checks whether the operation has been aborted.
|
static GuiApplication |
create()
Creates an application by instantiating the Application class
denoted by the System property
org.opends.quicksetup.Application.class . |
UserData |
createUserData()
Creates a set of user data with default values.
|
Application.ErrorPrintStream |
getApplicationErrorStream()
Returns the error stream to be used by the application when launching
command lines.
|
Application.OutputPrintStream |
getApplicationOutputStream()
Returns the output stream to be used by the application when launching
command lines.
|
abstract ProgressStep |
getCurrentProgressStep()
Gets the current step.
|
LocalizableMessage |
getFormattedDone()
Returns the formatted representation of the 'Done' text string.
|
LocalizableMessage |
getFormattedDoneWithLineBreak()
Returns the formatted representation of the 'Done' text string
with a line break at the end.
|
protected LocalizableMessage |
getFormattedError(LocalizableMessage text)
Returns the formatted representation of an error for a given text.
|
protected LocalizableMessage |
getFormattedError(Throwable t,
boolean applyMargin)
Returns the formatted representation of an error message for a given
exception.
|
LocalizableMessage |
getFormattedLog(LocalizableMessage text)
Returns the formatted representation of a log message for a given text.
|
LocalizableMessage |
getFormattedLogError(LocalizableMessage text)
Returns the formatted representation of a log error message for a given
text.
|
LocalizableMessage |
getFormattedProgress(LocalizableMessage text)
Returns the formatted representation of a progress message for a given
text.
|
LocalizableMessage |
getFormattedProgressWithLineBreak(LocalizableMessage text)
Returns the formatted representation of a progress message for a given
text with a line break.
|
protected LocalizableMessage |
getFormattedSuccess(LocalizableMessage text)
Returns the formatted representation of a success message for a given text.
|
protected LocalizableMessage |
getFormattedSummary(LocalizableMessage text)
Returns the formatted representation of the text that is the summary of the
installation process (the one that goes in the UI next to the progress
bar).
|
LocalizableMessage |
getFormattedWarning(LocalizableMessage text)
Returns the formatted representation of an warning for a given text.
|
LocalizableMessage |
getFormattedWithPoints(LocalizableMessage text)
Returns the formatted representation of the argument text to which we add
points.
|
Installation |
getInstallation()
Gets the OpenDJ installation associated with the execution of this
command.
|
abstract String |
getInstallationPath()
Returns the installation path.
|
abstract String |
getInstancePath()
Returns the instance path.
|
LocalizableMessage |
getLineBreak()
Returns the line break formatted.
|
protected LocalizableMessage |
getMessage(TopologyCacheException e)
Returns a localized representation of a TopologyCacheException object.
|
ProgressMessageFormatter |
getProgressMessageFormatter()
Gets the formatter this instance is currently using.
|
abstract Integer |
getRatio(ProgressStep step)
Gets an integer representing the amount of processing
this application still needs to perform as a ratio
out of 100.
|
protected ConnectionWrapper |
getRemoteConnection(ServerDescriptor server,
org.forgerock.opendj.ldap.Dn dn,
String pwd,
int timeout,
Set<PreferredConnection> cnx)
Gets a connection based on the information that appears on the
provided ServerDescriptor object.
|
abstract LocalizableMessage |
getSummary(ProgressStep step)
Gets an i18n'd string representing the summary of
a give ProgressStep.
|
protected LocalizableMessage |
getTaskSeparator()
Returns the task separator formatted.
|
ApplicationTrustManager |
getTrustManager()
Returns the trust manager that can be used to establish secure connections.
|
UserData |
getUserData()
Returns the UserData object representing the parameters provided by
the user to do the installation.
|
abstract boolean |
isCancellable()
Indicates whether this application is capable of cancelling
the operation performed in the run method.
|
abstract boolean |
isFinished()
Returns whether the installer has finished or not.
|
boolean |
isVerbose()
Returns
true if the application is running in verbose mode and
false otherwise. |
void |
notifyListeners(Integer ratio,
LocalizableMessage currentPhaseSummary,
LocalizableMessage newLogDetail)
This method notifies the ProgressUpdateListeners that there was an
update in the installation progress.
|
void |
notifyListeners(LocalizableMessage newLogDetail)
This method is called when a new log message has been received.
|
void |
notifyListenersDone(Integer ratio)
This method notifies the ProgressUpdateListeners that there was an
update in the installation progress.
|
void |
notifyListenersRatioChange(Integer ratio)
This method notifies the ProgressUpdateListeners that there was an
update in the installation progress.
|
void |
notifyListenersWithPoints(Integer ratio,
LocalizableMessage newLogDetail)
This method notifies the ProgressUpdateListeners that there was an
update in the installation progress.
|
void |
removeProgressUpdateListener(ProgressUpdateListener l)
Removes a ProgressUpdateListener.
|
void |
setCurrentInstallStatus(CurrentInstallStatus installStatus)
Sets the current install status for this application.
|
void |
setInstallation(Installation installation)
Sets the application's installation.
|
void |
setNotifyListeners(boolean notifyListeners)
Tells whether we must notify the listeners or not of the message
received.
|
void |
setProgressMessageFormatter(ProgressMessageFormatter formatter)
Sets the formatter this instance should use to used
to format progress messages.
|
void |
setTempLogFile(TempLogFile tempLogFile)
Sets the temporary log file where messages will be logged.
|
void |
setUserData(UserData userData)
Sets this instances user data.
|
protected CurrentInstallStatus installStatus
protected ProgressMessageFormatter formatter
protected TempLogFile tempLogFile
public Application()
public static GuiApplication create() throws RuntimeException
org.opends.quicksetup.Application.class
.RuntimeException
- if there was a problem
creating the new Application objectpublic void setUserData(UserData userData)
userData
- UserData this application will use
when executingpublic UserData createUserData()
public void addProgressUpdateListener(ProgressUpdateListener l)
addProgressUpdateListener
in interface ProgressNotifier
l
- the ProgressUpdateListener to be added.public void removeProgressUpdateListener(ProgressUpdateListener l)
removeProgressUpdateListener
in interface ProgressNotifier
l
- the ProgressUpdateListener to be removed.public Installation getInstallation()
public void setInstallation(Installation installation)
installation
- describing the application's OpenDS installationpublic UserData getUserData()
public void notifyListenersDone(Integer ratio)
ratio
- the integer that specifies which percentage of the whole
installation has been completed.public void notifyListenersRatioChange(Integer ratio)
ratio
- the integer that specifies which percentage of the whole
installation has been completed.public void notifyListeners(Integer ratio, LocalizableMessage currentPhaseSummary, LocalizableMessage newLogDetail)
notifyListeners
in interface ProgressNotifier
ratio
- the integer that specifies which percentage of
the whole installation has been completed.currentPhaseSummary
- the localized summary message for the
current installation progress in formatted form.newLogDetail
- the new log messages that we have for the
installation in formatted form.public void notifyListenersWithPoints(Integer ratio, LocalizableMessage newLogDetail)
ratio
- the integer that specifies which percentage of
the whole installation has been completed.newLogDetail
- the localized additional log message.public void setProgressMessageFormatter(ProgressMessageFormatter formatter)
formatter
- ProgressMessageFormatter for formatting
progress messagespublic ProgressMessageFormatter getProgressMessageFormatter()
protected LocalizableMessage getFormattedSummary(LocalizableMessage text)
text
- the source text from which we want to get the formatted
representationprotected LocalizableMessage getFormattedError(LocalizableMessage text)
text
- the source text from which we want to get the formatted
representationpublic LocalizableMessage getFormattedWarning(LocalizableMessage text)
text
- the source text from which we want to get the formatted
representationprotected LocalizableMessage getFormattedSuccess(LocalizableMessage text)
text
- the source text from which we want to get the formatted
representationpublic LocalizableMessage getFormattedLogError(LocalizableMessage text)
text
- the source text from which we want to get the formatted
representationpublic LocalizableMessage getFormattedLog(LocalizableMessage text)
text
- the source text from which we want to get the formatted
representationpublic LocalizableMessage getFormattedDone()
public LocalizableMessage getFormattedDoneWithLineBreak()
public LocalizableMessage getFormattedWithPoints(LocalizableMessage text)
text
- the String to which add points.public LocalizableMessage getFormattedProgress(LocalizableMessage text)
text
- the source text from which we want to get the formatted
representationpublic LocalizableMessage getFormattedProgressWithLineBreak(LocalizableMessage text)
text
- the source text from which we want to get the formatted
representationprotected LocalizableMessage getFormattedError(Throwable t, boolean applyMargin)
true
.t
- the exception.applyMargin
- specifies whether we apply a margin or not to the
resulting formatted text.public LocalizableMessage getLineBreak()
protected LocalizableMessage getTaskSeparator()
public void notifyListeners(LocalizableMessage newLogDetail)
newLogDetail
- the new log detail.public abstract String getInstallationPath()
public abstract String getInstancePath()
public abstract ProgressStep getCurrentProgressStep()
public abstract Integer getRatio(ProgressStep step)
step
- ProgressStop for which a summary is neededpublic abstract LocalizableMessage getSummary(ProgressStep step)
step
- ProgressStop for which a summary is neededpublic void setCurrentInstallStatus(CurrentInstallStatus installStatus)
installStatus
- for the current installation.public abstract boolean isFinished()
true
if the install is finished or false
if not.public ApplicationTrustManager getTrustManager()
public abstract boolean isCancellable()
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.public abstract void cancel()
isFinished
returns true so that the application can complete.public void checkAbort() throws ApplicationException
ApplicationException
- thrown if the application was aborted.protected LocalizableMessage getMessage(TopologyCacheException e)
e
- the exception we want to obtain the representation from.protected ConnectionWrapper getRemoteConnection(ServerDescriptor server, org.forgerock.opendj.ldap.Dn dn, String pwd, int timeout, Set<PreferredConnection> cnx) throws ApplicationException
server
- the object describing the server.dn
- the dn to be used to authenticate.pwd
- the pwd to be used to authenticate.timeout
- the timeout to establish the connection in milliseconds.
Use 0
to express no timeout.cnx
- the ordered list of preferred connections to connect to the
server.ApplicationException
- if something goes wrong.public boolean isVerbose()
true
if the application is running in verbose mode and
false
otherwise.true
if the application is running in verbose mode and
false
otherwise.public Application.ErrorPrintStream getApplicationErrorStream()
public Application.OutputPrintStream getApplicationOutputStream()
public void setNotifyListeners(boolean notifyListeners)
notifyListeners
- the boolean that informs of whether we have
to notify the listeners or not.protected void applicationPrintStreamReceived(String message)
message
- the message that has been receivedpublic void setTempLogFile(TempLogFile tempLogFile)
tempLogFile
- temporary log file where messages will be logged.Copyright © 2010-2017 ForgeRock AS. All Rights Reserved.