use of org.apache.openejb.jee.AssemblyDescriptor in project tomee by apache.
the class SecondStatelessInterceptedTest method module.
@Module
public EjbJar module() {
final EjbJar ejbJar = new EjbJar();
final StatelessBean bean = ejbJar.addEnterpriseBean(new StatelessBean(SecondStatelessInterceptedBean.class));
final AssemblyDescriptor assembly = ejbJar.getAssemblyDescriptor();
assembly.addInterceptorBinding(new InterceptorBinding("*", new Interceptor(DefaultInterceptorOne.class)));
assembly.addInterceptorBinding(new InterceptorBinding("*", new Interceptor(DefaultInterceptorTwo.class)));
assembly.addInterceptorBinding(new InterceptorBinding(bean)).setExcludeDefaultInterceptors(true);
return ejbJar;
}
use of org.apache.openejb.jee.AssemblyDescriptor in project tomee by apache.
the class CheckAssemblyBindings method checkUnusedInterceptors.
private void checkUnusedInterceptors(final EjbModule ejbModule) {
final AssemblyDescriptor assembly = ejbModule.getEjbJar().getAssemblyDescriptor();
final Interceptor[] interceptorsArray = ejbModule.getEjbJar().getInterceptors();
final List<Interceptor> interceptors = Arrays.asList(interceptorsArray);
final Set<String> interceptorClassNames = new HashSet<String>(interceptors.size());
for (final Interceptor interceptor : interceptors) {
interceptorClassNames.add(interceptor.getInterceptorClass());
}
final Set<String> interceptorClassNamesUsedInBindings = new HashSet<String>();
for (final InterceptorBinding binding : assembly.getInterceptorBinding()) {
final List<String> interceptorClass = binding.getInterceptorClass();
interceptorClassNamesUsedInBindings.addAll(interceptorClass);
}
final Set<String> unusedInterceptors = new HashSet<String>();
for (final String clazz : interceptorClassNames) {
if (!interceptorClassNamesUsedInBindings.contains(clazz)) {
unusedInterceptors.add(clazz);
}
}
for (final String clazz : unusedInterceptors) {
warn("Interceptors", "interceptor.unused", clazz);
}
}
Aggregations