incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r428172 - /incubator/xap/trunk/src/xap/Xap.js
Date Wed, 02 Aug 2006 22:06:30 GMT
Author: mturyn
Date: Wed Aug  2 15:06:30 2006
New Revision: 428172

URL: http://svn.apache.org/viewvc?rev=428172&view=rev
Log:
Broke out object hierarchy analysis pieces of Xap into xap.util.ObjectHierarchyAnalyzer as
a first step of reducing Xap bloat.

Modified:
    incubator/xap/trunk/src/xap/Xap.js

Modified: incubator/xap/trunk/src/xap/Xap.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/Xap.js?rev=428172&r1=428171&r2=428172&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/Xap.js (original)
+++ incubator/xap/trunk/src/xap/Xap.js Wed Aug  2 15:06:30 2006
@@ -229,6 +229,7 @@
 	Xap.require("xap.util.XapException" ) ;
 	Xap.require("xap.util.Exception" ) ;
 	Xap.require("xap.util.Profiler" ) ;
+	Xap.require("xap.util.ObjectHierarchyAnalyzer" ) ;	
 	
 
 	//xap.session
@@ -439,193 +440,4 @@
 	xap.util.Utils.importFile(  sourceRootDir + "src/xap/components/zimbra/DwtHorizontalLayoutPanel.js"
);	
 
 }
-
-
-Xap.getAllClasses = function(name,arr){
-	var theArray = null ;
-	if (!arr ){
-		theArray = new Array(0) ;
-	} else {
-		theArray = arr ;
-	}
-	var pushClass = function(){ 
-									if(arguments[0][3]){
-											theArray.push(arguments[0][1]) ;
-									} 
-								}
-	// At each node
-	Xap.walkClassTree(name, pushClass) ;
-	return theArray ;
-}
-
-
-
-
-
-Xap.walkClassTree = function(name,callbackFunction,level,object){
-	var theLevel = -1 ;
-	if( level ){
-		theLevel = level ;
-	} else {
-		theLevel=0 ;
-	}
-	var theObject = null ;
-	if( object ){
-		theObject = object ;
-	} else {
-		try {
-			var theObject = eval(name) ;
-		} catch(ee){
-			return ;
-		}
-	}
-	var args = [] ;
-	args.push(this) ;
-	args.push(name) ;
-	args.push(theObject);
-	if ( theObject.prototype ){
-		// Let the callback know that this is a class, not a package node:
-		args.push(true) ;
-		callbackFunction.call(this,args) ;
-	} else {
-		for (var oo in theObject){			
-		// Let the callback know that this is a package node, not a class
-			args.push(false) ;
-	 // Better in a different order?
- 			callbackFunction.call(this,args) ;
-			Xap.walkClassTree(name+"."+oo,callbackFunction,theLevel+1 );
-		}
-	}
-
-	return ;
-}
-
-// Regular expressions for finding and manipulation Xap.require() or dojo.require()
-// statements in code:
-Xap.require_startRegexp = /^.*require\S\s*['"]/  ;
-Xap.require_endRegexp = /["'].*$/ ;
-// Exclude algorithmic .require() statements that aren't just quoted strings:
-Xap.requireRegexp = /(Xap|dojo)\.require\(\s*['"]\S*?['"]\s*\)/mg ;
-
-Xap.getDependencies = function(className){
-	var requirements = [] ;
-	if( !Xap._requestService ){
-		Xap._requestService = new xap.requestservice.RequestService( this );
-	}
-	
-	// Build a file path from a class name:
-	var filePath = "../../src/"+ className.replace(Xap.allFullstopsRegexp,"/") + ".js" ;
-	
-	// Get the source for the class:
-	var classSource = Xap._requestService.retrieve( filePath ).responseText;
-	
-	// These are the lines that have a Xap.require() or a dojo.require() statement in them:
-	var requireLines = classSource.match(Xap.requireRegexp) ;
-	
-	if(!requireLines){
-		return requirements;
-	}
-	
-	for(var jj=0; jj < requireLines.length; ++jj){
-		// extract the argument to the .require():
-		var req = requireLines[jj].replace(Xap.require_startRegexp,"");
-		req=req.replace(Xap.require_endRegexp,"") ;
-		requirements.push(req) ;
-		var bkp=-1 ;
-	}
-		
-	return requirements ;
-}
-
-
-Xap.getAllDependencies = function(name,holder,level){
-
-	var theLevel = -1 ;
-	if(level){
-		theLevel = level ;
-	} else {
-		theLevel = 0 ;
-	}
-
-	if( holder && holder[name]){
-		return ;
-	}
-    
-   
-	var theHolder= null ;
-	if (!holder ){
-		theHolder = new Object() ;
-	} else {
-		theHolder = holder ;
-	}
-	
-	try {
-		var theObject = eval(name) ;
-	} catch (ee){
-		Xap._logString += ("Problem with getting dependencies for \""+name+"\":\n"+ee) ;
-		return ;
-	}
-	
-	if(!theObject){
-		return ;
-	}
-	
-	if ( theObject.prototype ){
-		theHolder[name] = Xap.getDependencies(name) ;
-		var nextLevel = 1+ theLevel ;
-		for(var ii=0; ii<theHolder[name].length; ++ii ){
-			Xap.getAllDependencies( (theHolder[name])[ii] ,theHolder,nextLevel) ;
-		}
-	} else {
-		if ( theLevel == 0){
-			var clazzes = Xap.getAllClasses ("xap") ;
-			var nextLevel = 1+ theLevel ;			
-			for(var jj=0; jj < clazzes.length; ++jj){
-				Xap.getAllDependencies(clazzes[jj],theHolder,nextLevel) ;
-			}
-			
-/*			var arr = new Array(0) ; 
- *			for( key in theHolder){ 
- *				arr.push(key+"::"+theHolder[key].join(","))
- *			}
- *			prompt("",arr.join("^")) ;		
- */			
-			return  theHolder;			
-		}
-	}
-}
-
-Xap.resolveConstructor = function(aString){
-	var scoper = dj_global ;
-	var arr  = aString.split(".") ;
-	for( var kk=0; kk< arr.length - 1; ++kk ){
-		scoper = scoper[arr[kk]] ;
-	}
-	return  scoper[arr[arr.length-1]] ;
-}
-
-
-
-/**
- * Handles common class set-up routines, assumes constructors for subclass and superclass
already exist:
-**/ 
-Xap.setupClassAsSubclassOf = function(subclassName,superclassName,sub,sup){
-	var subclassConstructor = Xap.resolveConstructor( subclassName ) ;
-	var superclassConstructor = Xap.resolveConstructor( superclassName ) ;	
-	
-	if(superclassName){
-		Xap.require(superclassName) ;
-	}
-	dojo.inherits(subclassConstructor, superclassConstructor) ;
-	subclassConstructor.prototype.toString = function(){
-		return subclassName ;	
-	}
-	subclassConstructor.prototype.superclass = 	superclassConstructor.prototype ;
-	subclassConstructor.s_log = xap.util.LogFactory.getLog( subclassName ) ;
-}
-
-
-
-
-
 



Mime
View raw message