private void evaluateSrsNameForFeatureCollection( FeatureCollection fc, List<ICRS> queryCRS, String handle ) throws OWSException { for ( Feature feature : fc ) evaluateSrsNameForFeature( feature, queryCRS, handle ); }
@Override public ResourceMetadata<OWS> createFromLocation( Workspace workspace, ResourceLocation<OWS> location ) { return new WfsMetadata( workspace, location, this ); }
@Override public OWS build() { return new WebFeatureService( metadata, workspace, config ); }
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; }
private LimitedSupportedEncodings parseEncodings( SupportedRequests supportedRequests ) { List<String> supportedEncodingsForAllRequestTypes = supportedRequests.getSupportedEncodings(); if ( isAtLeastOneRequestTypeConfigured( supportedRequests ) ) return parseEncodingsWithSpecifiedRequestTypes( supportedRequests, supportedEncodingsForAllRequestTypes ); else return parseEncodingWithSupportedEncodings( supportedEncodingsForAllRequestTypes ); }
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; }
SupportedEncodings parseEncodings( DeegreeWFS jaxbConfig ) { SupportedRequests supportedRequests = jaxbConfig.getSupportedRequests(); if ( supportedRequests != null ) { if ( isAtLeastOneRequestTypeConfigured( supportedRequests ) || isGlobalSupportedEncodingsConfigured( supportedRequests ) ) return parseEncodings( supportedRequests ); } return new UnlimitedSupportedEncodings(); }
private void sendResponse200( HttpResponseBuffer response ) throws XMLStreamException, IOException { String ns = WFS_200_NS; String schemaLocation = ns + " " + WFS_200_SCHEMA_URL; XMLStreamWriter xmlWriter = getXMLResponseWriter( response, "text/xml", schemaLocation ); xmlWriter.setPrefix( "wfs", WFS_200_NS ); xmlWriter.writeStartElement( WFS_200_NS, "TransactionResponse" ); xmlWriter.writeAttribute( "version", VERSION_200.toString() ); xmlWriter.writeNamespace( "wfs", WFS_200_NS ); xmlWriter.writeNamespace( "fes", FES_20_NS ); xmlWriter.writeStartElement( WFS_200_NS, "TransactionSummary" ); writeElement( xmlWriter, WFS_200_NS, "totalInserted", "" + inserted.getTotal() ); writeElement( xmlWriter, WFS_200_NS, "totalUpdated", "" + updated.getTotal() ); writeElement( xmlWriter, WFS_200_NS, "totalReplaced", "" + replaced.getTotal() ); writeElement( xmlWriter, WFS_200_NS, "totalDeleted", "" + deleted ); xmlWriter.writeEndElement(); writeActionResults200( xmlWriter, "InsertResults", inserted ); writeActionResults200( xmlWriter, "UpdateResults", updated ); writeActionResults200( xmlWriter, "ReplaceResults", replaced ); xmlWriter.writeEndElement(); xmlWriter.flush(); }
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 void writeLockFeatureResponse200( HttpResponseBuffer response, Lock lock ) throws XMLStreamException, IOException, FeatureStoreException { String schemaLocation = WFS_200_NS + " " + WFS_200_SCHEMA_URL; XMLStreamWriter writer = getXMLResponseWriter( response, "text/xml", schemaLocation ); writer.setPrefix( "wfs", WFS_200_NS ); writer.writeStartElement( WFS_200_NS, "LockFeatureResponse" ); writer.writeAttribute( "lockId", lock.getId() ); writer.writeNamespace( "wfs", WFS_200_NS ); writer.writeNamespace( "fes", FES_20_NS ); if ( lock.getNumLocked() > 0 ) { writeFeaturesLocked200( lock, writer ); } if ( lock.getNumFailedToLock() > 0 ) { writeFeaturesNotLocked200( lock, writer ); } writer.writeEndElement(); writer.flush(); }
private void writeLockFeatureResponse100( HttpResponseBuffer response, Lock lock ) throws XMLStreamException, IOException, FeatureStoreException { String schemaLocation = WFS_NS + " " + WFS_100_TRANSACTION_URL; XMLStreamWriter writer = getXMLResponseWriter( response, "text/xml", schemaLocation ); writer.setPrefix( "wfs", WFS_NS ); writer.writeStartElement( WFS_NS, "WFS_LockFeatureResponse" ); writer.writeNamespace( "wfs", WFS_NS ); writer.writeNamespace( "ogc", OGCNS ); writeElement( writer, WFS_NS, "LockId", lock.getId() ); if ( lock.getNumLocked() > 0 ) { writeFeaturesLocked100or110( lock, writer ); } if ( lock.getNumFailedToLock() > 0 ) { writeFeaturesNotLocked100( lock, writer ); } writer.writeEndElement(); writer.flush(); }
private void writeLockFeatureResponse110( HttpResponseBuffer response, Lock lock ) throws XMLStreamException, IOException, FeatureStoreException { String schemaLocation = WFS_NS + " " + WFS_110_SCHEMA_URL; XMLStreamWriter writer = getXMLResponseWriter( response, "text/xml", schemaLocation ); writer.setPrefix( "wfs", WFS_NS ); writer.writeStartElement( WFS_NS, "LockFeatureResponse" ); writer.writeNamespace( "wfs", WFS_NS ); writer.writeNamespace( "ogc", OGCNS ); writeElement( writer, WFS_NS, "LockId", lock.getId() ); if ( lock.getNumLocked() > 0 ) { writeFeaturesLocked100or110( lock, writer ); } if ( lock.getNumFailedToLock() > 0 ) { writeFeaturesNotLocked110( lock, writer ); } writer.writeEndElement(); writer.flush(); }
private void sendServiceException( Version requestVersion, OWSException e, HttpResponseBuffer response ) throws ServletException { XMLExceptionSerializer serializer = getExceptionSerializer( requestVersion ); sendException( null, serializer, e, response ); }
private Lock acquireOrRenewLock( LockFeature request, LockManager manager ) throws OWSException { long expiryInMilliseconds = DEFAULT_EXPIRY_IN_MILLISECONDS; if ( request.getExpiryInSeconds() != null ) { expiryInMilliseconds = request.getExpiryInSeconds().longValue() * 1000; } String existingLockId = request.getExistingLockId(); if ( existingLockId != null ) { return renewLock( manager, expiryInMilliseconds, existingLockId ); } return acquireLock( request, manager, expiryInMilliseconds ); }
private void sendSoapException( SOAPEnvelope soapDoc, SOAPFactory factory, HttpResponseBuffer response, OWSException e, ServletRequest request, Version requestVersion ) throws OMException, ServletException { XMLExceptionSerializer serializer = getExceptionSerializer( requestVersion ); sendSOAPException( soapDoc.getHeader(), factory, response, e, serializer, null, null, request.getServerName(), request.getCharacterEncoding() ); }
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 void writeOutputFormats110( XMLStreamWriter writer ) throws XMLStreamException { writer.writeStartElement( WFS_NS, "OutputFormats" ); for ( String format : master.getOutputFormats() ) { writer.writeStartElement( WFS_NS, "Format" ); writer.writeCharacters( format ); writer.writeEndElement(); } writer.writeEndElement(); }
private void addOperation( WFSRequestType wfsRequestType, List<DCP> getAndPost, List<DCP> post, List<DCP> get, List<Operation> operations ) { addOperation( wfsRequestType, null, getAndPost, post, get, operations ); }
private void evaluateSrsName( ICRS crs, List<ICRS> supportedCrs, String handle ) throws OWSException { if ( !isCrsSupported( crs, supportedCrs ) ) { String message = "The value of the at least one geometrie srs is not one of the SRS values " + "the server claims to support in its capabilities document."; if ( handle == null || "".equals( handle ) ) handle = "Transaction"; throw new OWSException( message, OWSException.OPERATION_PROCESSING_FAILED, handle ); } }
private void writeOutputFormats200( XMLStreamWriter writer ) throws XMLStreamException { writer.writeStartElement( WFS_200_NS, "OutputFormats" ); for ( String format : master.getOutputFormats() ) { writer.writeStartElement( WFS_200_NS, "Format" ); writer.writeCharacters( format ); writer.writeEndElement(); } writer.writeEndElement(); }