You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tuscany.apache.org by "Millies, Sebastian" <Se...@ids-scheer.com> on 2010/10/05 13:54:19 UTC
Extending generated SDO implementation classes
Hello there,
I have three questions about this topic, one regarding the up-to-dateness of
the SDO FAQ, one regarding the XSD2JavaGenerator, and one regarding the use
of factories for extensions to generated classes.
The SDO FAQ still states:
"2) I cannot (yet) simply subclass a generated SDO class, this may be addressed in TUSCANY-513"
while TUSCANY-513 has been resolved in 2007 for Java-SDO-1.0, and Tuscany 1.6 presumably includes
Java-SDO-1.1.
In the generated code, extensibility behaviour is the default, as the base class for generated
SDOs, DataObjectBase, extends ExtensibleDataObjectImpl. However, the generator option
"-noExtensibility" which is mentioned in TUSCANY-513 is not accepted by the generator.
So here are the first two questions:
a) How can I (or someone else) update the FAQ
b) has the generator ever been updated with that option?
Among the generated classes, there is a factory class with a create method, e. g.:
public DataObject create(int typeNumber)
{
switch (typeNumber)
{
case TYPE1: return (DataObject)createType1();
case TYPE2: return (DataObject)createType2(); // (*)
default:
return super.create(typeNumber);
}
}
Here is the third question:
Now, when I extend the generated implementation class of type 2, and want to use that
subclass everywhere instead of the generated class, can I simply edit the factory? e. g.
replace line (*) with
case TYPE2: return createSubclassOfType2();
where createSubclassOfType2() is not a generated method but defined by me?
-- Sebastian
Re: Extending generated SDO implementation classes
Posted by Simon Laws <si...@googlemail.com>.
On Tue, Oct 5, 2010 at 12:54 PM, Millies, Sebastian
<Se...@ids-scheer.com> wrote:
> Hello there,
>
> I have three questions about this topic, one regarding the up-to-dateness of
> the SDO FAQ, one regarding the XSD2JavaGenerator, and one regarding the use
> of factories for extensions to generated classes.
>
> The SDO FAQ still states:
>
> "2) I cannot (yet) simply subclass a generated SDO class, this may be addressed in TUSCANY-513"
>
> while TUSCANY-513 has been resolved in 2007 for Java-SDO-1.0, and Tuscany 1.6 presumably includes
> Java-SDO-1.1.
>
> In the generated code, extensibility behaviour is the default, as the base class for generated
> SDOs, DataObjectBase, extends ExtensibleDataObjectImpl. However, the generator option
> "-noExtensibility" which is mentioned in TUSCANY-513 is not accepted by the generator.
>
> So here are the first two questions:
> a) How can I (or someone else) update the FAQ
> b) has the generator ever been updated with that option?
>
> Among the generated classes, there is a factory class with a create method, e. g.:
> public DataObject create(int typeNumber)
> {
> switch (typeNumber)
> {
> case TYPE1: return (DataObject)createType1();
> case TYPE2: return (DataObject)createType2(); // (*)
> default:
> return super.create(typeNumber);
> }
> }
>
> Here is the third question:
> Now, when I extend the generated implementation class of type 2, and want to use that
> subclass everywhere instead of the generated class, can I simply edit the factory? e. g.
> replace line (*) with
> case TYPE2: return createSubclassOfType2();
> where createSubclassOfType2() is not a generated method but defined by me?
>
> -- Sebastian
>
>
>
>
>
Hi Sebastien
Physical FAQ updates/corrections are easy. Just raise a JIRA with what
you want changed and any committer can fix the wiki that generates the
web page. I am though not an expert on the SDO code itself so I'm
hoping one of the SDO people will pitch in.
Regards
Simon
--
Apache Tuscany committer: tuscany.apache.org
Co-author of a book about Tuscany and SCA: tuscanyinaction.com