private void addClassAnnotation(EJBContainer container, Annotation annotation) { addClassAnnotation(container, annotation.annotationType(), annotation); }
private void addSimpleJndiAnnotations(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean) throws ClassNotFoundException { RemoteBindingImpl remoteBinding = null; String jndiName = enterpriseBean.getMappedName(); if (jndiName != null) { remoteBinding = new RemoteBindingImpl(); remoteBinding.setJndiBinding(jndiName); addClassAnnotation(container, RemoteBinding.class, remoteBinding); } if (remoteBinding != null) { RemoteBinding existingBinding = ejbClass.getAnnotation(RemoteBinding.class); if (existingBinding != null) remoteBinding.merge(existingBinding); addClassAnnotation(container, RemoteBinding.class, remoteBinding); } }
private void addServiceAnnotations(EJBContainer container, JBossServiceBeanMetaData service) throws ClassNotFoundException { if (service == null) return; String management = service.getManagement(); if (management != null) { ManagementImpl annotation = new ManagementImpl(di.getClassLoader().loadClass(management)); addClassAnnotation(container, Management.class, annotation); } }
private void addLocalJndiAnnotations(EJBContainer container, JBossSessionBeanMetaData enterpriseBean) throws ClassNotFoundException { String localJndiName = enterpriseBean.getLocalJndiName(); if (localJndiName != null) { LocalBindingImpl localBinding = new LocalBindingImpl(localJndiName); addClassAnnotation(container, LocalBinding.class, localBinding); } String localHomeJndiName = enterpriseBean.getLocalHomeJndiName(); if (localHomeJndiName != null) { LocalHomeBindingImpl localHomeBinding = new LocalHomeBindingImpl(localHomeJndiName); addClassAnnotation(container, LocalHomeBinding.class, localHomeBinding); } }
private void addHomeAnnotations(EJBContainer container, JBossSessionBeanMetaData sessionBean) throws Exception { if (sessionBean.getHome() != null) { RemoteHomeImpl annotation = new RemoteHomeImpl(di.getClassLoader() .loadClass(sessionBean.getHome())); addClassAnnotation(container, annotation.annotationType(), annotation); } if (sessionBean.getLocalHome() != null) { LocalHomeImpl annotation = new LocalHomeImpl(di.getClassLoader() .loadClass(sessionBean.getLocalHome())); addClassAnnotation(container, annotation.annotationType(), annotation); } }
private void addConcurrentAnnotations(EJBContainer container, JBossSessionBeanMetaData enterpriseBean) throws Exception { if (enterpriseBean.isConcurrent() != null) { if (enterpriseBean.isConcurrent()) { SerializedConcurrentAccessImpl annotation = new SerializedConcurrentAccessImpl(); addClassAnnotation(container, SerializedConcurrentAccess.class, annotation); } else { container.getAnnotations().disableAnnotation(SerializedConcurrentAccess.class.getName()); } } }
/** * Interceptors are additive. What's in the annotations and in the XML is * merged */ private void addClassLevelInterceptorBindingAnnotations( EJBContainer container, InterceptorBindingMetaData binding) throws ClassNotFoundException { Interceptors interceptors = (Interceptors) container .resolveAnnotation(Interceptors.class); if (binding != null) { Interceptors impl = createInterceptorsFromInterceptorBinding(interceptors, binding); addClassAnnotation(container, impl.annotationType(), impl); } boolean exclude = false; if (binding != null) exclude = binding.isExcludeDefaultInterceptors(); if (exclude && container.resolveAnnotation(ExcludeDefaultInterceptors.class) == null) { addClassAnnotation(container, ExcludeDefaultInterceptors.class, new ExcludeDefaultInterceptorsImpl()); } }
@Override protected StatefulContainer getStatefulContainer(int ejbIndex, JBossSessionBeanMetaData enterpriseBean) throws Exception { String ejbName = ejbNames.get(ejbIndex); StatefulContainer container = super.getStatefulContainer(ejbIndex, enterpriseBean); container.setAssemblyDescriptor(dd.getAssemblyDescriptor()); StatefulImpl annotation = new StatefulImpl(ejbName); if (enterpriseBean != null && !isAnnotatedBean()) { addClassAnnotation(container, annotation); } if(enterpriseBean instanceof JBossSessionBeanMetaData) addInterfaces(container, (JBossSessionBeanMetaData) enterpriseBean); else log.trace("Not analyzing interfaces on " + enterpriseBean); addDescriptorAnnotations(container, enterpriseBean, ejbName, true); return container; }
@Override protected EJBContainer getStatelessContainer(int ejbIndex, JBossSessionBeanMetaData enterpriseBean) throws Exception { String ejbName = ejbNames.get(ejbIndex); EJBContainer container = super.getStatelessContainer(ejbIndex, enterpriseBean); container.setAssemblyDescriptor(dd.getAssemblyDescriptor()); StatelessImpl annotation = new StatelessImpl(ejbName); if (enterpriseBean != null && !isAnnotatedBean()) { addClassAnnotation(container, Stateless.class, annotation); } if(enterpriseBean instanceof JBossSessionBeanMetaData) addInterfaces(container, (JBossSessionBeanMetaData) enterpriseBean); else log.debug("Not analyzing interfaces on " + enterpriseBean); addDescriptorAnnotations(container, enterpriseBean, ejbName); return container; }
private void addSecurityIdentityAnnotation(EJBContainer container, SecurityIdentityMetaData identity) { if (identity != null && !identity.isUseCallerId()) { RunAsMetaData runAs = identity.getRunAs(); RunAsImpl annotation = null; if (runAs != null) { annotation = new RunAsImpl(runAs.getRoleName()); addClassAnnotation(container, annotation.annotationType(), annotation); } String runAsPrincipal = identity.getRunAsPrincipal(); if (runAsPrincipal != null) { RunAsPrincipalImpl principalAnnotation = new RunAsPrincipalImpl(runAsPrincipal); addClassAnnotation(container, principalAnnotation .annotationType(), principalAnnotation); } } }
addClassAnnotation(container, RemoteHomeBinding.class, homeBinding); addClassAnnotation(container, RemoteBinding.class, remoteBindingAnnotation); log.debug("Adding " + RemoteBinding.class.getName() + " to " + container.toString() + ": " + remoteBindingAnnotation.toString()); addClassAnnotation(container, RemoteBindings.class, bindingsAnnotation);
private void addDefaultActivationConfig(MDB container, JBossMessageDrivenBeanMetaData mdb) { ActivationConfigMetaData defaultActivationConfig = mdb.getDefaultActivationConfig(); if (defaultActivationConfig != null) { DefaultActivationSpecsImpl activationAnnotation = new DefaultActivationSpecsImpl(); for (ActivationConfigPropertyMetaData property : defaultActivationConfig.getActivationConfigProperties()) { activationAnnotation.addActivationConfigProperty(new ActivationConfigPropertyImpl(property .getName(), property.getValue())); } DefaultActivationSpecs existingAnnotation = ejbClass.getAnnotation(DefaultActivationSpecs.class); if (existingAnnotation != null) activationAnnotation.merge(existingAnnotation); addClassAnnotation(container, DefaultActivationSpecs.class, activationAnnotation); } }
private void addDependencies(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean) throws Exception { Set<String> depends = enterpriseBean.getDepends(); if (depends != null && depends.size() > 0) { DependsImpl annotation = new DependsImpl(); Iterator<String> dependencies = enterpriseBean.getDepends() .iterator(); while (dependencies.hasNext()) { annotation.addDependency(dependencies.next()); } addClassAnnotation(container, Depends.class, annotation); } if (enterpriseBean.getIgnoreDependency() != null) { for(ResourceInjectionTargetMetaData ignore : enterpriseBean.getIgnoreDependency().getInjectionTargets()) { IgnoreDependencyImpl annotation = new IgnoreDependencyImpl(); MethodMetaData method = new MethodMetaData(); method.setMethodName(ignore.getInjectionTargetName()); addAnnotations(IgnoreDependency.class, annotation, container, method); } } }
private void addPoolAnnotations(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean) throws Exception { if (enterpriseBean.getPoolConfig() != null) { PoolConfigMetaData config = enterpriseBean.getPoolConfig(); PoolImpl poolAnnotation = new PoolImpl(); if (config.getValue() != null && !config.getValue().trim().equals("")) poolAnnotation.setValue(config.getValue()); // EJBTHREE-1119 if(config.getValue()==null || config.getValue().trim().equals("")) { // Set default implementation to Threadlocal poolAnnotation.setValue(PoolDefaults.POOL_IMPLEMENTATION_THREADLOCAL); } if (config.getMaxSize() != null) poolAnnotation.setMaxSize(config.getMaxSize()); if (config.getTimeout() != null) poolAnnotation.setTimeout(config.getTimeout()); addClassAnnotation(container, Pool.class, poolAnnotation); } }
addClassAnnotation(container, annotationClass, annotation);
private void addWebServiceAnnotations(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean) { if (enterpriseBean != null && (enterpriseBean instanceof JBossSessionBeanMetaData)) { PortComponent pc = ((JBossSessionBeanMetaData)enterpriseBean).getPortComponent(); if (pc != null) { PortComponentMD annotation = new PortComponentMD(); annotation.setAuthMethod(pc.getAuthMethod()); annotation.setPortComponentName(pc.getPortComponentName()); annotation.setPortComponentURI(pc.getPortComponentURI()); annotation.setSecureWSDLAccess(pc.getSecureWSDLAccess()); annotation.setTransportGuarantee(pc.getTransportGuarantee()); addClassAnnotation(container, PortComponentSpec.class, annotation); } } }
addClassAnnotation(container, Consumer.class, annotation);
@Override protected ServiceContainer getServiceContainer(int ejbIndex, JBossServiceBeanMetaData service) throws Exception { String ejbName = ejbNames.get(ejbIndex); ServiceContainer container = super.getServiceContainer(ejbIndex, service); ServiceImpl annotation = new ServiceImpl((Service) container .resolveAnnotation(Service.class)); container.setAssemblyDescriptor(dd.getAssemblyDescriptor()); if (service != null && !isAnnotatedBean()) { if (service.getObjectName() != null) annotation.setObjectName(service.getObjectName()); if (service.getEjbName() != null) annotation.setName(service.getEjbName()); if (service.getXmbean() != null) annotation.setXMBean(service.getXmbean()); addClassAnnotation(container, Service.class, annotation); } addInterfaces(container, service); addDescriptorAnnotations(container, service, ejbName); addServiceAnnotations(container, service); return container; }
addClassAnnotation(container, Clustered.class, clusteredAnnotation);
addClassAnnotation(container, TransactionManagement.class, annotation);