Package org.fcrepo.http.api
Class FedoraBaseResource
- java.lang.Object
-
- org.fcrepo.http.commons.AbstractResource
-
- org.fcrepo.http.api.FedoraBaseResource
-
- Direct Known Subclasses:
ContentExposingResource,FedoraReindex,FedoraSearch,Transactions
public abstract class FedoraBaseResource extends org.fcrepo.http.commons.AbstractResource
- Since:
- 10/5/14
- Author:
- cabeer
-
-
Field Summary
Fields Modifier and Type Field Description protected org.fcrepo.common.db.DbTransactionExecutordbTransactionExecutorprotected org.fcrepo.http.commons.api.rdf.HttpIdentifierConverteridentifierConverterprotected org.fcrepo.kernel.api.models.ResourceFactoryresourceFactoryprotected org.fcrepo.kernel.api.models.ResourceHelperresourceHelperprotected javax.ws.rs.core.SecurityContextsecurityContextprotected javax.servlet.http.HttpServletRequestservletRequestprotected org.fcrepo.kernel.api.TransactionManagertxManager
-
Constructor Summary
Constructors Constructor Description FedoraBaseResource()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleandoesResourceExist(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId, boolean includeDeleted)protected voiddoInDbTx(Runnable action)Executes the runnable within a DB transaction.protected voiddoInDbTxWithRetry(Runnable action)Executes the runnable within a DB transaction that will retry entire block on MySQL deadlock exceptions.protected org.fcrepo.kernel.api.models.FedoraResourcegetFedoraResource(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId)Gets a fedora resource by id.protected StringgetUserPrincipal()protected org.fcrepo.http.commons.api.rdf.HttpIdentifierConverteridentifierConverter()protected booleanisGhostNode(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId)protected org.fcrepo.kernel.api.Transactiontransaction()
-
-
-
Field Detail
-
securityContext
@Context protected javax.ws.rs.core.SecurityContext securityContext
-
resourceFactory
@Inject protected org.fcrepo.kernel.api.models.ResourceFactory resourceFactory
-
resourceHelper
@Inject protected org.fcrepo.kernel.api.models.ResourceHelper resourceHelper
-
servletRequest
@Context protected javax.servlet.http.HttpServletRequest servletRequest
-
txManager
@Inject protected org.fcrepo.kernel.api.TransactionManager txManager
-
dbTransactionExecutor
@Inject protected org.fcrepo.common.db.DbTransactionExecutor dbTransactionExecutor
-
identifierConverter
protected org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter identifierConverter
-
-
Constructor Detail
-
FedoraBaseResource
public FedoraBaseResource()
-
-
Method Detail
-
identifierConverter
protected org.fcrepo.http.commons.api.rdf.HttpIdentifierConverter identifierConverter()
-
getFedoraResource
protected org.fcrepo.kernel.api.models.FedoraResource getFedoraResource(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId) throws org.fcrepo.kernel.api.exception.PathNotFoundException
Gets a fedora resource by id. Uses the provided transaction if it is uncommitted, or uses a new transaction.- Parameters:
transaction- the fedora transactionfedoraId- identifier of the resource- Returns:
- the requested FedoraResource
- Throws:
org.fcrepo.kernel.api.exception.PathNotFoundException
-
doesResourceExist
protected boolean doesResourceExist(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId, boolean includeDeleted)
- Parameters:
transaction- the transaction in which to checkfedoraId- identifier of the object to checkincludeDeleted- Whether to check for deleted resources too.- Returns:
- Returns true if an object with the provided id exists
-
isGhostNode
protected boolean isGhostNode(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId)
- Parameters:
transaction- the transaction in which to checkfedoraId- identifier of the object to check- Returns:
- Returns true if object does not exist but whose ID starts other resources that do exist.
-
getUserPrincipal
protected String getUserPrincipal()
-
transaction
protected org.fcrepo.kernel.api.Transaction transaction()
-
doInDbTxWithRetry
protected void doInDbTxWithRetry(Runnable action)
Executes the runnable within a DB transaction that will retry entire block on MySQL deadlock exceptions. If the runnable throws an exception, after completing any retires, then the Fedora transaction is marked as failed.- Parameters:
action- the code to execute
-
-