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

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void commit()
      Locks changes, calls prepare (if not yet performed), followed by commit if no prepare errors.
      void commit​(Map<Object,​Object> finalBeanMapping)
      Same basic behavior as commit() with the added ability to substitute configuration beans used in the prepare phase with the final bean object replacements that should be managed.
      void created​(Object created, String name, org.jvnet.hk2.component.MultiMap<String,​String> metadata)
      Add configuration beans to the transaction.
      void deleted​(Object deletedConfigBean)
      Marks configuration beans as having been deleted.
      void deleted​(Collection<?> deletedConfigBeans)  
      void prepare()
      Locks changes, calls prepare.
      void rollback()
      Cancels the transaction, locking it out from further changes.
      void updated​(Object updatedConfigBean, PropertyChangeEvent event)
      Mark configuration beans as having been updated (note that name and metadata cannot change here).
      void updated​(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 created
        name - - optionally the name for the configuration
        metadata - - 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)
      • commit

        void commit()
             throws ConfigTransactionException
        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

        void commit​(Map<Object,​Object> finalBeanMapping)
             throws ConfigTransactionException
        Same basic behavior as commit() 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.