/* (non-Javadoc)
  * @see org.sakaiproject.sitestats.impl.event.EventRegistryService#getEventRegistry(java.lang.String, boolean)
  */
 public List<ToolInfo> getEventRegistry(String siteId, boolean onlyAvailableInSite) {
   if (siteId == null) {
     // return the full event registry
     return getMergedEventRegistry();
   } else if (onlyAvailableInSite) {
     // return the event registry with only tools available in site
     return EventUtil.getIntersectionWithAvailableToolsInSite(
         M_ss, getMergedEventRegistry(), siteId);
   } else {
     // return the event registry with only tools available in (whole) Sakai
     return EventUtil.getIntersectionWithAvailableToolsInSakaiInstallation(
         M_tm, getMergedEventRegistry());
   }
 }
예제 #2
0
 public void fire(Change change, PatchSet ps, Account restorer, String reason, Timestamp when) {
   if (!listeners.iterator().hasNext()) {
     return;
   }
   try {
     fire(
         util.changeInfo(change),
         util.revisionInfo(change.getProject(), ps),
         util.accountInfo(restorer),
         reason,
         when);
   } catch (PatchListNotAvailableException | GpgException | IOException | OrmException e) {
     log.error("Couldn't fire event", e);
   }
 }
예제 #3
0
 private static void setActiveControl(final Shell shell, final Widget widget) {
   if (EventUtil.isAccessible(widget)) {
     Object adapter = shell.getAdapter(IShellAdapter.class);
     IShellAdapter shellAdapter = (IShellAdapter) adapter;
     shellAdapter.setActiveControl((Control) widget);
   }
 }
예제 #4
0
  /**
   * PerformanceDoctorの結果より、{@link AlarmNotifyEntity}のリストを作成します。
   *
   * @param warningUnitList パフォーマンスドクターの結果
   * @param alarmLevel アラームのレベル
   * @param agentId エージェントID
   * @param entityList {@link AlarmNotifyEntity}のリスト
   * @param javelinLog JavelinLog本体。ここから必要な部分を切りだす
   */
  private static void createAlarmEntity(
      final List<WarningUnit> warningUnitList,
      final int alarmLevel,
      final int agentId,
      final List<AlarmNotifyEntity> entityList,
      final InputStream javelinLog) {
    for (WarningUnit unit : warningUnitList) {
      String level = unit.getLevel();
      if (EventUtil.compareLevel(level, alarmLevel) == false) {
        continue;
      }

      int eventId = EventConstants.EVENT_TERM_NOTIFY_ALARM_RESPONSE;
      AlarmNotifyEntity alarmNotifyEntity = createAlarmEntity(agentId, unit, level, eventId);

      entityList.add(alarmNotifyEntity);
    }
  }
  /** 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;
    }
  }
예제 #6
0
파일: JSMap.java 프로젝트: caplith/OpenGTS
  /* write JS to stream */
  public void writeJavaScript(PrintWriter out, RequestProperties reqState) throws IOException {

    /* prefetch map "Loading" image */
    if (this.getProperties().getBoolean(PROP_MAP_LOADING, false)) {
      String mapLoadingImageURI = this.getProperties().getString(PROP_MAP_LOADING_IMAGE, null);
      if (!StringTools.isBlank(mapLoadingImageURI)) {
        out.write("<link rel=\"prefetch\" href=\"" + mapLoadingImageURI + "\">\n");
      }
    }

    /* JSMap variables */
    JavaScriptTools.writeStartJavaScript(out);
    this.writeJSVariables(out, reqState);
    JavaScriptTools.writeEndJavaScript(out);

    /* Subclass JavaScript includes */
    // links to MapProvider support are written by the subclass here
    this.writeJSIncludes(out, reqState);

    /* JSMap Custom included JavaScript */
    String jsMapURLs[] =
        StringTools.parseStringArray(this.getProperties().getString(PROP_javascript_src, ""), '\n');
    this.writeJSIncludes(out, reqState, jsMapURLs);

    /* JSMap Custom inline JavaScript */
    String jsMapInline =
        StringTools.trim(this.getProperties().getString(PROP_javascript_inline, null));
    if (!StringTools.isBlank(jsMapInline)) {
      JavaScriptTools.writeStartJavaScript(out);
      out.write("// --- Inline Javascript [" + this.getName() + "]\n");
      out.write(jsMapInline);
      out.write("\n");
      JavaScriptTools.writeEndJavaScript(out);
    }

    /* event CSV parsing code */
    JavaScriptTools.writeStartJavaScript(out);
    out.write(EventUtil.getInstance().getParseMapEventJS(reqState.isFleet(), reqState.getLocale()));
    JavaScriptTools.writeEndJavaScript(out);
  }