/**
   * Invokes a given interface on a component's behavior.
   *
   * @param rcomponent The component
   * @param behavior
   * @throws ListenerInvocationNotAllowedException when listener invocation attempted on a component
   *     that does not allow it
   */
  public final void invoke(final IRequestableComponent rcomponent, final Behavior behavior) {
    // we are in Wicket core land
    final Component component = (Component) rcomponent;

    if (!behavior.canCallListenerInterface(component)) {
      log.warn(
          "behavior not enabled; ignore call. Behavior {} at component {}", behavior, component);
      throw new ListenerInvocationNotAllowedException(
          component, behavior, "Behavior rejected interface invocation. ");
    }

    internalInvoke(component, behavior);
  }
  /**
   * Invokes a given interface on a component.
   *
   * @param rcomponent The component
   * @throws ListenerInvocationNotAllowedException when listener invocation attempted on a component
   *     that does not allow it
   */
  public final void invoke(final IRequestableComponent rcomponent) {
    // we are in Wicket core land
    final Component component = (Component) rcomponent;

    if (!component.canCallListenerInterface()) {
      // just return so that we have a silent fail and just re-render the
      // page
      log.info("component not enabled or visible; ignoring call. Component: " + component);
      throw new ListenerInvocationNotAllowedException(
          component, null, "Component rejected interface invocation");
    }

    internalInvoke(component, component);
  }