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; }
public Set<String> getAppSchemaNamespaces() { Set<String> set = new LinkedHashSet<String>(); for ( FeatureStore fs : format.getMaster().getStoreManager().getStores() ) { set.addAll( fs.getSchema().getAppNamespaces() ); } set.remove( GMLNS ); set.remove( GML3_2_NS ); return set; }
private Set<String> findUnhandledNs( Set<String> set ) { Set<String> dependentNamespaces = new HashSet<String>(); WfsFeatureStoreManager storeManager = format.getMaster().getStoreManager(); for ( String ns : set ) { for ( FeatureStore fs : storeManager.getStores() ) { AppSchema schema = fs.getSchema(); List<String> depNs = schema.getNamespacesDependencies( ns ); for ( String n : depNs ) { if ( !set.contains( n ) ) { dependentNamespaces.add( n ); } } } } return dependentNamespaces; }
private LockManager getLockManager() throws OWSException { LockManager manager = null; try { // TODO strategy for multiple LockManagers / feature stores manager = master.getStoreManager().getStores()[0].getLockManager(); } catch ( FeatureStoreException e ) { LOG.debug( e.getMessage(), e ); throw new OWSException( "Cannot acquire lock manager: " + e.getMessage(), NO_APPLICABLE_CODE ); } return manager; } }
private GMLSchemaInfoSet findGmlSchema( Collection<String> namespaces, GMLVersion version ) { LOG.debug( "Try to find GML schema from store supporting namespaces {}", namespaces ); WfsFeatureStoreManager storeManager = format.getMaster().getStoreManager(); for ( FeatureStore store : storeManager.getStores() ) { if ( storeSupportsAllRequestedNamespaces( store, namespaces ) ) { GMLSchemaInfoSet gmlSchema = store.getSchema().getGMLSchema(); if ( gmlSchema != null && gmlSchema.getVersion() == version ) return gmlSchema; } } return null; }
FeatureStore featureStore = service.getStores()[0]; AppSchema schema = featureStore.getSchema(); GMLStreamReader gmlStream = GMLInputFactory.createGMLStreamReader( inputFormat, xmlStream );
for ( FeatureStore fs : service.getStores() ) { List<Query> fsQueries = fsToQueries.get( fs ); if ( fsQueries == null ) {
private void reencodeSchema( DescribeFeatureType request, XMLStreamWriter writer, String targetNs, Collection<String> importNs, GMLVersion version ) throws XMLStreamException { Map<String, String> importMap = buildImportMap( request, importNs ); WfsFeatureStoreManager storeManager = format.getMaster().getStoreManager(); Map<String, String> prefixToNs = storeManager.getPrefixToNs(); GMLAppSchemaWriter exporter = new GMLAppSchemaWriter( version, targetNs, importMap, prefixToNs ); List<FeatureType> fts = new ArrayList<FeatureType>(); for ( FeatureStore fs : storeManager.getStores() ) { for ( FeatureType ft : fs.getSchema().getFeatureTypes( targetNs, true, true ) ) { fts.add( ft ); } } exporter.export( writer, fts ); }
private Lock acquireLock( LockFeature request, LockManager manager, long expiryInMilliseconds ) throws OWSException { // default: lock all boolean lockAll = true; if ( request.getLockAll() != null ) { lockAll = request.getLockAll(); } List<Query> fsQueries = null; try { QueryAnalyzer queryAnalyzer = new QueryAnalyzer( request.getQueries(), master, master.getStoreManager(), master.getCheckAreaOfUse() ); fsQueries = queryAnalyzer.getQueries().get( master.getStoreManager().getStores()[0] ); } catch ( Exception e ) { throw new OWSException( "Cannot determine feature store queries for locking: " + e.getMessage(), NO_APPLICABLE_CODE ); } Lock lock = null; try { lock = manager.acquireLock( fsQueries, lockAll, expiryInMilliseconds ); } catch ( OWSException e ) { LOG.debug( e.getMessage(), e ); throw new OWSException( e.getMessage(), "CannotLockAllFeatures" ); } catch ( Exception e ) { LOG.debug( e.getMessage(), e ); throw new OWSException( "Cannot acquire lock: " + e.getMessage(), NO_APPLICABLE_CODE ); } return lock; }
if ( service.getStores().length == 0 ) { throw new OWSException( "Cannot perform insert. No feature store defined.", NO_APPLICABLE_CODE ); if ( service.getStores().length > 1 ) { String msg = "Cannot perform insert. More than one feature store is active -- " + "this is currently not supported. Please deactivate all feature stores, " FeatureCollection fc = parseFeaturesOrCollection( xmlStream, inputFormat, defaultCRS ); evaluateSrsNameForFeatureCollection( fc, queryCRS, insert.getHandle() ); FeatureStore fs = service.getStores()[0]; ta = acquireTransaction( fs ); IDGenMode mode = insert.getIdGen();
try { manager = service.getStores()[0].getLockManager(); } catch ( FeatureStoreException e ) { throw new OWSException( "Cannot acquire lock manager: " + e.getMessage(),
protected GMLObject retrieveObject( String id ) throws OWSException { GMLObject o = null; for ( FeatureStore fs : format.getMaster().getStoreManager().getStores() ) { try { o = fs.getObjectById( id ); } catch ( FeatureStoreException e ) { throw new OWSException( e.getMessage(), NO_APPLICABLE_CODE ); } if ( o != null ) { break; } } if ( o == null ) { String msg = Messages.getMessage( "WFS_NO_SUCH_OBJECT", id ); throw new OWSException( new InvalidParameterValueException( msg ) ); } return o; }