コード例 #1
0
 /* (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;
   }
 }
コード例 #2
0
  /** Get the merged Event Registry. */
  @SuppressWarnings("unchecked")
  private List<ToolInfo> getMergedEventRegistry() {
    if (eventRegistryCache.containsKey(CACHENAME_EVENTREGISTRY)) {
      return (List<ToolInfo>) eventRegistryCache.get(CACHENAME_EVENTREGISTRY);
    } else {
      // First:  use file Event Registry
      List<ToolInfo> eventRegistry = fileEventRegistry.getEventRegistry();

      // Second: add EntityBroker Event Registry,
      //         replacing events for tools found on this Registry
      //         (but keeping the anonymous flag for events in both Registries)
      eventRegistry =
          EventUtil.addToEventRegistry(
              entityBrokerEventRegistry.getEventRegistry(), true, eventRegistry);

      // Cache Event Registry
      eventRegistryCache.put(CACHENAME_EVENTREGISTRY, eventRegistry);
      LOG.debug("Cached EventRegistry.");
      return eventRegistry;
    }
  }