XMLStreamReaderUtil.nextElementContent(reader);
}
// process all <handler> elements
while (reader.getName().equals(QNAME_HANDLER)) {
Handler handler;
XMLStreamReaderUtil.nextContent(reader);
if (reader.getName().equals(QNAME_HANDLER_NAME)) {
skipTextElement(reader);
}
// handler class
ensureProperName(reader, QNAME_HANDLER_CLASS);
try {
handler = (Handler) loadClass(classLoader,
XMLStreamReaderUtil.getElementText(reader).trim()).newInstance();
} catch (InstantiationException ie){
throw new RuntimeException(ie);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
XMLStreamReaderUtil.nextContent(reader);
// init params (ignored)
while (reader.getName().equals(QNAME_HANDLER_PARAM)) {
skipInitParamElement(reader);
}
// headers (ignored)
while (reader.getName().equals(QNAME_HANDLER_HEADER)) {
skipTextElement(reader);
}
// roles (not stored per handler)
while (reader.getName().equals(QNAME_HANDLER_ROLE)) {
roles.add(XMLStreamReaderUtil.getElementText(reader));
XMLStreamReaderUtil.nextContent(reader);
}
// call @PostConstruct method on handler if present
for (Method method : handler.getClass().getMethods()) {
if (method.getAnnotation(PostConstruct.class) == null) {
continue;
}
try {
method.invoke(handler, new Object [0]);