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
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     

    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 Type
    Method
    Description
    org.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 Identifier
    org.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 identifier
    org.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 algorithm
    protected org.dataone.service.types.v1.NodeReference
     
    getInstance(javax.servlet.http.HttpServletRequest request)
    Get an instance of 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 format
    org.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 behavior
    getStatus(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 object
    protected void
    handleReindexAction(List<org.dataone.service.types.v1.Identifier> pids)
    Rebuild the index for one or more documents
    protected 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 parameters
    org.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 object
    postQuery(org.dataone.service.types.v1.Session session, String engine, HashMap<String,String[]> params)
    Handle the query sent by the http post method
    org.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.
    query(org.dataone.service.types.v1.Session session, String engine, String query)
     
    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
    Set the value if Metacat need to make the entire package public during the publish process
    static void
    This method is for testing only - replacing the real class by a stubbed Mockito MetacatSolrIndex class.
    static ObjectInfo
    storeData(Storage storage, InputStream inputStream, org.dataone.service.types.v1.SystemMetadata sysmeta)
    Store the input stream into hash store
    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 newPid
    updateAllIdMetadata(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 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

  • Method Details

    • getInstance

      public static MNodeService getInstance(javax.servlet.http.HttpServletRequest request)
      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 instance
      ipAddress - the ip address associated with the MNodeService instance
      userAgent - 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 interface org.dataone.service.mn.tier3.v2.MNStorage
      Parameters:
      session - - the Session object containing the credentials for the Subject
      id - - 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 interface org.dataone.service.mn.tier3.v2.MNStorage
      Parameters:
      session - - the Session object containing the credentials for the Subject
      pid - - The identifier of the object to be updated
      object - - the new object bytes
      sysmeta - - 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 interface org.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 interface org.dataone.service.mn.tier4.v2.MNReplication
      Parameters:
      session - - the Session object containing the credentials for the Subject
      sysmeta - - Copy of the CN held system metadata for the object
      sourceNode - - 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 interface org.dataone.service.mn.tier1.v2.MNRead
      Overrides:
      get in class D1NodeService
      Parameters:
      session - - the Session object containing the credentials for the Subject
      pid - - 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 interface org.dataone.service.mn.tier1.v2.MNRead
      Parameters:
      session - - the Session object containing the credentials for the Subject
      pid - - the object identifier for the given object
      algorithm - - 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 interface org.dataone.service.mn.tier1.v2.MNRead
      Overrides:
      getSystemMetadata in class D1NodeService
      Parameters:
      session - - the Session object containing the credentials for the Subject
      pid - - 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 interface org.dataone.service.mn.tier1.v2.MNRead
      Parameters:
      session - - the Session object containing the credentials for the Subject
      startTime - - 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 format
      replicaStatus - - Indicates if replicated objects should be returned in the list
      identifier - - identifier
      start - - 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.ServiceFailure
      Return a description of the node's capabilities and services.
      Specified by:
      getCapabilities in interface org.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 interface org.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 interface org.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 interface org.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 metadata
      dateSysMetaLastModified - 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 metadata
      dateSysMetaLastModified - 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 interface org.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 interface org.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 interface org.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 interface org.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.NotFound
      Handle the query sent by the http post method
      Parameters:
      session - identity information of the requester
      engine - the query engine will be used. Now we only support solr
      params - 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 Subject
      object - - the InputStream for the XML object to be edited
      pid - - the Identifier of the XML object to be updated
      newPid - = 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 interface org.dataone.service.mn.v2.MNPackage
      Parameters:
      session - Information about the user performing the request
      formatId -
      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 interface org.dataone.service.mn.tier3.v2.MNStorage
      Parameters:
      session - - the Session object containing the credentials for the Subject
      pid - - 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 interface org.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 method
      identifier - 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 permissions
      identifiers - 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 updated
      formatIds - 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 exception
      notAuthorizedCode - the detail code for the NotAuthorized exception
      error - the error message will be in the exception
      Throws:
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.ServiceFailure
    • handleReindexAction

      protected void handleReindexAction(List<org.dataone.service.types.v1.Identifier> pids)
      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

      public static void setDOIUpdater(UpdateDOI anotherDoiUpdater)
      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

      public static void setMetacatSolrIndex(MetacatSolrIndex solrIndex)
      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
    • storeData

      public static ObjectInfo storeData(Storage storage, InputStream inputStream, org.dataone.service.types.v1.SystemMetadata sysmeta) throws NoSuchAlgorithmException, IOException, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InvalidSystemMetadata, RuntimeException, InterruptedException, org.dataone.service.exceptions.ServiceFailure
      Store the input stream into hash store
      Parameters:
      storage - the storage system which stores the object
      inputStream - the object
      sysmeta - the system metadata associated with the object
      Returns:
      the metadata of the object
      Throws:
      NoSuchAlgorithmException
      IOException
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.InvalidSystemMetadata
      RuntimeException
      InterruptedException
      org.dataone.service.exceptions.ServiceFailure