You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by bb...@apache.org on 2006/11/28 00:11:16 UTC

svn commit: r479818 - in /incubator/xap/trunk/src/xap: application/Application.js html/HtmlConnector.js session/ClientSession.js

Author: bbuffone
Date: Mon Nov 27 16:11:15 2006
New Revision: 479818

URL: http://svn.apache.org/viewvc?view=rev&rev=479818
Log:
changed the way the configuration of paths work. I added a srcPath to the 
config file.  This tells the XAP engine where the src files are located relative to the
start page.

Modified:
    incubator/xap/trunk/src/xap/application/Application.js
    incubator/xap/trunk/src/xap/html/HtmlConnector.js
    incubator/xap/trunk/src/xap/session/ClientSession.js

Modified: incubator/xap/trunk/src/xap/application/Application.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/application/Application.js?view=diff&rev=479818&r1=479817&r2=479818
==============================================================================
--- incubator/xap/trunk/src/xap/application/Application.js (original)
+++ incubator/xap/trunk/src/xap/application/Application.js Mon Nov 27 16:11:15 2006
@@ -83,12 +83,14 @@
     if (this._applicationConfig.context == null){
     	this._applicationConfig.context = "../../";
     }
-	this._session = new xap.session.ClientSession(this._applicationConfig.context, 
-	                                    this._applicationConfig.toolkitType, 
-	                                    this._applicationConfig.element);
+    //need to make sure there is a default context supplied.
+    if (this._applicationConfig.srcPath == null){
+    	this._applicationConfig.srcPath = "../../";
+    }
+	this._session = new xap.session.ClientSession(this);
 	
     //now start the session this will retrieve the start page from the server.    
-	this._session._start(this._applicationConfig);	
+	this._session._start();	
 }
 
 /**
@@ -106,7 +108,7 @@
  * file properties as will as the supplied properties to the constructor
  */
 xap.application.Application.prototype.getConfiguration = function() {
-	return this._configuationObject;
+	return this._applicationConfig;
 }
 
 /**

Modified: incubator/xap/trunk/src/xap/html/HtmlConnector.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/html/HtmlConnector.js?view=diff&rev=479818&r1=479817&r2=479818
==============================================================================
--- incubator/xap/trunk/src/xap/html/HtmlConnector.js (original)
+++ incubator/xap/trunk/src/xap/html/HtmlConnector.js Mon Nov 27 16:11:15 2006
@@ -58,13 +58,14 @@
  *  
  */
 xap.html.HtmlConnector.getNextXapLabel = function(){
-	return "unlabelled_xaplet_"+ (++xap.html.HtmlConnector.xapletCount) ;
+	return "xapApplication_"+ (++xap.html.HtmlConnector.xapApplication) ;
 }
 
 /**
  * Embedded attributes for xap.
  */
 xap.html.HtmlConnector.APPLICATION_CONTEXT_ATTRIBUTE__NAME="context";
+xap.html.HtmlConnector.APPLICATION_SRC_PATH_ATTRIBUTE__NAME="srcPath";
 xap.html.HtmlConnector.APPLICATION_ID_ATTRIBUTE__NAME = "applicationName";
 xap.html.HtmlConnector.APPLICATION_SOURCE_ATTRIBUTE__NAME = "startPage";
 xap.html.HtmlConnector.APPLICATION_TOOLKIT_ATTRIBUTE__NAME = "toolkitType";
@@ -118,6 +119,12 @@
 		}
 		
 		// what's the load context for plugin.xml or its equivalent?---default to boot context:
