@Override public boolean isMapped( QName ftName ) { return schema.getFeatureType( ftName ) != null; }
private static void printFtHierarchy( AppSchema schema, Set<String> ftNames, Set<String> propNames ) { int concrete = 0; for ( FeatureType ft : schema.getFeatureTypes() ) { if ( !ft.isAbstract() ) { concrete++; } printFt( ft, ftNames, propNames ); } System.out.println( schema.getFeatureTypes().length + " feature types (" + concrete + " concrete)" ); }
private Set<String> getExplicitlyRequestedNamespaces( DescribeFeatureType request, WfsFeatureStoreManager storeManager ) { Set<String> set = new LinkedHashSet<String>(); for ( String ns : request.getNsBindings().values() ) { for ( FeatureStore fs : storeManager.getStores() ) { AppSchema schema = fs.getSchema(); if ( schema.getNamespaceBindings().values().contains( ns ) ) { set.add( ns ); break; } } } return set; }
private GMLObjectType getType( XMLStreamReader xmlStream ) { GMLObjectType type = null; if ( schema != null && schema.getGMLSchema() != null ) { QName name = xmlStream.getName(); type = schema.getGeometryType( name ); if ( type == null ) { LOG.debug( "GML geometry element '" + name + "' is not defined in application schema!?" ); } } return type; }
/** * Returns the {@link MappedAppSchema} derived from GML application schemas / configuration. * * @return mapped application schema, never <code>null</code> */ @Override public MappedAppSchema getMappedSchema() { FeatureType[] fts = gmlSchema.getFeatureTypes(); org.deegree.feature.persistence.sql.FeatureTypeMapping[] ftMappings = ftNameToMapping.values().toArray( new org.deegree.feature.persistence.sql.FeatureTypeMapping[ftNameToMapping.size()] ); Map<FeatureType, FeatureType> ftToSuperFt = gmlSchema.getFtToSuperFt(); Map<String, String> prefixToNs = new HashMap<String, String>(); Iterator<String> prefixIter = nsBindings.getPrefixes(); while ( prefixIter.hasNext() ) { String prefix = prefixIter.next(); prefixToNs.put( prefix, nsBindings.getNamespaceURI( prefix ) ); } GMLSchemaInfoSet xsModel = gmlSchema.getGMLSchema(); return new MappedAppSchema( fts, ftToSuperFt, prefixToNs, xsModel, ftMappings, bboxMapping, blobMapping, geometryParams, deleteCascadingByDB, null, gmlSchema.getGmlObjectTypes(), gmlSchema.getGeometryToSuperType() ); }
List<Query> buildInfoQueries() { List<Query> queries = new ArrayList<Query>(); if ( ftName == null ) { queries.addAll( map( featureStore.getSchema().getFeatureTypes( null, false, false ), new Mapper<Query, FeatureType>() { @Override public Query apply( FeatureType u ) { Filter f; if ( filter == null ) { f = buildFilter( null, u, bbox ); } else { f = buildFilter( ( (OperatorFilter) filter ).getOperator(), u, bbox ); } return createQuery( u.getName(), f, -1, query.getFeatureCount(), -1, sortBy ); } } ) ); clearNulls( queries ); } else { Filter f; if ( filter == null ) { f = buildFilter( null, featureStore.getSchema().getFeatureType( ftName ), bbox ); } else { f = buildFilter( ( (OperatorFilter) filter ).getOperator(), featureStore.getSchema().getFeatureType( ftName ), bbox ); } queries.add( createQuery( ftName, f, -1, query.getFeatureCount(), -1, sortBy ) ); } return queries; }
this.useIntegerFids = useIntegerFids; List<FeatureType> ftList = appSchema.getFeatureTypes( null, false, false ); List<FeatureType> blackList = new ArrayList<FeatureType>(); for ( FeatureType ft : ftList ) { if ( ft.getName().getNamespaceURI().equals( appSchema.getGMLSchema().getVersion().getNamespace() ) ) { blackList.add( ft ); Map<FeatureType, FeatureType> ftToSuperFt = new HashMap<FeatureType, FeatureType>( appSchema.getFtToSuperFt() ); for ( FeatureType ft : blackList ) { ftToSuperFt.remove( ft ); Map<String, String> prefixToNs = appSchema.getNamespaceBindings(); GMLSchemaInfoSet xsModel = appSchema.getGMLSchema(); blobMapping, geometryParams, true, null, appSchema.getGeometryTypes(), appSchema.getGeometryToSuperType() );
private void setSchema( Feature feature ) { if ( schema == null ) { schema = feature.getType().getSchema(); if ( schema != null ) { schemaInfoset = schema.getGMLSchema(); } } }
if ( gmlStreamReader.getGeometryReader().isGeometryElement( xmlStream ) ) { return gmlStreamReader.getGeometryReader().parse( xmlStream ); } else if ( schema.getFeatureType( elName ) != null ) { return gmlStreamReader.getFeatureReader().parseFeature( xmlStream, crs ); List<TypedObjectNode> children = new ArrayList<TypedObjectNode>(); Map<QName, XSTerm> childElementDecls = schema.getGMLSchema().getAllowedChildElementDecls( xsdValueType );
throw new IllegalArgumentException( msg ); for ( FeatureType ft : fs.getSchema().getFeatureTypes( null, true, false ) ) { if ( ft.getName().getNamespaceURI().equals( GMLNS ) || ft.getName().getNamespaceURI().equals( GML3_2_NS ) ) { for ( Entry<String, String> e : fs.getSchema().getNamespaceBindings().entrySet() ) { prefixToNs.put( e.getKey(), e.getValue() ); targetNsToPrefix.put( e.getValue(), e.getKey() );
throw new NullPointerException( "The feature store must have an application schema to work with." ); FeatureType[] rootFeatureTypes = schema.getRootFeatureTypes(); if ( rootFeatureTypes == null || rootFeatureTypes.length == 0 ) { throw new NullPointerException( "The application schema must have root feature types to work with." ); QName posFT = styleFT; if ( styleFT != null ) { FeatureType sFT = schema.getFeatureType( styleFT ); if ( sFT == null ) { posFT = null;
protected boolean localReferencesPossible( QueryAnalyzer analyzer, int traverseXLinkDepth ) { if ( traverseXLinkDepth == 0 && analyzer.getQueries().size() == 1 ) { List<Query> queries = analyzer.getQueries().values().iterator().next(); if ( queries.size() == 1 ) { Query query = queries.get( 0 ); if ( query.getTypeNames().length == 1 ) { TypeName typeName = query.getTypeNames()[0]; FeatureStore fs = analyzer.getQueries().keySet().iterator().next(); FeatureType ft = fs.getSchema().getFeatureType( typeName.getFeatureTypeName() ); for ( PropertyType pt : ft.getPropertyDeclarations() ) { if ( pt instanceof FeaturePropertyType ) { FeaturePropertyType fpt = (FeaturePropertyType) pt; FeatureType targetFt = fpt.getValueFt(); if ( targetFt == null || fs.getSchema().isSubType( targetFt, ft ) ) { return true; } } } LOG.debug( "Forward references can be ruled out." ); return false; } } } return true; }
Map<String, String> schemaNSBindings = gmlSchema.getNamespaceBindings(); for ( String prefix : schemaNSBindings.keySet() ) { String nsUri = schemaNSBindings.get( prefix ); schemaNSBindings = gmlSchema.getGMLSchema().getNamespacePrefixes(); for ( String prefix : schemaNSBindings.keySet() ) { String nsUri = schemaNSBindings.get( prefix );
AppSchema schema = ft.getSchema(); if ( schema != null ) { hasSubTypes = schema.getDirectSubtypes( ft ).length > 0; GMLSchemaInfoSet analyzer = ft.getSchema().getGMLSchema(); if ( analyzer == null ) { if ( hasSubTypes ) {
private static void createClasses( AppSchema schema, FeatureType root, HashMap<QName, FeatureClass> featClasses ) throws IOException { if ( root != null ) { createFeatureFile( root, featClasses ); } FeatureType[] directSubtypes = schema.getDirectSubtypes( root ); if ( directSubtypes != null && directSubtypes.length > 0 ) { for ( FeatureType dft : directSubtypes ) { if ( dft != null ) { createClasses( schema, dft, featClasses ); } } } }
FeatureType[] roots = schema.getRootFeatureTypes();
public FeatureClass( FeatureType ft, FeatureClass parent ) { super( ft.getName(), D_PACKAGE, PACKAGE_DIR, null, false, ft.isAbstract() ); this.ft = ft; this.baseType = parent; AppSchema schema = ft.getSchema(); propertyDeclarations = schema.getNewPropertyDecls( ft ); }
md.setMetadataId( lay.getMetadataSetId() ); if ( featureType != null ) { md.getFeatureTypes().add( store.getSchema().getFeatureType( featureType ) ); } else { md.getFeatureTypes().addAll( Arrays.asList( store.getSchema().getFeatureTypes() ) );
private AppSchema buildGMLSchema( String configURL, List<String> gmlSchemas ) throws FeatureStoreException { LOG.debug( "Building application schema from GML schema files." ); AppSchema appSchema = null; try { XMLAdapter resolver = new XMLAdapter(); resolver.setSystemId( configURL ); String[] schemaURLs = new String[gmlSchemas.size()]; int i = 0; for ( String gmlSchema : gmlSchemas ) { schemaURLs[i++] = resolver.resolve( gmlSchema.trim() ).toString(); } GMLAppSchemaReader decoder = null; if ( schemaURLs.length == 1 && schemaURLs[0].startsWith( "file:" ) ) { File file = new File( new URL( schemaURLs[0] ).toURI() ); decoder = new GMLAppSchemaReader( null, null, file ); } else { decoder = new GMLAppSchemaReader( null, null, schemaURLs ); } appSchema = decoder.extractAppSchema(); } catch ( Throwable t ) { t.printStackTrace(); String msg = "Error building GML application schema: " + t.getMessage(); throw new FeatureStoreException( msg ); } LOG.debug( "GML version: " + appSchema.getGMLSchema().getVersion() ); return appSchema; }
private static void writeLayer( HashSet<FeatureType> visited, XMLStreamWriter out, FeatureType ft, String storeId ) throws XMLStreamException { if ( visited.contains( ft ) || ft == null ) { return; } visited.add( ft ); out.writeCharacters( "\n" ); out.writeStartElement( ns, "RequestableLayer" ); XMLAdapter.writeElement( out, ns, "Name", ft.getName().getLocalPart() ); XMLAdapter.writeElement( out, ns, "Title", ft.getName().getLocalPart() ); for ( FeatureType sub : ft.getSchema().getDirectSubtypes( ft ) ) { writeLayer( visited, out, sub, storeId ); } XMLAdapter.writeElement( out, ns, "FeatureStoreId", storeId ); out.writeEndElement(); out.writeCharacters( "\n" ); }