Package org.jvnet.hk2.config.provider
Interface ConfigTransaction
-
public interface ConfigTransactionRepresents 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 withConfigured. 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcommit()Locks changes, calls prepare (if not yet performed), followed by commit if no prepare errors.voidcommit(Map<Object,Object> finalBeanMapping)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.voidcreated(Object created, String name, org.jvnet.hk2.component.MultiMap<String,String> metadata)Add configuration beans to the transaction.voiddeleted(Object deletedConfigBean)Marks 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 Detail
-
created
void created(Object created, String name, org.jvnet.hk2.component.MultiMap<String,String> metadata)
Add configuration beans to the transaction.- Parameters:
created- - the configuration bean instance being createdname- - optionally the name for the configurationmetadata- - name,value(s)
-
updated
void updated(Object updatedConfigBean, PropertyChangeEvent event)
Mark configuration beans as having been updated (note that name and metadata cannot change here).
-
updated
void updated(Collection<?> updatedConfigBeans)
-
deleted
void deleted(Object deletedConfigBean)
Marks configuration beans as having been deleted.
-
deleted
void deleted(Collection<?> deletedConfigBeans)
-
prepare
void prepare() throws ConfigTransactionExceptionLocks changes, calls prepare.- Throws:
ConfigTransactionException
-
commit
void commit() throws ConfigTransactionExceptionLocks 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
void commit(Map<Object,Object> finalBeanMapping) throws ConfigTransactionException
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.
-
-