Search in sources :

Example 6 with ResourceInfo

use of gate.Gate.ResourceInfo in project gate-core by GateNLP.

the class CreoleAnnotationHandler method createResourceElementsForDirInfo.

/**
 * Fetches the directory information for this handler's creole plugin and adds
 * additional RESOURCE elements to the given JDOM document so that it contains
 * a RESOURCE for every resource type defined in the plugin's directory info.
 *
 * @param jdomDoc
 *          JDOM document which should be the parsed creole.xml that this
 *          handler was configured for.
 */
public void createResourceElementsForDirInfo(Document jdomDoc) throws MalformedURLException {
    Element jdomElt = jdomDoc.getRootElement();
    // URL directoryUrl = new URL(creoleFileUrl, ".");
    // DirectoryInfo dirInfo = Gate.getDirectoryInfo(directoryUrl,jdomDoc);
    // if(dirInfo != null) {
    Map<String, Element> resourceElements = new HashMap<String, Element>();
    findResourceElements(resourceElements, jdomElt);
    for (ResourceInfo resInfo : plugin.getResourceInfoList()) {
        if (!resourceElements.containsKey(resInfo.getResourceClassName())) {
            // no existing RESOURCE element for this resource type (so it
            // was
            // auto-discovered from a <JAR SCAN="true">), so add a minimal
            // RESOURCE element which will be filled in by the annotation
            // processor.
            jdomElt.addContent(new Element("RESOURCE").addContent(new Element("CLASS").setText(resInfo.getResourceClassName())));
        }
    }
// }
}
Also used : ResourceInfo(gate.Gate.ResourceInfo) HashMap(java.util.HashMap) Element(org.jdom.Element) AnnotatedElement(java.lang.reflect.AnnotatedElement)

Aggregations

ResourceInfo (gate.Gate.ResourceInfo)6 URL (java.net.URL)3 Resource (gate.Resource)2 ClassReader (gate.util.asm.ClassReader)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 JarInputStream (java.util.jar.JarInputStream)2 Element (org.jdom.Element)2 JDOMException (org.jdom.JDOMException)2 Gate (gate.Gate)1 LanguageResource (gate.LanguageResource)1 ProcessingResource (gate.ProcessingResource)1 VisualResource (gate.VisualResource)1 AbstractResource (gate.creole.AbstractResource)1 GateException (gate.util.GateException)1 GateRuntimeException (gate.util.GateRuntimeException)1 ClassVisitor (gate.util.asm.ClassVisitor)1 InputStream (java.io.InputStream)1 AnnotatedElement (java.lang.reflect.AnnotatedElement)1 URISyntaxException (java.net.URISyntaxException)1