Package edu.ucsb.nceas.metacat.dataone
Class D1NodeService
java.lang.Object
edu.ucsb.nceas.metacat.dataone.D1NodeService
- Direct Known Subclasses:
CNodeService
,MNodeService
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
protected static MetacatHandler
protected String
protected static int
limit paged results sets to a configured maximumstatic final String
protected javax.servlet.http.HttpServletRequest
For logging the operationsprotected org.dataone.service.types.v1.Session
out-of-band session object to be used when not passed in as a method parameterprotected String
-
Constructor Summary
ConstructorDescriptionD1NodeService
(javax.servlet.http.HttpServletRequest request) Constructor - used to set the metacatUrl from a subclass extending D1NodeService -
Method Summary
Modifier and TypeMethodDescriptionprotected void
archiveCNObject
(boolean log, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysMeta, boolean needModifyDate, SystemMetadataManager.SysMetaVersion sysMetaCheck) Archive a object on cn and notify the replica.protected org.dataone.service.types.v1.Identifier
archiveObject
(boolean log, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysMeta, boolean changeDateModified, SystemMetadataManager.SysMetaVersion sysMetaCheck) Archive an object, which is either a data object or a science metadata object.protected boolean
checkSidInModifyingSystemMetadata
(org.dataone.service.types.v2.SystemMetadata sysmeta, String invalidSystemMetadataCode, String serviceFailureCode) void
checkV1SystemMetaPidExist
(org.dataone.service.types.v1.Identifier identifier, String serviceFailureCode, String serviceFailureMessage, String noFoundCode, String notFoundMessage) A utility method for v1 api to check the specified identifier exists as a pid Uses the IdentifierManager to call the Identifier table directly - this detects Identifiers for deleted objects (where the SystemMetadata doesn't exist, but the Identifier remains)org.dataone.service.types.v1.Identifier
create
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, InputStream object, org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModificationDate) Adds a new object to the Node, where the object is either a data object or a science metadata object.org.dataone.service.types.v1.Identifier
Deletes an object from the Member Node, where the object is either a data object or a science metadata object.org.dataone.service.types.v1.DescribeResponse
describe
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id) This method provides a lighter weight mechanism than getSystemMetadata() for a client to determine basic properties of the referenced object.static boolean
equals
(org.dataone.service.types.v1.AccessPolicy ap1, org.dataone.service.types.v1.AccessPolicy ap2) Compare two AccessPolicy objectsprotected String
existsInObsoletedBy
(org.dataone.service.types.v1.Identifier id) protected String
existsInObsoletes
(org.dataone.service.types.v1.Identifier id) protected static List<org.dataone.service.types.v1.Permission>
expandPermissions
(org.dataone.service.types.v1.Permission permission) Given a Permission, returns a list of all permissions that it encompasses Permissions are hierarchical so that WRITE also allows READ.get
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid) Return the object identified by the given object identifierprotected org.dataone.service.types.v2.NodeList
A centralized point for accessing the CN Nodelist, to make it easier to cache the nodelist in the future, if it's seen as helpful performance-wiseGet the ip address from the serviceorg.dataone.service.types.v2.Log
getLogRecords
(org.dataone.service.types.v1.Session session, Date fromDate, Date toDate, String event, String pidFilter, Integer start, Integer count) Return the log records associated with a given event between the start and end dates listed given a particular Subject listed in the Sessionprotected org.dataone.service.types.v1.Identifier
getPIDForSID
(org.dataone.service.types.v1.Identifier sid, String serviceFailureCode) Utility method to get the PID for an SID.org.dataone.service.types.v1.Session
retrieve the out-of-band sessionorg.dataone.service.types.v2.SystemMetadata
getSystemMetadata
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id) Return the system metadata for a given objectprotected org.dataone.service.types.v2.SystemMetadata
getSystemMetadataForPID
(org.dataone.service.types.v1.Identifier pid, String serviceFailureCode, String invalidRequestCode, String notFoundCode, boolean needDeleteInfo) Get the system metadata for the given PID (not a sid).Get the user agent from the servicestatic boolean
isAccessControlDirty
(org.dataone.service.types.v2.SystemMetadata originalSysmeta, org.dataone.service.types.v2.SystemMetadata newSysmeta) Check if the access control was modified between two system metadata objects.boolean
isAuthorized
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id, org.dataone.service.types.v1.Permission permission) Test if the user identified by the provided token has authorization for the operation on the specified object.protected void
isInAllowList
(org.dataone.service.types.v1.Session session) Check if the session is in the allow list which can upload objects to this Metacat instance.static boolean
isScienceMetadata
(org.dataone.service.types.v2.SystemMetadata sysmeta) Determine if a given object should be treated as an XML science metadata object.static boolean
isValidIdentifier
(org.dataone.service.types.v1.Identifier pid) Check for whitespace in the given pid.protected List<org.dataone.service.types.v2.Node>
listNodesBySubject
(org.dataone.service.types.v1.Subject subject, org.dataone.service.types.v2.NodeList nodelist) Calls CN.listNodes() to assemble a list of nodes that have been registered with the DataONE infrastructure that match the given session subjectorg.dataone.service.types.v1.ObjectList
listObjects
(org.dataone.service.types.v1.Session session, Date startTime, Date endTime, org.dataone.service.types.v1.ObjectFormatIdentifier objectFormatId, org.dataone.service.types.v1.Identifier identifier, org.dataone.service.types.v1.NodeReference nodeId, Integer start, Integer count) Retrieve the list of objects present on the MN that match the calling parametersorg.dataone.service.types.v2.OptionList
org.dataone.service.types.v2.OptionList
listViews
(org.dataone.service.types.v1.Session arg0) protected static void
objectExists
(org.dataone.service.types.v1.Identifier id) Determine if an object with the given identifier already exists or not.ping()
Low level, "are you alive" operation.protected void
removeSolrIndex
(org.dataone.service.types.v2.SystemMetadata sysMeta) protected void
removeSystemMetaAndIdentifier
(org.dataone.service.types.v1.Identifier id) void
setIpAddress
(String ipAddress) Set the ip address for the servicevoid
setSession
(org.dataone.service.types.v1.Session session) Set the out-of-band sessionvoid
setUserAgent
(String userAgent) Set the user agent for the serviceprotected boolean
updateSystemMetadata
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysmeta, boolean needUpdateModificationDate, org.dataone.service.types.v2.SystemMetadata currentSysmeta, boolean fromCN, SystemMetadataManager.SysMetaVersion sysMetaCheck) Update the system metadata of the specified pid.protected void
updateSystemMetadata
(org.dataone.service.types.v2.SystemMetadata sysMeta, boolean needUpdateModificationDate, SystemMetadataManager.SysMetaVersion sysMetaCheck) Update system metadata.view
(org.dataone.service.types.v1.Session session, String format, org.dataone.service.types.v1.Identifier id)
-
Field Details
-
DELETEDMESSAGE
- See Also:
-
METADATA
- See Also:
-
request
protected javax.servlet.http.HttpServletRequest requestFor logging the operations -
ipAddress
-
userAgent
-
handler
-
MAXIMUM_DB_RECORD_COUNT
protected static int MAXIMUM_DB_RECORD_COUNTlimit paged results sets to a configured maximum -
session2
protected org.dataone.service.types.v1.Session session2out-of-band session object to be used when not passed in as a method parameter
-
-
Constructor Details
-
D1NodeService
public D1NodeService(javax.servlet.http.HttpServletRequest request) Constructor - used to set the metacatUrl from a subclass extending D1NodeService- Parameters:
metacatUrl
- - the URL of the metacat service, including the ending /d1
-
-
Method Details
-
getSession
public org.dataone.service.types.v1.Session getSession()retrieve the out-of-band session- Returns:
-
setSession
public void setSession(org.dataone.service.types.v1.Session session) Set the out-of-band session- Parameters:
session
-
-
getCNNodeList
protected org.dataone.service.types.v2.NodeList getCNNodeList() throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotImplementedA centralized point for accessing the CN Nodelist, to make it easier to cache the nodelist in the future, if it's seen as helpful performance-wise- Returns:
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotImplemented
-
describe
public org.dataone.service.types.v1.DescribeResponse describe(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotImplemented This method provides a lighter weight mechanism than getSystemMetadata() for a client to determine basic properties of the referenced object.- Parameters:
session
- - the Session object containing the credentials for the Subjectpid
- - the identifier of the object to be described- Returns:
- describeResponse - A set of values providing a basic description of the object.
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.InvalidRequest
-
delete
public org.dataone.service.types.v1.Identifier delete(String username, org.dataone.service.types.v1.Identifier pid) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotImplemented Deletes an object from the Member Node, where the object is either a data object or a science metadata object. No access checking.- Parameters:
username
- - the name of the user who calls the method. This is only for logging.pid
- - The object identifier to be deleted- Returns:
- pid - the identifier of the object used for the deletion
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.InvalidRequest
-
ping
public Date ping() throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InsufficientResourcesLow level, "are you alive" operation. A valid ping response is indicated by a HTTP status of 200.- Returns:
- true if the service is alive
- Throws:
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.InsufficientResources
-
create
public org.dataone.service.types.v1.Identifier create(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, InputStream object, org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModificationDate) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.IdentifierNotUnique, org.dataone.service.exceptions.UnsupportedType, org.dataone.service.exceptions.InsufficientResources, org.dataone.service.exceptions.InvalidSystemMetadata, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidRequest Adds a new object to the Node, where the object is either a data object or a science metadata object. This method is called by clients to create new data objects on Member Nodes or internally for Coordinating Nodes- Parameters:
session
- - the Session object containing the credentials for the Subjectpid
- - The object identifier to be createdobject
- - the object bytessysmeta
- - the system metadata that describes the object- Returns:
- pid - the object identifier created
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.IdentifierNotUnique
org.dataone.service.exceptions.UnsupportedType
org.dataone.service.exceptions.InsufficientResources
org.dataone.service.exceptions.InvalidSystemMetadata
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.InvalidRequest
-
objectExists
protected static void objectExists(org.dataone.service.types.v1.Identifier id) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.IdentifierNotUnique Determine if an object with the given identifier already exists or not. (Using IdentityManager. Works for SID or PID)- Parameters:
id
- - the ID to be checked.- Throws:
org.dataone.service.exceptions.ServiceFailure
- if the system can't fulfill the check processorg.dataone.service.exceptions.IdentifierNotUnique
- if the object with the identifier does exist
-
removeSystemMetaAndIdentifier
protected void removeSystemMetaAndIdentifier(org.dataone.service.types.v1.Identifier id) -
removeSolrIndex
protected void removeSolrIndex(org.dataone.service.types.v2.SystemMetadata sysMeta) -
getLogRecords
public org.dataone.service.types.v2.Log getLogRecords(org.dataone.service.types.v1.Session session, Date fromDate, Date toDate, String event, String pidFilter, Integer start, Integer count) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented Return the log records associated with a given event between the start and end dates listed given a particular Subject listed in the Session- Parameters:
session
- - the Session object containing the credentials for the SubjectfromDate
- - the start date of the desired log recordstoDate
- - the end date of the desired log recordsevent
- - restrict log records of a specific event typestart
- - zero based offset from the first record in the set of matching log records. Used to assist with paging the response.count
- - maximum number of log records to return in the response. Used to assist with paging the response.- Returns:
- the desired log records
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
-
get
public InputStream get(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotImplemented Return the object identified by the given object identifier- Parameters:
session
- - the Session object containing the credentials for the Subjectid
- - the identifier for the given object TODO: The D1 Authorization API doesn't provide information on which authentication system the Subject belongs to, and so it's not possible to discern which Person or Group is a valid KNB LDAP DN. Fix this.- Returns:
- inputStream - the input stream of the given object
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.NotFound
-
getSystemMetadata
public org.dataone.service.types.v2.SystemMetadata getSystemMetadata(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotImplemented Return the system metadata for a given object- Parameters:
session
- - the Session object containing the credentials for the Subjectpid
- - the object identifier for the given object- Returns:
- inputStream - the input stream of the given system metadata object
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
-
isAuthorized
public boolean isAuthorized(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id, org.dataone.service.types.v1.Permission permission) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidRequest Test if the user identified by the provided token has authorization for the operation on the specified object. Allowed subjects include: 1. CNs 2. Authoritative node 3. Owner of the object 4. Users with the specified permission in the access rules.- Parameters:
session
- - the Session object containing the credentials for the Subjectpid
- - The identifer of the resource for which access is being checkedoperation
- - The type of operation which is being requested for the given pid- Returns:
- true if the operation is allowed
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.InvalidRequest
-
isScienceMetadata
public static boolean isScienceMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta) Determine if a given object should be treated as an XML science metadata object.- Parameters:
sysmeta
- - the SystemMetadata describing the object- Returns:
- true if the object should be treated as science metadata
-
isValidIdentifier
public static boolean isValidIdentifier(org.dataone.service.types.v1.Identifier pid) Check for whitespace in the given pid. null pids are also invalid by default- Parameters:
pid
-- Returns:
-
isInAllowList
protected void isInAllowList(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.ServiceFailure Check if the session is in the allow list which can upload objects to this Metacat instance.- Parameters:
session
- the identity of the user- Throws:
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.ServiceFailure
-
listObjects
public org.dataone.service.types.v1.ObjectList listObjects(org.dataone.service.types.v1.Session session, Date startTime, Date endTime, org.dataone.service.types.v1.ObjectFormatIdentifier objectFormatId, org.dataone.service.types.v1.Identifier identifier, org.dataone.service.types.v1.NodeReference nodeId, Integer start, Integer count) throws org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidToken Retrieve the list of objects present on the MN that match the calling parameters- Parameters:
session
- - the Session object containing the credentials for the SubjectstartTime
- - Specifies the beginning of the time range from which to return object (>=)endTime
- - Specifies the beginning of the time range from which to return object (>=)objectFormat
- - Restrict results to the specified object formatreplicaStatus
- - Indicates if replicated objects should be returned in the liststart
- - The zero-based index of the first value, relative to the first record of the resultset that matches the parameters.count
- - The maximum number of entries that should be returned in the response. The Member Node may return less entries than specified in this value.- Returns:
- objectList - the list of objects matching the criteria
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
-
updateSystemMetadata
protected void updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysMeta, boolean needUpdateModificationDate, SystemMetadataManager.SysMetaVersion sysMetaCheck) throws org.dataone.service.exceptions.ServiceFailure Update system metadata. And the index task is submitted as well. This method only apply to the cases involving the only change of the system metadata.- Parameters:
sysMeta
- the new system metadataneedUpdateModificationDate
- if Metacat need to change the modification datesysMetaCheck
- - check whether the version of the provided '@param sysMeta' matches the version of the existing system metadata- Throws:
org.dataone.service.exceptions.ServiceFailure
-
updateSystemMetadata
protected boolean updateSystemMetadata(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysmeta, boolean needUpdateModificationDate, org.dataone.service.types.v2.SystemMetadata currentSysmeta, boolean fromCN, SystemMetadataManager.SysMetaVersion sysMetaCheck) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InvalidSystemMetadata, org.dataone.service.exceptions.InvalidToken Update the system metadata of the specified pid.- Parameters:
session
- - the identity of the client which calls the methodpid
- - the identifier of the object which will be updatedsysmeta
- - the new system metadataneedUpdateModificationDate
- - if Metacat needs to change dateSysMetadataModifiedcurrentSysmeta
- - the current system metadata in MetcatfromCN
- - if the call from a CN methodsysMetaCheck
- - sysMetaCheck - check whether the version of the provided '@param sysmeta' matches the version of the existing system metadata- Returns:
- Throws:
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.InvalidSystemMetadata
org.dataone.service.exceptions.InvalidToken
-
expandPermissions
protected static List<org.dataone.service.types.v1.Permission> expandPermissions(org.dataone.service.types.v1.Permission permission) Given a Permission, returns a list of all permissions that it encompasses Permissions are hierarchical so that WRITE also allows READ.- Parameters:
permission
-- Returns:
- list of included Permissions for the given permission
-
listNodesBySubject
protected List<org.dataone.service.types.v2.Node> listNodesBySubject(org.dataone.service.types.v1.Subject subject, org.dataone.service.types.v2.NodeList nodelist) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotImplemented Calls CN.listNodes() to assemble a list of nodes that have been registered with the DataONE infrastructure that match the given session subject- Parameters:
subject
- - the subject serving as the filter.- Returns:
- nodes - List of nodes from the registry with a matching session subject
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotImplemented
-
archiveObject
protected org.dataone.service.types.v1.Identifier archiveObject(boolean log, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysMeta, boolean changeDateModified, SystemMetadataManager.SysMetaVersion sysMetaCheck) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotImplemented Archive an object, which is either a data object or a science metadata object. Note: it doesn't check the authorization; it only accepts a pid.- Parameters:
log
- indicator if we want to log the eventsession
- - the Session object containing the credentials for the Subjectpid
- - The object identifier to be archivedsysMeta
- - the system metadata associated with the pidchangeDateModified
- - if we need to modify the dateModified field in the system metadatasysMetaCheck
- sysMetaCheck - check whether the version of the provided '@param sysMeta' matches the version of the existing system metadata- Returns:
- pid - the identifier of the object used for the archiving
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.NotImplemented
-
archiveCNObject
protected void archiveCNObject(boolean log, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysMeta, boolean needModifyDate, SystemMetadataManager.SysMetaVersion sysMetaCheck) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotImplemented Archive a object on cn and notify the replica. This method doesn't lock the system metadata map. The caller should lock it. This method doesn't check the authorization; this method only accept a pid. It wouldn't notify the replca that the system metadata has been changed.- Parameters:
log
- if we need to log the event into dbsession
- the session who made the requestpid
- the pid of the object which needs to be archivedsysMeta
- the system metadata associated with the pidsysMetaCheck
- sysMetaCheck - check whether the version of the provided '@param sysMeta' matches the version of the existing system metadata- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.NotImplemented
-
checkV1SystemMetaPidExist
public void checkV1SystemMetaPidExist(org.dataone.service.types.v1.Identifier identifier, String serviceFailureCode, String serviceFailureMessage, String noFoundCode, String notFoundMessage) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotFound A utility method for v1 api to check the specified identifier exists as a pid Uses the IdentifierManager to call the Identifier table directly - this detects Identifiers for deleted objects (where the SystemMetadata doesn't exist, but the Identifier remains)- Parameters:
identifier
- the specified identifierserviceFailureCode
- the detail error code for the service failure exceptionnoFoundCode
- the detail error code for the not found exception- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotFound
-
getPIDForSID
protected org.dataone.service.types.v1.Identifier getPIDForSID(org.dataone.service.types.v1.Identifier sid, String serviceFailureCode) throws org.dataone.service.exceptions.ServiceFailure Utility method to get the PID for an SID. If the specified identifier is not an SID , null will be returned.- Parameters:
sid
- the specified sidserviceFailureCode
- the detail error code for the service failure exception- Returns:
- the pid for the sid. If the specified identifier is not an SID, null will be returned.
- Throws:
org.dataone.service.exceptions.ServiceFailure
-
getSystemMetadataForPID
protected org.dataone.service.types.v2.SystemMetadata getSystemMetadataForPID(org.dataone.service.types.v1.Identifier pid, String serviceFailureCode, String invalidRequestCode, String notFoundCode, boolean needDeleteInfo) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotFound Get the system metadata for the given PID (not a sid).- Parameters:
pid
-serviceFailureCode
-invalidRequestCode
-- Returns:
- the system metadata associated with the pid
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.InvalidRequest
-
checkSidInModifyingSystemMetadata
protected boolean checkSidInModifyingSystemMetadata(org.dataone.service.types.v2.SystemMetadata sysmeta, String invalidSystemMetadataCode, String serviceFailureCode) throws org.dataone.service.exceptions.InvalidSystemMetadata, org.dataone.service.exceptions.ServiceFailure - Throws:
org.dataone.service.exceptions.InvalidSystemMetadata
org.dataone.service.exceptions.ServiceFailure
-
listViews
public org.dataone.service.types.v2.OptionList listViews(org.dataone.service.types.v1.Session arg0) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented - Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
-
listViews
public org.dataone.service.types.v2.OptionList listViews() throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
-
view
public InputStream view(org.dataone.service.types.v1.Session session, String format, org.dataone.service.types.v1.Identifier id) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotFound - Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.NotFound
-
existsInObsoletes
protected String existsInObsoletes(org.dataone.service.types.v1.Identifier id) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure - Throws:
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.ServiceFailure
-
existsInObsoletedBy
protected String existsInObsoletedBy(org.dataone.service.types.v1.Identifier id) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure - Throws:
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.ServiceFailure
-
getIpAddress
Get the ip address from the service- Returns:
- the ip address
-
setIpAddress
Set the ip address for the service- Parameters:
ipAddress
- the address will be set
-
getUserAgent
Get the user agent from the service- Returns:
-
setUserAgent
Set the user agent for the service- Parameters:
userAgent
- the user agent will be set
-
isAccessControlDirty
public static boolean isAccessControlDirty(org.dataone.service.types.v2.SystemMetadata originalSysmeta, org.dataone.service.types.v2.SystemMetadata newSysmeta) Check if the access control was modified between two system metadata objects. It compares two parts: RightsHolder and AccessPolicy- Parameters:
originalSysmeta
- the original system metadata objectnewSysmeta
- the new system metadata object- Returns:
- true if the access control was modified; false otherwise.
-
equals
public static boolean equals(org.dataone.service.types.v1.AccessPolicy ap1, org.dataone.service.types.v1.AccessPolicy ap2) Compare two AccessPolicy objects- Parameters:
ap1
-ap2
-- Returns:
- true if they are same; false otherwise
-