/** * Parses the GML schema represented by the <code>configuration</code>'s {@link * Configuration#getSchemaFileURL() schema location} into a {@link SchemaIndex}. * * @param configuration configuration object used to access the XSDSchema to parse. This * configuration object might contain {@link Binding}s * @throws IOException */ public SchemaIndex parse(Configuration configuration) throws IOException { // find out the schemas involved in the app schema configuration final SchemaIndex appSchemaIndex = Schemas.findSchemas(configuration); return appSchemaIndex; }
/** * Parses the GML schema represented by the <code>configuration</code>'s * {@link Configuration#getSchemaFileURL() schema location} into a {@link SchemaIndex}. * * @param configuration * configuration object used to access the XSDSchema to parse. This configuration * object might contain {@link Binding}s * @throws IOException */ public SchemaIndex parse(Configuration configuration) throws IOException { // find out the schemas involved in the app schema configuration final SchemaIndex appSchemaIndex = Schemas.findSchemas(configuration); return appSchemaIndex; }
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(); } } }
private void createFoundationTypes() { synchronized (FOUNDATION_TYPES) { if (!FOUNDATION_TYPES.isEmpty()) { typeRegistry.putAll(FOUNDATION_TYPES); return; } importSchema(new XSSchema()); for (Schema schema : helper.getSchemas()) { importSchema(schema); } for (Configuration config : helper.getConfigurations()) { addSchemas(Schemas.findSchemas(config)); } FOUNDATION_TYPES.putAll(typeRegistry); } }
/** * 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 = Schemas.findSchemas(configuration); } catch (RuntimeException e) { throw new DataSourceException("Error parsing feature type for " + featureTypeName, e);
addSchemas(Schemas.findSchemas(new GMLConfiguration())); addSchemas(Schemas.findSchemas(new org.geotools.gml3.v3_2.GMLConfiguration()));