KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

55   public void initFcController(final InitializationContext ic)
56       throws InstantiationException JavaDoc
57   {
58     _super_initFcController(ic);
59     // Set the taskLogger
60
weaveableTMCLogger = NullLogger.NULL_LOGGER;
61     // register to logger controller
62
if (_this_weaveableOptLogC != null)
63     {
64       ((LoggerControllerRegister) _this_weaveableOptLogC).register(
65           "task-manager", (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 ("task".equals(name))
75     {
76       weaveableTMCLogger = 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