From: Vance K. <va...@us...> - 2007-04-16 14:09:52
|
User: vancek Date: 07/04/16 07:09:52 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBeanBase.vsl SessionBeanImpl.vsl SessionRemote.vsl Entity.vsl EntityEmbeddable.vsl SessionLocal.vsl andromda-ejb3/src/test/uml EJB3CartridgeTestModel.xml.zip andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades EJB3SessionOperationFacadeLogicImpl.java EJB3SessionAttributeFacadeLogicImpl.java EJB3MetafacadeUtils.java EJB3SessionFacadeLogicImpl.java andromda-ejb3/src/test/expected cartridge-output.zip andromda-ejb3/src/main/resources/templates/ejb3/config ejb-jar.xml.vsl persistence.xml.vsl andromda-ejb3/src/main/resources/META-INF/andromda cartridge.xml metafacades.xml namespace.xml andromda-ejb3/src/site/axdoc howto6.xml andromda-ejb3/src/site changes.xml andromda-ejb3/src/main/uml EJB3MetafacadeModel.xml.zip Added: andromda-ejb3/src/main/resources/templates/ejb3 SessionInterface.vsl andromda-ejb3/src/main/resources/templates/ejb3/config/jboss components.xml.vsl Removed: andromda-ejb3/src/main/resources/templates/ejb3 EntityImpl.vsl SessionBean.vsl Log: JBoss Seam extension corresponding to Seam cartridge release Revision Changes Path 1.12 +11 -48 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBeanBase.vsl Index: SessionBeanBase.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBeanBase.vsl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- SessionBeanBase.vsl 4 Feb 2007 02:39:07 -0000 1.11 +++ SessionBeanBase.vsl 16 Apr 2007 14:09:37 -0000 1.12 @@ -10,35 +10,24 @@ #set ($generatedFile = "${stringUtils.replace($service.fullyQualifiedServiceBaseName,'.','/')}.java") /** - * Autogenerated EJB session bean base class ${service.serviceName}. + * Autogenerated EJB3 session bean base class ${service.serviceName} which contains + * method level annotations for the session bean. All method level annotations + * are inherited by the extending session bean class. #if ($service.stateful) * * ${service.serviceName} is a stateful session bean and implements Serializable to maintain * state when bean instance not in use. #end +#if ($service.seamComponent) * + * This Seam component is defined through META-INF/components.xml rather than + * class level annotations. +#end $service.getDocumentation(" * ") */ -## -## Define the Seam component name for the class if JBoss Seam is enabled -## -#**##if ($service.seamComponent) -...@or...("${service.seamComponentName}") -#* *##if ($stringUtils.isNotBlank($service.seamComponentScopeType)) -...@or...ope(org.jboss.seam.ScopeType.${service.seamComponentScopeType}) -#* *##end -#* *##if ($service.seamComponentStartup) -...@or...artup#if ($stringUtils.isNotEmpty($service.seamComponentStartupOptions))$service.seamComponentStartupOptions#end -#* *##end -#**##end #if ($service.transactionManagement) @javax.ejb.TransactionManagement(javax.ejb.TransactionManagementType.${service.transactionManagement}) #end -#if (!$service.transactionManagementBean) -#**##if ($service.transactionType) -...@ja...ansactionAttribute(javax.ejb.TransactionAttributeType.${service.transactionType}) -#**##end -#end #if ($service.securityEnabled) #**##if ($service.persistenceContainerJboss) @org.jboss.annotation.security.SecurityDomain("${service.securityRealm}") @@ -57,33 +46,14 @@ @org.jboss.annotation.ejb.LocalBinding(jndiBinding = "${service.jndiNameLocal}") #**##end #end -#if ($service.viewTypeLocal) -@javax.ejb.Local({${service.fullyQualifiedServiceLocalInterfaceName}.class}) -#end -#if ($service.viewTypeRemote) -...@ja...mote({${service.fullyQualifiedServiceRemoteInterfaceName}.class}) -#end #if ($service.clusteringEnabled) @org.jboss.annotation.ejb.Clustered #end -#set ($interceptors = $service.interceptorReferences) -#if ($collectionUtils.size($interceptors) >= 1 || $service.listenerEnabled) -#**##if ($service.listenerEnabled) -#* *##set ($lifecycleCallback = "${service.fullyQualifiedServiceListenerName}.class") -#**##else -#* *##set ($lifecycleCallback = "") -#**##end -// Lifecycle callback listeners and interceptors are defined in ejb-jar.xml -// @javax.interceptor.Interceptors({$transform.getInterceptorsAsList(${interceptors}, ${lifecycleCallback})}) -#end -#if ($service.excludeDefaultInterceptors) -// @javax.interceptor.ExcludeDefaultInterceptors -#end public abstract class ${service.serviceBaseName} #if($service.generalization) extends ${service.generalization.fullyQualifiedServiceName} #end - implements#if ($service.viewTypeLocal) ${service.fullyQualifiedServiceLocalInterfaceName}#if ($service.viewTypeRemote),#end#end#if ($service.viewTypeRemote) ${service.fullyQualifiedServiceRemoteInterfaceName}#end#if ($service.stateful), java.io.Serializable#end + implements ${service.fullyQualifiedServiceInterfaceName}#if ($service.stateful), java.io.Serializable#end { // ------ Session Context Injection ------ @@ -367,7 +337,7 @@ $operation.getDocumentation(" * ") */ #* *##if (!$service.transactionManagementBean) -#* *##if ($operation.transactionType) +#* *##if ($stringUtils.isNotBlank($operation.transactionType)) @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${operation.transactionType}) #* *##end #* *##end @@ -570,17 +540,10 @@ /** * Remove lifecycle method */ - @javax.ejb.Remove #* *##if ($service.seamComponent) @org.jboss.seam.annotations.Destroy #* *##end - public void destroy() { - handleDestroy(); - } - - /** - * Performs the core logic for {@link #destroy()) - */ - protected abstract void handleDestroy(); + @javax.ejb.Remove + public void destroy() {} #end } \ No newline at end of file 1.16 +36 -21 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBeanImpl.vsl Index: SessionBeanImpl.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBeanImpl.vsl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- SessionBeanImpl.vsl 17 Jan 2007 00:50:56 -0000 1.15 +++ SessionBeanImpl.vsl 16 Apr 2007 14:09:37 -0000 1.16 @@ -8,27 +8,54 @@ #set ($generatedFile = "${stringUtils.replace($service.fullyQualifiedServiceName,'.','/')}.java") /** - * @see ${service.fullyQualifiedServiceName} - */ -/** + * @see ${service.fullyQualifiedServiceBaseName} + * + * Remember to manually configure the local business interface this bean implements if originally you only + * defined the remote business interface. However, this change is automatically reflected in the ejb-jar.xml. + * +#if (!$service.seamComponent) * Do not specify the javax.ejb.${service.type} annotation - * Instead, define the session bean in the ejb-jar.xml descriptor - * @javax.ejb.${service.type} + * Instead, the session bean is defined in the ejb-jar.xml descriptor. */ +#else + * This session bean is a Seam component. Currently, Seam components + * must have the bean type specified via annotations. Once this has been + * fixed in Seam 1.2.1, it is enough to define the session bean + * in ejb-jar.xml and we can safely remove this annotation. + */ +@javax.ejb.${service.type} +#**##if ($service.seamComponentStartup) +...@or...artup#if ($stringUtils.isNotEmpty($service.seamComponentStartupOptions))$service.seamComponentStartupOptions#end +#**##else +// Uncomment to define Seam startup +// @org.jboss.seam.annotations.Startup#if ($stringUtils.isNotEmpty($service.seamComponentStartupOptions))$service.seamComponentStartupOptions#end + +#**##end +#end #if ($service.webServiceEnabled) @javax.jws.WebService(endpointInterface = "${service.fullyQualifiedWebServiceInterfaceName}") #else -/** - * Uncomment to enable webservices for ${service.serviceName} - *@javax.jws.WebService(endpointInterface = "${service.fullyQualifiedWebServiceInterfaceName}") - */ +// Uncomment to enable webservices for ${service.serviceName} +// @javax.jws.WebService(endpointInterface = "${service.fullyQualifiedWebServiceInterfaceName}") #end public class ${service.serviceName} extends ${service.fullyQualifiedServiceBaseName} + implements#if ($service.viewTypeLocal) ${service.fullyQualifiedServiceLocalInterfaceName}#if ($service.viewTypeRemote),#end#end#if ($service.viewTypeRemote) ${service.fullyQualifiedServiceRemoteInterfaceName}#end + { +#if ($service.stateful) + /** + * Bean serial version ID + */ + private static final long serialVersionUID = 1L; +#end + // --------------- Constructors --------------- ## Default create method with no arguments. + /** + * Default constructor extending base class default constructor + */ public ${service.serviceName}() { super(); @@ -117,16 +144,4 @@ #* *##end #**##end #end -#if ($service.stateful) - - // ----------- Destroy Method Implementation ----------- - - /** - * @see ${service.fullyQualifiedServiceName}#destroy() - */ - protected void handleDestroy() - { - //TODO: put your implementation here - } -#end } 1.8 +13 -51 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionRemote.vsl Index: SessionRemote.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionRemote.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- SessionRemote.vsl 17 Jan 2007 00:50:56 -0000 1.7 +++ SessionRemote.vsl 16 Apr 2007 14:09:37 -0000 1.8 @@ -10,55 +10,23 @@ /** * Remote component interface for the ${service.serviceName} session bean. +#if ($service.seamComponent) + * The service that implement this business interface is a Seam component. The cartridge + * will not expose this interface as a Remote business interface for the bean + * component. Seam components will only have a Local business interface. +#end $service.getDocumentation(" * ") */ -public interface ${service.serviceRemoteInterfaceName} -#if ($service.generalization) - extends ${service.generalization.fullyQualifiedName}Remote +## +## Do not render this annotation if the session bean is a Seam component. +## We only expose the Local business interface for Seam components. +## +#if (!$service.seamComponent) +...@ja...mote #end +public interface ${service.serviceRemoteInterfaceName} + extends ${service.serviceInterfaceName}#if ($service.generalization), ${service.generalization.fullyQualifiedName}Remote#end { -#set ($constants = $service.constants) -#if (!$constants.empty) - - // ---------- Accessors For Constants ----------- - -#**##foreach($constant in $constants) -## Only expose the method if it is public. -#* *##if($constant.visibility == "public") - /** - * Get the $attribute.name constant -$constant.getDocumentation(" * ") - */ - public $constant.type.fullyQualifiedName ${constant.getterName}(); - -#* *##end -#**##end -#end -#set ($attributes = $service.filterSeamAttributes(${service.instanceAttributes})) -#if (!$attributes.empty) - - // --------------- Attributes --------------------- - -#**##foreach ($attribute in $attributes) -## Only expose the method to the component interface if it is public. -#* *##if ($attribute.visibility == "public") - /** - * Get the $attribute.name property -$attribute.getDocumentation(" * ") - */ - public $attribute.type.fullyQualifiedName ${attribute.getterName}(); - -#* *##if(!$attribute.readOnly) - /** - * Set the $attribute.name property - * @param value the new value - */ - public void ${attribute.setterName}($attribute.type.fullyQualifiedName value); - -#* *##end -#* *##end -#**##end -#end #set ($operations = $service.businessOperations) #if (!$operations.empty) @@ -84,10 +52,4 @@ #* *##end #**##end #end -#if ($service.stateful) - - // ------------ Lifecycle Methods ----------------- - - public void destroy(); -#end } \ No newline at end of file 1.22 +0 -11 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/Entity.vsl Index: Entity.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/Entity.vsl,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -r1.21 -r1.22 --- Entity.vsl 28 Feb 2007 00:56:18 -0000 1.21 +++ Entity.vsl 16 Apr 2007 14:09:38 -0000 1.22 @@ -20,17 +20,6 @@ */ @javax.persistence.Entity -#if ($entity.seamComponent) -...@or...("${entity.seamComponentName}") -#**##if ($stringUtils.isNotBlank($entity.seamComponentScopeType)) -...@or...ope(org.jboss.seam.ScopeType.${entity.seamComponentScopeType}) -#**##end -#else -// Uncomment to enable seam component name -// @org.jboss.seam.annotations.Name("${entity.seamComponentName}") -// Uncomment to set specific component scope type -//@org.jboss.seam.annotations.Scope(org.jboss.seam.ScopeType.#if ($entity.stateless)STATELESS#else#**#CONVERSATION#end) -#end @javax.persistence.Table(name = "${entity.tableName}") #if ($entity.listenerEnabled) @javax.persistence.EntityListeners({${entity.fullyQualifiedEntityListenerName}.class}) 1.47 +5 -2 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl Index: EntityEmbeddable.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/EntityEmbeddable.vsl,v retrieving revision 1.46 retrieving revision 1.47 diff -u -w -r1.46 -r1.47 --- EntityEmbeddable.vsl 26 Mar 2007 12:01:06 -0000 1.46 +++ EntityEmbeddable.vsl 16 Apr 2007 14:09:38 -0000 1.47 @@ -478,9 +478,12 @@ #* *##end #* *##if ($hibernateExtensionEnabled && $entity.seamComponent) ## -## If JBoss Seam and Hibernate extensions are both enabled, add NotNull and Length annotations +## If JBoss Seam and Hibernate extensions are both enabled, add NotNull and Length annotations where required +## +#* *##if (!$attribute.columnNullable && !($entity.dynamicIdentifiersPresent && $attribute.identifier)) +## +## Only specify this validator if identifier explicity specified and explicity set as not null ## -#* *##if (!$attribute.columnNullable) @org.hibernate.validator.NotNull #* *##end #* *##if ($attribute.columnLength) 1.8 +14 -55 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionLocal.vsl Index: SessionLocal.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionLocal.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- SessionLocal.vsl 17 Jan 2007 00:50:56 -0000 1.7 +++ SessionLocal.vsl 16 Apr 2007 14:09:39 -0000 1.8 @@ -10,55 +10,17 @@ /** * Local component interface for the ${service.serviceName} session bean. +#if ($service.seamComponent) + * The service that implement this business interface is a Seam component. The cartridge + * only exposes this interface as a Local business interface for the Seam bean + * component. +#end $service.getDocumentation(" * ") */ +@javax.ejb.Local public interface ${service.serviceLocalInterfaceName} -#if($service.generalization) - extends ${service.generalization.fullyQualifiedName}Local -#end + extends ${service.serviceInterfaceName}#if($service.generalization), ${service.generalization.fullyQualifiedName}Local#end { -#set ($constants = $service.constants) -#if (!$constants.empty) - - // ----------- Accessors For Constants ------------ - -#**##foreach($constant in $constants) -## Only expose the method if it is public. -#* *##if($constant.visibility == "public") - /** - * Get the $attribute.name constant -$constant.getDocumentation(" * ") - */ - public $constant.type.fullyQualifiedName ${constant.getterName}(); - -#* *##end -#**##end -#end -#set ($attributes = $service.filterSeamAttributes(${service.instanceAttributes})) -#if (!$attributes.empty) - - // --------------- Attributes --------------------- - -#**##foreach ($attribute in $attributes) -## Only expose the method to the component interface if it is public. -#* *##if ($attribute.visibility == "public") - /** - * Get the $attribute.name property -$attribute.getDocumentation(" * ") - */ - public $attribute.type.fullyQualifiedName ${attribute.getterName}(); - -#* *##if(!$attribute.readOnly) - /** - * Set the $attribute.name property - * @param value the new value - */ - public void ${attribute.setterName}($attribute.type.fullyQualifiedName value); - -#* *##end -#* *##end -#**##end -#end #set ($operations = $service.businessOperations) #if (!$operations.empty) @@ -68,11 +30,13 @@ ## ## Only expose methods that are not lifecycle callbacks ## Only expose public methods with local view type accessability +## or if the session bean is a Seam component, then expose all methods ## -#* *##if ($operation.viewTypeAbsoluteLocal) +#* *##if ($operation.viewTypeAbsoluteLocal || $service.seamComponent) /** $operation.getDocumentation(" * ") */ +#* *##if ($operation.visibility == "public") #* *##set ($returnType = $operation.returnType.fullyQualifiedName) #* *##if ($operation.exceptionsPresent) public $returnType $operation.signature @@ -80,14 +44,9 @@ #* *##else public $returnType $operation.signature; #* *##end +#* *##end #* *##end #**##end #end -#if ($service.stateful) - - // ------------ Lifecycle Methods ----------------- - - public void destroy(); -#end } \ No newline at end of file 1.1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionInterface.vsl Index: SessionInterface.vsl =================================================================== // license-header java merge-point // // Attention: Generated code! Do not modify by hand! // Generated by: SessionInterface.vsl in andromda-ejb3-cartridge. // #if ($stringUtils.isNotBlank($service.packageName)) package $service.packageName; #end #set ($generatedFile = "${stringUtils.replace($service.fullyQualifiedServiceInterfaceName,'.','/')}.java") /** * Parent interface for the ${service.serviceName} session bean which is * extended by Local and Remote business interfaces. Contains constant * and attribute accessor method definitions. */ public interface ${service.serviceInterfaceName} #if($service.generalization) extends ${service.generalization.fullyQualifiedServiceInterfaceName} #end { #set ($constants = $service.constants) #if (!$constants.empty) // ----------- Accessors For Constants ------------ #**##foreach($constant in $constants) ## Only expose the method if it is public. #* *##if($constant.visibility == "public") /** * Get the $attribute.name constant $constant.getDocumentation(" * ") */ public $constant.type.fullyQualifiedName ${constant.getterName}(); #* *##end #**##end #end #set ($attributes = $service.filterSeamAttributes(${service.instanceAttributes})) #if (!$attributes.empty) // --------------- Attributes --------------------- #**##foreach ($attribute in $attributes) ## Only expose the method to the component interface if it is public. #* *##if ($attribute.visibility == "public") /** * Get the $attribute.name property $attribute.getDocumentation(" * ") */ public $attribute.type.fullyQualifiedName ${attribute.getterName}(); #* *##if(!$attribute.readOnly) /** * Set the $attribute.name property * @param value the new value */ public void ${attribute.setterName}($attribute.type.fullyQualifiedName value); #* *##end #* *##end #**##end #end #if ($service.stateful) // ------------ Lifecycle Methods ----------------- public void destroy(); #end } 1.6 +317 -264 cartridges/andromda-ejb3/src/test/uml/EJB3CartridgeTestModel.xml.zip <<Binary file>> 1.18 +19 -17 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionOperationFacadeLogicImpl.java Index: EJB3SessionOperationFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionOperationFacadeLogicImpl.java,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- EJB3SessionOperationFacadeLogicImpl.java 4 Feb 2007 02:45:06 -0000 1.17 +++ EJB3SessionOperationFacadeLogicImpl.java 16 Apr 2007 14:09:40 -0000 1.18 @@ -258,6 +258,8 @@ /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionOperationFacadeLogic#handleGetTransactionType() + * + * If no method level transaction type specified, take it from the class level if it exists there. */ protected String handleGetTransactionType() { @@ -268,8 +270,8 @@ } else { - transType = StringUtils.trimToEmpty( - ObjectUtils.toString(this.getConfiguredProperty(EJB3Globals.TRANSACTION_TYPE))); + EJB3SessionFacade session = (EJB3SessionFacade)this.getOwner(); + transType = session.getTransactionType(); } return transType; } @@ -700,13 +702,13 @@ String value = (String) this.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_BIJECTION_FACTORY_VALUE); if(StringUtils.isNotBlank(value)) { - parameters.add("\"" + value + "\""); + parameters.add("value = \"" + value + "\""); } String scope = (String) this.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_BIJECTION_FACTORY_SCOPE_TYPE); if(StringUtils.isNotBlank(scope)) { - parameters.add("scope=" + scope); + parameters.add("scope = org.jboss.seam.ScopeType." + scope); } return EJB3MetafacadeUtils.buildAnnotationParameters(parameters); @@ -735,7 +737,7 @@ String flushMode = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_CONVERSATION_BEGIN_FLUSH_MODE); if(StringUtils.isNotBlank(flushMode)) { - parameters.add("flushMode=FlushModeType." + flushMode); + parameters.add("flushMode = org.jboss.seam.annotations.FlushModeType." + flushMode); } String pageflow = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_CONVERSATION_BEGIN_PAGEFLOW); @@ -789,7 +791,7 @@ EJB3Profile.TAGGEDVALUE_SEAM_CONVERSATION_BEGIN_TASK_FLUSH_MODE); if(StringUtils.isNotBlank(flushMode)) { - parameters.add("flushMode=\"" + flushMode + "\""); + parameters.add("flushMode = org.jboss.seam.annotations.FlushModeType." + flushMode + "\""); } String taskIdParameter = (String)this.findTaggedValue( @@ -950,7 +952,7 @@ EJB3Profile.TAGGEDVALUE_SEAM_CONVERSATION_START_TASK_FLUSH_MODE); if (StringUtils.isNotBlank(flushMode)) { - parameters.add("flushMode=" + flushMode); + parameters.add("flushMode = org.jboss.seam.annotations.FlushModeType." + flushMode); } String taskIdParameter = (String)this.findTaggedValue( 1.4 +12 -12 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionAttributeFacadeLogicImpl.java Index: EJB3SessionAttributeFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionAttributeFacadeLogicImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- EJB3SessionAttributeFacadeLogicImpl.java 17 Jan 2007 00:50:55 -0000 1.3 +++ EJB3SessionAttributeFacadeLogicImpl.java 16 Apr 2007 14:09:40 -0000 1.4 @@ -108,7 +108,7 @@ String scope = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_BIJECTION_OUT_SCOPE_TYPE, true); if(StringUtils.isNotBlank(scope)) { - parameters.add("scope=\"" + scope + "\""); + parameters.add("scope = org.jboss.seam.ScopeType." + scope); } String value = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_BIJECTION_OUT_VALUE, true); @@ -155,7 +155,7 @@ String scope = (String)this.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_DATA_DATAMODEL_SCOPE_TYPE, true); if(StringUtils.isNotBlank(scope)) { - parameters.add("scope=\"" + scope + "\""); + parameters.add("scope = org.jboss.seam.ScopeType." + scope); } return EJB3MetafacadeUtils.buildAnnotationParameters(parameters); 1.10 +15 -3 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java Index: EJB3MetafacadeUtils.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3MetafacadeUtils.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- EJB3MetafacadeUtils.java 1 Feb 2007 14:32:10 -0000 1.9 +++ EJB3MetafacadeUtils.java 16 Apr 2007 14:09:41 -0000 1.10 @@ -366,13 +366,25 @@ * If the Classifier is an entity or stateful session bean, then returns CONVERSATION * * @param classifier The classifier to lookup the scope type tagged value - * @paam stateful Whether the classifier is a stateful session bean + * @paam stateless Whether the classifier is a stateless session bean * @return The scope type as a String */ static String getSeamComponentScopeType(ClassifierFacade classifier, boolean stateless) { ExceptionUtils.checkNull("classifer", classifier); - return (String)classifier.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_SCOPE_TYPE); + String scopeType = (String)classifier.findTaggedValue(EJB3Profile.TAGGEDVALUE_SEAM_SCOPE_TYPE); + if (StringUtils.isBlank(scopeType)) + { + if (stateless) + { + scopeType = EJB3Globals.SEAM_COMPONENT_SCOPE_STATELESS; + } + else + { + scopeType = EJB3Globals.SEAM_COMPONENT_SCOPE_CONVERSATION; + } + } + return scopeType; } /** 1.22 +31 -4 cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionFacadeLogicImpl.java Index: EJB3SessionFacadeLogicImpl.java =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/java/org/andromda/cartridges/ejb3/metafacades/EJB3SessionFacadeLogicImpl.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -r1.21 -r1.22 --- EJB3SessionFacadeLogicImpl.java 11 Feb 2007 14:06:37 -0000 1.21 +++ EJB3SessionFacadeLogicImpl.java 16 Apr 2007 14:09:41 -0000 1.22 @@ -40,6 +40,11 @@ public static final String SERVICE_NAME_PATTERN = "serviceNamePattern"; /** + * The property which stores the pattern defining the service bean parent interface name. + */ + public static final String SERVICE_INTERFACE_NAME_PATTERN = "serviceInterfaceNamePattern"; + + /** * The property which stores the pattern defining the service bean local interface name. */ public static final String SERVICE_LOCAL_INTERFACE_NAME_PATTERN = "serviceLocalInterfaceNamePattern"; @@ -483,8 +488,7 @@ */ protected java.lang.String handleGetTransactionType() { - return EJB3MetafacadeUtils.getTransactionType(this, - String.valueOf(this.getConfiguredProperty(EJB3Globals.TRANSACTION_TYPE))); + return EJB3MetafacadeUtils.getTransactionType(this, null); } /** @@ -535,6 +539,19 @@ } /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleGetServiceInterfaceName() + */ + protected String handleGetServiceInterfaceName() + { + String serviceInterfaceNamePattern = + (String)this.getConfiguredProperty(SERVICE_INTERFACE_NAME_PATTERN); + + return MessageFormat.format( + serviceInterfaceNamePattern, + new Object[] {StringUtils.trimToEmpty(this.getName())}); + } + + /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleGetServiceLocalInterfaceName() */ protected String handleGetServiceLocalInterfaceName() @@ -660,6 +677,17 @@ } /** + * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleGetFullyQualifiedServiceInterfaceName() + */ + protected String handleGetFullyQualifiedServiceInterfaceName() + { + return EJB3MetafacadeUtils.getFullyQualifiedName( + this.getPackageName(), + this.getServiceInterfaceName(), + null); + } + + /** * @see org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacadeLogic#handleGetFullyQualifiedServiceLocalInterfaceName() */ protected String handleGetFullyQualifiedServiceLocalInterfaceName() @@ -1342,5 +1370,4 @@ { return this.hasStereotype(EJB3Profile.STEREOTYPE_SEAM_TRANSACTION_TRANSACTIONAL); } - } \ No newline at end of file 1.7 +836 -790 cartridges/andromda-ejb3/src/test/expected/cartridge-output.zip <<Binary file>> 1.9 +12 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/ejb-jar.xml.vsl Index: ejb-jar.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/ejb-jar.xml.vsl,v retrieving revision 1.8 retrieving revision 1.9 diff -u -w -r1.8 -r1.9 --- ejb-jar.xml.vsl 1 Dec 2006 02:52:22 -0000 1.8 +++ ejb-jar.xml.vsl 16 Apr 2007 14:09:42 -0000 1.9 @@ -19,7 +19,10 @@ ]]> </description> <ejb-name>${service.serviceName}</ejb-name> -#**##if ($service.viewTypeRemote) +## +## Only define the remote business interface if the bean is NOT a Seam component +## +#**##if ($service.viewTypeRemote && !$service.seamComponent) <remote>${service.fullyQualifiedServiceRemoteInterfaceName}</remote> #**##end #**##if ($service.viewTypeLocal) @@ -140,7 +143,15 @@ #end </enterprise-beans> +#if (${seamEnabled} == 'true') + <interceptors> + <interceptor> + <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class> + </interceptor> + </interceptors> + +#end <assembly-descriptor> #foreach ($interceptor in $interceptors) ## 1.5 +2 -5 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/persistence.xml.vsl Index: persistence.xml.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/persistence.xml.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- persistence.xml.vsl 13 Feb 2007 02:41:40 -0000 1.4 +++ persistence.xml.vsl 16 Apr 2007 14:09:43 -0000 1.5 @@ -3,17 +3,14 @@ Attention: Generated code! Do not modify by hand! Generated by: persistence.xml.vsl in andromda-ejb3-cartridge. --> -<persistence> - -<!-- <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> ---> <persistence-unit name="${entityManagerName}"> + <provider>org.hibernate.ejb.HibernatePersistence</provider> #if ($stringUtils.isNotBlank(${dataSource})) <jta-data-source>${dataSource}</jta-data-source> #end 1.38 +32 -2 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml Index: cartridge.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/cartridge.xml,v retrieving revision 1.37 retrieving revision 1.38 diff -u -w -r1.37 -r1.38 --- cartridge.xml 17 Feb 2007 14:09:08 -0000 1.37 +++ cartridge.xml 16 Apr 2007 14:09:43 -0000 1.38 @@ -175,6 +175,19 @@ </template> <template + path="templates/ejb3/SessionInterface.vsl" + outputPattern="$generatedFile" + outlet="session-beans" + overwrite="true" + generateEmptyFiles="true"> + <modelElements variable="service"> + <modelElement> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacade"/> + </modelElement> + </modelElements> + </template> + + <template path="templates/ejb3/SessionLocal.vsl" outputPattern="$generatedFile" outlet="session-beans" @@ -438,6 +451,23 @@ </template> <template + path="templates/ejb3/config/jboss/components.xml.vsl" + outputPattern="META-INF/components.xml" + outlet="session-config" + overwrite="true" + outputToSingleFile="true" + outputOnEmptyElements="false"> + <modelElements> + <modelElement variable="services"> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3SessionFacade"/> + </modelElement> + <modelElement variable="entities"> + <type name="org.andromda.cartridges.ejb3.metafacades.EJB3EntityFacade"/> + </modelElement> + </modelElements> + </template> + + <template path="templates/ejb3/config/jboss/login-config.xml.vsl" outputPattern="$generatedFile" outlet="application-metainf" 1.32 +1 -0 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml Index: metafacades.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/metafacades.xml,v retrieving revision 1.31 retrieving revision 1.32 diff -u -w -r1.31 -r1.32 --- metafacades.xml 18 Feb 2007 10:40:41 -0000 1.31 +++ metafacades.xml 16 Apr 2007 14:09:43 -0000 1.32 @@ -10,6 +10,7 @@ <property reference="labelCollectionNamePattern"/> <property reference="labelSingleNamePattern"/> <property reference="serviceNamePattern"/> + <property reference="serviceInterfaceNamePattern"/> <property reference="serviceLocalInterfaceNamePattern"/> <property reference="serviceRemoteInterfaceName"/> <property reference="serviceImplementationNamePattern"/> 1.38 +8 -1 cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/namespace.xml Index: namespace.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/META-INF/andromda/namespace.xml,v retrieving revision 1.37 retrieving revision 1.38 diff -u -w -r1.37 -r1.38 --- namespace.xml 18 Feb 2007 10:40:41 -0000 1.37 +++ namespace.xml 16 Apr 2007 14:09:43 -0000 1.38 @@ -463,6 +463,13 @@ "Bean". </documentation> </property> + <property name="serviceInterfaceNamePattern"> + <default>{0}</default> + <documentation> + The pattern to use when constructing the service + bean parent interface name. + </documentation> + </property> <property name="serviceLocalInterfaceNamePattern"> <default>{0}Local</default> <documentation> @@ -1221,7 +1228,7 @@ <li>NEVER</li> </ul> <strong>NOTE:</strong> - Can be overridden on a per entity basis with the + Can be overridden on a per bean/bean operation basis with the <a href="profile.html#@andromda_ejb_transaction_type"> @andromda.ejb.transaction.type 1.4 +8 -5 cartridges/andromda-ejb3/src/site/axdoc/howto6.xml Index: howto6.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/axdoc/howto6.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -r1.3 -r1.4 --- howto6.xml 24 Jan 2007 08:56:20 -0000 1.3 +++ howto6.xml 16 Apr 2007 14:09:47 -0000 1.4 @@ -34,10 +34,13 @@ entity's implementation class (they are considered to be business operations). </p> <p> - The documentation discussing the modeling of queries in UML is found here: - <a href="../andromda-ocl-query-library/modeling.html">Query Translation-Library Modeling</a>. + The documentation discussing the modelling of queries in OCL is found on the AndroMDA main + project in <a href="http://galaxy.andromda.org/docs/andromda-translation-libraries/index.html"> + Translation Libraries</a> and + <a href="http://galaxy.andromda.org/docs/andromda-translation-libraries/andromda-ocl-translation-libraries/andromda-ocl-query-library/modeling.html"> + Query Translation Library Modelling</a>. The tagged value overriding queries using EJB QL directly is found here: - <a href="../profile.html#@andromda_ejb_query">@andromda.ejb.query</a>. + <a href="http://galaxy.andromda.org/docs/andromda-ejb-cartridge/profile.html#@andromda_ejb_query">@andromda.ejb.query</a>. </p> <p> <img src="images/org/andromda/test/6/a/uml.gif"/> @@ -138,7 +141,7 @@ <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate</artifactId> - <version>3.2.1.ga</version> + <version>3.2.0.ga</version> <scope>provided</scope> </dependency> ... @@ -163,7 +166,7 @@ </p> <p> You can then model a <i>Classifier</i> scoped operation in your Entity such that you can - over-write the implementation in the DAOImpl (DAP implementation) and use the session object to + over-write the implementation in the DAOImpl (DAO implementation) and use the session object to create the criteria and perform the query. </p> <p> 1.13 +42 -0 cartridges/andromda-ejb3/src/site/changes.xml Index: changes.xml =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/site/changes.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- changes.xml 26 Mar 2007 12:01:05 -0000 1.12 +++ changes.xml 16 Apr 2007 14:09:48 -0000 1.13 @@ -398,6 +398,48 @@ mapped superclass or specializes another entity. This also cleaned up the constructor implementation in the inheriting entity. </action> + <action dev="vancek" type="fix"> + If transaction type specified on the class level and not on the method level, do not generate the + @TransactionAttribute on the method. Similarly, if not modelled on the class level, do not generate it there. + It doesn't make sense to have this annotation at the class level of the parent bean as class level annotations + are not inherited. + </action> + <action dev="vancek" type="update"> + Remove handleDestroy abstract method in SessionBeanBase. This was not being called correctly by + Seam. + </action> + <action dev="vancek" type="update"> + Session bean base or super classes now extend a super interface. Local and remote business interfaces + extend this super interface. Session bean implementations now extend the business interface(s). + This does introduce manual modification when refactoring a session bean's business interface. + The super interface contains common constants and attribute mutator definitions. + </action> + <action dev="vancek" type="update"> + Update persistence.xml descriptor with schema and namespace attributes. + Added provider org.hibernate.ejb.HibernatePersistence property. + </action> + <action dev="vancek" type="add"> + Expand on JBoss Seam support. Move Entity and Session bean Seam component declaration to newly added + components.xml. + This means removing @org.jboss.seam.annotations.Name and @org.jboss.seam.annotations.Scope annotations. + Only specify the @org.hibernate.validator.NotNull annotation on identifier attributes in entity Seam pojos + if identifer is explicity modelled and explicity defined as not null. + The ejb-jar.xml descriptor will NOT allow remote business interface declaration where the session bean + is a Seam component. + Add interceptors definition to ejb-jar.xml for the SeamInterceptor. + </action> + <action dev="vancek" type="update"> + By default, if a Seam component does not have it's scopte type specified, then the default stateless + scope type is assigned to stateless session beans and a conversation scope type is specified for all + other types of beans. + </action> + <action dev="vancek" type="fix"> + Specify the full package path for ScopeType and FlushModeType where the scope + or the flushMode parameters are required in Seam annotations. + </action> + <action dev="vancek" type="fix"> + Fix URLs in howto6.xml for referencing main AndroMDA project. + </action> </release> </body> </document> \ No newline at end of file 1.1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/config/jboss/components.xml.vsl Index: components.xml.vsl =================================================================== #parse("templates/ejb3/common/JNDIMacros.vm") <?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.1.xsd http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.1.xsd"> #foreach ($service in $services) #**##if ($service.seamComponent) #localJndiName($service true) <component name="${service.seamComponentName}" class="${service.fullyQualifiedServiceName}" scope="${service.seamComponentScopeType}" jndi-name="${jndiName}"/> #**##end #end #foreach ($entity in $entities) #**##if ($entity.seamComponent) <component name="${entity.seamComponentName}" class="${entity.fullyQualifiedEntityName}" scope="${entity.seamComponentScopeType}"/> #**##end #end <!-- seam-components merge-point --> </components> 1.53 +284 -262 cartridges/andromda-ejb3/src/main/uml/EJB3MetafacadeModel.xml.zip <<Binary file>> |