/* (non-Javadoc) * @see org.sakaiproject.sitestats.api.event.EventRegistry#getEventName(java.lang.String) */ public String getEventName(String eventId) { Locale currentUserLocale = getCurrentUserLocale(); EventLocaleKey key = new EventLocaleKey(eventId, currentUserLocale.toString()); if (eventNamesCache.containsKey(key.toString())) { return (String) eventNamesCache.get(key.toString()); } else { String eventName = null; try { String prefix = eventIdToEPPrefix.get(eventId); Statisticable s = M_epm.getProviderByPrefixAndCapability(prefix, Statisticable.class); Map<String, String> eventIdNamesMap = s.getEventNames(currentUserLocale); if (eventIdNamesMap != null) { for (String thisEventId : eventIdNamesMap.keySet()) { EventLocaleKey thisCacheKey = new EventLocaleKey(thisEventId, currentUserLocale.toString()); String thisEventName = eventIdNamesMap.get(thisEventId); eventNamesCache.put(thisCacheKey.toString(), thisEventName); if (thisEventId.equals(eventId)) { eventName = thisEventName; } } LOG.debug( "Cached event names for EB prefix '" + prefix + "', locale: " + currentUserLocale); } } catch (Exception e) { eventName = null; } return eventName; } }
public void init() { LOG.info("init()"); // configure cache eventNamesCache = M_ms.newCache(CACHENAME); // register EntityBrokerListener M_epm.registerListener(this, true); }