src/core/net/sf/basedb/util/extensions/events/EventType.java

Code
Comments
Other
Rev Date Author Line
4320 29 May 08 nicklas 1 /**
4320 29 May 08 nicklas 2   $Id$
4320 29 May 08 nicklas 3
4320 29 May 08 nicklas 4   Copyright (C) 2008 Nicklas Nordborg
4320 29 May 08 nicklas 5
4320 29 May 08 nicklas 6   This file is part of BASE - BioArray Software Environment.
4320 29 May 08 nicklas 7   Available at http://base.thep.lu.se/
4320 29 May 08 nicklas 8
4320 29 May 08 nicklas 9   BASE is free software; you can redistribute it and/or
4320 29 May 08 nicklas 10   modify it under the terms of the GNU General Public License
4479 05 Sep 08 jari 11   as published by the Free Software Foundation; either version 3
4320 29 May 08 nicklas 12   of the License, or (at your option) any later version.
4320 29 May 08 nicklas 13
4320 29 May 08 nicklas 14   BASE is distributed in the hope that it will be useful,
4320 29 May 08 nicklas 15   but WITHOUT ANY WARRANTY; without even the implied warranty of
4320 29 May 08 nicklas 16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
4320 29 May 08 nicklas 17   GNU General Public License for more details.
4320 29 May 08 nicklas 18
4320 29 May 08 nicklas 19   You should have received a copy of the GNU General Public License
4515 11 Sep 08 jari 20   along with BASE. If not, see <http://www.gnu.org/licenses/>.
4320 29 May 08 nicklas 21 */
4320 29 May 08 nicklas 22 package net.sf.basedb.util.extensions.events;
4320 29 May 08 nicklas 23
4320 29 May 08 nicklas 24 import net.sf.basedb.util.extensions.Extension;
4320 29 May 08 nicklas 25 import net.sf.basedb.util.extensions.ExtensionPoint;
4320 29 May 08 nicklas 26 import net.sf.basedb.util.extensions.Registry;
4320 29 May 08 nicklas 27
4320 29 May 08 nicklas 28 /**
4320 29 May 08 nicklas 29   Represents different types of event. Some event types has been defined
4320 29 May 08 nicklas 30   as static members of this class. External applications can create
4320 29 May 08 nicklas 31   their own event types and send to registered extensions by
4320 29 May 08 nicklas 32   calling {@link Registry#handleEvent(EventType, ExtensionPoint, Extension)}.
4320 29 May 08 nicklas 33
4320 29 May 08 nicklas 34   @author nicklas
4320 29 May 08 nicklas 35   @version 2.8
4320 29 May 08 nicklas 36   @base.modified $Date$
4320 29 May 08 nicklas 37 */
4320 29 May 08 nicklas 38 public class EventType
4320 29 May 08 nicklas 39 {
4320 29 May 08 nicklas 40
4320 29 May 08 nicklas 41   /**
4320 29 May 08 nicklas 42     This event is sent after an extension or extension point has been
4320 29 May 08 nicklas 43     registered with a registry.
4320 29 May 08 nicklas 44   */
4320 29 May 08 nicklas 45   public static final EventType AFTER_REGISTRATION = new EventType("After registration");
4320 29 May 08 nicklas 46   
4320 29 May 08 nicklas 47   /**
4320 29 May 08 nicklas 48     This event is sent during an update of an existing extension point or
4320 29 May 08 nicklas 49     extension. The arguments to the {@link EventHandler#handleEvent(EventType, ExtensionPoint, Extension)}
4320 29 May 08 nicklas 50     method is the currently registered extension point and extension. This
4320 29 May 08 nicklas 51     event will be followed by {@link #AFTER_UPDATE}.
4320 29 May 08 nicklas 52   */
4320 29 May 08 nicklas 53   public static final EventType BEFORE_UPDATE = new EventType("Before update");
4320 29 May 08 nicklas 54   
4320 29 May 08 nicklas 55   /**
4320 29 May 08 nicklas 56     This event is sent during an update of an existing extension point or
4320 29 May 08 nicklas 57     extension. The arguments to the {@link EventHandler#handleEvent(EventType, ExtensionPoint, Extension)}
4320 29 May 08 nicklas 58     method is the new extension point and extension. This event is preceeded by
4320 29 May 08 nicklas 59     {@link #BEFORE_UPDATE}.
4320 29 May 08 nicklas 60   */
4320 29 May 08 nicklas 61   public static final EventType AFTER_UPDATE = new EventType("After update");
4320 29 May 08 nicklas 62   
4320 29 May 08 nicklas 63   /**
4320 29 May 08 nicklas 64     This event is sent before an extension point or extension is
4320 29 May 08 nicklas 65     unregistered.
4320 29 May 08 nicklas 66   */
4320 29 May 08 nicklas 67   public static final EventType BEFORE_UNREGISTRATION = new EventType("Before unregistration");
4320 29 May 08 nicklas 68   
4320 29 May 08 nicklas 69   private final String name;
4320 29 May 08 nicklas 70   
4320 29 May 08 nicklas 71   /**
4320 29 May 08 nicklas 72     Create a new event type.
4320 29 May 08 nicklas 73     @param name A display name to use in the {@link #toString()} method
4320 29 May 08 nicklas 74   */
4320 29 May 08 nicklas 75   public EventType(String name)
4320 29 May 08 nicklas 76   {
4320 29 May 08 nicklas 77     this.name = name;
4320 29 May 08 nicklas 78   }
4320 29 May 08 nicklas 79   
4320 29 May 08 nicklas 80   @Override
4320 29 May 08 nicklas 81   public String toString()
4320 29 May 08 nicklas 82   {
4320 29 May 08 nicklas 83     return name;
4320 29 May 08 nicklas 84   }
4320 29 May 08 nicklas 85   
4320 29 May 08 nicklas 86 }