/*******************************************************************************
 * Copyright (C) 2017 Push Technology Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/

package com.pushtechnology.adapters.rest.metrics;

import org.apache.http.HttpResponse;

import com.pushtechnology.adapters.rest.model.latest.EndpointConfig;
import com.pushtechnology.adapters.rest.model.latest.ServiceConfig;

/**
 * Listener for endpoint poll events.
 *
 * @author Push Technology Limited
 */
public interface PollListener {
    /**
     * Notified when an attempt to poll an endpoint is made.
     *
     * @param serviceConfig the service
     * @param endpointConfig the endpoint
     */
    void onPollRequest(ServiceConfig serviceConfig, EndpointConfig endpointConfig);

    /**
     * Notified when a response from an endpoint is received.
     *
     * @param serviceConfig the service
     * @param endpointConfig the endpoint
     * @param response the response from the endpoint
     */
    void onPollResponse(ServiceConfig serviceConfig, EndpointConfig endpointConfig, HttpResponse response);

    /**
     * Notified when an attempt to poll an endpoint fails.
     *
     * @param serviceConfig the service
     * @param endpointConfig the endpoint
     * @param exception the exception associated with the failure
     */
    void onPollFailure(ServiceConfig serviceConfig, EndpointConfig endpointConfig, Exception exception);
}

/*******************************************************************************
 * Copyright (C) 2017 Push Technology Ltd.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *******************************************************************************/

package com.pushtechnology.adapters.rest.metrics;

import org.apache.http.HttpResponse;

import com.pushtechnology.adapters.rest.model.latest.EndpointConfig;
import com.pushtechnology.adapters.rest.model.latest.ServiceConfig;

/**
 * Listener for endpoint poll events.
 *
 * @author Push Technology Limited
 */
public interface PollListener {
    /**
     * Notified when an attempt to poll an endpoint is made.
     *
     * @param serviceConfig the service
     * @param endpointConfig the endpoint
     */
    void onPollRequest(ServiceConfig serviceConfig, EndpointConfig endpointConfig);

    /**
     * Notified when a response from an endpoint is received.
     *
     * @param serviceConfig the service
     * @param endpointConfig the endpoint
     * @param response the response from the endpoint
     */
    void onPollResponse(ServiceConfig serviceConfig, EndpointConfig endpointConfig, HttpResponse response);

    /**
     * Notified when an attempt to poll an endpoint fails.
     *
     * @param serviceConfig the service
     * @param endpointConfig the endpoint
     * @param exception the exception associated with the failure
     */
    void onPollFailure(ServiceConfig serviceConfig, EndpointConfig endpointConfig, Exception exception);

    /**
     * Implementation of {@link PollListener} that ignores notifications.
     */
    PollListener NULL_LISTENER = new PollListener() {
        @Override
        public void onPollRequest(ServiceConfig serviceConfig, EndpointConfig endpointConfig) {
        }

        @Override
        public void onPollResponse(ServiceConfig serviceConfig, EndpointConfig endpointConfig, HttpResponse response) {
        }

        @Override
        public void onPollFailure(ServiceConfig serviceConfig, EndpointConfig endpointConfig, Exception exception) {
        }
    };
}

Add null poll event listener.