コード例 #1
0
  /**
   * Via this method, event filters are registered with the event logger service for live
   * notification about events of interest.
   *
   * @param filter the filter to register
   */
  public synchronized void registerFilterForLiveEvents(EventFilter filter) {
    if (log.isDebugEnabled())
      log.debug("Registering event filter for live events: " + filter.getUuid());

    // hibernate proxy prefetch workaround
    if (filter.getTemplate().getContext() != null) {
      if (Ranger.isEnumerationRange(filter.getTemplate().getContext())) {
        for (Deployment d :
            Ranger.castToEnumerationRange(filter.getTemplate().getContext()).getEnumeration()) {
          d.getDeployedComponent().getCode();
        }
      } else {
        filter.getTemplate().getContext().getDeployedComponent().getCode();
      }
    }
    this.eventFiltersByUuid.put(filter.getUuid(), filter);

    if (log.isDebugEnabled()) log.debug("Event filter for live events registered.");
  }
コード例 #2
0
  /**
   * Via this method, event filters are registered with the event logger service for live
   * notification about events of interest. Before this happens though, the template in the filter
   * is used to query the event registry. Matching events in this registry are sent to the client
   * first before live event notification is established via <code>doRegisterEventFilter()</code>.
   *
   * @param filter the event filter to register
   */
  public void registerEventFilter(EventFilter filter, int limit) {
    if (log.isDebugEnabled())
      log.debug("Passing event filter on to registration: " + filter.toString());

    // hibernate proxy prefetch workaround
    if (filter.getTemplate().getContext() != null) {
      if (Ranger.isEnumerationRange(filter.getTemplate().getContext())) {
        for (Deployment d :
            Ranger.castToEnumerationRange(filter.getTemplate().getContext()).getEnumeration()) {
          d.getDeployedComponent().getCode();
        }
      } else {
        filter.getTemplate().getContext().getDeployedComponent().getCode();
      }
    }
    EventFilterRegistrationHandler eventFilterRegistrationHandler =
        this.createEventFilterRegistrationHandler(filter, limit);

    this.eventFilterRegistrationThreadPool.execute(eventFilterRegistrationHandler);
  }