public class D1Object extends Object
Constructor and Description |
---|
D1Object()
Construct a new D1Object, which is then populated with data and system metadata
during the download process.
|
D1Object(Identifier id,
byte[] data,
ObjectFormatIdentifier formatId,
Subject submitter,
NodeReference nodeId)
Deprecated.
|
D1Object(Identifier id,
byte[] data,
String formatValue,
String submitterValue,
String nodeIdValue)
Deprecated.
|
D1Object(Identifier id,
DataSource data,
ObjectFormatIdentifier formatId,
Subject submitter,
NodeReference nodeId)
Create an object that contains the given data bytes and with the given system metadata values.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkDataIntegrity()
Compares the data to the values in the size and checksum SystemMetadata fields
and returns true if they match.
|
protected static void |
checkLength(List<String> strings)
Check that the all strings in the array have > 0 length.
|
protected static void |
checkNotNull(List<Object> objects)
Check if any in a list of objects are null references.
|
static D1Object |
download(Identifier id)
Contact D1 services to download the systemMetadata and data.
|
AccessPolicyEditor |
getAccessPolicyEditor()
Provides an object to manipulate this D1Object's accessPolicy
|
byte[] |
getData()
Deprecated.
|
DataSource |
getDataSource()
get the DataSource representing the data
|
ObjectFormatIdentifier |
getFmtId()
Deprecated.
|
ObjectFormatIdentifier |
getFormatId() |
Identifier |
getIdentifier() |
SystemMetadata |
getSystemMetadata() |
boolean |
refreshSystemMetadata(Integer retryTimeoutMS)
refresh the SystemMetadata of this object, first trying the CN, then the
authoritative MN.
|
void |
setData(byte[] data)
Deprecated.
|
void |
setDataSource(DataSource dataSource)
set the DataSource representation of the data
|
void |
setPublicAccess(Session token)
Change the object to publicly readable
|
void |
setSystemMetadata(SystemMetadata sysmeta) |
protected static void |
validateRequest(Identifier id,
byte[] data,
ObjectFormatIdentifier formatId,
Subject submitter,
NodeReference nodeId)
Check the given set of input arguments that they are all valid and not null,
and that string values are not null and of non-zero length.
|
public D1Object()
@Deprecated public D1Object(Identifier id, byte[] data, String formatValue, String submitterValue, String nodeIdValue) throws NoSuchAlgorithmException, IOException, NotFound, InvalidRequest
id
- the identifier of the objectdata
- the data bytes of the objectformat
- the format of the objectsubmitter
- the submitter for the objectnodeId
- the identifier of the node on which the object will be createdNoSuchAlgorithmException
- if the checksum algorithm does not existIOException
- if the data bytes can not be readNotFound
- if the format specified is not found in the formatCacheInvalidRequest
- if the content of parameters is not correct@Deprecated public D1Object(Identifier id, byte[] data, ObjectFormatIdentifier formatId, Subject submitter, NodeReference nodeId) throws NoSuchAlgorithmException, IOException, NotFound, InvalidRequest
id
- the identifier of the objectdata
- the data bytes of the objectformat
- the format of the objectsubmitter
- the submitter for the objectnodeId
- the identifier of the node on which the object will be createdNoSuchAlgorithmException
- if the checksum algorithm does not existIOException
- if the data bytes can not be readNotFound
- if the format specified is not found in the formatCacheInvalidRequest
- if the content of parameters is not correctpublic D1Object(Identifier id, DataSource data, ObjectFormatIdentifier formatId, Subject submitter, NodeReference nodeId) throws NoSuchAlgorithmException, IOException, NotFound, InvalidRequest
id
- the identifier of the objectdata
- the data bytes of the objectformat
- the format of the objectsubmitter
- the submitter for the objectnodeId
- the identifier of the node on which the object will be createdNoSuchAlgorithmException
- if the checksum algorithm does not existIOException
- if the data bytes can not be readNotFound
- if the format specified is not found in the formatCacheInvalidRequest
- if the content of parameters is not correctpublic Identifier getIdentifier()
@Deprecated public ObjectFormatIdentifier getFmtId()
public ObjectFormatIdentifier getFormatId()
public SystemMetadata getSystemMetadata()
public void setSystemMetadata(SystemMetadata sysmeta) throws InvalidRequest
sysmeta
- the sysmeta to setInvalidRequest
- - if the sysmeta parameter is nullpublic byte[] getData() throws IOException
IOException
public void setData(byte[] data) throws InvalidRequest
data
- the data to setInvalidRequest
- - if data parameter is nullpublic DataSource getDataSource()
public void setDataSource(DataSource dataSource)
public void setPublicAccess(Session token) throws ServiceFailure, InvalidToken, NotFound, NotAuthorized, NotImplemented, InvalidRequest, VersionMismatch
token
- the credentials to use to make the changeServiceFailure
InvalidRequest
NotImplemented
NotAuthorized
NotFound
InvalidToken
VersionMismatch
public static D1Object download(Identifier id) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, InsufficientResources, InvalidRequest
id
- identifier to be downloadedInvalidToken
ServiceFailure
NotAuthorized
NotFound
NotImplemented
InsufficientResources
InvalidRequest
- - thrown when the data is retrieved but nullprotected static void validateRequest(Identifier id, byte[] data, ObjectFormatIdentifier formatId, Subject submitter, NodeReference nodeId) throws InvalidRequest
id
- data
- format
- submitter
- nodeId
- InvalidRequest
protected static void checkNotNull(List<Object> objects) throws InvalidRequest
objects
- the List of objects to checkInvalidRequest
- if any Object in the list is nullprotected static void checkLength(List<String> strings) throws InvalidRequest
strings
- InvalidRequest
public boolean checkDataIntegrity() throws NoSuchAlgorithmException, IOException
NoSuchAlgorithmException
IOException
public AccessPolicyEditor getAccessPolicyEditor()
public boolean refreshSystemMetadata(Integer retryTimeoutMS) throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure, InterruptedException
retryTimeoutMS
- - the number of milliseconds to wait before giving up
on refresh. If null, will only try the MN 1 time, otherwise will retry at
regular intervals until the retryTimeout is reached.ServiceFailure
NotImplemented
NotAuthorized
InvalidToken
InterruptedException
Copyright © 2014. All Rights Reserved.