01 /*
02 * Resource.java
03 *
04 * Copyright (c) 1995-2010, The University of Sheffield. See the file
05 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
06 *
07 * This file is part of GATE (see http://gate.ac.uk/), and is free
08 * software, licenced under the GNU Library General Public License,
09 * Version 2, June 1991 (in the distribution as file licence.html,
10 * and also available at http://gate.ac.uk/gate/licence.html).
11 *
12 * Hamish Cunningham, 11/Feb/2000
13 *
14 * $Id: Resource.java 12006 2009-12-01 17:24:28Z thomas_heitz $
15 */
16
17 package gate;
18
19 import java.io.Serializable;
20
21 import gate.creole.ResourceInstantiationException;
22 import gate.util.FeatureBearer;
23 import gate.util.NameBearer;
24
25 /** Models all sorts of resources.
26 */
27 public interface Resource extends FeatureBearer, NameBearer, Serializable
28 {
29 /** Initialise this resource, and return it. */
30 public Resource init() throws ResourceInstantiationException;
31
32 /** Clears the internal data of the resource, when it gets released **/
33 public void cleanup();
34
35
36 //Parameters utility methods
37 /**
38 * Gets the value of a parameter of this resource.
39 * @param paramaterName the name of the parameter
40 * @return the current value of the parameter
41 */
42 public Object getParameterValue(String paramaterName)
43 throws ResourceInstantiationException;
44
45 /**
46 * Sets the value for a specified parameter.
47 *
48 * @param paramaterName the name for the parameteer
49 * @param parameterValue the value the parameter will receive
50 */
51 public void setParameterValue(String paramaterName, Object parameterValue)
52 throws ResourceInstantiationException;
53
54 /**
55 * Sets the values for more parameters in one step.
56 *
57 * @param parameters a {@link FeatureMap} that has parameter names as keys and
58 * parameter values as values.
59 */
60 public void setParameterValues(FeatureMap parameters)
61 throws ResourceInstantiationException;
62
63 } // interface Resource
|