if (url != null) {
// Bind the XML handler chain file to an XMLBeans document
XmlObject xml = XmlBeansUtil.parse(url, null);
HandlerChainsDocument hcd = (HandlerChainsDocument) XmlBeansUtil.typedCopy(xml, HandlerChainsDocument.type);
HandlerChainsType handlerChains = hcd.getHandlerChains();
// Find the <service-ref> entry this handler chain belongs to and insert it
ServiceRefType[] serviceRefs = annotatedApp.getServiceRefArray();
boolean exists = false;
for ( ServiceRefType serviceRef : serviceRefs ) {
if ( serviceRef.getServiceRefName().getStringValue().trim().equals(serviceRefName) ) {
ServiceRefHandlerChainsType serviceRefHandlerChains = serviceRef.addNewHandlerChains();
for (HandlerChainType handlerChain : handlerChains.getHandlerChainArray()) {
ServiceRefHandlerChainType serviceRefHandlerChain = serviceRefHandlerChains.addNewHandlerChain();
if (handlerChain.getPortNamePattern() != null) {
serviceRefHandlerChain.setPortNamePattern(handlerChain.getPortNamePattern());
}
if (handlerChain.getServiceNamePattern() != null) {