------------------------------------------------------- Correspondce with Harold Ossher [ossher@us.ibm.com] ------------------------------------------------------- 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 To Sent by: cme-dev@eclipse.org 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@eclipse.org http://dev.eclipse.org/mailman/listinfo/cme-dev ------------------------------------------------------- Correspondce with stan sutton ------------------------------------------------------- Len, That's right. I'd forgotten about that. Classifiers for Units are taken from the associated Artifacts. We've actually had some discussion recently about this and will probably allow Units to also have their own classifiers directly. But I'm glad you figured that out! I hope it wasn't too much trouble. Regards, Stan "Len Feremans" 11/15/2004 09:56 AM To: Stan Sutton/Watson/IBM@IBMUS cc: Subject: RE: artifact loader question Hi, I found out what the problem with the classifier. It has to be added to the unit's associated artifact and not the unit itself. ... and the unit finally pops up in puma! ----------------------- example: public class PackageArtifact extends JascoArtifact { public Modifiers getModifiers() { Modifiers m = super.getModifiers(); m = m.add(SimpleClassifier.PACKAGE.getName()); return m; } } ----------------------- -----Oorspronkelijk bericht----- Van: Stan Sutton [mailto:suttons@us.ibm.com] Verzonden: vrijdag 12 november 2004 22:50 Aan: Len Feremans Onderwerp: RE: artifact loader question Len, I look forward to having some time to look at this more closely. (Right now happens to be a very busy time of year at IBM for reasons relating to proposals, evaluations, and other things like that.) As soon as I get a chance (hopefully next week) I'll try making use of the classifier mechanism with my new loaders and see what results I get. I'll let you know what happens. Good luck in the meantime, Stan "Len Feremans" 11/12/2004 04:21 PM To: Stan Sutton/Watson/IBM@IBMUS cc: Subject: RE: artifact loader question Hi Stan, You're answer about the relational database was satisfying and this anwer also :-) I tried adding the classifier, but it didn't work... Next week I'll have another go, inspecting some of the aspectJ loader source seems a very promissing idea. The deadline for the jasco loader is on the first of january and I think it will work just fine. Here's a link to the source (very beta): http://wilma.vub.ac.be/~lfereman/len/artifacts.jasco.zip. Jasco plugin and source (developed at the department I'm working at) can be downloaded from http://ssel.vub.ac.be/jasco/update and http://ssel.vub.ac.be/jasco/. Jasco is like aspectJ, except that the pointcut is defined outside of the aspect definition. (It does much more than that, but that information is on the website) A little Jasco Example (should you be interrested): ------------------------------logger.asp package aspect; class Logger{ hook SimpleLog{ SimpleLog(method(..args)){ execute(method); } before(){ System.out.println(calledmethod.getName()); } } } -----------------------logmath.con static connector{ Logger.SimpleLog hook = Logger.SimpleLog(void java.lang.Math.*(*)); hook.before(); } At the moment a jasco aspect is almost completly loaded. Now I still have to implement the connector loader. Another student is working at extraction and composition. I bases my loader on the ant loader, because CIT seems a bit to difficult to grasp at the moment. -----Oorspronkelijk bericht----- Van: Stan Sutton [mailto:suttons@us.ibm.com] Verzonden: vrijdag 12 november 2004 17:05 Aan: Len Feremans CC: Stan Sutton Onderwerp: Re: artifact loader question Hi Len, I remember you from your previous question about why we don't use a relational database to store the ConMan model. (Not sure whether my answer was satisfying, but there's not much more to say about it.) I can't yet give you detailed instructions for addressing this problem, but I wanted to assure you quickly that there is a simple solution. Basically, Puma (the query engine) is able to recognize different kinds of entities in a concern model based on "classifier" attributes with which the entities are tagged. The basic ConMan element types (e.g., Entity, Item, Concern, Unit, Relationship, and others) come with corresponding classifier attributes predefined. If you define a type of concern model element that extends one of the basic ConMan types, then the classifiers for that type are automatically associated to your type. That is why you can see your relationships and the Ant relationships, because the "relationship" classifier is supplied automatically. When Matt Chapman built the Ant loader, he didn't add any particular classifier attributes to his Ant elements, so queries like "type *" won't return any Ant types. "type" is a classifier, but it doesn't apply to any ConMan elements by default. It is an extension that has to be added specifically to concern model elements that are intended to represent types in languages like Java, AspectJ, UML, etc. However, if you try a query like "entity compile" or "entity task", you should get some Ant elements back (because they all extend the ConMan element-type Entity). This should work for your elements, too, assuming you defined yours by extension to the ConMan element types. Usually classifier attributes are added to a concern model element when it is created, although it can be done by a loader (or any tool that operates on the model) at any time. Here is an example from a constructor for one of the AspectJ element types: package org.eclipse.cme.conman.loaders.aj; ... import org.eclipse.cme.framework.SimpleClassifier; // @author AndyClement public class PointcutDeclarationUnitWithoutLoaders extends CompoundUnitImpl implements PointcutDeclaration { public PointcutDeclarationUnitWithoutLoaders(String name) { super(name); setModifiers(getModifiers().add(SimpleClassifier.POINTCUT.getName())); } ... This is found in the 'conman.loader.shrike' project. The package containing SimpleClassifier is part of the 'cme' project. So, what you have to do, basically, is assign the appropriate classifier attributes to your model entities, and you can use the existing set of classifiers or extend that with your own. Then you should be able to query for elements with those classifications. I have to be honest here and say that I have not actually done this myself yet :-), but I am about to, and I'll be happy to share my experience with you, such as it may be. I don't think we have a good user guide for this yet, but we should make it a priority to produce one. I hope this helps. Let me know if you have any more questions, and also just how your work on this goes. I'll be very interested to see it. Regards and good luck! Stan Len Feremans 11/12/2004 09:11 AM To: Stan Sutton/Watson/IBM@IBMUS cc: Subject: artifact loader question hi, I'm a last-year computer science student programming an artifact loader for a variant of aspectJ called JAsCo (http://ssel.vub.ac.be/jasco). I was wondering how I could make my aspects/advices and other ConcernElements visible in puma. Currently only my relations pop-up in puma, but when I search for any kind of type/artifact nothing is visible in the list of results. Ant has the same problem, only relations are visible and thus I have no example to copy-paste from. Any ideas? P.S.: For a screenshot of the cme with my loader in action check https://ssel.vub.ac.be/wiki/thesis0405:aop2a. With friendly greetings, Len Feremans