public abstract class AbstractAtmosApi extends java.lang.Object implements AtmosApi
Modifier and Type | Field and Description |
---|---|
protected AtmosConfig |
config |
static java.lang.String |
DEFAULT_CONTENT_TYPE |
Constructor and Description |
---|
AbstractAtmosApi(AtmosConfig config) |
Modifier and Type | Method and Description |
---|---|
ObjectId |
createObject(ObjectIdentifier identifier,
java.lang.Object content,
java.lang.String contentType)
Creates a new object in the cloud with the specified identifier.
|
ObjectId |
createObject(java.lang.Object content,
java.lang.String contentType)
Creates a new object in the cloud.
|
void |
deleteAccessToken(java.net.URL url)
Deletes the specified access token.
|
GetAccessTokenResponse |
getAccessToken(java.net.URL url)
Retrieves details about the specified access token.
|
java.net.URL |
getShareableUrl(ObjectIdentifier identifier,
java.util.Date expirationDate)
Constructs a pre-signed URL to an object, which anyone can then use to retrieve the object.
|
java.net.URL |
getShareableUrl(ObjectIdentifier identifier,
java.util.Date expirationDate,
java.lang.String disposition)
Constructs a shareable URL with a specific content-disposition.
|
PreSignedRequest |
preSignRequest(Request request,
java.util.Date expiration)
Pre-signs a request with a specified expiration time.
|
<T> T |
readObject(ObjectIdentifier identifier,
java.lang.Class<T> objectType)
Reads an object's entire content from the cloud.
|
<T> T |
readObject(ObjectIdentifier identifier,
Range range,
java.lang.Class<T> objectType)
Reads an object's content from the cloud.
|
void |
updateObject(ObjectIdentifier identifier,
java.lang.Object content)
Updates an object's content in the cloud.
|
void |
updateObject(ObjectIdentifier identifier,
java.lang.Object content,
Range range)
Updates an object's content in the cloud.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
calculateServerClockSkew, createAccessToken, createDirectory, createDirectory, createObject, createSubtenant, createVersion, delete, deleteAccessToken, deleteUserMetadata, deleteVersion, execute, getAccessToken, getAcl, getObjectInfo, getObjectMetadata, getServiceInformation, getSystemMetadata, getUserMetadata, getUserMetadataNames, listAccessTokens, listDirectory, listMetadata, listObjects, listVersions, move, readObject, readObjectStream, restoreVersion, setAcl, setUserMetadata, updateObject
public static final java.lang.String DEFAULT_CONTENT_TYPE
protected AtmosConfig config
public AbstractAtmosApi(AtmosConfig config)
public ObjectId createObject(java.lang.Object content, java.lang.String contentType)
AtmosApi
createObject
in interface AtmosApi
content
- The initial content of the object. May be appended to later. May be null to create an
object with no content. The content object can be any object type that is supported by the
implementation.contentType
- the MIME type of the content. Optional, may be null. If null, defaults to
application/octet-stream.public ObjectId createObject(ObjectIdentifier identifier, java.lang.Object content, java.lang.String contentType)
AtmosApi
createObject
in interface AtmosApi
identifier
- The identifier to use for the new object. This may be an ObjectPath or an ObjectKey.content
- The initial content of the object. May be appended to later. May be null to create an
object with no content. The content object can be any object type that is supported by the
implementation.contentType
- the MIME type of the content. Optional, may be null. If null, defaults to
application/octet-stream.public <T> T readObject(ObjectIdentifier identifier, java.lang.Class<T> objectType) throws java.io.IOException
AtmosApi
readObject
in interface AtmosApi
identifier
- The identifier of the object to read. May be any ObjectIdentifier.objectType
- The type of object to return. This can be any object type supported by the implementation.java.io.IOException
- if an exception occurs while reading the object. Note that IOExceptions are generally
retried automatically (configured in AtmosConfig
).public <T> T readObject(ObjectIdentifier identifier, Range range, java.lang.Class<T> objectType) throws java.io.IOException
AtmosApi
readObject
in interface AtmosApi
identifier
- The identifier of the object to read. May be any ObjectIdentifier.range
- (optional) The range of bytes to read from the object. A null value will read the entire
object.objectType
- The type of object to return. This can be any object type supported by the implementation.java.io.IOException
- if an exception occurs while reading the object. Note that IOExceptions are generally
retried automatically (configured in AtmosConfig
).public void updateObject(ObjectIdentifier identifier, java.lang.Object content)
AtmosApi
updateObject
in interface AtmosApi
identifier
- The identifier of the object to update. May be any ObjectIdentifier.content
- The new content of the object. The content object can be any object type that is supported by
the implementation.public void updateObject(ObjectIdentifier identifier, java.lang.Object content, Range range)
AtmosApi
updateObject
in interface AtmosApi
identifier
- The identifier of the object to update. May be any ObjectIdentifier.content
- The new content of the object. The content object can be any object type that is supported by
the implementation.range
- (optional) The portion of the object to update (expressed as a range of bytes). A null value
will overwrite the entire object.public java.net.URL getShareableUrl(ObjectIdentifier identifier, java.util.Date expirationDate) throws java.net.MalformedURLException
AtmosApi
AtmosApi.createAccessToken(com.emc.atmos.api.request.CreateAccessTokenRequest)
.getShareableUrl
in interface AtmosApi
identifier
- The identifier of the object. Can be any ObjectIdentifier.expirationDate
- The date at which the generated URL will no longer be valid.java.net.MalformedURLException
- if the configured Atmos endpoint is syntactically invalid.public java.net.URL getShareableUrl(ObjectIdentifier identifier, java.util.Date expirationDate, java.lang.String disposition) throws java.net.MalformedURLException
AtmosApi
getShareableUrl
in interface AtmosApi
identifier
- The identifier of the object. Can be any ObjectIdentifier.expirationDate
- The date at which the generated URL will no longer be valid.disposition
- the value of the Content-Disposition header, e.g.
"attachment; filename=\"filename.txt\""java.net.MalformedURLException
- if the configured Atmos endpoint is syntactically invalid.public GetAccessTokenResponse getAccessToken(java.net.URL url)
AtmosApi
AtmosApi.getAccessToken(String)
.getAccessToken
in interface AtmosApi
url
- The URL of the access token.public void deleteAccessToken(java.net.URL url)
AtmosApi
AtmosApi.deleteAccessToken(String)
.deleteAccessToken
in interface AtmosApi
url
- The URL of the access token.public PreSignedRequest preSignRequest(Request request, java.util.Date expiration) throws java.net.MalformedURLException
AtmosApi
AtmosApi.execute(com.emc.atmos.api.request.PreSignedRequest, Class, Object)
method. This feature is useful
if you intend to serialize the pre-signed request to some other system which does not have access to Atmos
credentials.preSignRequest
in interface AtmosApi
request
- the request to pre-sign (can be executed at a later time)expiration
- the date at which the pre-signed request becomes invalid and will no longer be acceptedexpiration
java.net.MalformedURLException
- if the configured Atmos endpoint is syntactically invalid.