From: Vance K. <va...@us...> - 2006-01-03 01:04:47
|
User: vancek Date: 06/01/02 17:04:40 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: fixed to include ejb3 annotations Revision Changes Path 1.2 +146 -363 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.1 retrieving revision 1.2 diff -u -w -r1.1 -r1.2 --- SessionBean.vsl 28 Dec 2005 00:32:55 -0000 1.1 +++ SessionBean.vsl 3 Jan 2006 01:04:39 -0000 1.2 @@ -5,422 +5,205 @@ #end /** - * Autogenerated EJB implementation class for the ${service.serviceName} session bean. -$service.getDocumentation(" * ") - * -#if ($service.abstract) - * @ejb.bean generate="false" -#else - * @ejb.bean generate="true" -#end - * name="$service.name" - * type="$service.type" - * view-type="$service.viewType" - * jndi-name = "${service.jndiName}/Remote" - * local-jndi-name = "${service.jndiName}/Local" - * - * @ejb.interface - * local-class="${service.fullyQualifiedName}Local" - * remote-class="${service.fullyQualifiedName}" - * @ejb.home - * local-class="${service.fullyQualifiedName}LocalHome" - * remote-class="${service.fullyQualifiedName}Home" - * @ejb.transaction type="$service.transactionType" + * Autogenerated EJB entity POJO class for the ${service.serviceName} session bean. * - * @ejb.util generate="physical" - * -#foreach($envEntry in $service.getEnvironmentEntries(true)) -#set ($value = $envEntry.defaultValue) -## Add string delimiters if they are not already present -#if (!$value.startsWith('"') || !$value.endsWith('"')) -#set ($value = "$value") -#end - * @ejb.env-entry - * name="$envEntry.name" - * type="$envEntry.type.fullyQualifiedName" - * value="$value" - * -#end -#foreach ( $dependency in $service.sourceDependencies ) -#if ($dependency.hasStereotype("EntityRef") || $dependency.hasStereotype("ServiceRef")) -#set ($reference = $dependency.targetElement) - * @ejb.ejb-ref - * ejb-name="${reference.name}" - * view-type="$reference.viewType" - * ref-name="ejb/${reference.name}BeanRef" - * -#end -#if ($dependency.hasStereotype("ResourceRef")) -#set ($reference = $dependency.targetElement) -#set ($jndiRef = $dependency.findTaggedValue("@andromda.ejb.resource-ref.jndi-name")) -#set ($resAuth = $dependency.findTaggedValue("@andromda.ejb.resource-ref.res-auth")) -#if (!$resAuth) -#set ($resAuth = "Container") -#end -#set ($resName = $dependency.name) -#if (!$resName) -#set ($resName = $reference.name) -#end - * @ejb.resource-ref - * res-ref-name="resource/$resName" - * res-type="${reference.fullyQualifiedName}" - * res-auth="$resAuth" - * -#if ($jndiRef) - * @jboss.resource-ref - * res-ref-name = "resource/$resName" - * jndi-name = "$jndiRef" +$service.getDocumentation(" * ") * - * @weblogic.resource-description - * res-ref-name= "resource/$resName" - * jndi-name= "$jndiRef" * - * @websphere.bean -#end -#end -#end */ +@javax.ejb.${service.type} +#if ($service.transactionType) +...@ja...ansactionAttribute(javax.ejb.TransactionAttributeType.${service.transactionType}) +#end +...@ja...llbackListener(${service.fullyQualifiedServiceListenerName}.class) +#if ($service.securityDomain) +#**##if ($service.persistenceContainerJboss) +...@or...curityDomain("${service.securityDomain}") +#**##end +#end +#if ($service.permitAll) +...@ja...rmitAll +#elseif ($service.rolesAllowed) +...@ja...lesAllowed({${service.rolesAllowed}}) +#end public abstract class ${service.serviceName} #if($service.generalization) extends ${service.generalization.fullyQualifiedName}BeanImpl #end - implements javax.ejb.SessionBean + implements ${service.fullyQualifiedServiceLocalInterfaceName}, ${service.fullyQualifiedServiceRemoteInterfaceName} { - // ----------- constant definitions ----------- -#foreach($constant in $service.getConstants(true)) - private static final $constant.type.fullyQualifiedName $constant.name = $constant.defaultValue; -#end + // ------ Session Context Injection ------ + @javax.annotation.Resource + javax.ejb.SessionContext context; - // -- accessors for environment entries -- -#foreach($envEntry in $service.getEnvironmentEntries(true)) - /** - * Get <em>${envEntry.name}</em> environment entry. -$envEntry.getDocumentation(" * ") - * -## Only expose the method to the component interface if it is public. -#set ($visibility = $envEntry.visibility) -#if($visibility == "public") - * @ejb.interface-method -#end - */ - $visibility $envEntry.type.fullyQualifiedName ${envEntry.getterName}() - { - javax.naming.InitialContext initialContext = null; - try - { - initialContext = new javax.naming.InitialContext(); - return (${envEntry.type.fullyQualifiedName}) initialContext.lookup("java:comp/env/$envEntry.name"); - } - catch (javax.naming.NamingException cause) - { - RuntimeException ex = new IllegalStateException( - "Cannot access environment entry \"$envEntry.name\"."); - // In order to set the exception cause on JDK 1.4 - // and stay JDK 1.3 compatible nonetheless, we need - // a bit of reflection magic here... - try - { - java.lang.reflect.Method initCause = - ex.getClass().getMethod("initCause", - new Class[] {Throwable.class}); - initCause.invoke(ex, new Object[] { cause }); - } - catch (Throwable t) - { - // Ignore any errors here - we simply make do without the cause - } - throw ex; - } - finally - { - try - { - if (initialContext != null) - { - initialContext.close(); - } - } - catch (javax.naming.NamingException ignore) - { - // Silently ignore naming exceptions at cleanup time - } - } - } -#end + // ------ Persistence Context Definitions -------- - // -- accessors for constants -- -#foreach($constant in $service.getConstants(true)) +#set ($argExists = false) /** - * Get the <code>$constant.name</code> constant -$constant.getDocumentation(" * ") -#if ($constant.visibility == "public") - * - * @ejb.interface-method -#end - $constant.visibility $constant.type.fullyQualifiedName ${constant.getterName}() - { - return $constant.name; - } - -## If the constant is public, expose it to the home interface as well -#if($constant.visibility == "public") + * Inject persistence context #if ($service.persistenceContextUnitName)${service.persistenceContextUnitName}#end - /** - * Home interface method for accessing {@link #${attribute.getterName}}. - * @ejb.home-method - * @see #${constant.getterName} */ - public $constant.type.fullyQualifiedName ejbHomeGet${constant.name}() - { - return ${constant.getterName}; - } -#end -#end + @javax.persistence.PersistenceContext#if ($service.persistenceContextUnitName || $service.persistenceContextType)(#end#if ($service.persistenceContextUnitName)unitName = "${service.persistenceContextUnitName}"#set ($argExists = true)#end#if ($service.persistenceContextType)#if ($argExists),#end type = javax.persistence.PersistenceContextType.${service.persistenceContextType}#end#if ($service.persistenceContextUnitName || $service.persistenceContextType))#end -#set ($instanceAttributes = $service.instanceAttributes) -#if(!$instanceAttributes.empty) - // --------------- attributes --------------------- -#foreach ( $attribute in $instanceAttributes) -#set ($visibility = $attribute.visibility) - /** The $attribute.name property */ - private $attribute.type.fullyQualifiedName $attribute.name; + protected javax.persistence.EntityManager emanager; +#foreach ($reference in $service.persistenceContextReferences) +#**##set ($persistenceContext = $reference.targetElement) +#**##set ($argExists = false) /** - * Get the ${attribute.name} property -$attribute.getDocumentation(" * ") - * -#if ($attribute.transactionType) - * @ejb.transaction type="$attribute.transactionType" -#end -#if($visibility == "public") - * @ejb.interface-method -#end - */ - $visibility $attribute.type.fullyQualifiedName ${attribute.getterName}() - { - return $attribute.name; - } + * Inject persistence context #if ($persistenceContext.persistenceContextUnitName)${persistenceContext.persistenceContextUnitName}#end -## Only generate a setter if the attribute is not read-only -## Note: It's no use to generate final fields for read-only attributes because -## the fields are likely to be initialized in ejbActivate() or a similiar -## method and not in the constructor. -#if (!$attribute.readOnly) - /** - * Set the $attribute.name property - * @param value the new value -#if($visibility == "public") - * @ejb.interface-method -#end -#if ($attribute.transactionType) - * @ejb.transaction type="$attribute.transactionType" -#end */ - $visibility void ${attribute.setterName}($attribute.type.fullyQualifiedName value) - { - this.$attribute.name = value; - } - -#end + @javax.persistence.PersistenceContext#if ($persistenceContext.persistenceContextUnitName || $persistenceContext.persistenceContextType)(#end#if ($persistenceContext.persistenceContextUnitName)unitName = "${persistenceContext.persistenceContextUnitName}"#set ($argExists = true)#end#if ($persistenceContext.persistenceContextType)#if ($argExists),#end type = javax.persistence.PersistenceContextType.${persistenceContext.persistenceContextType}#end#if ($persistenceContext.persistenceContextUnitName || $persistenceContext.persistenceContextType))#end + protected javax.persistence.EntityManager ${persistenceContext.name}; #end -#end - // ---------------- business methods ---------------------- +#set ($references = $service.serviceReferences) +#if (!$references.empty) +#**##foreach ($dependency in $references) +#* *##set ($reference = $dependency.targetElement) + + // ------ EJB Injection Definitions -------- -#foreach ( $operation in $service.businessOperations) -#set ($visibility = $operation.visibility) /** -$operation.getDocumentation(" * ") -## Only public methods have transactions and are exported to the interfaces -#if ($visibility == "public") - * @ejb.interface-method -#if ($operation.transactionType) - * @ejb.transaction type="$operation.transactionType" -#end -#end + * Inject session EJB ${reference.name}; */ -#set ($returnType = $operation.returnType.fullyQualifiedName) -#if ($operation.exceptionsPresent) - $visibility abstract $returnType $operation.signature throws $operation.exceptionList; -#else - $visibility abstract $returnType $operation.signature; + @javax.annotation.EJB + protected ${reference.fullyQualifiedServiceName} $stringUtils.uncapitalize(${reference.name}); +#**##end #end +#set ($constants = $service.getConstants(true)) +#if (!$constants.empty) + // ----------- Constant Definitions ----------- + +#**##foreach($constant in $constants) + private static final $constant.type.fullyQualifiedName $constant.name = $constant.defaultValue; +#**##end #end +#set ($instanceAttributes = $service.instanceAttributes) +#if(!$instanceAttributes.empty) - // ---------------- create methods -------------------- -## Handle explicitly defined create methods. Since we can't know -## what the user intended to do with the arbitrary parameters to these methods, -## we generate an abstract ejbCreate() and delegate the implementation to the user. -#foreach ( $operation in $service.getCreateMethods(false)) + // ------------ Attributes ------------------ - /** -$operation.getDocumentation(" * ") - * - * @ejb.create-method - */ - public abstract void ejbCreate($operation.typedArgumentList); - - public void ejbPostCreate($operation.typedArgumentList) - { - } +#**##foreach ($attribute in $instanceAttributes) + /** The $attribute.name property */ + private $attribute.type.fullyQualifiedName $attribute.name; +#**##end #end -## Default create method with no arguments. - /** -## Only expose the method to the interface for concrete EJBs -#if (!$service.abstract) - * @ejb.create-method -#end - */ - public void ejbCreate() throws javax.ejb.CreateException - { - } + // --------------- Constructors --------------- - public void ejbPostCreate() throws javax.ejb.CreateException +## Default create method with no arguments. + public ${service.serviceName}() { + super(); } - ## Autogenerated create method with all attributes. Only present for stateful beans. #set ($allAttributes = $service.allInstanceAttributes) #if (!$allAttributes.empty) + /** - * Create method with all attribute values. -#set ($inheritedAttributes = $service.inheritedInstanceAttributes) -#foreach($attribute in $allAttributes) + * Constructor with all attribute values. +#**##set ($inheritedAttributes = $service.inheritedInstanceAttributes) +#**##foreach($attribute in $allAttributes) * @param $attribute.name Value for the ${attribute.name} property -#end - * @ejb.create-method +#**##end */ - public void ejbCreate($transform.getAttributesAsList($allAttributes, true, true)) - throws javax.ejb.CreateException + public ${service.serviceName}($service.getAttributesAsList($allAttributes, true, true)) { -#if(!$inheritedAttributes.empty) - // Call ejbCreate method for the super type - super.ejbCreate($transform.getAttributesAsList($inheritedAttributes, false, true)); -#end -#foreach ( $attribute in $service.instanceAttributes) +#**##if(!$inheritedAttributes.empty) + super($service.getAttributesAsList($inheritedAttributes, false, true)); +#**##end +#**##foreach ($attribute in $service.instanceAttributes) ## Don't use a setter here - we may have none if the attribute is marked readonly this.$attribute.name = $attribute.name; -#end - } - - public void ejbPostCreate($transform.getAttributesAsList($allAttributes, true, true)) - throws javax.ejb.CreateException - { -#if(!$inheritedAttributes.empty) - // Call postCreate method for the super type - super.ejbPostCreate($transform.getAttributesAsList($inheritedAttributes, false, true)); -#end +#**##end } #end +#if (!$constants.empty) - // ---------------- accessor methods for bean references --------------- + // --------- Accessors for Constants ---------- -#foreach ( $dependency in $service.sourceDependencies ) -#if ($dependency.hasStereotype("EntityRef") || $dependency.hasStereotype("ServiceRef")) -#set ($reference = $dependency.targetElement) -#if ($reference.viewType == "local") -#set ($homeInterfaceName = "${reference.name}LocalHome") -#set ($fqHomeInterfaceName = "${reference.fullyQualifiedName}LocalHome") +#**##foreach($constant in $constants) +#* *##if ($constant.visibility == "public") /** - * Get the local home interface of the ${reference.name} bean. - * The home interface is obtained from the initial context - * by looking up the bean reference name. - * @return local home interface for ${reference.name}. + * Get the <code>$constant.name</code> constant +$constant.getDocumentation(" * ") */ - protected static ${fqHomeInterfaceName} get${homeInterfaceName}() - throws javax.naming.NamingException - { - javax.naming.InitialContext initialContext = new javax.naming.InitialContext(); - try - { - // Local homes shouldn't be narrowed, as there is no RMI involved. - ${fqHomeInterfaceName} home = - (${fqHomeInterfaceName}) initialContext.lookup("java:/comp/env/ejb/${reference.name}BeanRef"); - return home; - } - finally + $constant.visibility $constant.type.fullyQualifiedName ${constant.getterName}() { - initialContext.close(); - } + return $constant.name; } + +#* *##end +#**##end #end -#if ($reference.viewType == "remote") -#set ($homeInterfaceName = "${reference.name}Home") -#set ($fqHomeInterfaceName = "${reference.fullyQualifiedName}Home") +#if(!$instanceAttributes.empty) + + // ------- Accessors for Attributes ---------- + +#**##foreach ($attribute in $instanceAttributes) +#* *##set ($visibility = $attribute.visibility) +#* *##if ($visibility == "public") /** - * Get the remote home interface of the ${reference.name} bean. - * The home interface is obtained from the initial context - * by looking up the bean reference name. - * @return remote home interface for ${reference.name}. Lookup using bean ref name. + * Get the ${attribute.name} property +$attribute.getDocumentation(" * ") */ - protected static ${fqHomeInterfaceName} get${homeInterfaceName}() - throws javax.naming.NamingException { - javax.naming.InitialContext initialContext = new javax.naming.InitialContext(); - try - { - Object home = - initialContext.lookup("java:/comp/env/ejb/${reference.name}BeanRef"); - return ($fqHomeInterfaceName) - javax.rmi.PortableRemoteObject.narrow(home, - ${fqHomeInterfaceName}.class); - } - finally +#* *##if ($attribute.transactionType) + @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${attribute.transactionType}) +#* *##end + $visibility $attribute.type.fullyQualifiedName ${attribute.getterName}() { - initialContext.close(); - } + return $attribute.name; } -#end -#end -#if ($dependency.hasStereotype("ResourceRef")) -#set ($reference = $dependency.targetElement) -#set ($resClassName = "$referencedClass.fullyQualifiedName}") -#set ($resName = $dependency.name) -#if (!$resName) -#set ($resName = $reference.name) -#end +## Only generate a setter if the attribute is not read-only +#* *##if (!$attribute.readOnly) + /** - * Get the ${resName} resource. - * The resource is obtained by looking up - * <code>java:/comp/env/resource/$resName</code> in JNDI - * @return the ${resName} resource + * Set the $attribute.name property + * @param value the new value */ - protected static ${resClassName} get${stringUtils.capitalize($resName)}() - throws javax.naming.NamingException - { - javax.naming.InitialContext initialContext = - new javax.naming.InitialContext(); - try - { - Object resource = - initialContext.lookup("java:/comp/env/resource/$resName"); - return ($resClassName) resource; - } - finally - { - initialContext.close(); - } - } -#end -#end - - private javax.ejb.SessionContext context; - - public void setSessionContext(javax.ejb.SessionContext ctx) - { - context = ctx; - } - - public void ejbRemove() +#* *##if ($attribute.transactionType) + @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${attribute.transactionType}) +#* *##end + $visibility void ${attribute.setterName}($attribute.type.fullyQualifiedName value) { + this.$attribute.name = value; } - public void ejbPassivate() - { - } +#* *##end +#* *##end +#**##end +#end +#set ($operations = $service.businessOperations) +#if (!$operations.empty) + + // -------- Business Methods -------------- + +#**##foreach ($operation in $operations) +#* *##set ($visibility = $operation.visibility) +#* *##if ($visibility == "public") + /** +$operation.getDocumentation(" * ") +## Only public methods have transactions and are exported to the interfaces + */ +#* *##if ($operation.transactionType) + @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${operation.transactionType}) +#* *##end +#* *##if ($operation.permitAll) + @javax.annotation.security.PermitAll +#* *##elseif ($operation.rolesAllowed) + @javax.annotation.security.RolesAllowed({${operation.rolesAllowed}}) +#* *##end +#* *##set ($returnType = $operation.returnType.fullyQualifiedName) +#* *##if ($operation.exceptionsPresent) + $visibility abstract $returnType $operation.signature throws $operation.exceptionList; +#* *##else + $visibility abstract $returnType $operation.signature; +#* *##end - public void ejbActivate() - { - } +#* *##end +#**##end +#end } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-01-06 13:50:24
|
User: vancek Date: 06/01/06 05:49:35 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: added transaction management annotation, denyAll & runAs annotations, UserTransaction resource injection, queue and queue connection factory resource injections. Revision Changes Path 1.3 +67 -12 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -w -r1.2 -r1.3 --- SessionBean.vsl 3 Jan 2006 01:04:39 -0000 1.2 +++ SessionBean.vsl 6 Jan 2006 13:49:34 -0000 1.3 @@ -8,12 +8,15 @@ * Autogenerated EJB entity POJO class for the ${service.serviceName} session bean. * $service.getDocumentation(" * ") - * - * */ @javax.ejb.${service.type} -#if ($service.transactionType) +#if ($service.transactionManagement) +...@ja...ansactionManagement(javax.ejb.TransactionManagementType.${service.transactionManagement}) +#end +#if (!$service.transactionManagementBean) +#**##if ($service.transactionType) @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${service.transactionType}) +#**##end #end @javax.ejb.CallbackListener(${service.fullyQualifiedServiceListenerName}.class) #if ($service.securityDomain) @@ -23,9 +26,14 @@ #end #if ($service.permitAll) @javax.annotation.security.PermitAll +#elseif ($service.denyAll) +...@ja...nyAll #elseif ($service.rolesAllowed) @javax.annotation.security.RolesAllowed({${service.rolesAllowed}}) #end +#if ($service.runAs) +...@ja...nAs("${service.runAs}") +#end public abstract class ${service.serviceName} #if($service.generalization) extends ${service.generalization.fullyQualifiedName}BeanImpl @@ -35,7 +43,14 @@ // ------ Session Context Injection ------ @javax.annotation.Resource - javax.ejb.SessionContext context; + protected javax.ejb.SessionContext context; +#if ($service.transactionManagementBean) + + // ---------- User Transaction Injection --------- + + @javax.annotation.Resource + protected javax.transaction.UserTransaction userTrans; +#end // ------ Persistence Context Definitions -------- @@ -60,18 +75,47 @@ #end #set ($references = $service.serviceReferences) #if (!$references.empty) -#**##foreach ($dependency in $references) -#* *##set ($reference = $dependency.targetElement) // ------ EJB Injection Definitions -------- +#**##foreach ($dependency in $references) +#* *##set ($reference = $dependency.targetElement) /** - * Inject session EJB ${reference.name}; + * Inject session EJB ${reference.name} */ @javax.annotation.EJB protected ${reference.fullyQualifiedServiceName} $stringUtils.uncapitalize(${reference.name}); #**##end #end +#set ($mdbReferences = $service.messageDrivenReferences) +#if (!$mdbReferences.empty) + + // ------ Message Driven EJB Injection Definitions -------- + +#**##foreach ($dependency in $mdbReferences) +#* *##set ($reference = $dependency.targetElement) +#* *##if ($reference.destinationTypeQueue) +#* *##if (!$queueConnectionFactoryDefined) + @javax.annotation.Resource(name = "ConnectionFactory") + protected javax.jms.QueueConnectionFactory queueFactory; +#* *##set ($queueConnectionFactoryDefined = true) + +#* *##end +#* *##elseif ($reference.destinationTypeTopic) +#* *##if (!$topicConnectionFactoryDefined) + @javax.annotation.Resource(name = "ConnectionFactory") + protected javax.jms.TopicConnectionFactory topicFactory; +#* *##set ($topicConnectionFactoryDefined = true) + +#* *##end +#* *##end + /** + * Inject ${reference.destinationType} + */ + @javax.annotation.Resource(name = "${reference.destination}") + protected #if ($reference.destinationTypeQueue)javax.jms.Queue#elseif ($reference.destinationTypeTopic)javax.jms.Topic#end $stringUtils.uncapitalize(${reference.name}); +#**##end +#end #set ($constants = $service.getConstants(true)) #if (!$constants.empty) @@ -150,9 +194,11 @@ * Get the ${attribute.name} property $attribute.getDocumentation(" * ") */ +#* *##if (!$service.transactionManagementBean) #* *##if ($attribute.transactionType) @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${attribute.transactionType}) #* *##end +#* *##end $visibility $attribute.type.fullyQualifiedName ${attribute.getterName}() { return $attribute.name; @@ -164,9 +210,11 @@ * Set the $attribute.name property * @param value the new value */ +#* *##if (!$service.transactionManagementBean) #* *##if ($attribute.transactionType) @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${attribute.transactionType}) #* *##end +#* *##end $visibility void ${attribute.setterName}($attribute.type.fullyQualifiedName value) { this.$attribute.name = value; @@ -183,19 +231,26 @@ #**##foreach ($operation in $operations) #* *##set ($visibility = $operation.visibility) +## Only public methods have transactions and are exported to the interfaces #* *##if ($visibility == "public") /** $operation.getDocumentation(" * ") -## Only public methods have transactions and are exported to the interfaces */ +#* *##if (!$service.transactionManagementBean) #* *##if ($operation.transactionType) @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${operation.transactionType}) #* *##end +#* *##end #* *##if ($operation.permitAll) @javax.annotation.security.PermitAll +#* *##elseif ($operation.denyAll) + @javax.annotation.security.DenyAll #* *##elseif ($operation.rolesAllowed) @javax.annotation.security.RolesAllowed({${operation.rolesAllowed}}) #* *##end +#* *##if ($operation.flushMode) + @javax.persistence.FlushMode(javax.persistence.FlushModeType.${operation.flushMode}) +#* *##end #* *##set ($returnType = $operation.returnType.fullyQualifiedName) #* *##if ($operation.exceptionsPresent) $visibility abstract $returnType $operation.signature throws $operation.exceptionList; |
From: Vance K. <va...@us...> - 2006-01-17 03:13:55
|
User: vancek Date: 06/01/16 19:13:49 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: changed securityDomain to securityRealm, added RemoteBinding & LocalBinding annotations for setting JNDI names, moved Local and Remote annotation to session bean from interface classes, added Interceptor annotation Revision Changes Path 1.5 +33 -6 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -r1.4 -r1.5 --- SessionBean.vsl 10 Jan 2006 08:11:09 -0000 1.4 +++ SessionBean.vsl 17 Jan 2006 03:13:48 -0000 1.5 @@ -3,6 +3,7 @@ #if ($stringUtils.isNotBlank($service.packageName)) package $service.packageName; #end +#set ($generatedFile = "${stringUtils.replace($service.fullyQualifiedServiceName,'.','/')}.java") /** * Autogenerated EJB entity POJO class for the ${service.serviceName} session bean. @@ -19,9 +20,9 @@ #**##end #end @javax.ejb.CallbackListener(${service.fullyQualifiedServiceListenerName}.class) -#if ($service.securityDomain) +#if ($stringUtils.isNotBlank($service.securityRealm)) #**##if ($service.persistenceContainerJboss) -...@or...curityDomain("${service.securityDomain}") +...@or...curityDomain("${service.securityRealm}") #**##end #end #if ($service.permitAll) @@ -34,11 +35,34 @@ #if ($service.runAs) @javax.annotation.security.RunAs("${service.runAs}") #end +#if ($service.jndiNameRemote) +#**##if ($service.persistenceContainerJboss) +...@or...moteBinding(jndiBinding = "${service.jndiNameRemote}") +#**##end +#end +#if ($service.jndiNameLocal) +#**##if ($service.persistenceContainerJboss) +...@or...notation.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 +#set ($interceptors = $service.interceptorReferences) +#if ($collectionUtils.size($interceptors) == 1) +...@ja...erceptor($service.getInterceptorsAsList($interceptors)) +#elseif ($collectionUtils.size($interceptors) > 1) +...@ja...erceptors({$service.getInterceptorsAsList($interceptors)}) +#end public abstract class ${service.serviceName} #if($service.generalization) extends ${service.generalization.fullyQualifiedName}BeanImpl #end - implements ${service.fullyQualifiedServiceLocalInterfaceName}, ${service.fullyQualifiedServiceRemoteInterfaceName} + implements#if ($service.viewTypeLocal) ${service.fullyQualifiedServiceLocalInterfaceName}#if ($service.viewTypeRemote),#end#end#if ($service.viewTypeRemote) ${service.fullyQualifiedServiceRemoteInterfaceName}#end + { // ------ Session Context Injection ------ @@ -96,14 +120,16 @@ #* *##set ($reference = $dependency.targetElement) #* *##if ($reference.destinationTypeQueue) #* *##if (!$queueConnectionFactoryDefined) - @javax.annotation.Resource(name = "ConnectionFactory") +## NOTE: CHANGE TO USE mappedName + @javax.annotation.Resource(name = "ConnectionFactory", type = javax.jms.QueueConnectionFactory.class) protected javax.jms.QueueConnectionFactory queueFactory; #* *##set ($queueConnectionFactoryDefined = true) #* *##end #* *##elseif ($reference.destinationTypeTopic) #* *##if (!$topicConnectionFactoryDefined) - @javax.annotation.Resource(name = "ConnectionFactory") +## NOTE: CHANGE TO USE mappedName + @javax.annotation.Resource(name = "ConnectionFactory", type = javax.jms.TopicConnectionFactory.class) protected javax.jms.TopicConnectionFactory topicFactory; #* *##set ($topicConnectionFactoryDefined = true) @@ -112,7 +138,8 @@ /** * Inject ${reference.destinationType} */ - @javax.annotation.Resource(name = "${reference.destination}") + @javax.annotation.Resource(name = "${reference.destination}", type = #if ($reference.destinationTypeQueue)javax.jms.Queue.class#elseif ($reference.destinationTypeTopic)javax.jms.Topic.class#end) + ## NOTE: CHANGE TO USE mappedName protected #if ($reference.destinationTypeQueue)javax.jms.Queue#elseif ($reference.destinationTypeTopic)javax.jms.Topic#end $stringUtils.uncapitalize(${reference.name}); #**##end #end |
From: Vance K. <va...@us...> - 2006-01-18 09:38:14
|
User: vancek Date: 06/01/18 01:38:07 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: removed @javax.ejb.Stateless/@javax.ejb.Stateful annotation - cause double up of session bean registration and failure to associate remote interface. now regisration is done via ejb-jar.xml descriptor. added @javax.ejb.Timeout annotation for session beans to register the callback with the Timer Service. Revision Changes Path 1.6 +8 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -w -r1.5 -r1.6 --- SessionBean.vsl 17 Jan 2006 03:13:48 -0000 1.5 +++ SessionBean.vsl 18 Jan 2006 09:38:04 -0000 1.6 @@ -10,7 +10,11 @@ * $service.getDocumentation(" * ") */ -@javax.ejb.${service.type} +/** + * Do not specify the javax.ejb.${service.type} annotation + * Instead, define the session bean in the ejb-jar.xml descriptor + * javax.ejb.${service.type} + */ #if ($service.transactionManagement) @javax.ejb.TransactionManagement(javax.ejb.TransactionManagementType.${service.transactionManagement}) #end @@ -278,6 +282,9 @@ #* *##if ($operation.flushMode) @javax.persistence.FlushMode(javax.persistence.FlushModeType.${operation.flushMode}) #* *##end +#* *##if ($operation.timeoutCallback) + @javax.ejb.Timeout +#* *##end #* *##set ($returnType = $operation.returnType.fullyQualifiedName) #* *##if ($operation.exceptionsPresent) $visibility abstract $returnType $operation.signature $operation.throwsClause; |
From: Vance K. <va...@us...> - 2006-01-20 17:15:43
|
User: vancek Date: 06/01/20 09:15:29 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: Resource annotation now uses mappedName parameter for ConnectionFactory, Queue and Topics Revision Changes Path 1.7 +5 -7 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -w -r1.6 -r1.7 --- SessionBean.vsl 18 Jan 2006 09:38:04 -0000 1.6 +++ SessionBean.vsl 20 Jan 2006 17:15:27 -0000 1.7 @@ -124,16 +124,14 @@ #* *##set ($reference = $dependency.targetElement) #* *##if ($reference.destinationTypeQueue) #* *##if (!$queueConnectionFactoryDefined) -## NOTE: CHANGE TO USE mappedName - @javax.annotation.Resource(name = "ConnectionFactory", type = javax.jms.QueueConnectionFactory.class) + @javax.annotation.Resource(mappedName = "ConnectionFactory") protected javax.jms.QueueConnectionFactory queueFactory; #* *##set ($queueConnectionFactoryDefined = true) #* *##end #* *##elseif ($reference.destinationTypeTopic) #* *##if (!$topicConnectionFactoryDefined) -## NOTE: CHANGE TO USE mappedName - @javax.annotation.Resource(name = "ConnectionFactory", type = javax.jms.TopicConnectionFactory.class) + @javax.annotation.Resource(mappedName = "ConnectionFactory") protected javax.jms.TopicConnectionFactory topicFactory; #* *##set ($topicConnectionFactoryDefined = true) @@ -142,9 +140,9 @@ /** * Inject ${reference.destinationType} */ - @javax.annotation.Resource(name = "${reference.destination}", type = #if ($reference.destinationTypeQueue)javax.jms.Queue.class#elseif ($reference.destinationTypeTopic)javax.jms.Topic.class#end) + @javax.annotation.Resource(mappedName = "${reference.destination}") ## NOTE: CHANGE TO USE mappedName - protected #if ($reference.destinationTypeQueue)javax.jms.Queue#elseif ($reference.destinationTypeTopic)javax.jms.Topic#end $stringUtils.uncapitalize(${reference.name}); + protected javax.jms.Destination $stringUtils.uncapitalize(${reference.name}); #**##end #end #set ($constants = $service.getConstants(true)) |
From: Vance K. <va...@us...> - 2006-01-21 03:43:10
|
User: vancek Date: 06/01/20 19:43:02 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: fixed EJB injection - type is remote interface not bean class Revision Changes Path 1.8 +1 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -w -r1.7 -r1.8 --- SessionBean.vsl 20 Jan 2006 17:15:27 -0000 1.7 +++ SessionBean.vsl 21 Jan 2006 03:43:02 -0000 1.8 @@ -112,7 +112,7 @@ * Inject session EJB ${reference.name} */ @javax.annotation.EJB - protected ${reference.fullyQualifiedServiceName} $stringUtils.uncapitalize(${reference.name}); + protected ${reference.fullyQualifiedServiceRemoteInterfaceName} $stringUtils.uncapitalize(${reference.name}); #**##end #end #set ($mdbReferences = $service.messageDrivenReferences) |
From: Vance K. <va...@us...> - 2006-01-25 02:55:24
|
User: vancek Date: 06/01/24 18:55:18 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: fixed comment Revision Changes Path 1.10 +1 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -r1.9 -r1.10 --- SessionBean.vsl 22 Jan 2006 06:21:55 -0000 1.9 +++ SessionBean.vsl 25 Jan 2006 02:55:17 -0000 1.10 @@ -157,7 +157,7 @@ #set ($instanceAttributes = $service.instanceAttributes) #if(!$instanceAttributes.empty) - // ------------ Attributes ------------------ + // --------- Attribute Definitions ------------ #**##foreach ($attribute in $instanceAttributes) /** |
From: Vance K. <va...@us...> - 2006-01-28 02:49:21
|
User: vancek Date: 06/01/27 18:49:15 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: added Globals.vm inclusion, session operations are no longer abstract; their implementation checks for null args, perform a preconditial call if required and call handle<operation name>; added an abstract operation handle<operation name> for every operation which is implemented in the subclass. Revision Changes Path 1.11 +69 -19 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -w -r1.10 -r1.11 --- SessionBean.vsl 25 Jan 2006 02:55:17 -0000 1.10 +++ SessionBean.vsl 28 Jan 2006 02:49:15 -0000 1.11 @@ -1,5 +1,6 @@ // license-header java merge-point /* Autogenerated by AndroMDA (SessionBean.vsl) - do not edit */ +#parse("templates/ejb3/Globals.vm") #if ($stringUtils.isNotBlank($service.packageName)) package $service.packageName; #end @@ -278,9 +279,6 @@ // -------- Business Methods -------------- #**##foreach ($operation in $operations) -#* *##set ($visibility = $operation.visibility) -## Only public methods have transactions and are exported to the interfaces -#* *##if ($visibility == "public") /** $operation.getDocumentation(" * ") */ @@ -302,14 +300,66 @@ #* *##if ($operation.timeoutCallback) @javax.ejb.Timeout #* *##end -#* *##set ($returnType = $operation.returnType.fullyQualifiedName) + $operation.visibility $operation.returnType.fullyQualifiedName $operation.signature #* *##if ($operation.exceptionsPresent) - $visibility abstract $returnType $operation.signature $operation.throwsClause; + $operation.throwsClause +#* *##end + { +#* *##if ($requiredCheckEnabled) +#* *##foreach ($argument in $operation.arguments) +#* *##if ($argument.required && !$argument.type.primitive) + if ($argument.name == null) + { + throw new IllegalArgumentException( + "${service.fullyQualifiedServiceName}.${operation.signature} - '${argument.name}' can not be null"); + } +#* *##end +#* *##end +#* *##end +#if ($operation.constraintsPresent) + this.$operation.preconditionCall; +#end + try + { +#* *##set ($call = "this.${operation.implementationCall};") +#* *##if ($operation.returnTypePresent) + return $call #* *##else - $visibility abstract $returnType $operation.signature; + $call +#* *##end + } +#* *##foreach($exception in $operation.exceptions) + catch ($exception.fullyQualifiedName ex) + { + throw ex; + } +#* *##end +#* *##if ($service.allowDefaultServiceException) + catch (Throwable th) + { + throw new ${service.fullyQualifiedDefaultExceptionName}( + "Error performing '${service.fullyQualifiedName}.${operation.signature}' --> " + th, + th); + } #* *##end + } + +#* *##if ($operation.constraintsPresent) + /** + * Performs any precondition checks for {@link #${operation.call}}. + */ + private void $operation.preconditionSignature + { +#renderPreconditions($operation) + } #* *##end + /** + * Performs the core logic for {@link #${operation.getSignature(false)}} + */ + protected abstract $operation.returnType.fullyQualifiedName $operation.implementationSignature + throws java.lang.Exception; + #**##end #end } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-01-29 01:49:10
|
User: vancek Date: 06/01/28 17:49:01 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: the listener annotation is included only if listenerEnabled is true Revision Changes Path 1.12 +5 -3 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.11 retrieving revision 1.12 diff -u -w -r1.11 -r1.12 --- SessionBean.vsl 28 Jan 2006 02:49:15 -0000 1.11 +++ SessionBean.vsl 29 Jan 2006 01:49:00 -0000 1.12 @@ -24,7 +24,9 @@ @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${service.transactionType}) #**##end #end +#if ($service.listenerEnabled) @javax.ejb.CallbackListener(${service.fullyQualifiedServiceListenerName}.class) +#end #if ($stringUtils.isNotBlank($service.securityRealm)) #**##if ($service.persistenceContainerJboss) @org.jboss.annotation.security.SecurityDomain("${service.securityRealm}") |
From: Vance K. <va...@us...> - 2006-02-06 03:12:36
|
User: vancek Date: 06/02/05 19:12:29 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: renamed @Interceptor to @Interceptors removed @CallbackListener @Interceptors not include lifecycle callback listener @Interceptors now applied on session bean methods added @ExcludeDefaultInterceptors and @ExcludeClassInterceptors fixed casing for EntityManager variable name when persistent context references exist Revision Changes Path 1.13 +35 -8 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -r1.12 -r1.13 --- SessionBean.vsl 29 Jan 2006 01:49:00 -0000 1.12 +++ SessionBean.vsl 6 Feb 2006 03:12:29 -0000 1.13 @@ -24,9 +24,6 @@ @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${service.transactionType}) #**##end #end -#if ($service.listenerEnabled) -...@ja...llbackListener(${service.fullyQualifiedServiceListenerName}.class) -#end #if ($stringUtils.isNotBlank($service.securityRealm)) #**##if ($service.persistenceContainerJboss) @org.jboss.annotation.security.SecurityDomain("${service.securityRealm}") @@ -58,11 +55,17 @@ #if ($service.viewTypeRemote) @javax.ejb.Remote({${service.fullyQualifiedServiceRemoteInterfaceName}.class}) #end +## +## Service listener - lifecycle callbacks is defined as an interceptor +## #set ($interceptors = $service.interceptorReferences) -#if ($collectionUtils.size($interceptors) == 1) -...@ja...erceptor($service.getInterceptorsAsList($interceptors)) -#elseif ($collectionUtils.size($interceptors) > 1) -...@ja...erceptors({$service.getInterceptorsAsList($interceptors)}) +#if ($collectionUtils.size($interceptors) >= 1 || $service.listenerEnabled) +#**##if ($service.listenerEnabled) +#* *##set ($lifecycleCallback = "${service.fullyQualifiedServiceListenerName}.class") +#**##else +#* *##set ($lifecycleCallback = "null") +#**##end +...@ja...erceptors({$transform.getInterceptorsAsList(${interceptors}, ${lifecycleCallback})}) #end public abstract class ${service.serviceName} #if($service.generalization) @@ -102,7 +105,7 @@ */ @javax.persistence.PersistenceContext#if ($persistenceContext.persistenceContextUnitName || $persistenceContext.persistenceContextType)(#end#if ($persistenceContext.persistenceContextUnitName)unitName = "${persistenceContext.persistenceContextUnitName}"#set ($argExists = true)#end#if ($persistenceContext.persistenceContextType)#if ($argExists),#end type = javax.persistence.PersistenceContextType.${persistenceContext.persistenceContextType}#end#if ($persistenceContext.persistenceContextUnitName || $persistenceContext.persistenceContextType))#end - protected javax.persistence.EntityManager ${persistenceContext.name}; + protected javax.persistence.EntityManager $stringUtils.uncapitalize(${persistenceContext.name}); #end #set ($references = $service.serviceReferences) #if (!$references.empty) @@ -302,6 +305,16 @@ #* *##if ($operation.timeoutCallback) @javax.ejb.Timeout #* *##end +#* *##set ($interceptors = $operation.interceptorReferences) +#* *##if ($collectionUtils.size($interceptors) >= 1) + @javax.ejb.Interceptors({$transform.getInterceptorsAsList(${interceptors}, null)}) +#* *##end +#* *##if ($operation.excludeDefaultInterceptors) + @javax.ejb.ExcludeDefaultInterceptors +#* *##end +#* *##if ($operation.excludeClassInterceptors) + @javax.ejb.ExcludeClassInterceptors +#* *##end $operation.visibility $operation.returnType.fullyQualifiedName $operation.signature #* *##if ($operation.exceptionsPresent) $operation.throwsClause @@ -364,4 +377,18 @@ #**##end #end + // ------------ Generic Methods ------------ + + /** + * Generic remove method + */ + @javax.ejb.Remove + public void remove() { + handleRemove(); + } + + /** + * Performs the core logic for {@link #remove()) + */ + protected abstract void handleRemove(); } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-02-09 07:13:26
|
User: vancek Date: 06/02/08 23:13:20 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: QueueConnectionFactory and TopicConnectionFactory now inject transacted factory java:/JmsXA rather than ConnectionFactory Revision Changes Path 1.14 +3 -3 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -r1.13 -r1.14 --- SessionBean.vsl 6 Feb 2006 03:12:29 -0000 1.13 +++ SessionBean.vsl 9 Feb 2006 07:13:20 -0000 1.14 @@ -130,14 +130,14 @@ #* *##set ($reference = $dependency.targetElement) #* *##if ($reference.destinationTypeQueue) #* *##if (!$queueConnectionFactoryDefined) - @javax.annotation.Resource(mappedName = "ConnectionFactory") + @javax.annotation.Resource(mappedName = "java:/JmsXA") protected javax.jms.QueueConnectionFactory queueFactory; #* *##set ($queueConnectionFactoryDefined = true) #* *##end #* *##elseif ($reference.destinationTypeTopic) #* *##if (!$topicConnectionFactoryDefined) - @javax.annotation.Resource(mappedName = "ConnectionFactory") + @javax.annotation.Resource(mappedName = "java:/JmsXA") protected javax.jms.TopicConnectionFactory topicFactory; #* *##set ($topicConnectionFactoryDefined = true) |
From: Vance K. <va...@us...> - 2006-02-13 15:46:43
|
User: vancek Date: 06/02/13 07:46:37 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: updated comments Revision Changes Path 1.16 +1 -1 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -r1.15 -r1.16 --- SessionBean.vsl 9 Feb 2006 09:22:18 -0000 1.15 +++ SessionBean.vsl 13 Feb 2006 15:46:37 -0000 1.16 @@ -7,7 +7,7 @@ #set ($generatedFile = "${stringUtils.replace($service.fullyQualifiedServiceName,'.','/')}.java") /** - * Autogenerated EJB entity POJO class for the ${service.serviceName} session bean. + * Autogenerated EJB session bean class ${service.serviceName}. * $service.getDocumentation(" * ") */ |
From: Vance K. <va...@us...> - 2006-02-23 06:25:08
|
User: vancek Date: 06/02/22 22:25:07 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: if security is enabled, render the @RolesAllowed annotation only if logical roles exists, otherwise if deny all is specified, then render @DenyAll, otherwise always render the @PermitAll annotation Revision Changes Path 1.17 +8 -4 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -r1.16 -r1.17 --- SessionBean.vsl 13 Feb 2006 15:46:37 -0000 1.16 +++ SessionBean.vsl 23 Feb 2006 06:25:06 -0000 1.17 @@ -290,13 +290,17 @@ @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${operation.transactionType}) #* *##end #* *##end -#* *##if ($operation.permitAll) - @javax.annotation.security.PermitAll -#* *##elseif ($operation.denyAll) +#* *##if ($service.securityEnabled) +#* *##if ($stringUtils.isBlank(${operation.rolesAllowed})) +#* *##if ($operation.denyAll) @javax.annotation.security.DenyAll -#* *##elseif ($operation.rolesAllowed) +#* *##else + @javax.annotation.security.PermitAll +#* *##end +#* *##else @javax.annotation.security.RolesAllowed({${operation.rolesAllowed}}) #* *##end +#* *##end #* *##if ($operation.flushMode) @javax.persistence.FlushMode(javax.persistence.FlushModeType.${operation.flushMode}) #* *##end |
From: Vance K. <va...@us...> - 2006-02-23 06:26:36
|
User: vancek Date: 06/02/22 22:26:35 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: removed security annotations from class level - only have operation level security annotations Revision Changes Path 1.18 +0 -7 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -r1.17 -r1.18 --- SessionBean.vsl 23 Feb 2006 06:25:06 -0000 1.17 +++ SessionBean.vsl 23 Feb 2006 06:26:35 -0000 1.18 @@ -29,13 +29,6 @@ @org.jboss.annotation.security.SecurityDomain("${service.securityRealm}") #**##end #end -#if ($service.permitAll) -...@ja...rmitAll -#elseif ($service.denyAll) -...@ja...nyAll -#elseif ($service.rolesAllowed) -...@ja...lesAllowed({${service.rolesAllowed}}) -#end #if ($service.runAs) @javax.annotation.security.RunAs("${service.runAs}") #end |
From: Vance K. <va...@us...> - 2006-03-02 10:24:41
|
User: vancek Date: 06/03/02 02:24:35 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: add the lifecycle callback annotations for callback methods. if a lifecycle callback method, do not include other annotations on the operation. Revision Changes Path 1.19 +39 -20 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -r1.18 -r1.19 --- SessionBean.vsl 23 Feb 2006 06:26:35 -0000 1.18 +++ SessionBean.vsl 2 Mar 2006 10:24:34 -0000 1.19 @@ -278,6 +278,24 @@ /** $operation.getDocumentation(" * ") */ +## +## If this operation is a lifecycle callback, then exclude all other +## annotations except the callback annotations +## +#* *##if ($operation.lifecycleCallback) +#* *##if ($operation.postConstruct) + @javax.ejb.PostConstruct +#* *##elseif ($operation.preDestroy) + @javax.ejb.PreDestroy +#* *##end +#* *##if ($service.stateful) +#* *##if ($operation.postActivate) + @javax.ejb.PostActivate +#* *##elseif ($operation.prePassivate) + @javax.ejb.PrePassivate +#* *##end +#* *##end +#* *##else #* *##if (!$service.transactionManagementBean) #* *##if ($operation.transactionType) @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${operation.transactionType}) @@ -310,6 +328,7 @@ #* *##if ($operation.excludeClassInterceptors) @javax.ejb.ExcludeClassInterceptors #* *##end +#* *##end $operation.visibility $operation.returnType.fullyQualifiedName $operation.signature #* *##if ($operation.exceptionsPresent) $operation.throwsClause |
From: Vance K. <va...@us...> - 2006-03-05 05:54:28
|
User: vancek Date: 06/03/04 21:54:26 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: separated lifecycle callback generation from session operations generated an abstract handle operation for every callback Revision Changes Path 1.20 +58 -37 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -r1.19 -r1.20 --- SessionBean.vsl 2 Mar 2006 10:24:34 -0000 1.19 +++ SessionBean.vsl 5 Mar 2006 05:54:26 -0000 1.20 @@ -275,27 +275,13 @@ // -------- Business Methods -------------- #**##foreach ($operation in $operations) +## +## Check that operation is NOT a lifecycle callback +## +#* *##if (!$operation.lifecycleCallback) /** $operation.getDocumentation(" * ") */ -## -## If this operation is a lifecycle callback, then exclude all other -## annotations except the callback annotations -## -#* *##if ($operation.lifecycleCallback) -#* *##if ($operation.postConstruct) - @javax.ejb.PostConstruct -#* *##elseif ($operation.preDestroy) - @javax.ejb.PreDestroy -#* *##end -#* *##if ($service.stateful) -#* *##if ($operation.postActivate) - @javax.ejb.PostActivate -#* *##elseif ($operation.prePassivate) - @javax.ejb.PrePassivate -#* *##end -#* *##end -#* *##else #* *##if (!$service.transactionManagementBean) #* *##if ($operation.transactionType) @javax.ejb.TransactionAttribute(javax.ejb.TransactionAttributeType.${operation.transactionType}) @@ -328,7 +314,6 @@ #* *##if ($operation.excludeClassInterceptors) @javax.ejb.ExcludeClassInterceptors #* *##end -#* *##end $operation.visibility $operation.returnType.fullyQualifiedName $operation.signature #* *##if ($operation.exceptionsPresent) $operation.throwsClause @@ -345,9 +330,9 @@ #* *##end #* *##end #* *##end -#if ($operation.constraintsPresent) +#* *##if ($operation.constraintsPresent) this.$operation.preconditionCall; -#end +#* *##end try { #* *##set ($call = "this.${operation.implementationCall};") @@ -390,7 +375,43 @@ throws java.lang.Exception; #**##end +#**##end #end +#if (!$operations.empty) + + // -------- Lifecycle Callbacks -------------- + +#**##foreach ($operation in $operations) +#* *##if ($operation.lifecycleCallback) + /** +$operation.getDocumentation(" * ") + */ +#* *##if ($operation.postConstruct) + @javax.ejb.PostConstruct +#* *##elseif ($operation.preDestroy) + @javax.ejb.PreDestroy +#* *##end +#* *##if ($service.stateful) +#* *##if ($operation.postActivate) + @javax.ejb.PostActivate +#* *##elseif ($operation.prePassivate) + @javax.ejb.PrePassivate +#* *##end +#* *##end + $operation.visibility void ${operation.name}() + { + this.handle${stringUtils.capitalize(${operation.name})}(); + } + + /** + * Performs the core logic for {@link #${operation.name}()} + */ + protected abstract $operation.returnType.fullyQualifiedName handle${stringUtils.capitalize(${operation.name})}(); + +#* *##end +#**##end +#end + // ------------ Generic Methods ------------ /** |
From: Vance K. <va...@us...> - 2006-03-07 09:16:56
|
User: vancek Date: 06/03/07 01:16:54 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: fixed persistence context references and injecting extra persistence contexts Revision Changes Path 1.21 +4 -4 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -r1.20 -r1.21 --- SessionBean.vsl 5 Mar 2006 05:54:26 -0000 1.20 +++ SessionBean.vsl 7 Mar 2006 09:16:53 -0000 1.21 @@ -89,15 +89,15 @@ @javax.persistence.PersistenceContext#if ($service.persistenceContextUnitName || $service.persistenceContextType)(#end#if ($service.persistenceContextUnitName)unitName = "${service.persistenceContextUnitName}"#set ($argExists = true)#end#if ($service.persistenceContextType)#if ($argExists),#end type = javax.persistence.PersistenceContextType.${service.persistenceContextType}#end#if ($service.persistenceContextUnitName || $service.persistenceContextType))#end protected javax.persistence.EntityManager emanager; -#foreach ($reference in $service.persistenceContextReferences) -#**##set ($persistenceContext = $reference.targetElement) +#foreach ($persistenceContext in $service.persistenceContextReferences) #**##set ($argExists = false) /** - * Inject persistence context #if ($persistenceContext.persistenceContextUnitName)${persistenceContext.persistenceContextUnitName}#end + * Inject persistence context #if ($persistenceContext.unitName)${persistenceContext.unitName}#end */ - @javax.persistence.PersistenceContext#if ($persistenceContext.persistenceContextUnitName || $persistenceContext.persistenceContextType)(#end#if ($persistenceContext.persistenceContextUnitName)unitName = "${persistenceContext.persistenceContextUnitName}"#set ($argExists = true)#end#if ($persistenceContext.persistenceContextType)#if ($argExists),#end type = javax.persistence.PersistenceContextType.${persistenceContext.persistenceContextType}#end#if ($persistenceContext.persistenceContextUnitName || $persistenceContext.persistenceContextType))#end + @javax.persistence.PersistenceContext#if ($persistenceContext.unitName || $persistenceContext.contextType)(#end#if ($persistenceContext.unitName)unitName = "${persistenceContext.unitName}"#set ($argExists = true)#end#if ($persistenceContext.contextType)#if ($argExists),#end type = javax.persistence.PersistenceContextType.${persistenceContext.contextType}#end#if ($persistenceContext.unitName || $persistenceContext.contextType))#end + protected javax.persistence.EntityManager $stringUtils.uncapitalize(${persistenceContext.name}); #end #set ($references = $service.serviceReferences) |
From: Vance K. <va...@us...> - 2006-03-09 04:31:23
|
User: vancek Date: 06/03/08 20:31:23 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: moved class and method level interceptor definitions and default interceptor definition to ejb-jar descriptor Revision Changes Path 1.22 +19 -13 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.21 retrieving revision 1.22 diff -u -w -r1.21 -r1.22 --- SessionBean.vsl 7 Mar 2006 09:16:53 -0000 1.21 +++ SessionBean.vsl 9 Mar 2006 04:31:23 -0000 1.22 @@ -11,11 +11,11 @@ * $service.getDocumentation(" * ") */ -/** - * Do not specify the javax.ejb.${service.type} annotation - * Instead, define the session bean in the ejb-jar.xml descriptor - * javax.ejb.${service.type} - */ + +// Do not specify the javax.ejb.${service.type} annotation +// Instead, define the session bean in the ejb-jar.xml descriptor +// @javax.ejb.${service.type} + #if ($service.transactionManagement) @javax.ejb.TransactionManagement(javax.ejb.TransactionManagementType.${service.transactionManagement}) #end @@ -48,18 +48,21 @@ #if ($service.viewTypeRemote) @javax.ejb.Remote({${service.fullyQualifiedServiceRemoteInterfaceName}.class}) #end -## -## Service listener - lifecycle callbacks is defined as an interceptor -## + #set ($interceptors = $service.interceptorReferences) #if ($collectionUtils.size($interceptors) >= 1 || $service.listenerEnabled) #**##if ($service.listenerEnabled) #* *##set ($lifecycleCallback = "${service.fullyQualifiedServiceListenerName}.class") #**##else -#* *##set ($lifecycleCallback = "null") +#* *##set ($lifecycleCallback = "") #**##end -...@ja...erceptors({$transform.getInterceptorsAsList(${interceptors}, ${lifecycleCallback})}) +// Lifecycle callback listeners and interceptors are defined in ejb-jar.xml +// @javax.ejb.Interceptors({$transform.getInterceptorsAsList(${interceptors}, ${lifecycleCallback})}) #end +#if ($service.excludeDefaultInterceptors) +// @javax.ejb.ExcludeDefaultInterceptors +#end + public abstract class ${service.serviceName} #if($service.generalization) extends ${service.generalization.fullyQualifiedName}BeanImpl @@ -306,13 +309,16 @@ #* *##end #* *##set ($interceptors = $operation.interceptorReferences) #* *##if ($collectionUtils.size($interceptors) >= 1) - @javax.ejb.Interceptors({$transform.getInterceptorsAsList(${interceptors}, null)}) + // Interceptors are defined in ejb-jar.xml + // @javax.ejb.Interceptors({$transform.getInterceptorsAsList(${interceptors}, "")}) #* *##end #* *##if ($operation.excludeDefaultInterceptors) - @javax.ejb.ExcludeDefaultInterceptors + // Interceptor default exclusions are defined in ejb-jar.xml + // @javax.ejb.ExcludeDefaultInterceptors #* *##end #* *##if ($operation.excludeClassInterceptors) - @javax.ejb.ExcludeClassInterceptors + // Interceptor class exclusions are defined in ejb-jar.xm + // @javax.ejb.ExcludeClassInterceptors #* *##end $operation.visibility $operation.returnType.fullyQualifiedName $operation.signature #* *##if ($operation.exceptionsPresent) |
From: Vance K. <va...@us...> - 2006-03-14 06:10:53
|
User: vancek Date: 06/03/13 22:10:48 Modified: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: added @org.jboss.annotation.ejb.Clustered annotation if bean is marked as such. if stateful session bean, then implements Serializable. if stateful session bean, then add method with @Remove annotation. Revision Changes Path 1.23 +23 -17 cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl Index: SessionBean.vsl =================================================================== RCS file: /cvsroot/andromdaplugins/cartridges/andromda-ejb3/src/main/resources/templates/ejb3/SessionBean.vsl,v retrieving revision 1.22 retrieving revision 1.23 diff -u -w -r1.22 -r1.23 --- SessionBean.vsl 9 Mar 2006 04:31:23 -0000 1.22 +++ SessionBean.vsl 14 Mar 2006 06:10:47 -0000 1.23 @@ -8,14 +8,17 @@ /** * Autogenerated EJB session bean class ${service.serviceName}. +#if ($service.stateful) + * + * ${service.serviceName} is a stateful session bean and implements Serializable to maintain + * state when bean instance not in use. +#end * $service.getDocumentation(" * ") */ - // Do not specify the javax.ejb.${service.type} annotation // Instead, define the session bean in the ejb-jar.xml descriptor // @javax.ejb.${service.type} - #if ($service.transactionManagement) @javax.ejb.TransactionManagement(javax.ejb.TransactionManagementType.${service.transactionManagement}) #end @@ -48,7 +51,9 @@ #if ($service.viewTypeRemote) @javax.ejb.Remote({${service.fullyQualifiedServiceRemoteInterfaceName}.class}) #end - +#if ($service.clusteringEnabled) +...@or...ustered +#end #set ($interceptors = $service.interceptorReferences) #if ($collectionUtils.size($interceptors) >= 1 || $service.listenerEnabled) #**##if ($service.listenerEnabled) @@ -62,12 +67,11 @@ #if ($service.excludeDefaultInterceptors) // @javax.ejb.ExcludeDefaultInterceptors #end - public abstract class ${service.serviceName} #if($service.generalization) extends ${service.generalization.fullyQualifiedName}BeanImpl #end - implements#if ($service.viewTypeLocal) ${service.fullyQualifiedServiceLocalInterfaceName}#if ($service.viewTypeRemote),#end#end#if ($service.viewTypeRemote) ${service.fullyQualifiedServiceRemoteInterfaceName}#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 { // ------ Session Context Injection ------ @@ -417,11 +421,12 @@ #* *##end #**##end #end +#if ($service.stateful) - // ------------ Generic Methods ------------ + // ------------ Remove Method ------------ /** - * Generic remove method + * Remove lifecycle method */ @javax.ejb.Remove public void remove() { @@ -432,4 +437,5 @@ * Performs the core logic for {@link #remove()) */ protected abstract void handleRemove(); +#end } \ No newline at end of file |
From: Vance K. <va...@us...> - 2006-05-01 07:01:24
|
User: vancek Date: 06/05/01 00:01:22 Removed: andromda-ejb3/src/main/resources/templates/ejb3 SessionBean.vsl Log: remove SessionBean template - using SessionBeanBase |