//- Constructors -/
//----------------/
public DatabaseDescriptor() {
xmlName = "database";
XMLFieldDescriptorImpl desc = null;
XMLFieldHandler handler = null;
FieldValidator fieldValidator = null;
//-- initialize attribute descriptors
attributes = new XMLFieldDescriptorImpl[2];
//-- _engine
desc = new XMLFieldDescriptorImpl(java.lang.String.class, "_engine", "engine", NodeType.Attribute);
desc.setImmutable(true);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Database target = (Database) object;
return target.getEngine();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Database target = (Database) object;
target.setEngine( (java.lang.String) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public void resetValue( Object object )
{
setValue( object, null );
}
public Object newInstance( Object parent ) {
return null;
}
} );
desc.setHandler(handler);
attributes[0] = desc;
//-- validation code for: _engine
fieldValidator = new FieldValidator();
fieldValidator.setValidator(new StringValidator());
desc.setValidator(fieldValidator);
//-- _name
desc = new XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", NodeType.Attribute);
this.identity = desc;
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Database target = (Database) object;
return target.getName();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Database target = (Database) object;
target.setName( (java.lang.String) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public void resetValue( Object object )
{
setValue( object, null );
}
public Object newInstance( Object parent ) {
return new java.lang.String();
}
} );
desc.setHandler(handler);
desc.setRequired(true);
attributes[1] = desc;
//-- validation code for: _name
fieldValidator = new FieldValidator();
fieldValidator.setMinOccurs(1);
desc.setValidator(fieldValidator);
//-- initialize element descriptors
elements = new XMLFieldDescriptorImpl[4];
//-- _driver
desc = new XMLFieldDescriptorImpl(Driver.class, "_driver", "driver", NodeType.Element);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Database target = (Database) object;
return target.getDriver();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Database target = (Database) object;
target.setDriver( (Driver) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public void resetValue( Object object )
{
setValue( object, null );
}
public Object newInstance( Object parent ) {
return new Driver();
}
} );
desc.setHandler(handler);
desc.setRequired(false);
desc.setMultivalued(false);
elements[0] = desc;
//-- validation code for: _driver
fieldValidator = new FieldValidator();
desc.setValidator(fieldValidator);
//-- _dataSource
desc = new XMLFieldDescriptorImpl(DataSource.class, "_dataSource", "data-source", NodeType.Element);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Database target = (Database) object;
return target.getDataSource();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Database target = (Database) object;
target.setDataSource( (DataSource) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public void resetValue( Object object )
{
setValue( object, null );
}
public Object newInstance( Object parent ) {
return new DataSource();
}
} );
desc.setHandler(handler);
desc.setRequired(false);
desc.setMultivalued(false);
elements[1] = desc;
//-- validation code for: _dataSource
fieldValidator = new FieldValidator();
desc.setValidator(fieldValidator);
//-- _jndi
desc = new XMLFieldDescriptorImpl(Jndi.class, "_jndi", "jndi", NodeType.Element);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Database target = (Database) object;
return target.getJndi();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Database target = (Database) object;
target.setJndi( (Jndi) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public void resetValue( Object object )
{
setValue( object, null );
}
public Object newInstance( Object parent ) {
return new Jndi();
}
} );
desc.setHandler(handler);
desc.setRequired(false);
desc.setMultivalued(false);
elements[2] = desc;
//-- validation code for: _jndi
fieldValidator = new FieldValidator();
desc.setValidator(fieldValidator);
//-- _mappingList
desc = new XMLFieldDescriptorImpl(Mapping.class, "_mappingList", "mapping", NodeType.Element);
handler = (new XMLFieldHandler() {
public Object getValue( Object object )
throws IllegalStateException
{
Database target = (Database) object;
return target.getMapping();
}
public void setValue( Object object, Object value)
throws IllegalStateException, IllegalArgumentException
{
try {
Database target = (Database) object;
target.addMapping( (Mapping) value);
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public void resetValue( Object object )
{
try {
Database target = (Database) object;
target.removeAllMapping();
}
catch (Exception ex) {
throw new IllegalStateException(ex.toString());
}
}
public Object newInstance( Object parent ) {
return new Mapping();
}
} );
desc.setHandler(handler);
desc.setRequired(true);
desc.setMultivalued(true);
elements[3] = desc;
//-- validation code for: _mappingList
fieldValidator = new FieldValidator();
fieldValidator.setMinOccurs(1);
desc.setValidator(fieldValidator);
} //-- org.exolab.castor.jdo.conf.DatabaseDescriptor()