psdi.txn

Class MXTransactionImpl

  • java.lang.Object
    • psdi.txn.MXTransactionImpl
    • Constructor Summary

      Constructors 
      Constructor and Description
      MXTransactionImpl(java.lang.Object id)
      Construct a transaction with the specified ID.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void add(Transactable txn)
      Add a Transactable object to the list of objects coordinated by this transaction.
      void add(Transactable txn, long status)
      Add a transactable object to the transaction.
      void clear()
      clears the transactable array.
      void clearTxnPropertyMap()
      Clears the transaction property map after commit or rollback
      void commit()
      Commit the transaction.
      void commitTransaction(MXTransaction txn)
      Commit the transaction
      void fireEventsAfterDB(MXTransaction txn)
      fire events for all mbos in the transaction after db operation.
      void fireEventsAfterDBCommit(MXTransaction txn)
      fire events for all mbos in the transaction after db commit.
      void fireEventsBeforeDB(MXTransaction txn)
      fire events for all mbos in the transaction before db operation.
      boolean getBoolean(java.lang.String keyString)
      Gets the value from the Hashtable for the specified KeyString.
      java.lang.Object getID()
      Return the unique ID of the transaction.
      int getInt(java.lang.String keyString)
      Gets the value from the Hashtable for the specified KeyString.
      int getSize()
      gets the Size of the transactable array.
      java.lang.String getString(java.lang.String keyString)
      Gets the value from the Hashtable for the specified KeyString.
      long getTransactionStatus(Transactable t)
      Returns the transactable status of specified transactable.
      java.util.Map getTxnPropertyMap(Transactable t)
      Get the transaction property map for the transactable
      int indexOf(Transactable t)
      Returns the index (0 based) of the specified object in the transaction.
      void put(java.lang.String keyString, boolean value)
      Stores the value of keyStrings and values in the hashtable.
      void put(java.lang.String keyString, java.lang.String value)
      Stores the value of keyStrings and values in the hashtable.
      boolean remove(Transactable t)
      removes the Transactable object from the transactable array.
      void rollback()
      Rollback the transaction
      void rollbackTransaction(MXTransaction txn)
      Rollback the transaction
      void save()
      Save the transaction to storage
      void saveTransaction(MXTransaction txn)
      Save the transaction.
      void setEventFired(boolean flag)
      Sets the event fired flag.
      void setIndexOf(Transactable tsb, int order)
      First it will remove the transactable object from the transactable vector if the transactable object is found.
      void setTxnPropertyMap(Transactable t, java.util.Map map)
      Set the transaction property map for the transactable
      void undoTransaction(MXTransaction txn)
      Undo a transaction if it has been committed.
      void validate()
      Validate the transaction
      boolean validateTransaction(MXTransaction txn)
      validate transaction.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MXTransactionImpl

        public MXTransactionImpl(java.lang.Object id)
                          throws java.rmi.RemoteException
        Construct a transaction with the specified ID. MXTransactions are not constructed directly, but are created by calling MXServer.getMXServer().createMXTransaction()
        Parameters:
        id - Unique ID for the transaction
        Throws:
        java.rmi.RemoteException - Network Error
        See Also:
        MXServer
    • Method Detail

      • getID

        public java.lang.Object getID()
        Return the unique ID of the transaction.
        Specified by:
        getID in interface MXTransaction
        Returns:
        Identifier of the transaction
      • add

        public void add(Transactable txn)
                 throws java.rmi.RemoteException
        Add a Transactable object to the list of objects coordinated by this transaction.
        Specified by:
        add in interface MXTransaction
        Parameters:
        txn - Transactable object
        Throws:
        java.rmi.RemoteException - Network Error
        See Also:
        Transactable
      • add

        public void add(Transactable txn,
                        long status)
                 throws java.rmi.RemoteException
        Description copied from interface: MXTransaction
        Add a transactable object to the transaction. The transactable will have the status specified
        Specified by:
        add in interface MXTransaction
        Parameters:
        txn - Transactable Object
        Throws:
        java.rmi.RemoteException - Network Error
      • save

        public void save()
                  throws MXException,
                         java.rmi.RemoteException
        Save the transaction to storage
        Specified by:
        save in interface MXTransaction
        Throws:
        MXException - Error while saving
        java.rmi.RemoteException - Network error
      • commit

        public void commit()
                    throws MXException,
                           java.rmi.RemoteException
        Commit the transaction. If an object that is part of the transaction has not been saved, it is also saved.
        Specified by:
        commit in interface MXTransaction
        Throws:
        MXException - Error while saving
        java.rmi.RemoteException - Network error
      • rollback

        public void rollback()
                      throws MXException,
                             java.rmi.RemoteException
        Rollback the transaction
        Specified by:
        rollback in interface MXTransaction
        Throws:
        MXException - Error while rolling back
        java.rmi.RemoteException - Network Error
      • validate

        public void validate()
                      throws MXException,
                             java.rmi.RemoteException
        Validate the transaction
        Throws:
        MXException - Error while rolling back
        java.rmi.RemoteException - Network Error
      • saveTransaction

        public void saveTransaction(MXTransaction txn)
                             throws MXException,
                                    java.rmi.RemoteException
        Save the transaction.
        Specified by:
        saveTransaction in interface Transactable
        Parameters:
        txn - Transaction to save. This method is called when there are nested transactions
        Throws:
        MXException - Error while saving
        java.rmi.RemoteException - Network error
      • commitTransaction

        public void commitTransaction(MXTransaction txn)
                               throws MXException,
                                      java.rmi.RemoteException
        Commit the transaction
        Specified by:
        commitTransaction in interface Transactable
        Parameters:
        txn - Transaction that caused the commit. This is used for nested transactions.
        Throws:
        MXException - Error while committing
        java.rmi.RemoteException - Network error
      • rollbackTransaction

        public void rollbackTransaction(MXTransaction txn)
                                 throws MXException,
                                        java.rmi.RemoteException
        Rollback the transaction
        Specified by:
        rollbackTransaction in interface Transactable
        Parameters:
        txn - Transaction that caused the rollback. Used for nested transactions
        Throws:
        MXException - Error while rolling back
        java.rmi.RemoteException - Network error
      • undoTransaction

        public void undoTransaction(MXTransaction txn)
                             throws MXException,
                                    java.rmi.RemoteException
        Undo a transaction if it has been committed.
        Specified by:
        undoTransaction in interface Transactable
        Parameters:
        txn - Transaction that caused the undo. Used for nested transactions
        Throws:
        MXException - Error while undoing
        java.rmi.RemoteException - Network error
      • validateTransaction

        public boolean validateTransaction(MXTransaction txn)
                                    throws MXException,
                                           java.rmi.RemoteException
        validate transaction.
        Specified by:
        validateTransaction in interface Transactable
        Parameters:
        txn - Transaction that caused the save
        Throws:
        MXException - Error while committing
        java.rmi.RemoteException - Network error
      • fireEventsBeforeDB

        public void fireEventsBeforeDB(MXTransaction txn)
                                throws MXException,
                                       java.rmi.RemoteException
        fire events for all mbos in the transaction before db operation.
        Specified by:
        fireEventsBeforeDB in interface Transactable
        Parameters:
        txn - Transaction
        Throws:
        MXException - Error while committing
        java.rmi.RemoteException - Network error
      • fireEventsAfterDB

        public void fireEventsAfterDB(MXTransaction txn)
                               throws MXException,
                                      java.rmi.RemoteException
        fire events for all mbos in the transaction after db operation.
        Specified by:
        fireEventsAfterDB in interface Transactable
        Parameters:
        txn - Transaction
        Throws:
        MXException - Error while committing
        java.rmi.RemoteException - Network error
      • fireEventsAfterDBCommit

        public void fireEventsAfterDBCommit(MXTransaction txn)
                                     throws MXException,
                                            java.rmi.RemoteException
        fire events for all mbos in the transaction after db commit.
        Specified by:
        fireEventsAfterDBCommit in interface Transactable
        Parameters:
        txn - Transaction
        Throws:
        MXException - Error while committing
        java.rmi.RemoteException - Network error
      • put

        public void put(java.lang.String keyString,
                        boolean value)
                 throws java.rmi.RemoteException
        Stores the value of keyStrings and values in the hashtable. Rather than storing the boolean objects in the hashtable, Strings objects are stored so that we can store more info about the value when the values has more then just true false values.
        Specified by:
        put in interface MXTransaction
        Parameters:
        keyString -
        value -
        Throws:
        java.rmi.RemoteException
      • put

        public void put(java.lang.String keyString,
                        java.lang.String value)
                 throws java.rmi.RemoteException
        Stores the value of keyStrings and values in the hashtable. An example of keyString is "SENDERSYSID" and the value will be the sender's id.
        Specified by:
        put in interface MXTransaction
        Parameters:
        keyString -
        value -
        Throws:
        java.rmi.RemoteException
      • getBoolean

        public boolean getBoolean(java.lang.String keyString)
                           throws java.rmi.RemoteException
        Gets the value from the Hashtable for the specified KeyString. This will always be a string.
        Specified by:
        getBoolean in interface MXTransaction
        Parameters:
        keyString -
        Throws:
        java.rmi.RemoteException
      • getInt

        public int getInt(java.lang.String keyString)
        Gets the value from the Hashtable for the specified KeyString. This will always be an integer.
        Parameters:
        keyString -
      • getString

        public java.lang.String getString(java.lang.String keyString)
                                   throws java.rmi.RemoteException
        Gets the value from the Hashtable for the specified KeyString. This will always be a string.
        Specified by:
        getString in interface MXTransaction
        Parameters:
        keyString -
        Throws:
        java.rmi.RemoteException
      • remove

        public boolean remove(Transactable t)
                       throws java.rmi.RemoteException
        removes the Transactable object from the transactable array.
        Specified by:
        remove in interface MXTransaction
        Parameters:
        t -
        Throws:
        java.rmi.RemoteException
      • getTransactionStatus

        public long getTransactionStatus(Transactable t)
                                  throws MXException,
                                         java.rmi.RemoteException
        Description copied from interface: MXTransaction
        Returns the transactable status of specified transactable.
        Specified by:
        getTransactionStatus in interface MXTransaction
        Returns:
        Throws:
        MXException - when the transactable doesn't exist in the transaction
        java.rmi.RemoteException
      • clear

        public void clear()
                   throws java.rmi.RemoteException
        clears the transactable array.
        Specified by:
        clear in interface MXTransaction
        Throws:
        java.rmi.RemoteException
      • setIndexOf

        public void setIndexOf(Transactable tsb,
                               int order)
                        throws MXException,
                               java.rmi.RemoteException
        First it will remove the transactable object from the transactable vector if the transactable object is found. If found or not, Then it will insert the element at the specified location.
        Specified by:
        setIndexOf in interface MXTransaction
        Parameters:
        tsb -
        order -
        Throws:
        MXException
        java.rmi.RemoteException
      • getSize

        public int getSize()
                    throws java.rmi.RemoteException
        gets the Size of the transactable array.
        Specified by:
        getSize in interface MXTransaction
        Returns:
        size of the transactable array
        Throws:
        java.rmi.RemoteException
      • setEventFired

        public void setEventFired(boolean flag)
                           throws java.rmi.RemoteException
        Sets the event fired flag.
        Specified by:
        setEventFired in interface MXTransaction
        Parameters:
        flag -
        Throws:
        java.rmi.RemoteException
      • getTxnPropertyMap

        public java.util.Map getTxnPropertyMap(Transactable t)
                                        throws MXException,
                                               java.rmi.RemoteException
        Get the transaction property map for the transactable
        Specified by:
        getTxnPropertyMap in interface MXTransaction
        Parameters:
        Transactable -
        Returns:
        Map
        Throws:
        MXException
        java.rmi.RemoteException
      • setTxnPropertyMap

        public void setTxnPropertyMap(Transactable t,
                                      java.util.Map map)
                               throws MXException,
                                      java.rmi.RemoteException
        Set the transaction property map for the transactable
        Specified by:
        setTxnPropertyMap in interface MXTransaction
        Parameters:
        Transactable -
        Map -
        Throws:
        MXException
        java.rmi.RemoteException
      • clearTxnPropertyMap

        public void clearTxnPropertyMap()
                                 throws MXException,
                                        java.rmi.RemoteException
        Clears the transaction property map after commit or rollback
        Throws:
        MXException
        java.rmi.RemoteException