On 11/04/2011 04:19 AM, Caleb James DeLisle wrote:
We need a way for subservient stores such as FS
attachments to get transactions from the main store so that it can know to rollback if
there is an error in the main store.
In order to Cloud/DataNucleus store plug in seamlessly and function with FS attachments,
FS attachments needs to be able to get transactions from the main store without knowing or
caring what that main store is.
I propose this:
Add a new storage submodule: xwiki-platform-store-transactionprovider which provides this
interface which extends javax.inject.Provider:
@ComponentRole
public interface XWikiTransactionProvider
extends Provider<StartableTransactionRunnable<? extends
XWikiTransaction>>
{
// No additional functions, just the get() from Provider.
}
The default implementation for now will be a wrapper which picks out the real
TransactionProvider based on what the main store is, as defined in xwiki.cfg.
Correction: Using the hint "default" is not possible because the
TransactionProvider will use the same hint as the store and the "default" store
is the Hibernate
based store so the wrapper will use the hint "configured".
> This will allow code to get a transaction from the main store then get
TransactionRunnables from the main store and use them with this transaction and be
assured
> that you won't be using a Hibernate TransactionRunnable with a Cassandra
Transaction.
>
> WDYT?
>
> Caleb