- Inherits from:
- (com.apple.client.eocontrol) Object
(com.apple.yellow.eocontrol) NSObject
- Package:
- com.apple.client.eocontrol
- com.apple.yellow.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. In com.apple.yellow.eocontrol applications, you can optionally implement faultWillFire to prepare for conversion.
In a com.apple.yellow.eocontrol application you create an EOFaultHandler using
the standard constructor
. To create a fault in
a com.apple.yellow.eocontrol 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 com.apple.client.eocontrol application you also create
an EOFaultHandler using the standard constructor.
To create a fault in a com.apple.client.eocontrol 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 com.apple.client.eocontrol 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 (com.apple.yellow.eocontrol only)
- clearFault (com.apple.yellow.eocontrol only)
- isFault
- makeObjectIntoFault (com.apple.yellow.eocontrol only)
- handlerForFault (com.apple.yellow.eocontrol only)
- targetClassForFault (com.apple.yellow.eocontrol only)
- Reference counting
- incrementExtraRefCount (com.apple.yellow.eocontrol only)
- decrementExtraRefCountIsZero (com.apple.yellow.eocontrol only)
- extraRefCount (com.apple.yellow.eocontrol only)
- Getting the original class
- classForFault (com.apple.yellow.eocontrol only)
- Firing a fault
- completeInitializationOfObject
- faultWillFire (com.apple.yellow.eocontrol only)
- Getting a description
- descriptionForObject
- eoShallowDescription (com.apple.client.eocontrol only)
- Checking class information
- isKindOfClass (com.apple.yellow.eocontrol only)
- isMemberOfClass (com.apple.yellow.eocontrol only)
- respondsToSelectorForFault (com.apple.yellow.eocontrol only)
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)
null
if aFault isn't
a fault.public static boolean
isFault
(Object anObject)
true
if anObject is
a fault, false
otherwise.public static void
makeObjectIntoFault
(
Object anObject,
EOFaultHandler aFaultHandler)
public static Class
targetClassForFault
(Object anObject)
public Class
classForFault
(Object fault)
See Also: targetClass
public void
completeInitializationOfObject
(Object aFault)
public Object
createFaultForDeferredFault
(Object fault, Object eo)
public boolean
decrementExtraRefCountIsZero
()
If, after decrementing the reference count, the fault's new reference count is zero, this method returns true, If the reference count has not become zero, this method returns false. Objects that have a zero reference count are candidates for garbage collection.
This method is used by EOFaultHandler's internal reference counting mechanism.
public String
descriptionForObject
(Object aFault)
public int
extraRefCount
()
public void
faultWillFire
(Object aFault)
public void
incrementExtraRefCount
()
This method is used by EOFaultHandler's internal reference counting mechanism.
See Also: extraRefCount
public boolean
isKindOfClass
(
Class aClass,
Object aFault)
See Also: completeInitializationOfObject
public boolean
isMemberOfClass
(
Class aClass,
Object aFault)
See Also: completeInitializationOfObject
public boolean
respondsToSelectorForFault
(
NSSelector aSelector,
Object aFault)
See Also: completeInitializationOfObject
public Class
targetClass
()