From: Chris M. <cm...@us...> - 2006-10-02 01:21:49
|
User: cmicali Date: 06/10/01 18:21:48 Modified: andromda-cs pom.xml andromda-nhibernate pom.xml andromda-nhibernate/src/main/resources/templates/nhibernate NHibernateEmbeddedValue.vsl NHibernateEntity.vsl andromda-nhibernate/src/test/expected cartridge-output.zip andromda-nhibernate/src/test/expected/org/andromda/cartridges/nhibernate EntityOne.cs EntityTwo.cs andromda-nspring pom.xml andromda-nspring/src/main/resources/META-INF/andromda cartridge.xml andromda-nspring/src/main/resources/templates/nspring NSpringServiceBase.vsl Added: andromda-nspring/src/main/resources/templates/nspring NSpringServiceException.vsl Removed: andromda-cs/src/main/resources/templates/cs Service.vsl ServiceImpl.vsl Log: - Updated version to 1.1-SNAPSHOT - Added service exception to nspring cartridge - Changed newInstance to NewInstance in templates Revision Changes Path 1.9 +1 -1 cartridges/andromda-cs/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-cs/pom.xml,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- pom.xml 27 Sep 2006 13:32:20 -0000 1.8 +++ pom.xml 2 Oct 2006 01:21:46 -0000 1.9 @@ -10,7 +10,7 @@ <artifactId>andromda-cs-cartridge</artifactId> <packaging>andromda-cartridge</packaging> <name>AndroMDA C# Cartridge</name> - <version>1.0</version> + <version>1.1-SNAPSHOT</version> <description> Produces C# objects from a model. </description> 1.10 +1 -1 cartridges/andromda-nhibernate/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nhibernate/pom.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- pom.xml 21 Sep 2006 02:33:08 -0000 1.9 +++ pom.xml 2 Oct 2006 01:21:47 -0000 1.10 @@ -10,7 +10,7 @@ <artifactId>andromda-nhibernate-cartridge</artifactId> <packaging>andromda-cartridge</packaging> <name>AndroMDA NHibernate Cartridge</name> - <version>1.0</version> + <version>1.1-SNAPSHOT</version> <description> Produces NHibernate entities optionally services implemented as Session EJB facades. </description> 1.4 +3 -3 cartridges/andromda-nhibernate/src/main/resources/templates/nhibernate/NHibernateEmbeddedValue.vsl Index: NHibernateEmbeddedValue.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nhibernate/src/main/resources/templates/nhibernate/NHibernateEmbeddedValue.vsl,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- NHibernateEmbeddedValue.vsl 15 Aug 2006 22:48:46 -0000 1.3 +++ NHibernateEmbeddedValue.vsl 2 Oct 2006 01:21:47 -0000 1.4 @@ -34,7 +34,7 @@ #if ($embeddedValue.attributes.empty) #set ($parenthesis = "()") #end - public static $embeddedValue.name newInstance${parenthesis} + public static $embeddedValue.name NewInstance${parenthesis} #foreach ($attribute in $embeddedValue.attributes) $attribute.getterSetterTypeName ${attribute.name}#if($velocityCount != $embeddedValue.attributes.size()),#else) #end @@ -52,11 +52,11 @@ /// <summary> /// Creates a new instance from other $embeddedValue.name instance. /// </summary> - public static ${embeddedValue.name} newInstance($embeddedValue.name otherObject) + public static ${embeddedValue.name} NewInstance($embeddedValue.name otherObject) { if (otherObject != null) { - return newInstance( + return NewInstance( #foreach ($attribute in $embeddedValue.attributes) otherObject._${attribute.name}#if($velocityCount != $embeddedValue.attributes.size()),#else); #end 1.6 +2 -2 cartridges/andromda-nhibernate/src/main/resources/templates/nhibernate/NHibernateEntity.vsl Index: NHibernateEntity.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nhibernate/src/main/resources/templates/nhibernate/NHibernateEntity.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- NHibernateEntity.vsl 8 Sep 2006 14:48:54 -0000 1.5 +++ NHibernateEntity.vsl 2 Oct 2006 01:21:47 -0000 1.6 @@ -200,7 +200,7 @@ /// <summary> /// Constructs a new instance of <seealso cref="${entity.fullyQualifiedName}"/>. /// </summary> - public static $entity.fullyQualifiedName newInstance() + public static $entity.fullyQualifiedName NewInstance() { return new ${entity.fullyQualifiedEntityImplementationName}(); } @@ -223,7 +223,7 @@ /// <summary> /// Constructs a new instance of <seealso cref="${entity.fullyQualifiedName}"/>. /// </summary> - public static $entity.fullyQualifiedName newInstance() + public static $entity.fullyQualifiedName NewInstance() { return new ${entity.fullyQualifiedEntityImplementationName}(); } 1.6 +16 -15 cartridges/andromda-nhibernate/src/test/expected/cartridge-output.zip <<Binary file>> 1.5 +1 -1 cartridges/andromda-nhibernate/src/test/expected/org/andromda/cartridges/nhibernate/EntityOne.cs Index: EntityOne.cs =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nhibernate/src/test/expected/org/andromda/cartridges/nhibernate/EntityOne.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- EntityOne.cs 8 Sep 2006 14:48:54 -0000 1.4 +++ EntityOne.cs 2 Oct 2006 01:21:47 -0000 1.5 @@ -159,7 +159,7 @@ /// <summary> /// Constructs a new instance of <seealso cref="org.andromda.cartridges.nhibernate.EntityOne"/>. /// </summary> - public static org.andromda.cartridges.nhibernate.EntityOne newInstance() + public static org.andromda.cartridges.nhibernate.EntityOne NewInstance() { return new org.andromda.cartridges.nhibernate.EntityOneImpl(); } 1.5 +1 -1 cartridges/andromda-nhibernate/src/test/expected/org/andromda/cartridges/nhibernate/EntityTwo.cs Index: EntityTwo.cs =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nhibernate/src/test/expected/org/andromda/cartridges/nhibernate/EntityTwo.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- EntityTwo.cs 8 Sep 2006 14:48:54 -0000 1.4 +++ EntityTwo.cs 2 Oct 2006 01:21:47 -0000 1.5 @@ -132,7 +132,7 @@ /// <summary> /// Constructs a new instance of <seealso cref="org.andromda.cartridges.nhibernate.EntityTwo"/>. /// </summary> - public static org.andromda.cartridges.nhibernate.EntityTwo newInstance() + public static org.andromda.cartridges.nhibernate.EntityTwo NewInstance() { return new org.andromda.cartridges.nhibernate.EntityTwoImpl(); } 1.6 +1 -1 cartridges/andromda-nspring/pom.xml Index: pom.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nspring/pom.xml,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- pom.xml 27 Sep 2006 13:32:20 -0000 1.5 +++ pom.xml 2 Oct 2006 01:21:47 -0000 1.6 @@ -10,7 +10,7 @@ <artifactId>andromda-nspring-cartridge</artifactId> <packaging>andromda-cartridge</packaging> <name>AndroMDA NSpring Cartridge</name> - <version>1.0</version> + <version>1.1-SNAPSHOT</version> <description> Generates NSpring with NHibernate support </description> 1.4 +14 -0 cartridges/andromda-nspring/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nspring/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- cartridge.xml 15 Jun 2006 14:59:55 -0000 1.3 +++ cartridge.xml 2 Oct 2006 01:21:47 -0000 1.4 @@ -181,6 +181,20 @@ </template> <template + path="templates/nspring/NSpringServiceException.vsl" + outputPattern="$generatedFile" + outlet="services" + overwrite="true"> + <modelElements variable="service"> + <modelElement> + <type name="org.andromda.cartridges.nspring.metafacades.SpringService"> + <property name="configonly">false</property> + </type> + </modelElement> + </modelElements> + </template> + + <template path="templates/nspring/NSpringServiceBase.vsl" outputPattern="$generatedFile" outlet="services" 1.2 +1 -1 cartridges/andromda-nspring/src/main/resources/templates/nspring/NSpringServiceBase.vsl Index: NSpringServiceBase.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-nspring/src/main/resources/templates/nspring/NSpringServiceBase.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- NSpringServiceBase.vsl 15 Jun 2006 14:59:55 -0000 1.1 +++ NSpringServiceBase.vsl 2 Oct 2006 01:21:47 -0000 1.2 @@ -84,7 +84,7 @@ { SessionManagerFactory.SessionManager.RollbackTransaction(); log.Error(ex); - throw; + throw ${service.name}Exception.Create(ex); } finally { 1.1 cartridges/andromda-nspring/src/main/resources/templates/nspring/NSpringServiceException.vsl Index: NSpringServiceException.vsl =================================================================== #set ($generatedFile = "${service.packagePath}/${service.name}Exception.cs") // Name: ${service.name}Exception.cs // license-header cs merge-point // // Attention: Generated code! Do not modify by hand! // Generated by: NSpringServiceException.vsl using System; using System.Xml; using System.Runtime.Serialization; using System.Web; using System.Web.Services.Protocols; #if ($stringUtils.isNotBlank($service.packageName)) namespace $service.packageName { #end [Serializable] public class ${service.name}Exception : System.ApplicationException, ISerializable { private XmlNode detail = null; private const string ErrorMessage = "A call to TimeTrackingService failed. Please check the inner exception for more detail."; private static XmlDocument doc = new XmlDocument(); private bool isKnownException = false; /// <summary> /// Contains the details about the exception. Contains the InnerException if any /// Format of the InnerException is <exception type="FullNameOfTheException"><message></message></exception> /// </summary> public XmlNode Detail { get { return this.detail; } set { this.detail = value; } } /// <summary> /// Says whether this exception is a known business exception /// </summary> public bool KnownException { get { return this.isKnownException; } set { this.isKnownException = value; } } /// <summary> /// Initializes a new instance of ${service.name}Exception with a specified error message. /// </summary> /// <param name="message">A message that describes the error.</param> internal ${service.name}Exception(String message) : base(message) { this.isKnownException = true; } /// <summary> /// Initializes a new instance of ${service.name}Exception at the time of deserialization. /// Do not call the base class constructor as that initializes few properties that are not getting serialized /// </summary> /// <param name="info">Contains the state information of the serialized object.</param> /// <param name="context">Contains the context information.</param> public ${service.name}Exception(SerializationInfo info, StreamingContext context) // : base(info, context) { this.detail = info.GetValue("Detail", typeof(XmlNode) ) as XmlNode; this.isKnownException = info.GetBoolean("KnownException"); } /// <summary> /// Initializes a new instance of ${service.name}Exception that wraps the actual exception. /// </summary> /// <param name="message">A message that describes the error.</param> /// <param name="innerException">The exception that is the cause of the current exception.</param> internal ${service.name}Exception(String message, Exception innerException) : base(message) { this.detail = ToXmlNode( message, innerException ); } #region ISerializable Members void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) { /// Do not call the base class method as that initializes few properties that are not getting serialized //base.GetObjectData(info, context); info.AddValue("Detail", this.detail); info.AddValue("KnownException", isKnownException ); } #endregion /// <summary> /// Create a new instance of the ${service.name}Exception. /// </summary> /// <param name="message">A message that describes the error.</param> public static ${service.name}Exception Create(string message) { return new ${service.name}Exception(message); } /// <summary> /// Create a new instance of the ${service.name}Exception. /// </summary> /// <param name="exception">Actual exception that contains the error information.</param> public static ${service.name}Exception Create(Exception e) { if (e is ${service.name}Exception) { return (${service.name}Exception)e; } else if (e is SoapException) { return UnwrapSoapException((SoapException)e); } else { return new ${service.name}Exception(ErrorMessage, e); } } /// <summary> /// This method wraps the a exception as a ${service.name}Exception and then as a SoapException. /// </summary> /// <param name="e">Actual exception that contains the error information.</param> public static SoapException WrapSoapException(Exception e) { //Make sure the exception that is wrapped is a ${service.name}Exception ${service.name}Exception ttse = Create(e); string actor = (HttpContext.Current != null) ? HttpContext.Current.Request.Url.AbsoluteUri : string.Empty; return new SoapException("Fault occurred", SoapException.ClientFaultCode, actor, ToXmlNode(e.Message, ttse)); } /// <summary> /// This method unwraps the ${service.name}Exception from the SoapException. /// </summary> /// <param name="se">Actual exception that contains the error information.</param> private static ${service.name}Exception UnwrapSoapException(SoapException se) { ${service.name}Exception ttse = null; XmlNode detailNode = se.Detail; if (detailNode != null) { string message = detailNode.SelectSingleNode("message").InnerText; ttse = new ${service.name}Exception(message); XmlNode exceptionNode = detailNode.SelectSingleNode("exception"); if (exceptionNode != null) ttse.Detail = exceptionNode; } return ttse; } /// <summary> /// Helper method to create a xml node that contains the information about the parameters passed. /// </summary> /// <param name="message">A message that describes the error.</param> /// <param name="exception">Actual exception that contains the error information.</param> private static XmlNode ToXmlNode(string message, Exception e) { // Build the detail element of the SOAP fault. System.Xml.XmlNode detailNode = doc.CreateNode(XmlNodeType.Element, SoapException.DetailElementName.Name, SoapException.DetailElementName.Namespace); // Build specific details for the SoapException. XmlNode messageNode = ToXmlNode( "message", e.Message); detailNode.AppendChild(messageNode); bool IsKnownException = false; ${service.name}Exception ttse = e as ${service.name}Exception; if (ttse != null) { IsKnownException = ttse.KnownException; } XmlNode knownExceptionNode = ToXmlNode("KnownException", IsKnownException.ToString() ); detailNode.AppendChild(knownExceptionNode); if (e != null) { detailNode.AppendChild(ToXmlNode(e)); } return detailNode; } /// <summary> /// Helper method to create a xml node that contains the information about the parameters passed. /// </summary> /// <param name="exception">Actual exception that contains the error information.</param> private static XmlNode ToXmlNode(Exception e) { System.Xml.XmlNode exception = null; if (e != null) { // Create exception node. exception = doc.CreateNode(XmlNodeType.Element, "exception", null); XmlAttribute typeAttribute = doc.CreateAttribute("t", "type", null); typeAttribute.Value = e.GetType().FullName; exception.Attributes.Append(typeAttribute); exception.AppendChild(ToXmlNode("message", e.Message)); if (e.InnerException != null) { exception.AppendChild(ToXmlNode(e.InnerException)); } } return exception; } /// <summary> /// Helper method to create a xml node that contains the information about the parameters passed. /// </summary> /// <param name="nodeName">A name of the node to be created.</param> /// <param name="text">Text that is the value of the node.</param> private static XmlNode ToXmlNode(string nodeName, string text) { System.Xml.XmlNode messageNode = doc.CreateNode(XmlNodeType.Element, nodeName, null); XmlNode messageTextNode = doc.CreateNode(XmlNodeType.Text, "Text", null); messageTextNode.Value = text; messageNode.AppendChild(messageTextNode); return messageNode; } } #if ($stringUtils.isNotBlank($service.packageName)) } #end |