CreoleEvent.java
01 /*
02  *  Copyright (c) 1995-2010, The University of Sheffield. See the file
03  *  COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
04  *
05  *  This file is part of GATE (see http://gate.ac.uk/), and is free
06  *  software, licenced under the GNU Library General Public License,
07  *  Version 2, June 1991 (in the distribution as file licence.html,
08  *  and also available at http://gate.ac.uk/gate/licence.html).
09  *
10  *  Valentin Tablan 08/03/2001
11  *
12  *  $Id: CreoleEvent.java 12006 2009-12-01 17:24:28Z thomas_heitz $
13  */
14 
15 package gate.event;
16 
17 import gate.*;
18 
19 /**
20  * Events related to the 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 }