[jdom-interest] integration by derivation with JDOM classes

Matthew MacKenzie matt at xmlglobal.com
Mon Oct 29 07:47:52 PST 2001


Franck,

The JDOM classes will work fine for what you are talking about, but
there is another option for you.  What I have done in a couple products
is to use JDOM for marshalling and unmarshalling; basically modelling
out the classes for the application as I would like to see them, and and
applying JDOM after the fact.  For example, I did something recently
that looked a bit like this:

interface Message {
	public Element toXml();
	public void load(Element el);
}

class Person implements Message {
	public Person() {}
	...
	public Element toXml() {
		Element e = new Element("Person");
		e.addContent(getAddress().toXml());
		...
	}

	public void load(Element e) {
		...
		Address a = new Address();
		setAddress(a.load(e.getChild("Address")));
	}
}

A more flexible model is the "Builder/Outputter" model that JDOM uses.
This would allow you to use something other than JDOM in the future if
you needed to, say, load business processes from something that is
non-XML.  I've gone that way successfully as well.

Regards,

Matt

 

-----Original Message-----
From: jdom-interest-admin at jdom.org [mailto:jdom-interest-admin at jdom.org]
On Behalf Of Franck Delahaye
Sent: October 29, 2001 7:38 AM
To: jdom-interest at jdom.org
Subject: [jdom-interest] integration by derivation with JDOM classes


Hy everybody,
I'am new to this list and so to JDOM too.
we are currently prototyping a Business Process modeler.
It is implemented using Java/JDOM.
 After the first protoyping phase (quiet fast with JDOM), we came to
the conclusion that the best base architecture for the  modeler is to
derive our Business Process classes from the JDOM standard  classes (
particularly the Element and Attributes classes), like this:
  a Business Process --> is a --> Document with a "process" root Element
  a Business Process Graph --> is a --> "graph" Element child of a
"process"  Element
  ...

 The idea is then to implement Business Process modeling specific
methods and  checks in the derived classes, and leave the door open to a
direct JDOM  manipulation for other kind of application such as online
documentation generation, ...

 What I fear is that JDOM classes may not be designed for such an
"integration by  derivation" approch, and that this solution may be
risky...

 any opinion ?

 Franck
 email: franck.delahaye at akazi.com



_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@you
rhost.com




More information about the jdom-interest mailing list