FeatureStore store = workspace.getResource( id.getProvider(), id.getId() ); if ( store != null ) { addStore( store ); addNotYetHintedNamespaces( store.getSchema().getNamespaceBindings().values() ); throw new ResourceInitException( msg ); addStore( store ); addNotYetHintedNamespaces( store.getSchema().getNamespaceBindings().values() );
private Collection<FeatureType> getAllFeatureTypes() { Comparator<FeatureType> comp = new Comparator<FeatureType>() { @Override public int compare( FeatureType ftMd1, FeatureType ftMd2 ) { QName a = ftMd1.getName(); QName b = ftMd2.getName(); int order = a.getNamespaceURI().compareTo( b.getNamespaceURI() ); if ( order == 0 ) { order = a.getLocalPart().compareTo( b.getLocalPart() ); } return order; } }; Collection<FeatureType> sortedFts = new TreeSet<FeatureType>( comp ); for ( FeatureType ft : service.getFeatureTypes() ) { FeatureStore fs = service.getStore( ft.getName() ); if ( fs.isMapped( ft.getName() ) ) { sortedFts.add( ft ); } } return sortedFts; }
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 Collection<FeatureType> getFeatureTypesWithMetadata() { final Collection<FeatureType> sortedFts = new LinkedHashSet<FeatureType>(); for ( final DatasetMetadata datasetMetadata : mdProvider.getDatasetMetadata() ) { final QName ftName = datasetMetadata.getQName(); final FeatureStore fs = service.getStore( ftName ); if ( fs != null ) { if ( fs.isMapped( ftName ) ) { sortedFts.add( service.lookupFeatureType( ftName ) ); } } else { LOG.warn( "Found metadata for feature type '" + ftName + "', but feature type is not available from any store." ); } } return sortedFts; }
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; }
FeatureStore fs = service.getStore( ftName ); env = fs.getEnvelope( ftName ); } catch ( FeatureStoreException e ) {
private QName getPropertyNameAsQName( ValueReference propName ) { QName name = null; NamespaceContext nsContext = propName.getNsContext(); String s = propName.getAsText(); int colonIdx = s.indexOf( ':' ); if ( !s.contains( "/" ) && colonIdx != -1 ) { if ( Character.isLetterOrDigit( s.charAt( 0 ) ) && Character.isLetterOrDigit( s.charAt( s.length() - 1 ) ) ) { String prefix = s.substring( 0, colonIdx ); String localName = s.substring( colonIdx + 1, s.length() ); String nsUri = null; if ( nsContext != null ) { nsUri = nsContext.translateNamespacePrefixToUri( prefix ); } else { nsUri = service.getPrefixToNs().get( prefix ); if ( nsUri == null ) { nsUri = ""; } } name = new QName( nsUri, localName, prefix ); } } else { if ( !s.contains( "/" ) && !s.isEmpty() && Character.isLetterOrDigit( s.charAt( 0 ) ) && Character.isLetterOrDigit( s.charAt( s.length() - 1 ) ) ) { name = new QName( s ); } } return name; }
: jaxbConfig.isEnableResponsePaging(); service = new WfsFeatureStoreManager(); try { service.init( jaxbConfig, workspace ); } catch ( Exception e ) { throw new ResourceInitException( "Error initializing WFS/FeatureStores: " + e.getMessage(), e );
/** * Returns the {@link FeatureStore} instance which is responsible for the specified feature type. * * @param ftName * name of the {@link FeatureType} * @return the responsible {@link FeatureStore} or <code>null</code> if no such store exists, i.e. the specified * feature type is not served */ public FeatureStore getStore( QName ftName ) { FeatureType ft = lookupFeatureType( ftName ); if ( ft == null ) { return null; } return schemaToStore.get( ft.getSchema() ); }
protected Map<String, String> getFeatureTypeNsPrefixes( Collection<FeatureType> fts ) { if ( fts == null ) { fts = format.getMaster().getStoreManager().getFeatureTypes(); } Map<String, String> prefixToNs = new HashMap<String, String>(); for ( FeatureType ft : fts ) { QName ftName = ft.getName(); if ( ftName.getPrefix() != null ) { prefixToNs.put( ftName.getPrefix(), ftName.getNamespaceURI() ); } } return prefixToNs; }
private void doUpdate( Update update, Lock lock ) throws OWSException { LOG.debug( "doUpdate: " + update ); QName ftName = update.getTypeName(); FeatureType ft = service.lookupFeatureType( ftName ); FeatureStore fs = service.getStore( ftName ); if ( fs == null ) { throw new OWSException( Messages.get( "WFS_FEATURE_TYPE_NOT_SERVED", ftName ), INVALID_PARAMETER_VALUE ); } GMLVersion inputFormat = determineFormat( request.getVersion(), update.getInputFormat() ); FeatureStoreTransaction ta = acquireTransaction( fs ); List<ParsedPropertyReplacement> replacementProps = getReplacementProps( update, ft, inputFormat ); Filter filter = null; try { filter = update.getFilter(); // superimpose default query CRS Filters.setDefaultCRS( filter, master.getDefaultQueryCrs() ); } catch ( Exception e ) { throw new OWSException( e.getMessage(), INVALID_PARAMETER_VALUE ); } try { List<String> updatedFids = ta.performUpdate( ftName, replacementProps, filter, lock ); for ( String updatedFid : updatedFids ) { this.updated.add( updatedFid, update.getHandle() ); } } catch ( FeatureStoreException e ) { throw new OWSException( "Error performing update: " + e.getMessage(), e, NO_APPLICABLE_CODE ); } }
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; }
FeatureStore fs = service.getStore( ftName ); writeElement( writer, WFS_NS, "DefaultSRS", querySRS.get( 0 ).getAlias() );
gmlStream.setGeometrySimplifier( options.getGeometrySimplifier() ); Map<String, String> prefixToNs = new HashMap<String, String>( format.getMaster().getStoreManager().getPrefixToNs() ); prefixToNs.putAll( getFeatureTypeNsPrefixes( analyzer.getFeatureTypes() ) ); gmlStream.setNamespaceBindings( prefixToNs );
private Set<String> getNamespacesForRequestedFeatureTypes( DescribeFeatureType request, WfsFeatureStoreManager storeManager ) throws OWSException { Set<String> set = new LinkedHashSet<String>(); LOG.debug( "Adding namespaces of requested feature types." ); for ( QName ftName : request.getTypeNames() ) { FeatureType ft = storeManager.lookupFeatureType( ftName ); if ( ft == null ) { throw new OWSException( Messages.get( "WFS_FEATURE_TYPE_NOT_SERVED", ftName ), OWSException.INVALID_PARAMETER_VALUE, "typenames" ); } set.add( ft.getName().getNamespaceURI() ); } return set; }
List<QName> collectAndSortFeatureTypesToExport( List<QName> configuredReturnFeatureTypes ) { Collection<FeatureType> featureTypes = wfs.getStoreManager().getFeatureTypes(); List<QName> ftNames = collectFeatureTypes( configuredReturnFeatureTypes, featureTypes ); Collections.sort( ftNames, new Comparator<QName>() { @Override public int compare( QName arg0, QName arg1 ) { String s0 = arg0.toString(); String s1 = arg1.toString(); return s0.compareTo( s1 ); } } ); return ftNames; }
for ( int i = 0; i < wfsTypeNames.length; i++ ) { String alias = wfsTypeNames[i].getAlias(); FeatureType ft = service.lookupFeatureType( wfsTypeNames[i].getFeatureTypeName() ); if ( ft == null ) { String msg = "Feature type with name '" + wfsTypeNames[i].getFeatureTypeName() throw new OWSException( msg, INVALID_PARAMETER_VALUE, "typeName" ); FeatureStore fs = service.getStore( ft.getName() ); if ( commonFs != null ) { if ( fs != commonFs ) {
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; }
FeatureStore fs = service.getStore( ftName ); writeElement( writer, WFS_200_NS, "DefaultCRS", querySRS.get( 0 ).getAlias() );