...
This will the change the namespaces that CXF generates by default so that they are the same as XFire would generate.
XML and Annotation Mapping Overview
Aegis has a flexible mapping system so you can control how your beans are controlled. By default your POJOs are serialized based on their name and namespaces. If you have a class in the "org.codehaus.xfire" package named "Employee" it would be serialized in namespace "http://xfire.codehaus.org" with the local name "Employee"
Fore example, the java class:
Code Block | ||||
---|---|---|---|---|
| ||||
public class Employee
{
private String name;
private String title;
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
}
|
In XML this translates to:
Code Block | ||||
---|---|---|---|---|
| ||||
<Employee xmlns="http://xfire.codehaus.org">
<name>Santa Claus</name>
<title>Chief Present Officer (CPO)</title>
</Employee>
|
In XML Schema this would become a complex type:
Code Block | ||||
---|---|---|---|---|
| ||||
<xsd:complexType name="Employee">
<xsd:sequence>
<xsd:element name="name" type="xsd:string" minOccurs="0" maxOccurs="1/>
<xsd:element name="title" type="xsd:string" minOccurs="0" maxOccurs="1/>
</xsd:sequence>
</xsd:complexType>
|
Info | ||
---|---|---|
| ||
You can find an XML Schema for Aegis mapping files here. |
Supported Types
Wiki Markup Basic types: int, double, float, long, byte\[\], short, String, BigDecimal
- Arrays
- Collections - including Maps
- Dates: java.util.Date, java.util.Calendar, java.sql.Timestamp, java.sql.Date, java.sql.Time
- XML: org.w3c.dom.Docmument, org.jdom.Element, XMLStreamReader, Source
- Complex types which are aggregations of the above
If you have constructors defined in your Java beans, make sure a default constructor (i.e. no arguments) is also declared. (Aegis needs a no-argument contstructor to instantiate client Java classes.)
Setting Default minOccurs and nillable Parameters from Java
If you have many properties, and you want most, or all of them, to have a minOccurs other than 0 or a nillable other than false, you can change the defaults for Aegis from Java code (amongst other places).
Here is an example: it extracts the binding provider from the service factory, and changes the configuration parameters.
Code Block |
---|
ServerFactoryBean sf = new ServerFactoryBean();
sf.setServiceClass(serviceClass);
sf.setAddress("http://myhost/service");
AegisDatabinding db = new AegisDatabinding();
sf.getServiceFactory().setDataBinding(db);
DefaultTypeMappingRegistry tmr = (DefaultTypeMappingRegistry)db.getTypeMappingRegistry();
// here we disuade XFire from its rather annoying tendency to assume that, just because
// anything in Java can be null, that we want to advertise all that nullity all over.
Configuration configuration = tmr.getConfiguration();
configuration.setDefaultMinOccurs(1);
configuration.setDefaultNillable(false);
sf.create();
|
More Information....
This section is under construction. For more information about how the Aegis databinding works, please check out the Aegis documentation at the XFire site (http://xfire.codehaus.org/User's%2bGuide).