View Javadoc

1   package org.apache.jcs.engine.control.event;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  import java.util.EventObject;
23  
24  import org.apache.jcs.engine.control.event.behavior.IElementEvent;
25  import org.apache.jcs.engine.control.event.behavior.IElementEventConstants;
26  
27  /***
28   * Element events will trigger the creation of Element Event objects. This is a
29   * wrapper around the cache element that indicates the event triggered.
30   *
31   */
32  public class ElementEvent
33      extends EventObject
34      implements IElementEventConstants, IElementEvent
35  {
36  
37      private static final long serialVersionUID = -5364117411457467056L;
38  
39      private int elementEvent = ElementEvent.ELEMENT_EVENT_EXCEEDED_MAXLIFE_BACKGROUND;
40  
41      /***
42       * Constructor for the ElementEvent object
43       *
44       * @param source
45       *            The Cache Element (should restrict?)
46       * @param elementEvent
47       *            The event id defined in the constants class.
48       */
49      public ElementEvent( Object source, int elementEvent )
50      {
51          super( source );
52          this.elementEvent = elementEvent;
53      }
54  
55      /***
56       * Gets the elementEvent attribute of the ElementEvent object
57       *
58       * @return The elementEvent value. The List of values is defined in
59       *         IElementEventConstants.
60       */
61      public int getElementEvent()
62      {
63          return elementEvent;
64      }
65  
66  }