KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > dream > control > activity > task > LoggableTaskMixin


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.activity.task;
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 taskController. <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 LoggableTaskMixin implements Loggable
46 {
47
48   /** The logger of the task controller */
49   public Logger weaveableTCLogger;
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     // Set the taskLogger
59
weaveableTCLogger = NullLogger.NULL_LOGGER;
60     // register to logger controller
61
if (_this_weaveableOptLogC != null)
62     {
63       ((LoggerControllerRegister) _this_weaveableOptLogC).register(
64           "task-controller", (Loggable) this);
65     }
66   }
67
68   /**
69    * @see Loggable#setLogger(String, Logger)
70    */

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

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

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

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