| DatastoreEvent |

    1   /*
    2    *  Copyright (c) 1998-2001, The University of Sheffield.
    3    *
    4    *  This file is part of GATE (see http://gate.ac.uk/), and is free
    5    *  software, licenced under the GNU Library General Public License,
    6    *  Version 2, June 1991 (in the distribution as file licence.html,
    7    *  and also available at http://gate.ac.uk/gate/licence.html).
    8    *
    9    *  Valentin Tablan 21/04/2001
    10   *
    11   *  $Id: DatastoreEvent.java,v 1.3 2001/10/31 17:20:10 kalina Exp $
    12   */
    13  package gate.event;
    14
    15  import gate.*;
    16  /**
    17   * This class models events fired by datastores. Such events occur when new
    18   * resources are adopted by a datastore or when an existing resource from
    19   * the datastore is deleted.
    20   */
    21  public class DatastoreEvent extends GateEvent {
    22
    23    /**
    24     * Constructor.
    25     * @param source the datastore that originated the event.
    26     * @param type the event type.
    27     * @param res the resource that has been adopted/deleted/etc.
    28     * @param resourceID the ID corresponding to the resource in this datastore
    29     */
    30    public DatastoreEvent(DataStore source, int type, Resource res,
    31                          Object resourceID) {
    32      super(source, type);
    33      this.resource = res;
    34      this.resourceID = resourceID;
    35    }
    36
    37    protected Resource resource;
    38    protected Object resourceID;
    39
    40    /**
    41     * The type of events fired when a resource has been adopted
    42     */
    43    public static final int RESOURCE_ADOPTED = 301;
    44
    45    /**
    46     * The type of events fired when a resource has been deleted from a datastore
    47     */
    48    public static final int RESOURCE_DELETED = 302;
    49
    50    /**
    51     * The type of events fired when a resource has wrote into the datastore
    52     */
    53    public static final int RESOURCE_WRITTEN = 303;
    54
    55    /** Gets the ID of the resource involved in this event */
    56    public Object getResourceID() {
    57      return resourceID;
    58    }
    59
    60    /** Gets the resource involved in this event */
    61    public gate.Resource getResource() {
    62      return resource;
    63    }
    64  }
    65

| DatastoreEvent |