Sounds like a good idea...I had been thinking of similar implementation. I'll see if I can add something like this soon.
----- Original Message ----- From: "Lofi Dewanto" <[EMAIL PROTECTED]> To: "Chad Brandon" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Saturday, July 03, 2004 8:41 AM Subject: Re: [Andromda-user] Using other naming convension for the stereotypes? > 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 ;-))? > > -- > --------------------------------------------------- > Blasius Lofi Dewanto > --------------------------------------------------- > OpenUSS - Open University Support System > http://openuss.sourceforge.net > --------------------------------------------------- > E-Mail : [EMAIL PROTECTED] > ICQ : 39343280 > --------------------------------------------------- > > Chad Brandon schrieb: > > Hi Lofi, > > > > It would be great if it was that > > simple...unfortunately some of the cartridges use the > > hard coded values of stereotypes. I'd really like to > > do something clean with the stereotype names. So that > > its easy for people to configure them. > > > > Chad > > > > --- Lofi Dewanto <[EMAIL PROTECTED]> wrote: > > > >>Hi Community, > >> > >>I would like to whether it is possible to "rename" > >>those Stereotypes, TaggedValues constants in the > >>UMLProfile.java > >>in my own cartridge? > >> > >>Example: > >> > >>In UMLProfile.java the STEREOTYPE_IDENTIFIER is > >>defined > >>as "PrimaryKey". I would like to use another name > >>for > >>this, like for example "primaryKey". Is this > >>possible without > >>modifying the Metafacade itself? > >> > >>Thanks! > >>-- > >>--------------------------------------------------- > >>Blasius Lofi Dewanto > >>--------------------------------------------------- > >>OpenUSS - Open University Support System > >>http://openuss.sourceforge.net > >>--------------------------------------------------- > >>E-Mail : [EMAIL PROTECTED] > >>ICQ : 39343280 > >>--------------------------------------------------- > >> > >> > >> > >> > >> > > > > ------------------------------------------------------- > > > >>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-user mailing list > >>[EMAIL PROTECTED] > >> > > > > https://lists.sourceforge.net/lists/listinfo/andromda-user > > > > > > > > ------------------------------------------------------- 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-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/andromda-user