Package org.fcrepo.kernel.impl.services
Class MembershipIndexManager
- java.lang.Object
-
- org.fcrepo.kernel.impl.services.MembershipIndexManager
-
@Component public class MembershipIndexManager extends Object
Manager for the membership index- Author:
- bbpennel
-
-
Constructor Summary
Constructors Constructor Description MembershipIndexManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMembership(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, org.fcrepo.kernel.api.identifiers.FedoraId proxyId, org.apache.jena.graph.Triple membership, Instant startTime)Add new membership property to the index, clearing any delete operations for the property if necessary.voidaddMembership(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, org.fcrepo.kernel.api.identifiers.FedoraId proxyId, org.apache.jena.graph.Triple membership, Instant startTime, Instant endTime)Add new membership property to the indexvoidclearAllTransactions()voidclearIndex()Clear all entries from the indexvoidcommitTransaction(org.fcrepo.kernel.api.Transaction tx)Perform a commit of operations stored in the specified transactionvoiddeleteMembershipForProxyAfter(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, org.fcrepo.kernel.api.identifiers.FedoraId proxyId, Instant afterTime)voiddeleteMembershipForSourceAfter(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, Instant afterTime)Delete membership entries that are active at or after the given timestamp for the specified sourcevoiddeleteMembershipReferences(String txId, org.fcrepo.kernel.api.identifiers.FedoraId targetId)Clean up any references to the target id, in transactions and outsidevoiddeleteTransaction(org.fcrepo.kernel.api.Transaction tx)Delete all entries related to a transactionvoidendMembershipForSource(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, Instant endTime)End all membership properties resulting from the specified source containervoidendMembershipFromChild(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, org.fcrepo.kernel.api.identifiers.FedoraId proxyId, Instant endTime)End a membership from the child of a Direct/IndirectContainer, setting an end time if committed, or clearing from the current tx if it was newly added.DataSourcegetDataSource()Get the JDBC datastore.InstantgetLastUpdated(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId subjectId)Stream<org.apache.jena.graph.Triple>getMembership(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId subjectId)Get a stream of membership triples withprotected voidlogMembership()Log all membership entries, for debugging usage onlyprotected voidlogOperations()Log all membership operations, for debugging usage onlyvoidsetDataSource(DataSource dataSource)Set the JDBC datastore.voidsetUp()
-
-
-
Constructor Detail
-
MembershipIndexManager
public MembershipIndexManager()
-
-
Method Detail
-
setUp
@PostConstruct public void setUp()
-
endMembershipFromChild
public void endMembershipFromChild(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, org.fcrepo.kernel.api.identifiers.FedoraId proxyId, Instant endTime)
End a membership from the child of a Direct/IndirectContainer, setting an end time if committed, or clearing from the current tx if it was newly added.- Parameters:
tx- transactionsourceId- ID of the direct/indirect container whose membership should be endedproxyId- ID of the proxy producing this membership, when applicableendTime- the time the resource was deleted, generally its last modified
-
deleteMembershipForProxyAfter
public void deleteMembershipForProxyAfter(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, org.fcrepo.kernel.api.identifiers.FedoraId proxyId, Instant afterTime)
-
endMembershipForSource
public void endMembershipForSource(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, Instant endTime)
End all membership properties resulting from the specified source container- Parameters:
tx- transactionsourceId- ID of the direct/indirect container whose membership should be endedendTime- the time the resource was deleted, generally its last modified
-
deleteMembershipForSourceAfter
public void deleteMembershipForSourceAfter(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, Instant afterTime)
Delete membership entries that are active at or after the given timestamp for the specified source- Parameters:
tx- transactionsourceId- ID of the direct/indirect containerafterTime- time at or after which membership should be removed
-
deleteMembershipReferences
public void deleteMembershipReferences(String txId, org.fcrepo.kernel.api.identifiers.FedoraId targetId)
Clean up any references to the target id, in transactions and outside- Parameters:
txId- transaction idtargetId- identifier of the resource to cleanup membership references for
-
addMembership
public void addMembership(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, org.fcrepo.kernel.api.identifiers.FedoraId proxyId, org.apache.jena.graph.Triple membership, Instant startTime)
Add new membership property to the index, clearing any delete operations for the property if necessary.- Parameters:
tx- transactionsourceId- ID of the direct/indirect container which produced the membershipproxyId- ID of the proxy producing this membership, when applicablemembership- membership triplestartTime- time the membership triple was added
-
addMembership
public void addMembership(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId sourceId, org.fcrepo.kernel.api.identifiers.FedoraId proxyId, org.apache.jena.graph.Triple membership, Instant startTime, Instant endTime)
Add new membership property to the index- Parameters:
tx- transactionsourceId- ID of the direct/indirect container which produced the membershipproxyId- ID of the proxy producing this membership, when applicablemembership- membership triplestartTime- time the membership triple was addedendTime- time the membership triple ends, or never if not provided
-
getMembership
public Stream<org.apache.jena.graph.Triple> getMembership(org.fcrepo.kernel.api.Transaction tx, org.fcrepo.kernel.api.identifiers.FedoraId subjectId)
Get a stream of membership triples with- Parameters:
tx- transaction from which membership will be retrieved, or null for no transactionsubjectId- ID of the subject- Returns:
- Stream of membership triples
-
getLastUpdated
public Instant getLastUpdated(org.fcrepo.kernel.api.Transaction transaction, org.fcrepo.kernel.api.identifiers.FedoraId subjectId)
-
commitTransaction
public void commitTransaction(org.fcrepo.kernel.api.Transaction tx)
Perform a commit of operations stored in the specified transaction- Parameters:
tx- transaction
-
deleteTransaction
@Transactional(propagation=NOT_SUPPORTED) public void deleteTransaction(org.fcrepo.kernel.api.Transaction tx)
Delete all entries related to a transaction- Parameters:
tx- transaction
-
clearIndex
public void clearIndex()
Clear all entries from the index
-
clearAllTransactions
public void clearAllTransactions()
-
logMembership
protected void logMembership()
Log all membership entries, for debugging usage only
-
logOperations
protected void logOperations()
Log all membership operations, for debugging usage only
-
setDataSource
public void setDataSource(DataSource dataSource)
Set the JDBC datastore.- Parameters:
dataSource- the dataStore.
-
getDataSource
public DataSource getDataSource()
Get the JDBC datastore.- Returns:
- the dataStore.
-
-