1 26 27 package org.objectweb.util.monolog.provider.lib; 28 29 import java.util.HashMap ; 30 31 import org.objectweb.util.monolog.provider.api.TopicProvider; 32 import org.objectweb.util.monolog.provider.lib.topics.BundleTopics; 33 import org.objectweb.util.monolog.provider.lib.topics.TopicsMapSingleton; 34 import org.objectweb.util.monolog.provider.lib.topics.TopicsPool; 35 36 41 public class TopicProviderImpl implements TopicProvider { 42 protected static TopicsPool tm_ = TopicsMapSingleton.getTopicsMap(); 43 44 47 public String createTopic(String name, Class ref, String [] description) { 48 String realTopic = buildTopicNameBundle(ref) + BundleTopics.getPreTopic("TOPIC_SEPARATOR") + name; 49 50 if (ref != null) { 51 tm_.put(ref,realTopic,description); 54 } 55 return realTopic; 56 } 57 58 61 public String getTopic(Class ref) { 62 String res = tm_.getName(ref); 63 if (res == null) { 64 res = ""; 65 } 66 return res; 67 } 68 69 72 public String [] getTopics() { 73 return tm_.getAllName(); 74 } 75 76 79 public String [] getTopicDescription(String name) { 80 return tm_.getDescription(name); 81 } 82 83 87 public HashMap getTopicsByRef() { 88 return tm_.getTopicsByRef(); 89 } 90 91 94 private String buildTopicNameBundle(Class ref) { 95 String res = "default"; 96 res = BundleTopics.getPreTopic(ref.getPackage()); 97 return res; 98 } 99 } 100 | Popular Tags |