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