[Laszlo-checkins] r16681 - openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler

bargull@openlaszlo.org bargull at openlaszlo.org
Wed Jun 9 12:59:29 PDT 2010


Author: bargull
Date: 2010-06-09 12:59:26 -0700 (Wed, 09 Jun 2010)
New Revision: 16681

Modified:
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/DataCompiler.java
   openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
Log:
Change 20100609-bargull-8VB by bargull at Bargull02 on 2010-06-09 18:11:27
    in /home/anba/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: allow <dataset> src attribute to be a constraint

New Features:

Bugs Fixed: LPP-1905 (dataset src attribute can't be a once expression)

Technical Reviewer: henry
QA Reviewer: max
Doc Reviewer: (pending)

Documentation:

Release Notes:

Overview:
    

Details:
Handle constraint values for the "src" attribute in DataCompiler.Element() and in NodeModel.elementAsModelInternal().
And made the constraint pattern in NodeModel static, so it won't be recreated for every element.
    

Tests:
test case from bug report



Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/DataCompiler.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/DataCompiler.java	2010-06-09 19:22:37 UTC (rev 16680)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/DataCompiler.java	2010-06-09 19:59:26 UTC (rev 16681)
@@ -3,19 +3,15 @@
 * ****************************************************************************/
 
 /* J_LZ_COPYRIGHT_BEGIN *******************************************************
-* Copyright 2001-2009 Laszlo Systems, Inc.  All Rights Reserved.              *
+* Copyright 2001-2010 Laszlo Systems, Inc.  All Rights Reserved.              *
 * Use is subject to license terms.                                            *
 * J_LZ_COPYRIGHT_END *********************************************************/
 
 package org.openlaszlo.compiler;
-import org.openlaszlo.auth.AuthenticationException;
-import org.openlaszlo.iv.flash.api.action.*;
-import java.io.*;
+import java.util.regex.Pattern;
+
 import org.openlaszlo.sc.ScriptCompiler;
 import org.jdom.Element;
-import org.jdom.Text;
-import org.jdom.Content;
-import org.jdom.JDOMException;
 import org.openlaszlo.xml.internal.XMLUtils;
 
 /** Compiler for local data elements.
@@ -36,6 +32,9 @@
 
     static final String LOCAL_DATA_FNAME = "canvas.lzAddLocalData";
 
+    // Pattern matcher for '$once{...}' style constraints
+    private static final Pattern constraintPat = Pattern.compile("^\\s*\\$(\\w*)\\s*\\{(.*)\\}\\s*");
+
     DataCompiler(CompilationEnvironment env) {
         super(env);
     }
@@ -51,7 +50,8 @@
             if (src != null && src.indexOf("http:") == 0) {
                 return false;
             }
-            return src == null || !XMLUtils.isURL(src);
+            // not an element for this compiler when the is an url or a constraint
+            return ! (src != null && (XMLUtils.isURL(src) || constraintPat.matcher(src).matches()));
         }
         return false;
     }

Modified: openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java	2010-06-09 19:22:37 UTC (rev 16680)
+++ openlaszlo/trunk/WEB-INF/lps/server/src/org/openlaszlo/compiler/NodeModel.java	2010-06-09 19:59:26 UTC (rev 16681)
@@ -609,7 +609,7 @@
             String type = elt.getAttributeValue("type");
 
             if ((type != null && ("soap".equals(type) || "http".equals(type)))
-                || (src != null && XMLUtils.isURL(src))
+                || (src != null && (XMLUtils.isURL(src) || constraintPat.matcher(src).matches()))
                 || "true".equals(datafromchild)) {
                 contentIsLiteralXMLData = false;
             }
@@ -1764,7 +1764,7 @@
 
 
     // Pattern matcher for '$once{...}' style constraints
-    Pattern constraintPat = Pattern.compile("^\\s*\\$(\\w*)\\s*\\{(.*)\\}\\s*");
+    private static final Pattern constraintPat = Pattern.compile("^\\s*\\$(\\w*)\\s*\\{(.*)\\}\\s*");
 
 
     CompiledAttribute compileAttribute(



More information about the Laszlo-checkins mailing list