FileDocCategorySizeDatePackage
Notifier.javaAPI DocphoneME MR2 API (J2ME)5909Wed May 02 18:00:40 BST 2007com.sun.satsa.jcrmic.utils

Notifier

public class Notifier extends Object
This class is responsible for reporting any messages (error, warning, progress, banner and status messages) during the compilation.

Fields Summary
OutputStream
out
The stream where error messages are printed.
private static boolean
resourcesInitialized
Flag that indicates that resoyrces were initialized.
private static ResourceBundle
resources
Resource bundle.
Constructors Summary
public Notifier(OutputStream out)
Constructor.

param
out output stream


        this.out = out;
    
Methods Summary
public voiderror(java.lang.String msg)
Prints error message.

param
msg the message

        output(getText(msg));
    
public voiderror(java.lang.String msg, java.lang.String arg1)
Prints error message.

param
msg the message
param
arg1 argument

        output(getText(msg, arg1));
    
public voiderror(java.lang.String msg, java.lang.String arg1, java.lang.String arg2)
Prints error message.

param
msg the message
param
arg1 argument
param
arg2 argument

        output(getText(msg, arg1, arg2));
    
public voiderror(java.lang.String msg, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
Prints error message.

param
msg the message
param
arg1 argument
param
arg2 argument
param
arg3 argument

        output(getText(msg, arg1, arg2, arg3));
    
public static java.lang.StringgetString(java.lang.String key)
Return the string value of a named resource in the rmic.properties resource bundle. If the resource is not found, null is returned.

param
key resource name
return
the value


        if (!resourcesInitialized) {
            initResources();
        }

        try {
            return resources.getString(key);
        } catch (MissingResourceException ignore) {
        }
        return null;
    
public static java.lang.StringgetText(java.lang.String key, int num)
Returns the message.

param
key the key
param
num parameter
return
the message

        return getText(key, Integer.toString(num), null, null);
    
public static java.lang.StringgetText(java.lang.String key, java.lang.String arg0)
Returns the message.

param
key the key
param
arg0 parameter
return
the message

        return getText(key, arg0, null, null);
    
public static java.lang.StringgetText(java.lang.String key, java.lang.String arg0, java.lang.String arg1)
Returns the message.

param
key the key
param
arg0 parameter
param
arg1 parameter
return
the message

        return getText(key, arg0, arg1, null);
    
public static java.lang.StringgetText(java.lang.String key, java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)
Returns the message.

param
key the key
param
arg0 parameter
param
arg1 parameter
param
arg2 parameter
return
the message


        String format = getString(key);
        if (format == null) {
            format = "no text found: " +
                    "key = \"{0}\", arguments = \"{1}\", \"{2}\", \"{3}\"";
        }

        String[] args = new String[3];
        args[0] = (arg0 != null ? arg0.toString() : "null");
        args[1] = (arg1 != null ? arg1.toString() : "null");
        args[2] = (arg2 != null ? arg2.toString() : "null");

        return java.text.MessageFormat.format(format, args);
    
public static java.lang.StringgetText(java.lang.String key)
Returns the string for given key.

param
key the key
return
the string


        String message = getString(key);

        if (message == null) {
            message = "no text found: \"" + key + "\"";
        }

        return message;
    
private static voidinitResources()
Initializes resource bundle.


            
        

        try {
            resources = ResourceBundle.getBundle("com/sun/satsa/jcrmic/jcrmic");
            resourcesInitialized = true;
        } catch (MissingResourceException e) {
            throw new Error("fatal: missing resource bundle: " +
                    e.getClassName());
        }
    
public voidoutput(java.lang.String msg)
Output a message.

param
msg the message


        if (this.out instanceof PrintStream) {
            ((PrintStream) out).println(msg);
        } else {
            OutputStreamWriter osw = new OutputStreamWriter(this.out);
            PrintWriter pw = new PrintWriter(osw, true);
            pw.println(msg);
            try {
                osw.flush();
            } catch (IOException phooey) {
            }
        }