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 08/03/2001
10   *
11   *  $Id: CreoleEvent.java,v 1.4 2001/09/21 12:21:54 valyt Exp $
12   */
13  
14  package gate.event;
15  
16  import gate.*;
17  import gate.util.*;
18  
19  /**
20   * Events related to the {@link gate.creole} package. This kind of events will
21   * be fired when resources are loaded or unloaded in the Gate system.
22   */
23  public class CreoleEvent extends GateEvent {
24  
25    /**
26     * Constructor
27     * @param res the {@link gate.Resource} that has been (un)loaded
28     * @param type the type of the event
29     */
30    public CreoleEvent(Resource res, int type){
31      //the source will always be the Creole register
32      super(Gate.getCreoleRegister(), type);
33      this.resource = res;
34      datastore = null;
35    }
36  
37    /**
38     * Constructor
39     * @param datastore the {@link gate.DataStore} that has been
40     * created/loaded/closed.
41     * @param type the type of the event
42     */
43    public CreoleEvent(DataStore datastore, int type){
44      //the source will always be the Creole register
45      super(Gate.getCreoleRegister(), type);
46      this.resource = null;
47      this.datastore = datastore;
48    }
49  
50    /**
51     * Gets the resource that has been (un)loaded.
52     */
53    public gate.Resource getResource() {
54      return resource;
55    }
56  
57    /**
58     * Gets the {@link gate.DataStore} that has been created/loaded/closed.
59     */
60    public DataStore getDatastore(){
61      return datastore;
62    }
63  
64    /**Event type that marks the loading of a new resource into the Gate system*/
65    public static final int RESOURCE_LOADED = 1;
66  
67    /**Event type that marks the unloading of a resource from the Gate system*/
68    public static final int RESOURCE_UNLOADED = 2;
69  
70    /**Event type that marks the creation of a new datastore*/
71    public static final int DATASTORE_CREATED = 3;
72  
73    /**Event type that mark the opening of a datastore*/
74    public static final int DATASTORE_OPENED = 4;
75  
76    /**Event type that mark the closing of a datastore*/
77    public static final int DATASTORE_CLOSED = 5;
78  
79    private gate.Resource resource;
80    private DataStore datastore;
81  
82  }