{
Element interceptorElement = (Element) children2.item(j);
String tag2 = interceptorElement.getTagName();
if (tag2.equals("interceptor"))
{
InterceptorFactory factory = deployInterceptor(interceptorElement);
interceptors.add(factory);
}
else if (tag2.equals("interceptor-ref"))
{
String iname = interceptorElement.getAttribute("name");
if (iname == null) throw new RuntimeException("interceptor-ref has null name attribute");
InterceptorFactory factory = manager.getInterceptorFactory(iname);
if (factory == null) throw new RuntimeException("unable to resolve interceptor-ref: " + iname);
interceptors.add(factory);
}
else if (tag2.equals("stack-ref"))
{
String name = interceptorElement.getAttribute("name");
AdviceStack stack = manager.getAdviceStack(name);
if (stack == null) throw new Exception("there is no <stack> defined for name: " + name);
interceptors.addAll(stack.getInterceptorFactories());
}
else
{
AdviceType type = null;
if (!tag2.equals("advice"))
{
try
{
type = Enum.valueOf(AdviceType.class, tag2.toUpperCase());
}
catch (IllegalArgumentException e)
{
StringBuffer message = new StringBuffer();
message.append("unexpected tag inside binding: \'");
message.append(tag2);
message.append("\'\n\t\t\t\t\t should be one of: \n\t\t\t\t\t\t'interceptor\', \n\t\t\t\t\t\t'interceptor-ref\', \n\t\t\t\t\t\t'advice\', \n\t\t\t\t\t\t'");
for (AdviceType adviceType : AdviceType.values())
{
message.append(adviceType.getName());
message.append("\', \n\t\t\t\t\t\t'");
}
message.append("stack-ref\'.\n");
throw new RuntimeException(message.toString());
}
}
InterceptorFactory factory = deployAdvice(interceptorElement, type);
interceptors.add(factory);
}
}
}
return interceptors;