InterceptorBindingNodepublic class InterceptorBindingNode extends com.sun.enterprise.deployment.node.DeploymentDescriptorNode
Fields Summary |
---|
private com.sun.enterprise.deployment.MethodDescriptor | businessMethod | private boolean | needsOverloadResolution |
Constructors Summary |
---|
public InterceptorBindingNode()
super();
|
Methods Summary |
---|
public boolean | endElement(com.sun.enterprise.deployment.node.XMLElement element)receives notification of the end of an XML element by the Parser
if (EjbTagNames.INTERCEPTOR_ORDER.equals(element.getQName())) {
InterceptorBindingDescriptor desc = (InterceptorBindingDescriptor)
getDescriptor();
desc.setIsTotalOrdering(true);
} else if (EjbTagNames.METHOD_PARAMS.equals(element.getQName())) {
// this means we have an empty method-params element
// which means this method has no input parameter
if (businessMethod.getParameterClassNames() == null) {
businessMethod.setEmptyParameterClassNames();
}
}else if( EjbTagNames.METHOD.equals(element.getQName()) ) {
InterceptorBindingDescriptor bindingDesc =
(InterceptorBindingDescriptor) getDescriptor();
businessMethod.setEjbClassSymbol(MethodDescriptor.EJB_BEAN);
bindingDesc.setBusinessMethod(businessMethod);
if( needsOverloadResolution ) {
bindingDesc.setNeedsOverloadResolution(true);
}
businessMethod = null;
needsOverloadResolution = false;
}
return super.endElement(element);
| protected java.util.Map | getDispatchTable()all sub-implementation of this class can use a dispatch table to map xml element to
method name on the descriptor class for setting the element value.
Map table = super.getDispatchTable();
table.put(EjbTagNames.EJB_NAME, "setEjbName");
table.put(EjbTagNames.INTERCEPTOR_CLASS, "appendInterceptorClass");
table.put(EjbTagNames.EXCLUDE_DEFAULT_INTERCEPTORS,
"setExcludeDefaultInterceptors");
table.put(EjbTagNames.EXCLUDE_CLASS_INTERCEPTORS,
"setExcludeClassInterceptors");
return table;
| public void | setElementValue(com.sun.enterprise.deployment.node.XMLElement element, java.lang.String value)
if( EjbTagNames.METHOD_NAME.equals(element.getQName()) ) {
businessMethod.setName(value);
} else if( EjbTagNames.METHOD_PARAM.equals(element.getQName()) ) {
if( (value != null) && (value.trim().length() > 0) ) {
businessMethod.addParameterClass(value.trim());
}
} else {
super.setElementValue(element, value);
}
| public void | startElement(com.sun.enterprise.deployment.node.XMLElement element, org.xml.sax.Attributes attributes)
if( EjbTagNames.METHOD.equals(element.getQName()) ) {
businessMethod = new MethodDescriptor();
// Assume we need overloaded method resolution until we
// encounter at least one method-param element.
needsOverloadResolution = true;
} else if( EjbTagNames.METHOD_PARAMS.equals(element.getQName()) ) {
// If there's a method-params element, regardless of whether there
// are any <method-param> sub-elements, there's no overload
// resolution needed.
needsOverloadResolution = false;
}
super.startElement(element, attributes);
| public void | writeBindings(org.w3c.dom.Node parent, com.sun.enterprise.deployment.EjbDescriptor ejbDesc)Write interceptor bindings for this ejb.
List<EjbInterceptor> classInterceptors = ejbDesc.getInterceptorChain();
if( classInterceptors.size() > 0 ) {
writeTotalOrdering(parent, classInterceptors, ejbDesc, null);
}
Map<MethodDescriptor, List<EjbInterceptor>> methodInterceptorsMap =
ejbDesc.getMethodInterceptorsMap();
for(MethodDescriptor nextMethod : methodInterceptorsMap.keySet()) {
List<EjbInterceptor> interceptors =
methodInterceptorsMap.get(nextMethod);
if(interceptors.isEmpty()) {
writeExclusionBinding(parent, ejbDesc, nextMethod);
} else {
writeTotalOrdering(parent, interceptors, ejbDesc, nextMethod);
}
}
return;
| private void | writeExclusionBinding(org.w3c.dom.Node parent, com.sun.enterprise.deployment.EjbDescriptor ejbDesc, com.sun.enterprise.deployment.MethodDescriptor method)
Node bindingNode = appendChild(parent,
EjbTagNames.INTERCEPTOR_BINDING);
appendTextChild(bindingNode, EjbTagNames.EJB_NAME,
ejbDesc.getName());
appendTextChild(bindingNode, EjbTagNames.EXCLUDE_CLASS_INTERCEPTORS,
"true");
MethodNode methodNode = new MethodNode();
// Write out method description. void methods will be written
// out using an empty method-params element so they will not
// be interpreted as overloaded when processed.
methodNode.writeJavaMethodDescriptor
(bindingNode, EjbTagNames.INTERCEPTOR_BUSINESS_METHOD, method,
true);
| private void | writeTotalOrdering(org.w3c.dom.Node parent, java.util.List interceptors, com.sun.enterprise.deployment.EjbDescriptor ejbDesc, com.sun.enterprise.deployment.MethodDescriptor method)
Node bindingNode = appendChild(parent,
EjbTagNames.INTERCEPTOR_BINDING);
appendTextChild(bindingNode, EjbTagNames.EJB_NAME,
ejbDesc.getName());
Node totalOrderingNode = appendChild(bindingNode,
EjbTagNames.INTERCEPTOR_ORDER);
for(EjbInterceptor next : interceptors) {
appendTextChild(totalOrderingNode, EjbTagNames.INTERCEPTOR_CLASS,
next.getInterceptorClassName());
}
if( method != null ) {
MethodNode methodNode = new MethodNode();
// Write out method description. void methods will be written
// out using an empty method-params element so they will not
// be interpreted as overloaded when processed.
methodNode.writeJavaMethodDescriptor
(bindingNode, EjbTagNames.INTERCEPTOR_BUSINESS_METHOD, method,
true);
}
|
|