Re: [mdr-users] continueing . . How to create Associations and AssociationEnd?

Richard Ciglansky <[email protected]>
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <1117060010.3550.5.camel@ares>
On Wed, 2005-05-25 at 19:58, Leena Borle wrote:
> Hi Richard,
>    Do you mean that I should have a design similar to the XML example
> explained in JMI specification document for JAVA? And then create MOF
> using this kind of design.
This is exactly what I mean.
>  Also, could you please tell me which Netbean's module you are referring to?
> 
Check :
http://java.netbeans.org/
it's "java" module supporting handling of Java sources, I assume all
Netbeans Java support uses this module.
It contains parser, Java metamodel and many more features you can find
useful when working with Java sources.
There is also XMI metamodel of Java directly loadable by MDR, that means
you can generate JMI interfaces and javadoc from it :
http://java.netbeans.org/unbranded-source/browse/~checkout~/java/javamodel/src/org/netbeans/jmi/javamodel/resources/java-model.xml?content-type=text/plain

UML version of it (which can be opened in MagicDraw 7 CE and higher) is 
at http://java.netbeans.org/models/java/java.xml.
This is to get better overview about metamodel structure.


Richard

> Thanks,
> Leena
> 
> On 5/24/05, Richard Ciglansky <[email protected]> wrote:
> > 
> > >> To associate an attribute with a mof class, just add the attribute to
> > >> the contents of that class:
> > >>
> > >> mofClass.getContents().add(attribute)
> > >>             This solution is fine if an attribute is of type
> > >> primitive or any
> > >> Java class. But if it is another MofClass(which means user defined
> > >> class or interface), Don't I need to create some kind of
> > >> reference/association between the two classes ?
> > >>
> > >>
> > > I do not understand what you mean. A MOF attribute can be of MOF type
> > > only. Regardless of the attribute type, the attributes are added to a
> > > class the same way I described.
> > 
> > I think that how Leena is using MDR/JMI/MOF is not exactly the way these
> > technologies are intended to be used.
> > When you want to parser Java code and put it "into MDR", the best way
> > would be to write some Java - MOF compliant metamodel ( the same thing
> > like UML just for Java language ) and then create instance of this model
> > modeling particular Java application. It seems that you are importing
> > Java directly into MOF, creating in such a way MOF metamodel rather than
> > MOF model. Please check MOF/UML/JMI specification where this 4-layer
> > modeling architecture is explained ( MOF metameta model, MOF metamodel,
> > MOF model, model instance ). Surely everything depends on point of view,
> > but I would highly suggest to import Java as MOF model and not MOF
> > metamodel.
> > 
> > Good news, actually you don't need to "write Java metamodel" as Netbeans
> > already contains Java metamodel you can use, maybe you can use whole
> > Netbeans module used for manipulating Java sources in "MDR way". Then no
> > parsing, no imports, just manipulation of Java program stored in MDR/MOF
> > form.
> > 
> > Hope this helps
> > 
> > Richard
> > 
> > >>   This also applies for creating and association between current
> > >> class and its super classes which again will be MofClasses. Hw do I
> > >> achieve this?
> > >>
> > >>
> > > mofClass.getSupertypes().add(superClass)
> > >
> > > or (if there is more than one superclass:
> > >
> > > mofClass.getSupertypes().addAll(superClasses)
> > >
> > > Regards,
> > > Martin
> > >
> > >
> > 
> >
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.