|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractMap<K,V>
java.util.HashMap<String,ResourceData>
gate.creole.CreoleRegisterImpl
public class CreoleRegisterImpl
This class implements the CREOLE register interface. DO NOT construct objects of this class unless your name is gate.Gate (in which case please go back to the source code repository and stop looking at other class's code).
The CREOLE register records the set of resources that are currently known to
the system. Each member of the register is a ResourceData
object, indexed by the class name of the resource.
CreoleRegister,
Serialized Form| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class java.util.AbstractMap |
|---|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V> |
| Nested classes/interfaces inherited from interface java.util.Map |
|---|
Map.Entry<K,V> |
| Field Summary | |
|---|---|
protected Set<String> |
controllerTypes
A list of the types of Controller in the register. |
protected static boolean |
DEBUG
Debug flag |
protected Set<URL> |
directories
The set of CREOLE directories (URLs). |
protected org.jdom.input.SAXBuilder |
jdomBuilder
The parser for the CREOLE directory files |
protected static org.apache.log4j.Logger |
log
A logger to use instead of sending messages to Out or Err |
protected Set<String> |
lrTypes
A list of the types of LR in the register. |
static String |
PLUGIN_NAMES_MAPPING_FILE
Name of the plugin-mappings file |
protected Map<String,String> |
pluginNamesMappings
maps previous plugin names to new plugin names |
protected Set<String> |
prTypes
A list of the types of PR in the register. |
protected Set<String> |
toolTypes
A list of the types of TOOL in the register. |
protected List<String> |
vrTypes
A list of the types of VR in the register. |
| Constructor Summary | |
|---|---|
CreoleRegisterImpl()
Default constructor. |
|
| Method Summary | ||
|---|---|---|
void |
addCreoleListener(CreoleListener l)
Registers a CreoleListenerwith this CreoleRegister. |
|
void |
addDirectory(URL directoryUrl)
Deprecated. |
|
void |
clear()
Overide HashMap's clear to update the list of LR types in the register, and remove all resources and forgets all directories. |
|
File |
createCreoleDirectoryFile(File directoryFile,
Set jarFileNames)
This is a utility method for creating CREOLE directory files (typically called creole.xml) from a list of Jar files that contain
resources. |
|
void |
datastoreClosed(CreoleEvent e)
Called when a DataStore has been closed |
|
void |
datastoreCreated(CreoleEvent e)
Called when a DataStore has been created |
|
void |
datastoreOpened(CreoleEvent e)
Called when a DataStore has been opened |
|
protected void |
fireDatastoreClosed(CreoleEvent e)
|
|
protected void |
fireDatastoreCreated(CreoleEvent e)
|
|
protected void |
fireDatastoreOpened(CreoleEvent e)
|
|
protected void |
fireResourceLoaded(CreoleEvent e)
|
|
protected void |
fireResourceRenamed(Resource res,
String oldName,
String newName)
|
|
protected void |
fireResourceUnloaded(CreoleEvent e)
|
|
List<Resource> |
getAllInstances(String type)
Gets all the instantiations of a given type and all its derivate types; It doesn't return instances that have the hidden attribute set to "true" |
|
List<String> |
getAnnotationVRs()
Returns a list of strings representing class names for annotation VRs that are able to display/edit all types of annotations. |
|
List<String> |
getAnnotationVRs(String annotationType)
Returns a list of strings representing class names for annotation VRs that are able to display/edit a given annotation type The default VR will be the first in the returned list. |
|
Set<String> |
getControllerTypes()
Get the list of types of Controller in the register. |
|
Set<URL> |
getDirectories()
Get the list of CREOLE directory URLs. |
|
List<String> |
getLargeVRsForResource(String resourceClassName)
Returns a list of strings representing class names for large VRs valid for a given type of language/processing resource. |
|
List<LanguageResource> |
getLrInstances()
Get a list of all instantiations of LR in the register. |
|
List<LanguageResource> |
getLrInstances(String resourceTypeName)
Get a list of instantiations of a type of LR in the register. |
|
Set<String> |
getLrTypes()
Get the list of types of LR in the register. |
|
List<ProcessingResource> |
getPrInstances()
Get a list of all instantiations of PR in the register. |
|
List<ProcessingResource> |
getPrInstances(String resourceTypeName)
Get a list of instantiations of a type of PR in the register. |
|
Set<String> |
getPrTypes()
Get the list of types of PR in the register. |
|
List<String> |
getPublicControllerTypes()
Get a list of all non-private types of controller in the register. |
|
List<LanguageResource> |
getPublicLrInstances()
Get a list of all non-private instantiations of LR in the register. |
|
List<String> |
getPublicLrTypes()
Get a list of all non-private types of LR in the register. |
|
List<ProcessingResource> |
getPublicPrInstances()
Get a list of all non-private instantiations of PR in the register. |
|
List<String> |
getPublicPrTypes()
Get a list of all non-private types of PR in the register. |
|
protected
|
getPublics(List<T> instances)
Get a list of all non-private instantiations. |
|
protected List<String> |
getPublicTypes(Collection<String> types)
Gets a list of all non private types from alist of types |
|
List<VisualResource> |
getPublicVrInstances()
Get a list of all non-private instantiations of VR in the register. |
|
List<String> |
getPublicVrTypes()
Get a list of all non-private types of VR in the register. |
|
List<String> |
getSmallVRsForResource(String resourceClassName)
Returns a list of strings representing class names for small VRs valid for a given type of language/processing resource The default VR will be the first in the returned list. |
|
Set<String> |
getToolTypes()
Get the list of types of TOOL resources in the register. |
|
List<String> |
getVREnabledAnnotationTypes()
Returns a list of strings representing annotations types for which there are custom viewers/editor registered. |
|
List<VisualResource> |
getVrInstances()
Get a list of all instantiations of VR in the register. |
|
List<VisualResource> |
getVrInstances(String resourceTypeName)
Get a list of instantiations of a type of VR in the register. |
|
Set<String> |
getVrTypes()
Get the list of types of VR in the register. |
|
protected void |
parseDirectory(InputStream directoryStream,
URL directoryUrl,
URL creoleFileUrl)
Parse a directory file (represented as an open stream), adding resource data objects to the CREOLE register as they occur. |
|
ResourceData |
put(String key,
ResourceData rd)
Overide HashMap's put method to maintain a list of all the types of LR in the register, and a list of tool types. |
|
void |
registerBuiltins()
Register resources that are built in to the GATE distribution. |
|
void |
registerComponent(Class<? extends Resource> resourceClass)
Given the class object for a class with CreoleResource
annotations, register that class is if it was found in a scanned jar
file with no additional creole.xml information. |
|
void |
registerDirectories()
Deprecated. |
|
void |
registerDirectories(URL directoryUrl)
Register a single CREOLE directory. |
|
ResourceData |
remove(Object key)
Overide HashMap's delete method to update the lists of types in the register. |
|
void |
removeCreoleListener(CreoleListener l)
Removes a CreoleListener previously registered with this
CreoleRegister. |
|
void |
removeDirectory(URL directory)
Removes a CREOLE directory from the set of loaded directories. |
|
void |
resourceLoaded(CreoleEvent e)
Called when a new Resource has been loaded into the system |
|
void |
resourceRenamed(Resource resource,
String oldName,
String newName)
Called when the creole register has renamed a resource.1 |
|
void |
resourceUnloaded(CreoleEvent e)
Called when a Resource has been removed from the system |
|
void |
setResourceName(Resource res,
String newName)
Renames an existing resource. |
|
| Methods inherited from class java.util.HashMap |
|---|
clone, containsKey, containsValue, entrySet, get, isEmpty, keySet, putAll, size, values |
| Methods inherited from class java.util.AbstractMap |
|---|
equals, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface java.util.Map |
|---|
containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, putAll, size, values |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
protected static final boolean DEBUG
protected Set<URL> directories
protected transient org.jdom.input.SAXBuilder jdomBuilder
public static final String PLUGIN_NAMES_MAPPING_FILE
protected Map<String,String> pluginNamesMappings
protected Set<String> lrTypes
protected Set<String> prTypes
protected List<String> vrTypes
protected Set<String> controllerTypes
protected Set<String> toolTypes
| Constructor Detail |
|---|
public CreoleRegisterImpl()
throws GateException
GateException| Method Detail |
|---|
public void addDirectory(URL directoryUrl)
addDirectory in interface CreoleRegisterpublic Set<URL> getDirectories()
getDirectories in interface CreoleRegister
public void registerDirectories()
throws GateException
registerDirectories in interface CreoleRegisterGateException
public void registerComponent(Class<? extends Resource> resourceClass)
throws GateException
CreoleRegisterCreoleResource
annotations, register that class is if it was found in a scanned jar
file with no additional creole.xml information.
This API is intended for use in embedded GATE applications where
the 'application' is created via the API. Components registered with this
API won't work in saved applications, but they can be added
to saved applications at runtime.
registerComponent in interface CreoleRegisterresourceClass - Class object for class with CreoleResource annotations.
GateException
public void registerDirectories(URL directoryUrl)
throws GateException
creole.xml file at the
URL is parsed, and CreoleData objects added to the register.
If the directory URL has not yet been added it is now added. URLs for
resource JAR files are added to the GATE class loader.
registerDirectories in interface CreoleRegisterGateException
protected void parseDirectory(InputStream directoryStream,
URL directoryUrl,
URL creoleFileUrl)
throws GateException
GateException
public void registerBuiltins()
throws GateException
registerBuiltins in interface CreoleRegisterGateException
public File createCreoleDirectoryFile(File directoryFile,
Set jarFileNames)
creole.xml) from a list of Jar files that contain
resources. The method concatenates the resource.xml files that
the Jars contain.
If Java allowed class methods in interfaces this would be static.
createCreoleDirectoryFile in interface CreoleRegister
public ResourceData put(String key,
ResourceData rd)
put in interface Map<String,ResourceData>put in class HashMap<String,ResourceData>public void removeDirectory(URL directory)
removeDirectory in interface CreoleRegisterdirectory - public ResourceData remove(Object key)
remove in interface Map<String,ResourceData>remove in class HashMap<String,ResourceData>public void clear()
clear in interface Map<String,ResourceData>clear in class HashMap<String,ResourceData>public Set<String> getLrTypes()
getLrTypes in interface CreoleRegisterpublic Set<String> getPrTypes()
getPrTypes in interface CreoleRegisterpublic Set<String> getVrTypes()
getVrTypes in interface CreoleRegisterpublic Set<String> getControllerTypes()
getControllerTypes in interface CreoleRegisterpublic Set<String> getToolTypes()
getToolTypes in interface CreoleRegisterpublic List<LanguageResource> getLrInstances()
getLrInstances in interface CreoleRegisterpublic List<ProcessingResource> getPrInstances()
getPrInstances in interface CreoleRegisterpublic List<VisualResource> getVrInstances()
getVrInstances in interface CreoleRegisterpublic List<LanguageResource> getLrInstances(String resourceTypeName)
getLrInstances in interface CreoleRegisterpublic List<ProcessingResource> getPrInstances(String resourceTypeName)
getPrInstances in interface CreoleRegisterpublic List<VisualResource> getVrInstances(String resourceTypeName)
getVrInstances in interface CreoleRegisterpublic List<LanguageResource> getPublicLrInstances()
getPublicLrInstances in interface CreoleRegisterpublic List<ProcessingResource> getPublicPrInstances()
getPublicPrInstances in interface CreoleRegisterpublic List<VisualResource> getPublicVrInstances()
getPublicVrInstances in interface CreoleRegisterpublic List<String> getPublicLrTypes()
getPublicLrTypes in interface CreoleRegisterpublic List<String> getPublicPrTypes()
getPublicPrTypes in interface CreoleRegisterpublic List<String> getPublicVrTypes()
getPublicVrTypes in interface CreoleRegisterpublic List<String> getPublicControllerTypes()
getPublicControllerTypes in interface CreoleRegister
public List<Resource> getAllInstances(String type)
throws GateException
getAllInstances in interface CreoleRegisterGateExceptionpublic List<String> getLargeVRsForResource(String resourceClassName)
getLargeVRsForResource in interface CreoleRegisterresourceClassName - the name of the resource that has large viewers. If
resourceClassName is null then an empty list will be
returned.
public List<String> getSmallVRsForResource(String resourceClassName)
getSmallVRsForResource in interface CreoleRegisterresourceClassName - the name of the resource that has large viewers. If
resourceClassName is null then an empty list will be
returned.
public List<String> getAnnotationVRs()
getAnnotationVRs in interface CreoleRegisterpublic List<String> getAnnotationVRs(String annotationType)
getAnnotationVRs in interface CreoleRegister
public void setResourceName(Resource res,
String newName)
setResourceName in interface CreoleRegisterpublic List<String> getVREnabledAnnotationTypes()
getVREnabledAnnotationTypes in interface CreoleRegisterprotected <T> List<T> getPublics(List<T> instances)
protected List<String> getPublicTypes(Collection<String> types)
public void removeCreoleListener(CreoleListener l)
CreoleRegisterCreoleListener previously registered with this
CreoleRegister.
removeCreoleListener in interface CreoleRegisterCreoleRegister.addCreoleListener(CreoleListener)public void addCreoleListener(CreoleListener l)
CreoleRegisterCreoleListenerwith this CreoleRegister.
The register will fire events every time a resource is added to or removed
from the system and when a datastore is created, opened or closed.
addCreoleListener in interface CreoleRegisterprotected void fireResourceLoaded(CreoleEvent e)
protected void fireResourceUnloaded(CreoleEvent e)
protected void fireResourceRenamed(Resource res,
String oldName,
String newName)
protected void fireDatastoreOpened(CreoleEvent e)
protected void fireDatastoreCreated(CreoleEvent e)
protected void fireDatastoreClosed(CreoleEvent e)
public void resourceLoaded(CreoleEvent e)
CreoleListenerResource has been loaded into the system
resourceLoaded in interface CreoleListenerpublic void resourceUnloaded(CreoleEvent e)
CreoleListenerResource has been removed from the system
resourceUnloaded in interface CreoleListener
public void resourceRenamed(Resource resource,
String oldName,
String newName)
CreoleListener
resourceRenamed in interface CreoleListenerpublic void datastoreOpened(CreoleEvent e)
CreoleListenerDataStore has been opened
datastoreOpened in interface CreoleListenerpublic void datastoreCreated(CreoleEvent e)
CreoleListenerDataStore has been created
datastoreCreated in interface CreoleListenerpublic void datastoreClosed(CreoleEvent e)
CreoleListenerDataStore has been closed
datastoreClosed in interface CreoleListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||