Index: bugs/jdo/c1481/create.sql =================================================================== --- bugs/jdo/c1481/create.sql (revision 0) +++ bugs/jdo/c1481/create.sql (revision 0) @@ -0,0 +1,5 @@ +drop table entity; +create table entity ( + id integer not null primary key, + name varchar(200) not null +); \ No newline at end of file Index: bugs/jdo/c1481/EntityOne.java =================================================================== --- bugs/jdo/c1481/EntityOne.java (revision 0) +++ bugs/jdo/c1481/EntityOne.java (revision 0) @@ -0,0 +1,34 @@ +package jdo.c1481; + +public final class EntityOne { + private Integer _id; + private String _name; + + public EntityOne(){ + } + + public EntityOne(Integer id){ + _id = id; + } + + public EntityOne(Integer id, String name){ + _id = id; + _name = name; + } + + public Integer getId() { + return _id; + } + + public void setId(final Integer id) { + _id = id; + } + + public String getName() { + return _name; + } + + public void setName(final String name) { + _name = name; + } +} Index: bugs/jdo/c1481/jdo-conf.xml =================================================================== --- bugs/jdo/c1481/jdo-conf.xml (revision 0) +++ bugs/jdo/c1481/jdo-conf.xml (revision 0) @@ -0,0 +1,14 @@ + + + + + + + + + + + + + Index: bugs/jdo/c1481/mapping.xml =================================================================== --- bugs/jdo/c1481/mapping.xml (revision 0) +++ bugs/jdo/c1481/mapping.xml (revision 0) @@ -0,0 +1,24 @@ + + + + + + Entity one + + + + + + + + + + + + + + + + + Index: bugs/jdo/c1481/README.txt =================================================================== --- bugs/jdo/c1481/README.txt (revision 0) +++ bugs/jdo/c1481/README.txt (revision 0) @@ -0,0 +1,5 @@ +bug number: 1481 +description: Bug report template for castor jdo. +castor: version 1.0.2 or SVN of 2006-08-02 +database: Derby 10.1.3.1 +driver: derbyclient.jar Index: bugs/jdo/c1481/TestTemplate.java =================================================================== --- bugs/jdo/c1481/TestTemplate.java (revision 0) +++ bugs/jdo/c1481/TestTemplate.java (revision 0) @@ -0,0 +1,184 @@ +package jdo.c1481; + +import junit.framework.TestCase; + +import org.exolab.castor.jdo.Database; +import org.exolab.castor.jdo.JDOManager; +import org.exolab.castor.jdo.OQLQuery; +import org.exolab.castor.jdo.QueryException; +import org.exolab.castor.jdo.QueryResults; + +public final class TestTemplate extends TestCase { + private static final String JDO_CONF_FILE = "jdo-conf.xml"; + private static final String DATABASE_NAME = "derby"; + private static final int ENTITY_COUNT = 5; + private static final String SELECT_ALL_ENTITY_ONE = "selectAllEntityOne"; + private static final String SELECT_ALL_ENTITY_HINT = "selectEntitiesWithHint"; + private static final String SELECT_ENTITY_ONE_BY_ID = "selectEntityOneById"; + private static final String SELECT_KNIGHTS_WHO_SAY_NI = "selectAllNightsWhoSayNi"; + private static final String QUERY_WITH_BAD_SYNTAX = "queryBadSyntax"; + private JDOManager _jdo = null; + + public static void main(final String[] args) throws Exception { + TestTemplate test = new TestTemplate(); + test.setUp(); + test.testNamedQuery(); + test.testNonExistentNamedQuery(); + test.testBadSyntaxNamedQuery(); + test.testNamedQueryIgnoreHint(); + test.tearDown(); + } + + public TestTemplate() { + super(); + } + + public TestTemplate(final String name) { + super(name); + } + + protected void setUp() throws Exception { + super.setUp(); + + String config = getClass().getResource(JDO_CONF_FILE).toString(); + JDOManager.loadConfiguration(config, getClass().getClassLoader()); + _jdo = JDOManager.createInstance(DATABASE_NAME); + } + + protected void tearDown() throws Exception { + Database db = _jdo.getDatabase(); + db.begin(); + // delete what we have entered + for(int i=0; i < ENTITY_COUNT; i++ ) { + db.remove(db.load(EntityOne.class, new Integer(i))); + } + db.commit(); + super.tearDown(); + } + + /** + * Test method. + * @throws Exception For any exception thrown. + */ + public void testNamedQuery() throws Exception { + Database db = _jdo.getDatabase(); + // persist few EntityOne class instances + assertTrue(ENTITY_COUNT > 0); + db.begin(); + for(int i=0; i < ENTITY_COUNT; i++ ) { + db.create(new EntityOne(new Integer(i), String.valueOf(i))); + } + db.commit(); + + // load all EntityOne instances using a named query + db.begin(); + + OQLQuery query = db.getNamedQuery(SELECT_ALL_ENTITY_ONE); + QueryResults results = query.execute(); + int i = 0; + while(results.hasMore()) + { + EntityOne entity = (EntityOne) results.next(); + assertNotNull(entity); // use entity + i++; + } + assertTrue(i >= ENTITY_COUNT); + db.commit(); + + + // load EntityOne with Id=1 from persistent store + db.begin(); + + query = db.getNamedQuery(SELECT_ENTITY_ONE_BY_ID); + query.bind(new Integer(0)); + results = query.execute(); + + EntityOne entity = (EntityOne) results.next(); + + assertNotNull(entity); + assertEquals(new Integer(0), entity.getId()); + + db.commit(); + db.close(); + } + + /** + * Test method. + * @throws Exception For any exception thrown. + */ + public void testNonExistentNamedQuery() throws Exception { + Database db = _jdo.getDatabase(); + + // try to get non-existent named query + db.begin(); + try { + OQLQuery query = db.getNamedQuery(SELECT_KNIGHTS_WHO_SAY_NI); + query.close(); //this shouldn't happen + } + catch(QueryException ex){ + // great, this is what we expect + // check if it's the correct one + if(!ex.getMessage().startsWith("Can not find the query")){ + throw ex; + } + } + db.commit(); + db.close(); + } + + /** + * Test method. + * @throws Exception For any exception thrown. + */ + public void testBadSyntaxNamedQuery() throws Exception { + Database db = _jdo.getDatabase(); + + // try to load non-existent named query + db.begin(); + try { + OQLQuery query = db.getNamedQuery(QUERY_WITH_BAD_SYNTAX); + query.close(); //this shouldn't happen + } + catch(QueryException ex){ + // great, this is what we expect + // check if it's the correct one + if(!ex.getMessage().startsWith("Could not find class")){ + throw ex; + } + } + db.commit(); + db.close(); + } + + /** + * Test method. + * @throws Exception For any exception thrown. + */ + public void testNamedQueryIgnoreHint() throws Exception { + Database db = _jdo.getDatabase(); + // load all EntityOne instances using a named query + // and then use same query but with hints + db.begin(); + + OQLQuery query = db.getNamedQuery(SELECT_ALL_ENTITY_ONE); + QueryResults results = query.execute(); + int countFirst = 0; + while(results.hasMore()) { + EntityOne entity = (EntityOne)results.next(); + assertNotNull(entity); + countFirst++; + } + query = db.getNamedQuery(SELECT_ALL_ENTITY_HINT); + results = query.execute(); + int countSecond = 0; + while(results.hasMore()) { + EntityOne entity = (EntityOne)results.next(); + assertNotNull(entity); + countSecond++; + } + assertEquals(countFirst, countSecond); + + db.commit(); + db.close(); + } +} Index: main/java/org/castor/persist/AbstractTransactionContext.java =================================================================== --- main/java/org/castor/persist/AbstractTransactionContext.java (revision 6064) +++ main/java/org/castor/persist/AbstractTransactionContext.java (working copy) @@ -31,10 +31,12 @@ import org.exolab.castor.jdo.DbMetaInfo; import org.exolab.castor.jdo.DuplicateIdentityException; import org.exolab.castor.jdo.LockNotGrantedException; +import org.exolab.castor.jdo.OQLQuery; import org.exolab.castor.jdo.ObjectDeletedException; import org.exolab.castor.jdo.ObjectNotFoundException; import org.exolab.castor.jdo.ObjectNotPersistentException; import org.exolab.castor.jdo.PersistenceException; +import org.exolab.castor.jdo.QueryException; import org.exolab.castor.jdo.TransactionAbortedException; import org.exolab.castor.mapping.AccessMode; import org.exolab.castor.persist.ClassMolder; @@ -1667,4 +1669,18 @@ OID oid = new OID(lockEngine.getClassMolder(cls), identity); return lockEngine.isLocked(cls, oid); } + + /** + * @inheritDoc + * @see org.castor.persist.TransactionContext#getNamedQuery(java.lang.String) + */ + public String getNamedQuery(final ClassMolder molder, final String name) + throws QueryException { + if (molder == null) { + throw new QueryException("Invalid argument - molder is null"); + } + return molder.getNamedQuery(name); + } + + } Index: main/java/org/castor/persist/TransactionContext.java =================================================================== --- main/java/org/castor/persist/TransactionContext.java (revision 6064) +++ main/java/org/castor/persist/TransactionContext.java (working copy) @@ -5,7 +5,9 @@ import org.exolab.castor.jdo.Database; import org.exolab.castor.jdo.DbMetaInfo; +import org.exolab.castor.jdo.OQLQuery; import org.exolab.castor.jdo.PersistenceException; +import org.exolab.castor.jdo.QueryException; import org.exolab.castor.jdo.TransactionAbortedException; import org.exolab.castor.mapping.AccessMode; import org.exolab.castor.persist.ClassMolder; @@ -541,4 +543,16 @@ * @return True if the object in question is locked. */ boolean isLocked(Class cls, Identity identity, LockEngine lockEngine); + + /** + * Creates an OQL query based upon a named query as defined in the + * mapping file. + * + * @param molder Specific class molder. + * @param name Name of the (named) query to create. + * @return An OQL query + * @throws QueryException If the named query can not be found + */ + String getNamedQuery(ClassMolder molder, String name) throws QueryException; + } Index: main/java/org/exolab/castor/jdo/Database.java =================================================================== --- main/java/org/exolab/castor/jdo/Database.java (revision 6064) +++ main/java/org/exolab/castor/jdo/Database.java (working copy) @@ -190,8 +190,16 @@ */ public Query getQuery(); + /** + * Creates an OQL query based upon a named query as defined in the + * mapping file. {@link OQLQuery#create} + * + * @param name Name of the (named) query to create. + * @return An OQL query + * @throws PersistenceException + */ + public OQLQuery getNamedQuery(String name) throws PersistenceException; - public PersistenceInfoGroup getScope(); /** Index: main/java/org/exolab/castor/jdo/engine/AbstractDatabaseImpl.java =================================================================== --- main/java/org/exolab/castor/jdo/engine/AbstractDatabaseImpl.java (revision 6064) +++ main/java/org/exolab/castor/jdo/engine/AbstractDatabaseImpl.java (working copy) @@ -403,6 +403,16 @@ /** * @inheritDoc + * @see org.exolab.castor.jdo.Database#getNamedQuery() + */ + public OQLQuery getNamedQuery(final String name) throws PersistenceException { + String oql = _ctx.getNamedQuery(_scope.findClassMolderByQuery(name), name); + return getOQLQuery(oql); + } + + + /** + * @inheritDoc * @see org.exolab.castor.jdo.Database#getOQLQuery(java.lang.String) */ public OQLQuery getOQLQuery(final String oql) Index: main/java/org/exolab/castor/jdo/engine/JDOClassDescriptor.java =================================================================== --- main/java/org/exolab/castor/jdo/engine/JDOClassDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/jdo/engine/JDOClassDescriptor.java (working copy) @@ -44,12 +44,16 @@ */ package org.exolab.castor.jdo.engine; +import java.util.HashMap; +import java.util.Map; import java.util.Properties; import org.castor.cache.Cache; import org.castor.cache.simple.CountLimited; import org.castor.cache.simple.TimeLimited; import org.castor.util.Messages; +import org.exolab.castor.jdo.OQLQuery; +import org.exolab.castor.jdo.QueryException; import org.exolab.castor.jdo.TimeStampable; import org.exolab.castor.mapping.ClassDescriptor; import org.exolab.castor.mapping.MappingException; @@ -80,6 +84,8 @@ /** The properties defining cache type and parameters. */ private final Properties _cacheParams = new Properties(); + private Map _namedQueries = new HashMap(); + public JDOClassDescriptor(final ClassDescriptor clsDesc, final KeyGeneratorDescriptor keyGenDesc) throws MappingException { @@ -201,4 +207,34 @@ public String toString() { return super.toString() + " AS " + _tableName; } + + /** + * Returns the OQL statement from a named query instance associated with the given name + * @param name Name of the named query + * @return the OQL statement from a named query instance associated with the given name + */ + public String getNamedQuery(String name) { + String namedQuery = (String) _namedQueries.get(name); + /* TODO [EC] Remove + * Since we iterate through all descriptors, + * not finding a query is ok. + * + * if (namedQuery == null) { + throw new QueryException ("Cannot find named query for '" + name + "'"); + }*/ + return namedQuery; + } + + /** + * Adds a new named query for the given name for future usage (through Database.getNamedQuery()). + * @param name Name of the named query. + * @param namedQuery Named query to be associated with the given name + * @throws QueryException If there's already a named query for the given name + */ + public void addNamedQuery(final String name, final String namedQuery) throws QueryException { + if (_namedQueries.containsKey(name)) { + throw new QueryException ("Duplicate entry for named query " + name); + } + _namedQueries.put(name, namedQuery); + } } Index: main/java/org/exolab/castor/jdo/engine/JDOMappingLoader.java =================================================================== --- main/java/org/exolab/castor/jdo/engine/JDOMappingLoader.java (revision 6064) +++ main/java/org/exolab/castor/jdo/engine/JDOMappingLoader.java (working copy) @@ -49,6 +49,7 @@ import org.castor.jdo.engine.SQLTypeConverters.Convertor; import org.castor.mapping.BindingType; import org.castor.util.Messages; +import org.exolab.castor.jdo.QueryException; import org.exolab.castor.mapping.*; import org.exolab.castor.mapping.loader.CollectionHandlers; import org.exolab.castor.mapping.loader.FieldDescriptorImpl; @@ -129,6 +130,13 @@ * See {@link #loadMapping}. */ private Hashtable _keyGenDescs = new Hashtable(); + + /** + * Used to locally register all loaded queries + * to detect duplicated query names. + * See {@link #createDescriptor(ClassMapping)}. + */ + private Hashtable _namedQueries = new Hashtable(); /** @@ -214,8 +222,28 @@ _keyGenDescs.put(keyGenName, keyGenDesc); } } - - return new JDOClassDescriptor(clsDesc, keyGenDesc); + + JDOClassDescriptor classDescriptor = new JDOClassDescriptor(clsDesc, keyGenDesc); + + // add named queries to (JDO) class descriptor + Enumeration namedQueriesEnum = clsMap.enumerateNamedQuery(); + while (namedQueriesEnum.hasMoreElements()) { + NamedQuery namedQuery = (NamedQuery) namedQueriesEnum.nextElement(); + try + { + if(_namedQueries.get(namedQuery.getName()) != null) { + throw new MappingException("Duplicate named query name."); + } + classDescriptor.addNamedQuery(namedQuery.getName(), namedQuery.getQuery()); + _namedQueries.put(namedQuery.getName(), namedQuery); + } + catch(QueryException err) + { + throw new MappingException(err); + } + } + + return classDescriptor; } /** Index: main/java/org/exolab/castor/mapping/xml/BindXml.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/BindXml.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/BindXml.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,19 +11,9 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import org.exolab.castor.mapping.xml.types.BindXmlAutoNamingType; -import org.exolab.castor.mapping.xml.types.BindXmlNodeType; -import org.exolab.castor.xml.MarshalException; +import java.util.Collections; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * The 'bind-xml' element is used for specifying XML specific @@ -33,7 +23,7 @@ * as a child of a 'field' element. * * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class BindXml implements java.io.Serializable { @@ -131,7 +121,7 @@ public BindXml() { super(); - _propertyList = new ArrayList(); + _propertyList = new java.util.ArrayList(); } //-- org.exolab.castor.mapping.xml.BindXml() @@ -202,7 +192,7 @@ */ public java.util.Enumeration enumerateProperty() { - return new org.exolab.castor.util.IteratorEnumeration(_propertyList.iterator()); + return Collections.enumeration(_propertyList); } //-- java.util.Enumeration enumerateProperty() /** @@ -304,7 +294,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _propertyList.size())) { + if ((index < 0) || (index >= _propertyList.size())) { throw new IndexOutOfBoundsException(); } @@ -561,7 +551,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _propertyList.size())) { + if ((index < 0) || (index >= _propertyList.size())) { throw new IndexOutOfBoundsException(); } _propertyList.set(index, vProperty); Index: main/java/org/exolab/castor/mapping/xml/BindXmlDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/BindXmlDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/BindXmlDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class BindXmlDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class BindXmlDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "bind-xml"; + elementDefinition = true; //-- set grouping compositor setCompositorAsSequence(); @@ -131,7 +128,7 @@ //-- validation code for: _type fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -202,7 +199,7 @@ //-- validation code for: _location fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -239,7 +236,7 @@ //-- validation code for: _matches fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -282,7 +279,7 @@ //-- validation code for: _reference fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -352,7 +349,7 @@ //-- validation code for: _QNamePrefix fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -394,7 +391,7 @@ //-- validation code for: _transient fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -571,4 +568,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/CacheTypeMapping.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/CacheTypeMapping.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/CacheTypeMapping.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,22 +11,14 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import org.exolab.castor.xml.MarshalException; +import java.util.Collections; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class CacheTypeMapping. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class CacheTypeMapping implements java.io.Serializable { @@ -74,7 +66,7 @@ { super(); setType("count-limited"); - _paramList = new ArrayList(); + _paramList = new java.util.ArrayList(); } //-- org.exolab.castor.mapping.xml.CacheTypeMapping() @@ -145,7 +137,7 @@ */ public java.util.Enumeration enumerateParam() { - return new org.exolab.castor.util.IteratorEnumeration(_paramList.iterator()); + return Collections.enumeration(_paramList); } //-- java.util.Enumeration enumerateParam() /** @@ -182,7 +174,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _paramList.size())) { + if ((index < 0) || (index >= _paramList.size())) { throw new IndexOutOfBoundsException(); } @@ -347,7 +339,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _paramList.size())) { + if ((index < 0) || (index >= _paramList.size())) { throw new IndexOutOfBoundsException(); } _paramList.set(index, vParam); Index: main/java/org/exolab/castor/mapping/xml/CacheTypeMappingDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/CacheTypeMappingDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/CacheTypeMappingDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class CacheTypeMappingDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class CacheTypeMappingDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "cache-type"; + elementDefinition = true; //-- set grouping compositor setCompositorAsSequence(); @@ -98,7 +95,7 @@ //-- validation code for: _type fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -141,7 +138,7 @@ //-- validation code for: _debug fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -183,7 +180,7 @@ //-- validation code for: _capacity fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - IntegerValidator typeValidator = new IntegerValidator(); + org.exolab.castor.xml.validators.IntegerValidator typeValidator = new org.exolab.castor.xml.validators.IntegerValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -327,4 +324,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/ClassChoice.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/ClassChoice.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/ClassChoice.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,17 +11,9 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import org.exolab.castor.xml.MarshalException; +import java.util.Collections; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class ClassChoice. @@ -53,8 +45,8 @@ public ClassChoice() { super(); - _fieldMappingList = new ArrayList(); - _containerList = new ArrayList(); + _fieldMappingList = new java.util.ArrayList(); + _containerList = new java.util.ArrayList(); } //-- org.exolab.castor.mapping.xml.ClassChoice() @@ -143,7 +135,7 @@ */ public java.util.Enumeration enumerateContainer() { - return new org.exolab.castor.util.IteratorEnumeration(_containerList.iterator()); + return Collections.enumeration(_containerList); } //-- java.util.Enumeration enumerateContainer() /** @@ -155,7 +147,7 @@ */ public java.util.Enumeration enumerateFieldMapping() { - return new org.exolab.castor.util.IteratorEnumeration(_fieldMappingList.iterator()); + return Collections.enumeration(_fieldMappingList); } //-- java.util.Enumeration enumerateFieldMapping() /** @@ -170,7 +162,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _containerList.size())) { + if ((index < 0) || (index >= _containerList.size())) { throw new IndexOutOfBoundsException(); } @@ -218,7 +210,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _fieldMappingList.size())) { + if ((index < 0) || (index >= _fieldMappingList.size())) { throw new IndexOutOfBoundsException(); } @@ -340,7 +332,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _containerList.size())) { + if ((index < 0) || (index >= _containerList.size())) { throw new IndexOutOfBoundsException(); } _containerList.set(index, vContainer); @@ -374,7 +366,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _fieldMappingList.size())) { + if ((index < 0) || (index >= _fieldMappingList.size())) { throw new IndexOutOfBoundsException(); } _fieldMappingList.set(index, vFieldMapping); Index: main/java/org/exolab/castor/mapping/xml/ClassChoiceDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/ClassChoiceDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/ClassChoiceDescriptor.java (working copy) @@ -1,21 +1,12 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class ClassChoiceDescriptor. * @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -57,6 +53,7 @@ { super(); nsURI = "http://castor.exolab.org/"; + elementDefinition = false; //-- set grouping compositor setCompositorAsChoice(); @@ -240,4 +237,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/ClassMapping.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/ClassMapping.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/ClassMapping.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,23 +11,14 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import org.exolab.castor.mapping.xml.types.ClassMappingAccessType; -import org.exolab.castor.xml.MarshalException; +import java.util.Collections; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class ClassMapping. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class ClassMapping implements java.io.Serializable { @@ -102,6 +93,11 @@ private org.exolab.castor.mapping.xml.MapTo _mapTo; /** + * Field _namedQueryList + */ + private java.util.ArrayList _namedQueryList; + + /** * Field _classChoice */ private org.exolab.castor.mapping.xml.ClassChoice _classChoice; @@ -114,8 +110,9 @@ public ClassMapping() { super(); - _identity = new ArrayList(); + _identity = new java.util.ArrayList(); setAccess(org.exolab.castor.mapping.xml.types.ClassMappingAccessType.valueOf("shared")); + _namedQueryList = new java.util.ArrayList(); } //-- org.exolab.castor.mapping.xml.ClassMapping() @@ -151,6 +148,33 @@ } //-- void addIdentity(int, java.lang.String) /** + * Method addNamedQuery + * + * + * + * @param vNamedQuery + */ + public void addNamedQuery(org.exolab.castor.mapping.xml.NamedQuery vNamedQuery) + throws java.lang.IndexOutOfBoundsException + { + _namedQueryList.add(vNamedQuery); + } //-- void addNamedQuery(org.exolab.castor.mapping.xml.NamedQuery) + + /** + * Method addNamedQuery + * + * + * + * @param index + * @param vNamedQuery + */ + public void addNamedQuery(int index, org.exolab.castor.mapping.xml.NamedQuery vNamedQuery) + throws java.lang.IndexOutOfBoundsException + { + _namedQueryList.add(index, vNamedQuery); + } //-- void addNamedQuery(int, org.exolab.castor.mapping.xml.NamedQuery) + + /** * Method clearIdentity * */ @@ -160,6 +184,15 @@ } //-- void clearIdentity() /** + * Method clearNamedQuery + * + */ + public void clearNamedQuery() + { + _namedQueryList.clear(); + } //-- void clearNamedQuery() + + /** * Method deleteAutoComplete * */ @@ -186,10 +219,22 @@ */ public java.util.Enumeration enumerateIdentity() { - return new org.exolab.castor.util.IteratorEnumeration(_identity.iterator()); + return Collections.enumeration(_identity); } //-- java.util.Enumeration enumerateIdentity() /** + * Method enumerateNamedQuery + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateNamedQuery() + { + return Collections.enumeration(_namedQueryList); + } //-- java.util.Enumeration enumerateNamedQuery() + + /** * Returns the value of field 'access'. * * @return ClassMappingAccessType @@ -278,7 +323,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _identity.size())) { + if ((index < 0) || (index >= _identity.size())) { throw new IndexOutOfBoundsException(); } @@ -348,6 +393,54 @@ } //-- java.lang.String getName() /** + * Method getNamedQuery + * + * + * + * @param index + * @return NamedQuery + */ + public org.exolab.castor.mapping.xml.NamedQuery getNamedQuery(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index >= _namedQueryList.size())) { + throw new IndexOutOfBoundsException(); + } + + return (org.exolab.castor.mapping.xml.NamedQuery) _namedQueryList.get(index); + } //-- org.exolab.castor.mapping.xml.NamedQuery getNamedQuery(int) + + /** + * Method getNamedQuery + * + * + * + * @return NamedQuery + */ + public org.exolab.castor.mapping.xml.NamedQuery[] getNamedQuery() + { + int size = _namedQueryList.size(); + org.exolab.castor.mapping.xml.NamedQuery[] mArray = new org.exolab.castor.mapping.xml.NamedQuery[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (org.exolab.castor.mapping.xml.NamedQuery) _namedQueryList.get(index); + } + return mArray; + } //-- org.exolab.castor.mapping.xml.NamedQuery[] getNamedQuery() + + /** + * Method getNamedQueryCount + * + * + * + * @return int + */ + public int getNamedQueryCount() + { + return _namedQueryList.size(); + } //-- int getNamedQueryCount() + + /** * Returns the value of field 'verifyConstructable'. * * @return boolean @@ -443,6 +536,20 @@ } //-- boolean removeIdentity(java.lang.String) /** + * Method removeNamedQuery + * + * + * + * @param vNamedQuery + * @return boolean + */ + public boolean removeNamedQuery(org.exolab.castor.mapping.xml.NamedQuery vNamedQuery) + { + boolean removed = _namedQueryList.remove(vNamedQuery); + return removed; + } //-- boolean removeNamedQuery(org.exolab.castor.mapping.xml.NamedQuery) + + /** * Sets the value of field 'access'. * * @param access the value of field 'access'. @@ -526,7 +633,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _identity.size())) { + if ((index < 0) || (index >= _identity.size())) { throw new IndexOutOfBoundsException(); } _identity.set(index, vIdentity); @@ -579,6 +686,40 @@ } //-- void setName(java.lang.String) /** + * Method setNamedQuery + * + * + * + * @param index + * @param vNamedQuery + */ + public void setNamedQuery(int index, org.exolab.castor.mapping.xml.NamedQuery vNamedQuery) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index >= _namedQueryList.size())) { + throw new IndexOutOfBoundsException(); + } + _namedQueryList.set(index, vNamedQuery); + } //-- void setNamedQuery(int, org.exolab.castor.mapping.xml.NamedQuery) + + /** + * Method setNamedQuery + * + * + * + * @param namedQueryArray + */ + public void setNamedQuery(org.exolab.castor.mapping.xml.NamedQuery[] namedQueryArray) + { + //-- copy array + _namedQueryList.clear(); + for (int i = 0; i < namedQueryArray.length; i++) { + _namedQueryList.add(namedQueryArray[i]); + } + } //-- void setNamedQuery(org.exolab.castor.mapping.xml.NamedQuery) + + /** * Sets the value of field 'verifyConstructable'. * * @param verifyConstructable the value of field Index: main/java/org/exolab/castor/mapping/xml/ClassMappingDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/ClassMappingDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/ClassMappingDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class ClassMappingDescriptor. * - * @version $Revision$ $Date: 2006-04-13 07:37:49 -0600 (Thu, 13 Apr 2006) $ + * @version $Revision$ $Date$ */ public class ClassMappingDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "class"; + elementDefinition = true; //-- set grouping compositor setCompositorAsSequence(); @@ -117,7 +114,7 @@ { try { ClassMapping target = (ClassMapping) object; - target.setExtends( value); + target.setExtends( (java.lang.Object) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -151,7 +148,7 @@ { try { ClassMapping target = (ClassMapping) object; - target.setDepends( value); + target.setDepends( (java.lang.Object) value); } catch (java.lang.Exception ex) { throw new IllegalStateException(ex.toString()); @@ -269,7 +266,7 @@ //-- validation code for: _keyGenerator fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -312,7 +309,7 @@ //-- validation code for: _autoComplete fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -354,7 +351,7 @@ //-- validation code for: _verifyConstructable fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -392,7 +389,7 @@ //-- validation code for: _description fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -465,6 +462,41 @@ { //-- local scope } desc.setValidator(fieldValidator); + //-- _namedQueryList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.mapping.xml.NamedQuery.class, "_namedQueryList", "named-query", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + ClassMapping target = (ClassMapping) object; + return target.getNamedQuery(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + ClassMapping target = (ClassMapping) object; + target.addNamedQuery( (org.exolab.castor.mapping.xml.NamedQuery) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return new org.exolab.castor.mapping.xml.NamedQuery(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://castor.exolab.org/"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _namedQueryList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); //-- _classChoice desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.mapping.xml.ClassChoice.class, "_classChoice", "-error-if-this-is-used-", org.exolab.castor.xml.NodeType.Element); handler = new org.exolab.castor.xml.XMLFieldHandler() { @@ -604,4 +636,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/Container.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/Container.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/Container.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,20 +11,13 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class Container. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class Container implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/ContainerDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/ContainerDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/ContainerDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class ContainerDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class ContainerDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "container"; + elementDefinition = true; //-- set grouping compositor setCompositorAsSequence(); @@ -99,7 +96,7 @@ fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -134,7 +131,7 @@ //-- validation code for: _type fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -176,7 +173,7 @@ //-- validation code for: _required fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -218,7 +215,7 @@ //-- validation code for: _direct fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -253,7 +250,7 @@ //-- validation code for: _getMethod fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -288,7 +285,7 @@ //-- validation code for: _setMethod fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -323,7 +320,7 @@ //-- validation code for: _createMethod fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -361,7 +358,7 @@ //-- validation code for: _description fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -505,4 +502,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/FieldMapping.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/FieldMapping.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/FieldMapping.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,21 +11,13 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.mapping.xml.types.FieldMappingCollectionType; -import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class FieldMapping. * - * @version $Revision$ $Date: 2006-02-14 07:53:50 -0700 (Tue, 14 Feb 2006) $ + * @version $Revision$ $Date$ */ public class FieldMapping implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/FieldMappingDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/FieldMappingDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/FieldMappingDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class FieldMappingDescriptor. * - * @version $Revision$ $Date: 2006-02-14 07:53:50 -0700 (Tue, 14 Feb 2006) $ + * @version $Revision$ $Date$ */ public class FieldMappingDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "field"; + elementDefinition = true; //-- set grouping compositor setCompositorAsSequence(); @@ -100,7 +97,7 @@ fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -137,7 +134,7 @@ //-- validation code for: _type fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -180,7 +177,7 @@ //-- validation code for: _required fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -222,7 +219,7 @@ //-- validation code for: _transient fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -264,7 +261,7 @@ //-- validation code for: _direct fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -306,7 +303,7 @@ //-- validation code for: _lazy fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -348,7 +345,7 @@ //-- validation code for: _container fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -384,7 +381,7 @@ //-- validation code for: _getMethod fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -421,7 +418,7 @@ //-- validation code for: _hasMethod fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -458,7 +455,7 @@ //-- validation code for: _setMethod fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -495,7 +492,7 @@ //-- validation code for: _createMethod fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -532,7 +529,7 @@ //-- validation code for: _handler fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -604,7 +601,7 @@ //-- validation code for: _comparator fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -647,7 +644,7 @@ //-- validation code for: _identity fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -685,7 +682,7 @@ //-- validation code for: _description fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -895,4 +892,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/Include.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/Include.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/Include.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,20 +11,13 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class Include. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class Include implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/IncludeDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/IncludeDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/IncludeDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class IncludeDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class IncludeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "include"; + elementDefinition = true; org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; org.exolab.castor.mapping.FieldHandler handler = null; org.exolab.castor.xml.FieldValidator fieldValidator = null; @@ -97,7 +94,7 @@ fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -207,4 +204,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/KeyGeneratorDef.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/KeyGeneratorDef.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/KeyGeneratorDef.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,22 +11,14 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import org.exolab.castor.xml.MarshalException; +import java.util.Collections; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class KeyGeneratorDef. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class KeyGeneratorDef implements java.io.Serializable { @@ -58,7 +50,7 @@ public KeyGeneratorDef() { super(); - _paramList = new ArrayList(); + _paramList = new java.util.ArrayList(); } //-- org.exolab.castor.mapping.xml.KeyGeneratorDef() @@ -111,7 +103,7 @@ */ public java.util.Enumeration enumerateParam() { - return new org.exolab.castor.util.IteratorEnumeration(_paramList.iterator()); + return Collections.enumeration(_paramList); } //-- java.util.Enumeration enumerateParam() /** @@ -148,7 +140,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _paramList.size())) { + if ((index < 0) || (index >= _paramList.size())) { throw new IndexOutOfBoundsException(); } @@ -276,7 +268,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _paramList.size())) { + if ((index < 0) || (index >= _paramList.size())) { throw new IndexOutOfBoundsException(); } _paramList.set(index, vParam); Index: main/java/org/exolab/castor/mapping/xml/KeyGeneratorDefDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/KeyGeneratorDefDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/KeyGeneratorDefDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class KeyGeneratorDefDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class KeyGeneratorDefDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "key-generator"; + elementDefinition = true; //-- set grouping compositor setCompositorAsSequence(); @@ -134,7 +131,7 @@ //-- validation code for: _alias fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -279,4 +276,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/Ldap.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/Ldap.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/Ldap.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,20 +11,13 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class Ldap. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class Ldap implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/LdapDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/LdapDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/LdapDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class LdapDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class LdapDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "ldap"; + elementDefinition = true; org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; org.exolab.castor.mapping.FieldHandler handler = null; org.exolab.castor.xml.FieldValidator fieldValidator = null; @@ -94,7 +91,7 @@ //-- validation code for: _name fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -203,4 +200,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/MappingRoot.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/MappingRoot.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/MappingRoot.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,22 +11,14 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import org.exolab.castor.xml.MarshalException; +import java.util.Collections; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class MappingRoot. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class MappingRoot implements java.io.Serializable { @@ -63,9 +55,9 @@ public MappingRoot() { super(); - _includeList = new ArrayList(); - _classMappingList = new ArrayList(); - _keyGeneratorDefList = new ArrayList(); + _includeList = new java.util.ArrayList(); + _classMappingList = new java.util.ArrayList(); + _keyGeneratorDefList = new java.util.ArrayList(); } //-- org.exolab.castor.mapping.xml.MappingRoot() @@ -190,7 +182,7 @@ */ public java.util.Enumeration enumerateClassMapping() { - return new org.exolab.castor.util.IteratorEnumeration(_classMappingList.iterator()); + return Collections.enumeration(_classMappingList); } //-- java.util.Enumeration enumerateClassMapping() /** @@ -202,7 +194,7 @@ */ public java.util.Enumeration enumerateInclude() { - return new org.exolab.castor.util.IteratorEnumeration(_includeList.iterator()); + return Collections.enumeration(_includeList); } //-- java.util.Enumeration enumerateInclude() /** @@ -214,7 +206,7 @@ */ public java.util.Enumeration enumerateKeyGeneratorDef() { - return new org.exolab.castor.util.IteratorEnumeration(_keyGeneratorDefList.iterator()); + return Collections.enumeration(_keyGeneratorDefList); } //-- java.util.Enumeration enumerateKeyGeneratorDef() /** @@ -229,7 +221,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _classMappingList.size())) { + if ((index < 0) || (index >= _classMappingList.size())) { throw new IndexOutOfBoundsException(); } @@ -288,7 +280,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _includeList.size())) { + if ((index < 0) || (index >= _includeList.size())) { throw new IndexOutOfBoundsException(); } @@ -336,7 +328,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _keyGeneratorDefList.size())) { + if ((index < 0) || (index >= _keyGeneratorDefList.size())) { throw new IndexOutOfBoundsException(); } @@ -472,7 +464,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _classMappingList.size())) { + if ((index < 0) || (index >= _classMappingList.size())) { throw new IndexOutOfBoundsException(); } _classMappingList.set(index, vClassMapping); @@ -516,7 +508,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _includeList.size())) { + if ((index < 0) || (index >= _includeList.size())) { throw new IndexOutOfBoundsException(); } _includeList.set(index, vInclude); @@ -550,7 +542,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _keyGeneratorDefList.size())) { + if ((index < 0) || (index >= _keyGeneratorDefList.size())) { throw new IndexOutOfBoundsException(); } _keyGeneratorDefList.set(index, vKeyGeneratorDef); Index: main/java/org/exolab/castor/mapping/xml/MappingRootDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/MappingRootDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/MappingRootDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class MappingRootDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class MappingRootDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "mapping"; + elementDefinition = true; //-- set grouping compositor setCompositorAsSequence(); @@ -100,7 +97,7 @@ //-- validation code for: _description fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -313,4 +310,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/MapTo.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/MapTo.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/MapTo.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M2, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,20 +11,13 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class MapTo. * - * @version $Revision$ $Date: 2006-02-23 01:37:50 -0700 (Thu, 23 Feb 2006) $ + * @version $Revision$ $Date$ */ public class MapTo implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/MapToDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/MapToDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/MapToDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class MapToDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class MapToDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "map-to"; + elementDefinition = true; org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; org.exolab.castor.mapping.FieldHandler handler = null; org.exolab.castor.xml.FieldValidator fieldValidator = null; @@ -94,7 +91,7 @@ //-- validation code for: _table fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -130,7 +127,7 @@ //-- validation code for: _xml fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -167,7 +164,7 @@ //-- validation code for: _nsUri fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -203,10 +200,52 @@ //-- validation code for: _nsPrefix fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); + //-- _elementDefinition + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.Boolean.TYPE, "_elementDefinition", "element-definition", org.exolab.castor.xml.NodeType.Attribute); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + MapTo target = (MapTo) object; + if(!target.hasElementDefinition()) + return null; + return (target.getElementDefinition() ? java.lang.Boolean.TRUE : java.lang.Boolean.FALSE); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + MapTo target = (MapTo) object; + // if null, use delete method for optional primitives + if (value == null) { + target.deleteElementDefinition(); + return; + } + target.setElementDefinition( ((java.lang.Boolean)value).booleanValue()); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _elementDefinition + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + { //-- local scope + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); //-- _ldapDn desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_ldapDn", "ldap-dn", org.exolab.castor.xml.NodeType.Attribute); desc.setImmutable(true); @@ -239,7 +278,7 @@ //-- validation code for: _ldapDn fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -276,7 +315,7 @@ //-- validation code for: _ldapOc fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -386,4 +425,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/NamedQuery.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/NamedQuery.java (revision 0) +++ main/java/org/exolab/castor/mapping/xml/NamedQuery.java (revision 0) @@ -0,0 +1,318 @@ +/* + * This class was automatically generated with + * Castor 1.0.1, using an XML + * Schema. + * $Id$ + */ + +package org.exolab.castor.mapping.xml; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import java.util.Collections; +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * Class NamedQuery. + * + * @version $Revision$ $Date$ + */ +public class NamedQuery implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _name + */ + private java.lang.String _name; + + /** + * Field _query + */ + private java.lang.String _query; + + /** + * Field _queryHintList + */ + private java.util.ArrayList _queryHintList; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public NamedQuery() + { + super(); + _queryHintList = new java.util.ArrayList(); + } //-- org.exolab.castor.mapping.xml.NamedQuery() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method addQueryHint + * + * + * + * @param vQueryHint + */ + public void addQueryHint(org.exolab.castor.mapping.xml.QueryHint vQueryHint) + throws java.lang.IndexOutOfBoundsException + { + _queryHintList.add(vQueryHint); + } //-- void addQueryHint(org.exolab.castor.mapping.xml.QueryHint) + + /** + * Method addQueryHint + * + * + * + * @param index + * @param vQueryHint + */ + public void addQueryHint(int index, org.exolab.castor.mapping.xml.QueryHint vQueryHint) + throws java.lang.IndexOutOfBoundsException + { + _queryHintList.add(index, vQueryHint); + } //-- void addQueryHint(int, org.exolab.castor.mapping.xml.QueryHint) + + /** + * Method clearQueryHint + * + */ + public void clearQueryHint() + { + _queryHintList.clear(); + } //-- void clearQueryHint() + + /** + * Method enumerateQueryHint + * + * + * + * @return Enumeration + */ + public java.util.Enumeration enumerateQueryHint() + { + return Collections.enumeration(_queryHintList); + } //-- java.util.Enumeration enumerateQueryHint() + + /** + * Returns the value of field 'name'. + * + * @return String + * @return the value of field 'name'. + */ + public java.lang.String getName() + { + return this._name; + } //-- java.lang.String getName() + + /** + * Returns the value of field 'query'. + * + * @return String + * @return the value of field 'query'. + */ + public java.lang.String getQuery() + { + return this._query; + } //-- java.lang.String getQuery() + + /** + * Method getQueryHint + * + * + * + * @param index + * @return QueryHint + */ + public org.exolab.castor.mapping.xml.QueryHint getQueryHint(int index) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index >= _queryHintList.size())) { + throw new IndexOutOfBoundsException(); + } + + return (org.exolab.castor.mapping.xml.QueryHint) _queryHintList.get(index); + } //-- org.exolab.castor.mapping.xml.QueryHint getQueryHint(int) + + /** + * Method getQueryHint + * + * + * + * @return QueryHint + */ + public org.exolab.castor.mapping.xml.QueryHint[] getQueryHint() + { + int size = _queryHintList.size(); + org.exolab.castor.mapping.xml.QueryHint[] mArray = new org.exolab.castor.mapping.xml.QueryHint[size]; + for (int index = 0; index < size; index++) { + mArray[index] = (org.exolab.castor.mapping.xml.QueryHint) _queryHintList.get(index); + } + return mArray; + } //-- org.exolab.castor.mapping.xml.QueryHint[] getQueryHint() + + /** + * Method getQueryHintCount + * + * + * + * @return int + */ + public int getQueryHintCount() + { + return _queryHintList.size(); + } //-- int getQueryHintCount() + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Method removeQueryHint + * + * + * + * @param vQueryHint + * @return boolean + */ + public boolean removeQueryHint(org.exolab.castor.mapping.xml.QueryHint vQueryHint) + { + boolean removed = _queryHintList.remove(vQueryHint); + return removed; + } //-- boolean removeQueryHint(org.exolab.castor.mapping.xml.QueryHint) + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName(java.lang.String name) + { + this._name = name; + } //-- void setName(java.lang.String) + + /** + * Sets the value of field 'query'. + * + * @param query the value of field 'query'. + */ + public void setQuery(java.lang.String query) + { + this._query = query; + } //-- void setQuery(java.lang.String) + + /** + * Method setQueryHint + * + * + * + * @param index + * @param vQueryHint + */ + public void setQueryHint(int index, org.exolab.castor.mapping.xml.QueryHint vQueryHint) + throws java.lang.IndexOutOfBoundsException + { + //-- check bounds for index + if ((index < 0) || (index >= _queryHintList.size())) { + throw new IndexOutOfBoundsException(); + } + _queryHintList.set(index, vQueryHint); + } //-- void setQueryHint(int, org.exolab.castor.mapping.xml.QueryHint) + + /** + * Method setQueryHint + * + * + * + * @param queryHintArray + */ + public void setQueryHint(org.exolab.castor.mapping.xml.QueryHint[] queryHintArray) + { + //-- copy array + _queryHintList.clear(); + for (int i = 0; i < queryHintArray.length; i++) { + _queryHintList.add(queryHintArray[i]); + } + } //-- void setQueryHint(org.exolab.castor.mapping.xml.QueryHint) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return NamedQuery + */ + public static org.exolab.castor.mapping.xml.NamedQuery unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (org.exolab.castor.mapping.xml.NamedQuery) Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.NamedQuery.class, reader); + } //-- org.exolab.castor.mapping.xml.NamedQuery unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} Index: main/java/org/exolab/castor/mapping/xml/NamedQueryDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/NamedQueryDescriptor.java (revision 0) +++ main/java/org/exolab/castor/mapping/xml/NamedQueryDescriptor.java (revision 0) @@ -0,0 +1,296 @@ +/* + * This class was automatically generated with + * Castor 1.0.1, using an XML + * Schema. + * $Id$ + */ + +package org.exolab.castor.mapping.xml; + +/** + * Class NamedQueryDescriptor. + * + * @version $Revision$ $Date$ + */ +public class NamedQueryDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** + * Field nsPrefix + */ + private java.lang.String nsPrefix; + + /** + * Field nsURI + */ + private java.lang.String nsURI; + + /** + * Field xmlName + */ + private java.lang.String xmlName; + + /** + * Field identity + */ + private org.exolab.castor.xml.XMLFieldDescriptor identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public NamedQueryDescriptor() + { + super(); + nsURI = "http://castor.exolab.org/"; + xmlName = "named-query"; + elementDefinition = true; + + //-- set grouping compositor + setCompositorAsSequence(); + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _name + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NamedQuery target = (NamedQuery) object; + return target.getName(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NamedQuery target = (NamedQuery) object; + target.setName( (java.lang.String) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _name + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + typeValidator.setWhiteSpace("preserve"); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _query + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_query", "query", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NamedQuery target = (NamedQuery) object; + return target.getQuery(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NamedQuery target = (NamedQuery) object; + target.setQuery( (java.lang.String) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _query + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + typeValidator.setWhiteSpace("preserve"); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + //-- _queryHintList + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(org.exolab.castor.mapping.xml.QueryHint.class, "_queryHintList", "query-hint", org.exolab.castor.xml.NodeType.Element); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + NamedQuery target = (NamedQuery) object; + return target.getQueryHint(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + NamedQuery target = (NamedQuery) object; + target.addQueryHint( (org.exolab.castor.mapping.xml.QueryHint) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return new org.exolab.castor.mapping.xml.QueryHint(); + } + }; + desc.setHandler(handler); + desc.setNameSpaceURI("http://castor.exolab.org/"); + desc.setMultivalued(true); + addFieldDescriptor(desc); + + //-- validation code for: _queryHintList + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(0); + { //-- local scope + } + desc.setValidator(fieldValidator); + } //-- org.exolab.castor.mapping.xml.NamedQueryDescriptor() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode + * + * + * + * @return AccessMode + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } //-- org.exolab.castor.mapping.AccessMode getAccessMode() + + /** + * Method getExtends + * + * + * + * @return ClassDescriptor + */ + public org.exolab.castor.mapping.ClassDescriptor getExtends() + { + return null; + } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() + + /** + * Method getIdentity + * + * + * + * @return FieldDescriptor + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return identity; + } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() + + /** + * Method getJavaClass + * + * + * + * @return Class + */ + public java.lang.Class getJavaClass() + { + return org.exolab.castor.mapping.xml.NamedQuery.class; + } //-- java.lang.Class getJavaClass() + + /** + * Method getNameSpacePrefix + * + * + * + * @return String + */ + public java.lang.String getNameSpacePrefix() + { + return nsPrefix; + } //-- java.lang.String getNameSpacePrefix() + + /** + * Method getNameSpaceURI + * + * + * + * @return String + */ + public java.lang.String getNameSpaceURI() + { + return nsURI; + } //-- java.lang.String getNameSpaceURI() + + /** + * Method getValidator + * + * + * + * @return TypeValidator + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } //-- org.exolab.castor.xml.TypeValidator getValidator() + + /** + * Method getXMLName + * + * + * + * @return String + */ + public java.lang.String getXMLName() + { + return xmlName; + } //-- java.lang.String getXMLName() + + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + +} Index: main/java/org/exolab/castor/mapping/xml/Param.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/Param.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/Param.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,20 +11,13 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class Param. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class Param implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/ParamDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/ParamDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/ParamDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class ParamDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class ParamDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "param"; + elementDefinition = true; org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; org.exolab.castor.mapping.FieldHandler handler = null; org.exolab.castor.xml.FieldValidator fieldValidator = null; @@ -97,7 +94,7 @@ fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -136,7 +133,7 @@ fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -246,4 +243,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/Property.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/Property.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/Property.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,20 +11,13 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.MarshalException; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class Property. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class Property extends PropertyType implements java.io.Serializable Index: main/java/org/exolab/castor/mapping/xml/PropertyDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/PropertyDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/PropertyDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class PropertyDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class PropertyDescriptor extends PropertyTypeDescriptor { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); setExtendsWithoutFlatten(new PropertyTypeDescriptor()); xmlName = "property"; + elementDefinition = true; } //-- org.exolab.castor.mapping.xml.PropertyDescriptor() @@ -163,4 +160,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/PropertyType.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/PropertyType.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/PropertyType.java (working copy) @@ -1,27 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; - /** * Class PropertyType. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public abstract class PropertyType implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/PropertyTypeDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/PropertyTypeDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/PropertyTypeDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class PropertyTypeDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class PropertyTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "propertyType"; + elementDefinition = false; //-- set grouping compositor setCompositorAsSequence(); @@ -102,7 +99,7 @@ fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -141,7 +138,7 @@ fieldValidator = new org.exolab.castor.xml.FieldValidator(); fieldValidator.setMinOccurs(1); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -249,4 +246,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/QueryHint.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/QueryHint.java (revision 0) +++ main/java/org/exolab/castor/mapping/xml/QueryHint.java (revision 0) @@ -0,0 +1,167 @@ +/* + * This class was automatically generated with + * Castor 1.0.1, using an XML + * Schema. + * $Id$ + */ + +package org.exolab.castor.mapping.xml; + + //---------------------------------/ + //- Imported classes and packages -/ +//---------------------------------/ + +import org.exolab.castor.xml.Marshaller; +import org.exolab.castor.xml.Unmarshaller; + +/** + * Class QueryHint. + * + * @version $Revision$ $Date$ + */ +public class QueryHint implements java.io.Serializable { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field _name + */ + private java.lang.String _name; + + /** + * Field _value + */ + private java.lang.String _value; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public QueryHint() + { + super(); + } //-- org.exolab.castor.mapping.xml.QueryHint() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Returns the value of field 'name'. + * + * @return String + * @return the value of field 'name'. + */ + public java.lang.String getName() + { + return this._name; + } //-- java.lang.String getName() + + /** + * Returns the value of field 'value'. + * + * @return String + * @return the value of field 'value'. + */ + public java.lang.String getValue() + { + return this._value; + } //-- java.lang.String getValue() + + /** + * Method isValid + * + * + * + * @return boolean + */ + public boolean isValid() + { + try { + validate(); + } + catch (org.exolab.castor.xml.ValidationException vex) { + return false; + } + return true; + } //-- boolean isValid() + + /** + * Method marshal + * + * + * + * @param out + */ + public void marshal(java.io.Writer out) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, out); + } //-- void marshal(java.io.Writer) + + /** + * Method marshal + * + * + * + * @param handler + */ + public void marshal(org.xml.sax.ContentHandler handler) + throws java.io.IOException, org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + + Marshaller.marshal(this, handler); + } //-- void marshal(org.xml.sax.ContentHandler) + + /** + * Sets the value of field 'name'. + * + * @param name the value of field 'name'. + */ + public void setName(java.lang.String name) + { + this._name = name; + } //-- void setName(java.lang.String) + + /** + * Sets the value of field 'value'. + * + * @param value the value of field 'value'. + */ + public void setValue(java.lang.String value) + { + this._value = value; + } //-- void setValue(java.lang.String) + + /** + * Method unmarshal + * + * + * + * @param reader + * @return QueryHint + */ + public static org.exolab.castor.mapping.xml.QueryHint unmarshal(java.io.Reader reader) + throws org.exolab.castor.xml.MarshalException, org.exolab.castor.xml.ValidationException + { + return (org.exolab.castor.mapping.xml.QueryHint) Unmarshaller.unmarshal(org.exolab.castor.mapping.xml.QueryHint.class, reader); + } //-- org.exolab.castor.mapping.xml.QueryHint unmarshal(java.io.Reader) + + /** + * Method validate + * + */ + public void validate() + throws org.exolab.castor.xml.ValidationException + { + org.exolab.castor.xml.Validator validator = new org.exolab.castor.xml.Validator(); + validator.validate(this); + } //-- void validate() + +} Index: main/java/org/exolab/castor/mapping/xml/QueryHintDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/QueryHintDescriptor.java (revision 0) +++ main/java/org/exolab/castor/mapping/xml/QueryHintDescriptor.java (revision 0) @@ -0,0 +1,258 @@ +/* + * This class was automatically generated with + * Castor 1.0.1, using an XML + * Schema. + * $Id$ + */ + +package org.exolab.castor.mapping.xml; + +/** + * Class QueryHintDescriptor. + * + * @version $Revision$ $Date$ + */ +public class QueryHintDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { + + + //--------------------------/ + //- Class/Member Variables -/ + //--------------------------/ + + /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** + * Field nsPrefix + */ + private java.lang.String nsPrefix; + + /** + * Field nsURI + */ + private java.lang.String nsURI; + + /** + * Field xmlName + */ + private java.lang.String xmlName; + + /** + * Field identity + */ + private org.exolab.castor.xml.XMLFieldDescriptor identity; + + + //----------------/ + //- Constructors -/ + //----------------/ + + public QueryHintDescriptor() + { + super(); + nsURI = "http://castor.exolab.org/"; + xmlName = "query-hint"; + elementDefinition = true; + org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; + org.exolab.castor.mapping.FieldHandler handler = null; + org.exolab.castor.xml.FieldValidator fieldValidator = null; + //-- initialize attribute descriptors + + //-- _name + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_name", "name", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + QueryHint target = (QueryHint) object; + return target.getName(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + QueryHint target = (QueryHint) object; + target.setName( (java.lang.String) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _name + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + typeValidator.setWhiteSpace("preserve"); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- _value + desc = new org.exolab.castor.xml.util.XMLFieldDescriptorImpl(java.lang.String.class, "_value", "value", org.exolab.castor.xml.NodeType.Attribute); + desc.setImmutable(true); + handler = new org.exolab.castor.xml.XMLFieldHandler() { + public java.lang.Object getValue( java.lang.Object object ) + throws IllegalStateException + { + QueryHint target = (QueryHint) object; + return target.getValue(); + } + public void setValue( java.lang.Object object, java.lang.Object value) + throws IllegalStateException, IllegalArgumentException + { + try { + QueryHint target = (QueryHint) object; + target.setValue( (java.lang.String) value); + } + catch (java.lang.Exception ex) { + throw new IllegalStateException(ex.toString()); + } + } + public java.lang.Object newInstance( java.lang.Object parent ) { + return null; + } + }; + desc.setHandler(handler); + desc.setRequired(true); + desc.setMultivalued(false); + addFieldDescriptor(desc); + + //-- validation code for: _value + fieldValidator = new org.exolab.castor.xml.FieldValidator(); + fieldValidator.setMinOccurs(1); + { //-- local scope + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); + typeValidator.setWhiteSpace("preserve"); + fieldValidator.setValidator(typeValidator); + } + desc.setValidator(fieldValidator); + //-- initialize element descriptors + + } //-- org.exolab.castor.mapping.xml.QueryHintDescriptor() + + + //-----------/ + //- Methods -/ + //-----------/ + + /** + * Method getAccessMode + * + * + * + * @return AccessMode + */ + public org.exolab.castor.mapping.AccessMode getAccessMode() + { + return null; + } //-- org.exolab.castor.mapping.AccessMode getAccessMode() + + /** + * Method getExtends + * + * + * + * @return ClassDescriptor + */ + public org.exolab.castor.mapping.ClassDescriptor getExtends() + { + return null; + } //-- org.exolab.castor.mapping.ClassDescriptor getExtends() + + /** + * Method getIdentity + * + * + * + * @return FieldDescriptor + */ + public org.exolab.castor.mapping.FieldDescriptor getIdentity() + { + return identity; + } //-- org.exolab.castor.mapping.FieldDescriptor getIdentity() + + /** + * Method getJavaClass + * + * + * + * @return Class + */ + public java.lang.Class getJavaClass() + { + return org.exolab.castor.mapping.xml.QueryHint.class; + } //-- java.lang.Class getJavaClass() + + /** + * Method getNameSpacePrefix + * + * + * + * @return String + */ + public java.lang.String getNameSpacePrefix() + { + return nsPrefix; + } //-- java.lang.String getNameSpacePrefix() + + /** + * Method getNameSpaceURI + * + * + * + * @return String + */ + public java.lang.String getNameSpaceURI() + { + return nsURI; + } //-- java.lang.String getNameSpaceURI() + + /** + * Method getValidator + * + * + * + * @return TypeValidator + */ + public org.exolab.castor.xml.TypeValidator getValidator() + { + return this; + } //-- org.exolab.castor.xml.TypeValidator getValidator() + + /** + * Method getXMLName + * + * + * + * @return String + */ + public java.lang.String getXMLName() + { + return xmlName; + } //-- java.lang.String getXMLName() + + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + +} Index: main/java/org/exolab/castor/mapping/xml/Sql.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/Sql.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/Sql.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,23 +11,14 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.IOException; -import java.io.Reader; -import java.io.Serializable; -import java.io.Writer; -import java.util.ArrayList; -import java.util.Enumeration; -import org.exolab.castor.mapping.xml.types.SqlDirtyType; -import org.exolab.castor.xml.MarshalException; +import java.util.Collections; import org.exolab.castor.xml.Marshaller; import org.exolab.castor.xml.Unmarshaller; -import org.exolab.castor.xml.ValidationException; -import org.xml.sax.ContentHandler; /** * Class Sql. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class Sql implements java.io.Serializable { @@ -89,8 +80,8 @@ public Sql() { super(); - _name = new ArrayList(); - _manyKey = new ArrayList(); + _name = new java.util.ArrayList(); + _manyKey = new java.util.ArrayList(); setDirty(org.exolab.castor.mapping.xml.types.SqlDirtyType.valueOf("check")); } //-- org.exolab.castor.mapping.xml.Sql() @@ -198,7 +189,7 @@ */ public java.util.Enumeration enumerateManyKey() { - return new org.exolab.castor.util.IteratorEnumeration(_manyKey.iterator()); + return Collections.enumeration(_manyKey); } //-- java.util.Enumeration enumerateManyKey() /** @@ -210,7 +201,7 @@ */ public java.util.Enumeration enumerateName() { - return new org.exolab.castor.util.IteratorEnumeration(_name.iterator()); + return Collections.enumeration(_name); } //-- java.util.Enumeration enumerateName() /** @@ -236,7 +227,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _manyKey.size())) { + if ((index < 0) || (index >= _manyKey.size())) { throw new IndexOutOfBoundsException(); } @@ -295,7 +286,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _name.size())) { + if ((index < 0) || (index >= _name.size())) { throw new IndexOutOfBoundsException(); } @@ -484,7 +475,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _manyKey.size())) { + if ((index < 0) || (index >= _manyKey.size())) { throw new IndexOutOfBoundsException(); } _manyKey.set(index, vManyKey); @@ -528,7 +519,7 @@ throws java.lang.IndexOutOfBoundsException { //-- check bounds for index - if ((index < 0) || (index > _name.size())) { + if ((index < 0) || (index >= _name.size())) { throw new IndexOutOfBoundsException(); } _name.set(index, vName); Index: main/java/org/exolab/castor/mapping/xml/SqlDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/SqlDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/SqlDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class SqlDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class SqlDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "sql"; + elementDefinition = true; org.exolab.castor.xml.util.XMLFieldDescriptorImpl desc = null; org.exolab.castor.mapping.FieldHandler handler = null; org.exolab.castor.xml.FieldValidator fieldValidator = null; @@ -127,7 +124,7 @@ //-- validation code for: _type fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - StringValidator typeValidator = new StringValidator(); + org.exolab.castor.xml.validators.StringValidator typeValidator = new org.exolab.castor.xml.validators.StringValidator(); typeValidator.setWhiteSpace("preserve"); fieldValidator.setValidator(typeValidator); } @@ -163,7 +160,7 @@ //-- validation code for: _manyTable fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - NameValidator typeValidator = new NameValidator(NameValidator.NMTOKEN); + org.exolab.castor.xml.validators.NameValidator typeValidator = new org.exolab.castor.xml.validators.NameValidator(org.exolab.castor.xml.validators.NameValidator.NMTOKEN); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -237,7 +234,7 @@ //-- validation code for: _readOnly fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -279,7 +276,7 @@ //-- validation code for: _transient fieldValidator = new org.exolab.castor.xml.FieldValidator(); { //-- local scope - BooleanValidator typeValidator = new BooleanValidator(); + org.exolab.castor.xml.validators.BooleanValidator typeValidator = new org.exolab.castor.xml.validators.BooleanValidator(); fieldValidator.setValidator(typeValidator); } desc.setValidator(fieldValidator); @@ -423,4 +420,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/types/BindXmlAutoNamingType.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/BindXmlAutoNamingType.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/BindXmlAutoNamingType.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,16 +11,12 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.Serializable; -import java.util.Enumeration; import java.util.Hashtable; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; /** * Class BindXmlAutoNamingType. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class BindXmlAutoNamingType implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/types/BindXmlAutoNamingTypeDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/BindXmlAutoNamingTypeDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/BindXmlAutoNamingTypeDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml.types; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class BindXmlAutoNamingTypeDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class BindXmlAutoNamingTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "BindXmlAutoNamingType"; + elementDefinition = false; } //-- org.exolab.castor.mapping.xml.types.BindXmlAutoNamingTypeDescriptor() @@ -161,4 +158,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/types/BindXmlNodeType.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/BindXmlNodeType.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/BindXmlNodeType.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,16 +11,12 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.Serializable; -import java.util.Enumeration; import java.util.Hashtable; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; /** * Class BindXmlNodeType. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class BindXmlNodeType implements java.io.Serializable { Index: main/java/org/exolab/castor/mapping/xml/types/BindXmlNodeTypeDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/BindXmlNodeTypeDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/BindXmlNodeTypeDescriptor.java (working copy) @@ -1,25 +1,16 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml.types; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class BindXmlNodeTypeDescriptor. * - * @version $Revision$ $Date: 2006-01-07 15:48:31 -0700 (Sat, 07 Jan 2006) $ + * @version $Revision$ $Date$ */ public class BindXmlNodeTypeDescriptor extends org.exolab.castor.xml.util.XMLClassDescriptorImpl { @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "BindXmlNodeType"; + elementDefinition = false; } //-- org.exolab.castor.mapping.xml.types.BindXmlNodeTypeDescriptor() @@ -161,4 +158,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/types/ClassMappingAccessType.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/ClassMappingAccessType.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/ClassMappingAccessType.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,11 +11,7 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.Serializable; -import java.util.Enumeration; import java.util.Hashtable; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; /** * Class ClassMappingAccessType. Index: main/java/org/exolab/castor/mapping/xml/types/ClassMappingAccessTypeDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/ClassMappingAccessTypeDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/ClassMappingAccessTypeDescriptor.java (working copy) @@ -1,21 +1,12 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml.types; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class ClassMappingAccessTypeDescriptor. * @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "ClassMappingAccessType"; + elementDefinition = false; } //-- org.exolab.castor.mapping.xml.types.ClassMappingAccessTypeDescriptor() @@ -161,4 +158,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/types/FieldMappingCollectionType.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/FieldMappingCollectionType.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/FieldMappingCollectionType.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,11 +11,7 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.Serializable; -import java.util.Enumeration; import java.util.Hashtable; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; /** * Class FieldMappingCollectionType. Index: main/java/org/exolab/castor/mapping/xml/types/FieldMappingCollectionTypeDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/FieldMappingCollectionTypeDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/FieldMappingCollectionTypeDescriptor.java (working copy) @@ -1,21 +1,12 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml.types; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class FieldMappingCollectionTypeDescriptor. * @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "FieldMappingCollectionType"; + elementDefinition = false; } //-- org.exolab.castor.mapping.xml.types.FieldMappingCollectionTypeDescriptor() @@ -161,4 +158,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/mapping/xml/types/SqlDirtyType.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/SqlDirtyType.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/SqlDirtyType.java (working copy) @@ -1,6 +1,6 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ @@ -11,11 +11,7 @@ //- Imported classes and packages -/ //---------------------------------/ -import java.io.Serializable; -import java.util.Enumeration; import java.util.Hashtable; -import org.exolab.castor.xml.Marshaller; -import org.exolab.castor.xml.Unmarshaller; /** * Class SqlDirtyType. Index: main/java/org/exolab/castor/mapping/xml/types/SqlDirtyTypeDescriptor.java =================================================================== --- main/java/org/exolab/castor/mapping/xml/types/SqlDirtyTypeDescriptor.java (revision 6064) +++ main/java/org/exolab/castor/mapping/xml/types/SqlDirtyTypeDescriptor.java (working copy) @@ -1,21 +1,12 @@ /* * This class was automatically generated with - * Castor 1.0M1, using an XML + * Castor 1.0.1, using an XML * Schema. * $Id$ */ package org.exolab.castor.mapping.xml.types; - //---------------------------------/ - //- Imported classes and packages -/ -//---------------------------------/ - -import org.exolab.castor.mapping.AccessMode; -import org.exolab.castor.xml.TypeValidator; -import org.exolab.castor.xml.XMLFieldDescriptor; -import org.exolab.castor.xml.validators.*; - /** * Class SqlDirtyTypeDescriptor. * @@ -29,6 +20,11 @@ //--------------------------/ /** + * Field elementDefinition + */ + private boolean elementDefinition; + + /** * Field nsPrefix */ private java.lang.String nsPrefix; @@ -58,6 +54,7 @@ super(); nsURI = "http://castor.exolab.org/"; xmlName = "SqlDirtyType"; + elementDefinition = false; } //-- org.exolab.castor.mapping.xml.types.SqlDirtyTypeDescriptor() @@ -161,4 +158,16 @@ return xmlName; } //-- java.lang.String getXMLName() + /** + * Method isElementDefinition + * + * + * + * @return boolean + */ + public boolean isElementDefinition() + { + return elementDefinition; + } //-- boolean isElementDefinition() + } Index: main/java/org/exolab/castor/persist/ClassMolder.java =================================================================== --- main/java/org/exolab/castor/persist/ClassMolder.java (revision 6064) +++ main/java/org/exolab/castor/persist/ClassMolder.java (working copy) @@ -1451,5 +1451,9 @@ resolversHaveBeenReset = true; } } + + public String getNamedQuery(String name) { + return ((JDOClassDescriptor) _clsDesc).getNamedQuery(name); + } } Index: main/java/org/exolab/castor/persist/LockEngine.java =================================================================== --- main/java/org/exolab/castor/persist/LockEngine.java (revision 6064) +++ main/java/org/exolab/castor/persist/LockEngine.java (working copy) @@ -307,6 +307,19 @@ TypeInfo info = (TypeInfo)_typeInfo.get( cls.getName() ); return (info != null) ? info.molder : null; } + + public ClassMolder getClassMolderByQuery(String name) + { + Iterator typeIterator = _typeInfo.values().iterator(); + while(typeIterator.hasNext()) + { + TypeInfo info = (TypeInfo)typeIterator.next(); + if(info.molder.getNamedQuery(name) != null) { + return info.molder; + } + } + return null; + } public Persistence getPersistence( Class cls ) { ClassMolder molder = getClassMolder( cls ); Index: main/java/org/exolab/castor/persist/PersistenceInfoGroup.java =================================================================== --- main/java/org/exolab/castor/persist/PersistenceInfoGroup.java (revision 6064) +++ main/java/org/exolab/castor/persist/PersistenceInfoGroup.java (working copy) @@ -47,6 +47,8 @@ import org.castor.util.Messages; import org.exolab.castor.jdo.ClassNotPersistenceCapableException; +import org.exolab.castor.jdo.QueryException; + public class PersistenceInfoGroup { @@ -72,6 +74,19 @@ return molder; } + public ClassMolder findClassMolderByQuery(String query) + throws QueryException { + ClassMolder molder = null; + for(int i=0; i < engines.length; i++) { + molder = engines[i].getClassMolderByQuery(query); + } + if(molder == null) + { + throw new QueryException("Can not find the query specified."); + } + return molder; + } + public LockEngine getLockEngine() { if ( engines != null && engines.length >= 1 ) return engines[0]; Index: main/resources/org/exolab/castor/mapping/mapping.dtd =================================================================== --- main/resources/org/exolab/castor/mapping/mapping.dtd (revision 6064) +++ main/resources/org/exolab/castor/mapping/mapping.dtd (working copy) @@ -63,7 +63,7 @@ resulting XML document must preserve the order of elements. --> - + + + + + + + + + Index: main/resources/org/exolab/castor/mapping/mapping.xsd =================================================================== --- main/resources/org/exolab/castor/mapping/mapping.xsd (revision 6064) +++ main/resources/org/exolab/castor/mapping/mapping.xsd (working copy) @@ -39,6 +39,7 @@ + @@ -64,6 +65,23 @@ + + + + + + + + + + + + + + + + +