Hi Nick,

for the JDOConfFactory I think we can add 2 new createMapping() methods like:

- JDOConfFactory.createMapping(Class clazz)
  Creates a mapping for given class using its annotaions. If class
  doesn't contain annotiations it's silently ignored.

- JDOConfFactory.createMapping(String path)
  Searches given path for class files and creates mappings for them
  using above createMapping(Class clazz) method.

At the jdo-conf.xml we can extend the syntax of the mapping tag like:

- <mapping path="package"/>
  This will cause castor to search given path similar to the above
  createMapping(String path) method.

I guess similar possibilities can be found on the XML side of castor.

Ralf


Nick Stuart schrieb:
Ok, so looking through Castor to see what can be done about completely
skipping the XML file altogether when possible with the use of
annotations and have a few questions and looking for suggestions.

First, any thoughts on how to tell Castor what classes to look for
annotations in? This should be available to search whole packages, or
be told what classes specifically to look at. Not sure where to do
this, I'm thinking about the possibility of using HiveMind to be able
to configure things like this, but am open to ideas. Doing this
through HiveMind you would have to add a contribution through a
hivemind.xml. Yes, its writing XML to not write XML, but you only have
to do it once and everything will stay in sync.

Second, just looking at the following from the site,
// create driver configuration
  org.exolab.castor.jdo.conf.Driver driverConf =
      JDOConfFactory.createDriver(DRIVER, CONNECT, USERNAME, PASSWORD);
// create mapping configuration
  org.exolab.castor.jdo.conf.Mapping mappingConf =
      JDOConfFactory.createMapping(getClass().getResource(MAPPING).toString());

  // create database configuration
  org.exolab.castor.jdo.conf.Database dbConf =
      JDOConfFactory.createDatabase(DATABASE, ENGINE, driverConf, mappingConf);
// create and load jdo configuration
  JDOManager.loadConfiguration(JDOConfFactory.createJdoConf(dbConf));
// Construct a new JDOManager for the database
  jdoManager = JDOManager.createInstance(DATABASE);
// Obtain a new database
  Database db = jdoManager.getDatabase();
I think it would be pretty easy to replace the .createMapping() call
to use my own that will create the mapping from the annotations. I
already have this set up to marshal using my own generated classes,
but should be simple enough to change the classes around to use the
jdo.conf classes.  Any thoughts here? Any reason this wouldn't work?

XML Folks, I know I'm ignoring you for now, but chime in on any
features that would help out. As I've said before, I'm not a heavy
user of XML so my knowledge of what things to make easier is sorely
lacking.

-Nick

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

--

Syscon Ingenieurbüro für
Meß- und Datentechnik GmbH
Ralf Joachim
Raiffeisenstraße 11
D-72127 Kusterdingen
Germany

Tel.   +49 7071 3690 52
Mobil: +49 173 9630135
Fax    +49 7071 3690 98

Email: [EMAIL PROTECTED]
Web:   www.syscon-world.de

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to