Class CNResourceHandler

java.lang.Object
edu.ucsb.nceas.metacat.restservice.D1ResourceHandler
edu.ucsb.nceas.metacat.restservice.v2.CNResourceHandler

public class CNResourceHandler extends D1ResourceHandler
CN REST service implementation handler ****************** CNCore -- DONE create() - POST /d1/cn/object/PID listFormats() - GET /d1/cn/formats getFormat() - GET /d1/cn/formats/FMTID getLogRecords - GET /d1/cn/log reserveIdentifier() - POST /d1/cn/reserve listNodes() - Not implemented registerSystemMetadata() - POST /d1/meta/PID CNRead -- DONE get() - GET /d1/cn/object/PID getSystemMetadata() - GET /d1/cn/meta/PID resolve() - GET /d1/cn/resolve/PID assertRelation() - GET /d1/cn/assertRelation/PID getChecksum() - GET /d1/cn/checksum search() - Not implemented in Metacat CNAuthorization setOwner() - PUT /d1/cn/owner/PID isAuthorized() - GET /d1/cn/isAuthorized/PID setAccessPolicy() - POST /d1/cn/accessRules CNIdentity - not implemented at all on Metacat CNReplication setReplicationStatus() - PUT /replicaNotifications/PID updateReplicationMetadata() - PUT /replicaMetadata/PID setReplicationPolicy() - PUT /replicaPolicies/PID isNodeAuthorized() - GET /replicaAuthorizations/PID CNRegister -- not implemented at all in Metacat ******************
Author:
leinfelder
  • Field Details

  • Constructor Details

    • CNResourceHandler

      public CNResourceHandler(javax.servlet.ServletContext servletContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
  • Method Details

    • handle

      public void handle(byte httpVerb)
      This function is called from REST API servlet and handles each request to the servlet
      Overrides:
      handle in class D1ResourceHandler
      Parameters:
      httpVerb - (GET, POST, PUT or DELETE)
    • getObject

      protected void getObject(String guid) 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, IOException
      Implements REST version of DataONE CRUD API --> get
      Parameters:
      guid - ID of data object to be read
      Throws:
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.NotFound
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.InvalidToken
      IOException
    • getSystemMetadataObject

      protected void getSystemMetadataObject(String guid) 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, IOException, org.dataone.exceptions.MarshallingException
      Implements REST version of DataONE CRUD API --> getSystemMetadata
      Parameters:
      guid - ID of data object to be read
      Throws:
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.NotFound
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.InvalidToken
      IOException
      org.dataone.exceptions.MarshallingException
    • putObject

      protected void putObject(String action) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.IdentifierNotUnique, org.dataone.exceptions.MarshallingException, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.UnsupportedType, org.dataone.service.exceptions.InsufficientResources, org.dataone.service.exceptions.InvalidSystemMetadata, org.dataone.service.exceptions.NotImplemented, IOException, InstantiationException, IllegalAccessException, NoSuchAlgorithmException, org.apache.commons.fileupload.FileUploadException
      Earthgrid API > Put Service >Put Function : calls MetacatHandler > handleInsertOrUpdateAction
      Parameters:
      guid - - ID of data object to be inserted or updated. If action is update, the pid is the existing pid. If insert, the pid is the new one
      Throws:
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.IdentifierNotUnique
      org.dataone.exceptions.MarshallingException
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.InvalidSystemMetadata
      org.dataone.service.exceptions.InsufficientResources
      org.dataone.service.exceptions.UnsupportedType
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.InvalidToken
      IOException
      IllegalAccessException
      InstantiationException
      org.apache.commons.fileupload.FileUploadException
      NoSuchAlgorithmException
    • registerSystemMetadata

      protected void registerSystemMetadata() throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest, IOException, org.apache.commons.fileupload.FileUploadException, org.dataone.exceptions.MarshallingException, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidSystemMetadata, InstantiationException, IllegalAccessException
      Register System Metadata without data or metadata object
      Parameters:
      pid - identifier for System Metadata entry
      Throws:
      org.dataone.exceptions.MarshallingException
      org.apache.commons.fileupload.FileUploadException
      IOException
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.InvalidSystemMetadata
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.NotImplemented
      IllegalAccessException
      InstantiationException
    • setAccess

      protected void setAccess(String pid) throws org.dataone.exceptions.MarshallingException, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidRequest, IOException, InstantiationException, IllegalAccessException, ParserConfigurationException, SAXException, org.dataone.service.exceptions.VersionMismatch
      set the access perms on a document
      Throws:
      org.dataone.exceptions.MarshallingException
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.NotFound
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.InvalidToken
      IllegalAccessException
      InstantiationException
      IOException
      SAXException
      ParserConfigurationException
      org.dataone.service.exceptions.VersionMismatch
    • isNodeAuthorized

      public boolean isNodeAuthorized(String pid) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.InvalidRequest
      Pass the request to get node replication authorization to CNodeService
      Parameters:
      pid - the identifier of the object to get authorization to replicate
      Throws:
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.InvalidToken
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.NotFound
      org.dataone.service.exceptions.InvalidRequest
    • setReplicationPolicy

      public boolean setReplicationPolicy(String pid) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InvalidToken, IOException, InstantiationException, IllegalAccessException, org.dataone.exceptions.MarshallingException, org.dataone.service.exceptions.VersionMismatch
      Pass the request to set the replication policy to CNodeService
      Parameters:
      pid - the identifier of the object to set the replication policy on
      Throws:
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.NotFound
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.InvalidToken
      IOException
      InstantiationException
      IllegalAccessException
      org.dataone.exceptions.MarshallingException
      org.dataone.service.exceptions.VersionMismatch
    • setObsoletedBy

      public boolean setObsoletedBy(String pid) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InvalidToken, InstantiationException, IllegalAccessException, org.dataone.service.exceptions.VersionMismatch
      Update the system metadata for a given pid, setting it to be obsoleted by the obsoletedByPid
      Parameters:
      pid -
      Returns:
      Throws:
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.NotFound
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.InvalidToken
      InstantiationException
      IllegalAccessException
      org.dataone.service.exceptions.VersionMismatch
    • deleteReplica

      public boolean deleteReplica(String pid) throws org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.InvalidToken, InstantiationException, IllegalAccessException, org.dataone.service.exceptions.VersionMismatch
      Delete the replica entry with the given nodeId for the given pid
      Parameters:
      pid -
      Returns:
      Throws:
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.NotFound
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.InvalidToken
      InstantiationException
      IllegalAccessException
      org.dataone.service.exceptions.VersionMismatch
    • setReplicationStatus

      public boolean setReplicationStatus(String pid) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotFound
      Pass the request to set the replication status to CNodeService
      Parameters:
      pid - the identifier of the object to set the replication status on
      Throws:
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.InvalidToken
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.NotFound
      org.dataone.exceptions.MarshallingException
      IllegalAccessException
      InstantiationException
      IOException
    • updateReplicationMetadata

      public boolean updateReplicationMetadata(String pid) throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.InvalidToken, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidRequest, org.dataone.service.exceptions.NotFound, org.dataone.service.exceptions.VersionMismatch, InstantiationException, IllegalAccessException, IOException, org.dataone.exceptions.MarshallingException
      Pass the request to update the replication metadata to CNodeService
      Parameters:
      pid - the identifier of the object to update the replication metadata on
      Throws:
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.InvalidToken
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.InvalidRequest
      org.dataone.service.exceptions.NotFound
      org.dataone.service.exceptions.VersionMismatch
      org.dataone.exceptions.MarshallingException
      IOException
      IllegalAccessException
      InstantiationException
    • updateSystemMetadata

      protected void updateSystemMetadata() throws org.dataone.service.exceptions.ServiceFailure, org.dataone.service.exceptions.InvalidRequest, InstantiationException, IllegalAccessException, IOException, org.dataone.exceptions.MarshallingException, org.dataone.service.exceptions.NotImplemented, org.dataone.service.exceptions.NotAuthorized, org.dataone.service.exceptions.InvalidSystemMetadata, org.dataone.service.exceptions.InvalidToken
      Update the system metadata for a specified pid
      Throws:
      org.dataone.service.exceptions.ServiceFailure
      org.dataone.service.exceptions.InvalidRequest
      InstantiationException
      IllegalAccessException
      IOException
      org.dataone.exceptions.MarshallingException
      org.dataone.service.exceptions.NotImplemented
      org.dataone.service.exceptions.NotAuthorized
      org.dataone.service.exceptions.InvalidSystemMetadata
      org.dataone.service.exceptions.InvalidToken