public abstract class AbstractResource extends AbstractFeatureBearer implements Resource
Modifier and Type | Field and Description |
---|---|
protected String |
name |
features
Constructor and Description |
---|
AbstractResource() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkParameterValues(Resource resource,
List<List<Parameter>> parameters)
Checks whether the provided
Resource has values for all the
required parameters from the provided list of parameters. |
void |
cleanup()
releases the memory allocated to this resource
|
static void |
flushBeanInfoCache() |
static boolean |
forgetBeanInfo(Class<? extends Resource> c) |
static BeanInfo |
getBeanInfo(Class<? extends Resource> c) |
FeatureMap |
getInitParameterValues()
Get the current values for all this resource's registered
init-time parameters.
|
static FeatureMap |
getInitParameterValues(Resource res)
Get the current values for all of a specified resource's
registered init-time parameters.
|
String |
getName()
Returns the name of this resource
|
static Object |
getParameterValue(Resource resource,
String paramaterName)
Gets the value of a parameter for a resource.
|
Object |
getParameterValue(String paramaterName)
Gets the value of a parameter of this resource.
|
static FeatureMap |
getParameterValues(Resource res,
List<List<Parameter>> params)
Get the current values of the given parameters from the given
resource.
|
Resource |
init()
Initialise this resource, and return it.
|
static void |
removeResourceListeners(Resource resource,
Map<String,? extends Object> listeners)
Removes listeners from a resource.
|
void |
setName(String name)
Sets the name of this resource
|
static void |
setParameterValue(Resource resource,
BeanInfo resBeanInf,
String paramaterName,
Object parameterValue)
Sets the value for a specified parameter for a resource.
|
void |
setParameterValue(String paramaterName,
Object parameterValue)
Sets the value for a specified parameter for this resource.
|
void |
setParameterValues(FeatureMap parameters)
Sets the values for more parameters for this resource in one step.
|
static void |
setParameterValues(Resource resource,
FeatureMap parameters)
Sets the values for more parameters for a resource in one step.
|
static void |
setResourceListeners(Resource resource,
Map<String,? extends Object> listeners)
Adds listeners to a resource.
|
String |
toString() |
getFeatures, setFeatures
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getFeatures, setFeatures
protected String name
public Resource init() throws ResourceInstantiationException
init
in interface Resource
ResourceInstantiationException
public void setName(String name)
setName
in interface NameBearer
public String getName()
getName
in interface NameBearer
public void cleanup()
public static Object getParameterValue(Resource resource, String paramaterName) throws ResourceInstantiationException
resource
- the resource from which the parameter value will be
obtainedparamaterName
- the name of the parameterResourceInstantiationException
public static void setParameterValue(Resource resource, BeanInfo resBeanInf, String paramaterName, Object parameterValue) throws ResourceInstantiationException
resource
- the resource for which the parameter value will be setparamaterName
- the name for the parameterparameterValue
- the value the parameter will receiveResourceInstantiationException
public static void setParameterValues(Resource resource, FeatureMap parameters) throws ResourceInstantiationException
parameters
- a feature map that has parameter names as keys and
parameter values as values.ResourceInstantiationException
public static void setResourceListeners(Resource resource, Map<String,? extends Object> listeners) throws IntrospectionException, InvocationTargetException, IllegalAccessException, GateException
listeners
- The listeners to be registered with the resource. A
Map
that maps from fully qualified class name (as a
string) to listener (of the type declared by the key).resource
- the resource that listeners will be registered to.IntrospectionException
InvocationTargetException
IllegalAccessException
GateException
public static void removeResourceListeners(Resource resource, Map<String,? extends Object> listeners) throws IntrospectionException, InvocationTargetException, IllegalAccessException, GateException
listeners
- The listeners to be removed from the resource. A
Map
that maps from fully qualified class name
(as a string) to listener (of the type declared by the key).resource
- the resource that listeners will be removed from.IntrospectionException
InvocationTargetException
IllegalAccessException
GateException
public static boolean checkParameterValues(Resource resource, List<List<Parameter>> parameters) throws ResourceInstantiationException
Resource
has values for all the
required parameters from the provided list of parameters.resource
- the resource being checkedparameters
- is a List
of List
of Parameter
representing a list of parameter disjunctions (e.g. the one returned by
ParameterList.getRuntimeParameters()
).ResourceInstantiationException
- if problems occur while
inspecting the parameters for the resource. These will normally be
introspection problems and are usually caused by the lack of a parameter
or of the read accessor for a parameter.public Object getParameterValue(String paramaterName) throws ResourceInstantiationException
getParameterValue
in interface Resource
paramaterName
- the name of the parameterResourceInstantiationException
public void setParameterValue(String paramaterName, Object parameterValue) throws ResourceInstantiationException
setParameterValue
in interface Resource
paramaterName
- the name for the parameterparameterValue
- the value the parameter will receiveResourceInstantiationException
public void setParameterValues(FeatureMap parameters) throws ResourceInstantiationException
setParameterValues
in interface Resource
parameters
- a feature map that has paramete names as keys and
parameter values as values.ResourceInstantiationException
public static FeatureMap getParameterValues(Resource res, List<List<Parameter>> params) throws ResourceInstantiationException
res
- the resourceparams
- a list of parameter disjunctions such as would
be returned by ParameterList.getInitimeParameters()
or similar.ResourceInstantiationException
public static FeatureMap getInitParameterValues(Resource res) throws ResourceInstantiationException
ResourceInstantiationException
public FeatureMap getInitParameterValues() throws ResourceInstantiationException
ResourceInstantiationException
public static BeanInfo getBeanInfo(Class<? extends Resource> c) throws IntrospectionException
IntrospectionException
public static void flushBeanInfoCache()
Copyright © 2024 GATE. All rights reserved.