Package edu.ucsb.nceas.metacat.dataone
Class MNodeService
java.lang.Object
edu.ucsb.nceas.metacat.dataone.D1NodeService
edu.ucsb.nceas.metacat.dataone.MNodeService
- All Implemented Interfaces:
org.dataone.service.mn.tier1.v2.MNCore
,org.dataone.service.mn.tier1.v2.MNRead
,org.dataone.service.mn.tier2.v2.MNAuthorization
,org.dataone.service.mn.tier3.v2.MNStorage
,org.dataone.service.mn.tier4.v2.MNReplication
,org.dataone.service.mn.v2.MNPackage
,org.dataone.service.mn.v2.MNQuery
,org.dataone.service.mn.v2.MNView
public class MNodeService
extends D1NodeService
implements org.dataone.service.mn.tier2.v2.MNAuthorization, org.dataone.service.mn.tier1.v2.MNCore, org.dataone.service.mn.tier1.v2.MNRead, org.dataone.service.mn.tier4.v2.MNReplication, org.dataone.service.mn.tier3.v2.MNStorage, org.dataone.service.mn.v2.MNQuery, org.dataone.service.mn.v2.MNView, org.dataone.service.mn.v2.MNPackage
Represents Metacat's implementation of the DataONE Member Node service API. Methods implement the
various MN* interfaces, and methods common to both Member Node and Coordinating Node interfaces
are found in the D1NodeService base class.
Implements:
MNCore.ping()
MNCore.getLogRecords()
MNCore.getObjectStatistics()
MNCore.getOperationStatistics()
MNCore.getStatus()
MNCore.getCapabilities()
MNRead.get()
MNRead.getSystemMetadata()
MNRead.describe()
MNRead.getChecksum()
MNRead.listObjects()
MNRead.synchronizationFailed()
MNAuthorization.isAuthorized()
MNAuthorization.setAccessPolicy()
MNStorage.create()
MNStorage.update()
MNStorage.delete()
MNStorage.updateSystemMetadata()
MNReplication.replicate()
MNAdmin.reindex()
-
Field Summary
Fields inherited from class edu.ucsb.nceas.metacat.dataone.D1NodeService
DELETEDMESSAGE, handler, ipAddress, MAXIMUM_DB_RECORD_COUNT, METADATA, request, session2, userAgent
Fields inherited from interface org.dataone.service.mn.tier1.v2.MNCore
SERVICE_VERSION
-
Method Summary
Modifier and TypeMethodDescriptionorg.dataone.service.types.v1.Identifier
archive
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid) Archives an object, where the object is either a data object or a science metadata object.protected void
checkAdminPrivilege
(org.dataone.service.types.v1.Session session, String serviceFailureCode, String notAuthorizedCode, String error) Check if the given session has the admin privilege.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) org.dataone.service.types.v1.Identifier
delete
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier id) Deletes an object from the Member Node, where the object is either a data object or a science metadata object.editScienceMetadata
(org.dataone.service.types.v1.Session session, InputStream object, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v1.Identifier newPid, boolean isEML, org.dataone.service.types.v2.SystemMetadata newSysmeta) Update a science metadata document with its new Identifierorg.dataone.service.types.v1.Identifier
generateIdentifier
(org.dataone.service.types.v1.Session session, String scheme, String fragment) get
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid) Return the object identified by the given object identifierorg.dataone.service.types.v2.Node
Return a description of the node's capabilities and services.org.dataone.service.types.v1.Checksum
getChecksum
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, String algorithm) Returns a Checksum for the specified object using an accepted hashing algorithmprotected org.dataone.service.types.v1.NodeReference
static MNodeService
getInstance
(javax.servlet.http.HttpServletRequest request) Get an instance of MNodeService.static MNodeService
getInstance
(javax.servlet.http.HttpServletRequest request, String ipAddress, String userAgent) Get an instance of MNodeService.getPackage
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.ObjectFormatIdentifier formatId, org.dataone.service.types.v1.Identifier pid) Exports a data package to disk using the BagIt The Bagit 0.97 format corresponds to the V1 export format The Bagit 1.0 format corresponds to the V2 export formatorg.dataone.service.types.v1_1.QueryEngineDescription
getQueryEngineDescription
(org.dataone.service.types.v1.Session session, String engine) getReplica
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid) Essentially a get() but with different logging behaviorgetStatus
(org.dataone.service.types.v1.Session session) Get the status of the system.org.dataone.service.types.v2.SystemMetadata
getSystemMetadata
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid) Return the system metadata for a given objectprotected void
handleReindexAction
(List<org.dataone.service.types.v1.Identifier> pids) Rebuild the index for one or more documentsprotected void
Rebuild the index for all documents in the systemMetadata table.protected boolean
isAuthoritativeNode
(org.dataone.service.types.v1.Identifier pid) Determine if the current node is the authoritative node for the given pid.protected boolean
Check if the metacat is in the read-only mode.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, Boolean replicaStatus, Integer start, Integer count) Retrieve the list of objects present on the MN that match the calling parametersorg.dataone.service.types.v1_1.QueryEngineList
listQueryEngines
(org.dataone.service.types.v1.Session session) List<org.dataone.service.types.v1.Identifier>
lookupOreFor
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier guid, boolean includeObsolete) Determines if we already have registered an ORE map for this package NOTE: uses a solr query to locate OREs for the objectpostQuery
(org.dataone.service.types.v1.Session session, String engine, HashMap<String, String[]> params) Handle the query sent by the http post methodorg.dataone.service.types.v1.Identifier
publish
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier originalIdentifier) Given an existing Science Metadata PID, this method mints a DOI and updates the original object "publishing" the update with the DOI.void
publishIdentifier
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier identifier) Make status of the given identifier (e.g.reindex
(org.dataone.service.types.v1.Session session, List<org.dataone.service.types.v1.Identifier> identifiers) The admin API call to reindex a list of documents in the instance.reindexAll
(org.dataone.service.types.v1.Session session) The admin API call to reindex all documents in the instance.boolean
replicate
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta, org.dataone.service.types.v1.NodeReference sourceNode) Called by a Coordinating Node to request that the Member Node create a copy of the specified object by retrieving it from another Member Node and storing it locally so that it can be made accessible to the DataONE system.static void
setDOIUpdater
(UpdateDOI anotherDoiUpdater) This method is for testing only - replacing the real class by a stubbed Mockito UpdateDOI class.static void
setEnforcePublisEntirePackage
(boolean enforce) Set the value if Metacat need to make the entire package public during the publish processstatic void
setMetacatSolrIndex
(MetacatSolrIndex solrIndex) This method is for testing only - replacing the real class by a stubbed Mockito MetacatSolrIndex class.boolean
synchronizationFailed
(org.dataone.service.types.v1.Session session, org.dataone.service.exceptions.SynchronizationFailed syncFailed) A callback method used by a CN to indicate to a MN that it cannot complete synchronization of the science metadata identified by pid.boolean
systemMetadataChanged
(boolean needCheckAuthoriativeNode, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, long serialVersion, Date dateSysMetaLastModified) A method to notify the Member Node that the authoritative copy of system metadata on the Coordinating Nodes has changed.boolean
systemMetadataChanged
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, long serialVersion, Date dateSysMetaLastModified) A method to notify the Member Node that the authoritative copy of system metadata on the Coordinating Nodes has changed.org.dataone.service.types.v1.Identifier
update
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, InputStream object, org.dataone.service.types.v1.Identifier newPid, org.dataone.service.types.v2.SystemMetadata sysmeta) Updates an existing object by creating a new object identified by newPid on the Member Node which explicitly obsoletes the object identified by pid through appropriate changes to the SystemMetadata of pid and newPidupdateAllIdMetadata
(org.dataone.service.types.v1.Session session) Update all controlled identifiers' (such as DOI) metadata on the third party service.updateIdMetadata
(org.dataone.service.types.v1.Session session, String[] pids, String[] formatIds) Update the given identifiers' (such as DOI) metadata on the third party service.boolean
updateSystemMetadata
(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysmeta) Update the system metadata of the specified pid.Methods inherited from class edu.ucsb.nceas.metacat.dataone.D1NodeService
archiveCNObject, archiveObject, checkSidInModifyingSystemMetadata, checkV1SystemMetaPidExist, create, delete, describe, equals, existsInObsoletedBy, existsInObsoletes, expandPermissions, getCNNodeList, getIpAddress, getLogRecords, getPIDForSID, getSession, getSystemMetadataForPID, getUserAgent, isAccessControlDirty, isAuthorized, isInAllowList, isScienceMetadata, isValidIdentifier, listNodesBySubject, listObjects, listViews, listViews, objectExists, ping, removeSolrIndex, removeSystemMetaAndIdentifier, setIpAddress, setSession, setUserAgent, updateSystemMetadata, updateSystemMetadata, view
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.dataone.service.mn.tier2.v2.MNAuthorization
isAuthorized
Methods inherited from interface org.dataone.service.mn.tier1.v2.MNCore
getLogRecords, ping
Methods inherited from interface org.dataone.service.mn.tier1.v2.MNRead
describe
Methods inherited from interface org.dataone.service.mn.v2.MNView
listViews, view
-
Field Details
-
UUID_SCHEME
- See Also:
-
DOI_SCHEME
- See Also:
-
-
Method Details
-
getInstance
Get an instance of MNodeService.- Returns:
- instance - the instance of MNodeService
-
getInstance
public static MNodeService getInstance(javax.servlet.http.HttpServletRequest request, String ipAddress, String userAgent) Get an instance of MNodeService.- Parameters:
request
- the servlet request associated with the MNodeService instanceipAddress
- the ip address associated with the MNodeService instanceuserAgent
- the user agent associated with the MNodeService instance- Returns:
- the instance of MNodeService
-
delete
public org.dataone.service.types.v1.Identifier delete(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 Deletes an object from the Member Node, where the object is either a data object or a science metadata object.- Specified by:
delete
in interfaceorg.dataone.service.mn.tier3.v2.MNStorage
- Parameters:
session
- - the Session object containing the credentials for the Subjectid
- - 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
-
update
public org.dataone.service.types.v1.Identifier update(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, InputStream object, org.dataone.service.types.v1.Identifier newPid, org.dataone.service.types.v2.SystemMetadata sysmeta) 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.NotFound, org.dataone.service.exceptions.InvalidSystemMetadata, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidRequest Updates an existing object by creating a new object identified by newPid on the Member Node which explicitly obsoletes the object identified by pid through appropriate changes to the SystemMetadata of pid and newPid- Specified by:
update
in interfaceorg.dataone.service.mn.tier3.v2.MNStorage
- Parameters:
session
- - the Session object containing the credentials for the Subjectpid
- - The identifier of the object to be updatedobject
- - the new object bytessysmeta
- - the new system metadata describing the object- Returns:
- newPid - the identifier of the new 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.IdentifierNotUnique
org.dataone.service.exceptions.UnsupportedType
org.dataone.service.exceptions.InsufficientResources
org.dataone.service.exceptions.InvalidSystemMetadata
org.dataone.service.exceptions.InvalidRequest
-
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) 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 - Specified by:
create
in interfaceorg.dataone.service.mn.tier3.v2.MNStorage
- 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
-
replicate
public boolean replicate(org.dataone.service.types.v1.Session session, org.dataone.service.types.v2.SystemMetadata sysmeta, org.dataone.service.types.v1.NodeReference sourceNode) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InsufficientResources, org.dataone.service.exceptions.UnsupportedType Called by a Coordinating Node to request that the Member Node create a copy of the specified object by retrieving it from another Member Node and storing it locally so that it can be made accessible to the DataONE system.- Specified by:
replicate
in interfaceorg.dataone.service.mn.tier4.v2.MNReplication
- Parameters:
session
- - the Session object containing the credentials for the Subjectsysmeta
- - Copy of the CN held system metadata for the objectsourceNode
- - A reference to node from which the content should be retrieved. The reference should be resolved by checking the CN node registry.- Returns:
- true if the replication succeeds
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.UnsupportedType
org.dataone.service.exceptions.InsufficientResources
org.dataone.service.exceptions.InvalidRequest
-
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- Specified by:
get
in interfaceorg.dataone.service.mn.tier1.v2.MNRead
- Overrides:
get
in classD1NodeService
- 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 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
-
getChecksum
public org.dataone.service.types.v1.Checksum getChecksum(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, String algorithm) 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 Returns a Checksum for the specified object using an accepted hashing algorithm- Specified by:
getChecksum
in interfaceorg.dataone.service.mn.tier1.v2.MNRead
- Parameters:
session
- - the Session object containing the credentials for the Subjectpid
- - the object identifier for the given objectalgorithm
- - the name of an algorithm that will be used to compute a checksum of the bytes of the object- Returns:
- checksum - the checksum of the given 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
-
getSystemMetadata
public org.dataone.service.types.v2.SystemMetadata getSystemMetadata(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 system metadata for a given object- Specified by:
getSystemMetadata
in interfaceorg.dataone.service.mn.tier1.v2.MNRead
- Overrides:
getSystemMetadata
in classD1NodeService
- 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
-
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, Boolean replicaStatus, 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- Specified by:
listObjects
in interfaceorg.dataone.service.mn.tier1.v2.MNRead
- 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 (>=)objectFormatId
- - Restrict results to the specified object formatreplicaStatus
- - Indicates if replicated objects should be returned in the listidentifier
- - identifierstart
- - 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
-
getCapabilities
public org.dataone.service.types.v2.Node getCapabilities() throws org.dataone.service.exceptions.ServiceFailureReturn a description of the node's capabilities and services.- Specified by:
getCapabilities
in interfaceorg.dataone.service.mn.tier1.v2.MNCore
- Returns:
- node - the technical capabilities of the Member Node
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
- - not thrown by this implementation
-
synchronizationFailed
public boolean synchronizationFailed(org.dataone.service.types.v1.Session session, org.dataone.service.exceptions.SynchronizationFailed syncFailed) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized A callback method used by a CN to indicate to a MN that it cannot complete synchronization of the science metadata identified by pid. Log the event in the metacat event log.- Specified by:
synchronizationFailed
in interfaceorg.dataone.service.mn.tier1.v2.MNRead
- Parameters:
session
-syncFailed
-- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotImplemented
-
getReplica
public InputStream getReplica(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid) throws org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.NotFound Essentially a get() but with different logging behavior- Specified by:
getReplica
in interfaceorg.dataone.service.mn.tier1.v2.MNRead
- Throws:
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.NotFound
-
systemMetadataChanged
public boolean systemMetadataChanged(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, long serialVersion, Date dateSysMetaLastModified) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InvalidToken A method to notify the Member Node that the authoritative copy of system metadata on the Coordinating Nodes has changed.- Specified by:
systemMetadataChanged
in interfaceorg.dataone.service.mn.tier1.v2.MNRead
- Parameters:
session
- Session information that contains the identity of the calling user as retrieved from the X.509 certificate which must be traceable to the CILogon service.serialVersion
- The serialVersion of the system metadatadateSysMetaLastModified
- The time stamp for when the system metadata was changed- Throws:
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.InvalidToken
-
systemMetadataChanged
public boolean systemMetadataChanged(boolean needCheckAuthoriativeNode, org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, long serialVersion, Date dateSysMetaLastModified) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InvalidToken A method to notify the Member Node that the authoritative copy of system metadata on the Coordinating Nodes has changed.- Parameters:
needCheckAuthoriativeNode
- this is for the dataone version 2. In the version 2, there are two scenarios: 1. If the node is the authoritative node, it only accepts serial version and replica list. 2. If the node is a replica, it accepts everything. For the v1, api, the parameter should be false.session
- Session information that contains the identity of the calling user as retrieved from the X.509 certificate which must be traceable to the CILogon service.serialVersion
- The serialVersion of the system metadatadateSysMetaLastModified
- The time stamp for when the system metadata was changed- Throws:
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.InvalidToken
-
generateIdentifier
public org.dataone.service.types.v1.Identifier generateIdentifier(org.dataone.service.types.v1.Session session, String scheme, String fragment) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidRequest - Specified by:
generateIdentifier
in interfaceorg.dataone.service.mn.tier3.v2.MNStorage
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.InvalidRequest
-
getQueryEngineDescription
public org.dataone.service.types.v1_1.QueryEngineDescription getQueryEngineDescription(org.dataone.service.types.v1.Session session, String engine) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotFound - Specified by:
getQueryEngineDescription
in interfaceorg.dataone.service.mn.v2.MNQuery
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.NotFound
-
listQueryEngines
public org.dataone.service.types.v1_1.QueryEngineList listQueryEngines(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotImplemented - Specified by:
listQueryEngines
in interfaceorg.dataone.service.mn.v2.MNQuery
- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotImplemented
-
query
public InputStream query(org.dataone.service.types.v1.Session session, String engine, String query) 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 - Specified by:
query
in interfaceorg.dataone.service.mn.v2.MNQuery
- 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
-
postQuery
public InputStream postQuery(org.dataone.service.types.v1.Session session, String engine, HashMap<String, String[]> params) 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.NotFoundHandle the query sent by the http post method- Parameters:
session
- identity information of the requesterengine
- the query engine will be used. Now we only support solrparams
- the query parameters with key/value pairs- Returns:
- 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
-
publish
public org.dataone.service.types.v1.Identifier publish(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier originalIdentifier) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.IdentifierNotUnique, org.dataone.service.exceptions.UnsupportedType, org.dataone.service.exceptions.InsufficientResources, org.dataone.service.exceptions.InvalidSystemMetadata, IOException Given an existing Science Metadata PID, this method mints a DOI and updates the original object "publishing" the update with the DOI. This includes updating the ORE map that describes the Science Metadata+data.- Parameters:
session
-originalIdentifier
-- Throws:
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.InvalidSystemMetadata
org.dataone.service.exceptions.InsufficientResources
org.dataone.service.exceptions.UnsupportedType
org.dataone.service.exceptions.IdentifierNotUnique
IOException
-
editScienceMetadata
public InputStream editScienceMetadata(org.dataone.service.types.v1.Session session, InputStream object, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v1.Identifier newPid, boolean isEML, org.dataone.service.types.v2.SystemMetadata newSysmeta) throws org.dataone.service.exceptions.ServiceFailure, IOException, UnsupportedEncodingException, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotImplemented Update a science metadata document with its new Identifier- Parameters:
session
- - the Session object containing the credentials for the Subjectobject
- - the InputStream for the XML object to be editedpid
- - the Identifier of the XML object to be updatednewPid
- = the new Identifier to give to the modified XML doc- Returns:
- newObject - The InputStream for the modified XML object
- Throws:
org.dataone.service.exceptions.ServiceFailure
IOException
UnsupportedEncodingException
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.NotImplemented
-
lookupOreFor
public List<org.dataone.service.types.v1.Identifier> lookupOreFor(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier guid, boolean includeObsolete) Determines if we already have registered an ORE map for this package NOTE: uses a solr query to locate OREs for the object- Parameters:
guid
- of the EML/packaging object- Returns:
- list of resource map identifiers for the given pid
-
getPackage
public InputStream getPackage(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.ObjectFormatIdentifier formatId, 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.InvalidRequest, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotFound Exports a data package to disk using the BagIt The Bagit 0.97 format corresponds to the V1 export format The Bagit 1.0 format corresponds to the V2 export format- Specified by:
getPackage
in interfaceorg.dataone.service.mn.v2.MNPackage
- Parameters:
session
- Information about the user performing the requestformatId
-pid
- The pid of the resource map- Returns:
- A stream of a bag
- 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
-
archive
public org.dataone.service.types.v1.Identifier archive(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 Archives an object, where the object is either a data object or a science metadata object.- Specified by:
archive
in interfaceorg.dataone.service.mn.tier3.v2.MNStorage
- Parameters:
session
- - the Session object containing the credentials for the Subjectpid
- - The object identifier to be archived- 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
org.dataone.service.exceptions.InvalidRequest
-
updateSystemMetadata
public boolean updateSystemMetadata(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier pid, org.dataone.service.types.v2.SystemMetadata sysmeta) 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.- Specified by:
updateSystemMetadata
in interfaceorg.dataone.service.mn.tier3.v2.MNStorage
- 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
-
getStatus
public InputStream getStatus(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotImplemented Get the status of the system. this is an unofficial dataone api method. Currently we only reply the size of the index queue. The method will return the input stream of a xml instance. In the future, we need to add a new dataone type to represent the result.- Parameters:
session
-- Returns:
- the input stream which is the xml presentation of the status report
- Throws:
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotImplemented
-
publishIdentifier
public void publishIdentifier(org.dataone.service.types.v1.Session session, org.dataone.service.types.v1.Identifier identifier) throws org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.IdentifierNotUnique, org.dataone.service.exceptions.UnsupportedType, org.dataone.service.exceptions.InsufficientResources, org.dataone.service.exceptions.InvalidSystemMetadata, DOIException Make status of the given identifier (e.g. a DOI) public- Parameters:
session
- the subject who calls the methodidentifier
- the identifier whose status will be public. It can be a pid or sid.- Throws:
org.dataone.service.exceptions.InvalidToken
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.NotImplemented
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotFound
org.dataone.service.exceptions.IdentifierNotUnique
org.dataone.service.exceptions.UnsupportedType
org.dataone.service.exceptions.InsufficientResources
org.dataone.service.exceptions.InvalidSystemMetadata
DOIException
-
reindex
public Boolean reindex(org.dataone.service.types.v1.Session session, List<org.dataone.service.types.v1.Identifier> identifiers) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented The admin API call to reindex a list of documents in the instance.- Parameters:
session
- the identity of requester. It must have administrative permissionsidentifiers
- the list of objects' identifier which will be reindexed.- Returns:
- true if the reindex request is scheduled. If something went wrong, an exception will be thrown.
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
NotImplementedException
org.dataone.service.exceptions.NotImplemented
-
reindexAll
public Boolean reindexAll(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented The admin API call to reindex all documents in the instance.- Parameters:
session
- the identity of requester. It must have administrative permissions- Returns:
- true if the reindex request is scheduled. If something went wrong, an exception will be thrown.
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
NotImplementedException
org.dataone.service.exceptions.NotImplemented
-
updateAllIdMetadata
public Boolean updateAllIdMetadata(org.dataone.service.types.v1.Session session) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented Update all controlled identifiers' (such as DOI) metadata on the third party service.- Parameters:
session
- the identity of requester. It must have administrative permissions- Returns:
- true if the reindex request is scheduled. If something went wrong, an exception will be thrown.
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
-
updateIdMetadata
public Boolean updateIdMetadata(org.dataone.service.types.v1.Session session, String[] pids, String[] formatIds) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotImplemented Update the given identifiers' (such as DOI) metadata on the third party service.- Parameters:
session
- the identity of requester. It must have administrative permissions.pids
- the list of pids will be updatedformatIds
- the list of format id to which the identifiers belong will be updated- Returns:
- true if the reindex request is scheduled. If something went wrong, an exception will be thrown.
- Throws:
org.dataone.service.exceptions.ServiceFailure
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.NotImplemented
-
checkAdminPrivilege
protected void checkAdminPrivilege(org.dataone.service.types.v1.Session session, String serviceFailureCode, String notAuthorizedCode, String error) throws org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.ServiceFailure Check if the given session has the admin privilege. If it does not have, a NotAuthorized exception will be thrown.- Parameters:
session
- the session will be checked.serviceFailureCode
- the detail code for the ServiceFailure exceptionnotAuthorizedCode
- the detail code for the NotAuthorized exceptionerror
- the error message will be in the exception- Throws:
org.dataone.service.exceptions.NotAuthorized
org.dataone.service.exceptions.ServiceFailure
-
handleReindexAction
Rebuild the index for one or more documents- Parameters:
pids
- the list of identifier whose solr doc needs to be rebuilt
-
handleReindexAllAction
protected void handleReindexAllAction()Rebuild the index for all documents in the systemMetadata table. -
getCurrentNodeId
protected org.dataone.service.types.v1.NodeReference getCurrentNodeId() -
isAuthoritativeNode
protected boolean isAuthoritativeNode(org.dataone.service.types.v1.Identifier pid) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure Determine if the current node is the authoritative node for the given pid. (uses HZsysmeta map)- Throws:
org.dataone.service.exceptions.InvalidRequest
org.dataone.service.exceptions.ServiceFailure
-
isReadOnlyMode
protected boolean isReadOnlyMode()Check if the metacat is in the read-only mode.- Returns:
- true if it is; otherwise false.
-
setEnforcePublisEntirePackage
public static void setEnforcePublisEntirePackage(boolean enforce) Set the value if Metacat need to make the entire package public during the publish process- Parameters:
enforce
- enforce the entire package public readable or not
-
setDOIUpdater
This method is for testing only - replacing the real class by a stubbed Mockito UpdateDOI class.- Parameters:
anotherDoiUpdater
- the stubbed Mockito UpdateDOI class which will be used to replace the real class
-
setMetacatSolrIndex
This method is for testing only - replacing the real class by a stubbed Mockito MetacatSolrIndex class.- Parameters:
solrIndex
- the stubbed Mockito MetacatSolrIndex class which will be used to replace the real class
-