1 23 24 package com.sun.enterprise.deployment.node.ejb; 25 26 import java.util.Map ; 27 import java.util.Iterator ; 28 29 import org.w3c.dom.Node ; 30 31 import com.sun.enterprise.deployment.node.XMLElement; 32 import com.sun.enterprise.deployment.node.SecurityRoleRefNode; 33 import com.sun.enterprise.deployment.node.SecurityRoleNode; 34 35 import com.sun.enterprise.deployment.Descriptor; 36 import com.sun.enterprise.deployment.EjbDescriptor; 37 import com.sun.enterprise.deployment.RoleReference; 38 import com.sun.enterprise.deployment.xml.EjbTagNames; 39 40 47 public abstract class InterfaceBasedEjbNode extends EjbNode { 48 49 public InterfaceBasedEjbNode() { 50 super(); 51 registerElementHandler(new XMLElement(EjbTagNames.ROLE_REFERENCE), SecurityRoleRefNode.class, "addRoleReference"); 53 } 54 55 61 protected Map getDispatchTable() { 62 Map table = super.getDispatchTable(); 64 table.put(EjbTagNames.HOME, "setHomeClassName"); 65 table.put(EjbTagNames.REMOTE, "setRemoteClassName"); 66 table.put(EjbTagNames.LOCAL_HOME, "setLocalHomeClassName"); 67 table.put(EjbTagNames.LOCAL, "setLocalClassName"); 68 table.put(EjbTagNames.BUSINESS_LOCAL, "addLocalBusinessClassName"); 69 table.put(EjbTagNames.BUSINESS_REMOTE, "addRemoteBusinessClassName"); 70 table.put(EjbTagNames.SERVICE_ENDPOINT_INTERFACE, 71 "setWebServiceEndpointInterfaceName"); 72 return table; 73 } 74 75 81 protected void writeCommonHeaderEjbDescriptor(Node ejbNode, EjbDescriptor descriptor) { 82 super.writeCommonHeaderEjbDescriptor(ejbNode, descriptor); 83 appendTextChild(ejbNode, EjbTagNames.HOME, descriptor.getHomeClassName()); 84 appendTextChild(ejbNode, EjbTagNames.REMOTE, descriptor.getRemoteClassName()); 85 appendTextChild(ejbNode, EjbTagNames.LOCAL_HOME, descriptor.getLocalHomeClassName()); 86 appendTextChild(ejbNode, EjbTagNames.LOCAL, descriptor.getLocalClassName()); 87 88 for(String next : descriptor.getLocalBusinessClassNames()) { 89 appendTextChild(ejbNode, EjbTagNames.BUSINESS_LOCAL, next); 90 } 91 92 for(String next : descriptor.getRemoteBusinessClassNames()) { 93 appendTextChild(ejbNode, EjbTagNames.BUSINESS_REMOTE, next); 94 } 95 96 appendTextChild(ejbNode, EjbTagNames.SERVICE_ENDPOINT_INTERFACE, 97 descriptor.getWebServiceEndpointInterfaceName()); 98 appendTextChild(ejbNode, EjbTagNames.EJB_CLASS, 99 descriptor.getEjbClassName()); 100 } 101 102 108 protected void writeRoleReferenceDescriptors(Node parentNode, Iterator refs) { 109 SecurityRoleRefNode node = new SecurityRoleRefNode(); 110 for (;refs.hasNext();) { 111 RoleReference roleRef = (RoleReference) refs.next(); 112 node.writeDescriptor(parentNode, EjbTagNames.ROLE_REFERENCE, roleRef); 113 } 114 } 115 } 116 | Popular Tags |