AccessCondition Class
- java.
lang. Object - com.
microsoft. azure. storage. AccessCondition
- com.
public class AccessCondition
Represents a set of access conditions to be used for operations against the storage services.
Constructor Summary
Constructor | Description |
---|---|
AccessCondition() |
Creates an instance of the class. |
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
applyAppendConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the access condition to the request. |
void |
applyConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the access conditions to the request. |
void |
applyLeaseConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the lease access condition to the request. |
void |
applySequenceConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the sequence number access conditions to the request. |
void |
applySourceConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the source access conditions to the request. |
Access |
generateEmptyCondition()
Generates a new empty AccessCondition. For more information, see Specifying Conditional Headers for Blob Service Operations. |
Access |
generateIfExistsCondition()
Returns an access condition such that an operation will be performed only if the resource exists on the service. Setting this access condition modifies the request to include the HTTP If-Match conditional header. For more information, see Specifying Conditional Headers for Blob Service Operations. |
Access |
generateIfMatchCondition(final String etag)
Returns an access condition such that an operation will be performed only if the resource's ETag value matches the specified ETag value. Setting this access condition modifies the request to include the HTTP If-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource matches the specified ETag. For more information, see Specifying Conditional Headers for Blob Service Operations. |
Access |
generateIfModifiedSinceCondition(final Date lastMotified)
Returns an access condition such that an operation will be performed only if the resource has been modified since the specified time. Setting this access condition modifies the request to include the HTTP If-Modified-Since conditional header. If this access condition is set, the operation is performed only if the resource has been modified since the specified time. For more information, see Specifying Conditional Headers for Blob Service Operations. |
Access |
generateIfNoneMatchCondition(final String etag)
Returns an access condition such that an operation will be performed only if the resource's ETag value does not match the specified ETag value. Setting this access condition modifies the request to include the HTTP If-None-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource does not match the specified ETag. For more information, see Specifying Conditional Headers for Blob Service Operations. |
Access |
generateIfNotExistsCondition()
Returns an access condition such that an operation will be performed only if the resource does not exist on the service. Setting this access condition modifies the request to include the HTTP If-None-Match conditional header. For more information, see Specifying Conditional Headers for Blob Service Operations. |
Access |
generateIfNotModifiedSinceCondition(final Date lastMotified)
Returns an access condition such that an operation will be performed only if the resource has not been modified since the specified time. Setting this access condition modifies the request to include the HTTP If-Unmodified-Since conditional header. If this access condition is set, the operation is performed only if the resource has not been modified since the specified time. For more information, see Specifying Conditional Headers for Blob Service Operations. |
Access |
generateIfSequenceNumberEqualCondition(long sequenceNumber)
Returns an access condition such that an operation will be performed only if resource's current sequence number is equal to the specified value. This condition only applies to page blobs. |
Access |
generateIfSequenceNumberLessThanCondition(long sequenceNumber)
Returns an access condition such that an operation will be performed only if resource's current sequence number is less than the specified value. This condition only applies to page blobs. |
Access |
generateIfSequenceNumberLessThanOrEqualCondition(long sequenceNumber)
Returns an access condition such that an operation will be performed only if resource's current sequence number is less than or equal to the specified value. This condition only applies to page blobs. |
Access |
generateLeaseCondition(final String leaseID)
Returns an access condition such that an operation will be performed only if the resource is accessible under the specified lease ID. For more information, see Specifying Conditional Headers for Blob Service Operations. |
Long |
getIfAppendPositionEqual()
Gets the value for a conditional header used only for append operations. A number indicating the byte offset to check for. The append will succeed only if the end position is equal to this number. |
String |
getIfMatch()
Gets the ETag when the If-Match condition is set. |
Long |
getIfMaxSizeLessThanOrEqual()
Gets the value for a conditional header used only for append operations. A number that indicates the maximum length in bytes to restrict the blob to when committing the block. |
Date |
getIfModifiedSinceDate()
Gets the If-Modified-Since date. |
String |
getIfNoneMatch()
Gets the ETag when the If-None-Match condition is set. |
Long |
getIfSequenceNumberEqual()
Gets the sequence number when the sequence number equal condition is set. This condition is only applicable to page blobs. |
Long |
getIfSequenceNumberLessThan()
Gets the sequence number when the sequence number less than condition is set. This condition is only applicable to page blobs. |
Long |
getIfSequenceNumberLessThanOrEqual()
Gets the sequence number when the sequence number less than or equal condition is set. This condition is only applicable to page blobs. |
Date |
getIfUnmodifiedSinceDate()
Gets the If-Unmodified-Since date. |
String |
getLeaseID()
Gets the lease ID. |
void |
setIfAppendPositionEqual(Long ifAppendPositionEqual)
Sets the value for a conditional header used only for append operations. A number indicating the byte offset to check for. The append will succeed only if the end position is equal to this number. |
void |
setIfMatch(String etag)
Sets the ETag for the If-Match condition. |
void |
setIfMaxSizeLessThanOrEqual(Long ifMaxSizeLessThanOrEqual)
Sets the value for a conditional header used only for append operations. A number that indicates the maximum length in bytes to restrict the blob to when committing the block. |
void |
setIfModifiedSinceDate(Date ifModifiedSinceDate)
Sets the If-Modified-Since date. |
void |
setIfNoneMatch(String etag)
Sets the ETag for the If-None-Match condition. |
void |
setIfSequenceNumberEqual(Long sequenceNumber)
Sets the sequence number for the sequence number equal to condition. This condition is only applicable to page blobs. |
void |
setIfSequenceNumberLessThan(Long sequenceNumber)
Sets the sequence number for the sequence number less than condition. This condition is only applicable to page blobs. |
void |
setIfSequenceNumberLessThanOrEqual(Long sequenceNumber)
Sets the sequence number for the sequence number less than or equal to condition. This condition is only applicable to page blobs. |
void |
setIfUnmodifiedSinceDate(Date ifUnmodifiedSinceDate)
Sets the If-Unmodified-Since date. |
void |
setLeaseID(String leaseID)
Gets the lease ID. |
boolean |
verifyConditional(final String etag, final Date lastModified)
RESERVED FOR INTERNAL USE. Verifies the condition is satisfied. |
Constructor Details
AccessCondition
public AccessCondition()
Creates an instance of the class.
Method Details
applyAppendConditionToRequest
public void applyAppendConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the access condition to the request.
Parameters:
java.net.HttpURLConnection
object that represents the request to which the condition is being applied.
applyConditionToRequest
public void applyConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the access conditions to the request.
Parameters:
java.net.HttpURLConnection
object that represents the request to which the condition is being applied.
applyLeaseConditionToRequest
public void applyLeaseConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the lease access condition to the request.
Parameters:
java.net.HttpURLConnection
object that represents the request to which the condition is being applied.
applySequenceConditionToRequest
public void applySequenceConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the sequence number access conditions to the request.
Parameters:
java.net.HttpURLConnection
object that represents the request to which the condition is being applied.
applySourceConditionToRequest
public void applySourceConditionToRequest(final HttpURLConnection request)
RESERVED FOR INTERNAL USE. Applies the source access conditions to the request.
Parameters:
java.net.HttpURLConnection
object that represents the request to which the condition is being applied.
generateEmptyCondition
public static AccessCondition generateEmptyCondition()
Generates a new empty AccessCondition.
For more information, see Specifying Conditional Headers for Blob Service Operations.
Returns:
AccessCondition
object that has no conditions set.generateIfExistsCondition
public static AccessCondition generateIfExistsCondition()
Returns an access condition such that an operation will be performed only if the resource exists on the service.
Setting this access condition modifies the request to include the HTTP If-Match conditional header.
For more information, see Specifying Conditional Headers for Blob Service Operations.
Returns:
AccessCondition
object that represents the if exists condition.generateIfMatchCondition
public static AccessCondition generateIfMatchCondition(final String etag)
Returns an access condition such that an operation will be performed only if the resource's ETag value matches the specified ETag value.
Setting this access condition modifies the request to include the HTTP If-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource matches the specified ETag.
For more information, see Specifying Conditional Headers for Blob Service Operations.
Parameters:
String
that represents the ETag value to check.
Returns:
AccessCondition
object that represents the If-Match condition.generateIfModifiedSinceCondition
public static AccessCondition generateIfModifiedSinceCondition(final Date lastMotified)
Returns an access condition such that an operation will be performed only if the resource has been modified since the specified time.
Setting this access condition modifies the request to include the HTTP If-Modified-Since conditional header. If this access condition is set, the operation is performed only if the resource has been modified since the specified time.
For more information, see Specifying Conditional Headers for Blob Service Operations.
Parameters:
java.util.Date
object that represents the last-modified time to check for the resource.
Returns:
AccessCondition
object that represents the If-Modified-Since condition.generateIfNoneMatchCondition
public static AccessCondition generateIfNoneMatchCondition(final String etag)
Returns an access condition such that an operation will be performed only if the resource's ETag value does not match the specified ETag value.
Setting this access condition modifies the request to include the HTTP If-None-Match conditional header. If this access condition is set, the operation is performed only if the ETag of the resource does not match the specified ETag.
For more information, see Specifying Conditional Headers for Blob Service Operations.
Parameters:
String
that represents the ETag value to check.
Returns:
AccessCondition
object that represents the If-None-Match condition.generateIfNotExistsCondition
public static AccessCondition generateIfNotExistsCondition()
Returns an access condition such that an operation will be performed only if the resource does not exist on the service.
Setting this access condition modifies the request to include the HTTP If-None-Match conditional header.
For more information, see Specifying Conditional Headers for Blob Service Operations.
Returns:
AccessCondition
object that represents the if not exists condition.generateIfNotModifiedSinceCondition
public static AccessCondition generateIfNotModifiedSinceCondition(final Date lastMotified)
Returns an access condition such that an operation will be performed only if the resource has not been modified since the specified time.
Setting this access condition modifies the request to include the HTTP If-Unmodified-Since conditional header. If this access condition is set, the operation is performed only if the resource has not been modified since the specified time.
For more information, see Specifying Conditional Headers for Blob Service Operations.
Parameters:
java.util.Date
object that represents the last-modified time to check for the resource.
Returns:
AccessCondition
object that represents the If-Unmodified-Since condition.generateIfSequenceNumberEqualCondition
public static AccessCondition generateIfSequenceNumberEqualCondition(long sequenceNumber)
Returns an access condition such that an operation will be performed only if resource's current sequence number is equal to the specified value. This condition only applies to page blobs.
Parameters:
Returns:
AccessCondition
object that represents the If-Sequence-Number-EQ condition.generateIfSequenceNumberLessThanCondition
public static AccessCondition generateIfSequenceNumberLessThanCondition(long sequenceNumber)
Returns an access condition such that an operation will be performed only if resource's current sequence number is less than the specified value. This condition only applies to page blobs.
Parameters:
Returns:
AccessCondition
object that represents the If-Sequence-Number-LT condition.generateIfSequenceNumberLessThanOrEqualCondition
public static AccessCondition generateIfSequenceNumberLessThanOrEqualCondition(long sequenceNumber)
Returns an access condition such that an operation will be performed only if resource's current sequence number is less than or equal to the specified value. This condition only applies to page blobs.
Parameters:
Returns:
AccessCondition
object that represents the If-Sequence-Number-LE condition.generateLeaseCondition
public static AccessCondition generateLeaseCondition(final String leaseID)
Returns an access condition such that an operation will be performed only if the resource is accessible under the specified lease ID.
For more information, see Specifying Conditional Headers for Blob Service Operations.
Parameters:
Returns:
AccessCondition
object that represents the lease condition.getIfAppendPositionEqual
public Long getIfAppendPositionEqual()
Gets the value for a conditional header used only for append operations. A number indicating the byte offset to check for. The append will succeed only if the end position is equal to this number.
Returns:
null
if no condition exists.getIfMatch
public String getIfMatch()
Gets the ETag when the If-Match condition is set.
Returns:
getIfMaxSizeLessThanOrEqual
public Long getIfMaxSizeLessThanOrEqual()
Gets the value for a conditional header used only for append operations. A number that indicates the maximum length in bytes to restrict the blob to when committing the block.
Returns:
null
if no condition exists.getIfModifiedSinceDate
public Date getIfModifiedSinceDate()
Gets the If-Modified-Since date.
Returns:
java.util.Date
object that represents the If-Modified-Since date.getIfNoneMatch
public String getIfNoneMatch()
Gets the ETag when the If-None-Match condition is set.
Returns:
getIfSequenceNumberEqual
public Long getIfSequenceNumberEqual()
Gets the sequence number when the sequence number equal condition is set. This condition is only applicable to page blobs.
Returns:
null
getIfSequenceNumberLessThan
public Long getIfSequenceNumberLessThan()
Gets the sequence number when the sequence number less than condition is set. This condition is only applicable to page blobs.
Returns:
null
getIfSequenceNumberLessThanOrEqual
public Long getIfSequenceNumberLessThanOrEqual()
Gets the sequence number when the sequence number less than or equal condition is set. This condition is only applicable to page blobs.
Returns:
null
getIfUnmodifiedSinceDate
public Date getIfUnmodifiedSinceDate()
Gets the If-Unmodified-Since date.
Returns:
java.util.Date
object that represents the If-Unmodified-Since date.getLeaseID
public String getLeaseID()
Gets the lease ID.
Returns:
setIfAppendPositionEqual
public void setIfAppendPositionEqual(Long ifAppendPositionEqual)
Sets the value for a conditional header used only for append operations. A number indicating the byte offset to check for. The append will succeed only if the end position is equal to this number.
Parameters:
null
if no condition exists.
setIfMatch
public void setIfMatch(String etag)
Sets the ETag for the If-Match condition.
Parameters:
setIfMaxSizeLessThanOrEqual
public void setIfMaxSizeLessThanOrEqual(Long ifMaxSizeLessThanOrEqual)
Sets the value for a conditional header used only for append operations. A number that indicates the maximum length in bytes to restrict the blob to when committing the block.
Parameters:
null
if no condition exists.
setIfModifiedSinceDate
public void setIfModifiedSinceDate(Date ifModifiedSinceDate)
Sets the If-Modified-Since date.
Parameters:
java.util.Date
object that represents the If-Modified-Since to set.
setIfNoneMatch
public void setIfNoneMatch(String etag)
Sets the ETag for the If-None-Match condition.
Parameters:
setIfSequenceNumberEqual
public void setIfSequenceNumberEqual(Long sequenceNumber)
Sets the sequence number for the sequence number equal to condition. This condition is only applicable to page blobs.
Parameters:
setIfSequenceNumberLessThan
public void setIfSequenceNumberLessThan(Long sequenceNumber)
Sets the sequence number for the sequence number less than condition. This condition is only applicable to page blobs.
Parameters:
setIfSequenceNumberLessThanOrEqual
public void setIfSequenceNumberLessThanOrEqual(Long sequenceNumber)
Sets the sequence number for the sequence number less than or equal to condition. This condition is only applicable to page blobs.
Parameters:
setIfUnmodifiedSinceDate
public void setIfUnmodifiedSinceDate(Date ifUnmodifiedSinceDate)
Sets the If-Unmodified-Since date.
Parameters:
java.util.Date
object that represents the If-Unmodified-Since to set.
setLeaseID
public void setLeaseID(String leaseID)
Gets the lease ID.
Parameters:
verifyConditional
public boolean verifyConditional(final String etag, final Date lastModified)
RESERVED FOR INTERNAL USE. Verifies the condition is satisfied.
Parameters:
String
that represents the ETag to check.
java.util.Date
object that represents the last modified date/time.
Returns:
true
if the condition is satisfied; otherwise, false
.