Revision: 17399
http://sourceforge.net/p/gate/code/17399
Author: markagreenwood
Date: 2014-02-22 12:22:02 +0000 (Sat, 22 Feb 2014)
Log Message:
-----------
removed the old add/register methods from the CreoleRegister and fixed up all
the plugin tests that were using the deprecated methods
Modified Paths:
--------------
gate/trunk/plugins/Annotation_Merging/src/gate/merger/test/TestAnnotationMergingPlugin.java
gate/trunk/plugins/Copy_Annots_Between_Docs/src/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
gate/trunk/plugins/Inter_Annotator_Agreement/src/gate/iaaplugin/test/TestIaaPlugin.java
gate/trunk/plugins/Lang_Chinese/src/gate/chineseSeg/TestChineseSegMain.java
gate/trunk/plugins/Learning/src/gate/learning/test/TestLearningAPI.java
gate/trunk/plugins/Ontology_BDM_Computation/src/gate/bdmComp/TestBDMCompPlugin.java
gate/trunk/src/main/gate/CreoleRegister.java
gate/trunk/src/main/gate/Gate.java
gate/trunk/src/main/gate/config/ConfigXmlHandler.java
gate/trunk/src/main/gate/creole/CreoleRegisterImpl.java
gate/trunk/src/test/gate/creole/TestCreole.java
Modified:
gate/trunk/plugins/Annotation_Merging/src/gate/merger/test/TestAnnotationMergingPlugin.java
===================================================================
---
gate/trunk/plugins/Annotation_Merging/src/gate/merger/test/TestAnnotationMergingPlugin.java
2014-02-22 11:46:34 UTC (rev 17398)
+++
gate/trunk/plugins/Annotation_Merging/src/gate/merger/test/TestAnnotationMergingPlugin.java
2014-02-22 12:22:02 UTC (rev 17399)
@@ -44,7 +44,7 @@
Gate.init();
learningHome = new File(new File(Gate.getGateHome(), "plugins"),
"Annotation_Merging");
- Gate.getCreoleRegister().addDirectory(learningHome.toURI().toURL());
+
Gate.getCreoleRegister().registerDirectories(learningHome.toURI().toURL());
initialized = true;
}
}
Modified:
gate/trunk/plugins/Copy_Annots_Between_Docs/src/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
===================================================================
---
gate/trunk/plugins/Copy_Annots_Between_Docs/src/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
2014-02-22 11:46:34 UTC (rev 17398)
+++
gate/trunk/plugins/Copy_Annots_Between_Docs/src/gate/copyAS2AnoDoc/TestCopyAS2AnoDocPlugin.java
2014-02-22 12:22:02 UTC (rev 17399)
@@ -7,14 +7,12 @@
*/
package gate.copyAS2AnoDoc;
-import gate.Annotation;
import gate.AnnotationSet;
import gate.Corpus;
import gate.Document;
import gate.Factory;
import gate.Gate;
import gate.GateConstants;
-
import gate.util.ExtensionFileFilter;
import gate.util.GateException;
@@ -22,7 +20,6 @@
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.Comparator;
-import java.util.HashSet;
import java.util.Vector;
import junit.framework.TestCase;
@@ -45,7 +42,7 @@
Gate.init();
learningHome = new File(new File(Gate.getGateHome(), "plugins"),
"Copy_Annots_Between_Docs");
- Gate.getCreoleRegister().addDirectory(learningHome.toURI().toURL());
+
Gate.getCreoleRegister().registerDirectories(learningHome.toURI().toURL());
initialized = true;
}
}
Modified:
gate/trunk/plugins/Inter_Annotator_Agreement/src/gate/iaaplugin/test/TestIaaPlugin.java
===================================================================
---
gate/trunk/plugins/Inter_Annotator_Agreement/src/gate/iaaplugin/test/TestIaaPlugin.java
2014-02-22 11:46:34 UTC (rev 17398)
+++
gate/trunk/plugins/Inter_Annotator_Agreement/src/gate/iaaplugin/test/TestIaaPlugin.java
2014-02-22 12:22:02 UTC (rev 17399)
@@ -8,24 +8,23 @@
package gate.iaaplugin.test;
-import java.io.File;
-import java.net.MalformedURLException;
-import java.util.Arrays;
-import java.util.Comparator;
-
import gate.Corpus;
-import gate.Document;
import gate.Factory;
import gate.FeatureMap;
import gate.Gate;
import gate.GateConstants;
+import gate.iaaplugin.IaaMain;
+import gate.iaaplugin.MeasureType;
import gate.util.ExtensionFileFilter;
import gate.util.GateException;
+
+import java.io.File;
+import java.net.MalformedURLException;
+
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import gate.iaaplugin.IaaMain;
-import gate.iaaplugin.MeasureType;
+
/**
* Test the IAA computation by using the test
* methods and small dataset.
@@ -44,7 +43,7 @@
Gate.init();
iaaPluginHome = new File(new File(Gate.getGateHome(), "plugins"),
"Inter_Annotator_Agreement");
- Gate.getCreoleRegister().addDirectory(iaaPluginHome.toURI().toURL());
+
Gate.getCreoleRegister().registerDirectories(iaaPluginHome.toURI().toURL());
initialized = true;
}
}
Modified:
gate/trunk/plugins/Lang_Chinese/src/gate/chineseSeg/TestChineseSegMain.java
===================================================================
--- gate/trunk/plugins/Lang_Chinese/src/gate/chineseSeg/TestChineseSegMain.java
2014-02-22 11:46:34 UTC (rev 17398)
+++ gate/trunk/plugins/Lang_Chinese/src/gate/chineseSeg/TestChineseSegMain.java
2014-02-22 12:22:02 UTC (rev 17399)
@@ -8,28 +8,17 @@
package gate.chineseSeg;
-import gate.Corpus;
-import gate.Document;
import gate.Factory;
import gate.FeatureMap;
import gate.Gate;
import gate.GateConstants;
import gate.util.BomStrippingInputStreamReader;
-import gate.util.ExtensionFileFilter;
import gate.util.GateException;
import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Map;
import junit.framework.Test;
import junit.framework.TestCase;
@@ -50,7 +39,7 @@
bdmPluginHome = new File(new File(Gate.getGateHome(), "plugins"),
"Lang_Chinese");
- Gate.getCreoleRegister().addDirectory(bdmPluginHome.toURI().toURL());
+
Gate.getCreoleRegister().registerDirectories(bdmPluginHome.toURI().toURL());
initialized = true;
}
}
Modified:
gate/trunk/plugins/Learning/src/gate/learning/test/TestLearningAPI.java
===================================================================
--- gate/trunk/plugins/Learning/src/gate/learning/test/TestLearningAPI.java
2014-02-22 11:46:34 UTC (rev 17398)
+++ gate/trunk/plugins/Learning/src/gate/learning/test/TestLearningAPI.java
2014-02-22 12:22:02 UTC (rev 17399)
@@ -45,7 +45,7 @@
Gate.init();
learningHome = new File(new File(Gate.getGateHome(), "plugins"),
"Learning");
- Gate.getCreoleRegister().addDirectory(learningHome.toURI().toURL());
+
Gate.getCreoleRegister().registerDirectories(learningHome.toURI().toURL());
initialized = true;
}
}
Modified:
gate/trunk/plugins/Ontology_BDM_Computation/src/gate/bdmComp/TestBDMCompPlugin.java
===================================================================
---
gate/trunk/plugins/Ontology_BDM_Computation/src/gate/bdmComp/TestBDMCompPlugin.java
2014-02-22 11:46:34 UTC (rev 17398)
+++
gate/trunk/plugins/Ontology_BDM_Computation/src/gate/bdmComp/TestBDMCompPlugin.java
2014-02-22 12:22:02 UTC (rev 17399)
@@ -28,10 +28,10 @@
if(!initialized) {
Gate.init();
File owlimPluginHome = new File(new File(Gate.getGateHome(), "plugins"),
"Ontology");
- Gate.getCreoleRegister().addDirectory(owlimPluginHome.toURI().toURL());
+
Gate.getCreoleRegister().registerDirectories(owlimPluginHome.toURI().toURL());
bdmPluginHome = new File(new File(Gate.getGateHome(), "plugins"),
"Ontology_BDM_Computation");
- Gate.getCreoleRegister().addDirectory(bdmPluginHome.toURI().toURL());
+
Gate.getCreoleRegister().registerDirectories(bdmPluginHome.toURI().toURL());
initialized = true;
}
}
Modified: gate/trunk/src/main/gate/CreoleRegister.java
===================================================================
--- gate/trunk/src/main/gate/CreoleRegister.java 2014-02-22 11:46:34 UTC
(rev 17398)
+++ gate/trunk/src/main/gate/CreoleRegister.java 2014-02-22 12:22:02 UTC
(rev 17399)
@@ -67,19 +67,9 @@
*/
public interface CreoleRegister extends Map<String, ResourceData>,
Serializable, CreoleListener
{
- /** Add a CREOLE directory URL. The directory is <B>not</B> registered. */
- public void addDirectory(URL directoryUrl);
-
/** Get the list of CREOLE directory URLs. */
- public Set getDirectories();
+ public Set<URL> getDirectories();
- /** Register all the CREOLE directories that we know of.
- * The <CODE>creole.xml</CODE> files
- * at the URLs are parsed, and <CODE>CreoleData</CODE> objects added
- * to the register.
- */
- public void registerDirectories() throws GateException;
-
/**
* Given the class object for a class with {@link CreoleResource}
* annotations, register that class is if it was found in a scanned jar
Modified: gate/trunk/src/main/gate/Gate.java
===================================================================
--- gate/trunk/src/main/gate/Gate.java 2014-02-22 11:46:34 UTC (rev 17398)
+++ gate/trunk/src/main/gate/Gate.java 2014-02-22 12:22:02 UTC (rev 17399)
@@ -474,7 +474,7 @@
// register the builtin CREOLE directories
for(int i = 0; i < builtinCreoleDirectoryUrls.length; i++)
try {
- creoleRegister.addDirectory(new URL(builtinCreoleDirectoryUrls[i]));
+ creoleRegister.registerDirectories(new
URL(builtinCreoleDirectoryUrls[i]));
}
catch(MalformedURLException e) {
throw new GateException(e);
Modified: gate/trunk/src/main/gate/config/ConfigXmlHandler.java
===================================================================
--- gate/trunk/src/main/gate/config/ConfigXmlHandler.java 2014-02-22
11:46:34 UTC (rev 17398)
+++ gate/trunk/src/main/gate/config/ConfigXmlHandler.java 2014-02-22
12:22:02 UTC (rev 17399)
@@ -177,9 +177,11 @@
} else if(elementName.toUpperCase().equals("CREOLE-DIRECTORY")) {
String dirUrlName = (String) contentStack.pop();
try {
- register.addDirectory(new URL(dirUrlName));
+ register.registerDirectories(new URL(dirUrlName));
} catch(MalformedURLException e) {
throw new GateSaxException("bad URL " + dirUrlName + e);
+ } catch(GateException e) {
+ throw new GateSaxException("unable to register directory",e);
}
//////////////////////////////////////////////////////////////////
Modified: gate/trunk/src/main/gate/creole/CreoleRegisterImpl.java
===================================================================
--- gate/trunk/src/main/gate/creole/CreoleRegisterImpl.java 2014-02-22
11:46:34 UTC (rev 17398)
+++ gate/trunk/src/main/gate/creole/CreoleRegisterImpl.java 2014-02-22
12:22:02 UTC (rev 17399)
@@ -77,6 +77,7 @@
*
* @see gate.CreoleRegister
*/
+@SuppressWarnings("serial")
public class CreoleRegisterImpl extends HashMap<String, ResourceData>
implements
CreoleRegister,
@@ -146,6 +147,7 @@
URL pluginMappingsFileURL =
new URL(creoleDirURL, PLUGIN_NAMES_MAPPING_FILE);
Document document = builder.build(pluginMappingsFileURL);
+ @SuppressWarnings("unchecked")
List<Element> plugins = document.getRootElement().getChildren("Plugin");
if(plugins != null) {
for(Element aPlugin : plugins) {
@@ -164,45 +166,11 @@
}
}
- /**
- * Add a CREOLE directory URL to the register and to the GATE classloader.
The
- * directory will be automatically registered. This method is equivalent with
- * #registerDirectories(URL) which it actually calls and it's only kept here
- * for backwards compatibility reasons.
- *
- * @deprecated
- */
- public void addDirectory(URL directoryUrl) {
- try {
- registerDirectories(directoryUrl);
- }
- catch(GateException ge) {
- throw new GateRuntimeException(ge);
- }
- } // addDirectory
-
/** Get the list of CREOLE directory URLs. */
public Set<URL> getDirectories() {
return Collections.unmodifiableSet(directories);
} // getDirectories
- /**
- * All CREOLE directories are now automatically registered when they are
added
- * so this method does nothing now. It is only kept here for backwards
- * compatibility reasons.
- *
- * @deprecated
- */
- public void registerDirectories() throws GateException {
- // Iterator iter = directories.iterator();
- //
- // while(iter.hasNext()) {
- // URL directoryUrl = (URL) iter.next();
- // registerDirectories(directoryUrl);
- // }
- } // registerDirectories
-
-
public void registerComponent(Class<? extends Resource> resourceClass)
throws GateException {
URL creoleFileUrl =
resourceClass.getResource("/gate/creole/CreoleRegisterImpl.class");
Gate.addKnownPlugin(creoleFileUrl);
Modified: gate/trunk/src/test/gate/creole/TestCreole.java
===================================================================
--- gate/trunk/src/test/gate/creole/TestCreole.java 2014-02-22 11:46:34 UTC
(rev 17398)
+++ gate/trunk/src/test/gate/creole/TestCreole.java 2014-02-22 12:22:02 UTC
(rev 17399)
@@ -52,9 +52,7 @@
// find a URL for finding test files and add to the directory set
URL testUrl = new URL(TestDocument.getTestServerName()+"tests/");
-// reg.registerDirectories(testUrl);
- reg.addDirectory(testUrl);
- reg.registerDirectories();
+ reg.registerDirectories(testUrl);
if(DEBUG) {
Iterator iter = reg.values().iterator();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs