KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > monolog > provider > lib > topics > TopicTools


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2003 USTL - LIFL - GOAL
5 Contact: openccm-team@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jerome Offroy.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.util.monolog.provider.lib.topics;
28
29 import java.io.PrintStream JavaDoc;
30 import java.util.HashMap JavaDoc;
31 import java.util.Iterator JavaDoc;
32
33 import org.objectweb.util.monolog.provider.lib.LoggerProviderSingleton;
34 import org.objectweb.util.monolog.provider.lib.TopicProviderSingleton;
35
36
37 /**
38  * @author Jerome Offroy
39  *
40  * class used to store utilities for Topics
41  * - function to print names of Topics used and configured
42  *
43  */

44 public class TopicTools {
45     
46     /**
47      * display all the names configured for topics in the current JVM to out
48      * @param out
49      */

50     static public void showAllTopics(PrintStream JavaDoc out){
51         String JavaDoc [] tmp = LoggerProviderSingleton.getLoggerProvider().getTopics();
52         out.println("configured Topics list");
53         for (int i=0; i< tmp.length ; i++){ out.println(tmp[i]);}
54     }
55      
56      /**
57       * display all the names used for topics in the current JVM to out
58       * @param out
59       */

60      static public void showAllUsedTopics(PrintStream JavaDoc out){
61         String JavaDoc [] tmp = TopicProviderSingleton.getTopicProvider().getTopics();
62         out.println("used Topics list");
63         for (int i=0; i< tmp.length ; i++){ out.println(tmp[i]);}
64     }
65
66     /**
67      * display all the key | names used for topics in the current JVM to out
68      * @param out
69      */

70     static public void showAllUsedTopicsWithRef(PrintStream JavaDoc out){
71         //TODO make a good display
72
HashMap JavaDoc tmp = TopicProviderSingleton.getTopicProvider().getTopicsByRef();
73         Iterator JavaDoc it = tmp.keySet().iterator();
74         Class JavaDoc key = null;
75         String JavaDoc value = "";
76             out.println("key\t\t\t\t|\tvalue");
77                     while(it.hasNext()){
78             key = (Class JavaDoc )it.next();
79             value = (String JavaDoc)tmp.get(key) ;
80             out.println(key + "\t" + value);
81         }
82         
83     }
84 }
85
Popular Tags