Class CNResourceHandler
java.lang.Object
edu.ucsb.nceas.metacat.restservice.D1ResourceHandler
edu.ucsb.nceas.metacat.restservice.v2.CNResourceHandler
CN REST service implementation handler
****************** CNCore
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 -- 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 Summary
Modifier and TypeFieldDescriptionprotected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
CN-specific operationsprotected static final String
Fields inherited from class edu.ucsb.nceas.metacat.restservice.D1ResourceHandler
auth, authCacheSize, DELETE, enableAppendLdapGroups, enableSessionFromHeader, FUNCTION_NAME_INSERT, FUNCTION_NAME_UPDATE, GET, HEAD, MAX_UPLOAD_SIZE, multipartparams, params, POST, proxyKey, PUT, request, RESOURCE_ACCESS_RULES, RESOURCE_BASE_URL, RESOURCE_IS_AUTHORIZED, RESOURCE_LOG, RESOURCE_META, RESOURCE_OBJECTS, RESOURCE_QUERY, RESOURCE_VIEWS, response, session
-
Constructor Summary
ConstructorDescriptionCNResourceHandler
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
deleteReplica
(String pid) Delete the replica entry with the given nodeId for the given pidprotected void
Implements REST version of DataONE CRUD API --> getprotected void
Implements REST version of DataONE CRUD API --> getSystemMetadatavoid
handle
(byte httpVerb) This function is called from REST API servlet and handles each request to the servletboolean
isNodeAuthorized
(String pid) Pass the request to get node replication authorization to CNodeServiceprotected void
Earthgrid API > Put Service >Put Function : calls MetacatHandler > handleInsertOrUpdateActionprotected void
Register System Metadata without data or metadata objectprotected void
set the access perms on a documentboolean
setObsoletedBy
(String pid) Update the system metadata for a given pid, setting it to be obsoleted by the obsoletedByPidboolean
Pass the request to set the replication policy to CNodeServiceboolean
Pass the request to set the replication status to CNodeServiceboolean
Pass the request to update the replication metadata to CNodeServiceprotected void
Update the system metadata for a specified pidMethods inherited from class edu.ucsb.nceas.metacat.restservice.D1ResourceHandler
collectMultipartFiles, collectMultipartParams, collectObjectFiles, decode, getSessionFromHeader, getTempDirectory, initMultipartParams, initParams, isD1Enabled, parseTrailing, printError, serializeException
-
Field Details
-
RESOURCE_RESERVE
CN-specific operations- See Also:
-
RESOURCE_FORMATS
- See Also:
-
RESOURCE_RESOLVE
- See Also:
-
RESOURCE_OWNER
- See Also:
-
RESOURCE_REPLICATION_POLICY
- See Also:
-
RESOURCE_REPLICATION_META
- See Also:
-
RESOURCE_REPLICATION_AUTHORIZED
- See Also:
-
RESOURCE_REPLICATION_NOTIFY
- See Also:
-
-
Constructor Details
-
CNResourceHandler
public CNResourceHandler(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) Constructor- Parameters:
request
- the request that the handler will handleresponse
- the response that the handler will send back
-
-
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 classD1ResourceHandler
- 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, InterruptedException, InstantiationException, IllegalAccessException, NoSuchAlgorithmException, org.apache.commons.fileupload.FileUploadException, InvocationTargetException 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
InterruptedException
InvocationTargetException
-
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, IllegalAccessExceptionRegister System Metadata without data or metadata object- 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.InvalidTokenUpdate 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
-