@Override public HashMap<String, String> getMetadata() { return getBlob().getMetadata(); }
@Override public HashMap<String, String> getMetadata() { return getBlob().getMetadata(); }
/** * Validates that the log given is of the correct log type. * * @param current * the current log * @return whether or not the log is of the correct type. */ private boolean isCorrectLogType(ListBlobItem current) { HashMap<String, String> metadata = ((CloudBlob) current).getMetadata(); String logType = metadata.get("LogType"); if (logType == null) { return true; } if (this.operations.contains(LoggingOperations.READ) && logType.contains("read")) { return true; } if (this.operations.contains(LoggingOperations.WRITE) && logType.contains("write")) { return true; } if (this.operations.contains(LoggingOperations.DELETE) && logType.contains("delete")) { return true; } return false; }
/** * Validates that the log given is of the correct log type. * * @param current * the current log * @return whether or not the log is of the correct type. */ private boolean isCorrectLogType(ListBlobItem current) { HashMap<String, String> metadata = ((CloudBlob) current).getMetadata(); String logType = metadata.get("LogType"); if (logType == null) { return true; } if (this.operations.contains(LoggingOperations.READ) && logType.contains("read")) { return true; } if (this.operations.contains(LoggingOperations.WRITE) && logType.contains("write")) { return true; } if (this.operations.contains(LoggingOperations.DELETE) && logType.contains("delete")) { return true; } return false; }
/** * Sets up the original non page aligned size of the file from the PageBlob * from the meta-data. * * @throws StorageException */ private void setOriginalNonPageAlignedStreamSize() throws StorageException { try { pageBlob.downloadAttributes(); String size = pageBlob.getMetadata().get(ORIGINAL_SIZE_KEY); try { totalsize = Long.parseLong(size); sizeRemaining = totalsize; } catch (Exception e) { logger.error("Size meta-data missing."); } } catch (StorageException e) { this.lastError = new AzureIOException("Unable to download attributes from Page Blob.", e); throw e; } }
public String getNextName(String pp, long id) throws IOException { String pfx = pp + "/"; if (di == null) di = container.listBlobs(pp + "/").iterator(); while (di.hasNext()) { CloudBlob bi = (CloudBlob) di.next(); try { bi.downloadAttributes(); HashMap<String, String> md = bi.getMetadata(); boolean encrypt = Boolean.parseBoolean(md.get("encrypt")); String fname = EncyptUtils.decString(bi.getName().substring(pfx.length()), encrypt); return fname; /* * this.downloadFile(fname, new File(to.getPath() + File.separator + fname), * pp); */ } catch (Exception e) { throw new IOException(e); } } di = null; return null; }
@Override public ChunkData getNextChunck() throws IOException { try { if (!iter.hasNext()) { pool.returnObject(iContainer); return null; } else { CloudBlob bi = (CloudBlob) iter.next(); HashMap<String, String> md = bi.getMetadata(); boolean encrypt = Boolean.parseBoolean(md.get("encrypt")); byte[] nm = this.getHashBytes(bi.getName(), encrypt); int sz = Integer.parseInt(md.get("size")); int cl = Integer.parseInt(md.get("compressedsize")); ChunkData chk = new ChunkData(nm, 0); chk.cLen = sz; this.currentLength.addAndGet(chk.cLen); this.compressedLength.addAndGet(cl); return chk; } } catch (Exception e) { throw new IOException(e); } }
@Override public CompletableFuture<List<BaseLease>> getAllLeases() { CompletableFuture<List<BaseLease>> future = null; try { ArrayList<BaseLease> infos = new ArrayList<BaseLease>(); EnumSet<BlobListingDetails> details = EnumSet.of(BlobListingDetails.METADATA); Iterable<ListBlobItem> leaseBlobs = this.consumerGroupDirectory.listBlobs("", true, details, this.leaseOperationOptions, null); leaseBlobs.forEach((lbi) -> { CloudBlob blob = (CloudBlob)lbi; BlobProperties bp = blob.getProperties(); HashMap<String, String> metadata = blob.getMetadata(); Path p = Paths.get(lbi.getUri().getPath()); infos.add(new BaseLease(p.getFileName().toString(), metadata.get(AzureStorageCheckpointLeaseManager.METADATA_OWNER_NAME), (bp.getLeaseState() == LeaseState.LEASED))); }); future = CompletableFuture.completedFuture(infos); } catch (URISyntaxException | StorageException e) { TRACE_LOGGER.warn(this.hostContext.withHost("Failure while getting lease state details"), e); future = new CompletableFuture<List<BaseLease>>(); future.completeExceptionally(LoggingUtils.wrapException(e, EventProcessorHostActionStrings.GETTING_LEASE)); } return future; }
CloudBlob bi = (CloudBlob) it.next(); bi.downloadAttributes(); HashMap<String, String> md = bi.getMetadata(); SDFSLogger.getLog().debug("keysize=" + md.size()); for (String st : md.keySet()) {
CloudBlob bi = (CloudBlob) _iter.next(); bi.downloadAttributes(); HashMap<String, String> md = bi.getMetadata(); String vn = bi.getName().substring("volume/".length()); System.out.println(vn);
AzureSegmentArchiveReader(CloudBlobDirectory archiveDirectory, IOMonitor ioMonitor) throws IOException { this.archiveDirectory = archiveDirectory; this.ioMonitor = ioMonitor; long length = 0; for (CloudBlob blob : AzureUtilities.getBlobs(archiveDirectory).collect(Collectors.toList())) { Map<String, String> metadata = blob.getMetadata(); if (AzureBlobMetadata.isSegment(metadata)) { AzureSegmentArchiveEntry indexEntry = AzureBlobMetadata.toIndexEntry(metadata, (int) blob.getProperties().getLength()); index.put(new UUID(indexEntry.getMsb(), indexEntry.getLsb()), indexEntry); } length += blob.getProperties().getLength(); } this.length = length; }
AzureSegmentArchiveReader(CloudBlobDirectory archiveDirectory, IOMonitor ioMonitor) throws IOException { this.archiveDirectory = archiveDirectory; this.ioMonitor = ioMonitor; long length = 0; for (CloudBlob blob : AzureUtilities.getBlobs(archiveDirectory).collect(Collectors.toList())) { Map<String, String> metadata = blob.getMetadata(); if (AzureBlobMetadata.isSegment(metadata)) { AzureSegmentArchiveEntry indexEntry = AzureBlobMetadata.toIndexEntry(metadata, (int) blob.getProperties().getLength()); index.put(new UUID(indexEntry.getMsb(), indexEntry.getLsb()), indexEntry); } length += blob.getProperties().getLength(); } this.length = length; }
CloudBlob bi = (CloudBlob) container.getBlockBlobReference(key); bi.downloadAttributes(); HashMap<String, String> md = bi.getMetadata(); byte[] nm = new byte[(int) bi.getProperties().getLength()]; bi.downloadToByteArray(nm, 0, null, null, opContext); CloudBlob nbi = (CloudBlob) container.getBlockBlobReference(this.getClaimName(sid)); nbi.downloadAttributes(); md = nbi.getMetadata(); boolean changed = false; if (md.containsKey("deleted")) {
final Map<String, String> metadata = new HashMap<String, String>(blob.getMetadata()); final BlobProperties properties = blob.getProperties(); if(StringUtils.isNotBlank(properties.getCacheControl())) {