KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dream > control > lifecycle > LoggableLifeCycleMixin


1 /**
2  * Dream Copyright (C) 2003-2004 INRIA Rhone-Alpes
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 2 of the License, or (at your option) any
7  * later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Contact: dream@objectweb.org
19  *
20  * Initial developer(s): Matthieu Leclercq
21  * Contributor(s):
22  */

23
24 package org.objectweb.dream.control.lifecycle;
25
26 import org.objectweb.dream.control.logger.Loggable;
27 import org.objectweb.dream.control.logger.LoggerController;
28 import org.objectweb.dream.control.logger.LoggerControllerRegister;
29 import org.objectweb.dream.util.NullLogger;
30 import org.objectweb.fractal.api.factory.InstantiationException;
31 import org.objectweb.fractal.julia.InitializationContext;
32 import org.objectweb.util.monolog.api.Logger;
33
34 /**
35  * Basic mixin implementing the <code>Loggable</code> interface, and provides
36  * a logger to the LifeCycleController. <br>
37  * <br>
38  * <b>Requirements </b>
39  * <ul>
40  * <li>this mixin requires the
41  * {@link org.objectweb.dream.control.logger.UseLoggerControllerMixin }mixin.
42  * </li>
43  * </ul>
44  */

45 public abstract class LoggableLifeCycleMixin implements Loggable
46 {
47
48   /** The logger of the task controller */
49   public Logger weaveableLCCLogger;
50
51   /**
52    * @see org.objectweb.fractal.julia.Controller#initFcController(InitializationContext)
53    */

54   public void initFcController(final InitializationContext ic)
55       throws InstantiationException JavaDoc
56   {
57     _super_initFcController(ic);
58
59     // Set the taskLogger
60
weaveableLCCLogger = NullLogger.NULL_LOGGER;
61     // register to logger controller
62
if (_this_weaveableOptLogC != null)
63     {
64       ((LoggerControllerRegister) _this_weaveableOptLogC).register(
65           "life-cycle", (Loggable) this);
66     }
67   }
68
69   /**
70    * @see Loggable#setLogger(String, Logger)
71    */

72   public void setLogger(String JavaDoc name, Logger logger)
73   {
74     if ("life-cycle".equals(name))
75     {
76       weaveableLCCLogger = logger;
77     }
78   }
79
80   // ---------------------------------------------------------------------------
81
// Fields and methods required by the mixin class in the base class
82
// ---------------------------------------------------------------------------
83

84   /**
85    * The <tt>weaveableOptLogC</tt> field required by this mixin. This field is
86    * supposed to reference the {@link LoggerController }interface of the
87    * component to which this controller object belongs.
88    */

89   public LoggerController _this_weaveableOptLogC;
90
91   /**
92    * The
93    * {@link org.objectweb.fractal.julia.Controller#initFcController(InitializationContext)}
94    * method overriden by this mixin.
95    *
96    * @see org.objectweb.fractal.julia.Controller#initFcController(InitializationContext)
97    */

98   public abstract void _super_initFcController(InitializationContext ic)
99       throws InstantiationException JavaDoc;
100
101 }
Popular Tags