Package org.fcrepo.persistence.ocfl.impl
Class DbFedoraToOcflObjectIndex
java.lang.Object
org.fcrepo.persistence.ocfl.impl.DbFedoraToOcflObjectIndex
- All Implemented Interfaces:
FedoraToOcflObjectIndex
@Component("ocflIndexImpl")
public class DbFedoraToOcflObjectIndex
extends Object
implements FedoraToOcflObjectIndex
Maps Fedora IDs to the OCFL IDs of the OCFL objects the Fedora resource is stored in. This implementation is backed
by a relational database.
- Author:
- pwinckles
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddMapping(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId, org.fcrepo.kernel.api.identifiers.FedoraId fedoraRootId, String ocflId) Adds a mapping to the indexvoidClear all transactions in the ocfl index.voidcommit(org.fcrepo.kernel.api.Transaction transaction) Commit mapping changes for the session.getMapping(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId) Retrieve identification information for the OCFL object which either contains, or is identified by, the provided fedora resource id.voidremoveMapping(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId) Removes a mappingvoidreset()Remove all persistent state associated with the index.voidrollback(org.fcrepo.kernel.api.Transaction transaction) Rollback mapping changes for the session.voidsetup()
-
Constructor Details
-
DbFedoraToOcflObjectIndex
-
-
Method Details
-
setup
-
getMapping
public FedoraOcflMapping getMapping(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId) throws FedoraOcflMappingNotFoundException Description copied from interface:FedoraToOcflObjectIndexRetrieve identification information for the OCFL object which either contains, or is identified by, the provided fedora resource id. In other words the method will find the closest resource that is persisted as an OCFL object and returns its identifiers. If you pass fedora identifier that is not part of an archival group such as "my/fedora/binary/fcr:metadata" the fedora resource returned in the mapping will be "my/fedora/binary". Contrast this with an Archival Group example: if you pass in "my/archival-group/binary/fcr:metadata" the resource returned in the mapping would be "my/archival-group".- Specified by:
getMappingin interfaceFedoraToOcflObjectIndex- Parameters:
transaction- the current session, or null for read-only.fedoraId- the fedora resource identifier- Returns:
- the mapping
- Throws:
FedoraOcflMappingNotFoundException- when no mapping exists for the specified identifier.
-
addMapping
public FedoraOcflMapping addMapping(@Nonnull org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId, org.fcrepo.kernel.api.identifiers.FedoraId fedoraRootId, String ocflId) Description copied from interface:FedoraToOcflObjectIndexAdds a mapping to the index- Specified by:
addMappingin interfaceFedoraToOcflObjectIndex- Parameters:
transaction- the current session.fedoraId- The fedora resourcefedoraRootId- The identifier of the root fedora object resourceocflId- The ocfl object id- Returns:
- The newly created mapping
-
removeMapping
public void removeMapping(@Nonnull org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId fedoraId) Description copied from interface:FedoraToOcflObjectIndexRemoves a mapping- Specified by:
removeMappingin interfaceFedoraToOcflObjectIndex- Parameters:
transaction- the current session.fedoraId- The fedora resource to remove the mapping for
-
reset
Description copied from interface:FedoraToOcflObjectIndexRemove all persistent state associated with the index.- Specified by:
resetin interfaceFedoraToOcflObjectIndex
-
commit
Description copied from interface:FedoraToOcflObjectIndexCommit mapping changes for the session.- Specified by:
commitin interfaceFedoraToOcflObjectIndex- Parameters:
transaction- the session to commit.
-
rollback
@Transactional(propagation=NOT_SUPPORTED) public void rollback(@Nonnull org.fcrepo.kernel.api.Transaction transaction) Description copied from interface:FedoraToOcflObjectIndexRollback mapping changes for the session.- Specified by:
rollbackin interfaceFedoraToOcflObjectIndex- Parameters:
transaction- the session to rollback.
-
clearAllTransactions
Description copied from interface:FedoraToOcflObjectIndexClear all transactions in the ocfl index.- Specified by:
clearAllTransactionsin interfaceFedoraToOcflObjectIndex
-