Author: nbelaevski
Date: 2007-08-29 09:22:39 -0400 (Wed, 29 Aug 2007)
New Revision: 2569
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/builder/AbstractCompilationContext.java
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/el/ELCompiler.java
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/A4JRendererElementsFactory.java
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp/FCallTemplateElement.java
Log:
CDK output redirected to logs
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/builder/AbstractCompilationContext.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/builder/AbstractCompilationContext.java 2007-08-29
13:21:28 UTC (rev 2568)
+++
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/builder/AbstractCompilationContext.java 2007-08-29
13:22:39 UTC (rev 2569)
@@ -36,6 +36,8 @@
import org.ajax4jsf.templatecompiler.elements.TemplateElement;
import org.apache.commons.beanutils.MethodUtils;
import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.velocity.VelocityContext;
import org.apache.velocity.exception.ParseErrorException;
import org.apache.velocity.exception.ResourceNotFoundException;
@@ -49,6 +51,8 @@
*
*/
public abstract class AbstractCompilationContext implements CompilationContext {
+ private static final Log log = LogFactory.getLog(AbstractCompilationContext.class);
+
final private static String VCPBODY = "VCPBODY";
final private static String regexComponent = "(.*)" + VCPBODY +
"(.*)"
@@ -342,7 +346,7 @@
}
if (null == clazz) {
- System.out.println("Error load class: " + className);
+ log.error("Error load class: " + className);
throw new ClassNotFoundException();
}
return clazz;
@@ -360,7 +364,7 @@
public Class getMethodReturnedClass(Class clazz, String methodName,
Class[] parametersTypes) {
Class returnedType = null;
- System.out.println("class : " + clazz.getName() + "\n\t method : "
+ log.debug("class : " + clazz.getName() + "\n\t method : "
+ methodName + "\n\t paramTypes : "
+ Arrays.asList(parametersTypes).toString());
@@ -369,10 +373,10 @@
if (null != method) {
returnedType = method.getReturnType();
- System.out.println("Method found, return type : "
+ log.debug("Method found, return type : "
+ returnedType.getName());
} else {
- System.out.println("Method not found");
+ log.error("Method not found: " + clazz + "#" + methodName +
"(" + parametersTypes + ")");
}
return returnedType;
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/el/ELCompiler.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/el/ELCompiler.java 2007-08-29
13:21:28 UTC (rev 2568)
+++
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/el/ELCompiler.java 2007-08-29
13:22:39 UTC (rev 2569)
@@ -32,6 +32,8 @@
import org.ajax4jsf.templatecompiler.builder.CompilationContext;
import org.ajax4jsf.templatecompiler.builder.StringUtils;
import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import com.sun.el.parser.ArithmeticNode;
import com.sun.el.parser.AstBracketSuffix;
@@ -60,6 +62,8 @@
*/
public class ELCompiler implements IELCompiler {
+ private static final Log log = LogFactory.getLog(ELCompiler.class);
+
Map functionsMap = new HashMap();
static {
@@ -181,7 +185,7 @@
sb.append(" (");
sb.append(node.getClass().getName());
sb.append(")");
- System.out.println(sb.toString());
+ log.debug(sb.toString());
}
return returnValue;
@@ -207,14 +211,14 @@
if (node1 != null) {
if (!(returnValue = processingNode(node.jjtGetChild(0), sb1,
componentBean))) {
- System.out.println("Error processing node1: "
+ log.error("Error processing node1: "
+ node.jjtGetChild(0).getImage());
}
}
if (!(returnValue = processingNode(node.jjtGetChild(1), sb2,
componentBean))) {
- System.out.println("Error processing node2: "
+ log.error("Error processing node2: "
+ node.jjtGetChild(1).getImage());
}
@@ -281,9 +285,9 @@
private boolean processingFunction(AstFunction node, StringBuffer sb,
CompilationContext componentBean) {
- System.out.println("Processing function : " + node.getPrefix());
- System.out.println("Processing function : " + node.getLocalName());
- System.out.println("Processing function : " + node.getOutputName());
+ log.debug("Processing function : " + node.getPrefix());
+ log.debug("Processing function : " + node.getLocalName());
+ log.debug("Processing function : " + node.getOutputName());
if (node.getPrefix().equals("this")) {
sb.append(node.getLocalName());
@@ -414,7 +418,7 @@
}
} else if (subChild instanceof AstDotSuffix) {
String propertyName = subChild.getImage();
- System.out.println("Object: " + lastVariableType
+ log.debug("Object: " + lastVariableType
+ ", property: " + propertyName);
if (lastVariableType != null) {
@@ -431,7 +435,7 @@
+ lastVariableType);
}
- System.out.println("propertyObject: "
+ log.debug("propertyObject: "
+ propertyDescriptor.getPropertyType()
.getName());
StringBuffer tmpbuf = new StringBuffer();
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/A4JRendererElementsFactory.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/A4JRendererElementsFactory.java 2007-08-29
13:21:28 UTC (rev 2568)
+++
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/A4JRendererElementsFactory.java 2007-08-29
13:22:39 UTC (rev 2569)
@@ -33,6 +33,8 @@
import org.ajax4jsf.templatecompiler.elements.vcp.AjaxRenderedAreaElement;
import org.ajax4jsf.templatecompiler.elements.vcp.HeaderScriptsElement;
import org.ajax4jsf.templatecompiler.elements.vcp.HeaderStylesElement;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Node;
/**
@@ -45,6 +47,8 @@
*/
public class A4JRendererElementsFactory implements ElementsFactory {
+ private static final Log log = LogFactory.getLog(A4JRendererElementsFactory.class);
+
public static final String TEMPLATES_PATH = "META-INF/templates";
public static final String TEMPLATES_TEMPLATECOMPILER_PATH =
TEMPLATES_PATH+"/templatecompiler";
@@ -135,7 +139,7 @@
if (!className.equals("")) {
Class class1;
try {
- System.out.println("loading class: " + className);
+ log.debug("loading class: " + className);
class1 = Class.forName(className);
Object[] objects = new Object[2];
Modified:
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp/FCallTemplateElement.java
===================================================================
---
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp/FCallTemplateElement.java 2007-08-29
13:21:28 UTC (rev 2568)
+++
trunk/cdk/generator/src/main/java/org/ajax4jsf/templatecompiler/elements/vcp/FCallTemplateElement.java 2007-08-29
13:22:39 UTC (rev 2569)
@@ -33,6 +33,8 @@
import org.ajax4jsf.templatecompiler.elements.A4JRendererElementsFactory;
import org.ajax4jsf.templatecompiler.elements.TemplateElementBase;
import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.velocity.VelocityContext;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -45,6 +47,8 @@
* @version $Revision: 1.1.2.3 $ $Date: 2007/02/26 20:48:47 $
*/
public class FCallTemplateElement extends TemplateElementBase {
+ private static final Log log = LogFactory.getLog(FCallTemplateElement.class);
+
private String functionName;
private String variable;
@@ -102,7 +106,7 @@
componentBean);
this.parameters = parameterProcessor.getParameters();
- System.out.println(this.parameters);
+ log.debug(this.parameters);
List decodeFunctionName = null;
@@ -120,17 +124,17 @@
String elementFunction = (String) iter.next();
try {
- System.out.println("Try to load class : " + lastClassName);
+ log.debug("Try to load class : " + lastClassName);
Class clazz = componentBean.loadClass(lastClassName);
if (!iter.hasNext()) {
String method = getMethod(clazz, elementFunction);
if (method != null) {
- System.out.println(method);
+ log.debug(method);
functionNames.add(method);
} else {
- System.out.println("Method " + elementFunction
+ log.error("Method " + elementFunction
+ " not found in class : " + lastClassName);
throw new CompilationException();
}
@@ -147,13 +151,13 @@
functionNames.add(propertyDescriptor.getReadMethod()
.getName()
+ "()");
- System.out.println("Property " + elementFunction
+ log.debug("Property " + elementFunction
+ " mapped to function : "
+ propertyDescriptor.getReadMethod().getName());
lastClassName = propertyDescriptor.getPropertyType()
.getName();
} else {
- System.out.println("Property " + elementFunction
+ log.error("Property " + elementFunction
+ " not found in class : " + lastClassName);
throw new CompilationException();
}
@@ -161,7 +165,7 @@
} catch (Throwable e) {
- System.out.println("Error load class : " + lastClassName + ", "
+ log.error("Error load class : " + lastClassName + ", "
+ e.getLocalizedMessage());
e.printStackTrace();
throw new CompilationException("Error load class : "