Protege-2000 1.7

edu.stanford.smi.protege.model
Class Transaction

java.lang.Object
  |
  +--edu.stanford.smi.protege.model.Transaction

public abstract class Transaction
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

Constructor Summary
Transaction(KnowledgeBase kb)
           
 
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.
 KnowledgeBase getKnowledgeBase()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transaction

public Transaction(KnowledgeBase kb)
Method Detail

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.

getKnowledgeBase

public KnowledgeBase getKnowledgeBase()

Protege-2000 1.7

Submit a bug report or feature request
Protege-2000 is a trademark of Stanford University.
Copyright (c) 1998-2002 Stanford University.