@SuppressWarnings("synthetic-access") @Override public Feature next() { Feature f = null; try { f = retrieveFeature( recIter.next() ); } catch ( FeatureStoreException e ) { throw new RuntimeException( e.getMessage(), e ); } return f; }
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; } }
@Override public GMLObject getObject( String uri, String baseURL ) { if ( uri.startsWith( "#" ) ) { try { return fs.getObjectById( uri.substring( 1 ) ); } catch ( FeatureStoreException e ) { throw new ReferenceResolvingException( e.getMessage(), e ); } } throw new ReferenceResolvingException( "Resolving of remote references is not implemented yet." ); } }
private FeatureStoreTransaction acquireTransaction( FeatureStore fs ) throws OWSException { FeatureStoreTransaction ta = acquiredTransactions.get( fs ); if ( ta == null ) { try { LOG.debug( "Acquiring transaction for feature store " + fs ); ta = fs.acquireTransaction(); acquiredTransactions.put( fs, ta ); } catch ( FeatureStoreException e ) { throw new OWSException( Messages.get( "WFS_CANNOT_ACQUIRE_TA", e.getMessage() ), NO_APPLICABLE_CODE ); } } return ta; }
private Lock renewLock( LockManager manager, long expiryInMilliseconds, String existingLockId ) throws OWSException { Lock lock = null; try { lock = manager.getLock( existingLockId ); long acquistionDate = lock.getAcquistionDate(); long expiryDate = acquistionDate + expiryInMilliseconds; lock.setExpiryDate( expiryDate ); } catch ( FeatureStoreException e ) { LOG.debug( e.getMessage(), e ); throw new OWSException( "Cannot renew lock: " + e.getMessage(), NO_APPLICABLE_CODE ); } return lock; }
/** * Performs the given {@link LockFeature} request. * * @param request * request to be handled, must not be <code>null</code> * @param response * response that is used to write the result, must not be <code>null</code> * @throws OWSException * if a WFS specific exception occurs, e.g. a requested feature type is not served * @throws IOException * @throws XMLStreamException */ void doLockFeature( LockFeature request, HttpResponseBuffer response ) throws OWSException, XMLStreamException, IOException { LOG.debug( "doLockFeature: " + request ); LockManager manager = getLockManager(); Lock lock = acquireOrRenewLock( request, manager ); try { writeLockFeatureResponse( request, response, lock ); } catch ( FeatureStoreException e ) { throw new OWSException( "Cannot acquire lock: " + e.getMessage(), NO_APPLICABLE_CODE ); } }
unitsPerPixel, cacheDir, Math.round( cacheSize * 1024 * 1024 * 1024 ) ); } catch ( FeatureStoreException e ) { LOG.error( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e ); throw new IOException( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e );
env = fs.getEnvelope( ftName ); } catch ( FeatureStoreException e ) { LOG.error( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e );
env = fs.getEnvelope( ftName ); } catch ( FeatureStoreException e ) { LOG.error( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e );
env = fs.getEnvelope( ftName ); } catch ( FeatureStoreException e ) { LOG.error( "Error retrieving envelope from FeatureStore: " + e.getMessage(), e );
throw new OWSException( "Cannot acquire lock manager: " + e.getMessage(), OWSException.NO_APPLICABLE_CODE );
private void doReplace( Replace replace, Lock lock ) throws OWSException { LOG.debug( "doReplace: " + replace ); XMLStreamReader xmlStream = replace.getReplacementFeatureStream(); QName ftName = xmlStream.getName(); FeatureStore fs = service.getStore( ftName ); if ( fs == null ) { throw new OWSException( Messages.get( "WFS_FEATURE_TYPE_NOT_SERVED", ftName ), INVALID_PARAMETER_VALUE ); } Feature replacementFeature = null; Filter filter = null; try { GMLStreamReader gmlReader = createGMLStreamReader( GML_32, xmlStream ); gmlReader.setApplicationSchema( fs.getSchema() ); replacementFeature = gmlReader.readFeature(); filter = replace.getFilter(); // superimpose default CRS Filters.setDefaultCRS( filter, master.getDefaultQueryCrs() ); } catch ( Exception e ) { throw new OWSException( e.getMessage(), INVALID_PARAMETER_VALUE ); } FeatureStoreTransaction ta = acquireTransaction( fs ); try { String newFid = ta.performReplace( replacementFeature, filter, lock, idGenMode ); replaced.add( newFid, replace.getHandle() ); } catch ( FeatureStoreException e ) { throw new OWSException( "Error performing replace: " + e.getMessage(), e, NO_APPLICABLE_CODE ); } }
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; }
private void doDelete( Delete delete, Lock lock ) throws OWSException { LOG.debug( "doDelete: " + delete ); QName ftName = delete.getTypeName(); FeatureStore fs = service.getStore( ftName ); if ( fs == null ) { throw new OWSException( Messages.get( "WFS_FEATURE_TYPE_NOT_SERVED", ftName ), INVALID_PARAMETER_VALUE ); } FeatureStoreTransaction ta = acquireTransaction( fs ); Filter filter = delete.getFilter(); // superimpose default query CRS Filters.setDefaultCRS( filter, master.getDefaultQueryCrs() ); try { switch ( filter.getType() ) { case ID_FILTER: { deleted += ta.performDelete( (IdFilter) filter, lock ); break; } case OPERATOR_FILTER: { deleted += ta.performDelete( ftName, (OperatorFilter) filter, lock ); break; } } } catch ( FeatureStoreException e ) { throw new OWSException( Messages.get( "WFS_ERROR_PERFORMING_DELETE", e.getMessage() ), NO_APPLICABLE_CODE ); } }
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 ); } }
throw new OWSException( e.getMessage(), "CannotLockAllFeatures" ); } catch ( FeatureStoreException e ) { throw new OWSException( "Cannot acquire lock: " + e.getMessage(), NO_APPLICABLE_CODE );