/** * Destroy all schema Indexes. VERY important to that this is called to avoid memory leaks, * because schema indexes are kept alive otherwise by static schema's and in this way keep other * schema's alive */ public void disposeSchemaIndexes() { for (SchemaIndex schemaIndex : schemas) { schemaIndex.destroy(); } }
/** * Destroy all schema Indexes. VERY important to that this is called * to avoid memory leaks, because schema indexes are kept alive otherwise * by static schema's and in this way keep other schema's alive */ public void disposeSchemaIndexes(){ for (SchemaIndex schemaIndex : schemas) { schemaIndex.destroy(); } }
public static Configuration findGmlConfiguration(AppSchemaConfiguration configuration) { SchemaIndex index = null; try { index = Schemas.findSchemas(configuration); for (QName name : SUPPORTED_GML_KNOWN_TYPE_TO_CONFIGURATION_MAP.keySet()) { XSDTypeDefinition type = index.getTypeDefinition(name); if (type != null) { try { return SUPPORTED_GML_KNOWN_TYPE_TO_CONFIGURATION_MAP.get(name) .newInstance(); } catch (Exception e) { throw new RuntimeException(e); } } } throw new RuntimeException("Unsupported GML version for schema at " + configuration.getSchemaLocation()); } finally { if (index != null) { index.destroy(); } } }
/** * TODO: add connectionfactory parameter to handle authentication, gzip, etc * * @param featureTypeName * @param schemaLocation * @return */ private static XSDElementDeclaration parseFeatureType( final QName featureTypeName, final URL schemaLocation) throws DataSourceException { ApplicationSchemaConfiguration configuration; { String namespaceURI = featureTypeName.getNamespaceURI(); String uri = schemaLocation.toExternalForm(); configuration = new ApplicationSchemaConfiguration(namespaceURI, uri); } SchemaIndex schemaIndex; try { schemaIndex = Schemas.findSchemas(configuration); } catch (RuntimeException e) { throw new DataSourceException("Error parsing feature type for " + featureTypeName, e); } XSDElementDeclaration elementDeclaration; elementDeclaration = schemaIndex.getElementDeclaration(featureTypeName); schemaIndex.destroy(); if (elementDeclaration == null) { throw new DataSourceException("No XSDElementDeclaration found for " + featureTypeName); } return elementDeclaration; }
schemaIndex.destroy(); if (elementDeclaration == null) { throw new DataSourceException("No XSDElementDeclaration found for " + featureTypeName);