+		var srcPath = element.getAttribute(xap.html.HtmlConnector.APPLICATION_SRC_PATH_ATTRIBUTE__NAME);
+		if(srcPath==null){
+			srcPath = xap.html.HtmlConnector.APPLICATION_CONTEXT_DEFAULT;
+		}
+		
+		// what's the load context for plugin.xml or its equivalent?---default to boot context:
 		var configFilePath = element.getAttribute(xap.html.HtmlConnector.APPLICATION_CONFIGFILEPATH_ATTRIBUTE__NAME);
 		if(configFilePath==null){
 			configFilePath = xap.html.HtmlConnector.APPLICATION_CONFIGFILEPATH_DEFAULT;
@@ -133,6 +140,7 @@
 			    applicationName: applicationId,
 				startPage: startPage,
 				context: context,
+				srcPath: srcPath,
 				scanPage: false,
 				element: element,
 				configFilePath: configFilePath

Modified: incubator/xap/trunk/src/xap/session/ClientSession.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/session/ClientSession.js?view=diff&rev=479818&r1=479817&r2=479818
==============================================================================
--- incubator/xap/trunk/src/xap/session/ClientSession.js (original)
+++ incubator/xap/trunk/src/xap/session/ClientSession.js Mon Nov 27 16:11:15 2006
@@ -44,11 +44,11 @@
 //-----------------------------------------------------------------------
 // Constructors.
 //-----------------------------------------------------------------------
-xap.session.ClientSession = function( webappContext,toolkitType, parentElement ) {
-	
-	this._namesToContainers = new xap.util.Hashtable();
-	this._webappContext = webappContext;
+xap.session.ClientSession = function( application ) {
+	this._application = application;
+	alert(this._application);
 	
+	this._namesToContainers = new xap.util.Hashtable();	
 	this._mcoContainer = new xap.session.Container(this);
 	this.addContainer("mco", this._mcoContainer);
 	
@@ -101,6 +101,10 @@
 	return this._attributeResolver;
 }
 
+xap.session.ClientSession.prototype.getApplication = function() {
+	return this._application;
+}
+
 /**
  * Returns the container used to house user-defined MCOs.
  *
@@ -217,10 +221,10 @@
 /**
  * @private
  */
-xap.session.ClientSession.prototype._start = function( appConfigObject ) {
+xap.session.ClientSession.prototype._start = function() {
     //enable logging if needed.
-    if(appConfigObject.loggingEnabled != null) {
-		if(appConfigObject.loggingEnabled == "true") {
+    if(this.getApplication().getConfiguration().loggingEnabled != null) {
+		if(this.getApplication().getConfiguration().loggingEnabled == "true") {
 			xap.util.LogFactory.enableLogging()
 		} else {
 			xap.util.LogFactory.disableLogging();
@@ -228,22 +232,23 @@
 	}
 	
 	//process any plugin class or files.
-	if (appConfigObject.pluginFiles){
-		this._processPluginConfigurationFiles( appConfigObject.pluginFiles );
+	if (this.getApplication().getConfiguration().pluginFiles){
+		this._processPluginConfigurationFiles( this.getApplication().getConfiguration().pluginFiles );
 	}
-	if (appConfigObject.pluginClasses){
-		this._processPluginConfigurationClasses( appConfigObject.pluginClasses );
+	if (this.getApplication().getConfiguration().pluginClasses){
+		this._processPluginConfigurationClasses( this.getApplication().getConfiguration().pluginClasses );
 	}
 	
-	if (appConfigObject.element != null){
-		this._createInitialDocument(appConfigObject.toolkitType, appConfigObject.element);
+	if (this.getApplication().getConfiguration().element != null){
+		this._createInitialDocument(this.getApplication().getConfiguration().toolkitType, 
+		            this.getApplication().getConfiguration().element);
 	}	
 
 	var requestService = this.getRequestService();
 	
 	try{
-        if (appConfigObject.startPage){
-		    requestService.retrieveStartPage( appConfigObject.startPage );
+        if (this.getApplication().getConfiguration().startPage){
+		    requestService.retrieveStartPage( this.getApplication().getConfiguration().startPage );
 		}
 	}
 	catch( exception ){
@@ -259,7 +264,7 @@
 	var requestService = this.getRequestService();
 	for( var i = 0; i < pluginFiles.length; i++ ) {
 		var fileLocation = pluginFiles[ i ];
-		var response = requestService.retrieve(this._webappContext + fileLocation);
+		var response = requestService.retrieve(this.getApplication().getConfiguration().context + fileLocation);
 		this._pluginRegistry.addPluginDescription(response.responseText);	
 	}
 }