[ http://jira.andromda.org/browse/NETCART-9?page=comments#action_13731 ] 

Campbell Boucher-Burnet commented on NETCART-9:
-----------------------------------------------

Something like...

In cartridge.xml:

    <template
        path="templates/nspring/NSpringDaoFactory.cs.vsl"
        outputPattern="$generatedFile"
        outlet="daos"
        overwrite="true"
        outputToSingleFile="true"
        outputOnEmptyElements="false">
        <modelElements variable="entities">
            <modelElement>
                <type 
name="org.andromda.cartridges.nspring.metafacades.SpringEntity"/>
            </modelElement>
        </modelElements>
    </template>

in templates/nspring/NSpringDaoFactory.cs.vsl:

#set ($generatedFile = "ServiceFactory.cs")
#if($stringUtils.isNotEmpty($springTypesPackage))
#set ($generatedFile = 
"${stringUtils.replace($springTypesPackage,'.','/')}/$generatedFile")
#end
// Name: ServiceFactory.cs
// license-header cs merge-point
//
// Attention: Generated code! Do not modify by hand!
// Generated by: NSpringServiceFactory.cs.vsl in andromda-nspring-cartridge.

using System;

#if ($stringUtils.isNotBlank($springTypesPackage))
namespace ${springTypesPackage}
{
#end
    //TODO:  local  versus remote?
    //             .NET remoting versus SOAP/Hessian, etc.?
    //             Generate service agent classes that are clients of this?

    #region Service Factory

    /// <summary>
    /// Factory for obtaining Service Interface implementation instances.
    /// </summary>
    public class ServiceFactory
    {
        #region Backing Fields

#foreach($service in $services)
        #region m_$stringUtils.lowerCamelCaseName($service.name)
        /// <summary>
        /// Backing field for ${service.fullyQualifiedInterfaceName}.
        /// </summary>
        private static ${service.fullyQualifiedInterfaceName} 
m_$stringUtils.lowerCamelCaseName($service.name) = null;
        #endregion
#end

        #endregion Backing Fields
        
        #region Factory Methods
#foreach($service in $services)

        #region Get${service.name}()
        /// <summary>
        /// Factory method to obtain concrete instances of 
${service.fullyQualifiedInterfaceName}.
        /// </summary>
        public static ${service.fullyQualifiedInterfaceName} 
Get${service.name}()
        {
            if (m_$stringUtils.lowerCamelCaseName($service.name) == null)
            {
                m_$stringUtils.lowerCamelCaseName($service.name) = new 
${service.fullyQualifiedImplementationName}();
            }

            return m_$stringUtils.lowerCamelCaseName($service.name);
        }        
        #endregion
#end

        #endregion Factory Methods
    }
    
    #endregion Service Factory
#if ($stringUtils.isNotBlank($springTypesPackage))
}
#end

> Create a template for generating a service locator class
> --------------------------------------------------------
>
>          Key: NETCART-9
>          URL: http://jira.andromda.org/browse/NETCART-9
>      Project: .NET Cartridges
>         Type: Improvement

>     Reporter: Naresh Bhatia
>     Assignee: Naresh Bhatia
>     Priority: Minor

>
> Create a template for generating a service locator class

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

Reply via email to