Class SystemMetadataManager

java.lang.Object
edu.ucsb.nceas.metacat.systemmetadata.SystemMetadataManager

public class SystemMetadataManager extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    convertPermission(org.dataone.service.types.v1.Permission permission)
    Utility method to convert a permission object to an integer
    void
    delete(org.dataone.service.types.v1.Identifier id)
    Delete a system metadata record from the store
    void
    delete(org.dataone.service.types.v1.Identifier guid, DBConnection dbConn)
    Delete the system metadata for the given guid with the DBConnection object
    org.dataone.service.types.v2.SystemMetadata
    get(org.dataone.service.types.v1.Identifier pid)
    Get the system metadata associated with the given identifier from the store.
    Get the singleton SystemMetadataManager instance
    void
    store(org.dataone.service.types.v2.SystemMetadata sysmeta)
    Store a system metadata record into the store The modification time will be changed and system metadata version will be checked during the process
    void
    store(org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModifyTime, DBConnection dbConn, SystemMetadataManager.SysMetaVersion sysMetaCheck)
    Store a system metadata record into the store.
    void
    store(org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModifyTime, SystemMetadataManager.SysMetaVersion sysMetaCheck)
    Store a system metadata record into the store
    protected void
    updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sm, DBConnection dbConn)
    Insert the system metadata fields into the db

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getInstance

      public static SystemMetadataManager getInstance()
      Get the singleton SystemMetadataManager instance
      Returns:
      the instance of SystemMetadataManager
    • get

      public org.dataone.service.types.v2.SystemMetadata get(org.dataone.service.types.v1.Identifier pid) throws org.dataone.service.exceptions.ServiceFailure
      Get the system metadata associated with the given identifier from the store. If the returned value is null, this means the system metadata is not found
      Parameters:
      pid - the identifier to determine the system metadata
      Returns:
      the system metadata associated with the given identifier
      Throws:
      org.dataone.service.exceptions.ServiceFailure
    • store

      public void store(org.dataone.service.types.v2.SystemMetadata sysmeta) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure
      Store a system metadata record into the store The modification time will be changed and system metadata version will be checked during the process
      Parameters:
      sysmeta - the new system metadata will be inserted
      Throws:
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.ServiceFailure
    • store

      public void store(org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModifyTime, SystemMetadataManager.SysMetaVersion sysMetaCheck) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure
      Store a system metadata record into the store
      Parameters:
      sysmeta - the new system metadata will be inserted
      changeModifyTime - if we need to change the modify time
      sysMetaCheck - check whether the version of the provided '@param sysmeta' matches the version of the existing metadata
      Throws:
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.ServiceFailure
    • store

      public void store(org.dataone.service.types.v2.SystemMetadata sysmeta, boolean changeModifyTime, DBConnection dbConn, SystemMetadataManager.SysMetaVersion sysMetaCheck) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure
      Store a system metadata record into the store. Note: the calling code is responsible for (a) setting setAutoCommit(false) before passing the DBConnection, and (b) calling commit() after this method has finished execution.
      Parameters:
      sysmeta - the new system metadata will be inserted
      changeModifyTIme - if we need to change the modify time
      dbConn - the db connection will be used during storing the system metadata into db
      sysMetaCheck - if Metacat needs to check the version of the coming system metadata matching the version of the existing one.
      Throws:
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.ServiceFailure
    • delete

      public void delete(org.dataone.service.types.v1.Identifier id) throws org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.ServiceFailure
      Delete a system metadata record from the store
      Parameters:
      id - the identifier to determine the system metadata record
      Throws:
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.ServiceFailure
    • updateSystemMetadata

      protected void updateSystemMetadata(org.dataone.service.types.v2.SystemMetadata sm, DBConnection dbConn) throws McdbDocNotFoundException, SQLException, org.dataone.service.exceptions.InvalidSystemMetadata, AccessException
      Insert the system metadata fields into the db
      Parameters:
      sm -
      Throws:
      McdbDocNotFoundException
      SQLException
      org.dataone.service.exceptions.InvalidSystemMetadata
      AccessException
    • convertPermission

      public static int convertPermission(org.dataone.service.types.v1.Permission permission)
      Utility method to convert a permission object to an integer
      Parameters:
      permission - the permission which needs to be convert
      Returns:
      the integer presentation of the permission
    • delete

      public void delete(org.dataone.service.types.v1.Identifier guid, DBConnection dbConn) throws org.dataone.service.exceptions.InvalidRequest, SQLException
      Delete the system metadata for the given guid with the DBConnection object
      Parameters:
      guid - the identifier of the object whose system metadata will be deleted
      dbConn - the DBConnection object which will execute the delete actions
      Throws:
      org.dataone.service.exceptions.InvalidRequest
      SQLException