Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cme-dev] Question about how to add new classifiers and relationships

Hi Len,

Adding new relationship names is easy. You create a new relaitonship class
as a subclass of the appropriate kind of relationship, and have its
getSimpleName() method return the desired name. then you have your loader
create such relationships. If this name is "connects", queries like
"relationship connects(connector *, aspect *)" should then work
automatically. For an example, take a look at the project artifacts.ant,
which provides support for Ant artifacts. It creates the new "dependsOn"
relationship with the class DirectedRelationshipForDependsOn.

Classifiers are a bit more complex. Firstly, there is an important
distinction between "modifiers" and "classifiers". You may already
understand this, but I'll state it to make the rest of this easeir to
explain. A "modifier" is a token (like "public" or "synchronized" that is
associted with a unit. Modifiers exist in different domains (e.g., Java or
Ant), allowing the same tokens to have different meanings in different
languages. You will need (may already have) a JAsCo domain for modifiers.

A "classifier" is a token in a classification hierarchy maintained by the
CME. There is an initial default hierarchy, defined in
org.eclipse.cme.framework.SimpleClassifier in the cme project, and it can
be extended. Unlike modifiers, classifiers are not directly associated with
software units. However modifiers can be specified as associated with
classifiers (they are what is called "Classifiable"), thereby specifying
the classification for the units having those modifiers. The names of
modifiers and classifiers can be the same.

So, to introduce "connector" as a new classifier, you need to do something
like this:
      public static final SimpleClassifier CONNECTOR =
Classifier.getClassifier("connector");
      CONNECTOR.classifyAs(ENTITY);
The second statement places yur new classifer in the classification
hierarchy, specifying a parent. You can call this multiple times with
different parents - the hierarchy is a DAG. ENTITY is the top of the
hierarchy; take a look at the existing hierarchy to find the most
appropriate parent.

As noted above, you also need a modifier, which I'll call
"connectorModifier" for clarity, but you could jusf call it "connector". To
set up a JAsCO modifiers domain, you create a "null" modifiers object as
follows:
      ... nullModifiers =
ComparableSingletonModifiers.nullModifiersInNewModifierFamily("JAsCO",
null, null, null);
(Or you can make use of the last 3 parameters - see the Javadoc).
To cause these objects to be classifies as connectors in the classification
hierarchy:

CONNECTOR.includesClassiable(nullModifiers.findModifier("connectorModifier"));
Then, whenever you have a connector object, you give it the following
modifier:
      nullModifiers.findModifier("connectorModifier");
(this will find exactly the same Modifiers object as the other calls to
findModifier("connectorModifier"). On the other hand, if you use it often,
you could store the result in a variable and use that).

The query parser, unfortunately, currently needs to be modified by hand to
accommodate new classifiers in the query language. Whereas relationship
names are just treated as identifiers, the classifiers and modifiers had to
be treated as tokens. We are planning to fix this when we move to a more
powerful parser generator. For now, look at PantherParser.jj, and search
for "project", which is an example classifier, and it should be fairly
clear what you need to do to add new classifiers. This is source for the
publicly-available JavaCC parser generator, We are using version 3.2. Once
the parser is extended, the rest should just work based on the setup above.

Thanks for finding and mentioning the bugs. We certainly don't expect you
to fix them (though you are very welcome to if you have time one day)! But
I would be grateful if you would enter them into bugzilla
(https://bugs.eclipse.org/bugs/), with just a bit more detail (e.g., the
specific query that doesn't work, and an example of what you expected it to
find). That way you will also get notification when they are fixed.

Please let us know if you have trouble with any of the above.

Regards, Harold



                                                                           
             Len Feremans                                                  
             <lfereman@xxxxxx.                                             
             be>                                                        To 
             Sent by:                  cme-dev@xxxxxxxxxxx                 
             cme-dev-admin@ecl                                          cc 
             ipse.org                                                      
                                                                   Subject 
                                       [cme-dev] Question about how to add 
             12/06/2004 06:17          new classifiers and relationships   
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
                  cme-dev                                                  
                                                                           
                                                                           




Hi,

How can I add new classifiers and relationships names to the concern model
and enable puma to use them in queries?
I have finished a loader for an aop language called JAsCo.The language is
very similar to aspectJ but has a concepts that don't exist in aspectJ. One
of them is the "connector" concept. I would like puma to be aware of that
concept, so users can do queries like "connector *" and "relationship
connects(connector *, aspect *)".
A connector in JAsCo seperates part of the pointcut expression from the
aspect definition. So users can make for example a Logger aspect and
connectors which define where the aspect advice should be executed.
I hope somebody has a solution to add new relationship names and types to
puma.

If you're interested im my loader visit
http://ssel.vub.ac.be/wiki/thesis0405:aop2a . If you have any comments on
the loader don't hesitate to contact me.

greetings,
Len Feremans

P.S.:
I found some bugs in the CME. Sorry but I have no time to fix them.
*I think there's a bug in the Ant loader and that somethimes elements with
a display-name that is null are created in the Unloaded space, which causes
the GUI to display nothing after the Unloaded space was viewed.
*Queries don't work for methods returning primitive return types.

_______________________________________________
cme-dev mailing list
cme-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/cme-dev




Back to the top