@@ -1192,49 +1192,49 @@ private void configureIndexer(final Document doc, final Element indexer) throws
1192
1192
setProperty (IndexManager .PROPERTY_INDEXER_MODULES , modConfig );
1193
1193
}
1194
1194
1195
- private void configureGrammarCache (final NodeList grammarPoolNl ) {
1196
- if (grammarPoolNl .getLength () == 0 ) {
1197
- setProperty (GrammarPool .GRAMMAR_POOL , new GrammarPool ());
1198
- } else {
1199
- final Element grammarPoolElem = (Element ) grammarPoolNl .item (0 );
1200
- configureProperty (grammarPoolElem , GrammarPool .ATTRIBUTE_MAXIMUM_SIZE , GrammarPool .PROPERTY_MAXIMUM_SIZE , Configuration ::asInteger , null );
1201
- configureProperty (grammarPoolElem , GrammarPool .ATTRIBUTE_EXPIRE_AFTER_ACCESS , GrammarPool .PROPERTY_EXPIRE_AFTER_ACCESS , Configuration ::asInteger , null );
1202
- setProperty (GrammarPool .GRAMMAR_POOL , new GrammarPool (getInteger (GrammarPool .PROPERTY_MAXIMUM_SIZE ), getInteger (GrammarPool .PROPERTY_EXPIRE_AFTER_ACCESS )));
1203
- }
1204
- }
1205
-
1206
1195
private void configureValidation (final Optional <Path > dbHome , final Element validation ) {
1207
1196
// Determine validation mode
1208
1197
configureProperty (validation , XMLReaderObjectFactory .VALIDATION_MODE_ATTRIBUTE , PROPERTY_VALIDATION_MODE );
1209
1198
1210
1199
// Configure the Entity Resolver
1211
- final NodeList entityResolver = validation .getElementsByTagName (XMLReaderObjectFactory .CONFIGURATION_ENTITY_RESOLVER_ELEMENT_NAME );
1212
- if (entityResolver .getLength () != 0 ) {
1213
- final Element elemEntityResolver = (Element ) entityResolver .item (0 );
1214
- setupEntityResolver (dbHome , elemEntityResolver );
1200
+ final NodeList entityResolverElements = validation .getElementsByTagName (XMLReaderObjectFactory .CONFIGURATION_ENTITY_RESOLVER_ELEMENT_NAME );
1201
+ if (entityResolverElements .getLength () != 0 ) {
1202
+ final Element elemEntityResolver = (Element ) entityResolverElements .item (0 );
1203
+ configureEntityResolver (dbHome , elemEntityResolver );
1215
1204
}
1216
1205
1217
1206
// Configure the grammar pool
1218
- final NodeList grammarPoolNl = validation .getElementsByTagName (GrammarPool .GRAMMAR_POOL );
1219
- configureGrammarCache (grammarPoolNl );
1207
+ final NodeList grammarPoolElements = validation .getElementsByTagName (GrammarPool .GRAMMAR_POOL_ELEMENT );
1208
+ configureGrammarCache (grammarPoolElements );
1220
1209
1221
1210
}
1222
1211
1223
- private void setupEntityResolver (final Optional <Path > dbHome , final Element elemEntityResolver ) {
1224
- LOG .info ("Creating xmlresolver.org OASIS Catalog resolver" );
1212
+ private void configureGrammarCache (final NodeList grammarCacheElements ) {
1213
+ if (grammarCacheElements .getLength () == 0 ) {
1214
+ setProperty (GrammarPool .GRAMMAR_POOL_ELEMENT , new GrammarPool ());
1215
+
1216
+ } else {
1217
+ final Element grammarPoolElem = (Element ) grammarCacheElements .item (0 );
1218
+ configureProperty (grammarPoolElem , GrammarPool .ATTRIBUTE_MAXIMUM_SIZE ,
1219
+ GrammarPool .PROPERTY_MAXIMUM_SIZE , Configuration ::asInteger , null );
1220
+ configureProperty (grammarPoolElem , GrammarPool .ATTRIBUTE_EXPIRE_AFTER_ACCESS ,
1221
+ GrammarPool .PROPERTY_EXPIRE_AFTER_ACCESS , Configuration ::asInteger , null );
1222
+ setProperty (GrammarPool .GRAMMAR_POOL_ELEMENT ,
1223
+ new GrammarPool (getInteger (GrammarPool .PROPERTY_MAXIMUM_SIZE ), getInteger (GrammarPool .PROPERTY_EXPIRE_AFTER_ACCESS )));
1224
+ }
1225
+ }
1225
1226
1226
- final NodeList nlCatalogs = elemEntityResolver .getElementsByTagName (XMLReaderObjectFactory .CONFIGURATION_CATALOG_ELEMENT_NAME );
1227
+ private void configureEntityResolver (final Optional <Path > dbHome , final Element entityResolverElement ) {
1228
+ LOG .info ("Creating xmlresolver.org OASIS Catalog resolver" );
1227
1229
1228
- final Path webappHome = getWebappHome (dbHome , nlCatalogs );
1230
+ final NodeList catalogElements = entityResolverElement
1231
+ .getElementsByTagName (XMLReaderObjectFactory .CONFIGURATION_CATALOG_ELEMENT_NAME );
1232
+ final Path webappHome = getWebappHome (dbHome , catalogElements );
1229
1233
1230
1234
// Store all configured URIs
1231
- final List <String > catalogUris = getCatalogUris (dbHome , nlCatalogs , webappHome );
1235
+ final List <String > catalogUris = getCatalogUris (dbHome , catalogElements , webappHome );
1232
1236
setProperty (XMLReaderObjectFactory .CATALOG_URIS , catalogUris );
1233
1237
1234
- setupResolver (catalogUris );
1235
- }
1236
-
1237
- private void setupResolver (final List <String > catalogUris ) {
1238
1238
// Create and Store the resolver
1239
1239
try {
1240
1240
final List <Tuple2 <String , Optional <InputSource >>> catalogs = catalogUris .stream ()
@@ -1252,7 +1252,7 @@ private void setupResolver(final List<String> catalogUris) {
1252
1252
be used at this phase. Trick is to check whether dbHOME is
1253
1253
pointing to a WEB-INF directory, meaning inside the war file.
1254
1254
*/
1255
- private static Path getWebappHome (Optional <Path > dbHome , NodeList nlCatalogs ) {
1255
+ private static Path getWebappHome (final Optional <Path > dbHome , final NodeList catalogElements ) {
1256
1256
1257
1257
final Path webappHome = dbHome .map (h -> {
1258
1258
if (FileUtils .fileName (h ).endsWith ("WEB-INF" )) {
@@ -1262,18 +1262,18 @@ private static Path getWebappHome(Optional<Path> dbHome, NodeList nlCatalogs) {
1262
1262
}).orElse (Paths .get ("webapp" ).toAbsolutePath ());
1263
1263
1264
1264
if (LOG .isDebugEnabled ()) {
1265
- LOG .debug ("Found {} catalog uri entries." , nlCatalogs .getLength ());
1265
+ LOG .debug ("Found {} catalog uri entries." , catalogElements .getLength ());
1266
1266
LOG .debug ("Using dbHome={}" , dbHome );
1267
1267
LOG .debug ("using webappHome={}" , webappHome );
1268
1268
}
1269
1269
return webappHome ;
1270
1270
}
1271
1271
1272
- private static List <String > getCatalogUris (Optional <Path > dbHome , NodeList nlCatalogs , Path webappHome ) {
1272
+ private static List <String > getCatalogUris (final Optional <Path > dbHome , final NodeList catalogElements , final Path webappHome ) {
1273
1273
// Get the Catalog URIs
1274
1274
final List <String > catalogUris = new ArrayList <>();
1275
- for (int i = 0 ; i < nlCatalogs .getLength (); i ++) {
1276
- final String uriAttributeValue = ((Element ) nlCatalogs .item (i )).getAttribute ("uri" );
1275
+ for (int i = 0 ; i < catalogElements .getLength (); i ++) {
1276
+ final String uriAttributeValue = ((Element ) catalogElements .item (i )).getAttribute ("uri" );
1277
1277
1278
1278
if (!uriAttributeValue .isEmpty ()) {
1279
1279
final String uri ;
0 commit comments