public abstract class Coordinator
extends java.lang.Object
implements org.xml.sax.ErrorHandler, javax.xml.bind.ValidationEventHandler
This class takes care of the logic that allows code to obtain
UnmarshallingContext and XMLSerializer instances
during the unmarshalling/marshalling.
This is done by using a ThreadLocal. Therefore one unmarshalling/marshalling
episode has to be done from the beginning till end by the same thread.
(Note that the same Coordinator can be then used by a different thread
for an entirely different episode.)
This class also maintains the user-configured instances of XmlAdapters.
This class implements ErrorHandler and propages erros to this object
as the ValidationEventHandler, which will be implemented in a derived class.
| Modifier and Type | Field and Description |
|---|---|
static boolean |
debugTableNPE |
java.lang.Exception |
guyWhoSetTheTableToNull
When we set
table to null, record who did it. |
| Constructor and Description |
|---|
Coordinator() |
| Modifier and Type | Method and Description |
|---|---|
static Coordinator |
_getInstance() |
<T extends javax.xml.bind.annotation.adapters.XmlAdapter> |
containsAdapter(java.lang.Class<T> type) |
void |
error(org.xml.sax.SAXParseException exception) |
void |
fatalError(org.xml.sax.SAXParseException exception) |
<T extends javax.xml.bind.annotation.adapters.XmlAdapter> |
getAdapter(java.lang.Class<T> key)
Gets the instance of the adapter.
|
protected abstract javax.xml.bind.ValidationEventLocator |
getLocation()
Gets the current location.
|
protected void |
popCoordinator()
Called whenever an execution flow exits the realm of this
Coordinator. |
protected void |
pushCoordinator()
Called whenever an execution flow enters the realm of this
Coordinator. |
javax.xml.bind.annotation.adapters.XmlAdapter |
putAdapter(java.lang.Class<? extends javax.xml.bind.annotation.adapters.XmlAdapter> c,
javax.xml.bind.annotation.adapters.XmlAdapter a) |
protected void |
resetThreadAffinity()
Dis-associate this
Coordinator with the current thread. |
protected void |
setThreadAffinity()
Associates this
Coordinator with the current thread. |
void |
warning(org.xml.sax.SAXParseException exception) |
public java.lang.Exception guyWhoSetTheTableToNull
table to null, record who did it.
This is for trouble-shooting a possible concurrency issue reported at:
http://forums.java.net/jive/thread.jspa?threadID=15132public static boolean debugTableNPE
public final javax.xml.bind.annotation.adapters.XmlAdapter putAdapter(java.lang.Class<? extends javax.xml.bind.annotation.adapters.XmlAdapter> c,
javax.xml.bind.annotation.adapters.XmlAdapter a)
public final <T extends javax.xml.bind.annotation.adapters.XmlAdapter> T getAdapter(java.lang.Class<T> key)
public <T extends javax.xml.bind.annotation.adapters.XmlAdapter> boolean containsAdapter(java.lang.Class<T> type)
protected final void setThreadAffinity()
Coordinator with the current thread.
Should be called at the very beginning of the episode.protected final void resetThreadAffinity()
Coordinator with the current thread.
Sohuld be called at the end of the episode to avoid memory leak.protected final void pushCoordinator()
Coordinator.protected final void popCoordinator()
Coordinator.public static Coordinator _getInstance()
protected abstract javax.xml.bind.ValidationEventLocator getLocation()
public final void error(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
error in interface org.xml.sax.ErrorHandlerorg.xml.sax.SAXExceptionpublic final void warning(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
warning in interface org.xml.sax.ErrorHandlerorg.xml.sax.SAXExceptionpublic final void fatalError(org.xml.sax.SAXParseException exception)
throws org.xml.sax.SAXException
fatalError in interface org.xml.sax.ErrorHandlerorg.xml.sax.SAXException