public void clear() throws StorageException { throw new StorageException("Not implemented yet!"); }
@Override public Boolean call() throws Exception { boolean result = false; try { // Execution of the requested operation result = action.executeOperation(store, objs); } catch (StorageException s) { if (LOG.isErrorEnabled()) { LOG.error(s.getMessage(), s); } } return result; } }
public StorageException(String msg, Throwable cause) { this.msg = msg; initCause(cause); }
private LiveStore defaultStore() throws StorageException { LiveStore store = blobStores.get(CompositeBlobStore.DEFAULT_STORE_DEFAULT_ID); if (store == null) { throw new StorageException("No default BlobStore has been defined"); } return store; }
/** * Notification that a layer has been added; to be called by {@link CatalogConfiguration} * whenever {@link CatalogConfiguration#save() save} is called and a layer has been renamed. * * <p>NOTE: this should be hanlded by GWC itself somehow, like with a configuration listener of * some sort. * * @param oldLayerName * @param newLayerName */ public void layerRenamed(String oldLayerName, String newLayerName) { try { log.info("Renaming GWC TileLayer '" + oldLayerName + "' as '" + newLayerName + "'"); // /embeddedConfig.rename(oldLayerName, newLayerName); storageBroker.rename(oldLayerName, newLayerName); } catch (StorageException e) { log.log(Level.WARNING, e.getMessage(), e); throw new RuntimeException(e); } }
@Nullable public byte[] getBytes(String key) throws StorageException { S3Object object = getObject(key); if (object == null) { return null; } try (S3ObjectInputStream in = object.getObjectContent()) { byte[] bytes = IOUtils.toByteArray(in); return bytes; } catch (IOException e) { throw new StorageException("Error getting " + key, e); } }
/** * Notification that a layer has been added; to be called by {@link CatalogConfiguration} * whenever {@link CatalogConfiguration#save() save} is called and a layer has been renamed. * <p> * NOTE: this should be hanlded by GWC itself somehow, like with a configuration listener of * some sort. * * @param oldLayerName * @param newLayerName */ public void layerRenamed(String oldLayerName, String newLayerName) { try { log.info("Renaming GWC TileLayer '" + oldLayerName + "' as '" + newLayerName + "'"); // /embeddedConfig.rename(oldLayerName, newLayerName); storageBroker.rename(oldLayerName, newLayerName); } catch (StorageException e) { log.log(Level.WARNING, e.getMessage(), e); throw new RuntimeException(e); } }
@Nullable public byte[] getBytes(String key) throws StorageException { S3Object object = getObject(key); if (object == null) { return null; } try (S3ObjectInputStream in = object.getObjectContent()) { byte[] bytes = IOUtils.toByteArray(in); return bytes; } catch (IOException e) { throw new StorageException("Error getting " + key, e); } }
respons = respons + "FileNotFoundException encountered: " + fileNotFoundException.getMessage(); } catch (StorageException storageException) { respons = respons + "StorageException encountered: " + storageException.getMessage(); } catch (IOException e) { respons = respons + "IOexception encountered: " + e.getMessage();
private void closeObject(S3Object object) throws StorageException { try { object.close(); } catch (IOException e) { throw new StorageException( "Error closing connection to " + object.getKey() + ": " + e.getMessage(), e); } }
throw new RestException(e.getMessage(), HttpStatus.BAD_REQUEST); } catch (StorageException e) { throw new RestException(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } catch (GeoWebCacheException e) { throw new RestException(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
private void closeObject(S3Object object) throws StorageException { try { object.close(); } catch (IOException e) { throw new StorageException( "Error closing connection to " + object.getKey() + ": " + e.getMessage(), e); } }
+ layerName + " was successful but deletion of cached tiles failed: " + storageBrokerDeleteException.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR, storageBrokerDeleteException);
public void putObject(PutObjectRequest putObjectRequest) throws StorageException { try { conn.putObject(putObjectRequest); } catch (RuntimeException e) { throw new StorageException("Error storing " + putObjectRequest.getKey(), e); } }
protected void handleRequest(HttpServletRequest req, HttpServletResponse resp, Object obj) { MassTruncateRequest mtr = (MassTruncateRequest) obj; try { if (!mtr.doTruncate(broker, breeder)) { throw new RestException("Truncation failed", HttpStatus.INTERNAL_SERVER_ERROR); } } catch (IllegalArgumentException e) { throw new RestException(e.getMessage(), HttpStatus.BAD_REQUEST); } catch (StorageException e) { throw new RestException(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } catch (GeoWebCacheException e) { throw new RestException(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); } }
public void putObject(PutObjectRequest putObjectRequest) throws StorageException { try { conn.putObject(putObjectRequest); } catch (RuntimeException e) { throw new StorageException("Error storing " + putObjectRequest.getKey(), e); } }
public boolean retrieve(long maxAge) throws GeoWebCacheException { try { if (isMetaTileCacheOnly) { boolean cached = storageBroker.getTransient((TileObject) stObj); this.setCacheResult(cached ? CacheResult.HIT : CacheResult.MISS); return cached; } boolean ret = storageBroker.get((TileObject) stObj); // Do we use expiration, and if so, is the tile recent enough ? if (ret && maxAge > 0 && stObj.getCreated() + maxAge < System.currentTimeMillis()) { ret = false; } if (ret) { this.setCacheResult(CacheResult.HIT); } else { this.setCacheResult(CacheResult.MISS); } return ret; } catch (StorageException se) { log.warn(se.getMessage()); return false; } }
private BlobStore store(String layerId) throws StorageException { LiveStore store; try { store = forLayer(layerId); } catch (GeoWebCacheException e) { throw new StorageException(e.getMessage(), e); } if (!store.config.isEnabled()) { throw new StorageException( "Attempted to use a blob store that's disabled: " + store.config.getName()); } return store.liveInstance; }
private ByteArrayInputStream toByteArray(final Resource blob) throws StorageException { final byte[] bytes; if (blob instanceof ByteArrayResource) { bytes = ((ByteArrayResource) blob).getContents(); } else { ByteArrayOutputStream out = new ByteArrayOutputStream((int) blob.getSize()); WritableByteChannel channel = Channels.newChannel(out); try { blob.transferTo(channel); } catch (IOException e) { throw new StorageException("Error copying blob contents", e); } bytes = out.toByteArray(); } ByteArrayInputStream input = new ByteArrayInputStream(bytes); return input; }
private ByteArrayInputStream toByteArray(final Resource blob) throws StorageException { final byte[] bytes; if (blob instanceof ByteArrayResource) { bytes = ((ByteArrayResource) blob).getContents(); } else { ByteArrayOutputStream out = new ByteArrayOutputStream((int) blob.getSize()); WritableByteChannel channel = Channels.newChannel(out); try { blob.transferTo(channel); } catch (IOException e) { throw new StorageException("Error copying blob contents", e); } bytes = out.toByteArray(); } ByteArrayInputStream input = new ByteArrayInputStream(bytes); return input; }