incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r482475 - in /incubator/xap/trunk/src/xap: macro/ mco/ session/ taghandling/ xml/ xml/xmodify/
Date Tue, 05 Dec 2006 03:49:55 GMT
Author: mturyn
Date: Mon Dec  4 19:49:53 2006
New Revision: 482475

URL: http://svn.apache.org/viewvc?view=rev&rev=482475
Log:
From: Rob Gagne

Fix for defect XAP-193

Added check for (xap.util.LogFactory.s_loggingEnabled) before ...s_log.debug.  Even though
the method internally checked, some of the log entries were building large strings before
calling the function.

This was causing high CPU on IE for simple operations.

Modified:
    incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js
    incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js
    incubator/xap/trunk/src/xap/session/DeclarativeArgumentParser.js
    incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js
    incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js
    incubator/xap/trunk/src/xap/xml/XalNamespaceHandler.js
    incubator/xap/trunk/src/xap/xml/xmodify/CommandDirective.js
    incubator/xap/trunk/src/xap/xml/xmodify/Xmodify.js

Modified: incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js?view=diff&rev=482475&r1=482474&r2=482475
==============================================================================
--- incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js (original)
+++ incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js Mon Dec  4 19:49:53 2006
@@ -68,8 +68,9 @@
 		 		xap.xml.InvalidXmlException.MISSING_ATTRIBUTE_MSGID,
 				new Array( "id", element.toXml( true ))));
 	}
-	xap.macro.MacroNamespaceHandler.s_log.debug( "Create macro id: ["+ id + 
-								"] from element: [" + element.toXml() + "]");
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.macro.MacroNamespaceHandler.s_log.debug( "Create macro id: ["+ id + 
+									"] from element: [" + element.toXml() + "]");
 	 
 	//TODO we really need to clarify whether or not XAP is a generic wrapping
 	//tag or something with more meaning

Modified: incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js?view=diff&rev=482475&r1=482474&r2=482475
==============================================================================
--- incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js (original)
+++ incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js Mon Dec  4 19:49:53 2006
@@ -130,8 +130,9 @@
 		}
 	}
 	
