Multiple Stereotypes

Discuss the XML Schema cartridge here

Postby thimstedt » Mon 17. Jul 2006, 08:14

Hi, I have the same problem. However, I use maven 1.0.2 but emf. As soon as I have more than one sterotype the complex types will not be generated.
thimstedt
 
Posts: 19
Joined: Thu 22. Jun 2006, 11:58

Postby cedric.jeanneret » Mon 17. Jul 2006, 13:57

Hi all,

I've looked for your problem. It's an issue related to the ";way"; facades are mapped.

I'll try to explain it as clear as possible...

Let's say a UMLClass with XmlSchema and ValueObject is poped out from repository and is entering to the mapping process.

:arrow: Firstly, all namespace (xmlschema - cartridge) specific mappings are scanned.

:arrow: None of them matches, because XMLComplexType need a Classifier and your class is a UMLClass (the name of metaclasses are compared)

:arrow: Metafacades facades are then scanned. The UMLClass metaobject is wrapped to a ValueObject (because: metaclass name and stereotypes match).

However, if you remove ValueObject stereotype, no mapping is found.

The mapping process continue by determining the hierarchy of the metaobject. (here: Classifier -> ...)

:arrow: The process described above restart, with the following element of the hierarchy (with Classifier).

:arrow: XMLComplexType matches, and your class is wrapped to a XMLComplexType facade (and your schema is correctly generated).

This issue is not dependant on how you've lauched andromda (maven, maven 2, ant) neither on the model type (uml 1.4, uml2). It's simply an ";issue"; of the algorithm computing how facade are resolved.

A quick'n dirty fix would be to replace common based mapping of XMLComplexType to:

Code: Select all
<metafacade class=";org.andromda.cartridges.xmlschema.metafacades.XSDComplexTypeLogicImpl";>
    <mapping class=";org.omg.uml.foundation.core.UmlClass$Impl";>
        <stereotype>XML_SCHEMA_TYPE</stereotype>
    </mapping>
</metafacade>
<metafacade class=";org.andromda.cartridges.xmlschema.metafacades.XSDComplexTypeLogicImpl";>
    <mapping class=";org.eclipse.uml2.impl.ClassImpl";>
        <stereotype>XML_SCHEMA_TYPE</stereotype>
    </mapping>
</metafacade>


This causes the mapping to be found at the first step. However, it solves the problem only for XMLSchemaType stereotype, and only for uml 1.4 and emf-uml2 metafacade. And it suppose that you don't put XMLSchemaType on Class only (and not other classifier like interface, enumeration, ...)
Cedric Jeanneret - cedric [at] andromda [dot] org
http://www.andromda.org
cedric.jeanneret
AndroMDA Developer
 
Posts: 161
Joined: Tue 18. Apr 2006, 06:21

Postby thimstedt » Tue 18. Jul 2006, 10:58

Thanks Cedric, this works (at least for classes).
thimstedt
 
Posts: 19
Joined: Thu 22. Jun 2006, 11:58

Postby junmin » Tue 1. Aug 2006, 15:51

I had similiar problem. could someone tell where the <metfacades> tags goes? should they go inside a metfacades.xml? then where is the file?
junmin
 
Posts: 21
Joined: Wed 26. Jul 2006, 19:23

Postby junmin » Tue 1. Aug 2006, 21:55

i got it. is inside the xmlschema catridge jar file in the maven2 repository
junmin
 
Posts: 21
Joined: Wed 26. Jul 2006, 19:23

XML Schema cartridge - more detail requested

Postby sszliske » Sun 27. Aug 2006, 18:54

Thanks for all this great info. It still isn't working for me so I must be doing something incorrectly.

In my case this jar file was located in the folder C:\Documents and Settings\username\.m2\repository\org\andromda\cartridges\andromda-xmlschema-cartridge\3.2-SNAPSHOT

First the file was extracted from the jar using

jar xf andromda-xmlschema-cartridge-3.2-SNAPSHOT.jar META-INF/andromda/metafacades.xml

Then I changed the file as below and saved it.

-------------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1" ?>

<metafacades>
<metafacade class="org.andromda.cartridges.xmlschema.metafacades.XSDEnumerationTypeLogicImpl">
<mapping>
<stereotype>XML_SCHEMA_TYPE</stereotype>
<stereotype>ENUMERATION</stereotype>
</mapping>
</metafacade>
<!--
<metafacade class="org.andromda.cartridges.xmlschema.metafacades.XSDComplexTypeLogicImpl">
<mapping>
<stereotype>XML_SCHEMA_TYPE</stereotype>
</mapping>
</metafacade>
-->

<metafacade class=";org.andromda.cartridges.xmlschema.metafacades.XSDComplexTypeLogicImpl";>
<mapping class=";org.omg.uml.foundation.core.UmlClass$Impl";>
<stereotype>XML_SCHEMA_TYPE</stereotype>
</mapping>
</metafacade>
<metafacade class=";org.andromda.cartridges.xmlschema.metafacades.XSDComplexTypeLogicImpl";>
<mapping class=";org.eclipse.uml2.impl.ClassImpl";>
<stereotype>XML_SCHEMA_TYPE</stereotype>
</mapping>
</metafacade>

<metafacade class="org.andromda.cartridges.xmlschema.metafacades.XSDAttributeLogicImpl">
<mapping>
<property name="ownerSchemaType"/>
</mapping>
</metafacade>
<metafacade class="org.andromda.cartridges.xmlschema.metafacades.XSDAssociationEndLogicImpl">
<mapping>
<property name="ownerSchemaType"/>
</mapping>
</metafacade>
</metafacades>
-------------------------------------------------------------------

An empty schema is still being generated.

How can I get the settings to take effect? I tried adding the updated file back into the jar, but the jar seemed to be overwritten back to the original.

It could be that my problem lies elsewhere, but I wanted to make sure that I was doing this fix correctly. All of my classes have Entity and XmlShemaType stereotypes

I apologize for asking such a simple question, but I am stuck and I have a deadline coming up tommorow.

Thanks in advance
Settimo Szliske
sszliske
 
Posts: 4
Joined: Sat 8. Jul 2006, 20:05
Location: Vancouver, BC

XML Schema cartridge - OK now

Postby sszliske » Mon 28. Aug 2006, 04:14

I found my mistake

First I found an error with how I was updating the jar file.

Then I removed the semicolons so it would parse correctly for me and updated the jar file with the changes and all is well.
----------------------------------------------------------------
<metafacade class="org.andromda.cartridges.xmlschema.metafacades.XSDComplexTypeLogicImpl">
<mapping class="org.omg.uml.foundation.core.UmlClass$Impl">
<stereotype>XML_SCHEMA_TYPE</stereotype>
</mapping>
</metafacade>
<metafacade class="org.andromda.cartridges.xmlschema.metafacades.XSDComplexTypeLogicImpl">
<mapping class="org.eclipse.uml2.impl.ClassImpl">
<stereotype>XML_SCHEMA_TYPE</stereotype>
</mapping>
</metafacade>
----------------------------------------------------------------

Next I ran the command as "mvn -o" so it wouldn't overwrite the updated jar file.

Thanks again for all the great info
Settimo Szliske
sszliske
 
Posts: 4
Joined: Sat 8. Jul 2006, 20:05
Location: Vancouver, BC


Return to XML Schema cartridge

Who is online

Users browsing this forum: No registered users and 0 guests