Package org.apache.cxf.aegis
Class AegisContext
java.lang.Object
org.apache.cxf.aegis.AegisContext
The Aegis Databinding context object. This object coordinates the data binding process: reading and writing
XML. By default, this object sets up a default set of type mappings. This consists of two
DefaultTypeMapping objects. The first is empty and has the Default, Java5, and XML TypeCreator classes
configured. The second contains the standard mappings of the stock types. If a type can't be mapped in
either, then the creators create a mapping and store it in the first one. The application can control some
parameters of the type creators by creating a TypeCreationOptions object and setting properties. The
application can add custom mappings to the type mapping, or even use its own classes for the TypeMapping or
TypeCreator objects. Aegis, unlike JAXB, has no concept of a 'root element'. So, an application that uses
Aegis without a web service has to either depend on xsi:type (at least for root elements) or have its own
mapping from elements to classes, and pass the resulting Class objects to the readers. At this level, the
application must specify the initial set of classes to make make use of untyped collections or .aegis.xml
files. If the application leaves this list empty, and reads XML messages, then no .aegis.xml files are used
unless the application has specified a Class<T> for the root of a particular item read. Specifically,
if the application just leaves it to Aegis to map an element tagged with an xsi:type to a class, Aegis
can't know that some arbitrary class in some arbitrary package is mapped to a particular schema type by
QName in a mapping XML file. At the level of the CXF data binding, the 'root elements' are defined by the
WSDL message parts. Additional classes that participate are termed 'override' classes.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringNamespace used for the miscellaneous Aegis type schema. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.ws.commons.schema.XmlSchemaaddTypesSchemaDocument(org.apache.ws.commons.schema.XmlSchemaCollection collection) static voidaddUtilityTypesToSchema(org.apache.ws.commons.schema.XmlSchema root) org.apache.ws.commons.schema.XmlSchemaaddXmimeSchemaDocument(org.apache.ws.commons.schema.XmlSchemaCollection collection) protected AbstractTypeCreatorprotected AbstractTypeCreatorThis property provides support for interfaces.What URI identifies the type mapping for this context? When the XMLTypeCreator reads .aegis.xml file, it will only read mappings for this URI (or no URI).Retrieve the set of root class names.getRootType(Class<?> clazz) If a class was provided as part of the 'root' list, retrieve it's AegisType by Class.getRootType(QName schemaTypeName) If a class was provided as part of the root list, retrieve it's AegisType by schema type QName.Retrieve the Aegis type objects for the root classes.Return the type mapping configuration associated with this context.Return the type mapping object used by this context.voidInitialize the context.booleanbooleanIs MTOM enabled in this context?booleanShould this service use schema for MTOM types xmime:base64Binary instead of xsd:base64Binary?booleanbooleanstatic booleanschemaImportsUtilityTypes(org.apache.ws.commons.schema.XmlSchema schema) voidsetBeanImplementationMap(Map<Class<?>, String> beanImplementationMap) voidsetEnableJDOMMappings(boolean enableJDOMMappings) Whether to enable JDOM as a mapping for xsd:anyType if JDOM is in the classpath.voidsetMappingNamespaceURI(String mappingNamespaceURI) voidsetMtomEnabled(boolean mtomEnabled) voidsetMtomUseXmime(boolean mtomUseXmime) voidsetReadXsiTypes(boolean flag) Controls the use of xsi:type attributes when reading objects.voidsetRootClasses(Set<Type> rootClasses) The list of initial classes.voidsetRootClassNames(Set<String> classNames) Set the root class names.voidsetTypeCreationOptions(TypeCreationOptions newConfiguration) Set the configuration object.voidsetTypeMapping(TypeMapping typeMapping) Set the type mapping object used by this context.voidsetWriteXsiTypes(boolean flag) Controls whether Aegis writes xsi:type attributes on all elements.
-
Field Details
-
UTILITY_TYPES_SCHEMA_NS
Namespace used for the miscellaneous Aegis type schema.- See Also:
-
-
Constructor Details
-
AegisContext
public AegisContext()Construct a context.
-
-
Method Details
-
createTypeCreator
-
createRootTypeCreator
-
createDefaultTypeCreator
-
initialize
public void initialize()Initialize the context. The encodingStyleURI allows .aegis.xml files to have multiple mappings for, say, SOAP 1.1 versus SOAP 1.2. Passing null uses a default URI. -
createDomElementReader
-
createXMLStreamReader
-
createDomElementWriter
-
createXMLStreamWriter
-
getRootType
If a class was provided as part of the 'root' list, retrieve it's AegisType by Class.- Parameters:
clazz-- Returns:
-
getRootType
If a class was provided as part of the root list, retrieve it's AegisType by schema type QName.- Parameters:
schemaTypeName-- Returns:
-
schemaImportsUtilityTypes
public static boolean schemaImportsUtilityTypes(org.apache.ws.commons.schema.XmlSchema schema) -
addTypesSchemaDocument
public org.apache.ws.commons.schema.XmlSchema addTypesSchemaDocument(org.apache.ws.commons.schema.XmlSchemaCollection collection) -
addXmimeSchemaDocument
public org.apache.ws.commons.schema.XmlSchema addXmimeSchemaDocument(org.apache.ws.commons.schema.XmlSchemaCollection collection) -
addUtilityTypesToSchema
public static void addUtilityTypesToSchema(org.apache.ws.commons.schema.XmlSchema root) -
getRootClassNames
Retrieve the set of root class names. Note that if the application specifies the root classes by Class instead of by name, this will return null.- Returns:
-
setRootClassNames
Set the root class names. This function is a convenience for Spring configuration. It sets the same underlying collection assetRootClasses(Set).- Parameters:
classNames-
-
getTypeCreationOptions
Return the type mapping configuration associated with this context.- Returns:
- Returns the configuration.
-
setTypeCreationOptions
Set the configuration object. The configuration specifies default type mapping behaviors.- Parameters:
newConfiguration- The configuration to set.
-
isWriteXsiTypes
public boolean isWriteXsiTypes() -
isReadXsiTypes
public boolean isReadXsiTypes() -
setWriteXsiTypes
public void setWriteXsiTypes(boolean flag) Controls whether Aegis writes xsi:type attributes on all elements. False by default.- Parameters:
flag-
-
setReadXsiTypes
public void setReadXsiTypes(boolean flag) Controls the use of xsi:type attributes when reading objects. By default, xsi:type reading is enabled. When disabled, Aegis will only map for objects that the application manually maps in the type mapping.- Parameters:
flag-
-
getTypeMapping
Return the type mapping object used by this context.- Returns:
-
setTypeMapping
Set the type mapping object used by this context.- Parameters:
typeMapping-
-
getRootTypes
Retrieve the Aegis type objects for the root classes.- Returns:
- the set of type objects.
-
getBeanImplementationMap
This property provides support for interfaces. If there is a mapping from an interface's Classto a string containing a class name, Aegis will create proxy objects of that class name. - Returns:
- See Also:
-
setBeanImplementationMap
-
getRootClasses
-
setRootClasses
The list of initial classes.- Parameters:
rootClasses-
-
isMtomEnabled
public boolean isMtomEnabled()Is MTOM enabled in this context?- Returns:
-
setMtomEnabled
public void setMtomEnabled(boolean mtomEnabled) -
isMtomUseXmime
public boolean isMtomUseXmime()Should this service use schema for MTOM types xmime:base64Binary instead of xsd:base64Binary?- Returns:
-
setMtomUseXmime
public void setMtomUseXmime(boolean mtomUseXmime) -
getMappingNamespaceURI
What URI identifies the type mapping for this context? When the XMLTypeCreator reads .aegis.xml file, it will only read mappings for this URI (or no URI). When the abstract type creator is otherwise at a loss for a namespace URI, it will use this URI.- Returns:
-
setMappingNamespaceURI
-
isEnableJDOMMappings
public boolean isEnableJDOMMappings() -
setEnableJDOMMappings
public void setEnableJDOMMappings(boolean enableJDOMMappings) Whether to enable JDOM as a mapping for xsd:anyType if JDOM is in the classpath.- Parameters:
enableJDOMMappings-
-