001 /*
002 *
003 * $Revision: 14998 $ $Date: 2009-03-24 14:08:58 +0100 (Tue, 24 Mar 2009) $
004 *
005 * This file is part of *** M y C o R e ***
006 * See http://www.mycore.de/ for details.
007 *
008 * This program is free software; you can use it, redistribute it
009 * and / or modify it under the terms of the GNU General Public License
010 * (GPL) as published by the Free Software Foundation; either version 2
011 * of the License or (at your option) any later version.
012 *
013 * This program is distributed in the hope that it will be useful, but
014 * WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program, in a file called gpl.txt or license.txt.
020 * If not, write to the Free Software Foundation Inc.,
021 * 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA
022 */
023
024 package org.mycore.common.events;
025
026 /**
027 * Represents an event that occured in the MyCoRe system. Events are of a
028 * predefined event type like create, update, delete and an object type like
029 * object or file. They can be handled by MCREventHandler implementations.
030 * Events are automatically created by some MyCoRe components and are forwarded
031 * to the handlers by MCREventManager.
032 *
033 * @author Frank Luetzenkirchen
034 */
035 public class MCREvent extends java.util.Hashtable<String, Object> {
036 /**
037 * Default version ID
038 */
039 private static final long serialVersionUID = 1L;
040
041 /** Pre-defined event types * */
042 final static public String CREATE_EVENT = "create";
043
044 final static public String UPDATE_EVENT = "update";
045
046 final static public String DELETE_EVENT = "delete";
047
048 final static public String REPAIR_EVENT = "repair";
049
050 final static public String OBJECT_TYPE = "MCRObject";
051
052 final static public String DERIVATE_TYPE = "MCRDerivate";
053
054 final static public String FILE_TYPE = "MCRFile";
055
056 final static public String CLASS_TYPE = "MCRClassification";
057
058 /** The object type like object or file * */
059 private String objType;
060
061 /** The event type like create, update or delete * */
062 private String evtType;
063
064 /**
065 * Creates a new event object of the given object type (object, file) and
066 * event type (create, update, delete)
067 */
068 public MCREvent(String objType, String evtType) {
069 this.objType = objType;
070 this.evtType = evtType;
071 }
072
073 /**
074 * Returns the object type of this event
075 *
076 * @return the object type of this event
077 */
078 public String getObjectType() {
079 return objType;
080 }
081
082 /**
083 * Returns the event type of this event
084 *
085 * @return the event type of this event
086 */
087 public String getEventType() {
088 return evtType;
089 }
090 }