@Override public void addMetadataRecord(File input, String name) throws DataStoreException { try { File file = new File(fsPathDir, name); FileUtils.copyFile(input, file); } catch (IOException e) { LOG.error("Exception while adding metadata record file {} with name {}, {}", input, name, e); throw new DataStoreException("Could not add root record", e); } }
public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException { DataRecord record = getRecordIfStored(identifier); if (record != null) { return record; } else { throw new DataStoreException( "Record " + identifier + " does not exist"); } }
@Override public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException { DataRecord record = getRecordIfStored(identifier); if (record != null) { return record; } else { throw new DataStoreException( "Record " + identifier + " does not exist"); } }
@Override public long getLength(DataIdentifier identifier) throws DataStoreException { File file = getFile(identifier); if (file.isFile()) { return file.length(); } throw new DataStoreException("Could not length of dataIdentifier [" + identifier + "]"); }
public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException { DataRecord record = getRecordIfStored(identifier); if (record != null) { return record; } else { throw new DataStoreException( "Record " + identifier + " does not exist"); } }
public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException { DataRecord record = getRecordIfStored(identifier); if (record != null) { return record; } else { throw new DataStoreException( "Record " + identifier + " does not exist"); } }
@Override public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException { DataRecord record = getRecordIfStored(identifier); if (record != null) { return record; } else { throw new DataStoreException( "Record " + identifier + " does not exist"); } }
@Override public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException { long start = System.currentTimeMillis(); File file = getFile(identifier, fsPathDir); if (!file.exists() || !file.isFile()) { LOG.info("getRecord:Identifier [{}] not found. Took [{}] ms.", identifier, (System.currentTimeMillis() - start)); throw new DataStoreException("Identifier [" + identifier + "] not found."); } return new FSBackendDataRecord(this, identifier, file); }
@Override public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException { long start = System.currentTimeMillis(); File file = getFile(identifier, fsPathDir); if (!file.exists() || !file.isFile()) { LOG.info("getRecord:Identifier [{}] not found. Took [{}] ms.", identifier, (System.currentTimeMillis() - start)); throw new DataStoreException("Identifier [" + identifier + "] not found."); } return new FSBackendDataRecord(this, identifier, file); }
@Override public InputStream read(DataIdentifier identifier) throws DataStoreException { File file = getFile(identifier); try { return new LazyFileInputStream(file); } catch (IOException e) { throw new DataStoreException("Error opening input stream of " + file.getAbsolutePath(), e); } }
@Override public InputStream read(DataIdentifier identifier) throws DataStoreException { File file = getFile(identifier, fsPathDir); try { return new LazyFileInputStream(file); } catch (IOException e) { throw new DataStoreException("Error opening input stream of " + file.getAbsolutePath(), e); } }
@Override public InputStream read(DataIdentifier identifier) throws DataStoreException { File file = getFile(identifier, fsPathDir); try { return new LazyFileInputStream(file); } catch (IOException e) { throw new DataStoreException("Error opening input stream of " + file.getAbsolutePath(), e); } }
@Override public InputStream read(DataIdentifier identifier) throws DataStoreException { File file = getFile(identifier); try { return new LazyFileInputStream(file); } catch (IOException e) { throw new DataStoreException("Error opening input stream of " + file.getAbsolutePath(), e); } }
@Override public DataRecord addRecord(InputStream stream) throws DataStoreException { try { return writeStream(stream, new BlobOptions()); } catch (IOException e) { throw new DataStoreException(e); } }
public static CloudBlobContainer getBlobContainer(final String connectionString, final String containerName) throws DataStoreException { try { CloudBlobClient client = Utils.getBlobClient(connectionString); return client.getContainerReference(containerName); } catch (InvalidKeyException | URISyntaxException | StorageException e) { throw new DataStoreException(e); } }
@Override public InputStream read(DataIdentifier identifier) throws DataStoreException { try { return new FileInputStream(_backend.get(identifier)); } catch (FileNotFoundException e) { throw new DataStoreException(e); } }
@Override public DataRecord addRecord(InputStream stream) throws DataStoreException { try { return writeStream(stream, new BlobOptions()); } catch (IOException e) { throw new DataStoreException(e); } }
public void deleteFromCache(DataIdentifier identifier) throws DataStoreException { try { // order is important here recLenCache.remove(identifier); String fileName = getFileName(identifier); asyncWriteCache.delete(fileName); cache.delete(fileName); } catch (IOException ioe) { throw new DataStoreException(ioe); } }
public void write(String id, File f) throws DataStoreException { try { File move = getFile(id, root); move.getParentFile().mkdirs(); Files.copy(f, move); LOG.info("In TestCacheLoader after write [{}], [{}]", id, move); } catch (IOException e) { throw new DataStoreException(e); } }
@Override public void write(String id, File f) throws DataStoreException { if (count.get() == 0) { throw new DataStoreException("Error in writing blob"); } super.write(id, f); } };