public abstract class MultipartD1Node extends Object implements D1Node
Modifier and Type | Field and Description |
---|---|
protected MultipartRestClient |
defaultRestClient
the D1Node instance adapter / connector to the RESTful service endpoints
|
protected Session |
defaultSession
this represents the defaultSession to be used for establishing the SSL connection
|
protected MultipartRestClient |
latestRestClient
the latest MRC used to make an API call
|
protected Session |
latestSession |
protected static org.apache.commons.logging.Log |
log |
protected NodeType |
nodeType |
Modifier | Constructor and Description |
---|---|
|
MultipartD1Node()
Deprecated.
|
|
MultipartD1Node(MultipartRestClient client,
String nodeBaseServiceUrl)
Convenience constructor to create a new instance.
|
protected |
MultipartD1Node(MultipartRestClient client,
String nodeBaseServiceUrl,
Session session)
Users can set either a default RestClient or default Session that will
build a RestClient configured appropriately from the information in the
Session.
|
|
MultipartD1Node(Session session,
String nodeBaseServiceUrl)
Convenience constructor to create a new instance.
|
|
MultipartD1Node(String nodeBaseServiceUrl)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
Identifier |
archive(Identifier pid) |
Identifier |
archive(Session session,
Identifier pid)
sets the archived flag to true on an MN or CN
|
protected static void |
closeLoudly(InputStream is)
Utility method to be used in finally blocks for methods that have to
close inputStreams.
|
Identifier |
delete(Identifier pid) |
Identifier |
delete(Session session,
Identifier pid) |
DescribeResponse |
describe(Identifier pid) |
DescribeResponse |
describe(Session session,
Identifier pid) |
protected <T> T |
deserializeServiceType(Class<T> domainClass,
InputStream is)
deserialize an object of type from the inputstream
This is a wrapper method of the standard common Unmarshalling method
that recasts exceptions to ServiceFailure
|
Identifier |
generateIdentifier(Session session,
String scheme,
String fragment) |
Identifier |
generateIdentifier(String scheme,
String fragment) |
InputStream |
get(Identifier pid)
Get the resource with the specified pid.
|
InputStream |
get(Session session,
Identifier pid)
Get the resource with the specified pid.
|
Checksum |
getChecksum(Identifier pid,
String checksumAlgorithm) |
Checksum |
getChecksum(Session session,
Identifier pid,
String checksumAlgorithm)
This method can handle both the MN and CN method, although the CN overriding method
will need to recast the InvalidRequest exception and use 'null' for the checksumAlgorithm param
|
String |
getLatestRequestUrl()
Useful for debugging to see what the last call was
|
String |
getNodeBaseServiceUrl()
Retrieve the service URL for this node.
|
NodeReference |
getNodeId()
Get the NodeId associated with the D1Node
|
NodeType |
getNodeType()
Get the NodeType associated with the D1Node
|
QueryEngineDescription |
getQueryEngineDescription(Session session,
String queryEngine) |
protected MultipartRestClient |
getRestClient(Session sessionFromMethod)
API methods should use this method to get the MultipartRestClient to
be used for the call.
|
boolean |
isAuthorized(Identifier pid,
Permission action) |
boolean |
isAuthorized(Session session,
Identifier pid,
Permission action) |
QueryEngineList |
listQueryEngines(Session session) |
protected OptionList |
listViews(Session session) |
Date |
ping() |
InputStream |
query(Session session,
String queryEngine,
String encodedQuery)
As with the sister query() method that takes a D1Url, the contents of
encodedQuery will be joined to the url with as follows:
/{queryEngine}/{encodedQuery}
Note: Users will need to provide the '?' where appropriate to mark
the beginning of the url-query portion.
|
void |
setNodeBaseServiceUrl(String nodeBaseServiceUrl)
Set the service URL for this node.
|
void |
setNodeId(NodeReference nodeId)
Set the NodeId associated with the D1Node
|
void |
setNodeType(NodeType nodeType)
Set the Nodetype for the D1Node
|
boolean |
systemMetadataChanged(Session session,
Identifier pid,
long serialVersion,
Date dateSystemMetadataLastModified) |
protected InputStream |
view(Session session,
String theme,
Identifier id) |
protected static org.apache.commons.logging.Log log
protected MultipartRestClient defaultRestClient
protected MultipartRestClient latestRestClient
protected Session latestSession
protected Session defaultSession
protected NodeType nodeType
protected MultipartD1Node(MultipartRestClient client, String nodeBaseServiceUrl, Session session)
public MultipartD1Node(MultipartRestClient client, String nodeBaseServiceUrl)
public MultipartD1Node(Session session, String nodeBaseServiceUrl)
@Deprecated public MultipartD1Node(String nodeBaseServiceUrl) throws IOException, ClientSideException
ClientSideException
IOException
@Deprecated public MultipartD1Node()
protected static void closeLoudly(InputStream is) throws ServiceFailure
is
- ServiceFailure
- - thrown if is.close throws an IOExceptionprotected MultipartRestClient getRestClient(Session sessionFromMethod) throws ServiceFailure
sessionFromMethod
- - this should be the session from the API method parameterServiceFailure
public String getNodeBaseServiceUrl()
getNodeBaseServiceUrl
in interface D1Node
public void setNodeBaseServiceUrl(String nodeBaseServiceUrl)
nodeBaseServiceUrl
- String representing the service URLpublic NodeReference getNodeId()
D1Node
public void setNodeId(NodeReference nodeId)
D1Node
public void setNodeType(NodeType nodeType)
D1Node
setNodeType
in interface D1Node
public NodeType getNodeType()
D1Node
getNodeType
in interface D1Node
public String getLatestRequestUrl()
getLatestRequestUrl
in interface D1Node
public Date ping() throws NotImplemented, ServiceFailure, InsufficientResources
public InputStream get(Identifier pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, InsufficientResources
public InputStream get(Session session, Identifier pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented, InsufficientResources
public boolean systemMetadataChanged(Session session, Identifier pid, long serialVersion, Date dateSystemMetadataLastModified) throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented, InvalidRequest
public DescribeResponse describe(Identifier pid) throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure, NotFound
public DescribeResponse describe(Session session, Identifier pid) throws InvalidToken, NotAuthorized, NotImplemented, ServiceFailure, NotFound
public Checksum getChecksum(Identifier pid, String checksumAlgorithm) throws InvalidRequest, InvalidToken, NotAuthorized, NotImplemented, ServiceFailure, NotFound
public Checksum getChecksum(Session session, Identifier pid, String checksumAlgorithm) throws InvalidRequest, InvalidToken, NotAuthorized, NotImplemented, ServiceFailure, NotFound
defaultSession
- pid
- checksumAlgorithm
- - for MN implementations onlyInvalidRequest
- - for MN implementations onlyInvalidToken
NotAuthorized
NotImplemented
ServiceFailure
NotFound
public boolean isAuthorized(Identifier pid, Permission action) throws ServiceFailure, InvalidRequest, InvalidToken, NotFound, NotAuthorized, NotImplemented
public boolean isAuthorized(Session session, Identifier pid, Permission action) throws ServiceFailure, InvalidRequest, InvalidToken, NotFound, NotAuthorized, NotImplemented
public Identifier generateIdentifier(String scheme, String fragment) throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented, InvalidRequest
public Identifier generateIdentifier(Session session, String scheme, String fragment) throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented, InvalidRequest
public Identifier archive(Identifier pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented
public Identifier archive(Session session, Identifier pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented
defaultSession
- pid
- InvalidToken
ServiceFailure
NotAuthorized
NotFound
NotImplemented
InvalidRequest
public Identifier delete(Identifier pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented
public Identifier delete(Session session, Identifier pid) throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented
public InputStream query(Session session, String queryEngine, String encodedQuery) throws InvalidToken, ServiceFailure, NotAuthorized, InvalidRequest, NotImplemented, NotFound
queryEngine
- encodedQuery
- InvalidToken
ServiceFailure
NotAuthorized
InvalidRequest
NotImplemented
NotFound
public QueryEngineDescription getQueryEngineDescription(Session session, String queryEngine) throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented, NotFound
public QueryEngineList listQueryEngines(Session session) throws InvalidToken, ServiceFailure, NotAuthorized, NotImplemented
protected <T> T deserializeServiceType(Class<T> domainClass, InputStream is) throws ServiceFailure
type
- the class of the object to serialize (i.e.
SystemMetadata.class)is
- the stream to deserialize fromServiceFailure
protected InputStream view(Session session, String theme, Identifier id) throws InvalidToken, ServiceFailure, NotAuthorized, InvalidRequest, NotImplemented, NotFound
protected OptionList listViews(Session session) throws InvalidToken, ServiceFailure, NotAuthorized, InvalidRequest, NotImplemented
Copyright © 2020. All Rights Reserved.