All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.cxf.event.EventCache Maven / Gradle / Ivy

There is a newer version: 3.0.0-milestone2
Show newest version
/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you 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 org.apache.cxf.event;

import java.util.List;

import javax.xml.namespace.QName;


/**
 * Caches all events that do not have a listener associated with them.
 * The events will be stored until the cache limit is reached.
 * After reaching the cache size, events will be discarded using first in,
 * first out semantics.
 */
public interface EventCache {
    /**
     * Add the Event to the cache.
     * If the maximum size of the cache is reached, the first Event
     * added will be removed from the cache(FIFO)
     * @param e The Event to be added to the cache.
     */
    void addEvent(Event e);


    /**
     * Flushes the cache of all the Events.
     * @return List Containing the cached Events.
     */
    List flushEvents();


    /**
     * Flushes the Event from the cache matching the event type.
     * @param eventType the Event type.
     * @return List the list of Events matching the event type. 
     */
    List flushEvents(QName eventType);


    /**
     * Flushes the Events from the cache matching the event type namespace.
     * @param namespaceURI the Event type namespace.
     * @return List the list of Events matching the event type namespace.
     */
    List flushEvents(String namespaceURI);

    /**
     * Returns all the events. This method doesn't remove the
     * events from the cache.
     * @return List the list of all events stored in the cache.
     */
    List getEvents();


    /**
     * Returns all the events matching the event type. This method doesn't
     * remove the events from the cache.
     * @param eventType the Event type.
     * @return the list of Events matching the event type.
     */
    List getEvents(QName eventType);

    /**
     * Returns all the events matching the event type namespace. This method doesn't
     * remove the events from the cache.
     * @param namespaceURI the Event type namespace.
     * @return the list of Events matching the event type namespace.
     */
    List getEvents(String namespaceURI);


    /**
     * Sets the cache size. This method can be used to dynamically change the
     * cache size from the configured size.
     * @param size Indicates the new size of the cache.
     */
    void setCacheSize(int size);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy