public void assertFullSessionBean(String ejbName, SessionBeanMetaData session, Mode mode) { assertId(ejbName, session); // TODO: enrich the jboss xml if (mode == Mode.SPEC) { assertMappedName(ejbName, session.getMappedName()); assertClass(ejbName, "Home", session.getHome()); assertClass(ejbName, "Remote", session.getRemote()); assertClass(ejbName, "LocalHome", session.getLocalHome()); assertClass(ejbName, "Local", session.getLocal()); assertClasses(ejbName, "BusinessLocal", 2, session.getBusinessLocals()); assertClasses(ejbName, "BusinessRemote", 2, session.getBusinessRemotes()); assertClass(ejbName, "ServiceEndpoint", session.getServiceEndpoint()); assertClass(ejbName, "EjbClass", session.getEjbClass()); assertEquals(SessionType.Stateless, session.getSessionType()); assertNamedMethod(ejbName + "TimeoutMethod", 2, session.getTimeoutMethod()); assertInitMethods(ejbName, 2, session.getInitMethods()); assertRemoveMethods(ejbName, 3, session.getRemoveMethods()); assertEquals(TransactionManagementType.CONTAINER, session.getTransactionType()); assertAroundInvokes(ejbName, 2, session.getAroundInvokes()); assertLifecycleCallbacks(ejbName, "PostActivate", 2, session.getPostActivates()); assertLifecycleCallbacks(ejbName, "PrePassivate", 2, session.getPrePassivates()); assertEnvironment(ejbName, session.getJndiEnvironmentRefsGroup(), true, mode); assertContainerTransactions(ejbName, 6, 6, session.getContainerTransactions()); assertMethodPermissions( ejbName, ejbName + "MethodPermission", 3, 3, session.getMethodPermissions()); assertExcludeList(ejbName, 5, 5, session.getExcludeList()); assertSecurityRoleRefs(ejbName, 2, session.getSecurityRoleRefs()); assertSecurityIdentity( ejbName, "SecurityIdentity", session.getSecurityIdentity(), true, mode); } else { assertNull(session.getMappedName()); assertNull(session.getHome()); assertNull(session.getRemote()); assertNull(session.getLocalHome()); assertNull(session.getLocal()); assertNull(session.getBusinessLocals()); assertNull(session.getBusinessRemotes()); assertNull(session.getServiceEndpoint()); assertNull(session.getEjbClass()); assertNull(session.getSessionType()); assertNull(session.getTimeoutMethod()); assertNull(session.getInitMethods()); assertNull(session.getRemoveMethods()); assertNull(session.getTransactionType()); assertNull(session.getAroundInvokes()); assertNull(session.getPostActivates()); assertNull(session.getPrePassivates()); assertEnvironment(ejbName, session.getJndiEnvironmentRefsGroup(), false, mode); assertNull(session.getContainerTransactions()); assertNull(session.getMethodPermissions()); assertNull(session.getExcludeList()); assertNull(session.getSecurityRoleRefs()); assertSecurityIdentity( ejbName, "SecurityIdentity", session.getSecurityIdentity(), false, mode); } }
private void processComponentConfig( final DeploymentUnit deploymentUnit, final EEApplicationClasses applicationClasses, final Module module, final DeploymentReflectionIndex deploymentReflectionIndex, final SessionBeanComponentDescription description) throws DeploymentUnitProcessingException, ClassNotFoundException { String home = null; String localHome = null; // first check for annotations if (!MetadataCompleteMarker.isMetadataComplete(deploymentUnit)) { final EEModuleClassDescription clazz = applicationClasses.getClassByName(description.getComponentClassName()); // we only care about annotations on the bean class itself if (clazz != null) { final ClassAnnotationInformation<LocalHome, String> localAnnotations = clazz.getAnnotationInformation(LocalHome.class); if (localAnnotations != null) { if (!localAnnotations.getClassLevelAnnotations().isEmpty()) { localHome = localAnnotations.getClassLevelAnnotations().get(0); if (description.getEjbLocalView() == null) { // If the local home is specified via annotation then the corresponding business // interface is implied // by the signature of the create method // See EJB 3.1 21.4.5 final String localClassName = this.inferLocalInterfaceFromLocalHome( localHome, module, deploymentReflectionIndex, description); description.addEjbLocalObjectView(localClassName); } } } final ClassAnnotationInformation<RemoteHome, String> remoteAnnotations = clazz.getAnnotationInformation(RemoteHome.class); if (remoteAnnotations != null) { if (!remoteAnnotations.getClassLevelAnnotations().isEmpty()) { home = remoteAnnotations.getClassLevelAnnotations().get(0); if (description.getEjbRemoteView() == null) { // If the remote home is specified via annotation then the corresponding business // interface is implied // by the signature of the create method // See EJB 3.1 21.4.5 final String remoteClassName = this.inferRemoteInterfaceFromHome( home, module, deploymentReflectionIndex, description); description.addEjbObjectView(remoteClassName); } } } } } // now allow the annotations to be overridden by the DD final SessionBeanMetaData descriptorData = description.getDescriptorData(); if (descriptorData != null) { if (descriptorData.getHome() != null) { home = descriptorData.getHome(); } if (descriptorData.getLocalHome() != null) { localHome = descriptorData.getLocalHome(); } } if (localHome != null) { description.addLocalHome(localHome); } if (home != null) { description.addRemoteHome(home); } // finally see if we have to infer the remote or local interface from the home/local home views, // respectively if (description.getEjbHomeView() != null && description.getEjbRemoteView() == null) { final String remoteClassName = this.inferRemoteInterfaceFromHome( description.getEjbHomeView().getViewClassName(), module, deploymentReflectionIndex, description); description.addEjbObjectView(remoteClassName); } if (description.getEjbLocalHomeView() != null && description.getEjbLocalView() == null) { final String localClassName = this.inferLocalInterfaceFromLocalHome( description.getEjbLocalHomeView().getViewClassName(), module, deploymentReflectionIndex, description); description.addEjbLocalObjectView(localClassName); } }