OMElement classElement = null;
String name = null;
String identifier = null;
String clazz = null;
Object filter = null;
FilterBean bean = null;
nameElement = element.getFirstChildWithName(new QName(NAME));
identifierElement = element.getFirstChildWithName(new QName(IDENTIFIER));
classElement = element.getFirstChildWithName(new QName(CLASS));
if (nameElement == null) {
throw new SavanException("Name element is not present within the Filter");
}
if (identifierElement == null) {
throw new SavanException("Identifier element is not present within the Filter");
}
if (classElement == null) {
throw new SavanException("Class element is not present within the Filter");
}
name = nameElement.getText();
identifier = identifierElement.getText();
clazz = classElement.getText();
// initialize the class to check weather it is value
filter = getObject(clazz);
if (!(filter instanceof Filter)) {
String message = "Class " + clazz + " does not implement the Filter interface.";
throw new SavanException(message);
}
bean = new FilterBean();
bean.setName(name);
bean.setIdentifier(identifier);
bean.setClazz(clazz);
filterMap.put(identifier, bean);
}