[all packages]
[package BR.unicamp.Guarana]
[class hierarchy]
[index]
public class BR.unicamp.Guarana.MetaLogger
(source file: /home/lsd/oliva/src/java/guarana/kaffe/libraries/extensions/guarana/javalib/BR/unicamp/Guarana/MetaLogger.java)
java.lang.Object
|
+----BR.unicamp.Guarana.MetaObject
|
+----BR.unicamp.Guarana.MetaLogger
The pure class interface.
public class MetaLogger
extends MetaObject
-
Logs all Operations, Results, Messages and Reconfiguration
requests.
It can be used for starting-up an originally non-reflective
application with logging enabled.
- See also:
- main
- MetaLogger(Writer)
-
Creates a MetaLogger that logs to the specified Writer
- MetaLogger(PrintWriter)
-
Creates a MetaLogger that logs to the specified PrintWriter.
- MetaLogger(OutputStream)
-
Creates a MetaLogger that logs to the specified OutputStream.
It will be wrapped in a
- MetaLogger()
-
Create a MetaLogger that logs to System.out.
- configure(Object, Object)
-
Copies itself into the meta-configuration of the new object, as
long as this object is not
- handle(Result, Object)
-
Logs a `Result' string.
- handle(Message, Object)
-
Logs a `Message' string.
- handle(Operation, Object)
-
Logs an `Operation' string.
- initialize(OperationFactory, Object)
-
Logs an initialization message.
- main(String[])
-
The MetaLogger class can be used as an application starter.
Running `guarana
- reconfigure(Object, MetaObject, MetaObject)
-
Accepts any reconfiguration request targeted to itself
- release(Object)
-
Logs an object release message.
- setPrefix(String)
-
Sets a prefix String, prepended to every line printed by this
MetaLogger.
MetaLogger
public MetaLogger();
-
Create a MetaLogger that logs to System.out.
MetaLogger
public MetaLogger(OutputStream out);
-
Creates a MetaLogger that logs to the specified OutputStream.
It will be wrapped in a PrintWriter with autoflush enabled.
- Parameters:
- out - the OutputStream that will get all logging.
MetaLogger
public MetaLogger(Writer out);
-
Creates a MetaLogger that logs to the specified Writer. It
will be wrapper in a PrintWriter with autoflush enabled.
- Parameters:
- out - the Writer that will get all logging.
MetaLogger
public MetaLogger(PrintWriter out);
-
Creates a MetaLogger that logs to the specified PrintWriter.
- Parameters:
- out - the PrintWriter that will get all logging.
setPrefix
public MetaLogger setPrefix(String prefix);
-
Sets a prefix String, prepended to every line printed by this
MetaLogger.
- Parameters:
- prefix - the prefix String. It should not be null,
otherwise the prefix will be the string `null'.
- Returns:
- the MetaLogger itself, so this can be chained with
construction or whatever.
handle
public Result handle(Operation op,
Object ob);
-
Logs an `Operation' string.
- Parameters:
- op - the Operation to be logged.
- ob - the target Object of the Operation. Unused.
- Returns:
- a request to inspect the result of the Operation:
Result.inspectResult.
- Overrides:
- handle in class MetaObject
handle
public Result handle(Result res,
Object ob);
-
Logs a `Result' string.
- Parameters:
- res - the Result of an Operation.
- ob - the target Object of the Operation.
- Returns:
- null, i.e., the provided Result should be maintained.
- Overrides:
- handle in class MetaObject
handle
public void handle(Message msg,
Object ob);
-
Logs a `Message' string.
- Parameters:
- msg - the Message to be logged.
- ob - the Object whose meta-configuration was the target of
the Message broadcast.
- Overrides:
- handle in class MetaObject
configure
public MetaObject configure(Object newObject,
Object object);
-
Copies itself into the meta-configuration of the new object, as
long as this object is not a String or a StringBuffer. Logs a
message informing about the configuration request, and another
indicating whether it propagated itself or not.
- Parameters:
- newObject - the new Object whose meta-configuration is to
be provided. Just used for printing the Object identification.
- object - the Object whose meta-configuration the new
meta-configuration was based on. Just used for printing its
identification.
- Returns:
- this or null, depending on whether it decided to
propagate itself or not.
- Overrides:
- configure in class MetaObject
reconfigure
public MetaObject reconfigure(Object object,
MetaObject prev,
MetaObject next);
-
Accepts any reconfiguration request targeted to itself. All
requests are logged. Furthermore, if the reconfiguration
request is targeted on itself, an acceptance message is logged;
otherwise, a message stating that the request was ignored is.
- Parameters:
- object - the Object whose meta-configuration is to be
affected. Used only for logging.
- prev - the MetaObject to be replaced.
- next - the MetaObject that should take its place.
- Returns:
- next if prev == this, this otherwise.
- Overrides:
- reconfigure in class MetaObject
initialize
public void initialize(OperationFactory fact,
Object obj);
-
Logs an initialization message.
- Parameters:
- fact - ignored.
- obj - the Object whose meta-configuration is to be
initialized. Used just for logging purposes.
- Overrides:
- initialize in class MetaObject
release
public void release(Object obj);
-
Logs an object release message.
- Parameters:
- obj - the Object to be released. Used just for logging
purposes.
- Overrides:
- release in class MetaObject
main
public static void main(String[] argv)
throws java.lang.ClassNotFoundException, java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException;
-
The MetaLogger class can be used as an application starter.
Running `guarana BR.unicamp.Guarana.MetaLogger classname
arguments ...' is equivalent to associating classname with a
MetaLogger that logs to System.out and invoking classname.main
with the provided argument list.
If the first argument is a number instead of a classname, it
should be followed by a list of classnames that will be
associated with MetaLoggers that log to System.out. After this
list, a classname and an argument list should appear. In this
case, the classname will not be associated with a MetaLogger.
For example: `guarana BR.unicamp.Guarana.MetaLogger 3 A B C D
args' will cause MetaLoggers to be associated with classes A, B
and C. Finally, D.main will be invoked with the provided
argument list.
[all packages]
[package BR.unicamp.Guarana]
[class hierarchy]
[index]
BR.unicamp.Guarana.MetaLogger.html