I forget something ;-)
> The cleanest solution would be: > > 1. Add a new property in andromda-cartridge.xml, something like:
And this is a very clean concept, since andromda-cartridge.xml is actually our "cartridge deployment descriptor" and we can change this in the runtime if we want/need to. -- --------------------------------------------------- Blasius Lofi Dewanto --------------------------------------------------- OpenUSS - Open University Support System http://openuss.sourceforge.net --------------------------------------------------- E-Mail : [EMAIL PROTECTED] ICQ : 39343280 ---------------------------------------------------
Lofi Dewanto schrieb:
> Hi Chad,
>
> thanks for your reply.
>
> <chad>
> Oh I agree...I think we need to come up with a way to
> easily configure stereotypes and tagged values.
> Ideas?
> </chad>
>
> 1. The easiest thing is to use one centralized property file
> like "UMLProfile.property".
>
> 2. The UMLProfile.java should read all its constants from
> this property file, so that you can change the string values easier,
> without recompiling Metafacade cartridge.
>
> UMLProfile.java
> ---------------
> Instead of:
> public static final String STEREOTYPE_ENTITY = "Entity";
>
> you can use:
> public static final String STEREOTYPE_ENTITY =
> ResourceBundle.getString("Entity");
>
> or so.
>
> And you have:
>
> UMLProfile.property
> -------------------
> Entity=Entity
>
>
> IMO, this only has to be done at the Metafacade cartridge,
> because this should be the foundation of all other cartridges.
>
> It doesn't mattter to other cartridges, since they depend on
> the developers of those cartridges.
>
>
> The !best! if we can centralized the constants (stereotypes,
> taggedvalues, constants, etc.) in one place, which we can
> refer from the:
> 1. Implementation Code in Java (from Metafacade),
> 2. andromda-metafacades.xml,
> 3. andromda-cartridge.xml,
> 4. Templates files,
>
> The cleanest solution would be:
>
> 1. Add a new property in andromda-cartridge.xml, something like:
>
> <constants>
> <name="STEREOTYPE_EXCEPTION" value="Exception">
> <name="STEREOTYPE_SERVICE" value="Service">
> <name="STEREOTYPE_ENTITY" value="Entity">
> <name="STEREOTYPE_FINDER_METHOD" value="FinderMethod">
> <name="TAGGEDVALUE_PERSISTENCE_COLUMN" value=""@persistence.column">
> ...
> </constants>
>
> 2. To access this values from our Java impl., we need a utility class,
> something like:
>
> String service = CartridgeUtil.getString("STEREOTYPE_SERVICE");
>
> 3. To access this values from our Templates:
>
> #set ($service = cartridgeUtil.getString("STEREOTYPE_SERVICE"))
>
> Before, we need to add this "CartidgeUtil" into our andromda-cartridge
> something like:
>
> <templateObject name="cartridgeUtil"
> className="org.andromda.core.common.CartridgeUtil"/>
>
> 4. In andromda-cartridge.xml and andromda-metafacades.xml
> we need to use the constant name and not the real name,
> something like:
>
> <!-- Stereotype: entity -->
> <template
> sheet="templates/HibernateEntityAbstract.vsl"
> outputPattern="{0}/{1}Abstract.java"
> outlet="entities"
> overWrite="true">
> <modelElements variable="class">
> <modelElement stereotype="STEREOTYPE_ENTITY"/>
> </modelElements>
> </template>
>
> and
>
> <metafacade
> metaobjectClass="org.omg.uml.foundation.core.Operation$Impl"
> metafacadeClass="org.andromda.cartridges.ejosa.
> businessejbhibernate.metafacades.BusinessEjbHibernateFinder
> MethodFacadeLogicImpl">
> <stereotype>STEREOTYPE_FINDER_METHOD</stereotype>
> </metafacade>
>
>
> Surely, all the cartidge developers must be very strict to this
> convention: never use a string like "Entity" directly in Java,
> Templates and everywhere else. Always use the constant defined
> in the andromda-cartridge.xml. In this way, it would be very
> easy to rename those stereotypes, taggedvalues, constants, etc.
>
> IMO, this would be really cool!
>
> Cheers,
>
> Writing the CartridgeUtil class is not a problem at all, I think.
> Just need to read andromda-cartridge.xml (and AndroMDA team has
> done this in AndroMDA a lot of time, right ;-))?
>-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - digital self defense, top technical experts, no vendor pitches, unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel
