Package org.jvnet.hk2.config.provider
Interface ConfigTransaction
public interface ConfigTransaction
Represents a configuration transaction from an outside
configuration system.
In all of the methods that take configuration beans, it is
expected that those objects are annotated with
Configured. Additionally, the object identity
of the bean must be unique; so that a call to delete
a bean must correspond to some previous addition of
the bean from earlier by object identity.- Author:
- Jeff Trent
-
Method Summary
Modifier and TypeMethodDescriptionvoidcommit()Locks changes, calls prepare (if not yet performed), followed by commit if no prepare errors.voidSame basic behavior ascommit()with the added ability to substitute configuration beans used in the prepare phase with the final bean object replacements that should be managed.voidAdd configuration beans to the transaction.voidMarks configuration beans as having been deleted.voiddeleted(Collection<?> deletedConfigBeans) voidprepare()Locks changes, calls prepare.voidrollback()Cancels the transaction, locking it out from further changes.voidupdated(Object updatedConfigBean, PropertyChangeEvent event) Mark configuration beans as having been updated (note that name and metadata cannot change here).voidupdated(Collection<?> updatedConfigBeans)
-
Method Details
-
created
Add configuration beans to the transaction.- Parameters:
created- - the configuration bean instance being createdname- - optionally the name for the configurationmetadata- - name,value(s)
-
updated
Mark configuration beans as having been updated (note that name and metadata cannot change here). -
updated
-
deleted
Marks configuration beans as having been deleted. -
deleted
-
prepare
Locks changes, calls prepare.- Throws:
ConfigTransactionException
-
commit
Locks changes, calls prepare (if not yet performed), followed by commit if no prepare errors. If prepare errors exists, calls rollback on the constituent configuration beans.- Throws:
ConfigTransactionException
-
commit
Same basic behavior ascommit()with the added ability to substitute configuration beans used in the prepare phase with the final bean object replacements that should be managed. This is an important variant when the configuration beans in the prepare phase are transient in nature.- Parameters:
finalBeanMapping- mapping from the bean instance used in prepare, with the final version that should be managed- Throws:
ConfigTransactionException
-
rollback
void rollback()Cancels the transaction, locking it out from further changes.
-