Author: hqm
Date: 2007-11-26 14:46:57 -0800 (Mon, 26 Nov 2007)
New Revision: 7375
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryCompiler.java
Log:
Change 20071126-hqm-a by [EMAIL PROTECTED] on 2007-11-26 17:45:51 EST
in /cygdrive/c/users/hqm/openlaszlo/trunk/WEB-INF/lps/server/src
for http://svn.openlaszlo.org/openlaszlo/trunk/WEB-INF/lps/server/src
Summary: add cache for parsing libraries
New Features:
Bugs Fixed: LPP-5150
Technical Reviewer: ptw
QA Reviewer: ewinard
Doc Reviewer:
Documentation:
Release Notes:
Details:
cache the parsed library XML DOM in the compilation environment for
the duration of the compilation
Tests:
smoke
lzmail
amazon
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
===================================================================
---
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
2007-11-26 22:44:27 UTC (rev 7374)
+++
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/CompilationEnvironment.java
2007-11-26 22:46:57 UTC (rev 7375)
@@ -49,6 +49,9 @@
public static final String USER_DEBUG_WINDOW = "userdebugwindow";
+ /** Cache for holding DOM tree from parsing library file */
+ public HashMap parsedLibraryCache = new HashMap();
+
/** The root file being compiled. This is used to resolve
* relative pathnames. */
protected File mApplicationFile = null;
Modified:
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryCompiler.java
===================================================================
---
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryCompiler.java
2007-11-26 22:44:27 UTC (rev 7374)
+++
openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/LibraryCompiler.java
2007-11-26 22:46:57 UTC (rev 7375)
@@ -20,7 +20,7 @@
class LibraryCompiler extends ToplevelCompiler {
final static String HREF_ANAME = "href";
final static String INCLUDES_ANAME = "includes";
-
+
/** Logger
*/
private static Logger mLogger = Logger.getLogger(LibraryCompiler.class);
@@ -70,13 +70,19 @@
env.getLoadableImportedLibraryFiles().put(key,
env.getApplicationFile());
}
- Document doc = env.getParser().parse(file, env);
- Element root = doc.getRootElement();
- mLogger.debug("" + file + ": " + root + " attributes: " +
root.getAttributes());
- // Look for and add any includes from a binary library
- String includesAttr = root.getAttributeValue(INCLUDES_ANAME);
- File base = new
File(Parser.getSourcePathname(root)).getParentFile();
- if (includesAttr != null) {
+ Element root = null;
+
+ if (env.parsedLibraryCache.get(file) != null) {
+ root = (Element) env.parsedLibraryCache.get(file);
+ } else {
+ Document doc = env.getParser().parse(file, env);
+ root = doc.getRootElement();
+ env.parsedLibraryCache.put(file, root);
+ mLogger.debug("" + file + ": " + root + " attributes: " +
root.getAttributes());
+ // Look for and add any includes from a binary library
+ String includesAttr = root.getAttributeValue(INCLUDES_ANAME);
+ File base = new
File(Parser.getSourcePathname(root)).getParentFile();
+ if (includesAttr != null) {
// This modularity sucks
Set binaryIncludes =
env.getFileResolver().getBinaryIncludes();
for (StringTokenizer st = new
StringTokenizer(includesAttr);
@@ -87,8 +93,8 @@
visited.add(canon);
binaryIncludes.add(canon);
}
+ }
}
-
return root;
} else {
return null;
_______________________________________________
Laszlo-checkins mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-checkins