public class EsuApiJerseyAdapter extends AbstractEsuRestApi
context, host, port, proto, readChecksum, secret, uid, unicodeEnabled
Constructor and Description |
---|
EsuApiJerseyAdapter(AtmosConfig config) |
Modifier and Type | Method and Description |
---|---|
long |
calculateServerOffset()
Makes a request to the server to get the value of the response Date
header.
|
ObjectId |
createObjectFromSegment(Acl acl,
MetadataList metadata,
BufferSegment data,
java.lang.String mimeType,
Checksum checksum)
Creates a new object in the cloud using a BufferSegment.
|
ObjectId |
createObjectFromSegmentOnPath(ObjectPath path,
Acl acl,
MetadataList metadata,
BufferSegment data,
java.lang.String mimeType,
Checksum checksum)
Creates a new object in the cloud using a BufferSegment on the
given path.
|
ObjectId |
createObjectFromStream(Acl acl,
MetadataList metadata,
java.io.InputStream data,
long length,
java.lang.String mimeType)
Creates a new object in the cloud.
|
ObjectId |
createObjectFromStreamOnPath(ObjectPath path,
Acl acl,
MetadataList metadata,
java.io.InputStream data,
long length,
java.lang.String mimeType)
Creates a new object in the cloud.
|
ObjectId |
createObjectWithKeyFromSegment(java.lang.String keyPool,
java.lang.String key,
Acl acl,
MetadataList metadata,
BufferSegment data,
java.lang.String mimeType,
Checksum checksum)
Creates a new object in the cloud using a BufferSegment.
|
ObjectId |
createObjectWithKeyFromStream(java.lang.String keyPool,
java.lang.String key,
Acl acl,
MetadataList metadata,
java.io.InputStream data,
long length,
java.lang.String mimeType)
Creates a new object in the cloud.
|
void |
deleteObject(Identifier id)
Deletes an object from the cloud.
|
void |
deleteObjectWithKey(java.lang.String keyPool,
java.lang.String key)
Deletes an object from the cloud.
|
void |
deleteUserMetadata(Identifier id,
MetadataTags tags)
Deletes metadata items from an object.
|
void |
deleteVersion(ObjectId id)
Deletes a version of an object from the cloud.
|
Acl |
getAcl(Identifier id)
Returns an object's ACL
|
ObjectMetadata |
getAllMetadata(Identifier id)
Returns all of an object's metadata and its ACL in
one call.
|
ObjectMetadata |
getAllMetadata(java.lang.String keyPool,
java.lang.String key)
Returns all of an object's metadata and its ACL in
one call.
|
MetadataTags |
getListableTags(MetadataTag tag)
Returns a list of the tags that are listable the current user's tennant.
|
MetadataTags |
getListableTags(java.lang.String tag)
Returns a list of the tags that are listable the current user's tennant.
|
ObjectInfo |
getObjectInfo(Identifier id)
Get information about an object's state including
replicas, expiration, and retention.
|
ServiceInformation |
getServiceInformation()
Gets the current Atmos server information.
|
MetadataList |
getSystemMetadata(Identifier id,
MetadataTags tags)
Fetches the system metadata for the object.
|
MetadataList |
getSystemMetadata(java.lang.String keyPool,
java.lang.String key,
MetadataTags tags)
Fetches the system metadata for the object.
|
MetadataList |
getUserMetadata(Identifier id,
MetadataTags tags)
Fetches the user metadata for the object.
|
void |
hardLink(ObjectPath source,
ObjectPath target)
Unsupported.
|
java.util.List<DirectoryEntry> |
listDirectory(ObjectPath path,
ListOptions options)
Lists the contents of a directory.
|
java.util.List<ObjectResult> |
listObjects(java.lang.String tag,
ListOptions options)
Lists all objects with the given tag.
|
MetadataTags |
listUserMetadataTags(Identifier id)
Returns the list of user metadata tags assigned to the object.
|
java.util.List<Identifier> |
listVersions(Identifier id)
Lists the versions of an object.
|
java.util.List<Version> |
listVersions(ObjectId id,
ListOptions options)
Lists the versions of an object.
|
java.util.List<ObjectId> |
queryObjects(java.lang.String xquery)
Executes a query for objects matching the specified XQuery string.
|
byte[] |
readObject(Identifier id,
Extent extent,
byte[] buffer,
Checksum checksum)
Reads an object's content.
|
java.io.InputStream |
readObjectStream(Identifier id,
Extent extent)
Reads an object's content and returns an InputStream to read the content.
|
java.io.InputStream |
readObjectStreamWithKey(java.lang.String keyPool,
java.lang.String key,
Extent extent)
Reads an object's content and returns an InputStream to read the content.
|
byte[] |
readObjectWithKey(java.lang.String keyPool,
java.lang.String key,
Extent extent,
byte[] buffer,
Checksum checksum)
Reads an object's content.
|
void |
rename(ObjectPath source,
ObjectPath destination,
boolean force)
Renames a file or directory within the namespace.
|
void |
restoreVersion(ObjectId id,
ObjectId vId)
Restores a version of an object to the base version (i.e.
|
void |
setAcl(Identifier id,
Acl acl)
Sets (overwrites) the ACL on the object.
|
void |
setUserMetadata(Identifier id,
MetadataList metadata)
Writes the metadata into the object.
|
void |
updateObjectFromSegment(Identifier id,
Acl acl,
MetadataList metadata,
Extent extent,
BufferSegment data,
java.lang.String mimeType,
Checksum checksum)
Updates an object in the cloud using a portion of a buffer.
|
void |
updateObjectFromStream(Identifier id,
Acl acl,
MetadataList metadata,
Extent extent,
java.io.InputStream data,
long length,
java.lang.String mimeType)
Updates an object in the cloud.
|
void |
updateObjectWithKeyFromSegment(java.lang.String keyPool,
java.lang.String key,
Acl acl,
MetadataList metadata,
Extent extent,
BufferSegment data,
java.lang.String mimeType,
Checksum checksum)
Updates an object in the cloud using a portion of a buffer.
|
void |
updateObjectWithKeyFromStream(java.lang.String keyPool,
java.lang.String key,
Acl acl,
MetadataList metadata,
Extent extent,
java.io.InputStream data,
long length,
java.lang.String mimeType)
Updates an object in the cloud.
|
ObjectId |
versionObject(Identifier id)
Creates a new immutable version of an object.
|
buildUrl, createObject, createObject, createObjectFromSegment, createObjectFromSegmentOnPath, createObjectOnPath, createObjectOnPath, createObjectWithKey, createObjectWithKey, createObjectWithKeyFromSegment, decodeUtf8, encodeUtf8, formatTag, getContext, getDateHeader, getObjectId, getProtocol, getResourcePath, getServerOffset, getShareableUrl, getShareableUrl, isReadChecksum, isUnicodeEnabled, join, listDirectory, listObjects, listObjects, listObjects, listObjectsWithMetadata, listObjectsWithMetadata, normalizeSpace, parseDirectoryListing, parseObjectList, parseObjectListWithMetadata, parseServiceInformation, parseVersionList, parseVersionListLong, processAcl, processMetadata, processTags, readAcl, readMetadata, readObject, readObjectWithKey, readStream, readTags, setContext, setProtocol, setReadChecksum, setServerOffset, setUnicodeEnabled, sign, sign, silentClose, updateObject, updateObject, updateObjectFromSegment, updateObjectWithKey, updateObjectWithKey, updateObjectWithKeyFromSegment
public EsuApiJerseyAdapter(AtmosConfig config) throws java.net.URISyntaxException, java.io.UnsupportedEncodingException, javax.xml.bind.JAXBException
java.net.URISyntaxException
java.io.UnsupportedEncodingException
javax.xml.bind.JAXBException
public long calculateServerOffset()
AbstractEsuRestApi
calculateServerOffset
in class AbstractEsuRestApi
public ObjectId createObjectFromStream(Acl acl, MetadataList metadata, java.io.InputStream data, long length, java.lang.String mimeType)
EsuApi
acl
- Access control list for the new object. May be null
to use a default ACLmetadata
- Metadata for the new object. May be null for
no metadata.data
- The initial contents of the object. May be appended
to later. The stream will NOT be closed at the end of the request.length
- The length of the stream in bytes. If the stream
is longer than the length, only length bytes will be written. If
the stream is shorter than the length, an error will occur.mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.public ObjectId createObjectFromStreamOnPath(ObjectPath path, Acl acl, MetadataList metadata, java.io.InputStream data, long length, java.lang.String mimeType)
EsuApi
path
- The path to create the object on.acl
- Access control list for the new object. May be null
to use a default ACLmetadata
- Metadata for the new object. May be null for
no metadata.data
- The initial contents of the object. May be appended
to later. The stream will NOT be closed at the end of the request.length
- The length of the stream in bytes. If the stream
is longer than the length, only length bytes will be written. If
the stream is shorter than the length, an error will occur.mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.public ObjectId createObjectFromSegment(Acl acl, MetadataList metadata, BufferSegment data, java.lang.String mimeType, Checksum checksum)
EsuApi
acl
- Access control list for the new object. May be null
to use a default ACLmetadata
- Metadata for the new object. May be null for
no metadata.data
- The initial contents of the object. May be appended
to later. May be null to create an object with no content.mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.checksum
- if not null, use the Checksum object to compute
the checksum for the create object request. If appending
to the object with subsequent requests, use the same
checksum object for each request.public ObjectId createObjectFromSegmentOnPath(ObjectPath path, Acl acl, MetadataList metadata, BufferSegment data, java.lang.String mimeType, Checksum checksum)
EsuApi
path
- the path to create the object on.acl
- Access control list for the new object. May be null
to use a default ACLmetadata
- Metadata for the new object. May be null for
no metadata.data
- The initial contents of the object. May be appended
to later. May be null to create an object with no content.mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.checksum
- if not null, use the Checksum object to compute
the checksum for the create object request. If appending
to the object with subsequent requests, use the same
checksum object for each request.public void updateObjectFromStream(Identifier id, Acl acl, MetadataList metadata, Extent extent, java.io.InputStream data, long length, java.lang.String mimeType)
EsuApi
id
- The ID of the object to updateacl
- Access control list for the new object. Optional, default
is NULL to leave the ACL unchanged.metadata
- Metadata list for the new object. Optional,
default is NULL for no changes to the metadata.extent
- portion of the object to update. May be null to indicate
the whole object is to be replaced. If not null, the extent size must
match the data size.data
- The new contents of the object. May be appended
to later. Optional, default is NULL (no content changes).length
- The length of the stream in bytes. If the stream
is longer than the length, only length bytes will be written. If
the stream is shorter than the length, an error will occur.mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.public void updateObjectFromSegment(Identifier id, Acl acl, MetadataList metadata, Extent extent, BufferSegment data, java.lang.String mimeType, Checksum checksum)
EsuApi
id
- The ID of the object to updateacl
- Access control list for the new object. Optional, default
is NULL to leave the ACL unchanged.metadata
- Metadata list for the new object. Optional,
default is NULL for no changes to the metadata.extent
- portion of the object to update. May be null to indicate
the whole object is to be replaced. If not null, the extent size must
match the data size.data
- The new contents of the object. May be appended
to later. Optional, default is NULL (no content changes).mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.checksum
- if not null, use the Checksum object to compute
the checksum for the update object request. If appending
to the object with subsequent requests, use the same
checksum object for each request.public void setUserMetadata(Identifier id, MetadataList metadata)
EsuApi
id
- the identifier of the object to updatemetadata
- metadata to write to the object.public void setAcl(Identifier id, Acl acl)
EsuApi
id
- the identifier of the object to change the ACL on.acl
- the new ACL for the object.public void deleteObject(Identifier id)
EsuApi
id
- the identifier of the object to delete.public void deleteVersion(ObjectId id)
EsuApi
id
- the identifier of the object to delete.public MetadataList getUserMetadata(Identifier id, MetadataTags tags)
EsuApi
id
- the identifier of the object whose user metadata
to fetch.tags
- A list of user metadata tags to fetch. Optional. If null,
all user metadata will be fetched.public MetadataList getSystemMetadata(Identifier id, MetadataTags tags)
EsuApi
id
- the identifier of the object whose system metadata
to fetch.tags
- A list of system metadata tags to fetch. Optional.
Default value is null to fetch all system metadata.public byte[] readObject(Identifier id, Extent extent, byte[] buffer, Checksum checksum)
EsuApi
id
- the identifier of the object whose content to read.extent
- the portion of the object data to read. Optional.
Default is null to read the entire object.buffer
- the buffer to use to read the extent. Must be large
enough to read the response or an error will be thrown. If null,
a buffer will be allocated to hold the response data. If you pass
a buffer that is larger than the extent, only extent.getSize() bytes
will be valid.checksum
- if not null, the given checksum object will be used
to verify checksums during the read operation. Note that only erasure
coded objects will return checksums *and* if you're reading the object
in chunks, you'll have to read the data back sequentially to keep
the checksum consistent. If the read operation does not return
a checksum from the server, the checksum operation will be skipped.public java.io.InputStream readObjectStream(Identifier id, Extent extent)
EsuApi
id
- the identifier of the object whose content to read.extent
- the portion of the object data to read. Optional.
Default is null to read the entire object.public Acl getAcl(Identifier id)
EsuApi
id
- the identifier of the object whose ACL to readpublic void deleteUserMetadata(Identifier id, MetadataTags tags)
EsuApi
id
- the identifier of the object whose metadata to
delete.tags
- the list of metadata tags to delete.public java.util.List<Identifier> listVersions(Identifier id)
EsuApi
id
- the object whose versions to list.public java.util.List<Version> listVersions(ObjectId id, ListOptions options)
EsuApi
id
- the object whose versions to list.public ObjectId versionObject(Identifier id)
EsuApi
id
- the object to versionpublic java.util.List<ObjectResult> listObjects(java.lang.String tag, ListOptions options)
EsuApi
tag
- the tag to search foroptions
- options for returning the listpublic MetadataTags getListableTags(MetadataTag tag)
EsuApi
tag
- optional. If specified, the list will be limited to the tags
under the specified tag. If null, only top level tags will be returned.public MetadataTags getListableTags(java.lang.String tag)
EsuApi
tag
- optional. If specified, the list will be limited to the tags
under the specified tag. If null, only top level tags will be returned.public MetadataTags listUserMetadataTags(Identifier id)
EsuApi
id
- the object whose metadata tags to listpublic java.util.List<ObjectId> queryObjects(java.lang.String xquery)
EsuApi
xquery
- the XQuery string to execute against the cloud.public java.util.List<DirectoryEntry> listDirectory(ObjectPath path, ListOptions options)
EsuApi
path
- the path to list. Must be a directory.options
- options for returning the list.public ObjectMetadata getAllMetadata(Identifier id)
EsuApi
id
- the object's identifier.public void rename(ObjectPath source, ObjectPath destination, boolean force)
EsuApi
source
- The file or directory to renamedestination
- The new path for the file or directoryforce
- If true, the desination file or
directory will be overwritten. Directories must be empty to be
overwritten. Also note that overwrite operations on files are
not synchronous; a delay may be required before the object is
available at its destination.public void restoreVersion(ObjectId id, ObjectId vId)
EsuApi
id
- Base object ID (target of the restore)vId
- Version object ID to restorepublic ServiceInformation getServiceInformation()
EsuApi
public ObjectInfo getObjectInfo(Identifier id)
EsuApi
id
- the object identifierpublic void hardLink(ObjectPath source, ObjectPath target)
EsuApi
public ObjectId createObjectWithKeyFromSegment(java.lang.String keyPool, java.lang.String key, Acl acl, MetadataList metadata, BufferSegment data, java.lang.String mimeType, Checksum checksum)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.acl
- Access control list for the new object. May be null
to use a default ACLmetadata
- Metadata for the new object. May be null for
no metadata.data
- The initial contents of the object. May be appended
to later. May be null to create an object with no content.mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.checksum
- if not null, use the Checksum object to compute
the checksum for the create object request. If appending
to the object with subsequent requests, use the same
checksum object for each request.public ObjectId createObjectWithKeyFromStream(java.lang.String keyPool, java.lang.String key, Acl acl, MetadataList metadata, java.io.InputStream data, long length, java.lang.String mimeType)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.acl
- Access control list for the new object. May be null
to use a default ACLmetadata
- Metadata for the new object. May be null for
no metadata.data
- The initial contents of the object. May be appended
to later. The stream will NOT be closed at the end of the request.length
- The length of the stream in bytes. If the stream
is longer than the length, only length bytes will be written. If
the stream is shorter than the length, an error will occur.mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.public void deleteObjectWithKey(java.lang.String keyPool, java.lang.String key)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.public ObjectMetadata getAllMetadata(java.lang.String keyPool, java.lang.String key)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.public MetadataList getSystemMetadata(java.lang.String keyPool, java.lang.String key, MetadataTags tags)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.tags
- A list of system metadata tags to fetch. Optional.
Default value is null to fetch all system metadata.public byte[] readObjectWithKey(java.lang.String keyPool, java.lang.String key, Extent extent, byte[] buffer, Checksum checksum)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.extent
- the portion of the object data to read. Optional.
Default is null to read the entire object.buffer
- the buffer to use to read the extent. Must be large
enough to read the response or an error will be thrown. If null,
a buffer will be allocated to hold the response data. If you pass
a buffer that is larger than the extent, only extent.getSize() bytes
will be valid.checksum
- if not null, the given checksum object will be used
to verify checksums during the read operation. Note that only erasure
coded objects will return checksums *and* if you're reading the object
in chunks, you'll have to read the data back sequentially to keep
the checksum consistent. If the read operation does not return
a checksum from the server, the checksum operation will be skipped.public java.io.InputStream readObjectStreamWithKey(java.lang.String keyPool, java.lang.String key, Extent extent)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.extent
- the portion of the object data to read. Optional.
Default is null to read the entire object.public void updateObjectWithKeyFromStream(java.lang.String keyPool, java.lang.String key, Acl acl, MetadataList metadata, Extent extent, java.io.InputStream data, long length, java.lang.String mimeType)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.acl
- Access control list for the new object. Optional, default
is NULL to leave the ACL unchanged.metadata
- Metadata list for the new object. Optional,
default is NULL for no changes to the metadata.extent
- portion of the object to update. May be null to indicate
the whole object is to be replaced. If not null, the extent size must
match the data size.data
- The new contents of the object. May be appended
to later. Optional, default is NULL (no content changes).length
- The length of the stream in bytes. If the stream
is longer than the length, only length bytes will be written. If
the stream is shorter than the length, an error will occur.mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.public void updateObjectWithKeyFromSegment(java.lang.String keyPool, java.lang.String key, Acl acl, MetadataList metadata, Extent extent, BufferSegment data, java.lang.String mimeType, Checksum checksum)
EsuApi
keyPool
- A name which represents the keyspace for this key. A pool is analogous
to an S3 bucket and two objects with the same name can exist in different pools.key
- The key that uniquely identifies this object within its keyPool.acl
- Access control list for the new object. Optional, default
is NULL to leave the ACL unchanged.metadata
- Metadata list for the new object. Optional,
default is NULL for no changes to the metadata.extent
- portion of the object to update. May be null to indicate
the whole object is to be replaced. If not null, the extent size must
match the data size.data
- The new contents of the object. May be appended
to later. Optional, default is NULL (no content changes).mimeType
- the MIME type of the content. Optional,
may be null. If data is non-null and mimeType is null, the MIME
type will default to application/octet-stream.checksum
- if not null, use the Checksum object to compute
the checksum for the update object request. If appending
to the object with subsequent requests, use the same
checksum object for each request.