Node functionNameNode = nnm.getNamedItem(FUNCTION_NAME_ATTRIBUTE_NAME);
if (functionNameNode != null) {
this.functionName = functionNameNode.getNodeValue();
} else {
throw new CompilationException("function name is not set");
}
Node nodeUseOnlyThisParameters = nnm
.getNamedItem(USE_ONLY_THIS_PARAMETERS);
if (nodeUseOnlyThisParameters != null) {
this.useOnlyEnumeratingParaments = Boolean
.getBoolean(nodeUseOnlyThisParameters.getNodeValue());
} // if
// read name of variable if need
Node variableName = nnm.getNamedItem(VAR_ATTRIBUTE_NAME);
if (variableName != null) {
this.variable = variableName.getNodeValue();
} // if
// read name of parameters if need
ParameterProcessor parameterProcessor = new ParameterProcessor(element,
componentBean);
this.parameters = parameterProcessor.getParameters();
log.debug(this.parameters);
List decodeFunctionName = null;
decodeFunctionName = Arrays.asList(this.functionName
.split(FUNCTION_DELIMITER));
if (null == decodeFunctionName) {
decodeFunctionName = new ArrayList();
decodeFunctionName.add(this.functionName);
}
ArrayList functionNames = new ArrayList();
String lastClassName = componentBean.getFullBaseclass();
for (Iterator iter = decodeFunctionName.iterator(); iter.hasNext();) {
String elementFunction = (String) iter.next();
try {
log.debug("Try to load class : " + lastClassName);
Class clazz = componentBean.loadClass(lastClassName);
if (!iter.hasNext()) {
String method = getMethod(clazz, elementFunction);
if (method != null) {
log.debug(method);
functionNames.add(method);
} else {
log.error("Method " + elementFunction
+ " not found in class : " + lastClassName);
throw new CompilationException();
}
} else {
//
// Probing properties !!!!
//
PropertyDescriptor propertyDescriptor = getPropertyDescriptor(
clazz, elementFunction);
if (propertyDescriptor != null) {
functionNames.add(propertyDescriptor.getReadMethod()
.getName()
+ "()");
log.debug("Property " + elementFunction
+ " mapped to function : "
+ propertyDescriptor.getReadMethod().getName());
lastClassName = propertyDescriptor.getPropertyType()
.getName();
} else {
log.error("Property " + elementFunction
+ " not found in class : " + lastClassName);
throw new CompilationException();
}
}
} catch (Throwable e) {
log.error("Error load class : " + lastClassName + ", "
+ e.getLocalizedMessage());
e.printStackTrace();
throw new CompilationException("Error load class : "
+ lastClassName, e);
}
}