@Override public void init() { featureType = DbFeatureUtils.determineFeatureType( ftName, connProvider, lods.values().iterator().next() ); if ( featureType == null ) { available = false; } else { schema = new GenericAppSchema( new FeatureType[] { featureType }, null, null, null, null, null ); available = true; } }
@Override public List<GMLObjectType> getSubstitutions( QName name ) { List<GMLObjectType> directSubtypes = getDirectSubstitutions( name ); List<GMLObjectType> result = new ArrayList<GMLObjectType>( typeNameToType.size() ); if ( directSubtypes != null && !directSubtypes.isEmpty() ) { for ( GMLObjectType son : directSubtypes ) { if ( son != null ) { result.add( son ); List<GMLObjectType> sons = getSubstitutions( son.getName() ); if ( sons != null ) { result.addAll( sons ); } } } } return result; }
@Override public FeatureType[] getSubtypes( FeatureType ft ) { FeatureType[] directSubtypes = getDirectSubtypes( ft ); List<FeatureType> result = new ArrayList<FeatureType>( ftNameToFt.size() ); if ( directSubtypes != null && directSubtypes.length > 0 ) { for ( FeatureType son : directSubtypes ) { if ( son != null ) { result.add( son ); FeatureType[] sons = getSubtypes( son ); if ( sons != null && sons.length > 0 ) { Collections.addAll( result, sons ); } } } } return result.toArray( new FeatureType[result.size()] ); }
@Override public List<String> getNamespacesDependencies( String ns ) { List<String> nsDependencies = nsToDependencies.get( ns ); if ( nsDependencies == null ) { Set<String> dependencies = new HashSet<String>(); List<FeatureType> fts = getFeatureTypes( ns, true, true ); for ( FeatureType ft : fts ) { dependencies.add( ft.getName().getNamespaceURI() ); for ( PropertyType pt : ft.getPropertyDeclarations() ) { if ( pt instanceof FeaturePropertyType ) { FeaturePropertyType fpt = (FeaturePropertyType) pt; if ( fpt.getValueFt() != null ) { dependencies.add( fpt.getValueFt().getName().getNamespaceURI() ); } } } if ( getParent( ft ) != null ) { dependencies.add( getParent( ft ).getName().getNamespaceURI() ); } } if ( gmlSchema != null ) { // TODO } dependencies.remove( ns ); nsDependencies = new ArrayList<String>( dependencies ); nsToDependencies.put( ns, nsDependencies ); } return nsDependencies; }
for ( FeatureType ft : getFeatureTypes() ) { String ns = ft.getName().getNamespaceURI(); if ( !( "".equals( ns ) ) ) { populateSubstitutionLookupMap( fts, ftToSuperFt, typeToSuperType );
@Override public List<PropertyType> getNewPropertyDecls( FeatureType ft ) { List<PropertyType> propDecls = ft.getPropertyDeclarations(); FeatureType parentFt = getParent( ft ); int firstNewIdx = 0; if ( parentFt != null ) { for ( PropertyType parentPropDecl : parentFt.getPropertyDeclarations() ) { if ( parentPropDecl.getName().equals( propDecls.get( firstNewIdx ).getName() ) ) { firstNewIdx++; } else { throw new RuntimeException( "Content model of feature type '" + ft.getName() + "' is not compatible with parent type '" + parentFt.getName() + "'." ); } } } // TODO integrate handling of gml:featureMember properly for ( int i = firstNewIdx; i < propDecls.size(); i++ ) { if ( "featureMember".equals( propDecls.get( firstNewIdx ).getName().getLocalPart() ) ) { firstNewIdx++; } else if ( "featureMembers".equals( propDecls.get( firstNewIdx ).getName().getLocalPart() ) ) { firstNewIdx++; } } return propDecls.subList( firstNewIdx, propDecls.size() ); }
static FeatureType buildFeatureType() { List<PropertyType> pts = new LinkedList<PropertyType>(); pts.add( new SimplePropertyType( new QName( "http://www.deegree.org/app", "value", "app" ), 0, -1, DECIMAL, null, null ) ); FeatureType featureType = new GenericFeatureType( new QName( "http://www.deegree.org/app", "data", "app" ), pts, false ); // needed to get the back reference to the schema into the featureType (it's a strange mechanism indeed) new GenericAppSchema( new FeatureType[] { featureType }, null, null, null, null, null ); return featureType; }
@Override public FeatureType[] getConcreteSubtypes( FeatureType ft ) { FeatureType[] directSubtypes = getDirectSubtypes( ft ); List<FeatureType> result = new ArrayList<FeatureType>( ftNameToFt.size() ); if ( directSubtypes != null && directSubtypes.length > 0 ) { for ( FeatureType son : directSubtypes ) { if ( son != null ) { if ( !son.isAbstract() ) { result.add( son ); } FeatureType[] sons = getSubtypes( son ); if ( sons != null && sons.length > 0 ) { for ( FeatureType sonSon : sons ) { if ( !sonSon.isAbstract() ) { result.add( sonSon ); } } } } } } return result.toArray( new FeatureType[result.size()] ); }
typeNameToType.put( type.getName(), type ); return new GenericAppSchema( fts, ftSubstitution, prefixToNs, gmlSchema, genericGmlObjectTypes, typeToSuperType );
schema = new GenericAppSchema( new FeatureType[] { ft }, null, null, null, null, null ); dbfLastModified = dbfFile.lastModified(); cache.clear();
ft = new GenericFeatureType( ftName, Collections.<PropertyType> singletonList( geomProp ), false ); schema = new GenericAppSchema( new FeatureType[] { ft }, null, null, null, null, null );