-	xap.mco.McoNamespaceHandler.s_log.debug( "Creating mco id: ["+ id + "] from class: [" 
-									 + className + "]");
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.mco.McoNamespaceHandler.s_log.debug( "Creating mco id: ["+ id + "] from class: [" 
+										 + className + "]");
 									 
 	//we STILL don't have an MCO constructor, try require() on the class name
 	if( !mcoConstructor ){
@@ -159,7 +160,7 @@
 	try {
 		// We can do the following because we're argless:
 		var mco = new mcoConstructor ;
-		xap.mco.McoNamespaceHandler.s_log.debug("Created mco: " + mco);
+		if (xap.util.LogFactory.s_loggingEnabled) xap.mco.McoNamespaceHandler.s_log.debug("Created
mco: " + mco);
 		//TODO info if replacing existing macro?
 		session.getMcoContainer().put( id, mco );
 		

Modified: incubator/xap/trunk/src/xap/session/DeclarativeArgumentParser.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/session/DeclarativeArgumentParser.js?view=diff&rev=482475&r1=482474&r2=482475
==============================================================================
--- incubator/xap/trunk/src/xap/session/DeclarativeArgumentParser.js (original)
+++ incubator/xap/trunk/src/xap/session/DeclarativeArgumentParser.js Mon Dec  4 19:49:53 2006
@@ -145,7 +145,8 @@
 xap.session.DeclarativeArgumentParser.prototype.parseArgument = function( args, startIndex,
 	sourceElement, clientEvent) {
 	
-	xap.session.DeclarativeArgumentParser.s_log.debug("Parse argument [ " + args + "] at start
index:" + startIndex);
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.session.DeclarativeArgumentParser.s_log.debug("Parse argument [ " + args + "] at start
index:" + startIndex);
 	var arg = new String();
 	var parseResult = null;
 
@@ -156,13 +157,15 @@
 		//we had better hit a ',' or a ')' next
 		if (parseResult!=null){
 			if (c==','){
-				xap.session.DeclarativeArgumentParser.s_log.debug("HIt a comma, returning arg" + arg);
+				if (xap.util.LogFactory.s_loggingEnabled)
+					xap.session.DeclarativeArgumentParser.s_log.debug("HIt a comma, returning arg" + arg);
 				parseResult._terminatingIndex = nextChar;
 				parseResult._parseStatus = this._ParseResult.COMMA_ENCOUNTERED;
 				return parseResult;
 			}
 			else if (c==')'){
-				xap.session.DeclarativeArgumentParser.s_log.debug("HIt a close paren, returning arg"
+ arg);
+				if (xap.util.LogFactory.s_loggingEnabled)
+					xap.session.DeclarativeArgumentParser.s_log.debug("HIt a close paren, returning arg"
+ arg);
 				parseResult._terminatingIndex = nextChar;
 				parseResult._parseStatus = this._ParseResult.CLOSING_PAREN;
 				return parseResult;
@@ -184,14 +187,16 @@
 			//if we hit a ' or " with only whitespace before it that's
 		   //a string
 			if ( (c=='\"' || c=='\'') && arg.trim().length==0){
-				xap.session.DeclarativeArgumentParser.s_log.debug("Hit an open string char, parsing string");
+				if (xap.util.LogFactory.s_loggingEnabled)
+					xap.session.DeclarativeArgumentParser.s_log.debug("Hit an open string char, parsing
string");
 				parseResult =  this._parseString(args,nextChar, c);
 				nextChar = parseResult._terminatingIndex;
 			}
 			
 			//if we get an '(' anywhere it means this must be an 'mco' call of some sort
 			else if (c=='('){
-				xap.session.DeclarativeArgumentParser.s_log.debug("Hit an open paren, parsing args");
+				if (xap.util.LogFactory.s_loggingEnabled)
+					xap.session.DeclarativeArgumentParser.s_log.debug("Hit an open paren, parsing args");
 				var mcoCallResult = this._parseArguments(args,sourceElement,nextChar+1, clientEvent);
 			    
 			   //TODO trim is needed here
@@ -231,11 +236,13 @@
 				var mcoName = mco.substring(0,periodIndex);
 				var methodName = mco.substring(periodIndex+1);
 				    
-				xap.session.DeclarativeArgumentParser.s_log.debug("Firing an object event");
+				if (xap.util.LogFactory.s_loggingEnabled)
+					xap.session.DeclarativeArgumentParser.s_log.debug("Firing an object event");
 				var callResult =
 					this._fireObjectEvent(containerName,mcoName,methodName,mcoCallResult._resultObject);
 					
-				xap.session.DeclarativeArgumentParser.s_log.debug("Object event returned : " + callResult);
+				if (xap.util.LogFactory.s_loggingEnabled)
+					xap.session.DeclarativeArgumentParser.s_log.debug("Object event returned : " + callResult);
 				    
 				parseResult = new this._ParseResult(callResult,mcoCallResult._terminatingIndex);
 				    
@@ -245,7 +252,8 @@
 			//if we hit a comma we must have had a plain old literal
 			//if the literal is all whitespace this will throw an exception
 			else if (c==','){
-				xap.session.DeclarativeArgumentParser.s_log.debug("Hit comma after arg:" + arg);
+				if (xap.util.LogFactory.s_loggingEnabled)
+					xap.session.DeclarativeArgumentParser.s_log.debug("Hit comma after arg:" + arg);
 				return new this._ParseResult(this._stringToMcoArgument(arg, sourceElement, clientEvent),
 			                nextChar,this._ParseResult.COMMA_ENCOUNTERED);
 				//TODO check for all whitespace here or someplace else?
@@ -256,7 +264,8 @@
 			//if we hit a ) we are also done
 			else if (c==')'){
 				
-				xap.session.DeclarativeArgumentParser.s_log.debug("Hit a close paren");
+				if (xap.util.LogFactory.s_loggingEnabled)
+					xap.session.DeclarativeArgumentParser.s_log.debug("Hit a close paren");
 				    
 				//an empty thing is fine if for example we got
 		 		//myMco.doSomething()
@@ -291,14 +300,16 @@
 	//so you can't do something like
 	//text="{   }"
 	if (parseResult==null){
-		xap.session.DeclarativeArgumentParser.s_log.debug("Exited loop without a parse result at
all");
+		if (xap.util.LogFactory.s_loggingEnabled)
+			xap.session.DeclarativeArgumentParser.s_log.debug("Exited loop without a parse result
at all");
 		return new this._ParseResult(this._stringToMcoArgument(arg,sourceElement, clientEvent),
 			args.length-1,this._ParseResult.END_OF_STRING);
 	}
 	
 	//if there was a parse result just set the terminating index up properly
 	else{
-		xap.session.DeclarativeArgumentParser.s_log.debug("Exited loop with a parse result");
+		if (xap.util.LogFactory.s_loggingEnabled)
+			xap.session.DeclarativeArgumentParser.s_log.debug("Exited loop with a parse result");
 		parseResult._terminatingIndex = args.length-1;
   		parseResult._parseStatus = this._ParseResult.END_OF_STRING;
    	return parseResult;
@@ -313,7 +324,8 @@
  * @private
  */
 xap.session.DeclarativeArgumentParser.prototype._parseArguments = function( argumentsString,
sourceElement, index, clientEvent){
-	xap.session.DeclarativeArgumentParser.s_log.debug("Parse arguments: " + argumentsString
+ " at index " + index);
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.session.DeclarativeArgumentParser.s_log.debug("Parse arguments: " + argumentsString
+ " at index " + index);
 	var args = new Array();
 	//keep calling parseAgument until we are done,
 	//then stick all the results in an object[]
@@ -377,10 +389,12 @@
 xap.session.DeclarativeArgumentParser.prototype._stringToMcoArgument =
 	function(arg, thisElement, clientEvent){
 
-	xap.session.DeclarativeArgumentParser.s_log.debug("Convert string [" + arg + "] to argument");
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.session.DeclarativeArgumentParser.s_log.debug("Convert string [" + arg + "] to argument");
 	arg = arg.trim();	
 	if (arg.indexOf(":")!=-1){
-		xap.session.DeclarativeArgumentParser.s_log.debug("Found a colon, convert to object reference");
+		if (xap.util.LogFactory.s_loggingEnabled)
+			xap.session.DeclarativeArgumentParser.s_log.debug("Found a colon, convert to object reference");
 		var index = arg.indexOf(":");
 		var containerName = arg.substring(0,index);
 		var mcoName = arg.substring(index+1);
@@ -401,17 +415,20 @@
 	    //note that this RETURNS a macro and does not RUN it!
 	}
 	else if (arg=="true") {
-		xap.session.DeclarativeArgumentParser.s_log.debug("Found true");
+		if (xap.util.LogFactory.s_loggingEnabled)
+			xap.session.DeclarativeArgumentParser.s_log.debug("Found true");
 		//TODO do we have to do this sort of thing, can we rely on JS type conversion stuff?
 		return true ;
 	}
 	else if (arg=="false"){
-		xap.session.DeclarativeArgumentParser.s_log.debug("Found false");
+		if (xap.util.LogFactory.s_loggingEnabled)	
+			xap.session.DeclarativeArgumentParser.s_log.debug("Found false");
 		return false ;
 	}
 	else{  
 		var num = parseFloat(arg);
-		xap.session.DeclarativeArgumentParser.s_log.debug("Converted to float: " + num);
+		if (xap.util.LogFactory.s_loggingEnabled)
+			xap.session.DeclarativeArgumentParser.s_log.debug("Converted to float: " + num);
 		if (!isNaN(num)){
 			return num; 
 		}
@@ -441,13 +458,12 @@
    		xap.session.DeclarativeArgumentParser.s_log.debug("Found element: " + element);
                              	
    		if (element){
-	   		if (!elementAttribute) return element;
-   		
-	   
-				var attributeValue = element.getAttribute(elementAttribute);
+	   		if (!elementAttribute) return element;   		
+			var attributeValue = element.getAttribute(elementAttribute);
+			if (xap.util.LogFactory.s_loggingEnabled)
 				xap.session.DeclarativeArgumentParser.s_log.debug("FOund attribute: " + attributeValue);
-				if (!attributeValue) attributeValue = ""; 
-				return attributeValue;
+			if (!attributeValue) attributeValue = ""; 
+			return attributeValue;
 			
    		}
 	}
@@ -503,8 +519,9 @@
     	
 	}
 	
-	xap.session.DeclarativeArgumentParser.s_log.debug("Fire object event [" + methodName +"]
on the object " + mcoName + 
-		" with arguments " + args);
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.session.DeclarativeArgumentParser.s_log.debug("Fire object event [" + methodName +"]
on the object " + mcoName + 
+			" with arguments " + args);
 	try{
 		return o[methodName].apply(o,args);
 	}
@@ -528,7 +545,8 @@
  
 xap.session.DeclarativeArgumentParser.prototype._parseString = function(args, startIndex,
terminatingCharacter){
 	
-	xap.session.DeclarativeArgumentParser.s_log.debug("Parse string :" + args + " at start index
" + startIndex);
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.session.DeclarativeArgumentParser.s_log.debug("Parse string :" + args + " at start
index " + startIndex);
 	var result = new this._ParseResult(null,startIndex);
 	var arg = new String();
 	startIndex++; //first must be a " or '

Modified: incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js?view=diff&rev=482475&r1=482474&r2=482475
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js (original)
+++ incubator/xap/trunk/src/xap/taghandling/PluginDocumentHandler.js Mon Dec  4 19:49:53 2006
@@ -190,9 +190,10 @@
 		//if the implementing class name is null do what we used to do
 		//and print out an error
 		if ( bridgeClass == null ) {
-			xap.taghandling.PluginDocumentHandler.s_log.debug( "No mapping for tag name [" + 
-					tagName + "] with namespace [" +
-					namespace + "] on document [" + this._documentName + "]");
+			if (xap.util.LogFactory.s_loggingEnabled)
+				xap.taghandling.PluginDocumentHandler.s_log.debug( "No mapping for tag name [" + 
+						tagName + "] with namespace [" +
+						namespace + "] on document [" + this._documentName + "]");
 			xap.taghandling.PluginDocumentHandler.s_log.error( "No mapping found for tag " + 
 										tagName + ", namespace=" + namespace );
 			return null;

Modified: incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js?view=diff&rev=482475&r1=482474&r2=482475
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js (original)
+++ incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js Mon Dec  4 19:49:53 2006
@@ -78,7 +78,7 @@
  */
 xap.taghandling.PluginRegistryImpl.prototype.addPluginDescription = function( fileContents
){
 	
-	xap.taghandling.PluginRegistryImpl.s_log.debug("Add plugin description");
+	if (xap.util.LogFactory.s_loggingEnabled) xap.taghandling.PluginRegistryImpl.s_log.debug("Add
plugin description");
 	var parser = xap.xml.ParserFactory.getParser();
 	var pluginDocument =  null;
 	
@@ -97,10 +97,10 @@
 	xap.taghandling.PluginRegistryImpl.s_log.debug(tagMappingSections.value.length + " mapped
tags");
 	this._parseTagMappingElements(tagMappingSections.value,true);		
 
-	xap.taghandling.PluginRegistryImpl.s_log.debug("Parse unmapped tags");
+	if (xap.util.LogFactory.s_loggingEnabled) xap.taghandling.PluginRegistryImpl.s_log.debug("Parse
unmapped tags");
 	tagMappingSections = 
 		google.xpathDomEval(xap.taghandling.PluginRegistryImpl.UNMAPPED_TAGS_PATH , pluginDocument);

-	xap.taghandling.PluginRegistryImpl.s_log.debug(tagMappingSections.value.length + " unmapped
tags");
+	if (xap.util.LogFactory.s_loggingEnabled) xap.taghandling.PluginRegistryImpl.s_log.debug(tagMappingSections.value.length
+ " unmapped tags");
 	this._parseTagMappingElements(tagMappingSections.value,false);
 
 	//TODO this returns an array but we want a string, get the first element node value?
@@ -115,7 +115,8 @@
 
 xap.taghandling.PluginRegistryImpl.prototype.loadLifecycleObject = function( lifecycleClassName
){
 	
-	xap.taghandling.PluginRegistryImpl.s_log.debug("lifecycle class = " + lifecycleClassName);
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.taghandling.PluginRegistryImpl.s_log.debug("lifecycle class = " + lifecycleClassName);
 	
 	if (lifecycleClassName){
 		try{
@@ -195,11 +196,12 @@
 				tagName = tagElement.getAttribute("name");
 				
 				if (tagName==null || tagName.length==0){
-					xap.taghandling.PluginRegistryImpl.s_log.error(
-						"Missing tag name (\"local name\") from tag element:\n"
-						+ tagElement
-						+"\n...; mapping will continue for other tag defs."
-						                                             ) ;
+					if (xap.util.LogFactory.s_loggingEnabled)
+						xap.taghandling.PluginRegistryImpl.s_log.error(
+							"Missing tag name (\"local name\") from tag element:\n"
+							+ tagElement
+							+"\n...; mapping will continue for other tag defs."
+												     ) ;
 					continue;
 				}
 				

Modified: incubator/xap/trunk/src/xap/xml/XalNamespaceHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/xml/XalNamespaceHandler.js?view=diff&rev=482475&r1=482474&r2=482475
==============================================================================
--- incubator/xap/trunk/src/xap/xml/XalNamespaceHandler.js (original)
+++ incubator/xap/trunk/src/xap/xml/XalNamespaceHandler.js Mon Dec  4 19:49:53 2006
@@ -75,7 +75,8 @@
  */
 xap.xml.XalNamespaceHandler.prototype.receiveDispatch = function( element ) {
 	if (xap.xml.XalNamespaceHandler.s_log.isDebug()){
-		xap.xml.XalNamespaceHandler.s_log.debug("receiveDispatch:" + element);
+		if (xap.util.LogFactory.s_loggingEnabled)
+			xap.xml.XalNamespaceHandler.s_log.debug("receiveDispatch:" + element);
 	}
 	 
 	 //get the root and just append to it

Modified: incubator/xap/trunk/src/xap/xml/xmodify/CommandDirective.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/xml/xmodify/CommandDirective.js?view=diff&rev=482475&r1=482474&r2=482475
==============================================================================
--- incubator/xap/trunk/src/xap/xml/xmodify/CommandDirective.js (original)
+++ incubator/xap/trunk/src/xap/xml/xmodify/CommandDirective.js Mon Dec  4 19:49:53 2006
@@ -61,22 +61,22 @@
 
 xap.xml.xmodify.CommandDirective = function(elemDirectiveElement, session)
 {
-    /* Call our superclass' xap.xml.xmodify.UpdateDirective */
-    xap.xml.xmodify.UpdateDirective.call( this, elemDirectiveElement );  
-
-    this._selectAttr = elemDirectiveElement.getAttribute("select");
-    this._commandArguments = elemDirectiveElement.childNodes ;
-    // Will set later, just before we execute this directive:
-    this._commandTargets = null ;
-
-    /* For mandatory arguments, like for set-attributes */
-    if ((this._commandArguments.length == 0) &&
-	   (this._strType == "set-attribute") ) /* We'll replace this with a mustHaveArgs() func
*/
+	/* Call our superclass' xap.xml.xmodify.UpdateDirective */
+	xap.xml.xmodify.UpdateDirective.call( this, elemDirectiveElement );  
+	
+	this._selectAttr = elemDirectiveElement.getAttribute("select");
+	this._commandArguments = elemDirectiveElement.childNodes ;
+	// Will set later, just before we execute this directive:
+	this._commandTargets = null ;
+	
+	/* For mandatory arguments, like for set-attributes */
+	if ((this._commandArguments.length == 0) &&
+		(this._strType == "set-attribute") ) /* We'll replace this with a mustHaveArgs() func */
 	{
-	    throw new xap.xml.xmodify.XmodifyException(xap.xml.xmodify.XmodifyException.COMMAND_EXPECTS_ONE_ARG,"set-attribute")
;   
+		throw new xap.xml.xmodify.XmodifyException(xap.xml.xmodify.XmodifyException.COMMAND_EXPECTS_ONE_ARG,"set-attribute")
;   
 	}
-
-    this._session = session;  
+	
+	this._session = session;  
 }
 
 xap.xml.xmodify.CommandDirective.s_log = xap.util.LogFactory.getLog( "xap.xml.xmodify.Xmodify"
);
@@ -147,7 +147,7 @@
           this._handleSetInnerHtml(uiDocumentNode);
           break;                            	                               
         default: 
-	       xap.xml.xmodify.UpdateDirective.s_log.debug("Unhandled command : "+this._strType);
+	       if (xap.util.LogFactory.s_loggingEnabled) xap.xml.xmodify.UpdateDirective.s_log.debug("Unhandled
command : "+this._strType);
     } /* end switch */
 } /* end execute */
 
@@ -222,14 +222,15 @@
 {
     var targetNodes = this._commandTargets ;
     var elemsToAppend = this._commandArguments;      
-    xap.xml.xmodify.CommandDirective.s_log.debug (
-			 "We have " 
-			 + elemsToAppend.length 
-			 + " children  to append to " 
-			 + this._selectAttr 
-			 + ": " 
-			 + this.formatDocument(uiDocumentNode)
-			 );
+    if (xap.util.LogFactory.s_loggingEnabled)
+	    xap.xml.xmodify.CommandDirective.s_log.debug (
+				 "We have " 
+				 + elemsToAppend.length 
+				 + " children  to append to " 
+				 + this._selectAttr 
+				 + ": " 
+				 + this.formatDocument(uiDocumentNode)
+				 );
   							
     for (var i = 0; i < targetNodes.length ; i ++)
     {
@@ -244,11 +245,12 @@
 		    {
 			throw new xap.xml.xmodify.XmodifyException(xap.xml.xmodify.XmodifyException.SET_ROOT_ELEMENT_EXPECTS_ONE_ARG);
 		    }
-
-		xap.xml.xmodify.CommandDirective.s_log.debug (
-                "We have 1 elem to append as new root : " 
-                + elemsToAppend[0]
-                );
+		
+		if (xap.util.LogFactory.s_loggingEnabled)
+			xap.xml.xmodify.CommandDirective.s_log.debug (
+			"We have 1 elem to append as new root : " 
+			+ elemsToAppend[0]
+			);
 		currentNode.setRootElement(elemsToAppend[0]);
          
     } else if (currentNode.nodeType == google.DOM_ELEMENT_NODE ){
@@ -278,9 +280,10 @@
         }
     } /* end for i < targetNodes.length...*/
 
-    xap.xml.xmodify.CommandDirective.s_log.debug("Post Append uIDoc: \n " 
-			+ this.formatDocument(uiDocumentNode) 
-			);
+	if (xap.util.LogFactory.s_loggingEnabled)
+	    xap.xml.xmodify.CommandDirective.s_log.debug("Post Append uIDoc: \n " 
+				+ this.formatDocument(uiDocumentNode) 
+				);
 
 
 
@@ -336,7 +339,8 @@
 	}
     }; /* End for */
 
-    xap.xml.xmodify.CommandDirective.s_log.debug("Post Set-Attr: \n " + this.formatDocument(uiDocumentNode)
);
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.CommandDirective.s_log.debug("Post Set-Attr: \n " + this.formatDocument(uiDocumentNode)
);
  
 } /* end handleSetAttribute */
 
@@ -383,7 +387,8 @@
     var xpathRemoved = this._selectAttr;
     var targetNodes = this._commandTargets ;  
 
-    xap.xml.xmodify.CommandDirective.s_log.debug('removing the element at XPath : ' 
+	if (xap.util.LogFactory.s_loggingEnabled)
+	xap.xml.xmodify.CommandDirective.s_log.debug('removing the element at XPath : ' 
             + xpathRemoved + " Results: " 
             + targetNodes.length
             );
@@ -438,6 +443,7 @@
         }; /* end for */
 
     } catch (e) {alert(e.message);}
+    if (xap.util.LogFactory.s_loggingEnabled)
         xap.xml.xmodify.CommandDirective.s_log.debug("Post Remove: " + this.formatDocument(uiDocumentNode));
 
 } /* end handleRemove */
@@ -458,10 +464,11 @@
     var parentSelector = this._selectAttr;
     var targetNodes = this._commandTargets ;  
 
-    xap.xml.xmodify.CommandDirective.s_log.debug('Removing the children of nodes for XPath
: ' 
-            + parentSelector + " Results: " 
-            + targetNodes.length
-            );
+	if (xap.util.LogFactory.s_loggingEnabled)
+	    xap.xml.xmodify.CommandDirective.s_log.debug('Removing the children of nodes for XPath
: ' 
+		    + parentSelector + " Results: " 
+		    + targetNodes.length
+		    );
 
 
     try{
@@ -492,7 +499,8 @@
     } catch (e) {
         alert(e.message);
     } 
-        xap.xml.xmodify.CommandDirective.s_log.debug("Post Remove: " + this.formatDocument(uiDocumentNode));
+    if (xap.util.LogFactory.s_loggingEnabled)
+	xap.xml.xmodify.CommandDirective.s_log.debug("Post Remove: " + this.formatDocument(uiDocumentNode));
 //xap.xml.xmodify.Xmodify.DEBUG=false ;        
 
 } /* end _handleRemoveChildren */
@@ -512,7 +520,8 @@
     var attrsToRemove = this._commandArguments ;
     var targetNodes = this._commandTargets ;  
 
-    xap.xml.xmodify.CommandDirective.s_log.debug("Pre Remove-Attr: "+this._selectAttr+"\n
" + this.formatDocument(uiDocumentNode) );
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.CommandDirective.s_log.debug("Pre Remove-Attr: "+this._selectAttr+"\n "
+ this.formatDocument(uiDocumentNode) );
 
     for (var i = 0; i < targetNodes.length ; i ++){
         var currentNode = targetNodes[i];
@@ -544,7 +553,8 @@
      }
     }; // (End iterating over attribute[s] to remove.)
 
-    xap.xml.xmodify.CommandDirective.s_log.debug("Post Remove-Attr: \n " + this.formatDocument(uiDocumentNode)
);
+    if (xap.util.LogFactory.s_loggingEnabled)
+	xap.xml.xmodify.CommandDirective.s_log.debug("Post Remove-Attr: \n " + this.formatDocument(uiDocumentNode)
);
  
 } /* end handleRemoveAttribute */
 
@@ -666,11 +676,13 @@
         }
 
         // Do the simple thing, at this point:
-        xap.xml.xmodify.CommandDirective.s_log.debug("Pre insert-before: <" + currentNode.nodeName+"/>:\n"
+ this.formatDocument(parent));
+        if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.CommandDirective.s_log.debug("Pre insert-before: <" + currentNode.nodeName+"/>:\n"
+ this.formatDocument(parent));
         
         this._insertCommandArgumentsBefore(parent,currentNode) ;
 
-        xap.xml.xmodify.CommandDirective.s_log.debug("Post insert-before:  <" + currentNode.nodeName+"/>:\n"
+ this.formatDocument(parent) );
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.CommandDirective.s_log.debug("Post insert-before:  <" + currentNode.nodeName+"/>:\n"
+ this.formatDocument(parent) );
 
 
         //this.insertCommandArgumentsAt(index, parent, contextNode, i);
@@ -720,11 +732,13 @@
         }
 
         // Do the simple thing, at this point:
-        xap.xml.xmodify.CommandDirective.s_log.debug("Pre insert-after: <" + currentNode.nodeName+"/>:\n"
+ this.formatDocument(parent));
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.CommandDirective.s_log.debug("Pre insert-after: <" + currentNode.nodeName+"/>:\n"
+ this.formatDocument(parent));
         
         this._insertCommandArgumentsAfter(parent,currentNode) ;
 
-        xap.xml.xmodify.CommandDirective.s_log.debug("Post insert-after:  <" + currentNode.nodeName+"/>:\n"
+ this.formatDocument(parent) );
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.CommandDirective.s_log.debug("Post insert-after:  <" + currentNode.nodeName+"/>:\n"
+ this.formatDocument(parent) );
 
 
         //this.insertCommandArgumentsAt(index, parent, contextNode, i);
@@ -843,6 +857,7 @@
 			throw new xap.xml.xmodify.XmodifyException(xap.xml.xmodify.XmodifyException.CANNOT_REPLACE__ORIGINAL_INVALID,""+oldChild)
;
 		}	
     }
+    if (xap.util.LogFactory.s_loggingEnabled)
 	xap.xml.xmodify.CommandDirective.s_log.debug("Post replacement:\n" + this.formatDocument(contextNode));
     
 
@@ -871,10 +886,11 @@
          newChild = arrArguments[ii] ;
          // Just try it for XNode and descendants so far:
          if (oldChild instanceof google.XNode){
-          xap.xml.xmodify.CommandDirective.s_log.debug(
-            "Pre insertion of " + this.formatDocument(newChild)+"\nbefore\n" 
-            + this.formatDocument(oldChild)
-            + this.formatDocument(parent) 
+		if (xap.util.LogFactory.s_loggingEnabled)
+		  xap.xml.xmodify.CommandDirective.s_log.debug(
+		    "Pre insertion of " + this.formatDocument(newChild)+"\nbefore\n" 
+		    + this.formatDocument(oldChild)
+		    + this.formatDocument(parent) 
                                 ) ;
           try {
               parent.insertBefore(
@@ -884,16 +900,18 @@
           } catch (insertionException){
               throw new xap.xml.xmodify.XmodifyException(xap.xml.xmodify.XmodifyException.CANNOT_REPLACE__INSERTION,newChild.nodeName,""+insertionException);
           }
-          xap.xml.xmodify.CommandDirective.s_log.debug(
-            "Post insertion of " + this.formatDocument(newChild) +"\nbefore\n" 
-            + this.formatDocument(oldChild)
-            + this.formatDocument(parent) 
+		if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.CommandDirective.s_log.debug(
+		    "Post insertion of " + this.formatDocument(newChild) +"\nbefore\n" 
+		    + this.formatDocument(oldChild)
+		    + this.formatDocument(parent) 
                                 ) ;                             
          } else if (this._bHtmlDocument){
-              xap.xml.xmodify.CommandDirective.s_log.debug(
-                "Pre insertion of " + this.formatDocument(newChild)+"\nbefore\n" 
-                + this.formatDocument(oldChild)
-                + this.formatDocument(parent) 
+		if (xap.util.LogFactory.s_loggingEnabled)
+		      xap.xml.xmodify.CommandDirective.s_log.debug(
+			"Pre insertion of " + this.formatDocument(newChild)+"\nbefore\n" 
+			+ this.formatDocument(oldChild)
+			+ this.formatDocument(parent) 
                                     ) ;
               try {
                   parent.insertBefore(
@@ -930,10 +948,10 @@
                        ""+replacementException
                        );     
     } finally {
-  xap.xml.xmodify.CommandDirective.s_log.debug(
-    "Post all insertions and removals composited into replacement:"
-    + '\n'+ this.formatDocument(parent) 
-                                ) ;
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.CommandDirective.s_log.debug(
+			"Post all insertions and removals composited into replacement:"
+			+ '\n'+ this.formatDocument(parent)) ;
     	//xap.xml.xmodify.Xmodify.DEBUG=false;
     }// end of 'try'/catch  blocks around iteration over nodes to to replace in
         

Modified: incubator/xap/trunk/src/xap/xml/xmodify/Xmodify.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/xml/xmodify/Xmodify.js?view=diff&rev=482475&r1=482474&r2=482475
==============================================================================
--- incubator/xap/trunk/src/xap/xml/xmodify/Xmodify.js (original)
+++ incubator/xap/trunk/src/xap/xml/xmodify/Xmodify.js Mon Dec  4 19:49:53 2006
@@ -68,7 +68,8 @@
 	 */
     this._directiveSet.execute(uiDoc, this._modificationsElement.baseUrl);
 
-    xap.xml.xmodify.Xmodify.s_log.debug(uiDoc);
+	if (xap.util.LogFactory.s_loggingEnabled)
+		xap.xml.xmodify.Xmodify.s_log.debug(uiDoc);
 }  /* end execute */
 
 //-----------------------------------------------------------------------



Mime
View raw message