The DescriptionElement interface has two roles - it acts as a
container for the data in the <description> element and it acts as a
factory for objects representing child elements of <description>.

In the factory role it has createXxxx and addXxxx methods. It is
possible to call createXxxx on one instance of DescriptionElement and
call the associated addXxxx method on a difference instance of
DescriptionElement. I don't think this is necessary so I would like to
contract this into a 'createAndAdd' method - ok I need a better name.

Why bother? Well I want to avoid this scenario:

     DescriptionElement desc = new DescriptionImpl();
     desc.setTargetNamespace(namespace1);

     // Create an interface element, name it and add to the description element
     InterfaceElement interfac = desc.createInterfaceElement();
     interfac.setName(name1);
     desc.addInterfaceElement(interfac);

     // Create another interface element, name it and add to the
description element
     InterfaceElement interfac2 = desc.createInterfaceElement();
     interfac2.setName(name2);

     // Make interfac extend interfac2
     // ***
     interfac.addExtendedInterfaceName(interfac2.getName());

Because interfac2 hasn't been added to a DescriptionElement at the
point at which interfac2.getName() is called the targetNamespace of
interfac2 is undefined see [1]. It is therefore not possible to supply
interfac with an interface to extend - because the tns of interfac2 is
undefined.

If at *** this line of code is added:

     desc.addInterfaceElement(interfac2);

then both interfac and interfac2 will be members of the
DescriptionElement and they will both have a tns defined.

To avoid unnecessary pitfalls for the Woden client programmer I
propose merging the addXxxx and createXxxx methods. After all why
would you create an Xxxx from one DescriptionElement and add it to
another instance!?

[1] http://issues.apache.org/jira/browse/WODEN-25

Cheers,
Jeremy

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to