psdi.txn

Interface MXTransaction

  • All Superinterfaces:
    java.rmi.Remote, Transactable
    All Known Implementing Classes:
    MXTransactionImpl


    public interface MXTransaction
    extends java.rmi.Remote, Transactable
    An MXTransaction is used by the framework where tasks need to be coordinated as part of a single unit of work. Examples of this are storing objects to the database, commiting messages to message queues. Objects can be added to the transaction using the add() method. The MXTransaction object supports addition of MboSetRemote, Connection, MXTransaction and Transactable objects. The Transactable interface should be implemented by objects that wish to be cooridianted as part of a transaction. A transaction life cycle is as follows :- 1) The transaction is created. 2) Objects are added to the transaction. 3) The owner of the object may then call save() or commit(). Calling save() will cause the objects to be placed in persistent storage. Calling commit() without saving first will cause the objects to be saved automatically. 4) If everything is successful, the commit() method should be called. If there is any error from the save(), the rollback() method should be called. 5) If there are any failures during the commit phase, for those objects that have been committed sucessfully, the undoTransaction() method is called so that the object can attempt to undo what had been previously committed. Once a transaction has been saved and committed, the MXTransaction object should NOT be resued again as objects that partcipate in the transaction may no longer be valid.
    See Also:
    Transactable, MboSet
    • Field Detail

      • InvalidStatus

        static final long InvalidStatus
        A long number that is reserved to indicate that the transaction status is not valid or the transactable doesn't exist in the transaction, while the status can be any long number except this one that understood by the transaction implementation.
        See Also:
        Constant Field Values
    • Method Detail

      • getID

        java.lang.Object getID()
                        throws java.rmi.RemoteException
        Return the transaction id.
        Throws:
        java.rmi.RemoteException - Network Error
      • add

        void add(Transactable txn)
          throws java.rmi.RemoteException
        Add a transactable object to the transaction.
        Parameters:
        txn - Transactable Object
        Throws:
        java.rmi.RemoteException - Network Error
      • add

        void add(Transactable txn,
                 long status)
          throws java.rmi.RemoteException
        Add a transactable object to the transaction. The transactable will have the status specified
        Parameters:
        txn - Transactable Object
        Throws:
        java.rmi.RemoteException - Network Error
      • save

        void save()
           throws MXException,
                  java.rmi.RemoteException
        Store the objects associated with the transaction
        Throws:
        MXException - Error while saving
        java.rmi.RemoteException - Network error
      • commit

        void commit()
             throws MXException,
                    java.rmi.RemoteException
        Call to commit the transaction.
        Throws:
        MXException - Error while committing
        java.rmi.RemoteException - Network error
      • rollback

        void rollback()
               throws MXException,
                      java.rmi.RemoteException
        Called by the user to explictily rollback the transaction.
        Throws:
        MXException - Error while rolling back
        java.rmi.RemoteException - Network error
      • setIndexOf

        void setIndexOf(Transactable t,
                        int order)
                 throws java.rmi.RemoteException,
                        MXException
        Sets the index of transactable obejct. If the transactable object is found withing transactable vector then it will first remove the transactable obejct. Then it will insert the transactable object at the specified index.
        Parameters:
        t -
        order -
        Throws:
        java.rmi.RemoteException
        MXException
      • getSize

        int getSize()
             throws java.rmi.RemoteException
        gets the Size of the transactable array.
        Returns:
        size of the transactable array
        Throws:
        java.rmi.RemoteException
      • put

        void put(java.lang.String keyString,
                 boolean value)
          throws java.rmi.RemoteException
        Stores the value of keyStrings and values in the hashtable. An example of keyString is "APISEQ" and the value will be either true or false. 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.
        Parameters:
        keyString -
        value -
        Throws:
        java.rmi.RemoteException
      • put

        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.
        Parameters:
        keyString -
        value -
        Throws:
        java.rmi.RemoteException
      • getBoolean

        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.
        Parameters:
        keyString -
        Throws:
        java.rmi.RemoteException
      • getString

        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.
        Parameters:
        keyString -
        Throws:
        java.rmi.RemoteException
      • remove

        boolean remove(Transactable t)
                throws java.rmi.RemoteException
        removes the Transactable object from the transactable array.
        Parameters:
        t -
        Throws:
        java.rmi.RemoteException
      • clear

        void clear()
            throws java.rmi.RemoteException
        clears the transactable array.
        Throws:
        java.rmi.RemoteException
      • setEventFired

        void setEventFired(boolean flag)
                    throws java.rmi.RemoteException
        Sets the event fired flag.
        Parameters:
        flag -
        Throws:
        java.rmi.RemoteException
      • getTransactionStatus

        long getTransactionStatus(Transactable t)
                           throws java.rmi.RemoteException,
                                  MXException
        Returns the transactable status of specified transactable.
        Parameters:
        t -
        Returns:
        Throws:
        java.rmi.RemoteException
        MXException - when the transactable doesn't exist in the transaction
      • setTxnPropertyMap

        void setTxnPropertyMap(Transactable t,
                               java.util.Map map)
                        throws MXException,
                               java.rmi.RemoteException
        Set the property map for the transaction
        Parameters:
        t -
        map -
        Throws:
        MXException
        java.rmi.RemoteException
      • getTxnPropertyMap

        java.util.Map getTxnPropertyMap(Transactable t)
                                 throws MXException,
                                        java.rmi.RemoteException
        Get the property map for the transaction
        Parameters:
        t -
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException