Revision: 14553
http://gate.svn.sourceforge.net/gate/?rev=14553&view=rev
Author: valyt
Date: 2011-11-15 16:15:05 +0000 (Tue, 15 Nov 2011)
Log Message:
-----------
Support for format version in index config.
Modified Paths:
--------------
mimir/trunk/mimir-core/src/gate/mimir/IndexConfig.java
Modified: mimir/trunk/mimir-core/src/gate/mimir/IndexConfig.java
===================================================================
--- mimir/trunk/mimir-core/src/gate/mimir/IndexConfig.java 2011-11-15
16:13:37 UTC (rev 14552)
+++ mimir/trunk/mimir-core/src/gate/mimir/IndexConfig.java 2011-11-15
16:15:05 UTC (rev 14553)
@@ -166,6 +166,12 @@
*
*/
private static final long serialVersionUID = -8127630936829037489L;
+
+ /**
+ * The current format version for the XML files containing serialisations of
+ * IndexConfig instances.
+ */
+ private static final int FORMAT_VERSION = 4;
/**
* The default feature name for obtaining document URIs (provided as features
@@ -227,6 +233,7 @@
DocumentRenderer documentRenderer) {
this.indexDirectory = indexDirectory;
+ this.formatVersion = FORMAT_VERSION;
this.tokenAnnotationSetName = tokenAnnotationSetName;
this.tokenAnnotationType = tokenAnnotationType;
this.tokenIndexers = tokenIndexers;
@@ -411,7 +418,16 @@
inputFactory.createXMLStreamReader(configStream);
HierarchicalStreamReader xmlReader = new StaxReader(new QNameMap(), xsr);
try {
- return (IndexConfig)newXStream().unmarshal(xmlReader);
+ IndexConfig theConfig = (IndexConfig)newXStream().unmarshal(xmlReader);
+ // check the version number
+ if(theConfig.formatVersion > FORMAT_VERSION){
+ throw new UnsupportedOperationException(
+ "The version of the IndexConfig at \"" + u.toExternalForm() +
+ "\" is greater than the maximum supported version by this MÃmir " +
+ "implementation (" + theConfig.formatVersion + " > " +
FORMAT_VERSION +
+ ").");
+ }
+ return theConfig;
} finally {
xmlReader.close();
configStream.close();
@@ -475,6 +491,11 @@
private File indexDirectory;
/**
+ * The format version for this index config instance.
+ */
+ private int formatVersion;
+
+ /**
* The annotation type used for tokens.
*/
private String tokenAnnotationType;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs