String[] rules = values;
value2factoryClass = new Object2ObjectLinkedOpenHashMap<String,Class<? extends DocumentFactory>>();
int i, m = rules.length;
for ( i = 0; i < m; i++ ) {
int pos = rules[ i ].indexOf( ':' );
if ( pos <= 0 || pos == rules[ i ].length() - 1 ) throw new ConfigurationException( "Rule " + rules[ i ] + " does not contain a colon or it is malformed" );
if ( rules[ i ].indexOf( ':', pos + 1 ) >= 0 ) throw new ConfigurationException( "Rule " + rules[ i ] + " contains too many colons" );
String factoryName = rules[ i ].substring( pos + 1 );
Class<? extends DocumentFactory> factoryClass = null;
try {
factoryClass = (Class<? extends DocumentFactory>)Class.forName( factoryName );
if ( ! ( DocumentFactory.class.isAssignableFrom( factoryClass ) ) ) throw new ClassNotFoundException();
} catch ( ClassNotFoundException e ) {
throw new ConfigurationException( "ParsingFactory " + factoryName + " is invalid; maybe the package name is missing" );
}
value2factoryClass.put( rules[ i ].substring( 0, pos ), factoryClass );
}
m = value2factoryClass.values().size();
return true;
}
else if ( sameKey( MetadataKeys.MAP, key ) ) {
String[] pieces = values;
int i, m = pieces.length;
rename = new int[ m ][];
for ( i = 0; i < m; i++ ) {
String[] subpieces = pieces[ i ].split( ":" );
if ( i > 0 && subpieces.length != rename[ 0 ].length ) throw new ConfigurationException( "Length mismatch in the map " + values );
rename[ i ] = new int[ subpieces.length ];
for ( int k = 0; k < subpieces.length; k++ ) {
try {
rename[ i ][ k ] = Integer.parseInt( subpieces[ k ] );
} catch ( NumberFormatException e ) {
throw new ConfigurationException( "Number format exception in the map " + values );
}
}
}
}
return super.parseProperty( key, values, metadata );