Castor 1.3.2 - Reference documentation

1.3.2

Copies of this document may be made for your own use and for distribution to others, provided that you do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.


1. Castor XML - XML data binding
1.1. XML framework
1.1.1. Introduction
1.1.2. Castor XML - The XML data binding framework
1.1.2.1. Introspection mode
1.1.2.2. Mapping mode
1.1.2.3. Descriptor mode
1.1.3. Sources and destinations
1.1.4. XMLContext - A consolidated way to bootstrap Castor
1.1.5. Using existing Classes/Objects
1.1.6. Class Descriptors
1.2. XML Mapping
1.2.1. Introduction
1.2.2. Overview
1.2.2.1. Marshalling Behavior
1.2.2.2. Unmarshalling Behavior
1.2.3. The Mapping File
1.2.3.1. Sample domain objects
1.2.3.2. The <mapping> element
1.2.3.3. The <class> element
1.2.3.4. The <map-to> element
1.2.3.5. The <field> element
1.2.3.6. Description of the content
1.2.3.7. The <bind-xml> element
1.2.4. Usage Pattern
1.2.5. xsi:type
1.2.6. Location attribute
1.2.7. Tips
1.2.7.1. Automatically create a mapping file
1.2.7.2. Create your own FieldHandler
1.2.7.3. Mapping constructor arguments (since 0.9.5)
1.2.7.4. Preventing Castor from checking for a default constructor (since 0.9.5)
1.2.7.5. Type safe enumeration mapping (since 0.9.5)
1.3. Configuring Castor XML (Un)Marshaller
1.3.1. Introduction
1.3.2. Configuring the Marshaller
1.3.3. Configuring the Unmarshaller
1.4. Usage of Castor and XML parsers
1.5. XML configuration file
1.5.1. News
1.5.2. Introduction
1.5.3. Accessing the properties from within code
1.6. Castor XML - Tips & Tricks
1.6.1. Logging and Tracing
1.6.2. Indentation
1.6.3. XML:Marshal validation
1.6.4. NoClassDefFoundError
1.6.5. Mapping: auto-complete
1.6.6. Create method
1.6.7. MarshalListener and UnmarshalListener
1.7. Castor XML: Writing Custom FieldHandlers
1.7.1. Introduction
1.7.2. Writing a simple FieldHandler
1.7.3. Writing a GeneralizedFieldHandler
1.7.4. Use ConfigurableFieldHandler for more flexibility
1.7.5. No Constructor, No Problem!
1.7.6. Collections and FieldHandlers
1.8. Best practice
1.8.1. General
1.8.1.1. Source Generator
1.8.2. Performance Considerations
1.8.2.1. General
1.8.2.2. Use of XMLContext - With and without a mapping file
1.8.2.3. Use of Marshaller/Unmarshaller
1.9. Castor XML - HOW-TO's
1.9.1. Introduction
1.9.2. Documentation
1.9.3. Contribution
1.9.4. Mapping
1.9.5. Validation
1.9.6. Source generation
1.9.7. Others
1.10. XML FAQ
1.10.1. General
1.10.1.1. How do I set the encoding?
1.10.1.2. I'm getting an error about 'xml' prefix already declared?
1.10.1.3. Why is my 'get' method called twice?
1.10.1.4. How can I speed up marshalling/unmarshalling performance?
1.10.1.5. How do I ignore elements during unmarshalling?
1.10.1.6. Where does Castor search for the castor.properties file?
1.10.1.7. Can I programmatically change the properties found in the castor.properties file?
1.10.2. Introspection
1.10.2.1. Can private methods be introspected?
1.10.3. Mapping
1.10.3.1. My mapping file seems to have no effect!
1.10.3.2. Are there any tools to automatically create a mapping file?
1.10.3.3. How do I specify a namespace in the mapping file?
1.10.3.4. How do I prevent a field from being marshaled?
1.10.4. Marshalling
1.10.4.1. The XML is marshalled on one line, how do I force line-breaks?
1.10.4.2. What is the order of the marshalled XML elements?
1.10.5. Source code generation
1.10.5.1. Can I use a DTD with the source generator?
1.10.5.2. My XML output looks incorrect, what could be wrong?
1.10.5.3. The generated source code has incorrect or missing imports for imported schema types
1.10.5.4. How can I make the generated source code more JDO friendly?
1.10.6. Miscellaneous
1.10.6.1. Is there a way to automatically create an XML Schema from an XML instance?
1.10.6.2. How to enable XML validation with Castor XML
1.10.6.3. Why is mapping ignored when using a FieldHandlerFactory
1.10.7. Serialization
1.10.7.1. Is it true that the use of Castor XML mandates Apache Xerces as XML parser?
1.10.7.2. Do I still have to download Xerces when using Castor XML with Java 5.0?
2. XML code generation
2.1. Why Castor XML code generator - Motivation
2.2. Introduction
2.2.1. News
2.2.1.1. Source generation & Java 5.0
2.2.2. Introduction
2.2.3. Invoking the XML code generator
2.2.4. XML Schema
2.3. Properties
2.3.1. Overview
2.3.2. Customization - Lookup mechanism
2.3.3. Detailed descriptions
2.3.3.1. org.exolab.castor.builder.javaVersion
2.3.3.2. org.exolab.castor.builder.javaVersion
2.3.3.3. org.exolab.castor.builder.boundproperties
2.3.3.4. org.exolab.castor.builder.javaclassmapping
2.3.3.5. org.exolab.castor.builder.superclass
2.3.3.6. org.exolab.castor.builder.nspackages
2.3.3.7. org.exolab.castor.builder.equalsmethod
2.3.3.8. org.exolab.castor.builder.useCycleBreaker
2.3.3.9. org.exolab.castor.builder.primitivetowrapper
2.3.3.10. org.exolab.castor.builder.automaticConflictResolution
2.3.3.11. org.exolab.castor.builder.extraCollectionMethods
2.3.3.12. org.exolab.castor.builder.jclassPrinterFactories
2.3.3.13. org.exolab.castor.builder.extraDocumentationMethods
2.4. Custom bindings
2.4.1. Binding File
2.4.1.1. <binding> element
2.4.1.2. <include> element
2.4.1.3. <package> element
2.4.1.4. <namingXML> element
2.4.1.5. <componentBinding> element
2.4.1.6. <java-class>
2.4.1.7. <member> element
2.4.1.8. <contentMember> element
2.4.1.9. <enumBinding> element
2.4.1.10. Not implemented yet
2.4.2. Class generation conflicts
2.4.2.1. Collision reporting
2.4.2.2. Automatic collision resolution
2.5. Invoking the XML code generator
2.5.1. Ant task definition
2.5.1.1. Specifying the source for generation
2.5.1.2. Parameters
2.5.1.3. Examples
2.5.2. Maven 2 plugin
2.5.2.1. Configuration
2.5.2.2. Integration into build life-cycle
2.5.2.3. Example
2.5.3. Command line
2.5.3.1. First steps
2.5.3.2. Source Generator - command line options
2.6. XML schema support
2.6.1. Supported XML Schema Built-in Datatypes
2.6.1.1. Primitive Datatypes
2.6.1.2. Derived Datatypes
2.6.2. Supported XML Schema Structures
2.6.2.1. Groups
2.6.2.2. Wildcard
2.7. Examples
2.7.1. The invoice XML schema
2.7.1.1. The schema file
2.7.1.2. Running the XML code generator
2.7.1.3. The generated code
2.7.2. Non-trivial real world example
2.7.2.1. The Supply Chain XSD
2.7.2.2. Binding file? -- IT IS REQUIRED!
3. JDO extensions for the Castor XML code generator
3.1. JDO extensions - Motivation
3.2. Limitations
3.3. Prerequisites
3.3.1. Sample XML schemas
3.3.2. Sample DDL statements
3.4. Configuring the XML code generator
3.5. The JDO annotations for XML schemas
3.5.1. <table> element
3.5.2. <column> element
3.5.3. <one-to-one> element
3.5.4. <one-to-many> element
3.6. Using the generated (domain) classes with Castor JDO
3.6.1. Empty mapping file
3.6.2. Use of a JDOClassDescriptorResolver
4. Castor JDO - Integration with Spring ORM
4.1. Usage
4.1.1. Getting started using Maven 2
4.1.2. Project dependencies
4.2. A high-level overview
4.2.1. Sample domain objects
4.2.2. Using Castor JDO manually
4.2.3. Using Castor JDO with Spring ORM - Without CastorTemplate
4.2.4. Using Castor JDO with Spring ORM - With CastorTemplate
4.2.5. Using Castor JDO with Spring ORM - With CastorDaoSupport
4.3. Data access through Castor JDO with the Spring framework
4.3.1. Resource management
4.3.2. JDOManager setup in a Spring container
4.3.3. The CastorTemplate
4.3.4. Implementing Spring-based DAOs without callbacks
4.3.5. Programmatic transaction demarcation
4.3.6. Declarative transaction demarcation
4.3.7. Transaction management strategies
4.4. Build instructions
4.4.1. Prerequisites
4.4.2. Building the Spring ORM module
5. Castor JDO - Support for the JPA specification
5.1. JPA annotations - Motivation
5.2. Prerequisites and outline
5.3. Limitations and Basic Information
5.3.1. persistence.xml
5.3.2. JPA access type and the placing of JPA annotations
5.3.3. Primary Keys
5.3.4. Inheritance, mapped superclasses, etc.
5.3.5. Relations
5.4. An outline of JPA-Annotations
5.5. Usage of JPA annotations - Configuration
5.5.1. HOW-TO persist a single class (@Entity, @Table, @Id)
5.5.2. HOW-TO persist a 1:1 relation (@OneToOne)
5.5.3. Persist one to many relation (@OnetoMany)
5.5.4. HOW-TO create and use a named query (@NamedQuery)
5.5.5. HOW-TO create and use multiple named queries (@NamedQueries)
5.5.6. HOW-TO create and use a named native query (@NamedNativeQuery)
5.5.7. HOW-TO create and use multiple named native queries (@NamedNativeQueries)
5.6. Integration with Spring ORM for Castor JDO
5.6.1. A typical sample
5.6.2. Adding a JDOClassDescriptorResolver configuration
5.7. Castor JPA Extensions
5.7.1. @Cache and @CacheProperty