com.universaldevices.resources.errormessages
Class Errors

java.lang.Object
  extended by com.universaldevices.resources.errormessages.Errors

public class Errors
extends java.lang.Object

This class handles all the error conditions generated either by ISY or by UDClient and notifies all the listeners

Author:
UD Architect

Field Summary
static java.lang.String ERROR_DIALOG_TITLE
          Start NLS
 
Constructor Summary
Errors()
           
 
Method Summary
static void addErrorListener(ErrorEventListener l)
          Adds an error listener
static java.util.Enumeration getErrorListeners()
           
static java.lang.String getErrorMessage(int status)
          Returns an error message based on the error id/status
static java.lang.String getLastError(int err)
           
static java.lang.String getSMTPError(java.lang.String err)
           
static boolean isSMTPError(int err)
           
static void removeErrorListener(ErrorEventListener l)
          Removes an error listener
static void removeGUIErrorHandler()
          Removes the previously set GUIErrorHandler
static void resetStatus()
          Since errors are handled in a state machine (i.e.
static GUIErrorHandler setGUIErrorHandler(GUIErrorHandler ge)
          Sets a GUI error handler which is going to be invoked in case of errors.
static void showError(int status, java.lang.String message)
          Convenient method for showError when the error is generated by UDClient and/or its proper subclasses
static void showError(int status, java.lang.String message, java.lang.Object object)
          This method is called by UDClient and its proper subclasses to indicate error conditions.
static void showError(java.lang.String msg, java.lang.String title, int type)
          Convenient method to completely bypass the Error subroutines and print out a message to either System.err or to GUIErrorHandler (if it's installed)
static void Stop()
          Clear all the static variables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_DIALOG_TITLE

public static final java.lang.String ERROR_DIALOG_TITLE
Start NLS

See Also:
Constant Field Values
Constructor Detail

Errors

public Errors()
Method Detail

addErrorListener

public static void addErrorListener(ErrorEventListener l)
Adds an error listener

Parameters:
l - - the listener to be added

removeErrorListener

public static void removeErrorListener(ErrorEventListener l)
Removes an error listener

Parameters:
l - - the listener to be removed

getErrorListeners

public static java.util.Enumeration getErrorListeners()
Returns:
- an Enumeration of all error listeners

setGUIErrorHandler

public static GUIErrorHandler setGUIErrorHandler(GUIErrorHandler ge)
Sets a GUI error handler which is going to be invoked in case of errors. Otherwise, depending on the return value of errorOccured, the errors are written to System.err

Parameters:
ge - - the GUIErrorHandler

removeGUIErrorHandler

public static void removeGUIErrorHandler()
Removes the previously set GUIErrorHandler


Stop

public static void Stop()
Clear all the static variables


isSMTPError

public static final boolean isSMTPError(int err)

getLastError

public static java.lang.String getLastError(int err)

getSMTPError

public static java.lang.String getSMTPError(java.lang.String err)

resetStatus

public static void resetStatus()
Since errors are handled in a state machine (i.e. the same error is not notified more than once), the clients may use the resetStatus() method to clear the state and thus be notified of same errors more than once


getErrorMessage

public static java.lang.String getErrorMessage(int status)
Returns an error message based on the error id/status

Parameters:
status - - the error id/status
Returns:
- the error message

showError

public static void showError(int status,
                             java.lang.String message,
                             java.lang.Object object)
This method is called by UDClient and its proper subclasses to indicate error conditions. As such, this method should not be extended or reimplemented. This method is the traffic controller for all the errors and thus notifies all the error listeners (by invoking errorOccurred method). If the errorOccured method returns true, then this method prints the error to System.err if no GUIErrorHandler is installed, or calls the showError(...) on GUIErrorHandler otherwise

Parameters:
status - - the error id
message - - an optional message
object - - the UDProxyDevice initiating this event/error (if any)

showError

public static void showError(int status,
                             java.lang.String message)
Convenient method for showError when the error is generated by UDClient and/or its proper subclasses

Parameters:
status - - the error id
message - - an optional message

showError

public static void showError(java.lang.String msg,
                             java.lang.String title,
                             int type)
Convenient method to completely bypass the Error subroutines and print out a message to either System.err or to GUIErrorHandler (if it's installed)

Parameters:
msg - - the message to be printed
title - - the title if any
type - - the type (based on JOptionPane)