Chad Brandon wrote:

Matthias Bohlen wrote:

Hallo Chad,

Thursday, October 13, 2005, 5:47:11 PM, you wrote:

CB> Yeah you're right, sorry, I guess I misunderstood. I guess I'm not
CB> sure how exactly why/how you'll be accessing them in the ATL
CB> script? Can you give me an example of how you'd call them using
CB> ATL once you have them available?

In the configuration metamodel, I am going to model a metaclass
"Mapping" with two attributes "from" and "to". Then, I can model a
1:n relationship from Configuration to Mapping, called
"languageMappings".

Then, after populating the configuration model at runtime with the
mappings from AndroMDA, I can write an ATL helper like this:

helper def: targetPlatformTypeName(sourcePlatformTypeName: String)
   : String =
     Config!Configuration.allInstances()->first().languageMappings
       ->select(m | m.from = sourcePlatformTypeName)->first().to;

(Weird, this mixture of "." and "->").
Cool thanks for the explantation.

CB> The reason I ask is because currently there is no way to retrieve
CB> all mappings at one time, the way they usually work is someone
CB> specifies the logical or physical path for a mappings file as a
CB> namespace property and then from within a metafacade we look up
CB> that mapping from the namespace, so I'm trying to understand
CB> you're requirements, do you need something that returns all
CB> mappings that have been loaded by AndroMDA?

Yes, I think this would be necessary because until AndroMDA reaches
that ATL script, no metafacades will have been involved, yet.
Metafacades will be invoked on the PSM, later, when it already has
been run through various model transformations.

What do you think would be the best way? Load all mappings eagerly at
the beginning? Or one by one incrementally, at cartridge
initialization time?
Probably eagerly, I'll look at implementing a method that does this for you.

Ok I thought about it and it isn't possible at the moment: Currently there is no way to tell which namespace properties are of what type until we actually use the namespace property to retrieve the property value, namespace properties store a property without defining its type, for example:

   protected TypeMappings handleGetLanguageMappings()
   {
final String propertyName = UMLMetafacadeProperties.LANGUAGE_MAPPINGS_URI;
       Object property = this.getConfiguredProperty(propertyName);
       TypeMappings mappings = null;
       String uri = null;
       if (property instanceof String)
       {
           uri = (String)property;
           try
           {
               mappings = TypeMappings.getInstance(uri);
               mappings.setArraySuffix(this.getArraySuffix());
               this.setProperty(
                   propertyName,
                   mappings);
           }
           catch (Throwable throwable)
           {
final String message = "Error getting '" + propertyName + "' --> '" + uri + "'";
               logger.error(
                   message,
                   throwable);

               // don't throw the exception
           }
       }
       else
       {
           mappings = (TypeMappings)property;
       }
       return mappings;
   }

As you can see from the example above that we actually construct the TypeMappings instance from the given namespace property URI value and that this doesn't happen until we actually call getLanguageMappings for the first time (i.e. lazily), because first its a string Do you have any ideas about a clean way we might go about indicating a namespace property is a mapping so that they can be loaded before we construct any metafacades? (I don't really like the idea of introducing a new property type in the andromda configuration).


Cheers...
Matthias








-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl





-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

Reply via email to