com.android.sdklib.internal.repository
Class NullTaskMonitor

java.lang.Object
  extended by com.android.sdklib.internal.repository.NullTaskMonitor
All Implemented Interfaces:
ITaskMonitor, com.android.utils.ILogger

public class NullTaskMonitor
extends java.lang.Object
implements ITaskMonitor

A no-op implementation of the ITaskMonitor interface.

This can be passed to methods that require a monitor when the caller doesn't have any UI to update or means to report tracked progress. A custom ILogger is used. Clients could use NullLogger if they really don't care about the logging either.


Constructor Summary
NullTaskMonitor(com.android.utils.ILogger log)
          Creates a no-op ITaskMonitor that defers logging to the specified logger.
 
Method Summary
 ITaskMonitor createSubMonitor(int tickCount)
          Creates a sub-monitor that will use up to tickCount on the progress bar.
 UserCredentials displayLoginCredentialsPrompt(java.lang.String title, java.lang.String message)
          Always return null.
 boolean displayPrompt(java.lang.String title, java.lang.String message)
          Always return false.
 void error(java.lang.Throwable t, java.lang.String errorFormat, java.lang.Object... args)
           
 int getProgress()
          Always return 1.
 int getProgressMax()
          Returns the max value of the progress bar, as last set by ITaskMonitor.setProgressMax(int).
 void incProgress(int delta)
          Increments the current value of the progress bar.
 void info(java.lang.String msgFormat, java.lang.Object... args)
           
 boolean isCancelRequested()
          Always return false.
 void log(java.lang.String format, java.lang.Object... args)
          Logs a "normal" information line.
 void logError(java.lang.String format, java.lang.Object... args)
          Logs an "error" information line.
 void logVerbose(java.lang.String format, java.lang.Object... args)
          Logs a "verbose" information line, that is extra details which are typically not that useful for the end-user and might be hidden until explicitly shown.
 void setDescription(java.lang.String format, java.lang.Object... args)
          Sets the description in the current task dialog.
 void setProgressMax(int max)
          Sets the max value of the progress bar.
 void verbose(java.lang.String msgFormat, java.lang.Object... args)
           
 void warning(java.lang.String warningFormat, java.lang.Object... args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NullTaskMonitor

public NullTaskMonitor(com.android.utils.ILogger log)
Creates a no-op ITaskMonitor that defers logging to the specified logger.

This can be passed to methods that require a monitor when the caller doesn't have any UI to update or means to report tracked progress.

Parameters:
log - An ILogger. Must not be null. Consider using NullLogger.
Method Detail

setDescription

public void setDescription(java.lang.String format,
                           java.lang.Object... args)
Description copied from interface: ITaskMonitor
Sets the description in the current task dialog. This method can be invoked from a non-UI thread.

Specified by:
setDescription in interface ITaskMonitor

log

public void log(java.lang.String format,
                java.lang.Object... args)
Description copied from interface: ITaskMonitor
Logs a "normal" information line. This method can be invoked from a non-UI thread.

Specified by:
log in interface ITaskMonitor

logError

public void logError(java.lang.String format,
                     java.lang.Object... args)
Description copied from interface: ITaskMonitor
Logs an "error" information line. This method can be invoked from a non-UI thread.

Specified by:
logError in interface ITaskMonitor

logVerbose

public void logVerbose(java.lang.String format,
                       java.lang.Object... args)
Description copied from interface: ITaskMonitor
Logs a "verbose" information line, that is extra details which are typically not that useful for the end-user and might be hidden until explicitly shown. This method can be invoked from a non-UI thread.

Specified by:
logVerbose in interface ITaskMonitor

setProgressMax

public void setProgressMax(int max)
Description copied from interface: ITaskMonitor
Sets the max value of the progress bar. This method can be invoked from a non-UI thread. This method MUST be invoked once before using ITaskMonitor.incProgress(int) or ITaskMonitor.getProgress() or ITaskMonitor.createSubMonitor(int). Callers are discouraged from using more than once -- implementations can either discard the next calls or behave incoherently.

Specified by:
setProgressMax in interface ITaskMonitor

getProgressMax

public int getProgressMax()
Description copied from interface: ITaskMonitor
Returns the max value of the progress bar, as last set by ITaskMonitor.setProgressMax(int). Returns 0 if the max has never been set yet.

Specified by:
getProgressMax in interface ITaskMonitor

incProgress

public void incProgress(int delta)
Description copied from interface: ITaskMonitor
Increments the current value of the progress bar. This method can be invoked from a non-UI thread. Callers MUST use setProgressMax before using this method.

Specified by:
incProgress in interface ITaskMonitor

getProgress

public int getProgress()
Always return 1.

Specified by:
getProgress in interface ITaskMonitor

isCancelRequested

public boolean isCancelRequested()
Always return false.

Specified by:
isCancelRequested in interface ITaskMonitor

createSubMonitor

public ITaskMonitor createSubMonitor(int tickCount)
Description copied from interface: ITaskMonitor
Creates a sub-monitor that will use up to tickCount on the progress bar. tickCount must be 1 or more.

Specified by:
createSubMonitor in interface ITaskMonitor

displayPrompt

public boolean displayPrompt(java.lang.String title,
                             java.lang.String message)
Always return false.

Specified by:
displayPrompt in interface ITaskMonitor
Parameters:
title - The title of the dialog box
message - The error message
Returns:
true if YES was clicked.

displayLoginCredentialsPrompt

public UserCredentials displayLoginCredentialsPrompt(java.lang.String title,
                                                     java.lang.String message)
Always return null.

Specified by:
displayLoginCredentialsPrompt in interface ITaskMonitor
Parameters:
title - The title of the dialog box.
message - The message to be displayed as an instruction.
Returns:
Returns the user provided credentials. Some fields may be blank if the user did not provide any input. If operation is canceled by user the return value must be null.

error

public void error(@Nullable
                  java.lang.Throwable t,
                  @Nullable
                  java.lang.String errorFormat,
                  java.lang.Object... args)
Specified by:
error in interface com.android.utils.ILogger

warning

public void warning(@NonNull
                    java.lang.String warningFormat,
                    java.lang.Object... args)
Specified by:
warning in interface com.android.utils.ILogger

info

public void info(@NonNull
                 java.lang.String msgFormat,
                 java.lang.Object... args)
Specified by:
info in interface com.android.utils.ILogger

verbose

public void verbose(@NonNull
                    java.lang.String msgFormat,
                    java.lang.Object... args)
Specified by:
verbose in interface com.android.utils.ILogger