KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > javabb > component > Spy


1 /*
2  * Copyright 2004 JavaFree.org
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.javabb.component;
17
18 import java.util.HashMap JavaDoc;
19 import java.util.LinkedHashSet JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import org.javabb.vo.Topic;
23
24 /**
25  * $Id: Spy.java,v 1.1.2.2 2006/08/28 21:00:21 daltoncamargo Exp $
26  *
27  * @author Dalton Camargo
28  */

29 public class Spy {
30
31     private static LinkedHashSet JavaDoc mostViews;
32     private static Map JavaDoc messagesI18n;
33
34     public static LinkedHashSet JavaDoc getSpyTopics() {
35         return Spy.mostViews;
36     }
37
38     public static void addSpyTopic(Topic topic) {
39         if (topic != null) {
40             if(Spy.mostViews == null){
41                 Spy.mostViews = new LinkedHashSet JavaDoc();
42             }
43             LinkedHashSet JavaDoc set = new LinkedHashSet JavaDoc();
44             set.add(topic);
45             set.addAll(Spy.mostViews);
46             Spy.mostViews = set;
47         }
48     }
49
50     public static void set18Messages(Map JavaDoc values){
51         if(Spy.messagesI18n == null){
52             Spy.messagesI18n = new HashMap JavaDoc();
53         }
54         Spy.messagesI18n = values;
55     }
56     
57     public static Map JavaDoc getI18NMessages() {
58         return Spy.messagesI18n;
59     }
60     
61     
62 }
63
Popular Tags