01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */package org.apache.cxf.event;
19:
20: import java.util.List;
21:
22: import javax.xml.namespace.QName;
23:
24: /**
25: * Caches all events that do not have a listener associated with them.
26: * The events will be stored until the cache limit is reached.
27: * After reaching the cache size, events will be discarded using first in,
28: * first out semantics.
29: */
30: public interface EventCache {
31: /**
32: * Add the <code>Event</code> to the cache.
33: * If the maximum size of the cache is reached, the first <code>Event</code>
34: * added will be removed from the cache(FIFO)
35: * @param e The <code>Event</code> to be added to the cache.
36: */
37: void addEvent(Event e);
38:
39: /**
40: * Flushes the cache of all the <code>Event</code>s.
41: * @return List Containing the cached <code>Event</code>s.
42: */
43: List<Event> flushEvents();
44:
45: /**
46: * Flushes the <code>Event</code> from the cache matching the event type.
47: * @param eventType the <code>Event</code> type.
48: * @return List the list of <code>Event</code>s matching the event type.
49: */
50: List<Event> flushEvents(QName eventType);
51:
52: /**
53: * Flushes the <code>Event</code>s from the cache matching the event type namespace.
54: * @param namespaceURI the <code>Event</code> type namespace.
55: * @return List the list of <code>Event</code>s matching the event type namespace.
56: */
57: List<Event> flushEvents(String namespaceURI);
58:
59: /**
60: * Returns all the events. This method doesn't remove the
61: * events from the cache.
62: * @return List the list of all events stored in the cache.
63: */
64: List<Event> getEvents();
65:
66: /**
67: * Returns all the events matching the event type. This method doesn't
68: * remove the events from the cache.
69: * @param eventType the <code>Event</code> type.
70: * @return the list of <code>Event</code>s matching the event type.
71: */
72: List<Event> getEvents(QName eventType);
73:
74: /**
75: * Returns all the events matching the event type namespace. This method doesn't
76: * remove the events from the cache.
77: * @param namespaceURI the <code>Event</code> type namespace.
78: * @return the list of <code>Event</code>s matching the event type namespace.
79: */
80: List<Event> getEvents(String namespaceURI);
81:
82: /**
83: * Sets the cache size. This method can be used to dynamically change the
84: * cache size from the configured size.
85: * @param size Indicates the new size of the cache.
86: */
87: void setCacheSize(int size);
88: }
|