Re: CompositionViolationException
"Fu,Bin" <[email protected]> Mon, 29 Mar 2004 17:02:49 +0100
| Newsgroups | gmane.comp.java.netbeans.modules.mdr.devel |
|---|---|
| Message-ID | <006001c415a7$48831b50$ae0aa8c0@Bin> |
Hi, all redefined properties, the properties with a set model attribute "redefinedProperty", are ignored when I convert UML 2.0 from MOF 2.0 to MOF 1.4, because I think one property or association end only need be defined once in one inheritance structure. For a more detailed description of my problem: org.omg.uml.classes.kernel.Property p1 = getUmlPackage().getClasses().getKernel().getProperty().createProperty(); org.omg.uml.classes.kernel.Property p2 = getUmlPackage().getClasses().getKernel().getProperty().createProperty(); org.omg.uml.auxiliaryconstructs.models.Model model = ......createModel(); p1.setNamespace(model); p2.setNamespace(model); // The exception occurs here "mode" is instance of "org.omg.infrastructurelibrary.core.abstractions.namespaces.Namespace". "p1" and "p2" are instance of "org.omg.infrastructurelibrary.core.abstractions.namespaces.NamedElement". In the metamodel, NamedElement is defined as part of Namespace (relation of composition). I think, only when Namespace were part of NamedElement (composition), this problem of CompositionViolationException would occur. Do you have any further tips about this problem? Thanks & regards Bin Fu ----- Original Message ----- From: "Stefan Ocke" <[email protected]> To: <[email protected]> Sent: Monday, March 29, 2004 2:49 PM Subject: Re: [mdr-dev] CompositionViolationException > Hi, > > it looks like you are experimenting with the UML 2.0 metamodel... How are you > trying to handle the association redefinitions (this is not supported by MOF1.4) > ? The composition you are talking about redefines the composition in the package > Ownership... Without proper support for association redefinition you probably > run into this error... > > Best Regards, > Stefan. > > > > Hi, > > > > when I tried to setNamespace() for the second model element, following > > execption messages always come to me: > > > > javax.jmi.reflect.CompositionViolationException > > at > > org.netbeans.mdr.storagemodel.StorableObject.setComposite(StorableObject.java:251) > > at > > org.netbeans.mdr.storagemodel.StorableObject.setComposite(StorableObject.java:233) > > at > > org.netbeans.mdr.storagemodel.AssocEndIndexSet.add(AssocEndIndexSet.java:148) > > at > > > org.netbeans.mdr.storagemodel.StorableAssociation.addLink(StorableAssociation.java:371) > > at > > > org.netbeans.mdr.handlers.AssociationHandler._handleLocalAdd(AssociationHandler.java:155) > > at > > > org.netbeans.mdr.handlers.AssociationHandler._handleAdd(AssociationHandler.java:144) > > at > > > org.omg.library.infrastructurelibrary.core.abstractions.namespaces.AOwnedMemberNamespace$Impl.add(Unknown > > Source) > > at > > > org.omg.library.infrastructurelibrary.core.abstractions.namespaces.AOwnedMemberNamespace$Impl._add(Unknown > > Source) > > at > > org.netbeans.mdr.handlers.InstanceHandler._handleSetR(InstanceHandler.java:166) > > at > > org.omg.library.uml2.classes.kernel.Class1$Impl.setNamespace(Unknown > > Source) > > > > I know "CompositionViolationException" indicates that an instance object is > > going to become owned by more than one element (in sense of aggregation > > semantics). But I cannot find the exact problem when I examine my metamodel. > > > > > > Regards > > > > Fu, Bin > > > > > > > > > > > > > > > >