|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.exolab.castor.mapping.Mapping
Utility class for loading mapping files and providing them to the XML marshaller, JDO engine etc. The mapping file can be loaded from a URL, input stream or SAX InputSource.
Multiple mapping files can be loaded with the same Mapping
object. When loading master mapping files that include other mapping
files it might be convenient to use setBaseURL(java.lang.String)
or setEntityResolver(org.xml.sax.EntityResolver)
.
If the desired class loader is different than the one used by Castor (e.g. if Castor is installed as a Java extension), the Mapping object can be constructed with the proper class loader.
The following example loads two mapping files:
Mapping mapping; mapping = new Mapping( getClass().getClassLoader() ); mapping.loadMapping( "mapping.xml" ); mapping.loadMapping( url );
Field Summary | |
static org.exolab.castor.mapping.Mapping.EngineMapping |
DAX
Use this object to obtain the mapping resolver for DAX from getResolver(org.exolab.castor.mapping.Mapping.EngineMapping) . |
static org.exolab.castor.mapping.Mapping.EngineMapping |
JDO
Use this object to obtain the mapping resolver for JDO from getResolver(org.exolab.castor.mapping.Mapping.EngineMapping) . |
static org.exolab.castor.mapping.Mapping.EngineMapping |
XML
Use this object to obtain the mapping resolver for XML from getResolver(org.exolab.castor.mapping.Mapping.EngineMapping) . |
Constructor Summary | |
Mapping()
Constructs a new mapping. |
|
Mapping(java.lang.ClassLoader loader)
Constructs a new mapping. |
Method Summary | |
java.lang.ClassLoader |
getClassLoader()
Returns the class loader used by this mapping object. |
MappingResolver |
getResolver(org.exolab.castor.mapping.Mapping.EngineMapping engine)
Returns a mapping resolver for the suitable engine. |
MappingResolver |
getResolver(org.exolab.castor.mapping.Mapping.EngineMapping engine,
java.lang.Object param)
Returns a mapping resolver for the suitable engine. |
void |
loadMapping(org.xml.sax.InputSource source)
Loads the mapping from the specified input source. |
void |
loadMapping(java.lang.String url)
Loads the mapping from the specified URL. |
void |
loadMapping(java.net.URL url)
Loads the mapping from the specified URL. |
void |
setBaseURL(java.lang.String url)
Sets the base URL for the mapping and related files. |
void |
setEntityResolver(org.xml.sax.EntityResolver resolver)
Sets the entity resolver. |
void |
setLogWriter(java.io.PrintWriter logWriter)
Sets the log writer. |
Methods inherited from class java.lang.Object |
equals,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final org.exolab.castor.mapping.Mapping.EngineMapping JDO
getResolver(org.exolab.castor.mapping.Mapping.EngineMapping)
.public static final org.exolab.castor.mapping.Mapping.EngineMapping DAX
getResolver(org.exolab.castor.mapping.Mapping.EngineMapping)
.public static final org.exolab.castor.mapping.Mapping.EngineMapping XML
getResolver(org.exolab.castor.mapping.Mapping.EngineMapping)
.Constructor Detail |
public Mapping(java.lang.ClassLoader loader)
loader
- The class loader to use, null for the defaultpublic Mapping()
Method Detail |
public MappingResolver getResolver(org.exolab.castor.mapping.Mapping.EngineMapping engine) throws MappingException
engine
- The mapping engineJDO
,
XML
,
DAX
public MappingResolver getResolver(org.exolab.castor.mapping.Mapping.EngineMapping engine, java.lang.Object param) throws MappingException
engine
- The mapping engineparam
- Arbitrary parameter that is to be passed to resolver.loadMapping()JDO
,
XML
,
DAX
public void setLogWriter(java.io.PrintWriter logWriter)
logWriter
- The log writer to usepublic void setEntityResolver(org.xml.sax.EntityResolver resolver)
resolver
- The entity resolver to usepublic void setBaseURL(java.lang.String url)
url
- The base URLpublic java.lang.ClassLoader getClassLoader()
public void loadMapping(java.lang.String url) throws java.io.IOException, MappingException
url
- The URL of the mapping filepublic void loadMapping(java.net.URL url) throws java.io.IOException, MappingException
url
- The URL of the mapping filepublic void loadMapping(org.xml.sax.InputSource source) throws java.io.IOException, MappingException
source
- The input source
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |