/** * Initializes a new instance of the BlobContainerAttributes class */ public BlobContainerAttributes() { this.setMetadata(new HashMap<String, String>()); this.setProperties(new BlobContainerProperties()); }
containerProperties.setEtag(BaseResponse.getEtag(request)); containerProperties.setLastModified(new Date(request.getLastModified())); containerAttributes.setMetadata(getMetadata(request)); containerProperties.setLeaseStatus(getLeaseStatus(request)); containerProperties.setLeaseState(getLeaseState(request)); containerProperties.setLeaseDuration(getLeaseDuration(request)); containerProperties.setPublicAccess(getPublicAccessLevel(request)); containerProperties.setHasImmutabilityPolicy(Boolean.parseBoolean(hasImmutability)); containerProperties.setHasLegalHold(Boolean.parseBoolean(hasLegalHold));
void updatePropertiesFromResponse(HttpURLConnection request) { // ETag this.getProperties().setEtag(request.getHeaderField(Constants.HeaderConstants.ETAG)); // Last Modified if (0 != request.getLastModified()) { final Calendar lastModifiedCalendar = Calendar.getInstance(Utility.LOCALE_US); lastModifiedCalendar.setTimeZone(Utility.UTC_ZONE); lastModifiedCalendar.setTime(new Date(request.getLastModified())); this.getProperties().setLastModified(lastModifiedCalendar.getTime()); } }
containerProperties.setEtag(BaseResponse.getEtag(request)); containerProperties.setLastModified(new Date(request.getLastModified())); containerAttributes.setMetadata(getMetadata(request)); containerProperties.setLeaseStatus(getLeaseStatus(request)); containerProperties.setLeaseState(getLeaseState(request)); containerProperties.setLeaseDuration(getLeaseDuration(request)); containerProperties.setPublicAccess(getPublicAccessLevel(request));
eTag = Strings.nullToEmpty(properties.getEtag()); if (properties.getLastModified() != null) { lastModified.setTime(properties.getLastModified());
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.elementStack.push(localName); if (BlobConstants.CONTAINER_ELEMENT.equals(localName)) { this.containerName = Constants.EMPTY_STRING; this.attributes = new BlobContainerAttributes(); this.attributes.getProperties().setPublicAccess(BlobContainerPublicAccessType.OFF); } }
/** * Check a container's existence * * @throws StorageException */ @Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudBlobContainerExists() throws StorageException { assertFalse(this.container.exists()); this.container.create(); assertTrue(this.container.exists()); assertNotNull(this.container.getProperties().getEtag()); this.container.delete(); assertFalse(this.container.exists()); }
private void getProperties(String currentNode, String value) throws ParseException, SAXException { this.attributes.getProperties().setLastModified(Utility.parseRFC1123DateFromStringInGMT(value)); this.attributes.getProperties().setEtag(Utility.formatETag(value)); this.attributes.getProperties().setLeaseStatus(tempStatus); final LeaseState tempState = LeaseState.parse(value); if (!tempState.equals(LeaseState.UNSPECIFIED)) { this.attributes.getProperties().setLeaseState(tempState); final LeaseDuration tempDuration = LeaseDuration.parse(value); if (!tempDuration.equals(LeaseDuration.UNSPECIFIED)) { this.attributes.getProperties().setLeaseDuration(tempDuration); final BlobContainerPublicAccessType tempAccessType = BlobContainerPublicAccessType.parse(value); if (!tempAccessType.equals(BlobContainerPublicAccessType.OFF)) { this.attributes.getProperties().setPublicAccess(tempAccessType);
eTag = Strings.nullToEmpty(properties.getEtag()); if (properties.getLastModified() != null) { lastModified.setTime(properties.getLastModified());
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { this.elementStack.push(localName); if (BlobConstants.CONTAINER_ELEMENT.equals(localName)) { this.containerName = Constants.EMPTY_STRING; this.attributes = new BlobContainerAttributes(); this.attributes.getProperties().setPublicAccess(BlobContainerPublicAccessType.OFF); } }
void updatePropertiesFromResponse(HttpURLConnection request) { // ETag this.getProperties().setEtag(request.getHeaderField(Constants.HeaderConstants.ETAG)); // Last Modified if (0 != request.getLastModified()) { final Calendar lastModifiedCalendar = Calendar.getInstance(Utility.LOCALE_US); lastModifiedCalendar.setTimeZone(Utility.UTC_ZONE); lastModifiedCalendar.setTime(new Date(request.getLastModified())); this.getProperties().setLastModified(lastModifiedCalendar.getTime()); } }
private void getProperties(String currentNode, String value) throws ParseException, SAXException { this.attributes.getProperties().setLastModified(Utility.parseRFC1123DateFromStringInGMT(value)); this.attributes.getProperties().setEtag(Utility.formatETag(value)); this.attributes.getProperties().setLeaseStatus(tempStatus); final LeaseState tempState = LeaseState.parse(value); if (!tempState.equals(LeaseState.UNSPECIFIED)) { this.attributes.getProperties().setLeaseState(tempState); final LeaseDuration tempDuration = LeaseDuration.parse(value); if (!tempDuration.equals(LeaseDuration.UNSPECIFIED)) { this.attributes.getProperties().setLeaseDuration(tempDuration); final BlobContainerPublicAccessType tempAccessType = BlobContainerPublicAccessType.parse(value); if (!tempAccessType.equals(BlobContainerPublicAccessType.OFF)) { this.attributes.getProperties().setPublicAccess(tempAccessType); this.attributes.getProperties().setHasImmutabilityPolicy(Boolean.parseBoolean(value)); this.attributes.getProperties().setHasLegalHold(Boolean.parseBoolean(value));
@Override public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException { ResultSegment<CloudBlobContainer> result; ResultContinuation token = null; try { final AttributedList<Path> containers = new AttributedList<Path>(); do { final BlobRequestOptions options = new BlobRequestOptions(); result = session.getClient().listContainersSegmented(null, ContainerListingDetails.NONE, preferences.getInteger("azure.listing.chunksize"), token, options, context); for(CloudBlobContainer container : result.getResults()) { final PathAttributes attributes = new PathAttributes(); attributes.setETag(container.getProperties().getEtag()); attributes.setModificationDate(container.getProperties().getLastModified().getTime()); containers.add(new Path(PathNormalizer.normalize(container.getName()), EnumSet.of(Path.Type.volume, Path.Type.directory), attributes)); } listener.chunk(directory, containers); token = result.getContinuationToken(); } while(result.getHasMoreResults()); return containers; } catch(StorageException e) { throw new AzureExceptionMappingService().map("Listing directory {0} failed", e, directory); } }
@Override public Void preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final BlobContainerAttributes attributes = BlobResponse.getBlobContainerAttributes( this.getConnection(), client.isUsePathStyleUris()); container.properties = attributes.getProperties(); container.name = attributes.getName(); if (accessType != null) { container.properties.setPublicAccess(accessType); } else { container.properties.setPublicAccess(BlobContainerPublicAccessType.OFF); } return null; } };
/** * Initializes a new instance of the BlobContainerAttributes class */ public BlobContainerAttributes() { this.setMetadata(new HashMap<String, String>()); this.setProperties(new BlobContainerProperties()); }
container.downloadAttributes(null, null, context); final BlobContainerProperties properties = container.getProperties(); attributes.setETag(properties.getEtag()); attributes.setModificationDate(properties.getLastModified().getTime()); return attributes;
@Override public Void preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_CREATED) { this.setNonExceptionedRetryableFailure(true); return null; } // Set attributes final BlobContainerAttributes attributes = BlobResponse.getBlobContainerAttributes( this.getConnection(), client.isUsePathStyleUris()); container.properties = attributes.getProperties(); container.name = attributes.getName(); if (accessType != null) { container.properties.setPublicAccess(accessType); } else { container.properties.setPublicAccess(BlobContainerPublicAccessType.OFF); } return null; } };
@Override public Void preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } container.updatePropertiesFromResponse(this.getConnection()); container.getProperties().setPublicAccess(permissions.getPublicAccess()); return null; } };
@Override public Void preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); return null; } container.updatePropertiesFromResponse(this.getConnection()); container.getProperties().setPublicAccess(permissions.getPublicAccess()); return null; } };
@Override public BlobContainerPermissions preProcessResponse(CloudBlobContainer container, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK) { this.setNonExceptionedRetryableFailure(true); } container.updatePropertiesFromResponse(this.getConnection()); final String aclString = BlobResponse.getAcl(this.getConnection()); final BlobContainerPermissions containerAcl = getContainerAcl(aclString); container.properties.setPublicAccess(containerAcl.getPublicAccess()); return containerAcl; }