1 25 26 package org.objectweb.easybeans.deployment.annotations.helper.bean; 27 28 import org.objectweb.easybeans.deployment.annotations.exceptions.ResolverException; 29 import org.objectweb.easybeans.deployment.annotations.impl.JLocal; 30 import org.objectweb.easybeans.deployment.annotations.impl.JRemote; 31 import org.objectweb.easybeans.deployment.annotations.metadata.ClassAnnotationMetadata; 32 import org.objectweb.easybeans.deployment.annotations.metadata.EjbJarAnnotationMetadata; 33 34 39 public final class InterfaceAnnotatedHelper { 40 41 44 private InterfaceAnnotatedHelper() { 45 } 46 47 52 public static void resolve(final ClassAnnotationMetadata sessionBean) throws ResolverException { 53 EjbJarAnnotationMetadata ejbJarAnnotationMetadata = sessionBean.getEjbJarAnnotationMetadata(); 55 56 JLocal currentLocalInterfaces = sessionBean.getLocalInterfaces(); 58 JRemote currentRemoteInterfaces = sessionBean.getRemoteInterfaces(); 59 60 String [] interfaces = sessionBean.getInterfaces(); 62 for (String itf : interfaces) { 63 ClassAnnotationMetadata itfAnnotationMetadata = ejbJarAnnotationMetadata.getClassAnnotationMetadata(itf); 64 65 if (itfAnnotationMetadata != null) { 67 JLocal jLocal = itfAnnotationMetadata.getLocalInterfaces(); 69 if (jLocal != null) { 70 if (currentLocalInterfaces == null) { 71 currentLocalInterfaces = new JLocal(); 72 sessionBean.setLocalInterfaces(currentLocalInterfaces); 73 } 74 String itfName = itfAnnotationMetadata.getClassName(); 75 if (!currentLocalInterfaces.getInterfaces().contains(itfName)) { 76 currentLocalInterfaces.addInterface(itfName); 77 } 78 } 79 80 JRemote jRemote = itfAnnotationMetadata.getRemoteInterfaces(); 82 if (jRemote != null) { 83 if (currentRemoteInterfaces == null) { 84 currentRemoteInterfaces = new JRemote(); 85 sessionBean.setRemoteInterfaces(currentRemoteInterfaces); 86 } 87 String itfName = itfAnnotationMetadata.getClassName(); 88 if (!currentRemoteInterfaces.getInterfaces().contains(itfName)) { 89 currentRemoteInterfaces.addInterface(itfName); 90 } 91 } 92 } 93 } 94 } 95 96 } 97 | Popular Tags |