PATH |
Inherits from: Object
Package: com.webobjects.eocontrol
EOFaultHandler is an abstract class that defines the mechanisms that create faults and help them to fire. Faults are used as placeholders for an enterprise object's relationship destinations. For example, suppose an Employee object has a department relationship to the employee's department. When an employee is fetched, faults are created for its relationship destinations. In the case of the department relationship, an empty Department object is created. The Department object's data isn't fetched until the Department is accessed, at which time the fault is said to fire.
Subclasses of EOFaultHandler perform the specific steps necessary to get data for the fault and fire it. The Access Layer, for example, uses private subclasses to fetch data using an EODatabaseContext (defined in EOAccess). Most of EOFaultHandler's methods are properly defined; you need only override completeInitializationOfObject to provide appropriate behavior.
You create an EOFaultHandler using the standard constructor. To create a fault in an application, you invoke the static method makeObjectIntoFault with the object to turn into a fault and the EOFaultHandler. An EOFaultHandler belongs exclusively to a single fault, and shouldn't be shared or used by any other object.
In a Java Client application you also create an EOFaultHandler using the standard constructor. To create a fault in a Java Client application, though, you send a newly-created object a turnIntoFault message and provide an EOFaultHandler that will help the fault to fire. In order for that newly-created object to be able to respond to turnIntoFault, the object must conform to the EOFaulting interface. An EOFaultHandler belongs exclusively to a single fault, and shouldn't be shared or used by any other object. In Java Client applications, the fault handler is the private property of the fault; you shouldn't send any messages to the fault handler, instead dealing exclusively with the fault.
When a fault receives a message that requires it to fire, it sends a completeInitializationOfObject method to its EOFaultHandler. This method is responsible for invoking the clearFault method to revert the fault to its original state, and then do whatever is necessary to complete initialization of the object. Doing so typically involves fetching data from an external repository and passing it to the object.
Creating and examining faults createFaultForDeferredFault clearFault isFault makeObjectIntoFault handlerForFault Firing a fault completeInitializationOfObject faultWillFire Getting a description descriptionForObject eoShallowDescription
public EOFaultHandler()
public static String eoShallowDescription(Object anObject)
public static void clearFault(Object aFault)
You rarely use this method. Faults typically fire automatically when accessed, using the completeInitializationOfObject method.
public static EOFaultHandler handlerForFault(Object aFault)
public static boolean isFault(Object anObject)
public static void makeObjectIntoFault( Object anObject, EOFaultHandler aFaultHandler)
public abstract void completeInitializationOfObject(Object aFault)
public Object createFaultForDeferredFault( Object fault, EOEnterpriseObject eo)
public String descriptionForObject(Object aFault)
public abstract void faultWillFire(Object aFault)
public Class targetClass()
public String toString()
© 2001 Apple Computer, Inc. (Last Published April 19, 2001)