Protege 3.4.3

edu.stanford.smi.protege.model
Class Transaction<X>

java.lang.Object
  extended by edu.stanford.smi.protege.model.Transaction<X>

public abstract class Transaction<X>
extends Object

Encapsulation of method for executing a tranaction.

Example:

 
 void foo(KnowledgeBase kb) {
                Transaction t = new Transaction(kb) {
                        public boolean doOperations() {
                                // kb calls go here
                                // return true for commit, false for rollback
                        }
                };
                boolean committed = t.execute();
                if (committed) {
                        System.out("transaction committed");
                } else {
                        System.out("transaction rolled back");
                }
 }
  

Author:
Ray Fergerson

Field Summary
static String APPLY_TO_TRAILER_STRING
           
 
Constructor Summary
protected Transaction(KnowledgeBase kb)
           
protected Transaction(KnowledgeBase kb, String transactionName)
           
protected Transaction(KnowledgeBase kb, String transactionName, String applyTo)
           
 
Method Summary
abstract  boolean doOperations()
          returns true if the the results of this method should be committed
 boolean execute()
          returns true if the transaction was committed This method handles the logic of executing a transaction, including the necessary synchronization.
static String getApplyTo(String beginString)
           
 KnowledgeBase getKnowledgeBase()
           
 X getResult()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

APPLY_TO_TRAILER_STRING

public static final String APPLY_TO_TRAILER_STRING
See Also:
Constant Field Values
Constructor Detail

Transaction

protected Transaction(KnowledgeBase kb)

Transaction

protected Transaction(KnowledgeBase kb,
                      String transactionName)

Transaction

protected Transaction(KnowledgeBase kb,
                      String transactionName,
                      String applyTo)
Method Detail

getKnowledgeBase

public KnowledgeBase getKnowledgeBase()

doOperations

public abstract boolean doOperations()
returns true if the the results of this method should be committed


execute

public boolean execute()
returns true if the transaction was committed This method handles the logic of executing a transaction, including the necessary synchronization. In addition, it handles correctly both runtime exceptions and errors.


getResult

public X getResult()

getApplyTo

public static String getApplyTo(String beginString)

Protege 3.4.3

Submit a bug report or feature request
Protégé is a trademark of Stanford University.
Copyright (c) 1998-2009 Stanford University.