You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-dev@incubator.apache.org by Bob Buffone <rb...@nexaweb.com> on 2006/08/29 16:09:52 UTC

Configuration

Xap currently provides a XapConfig.xml file that is used to configure
some of the properties of the Xap Application.  Below are my
recommendations for cleaning up configuration.


Configuration:

1.) There is currently no single place to define all the configuration
properties of a Xap application. Some properties are defined in the
XapConfig.js file and some properties are defined in the creation of the
Xap application.  
3.) The format of the configuration file is also Xml which needs to be
parsed, and is in a different format from the proposed configuration
object supplied to the createApplication method.  
4.) Now way to add configuration information for third party plugins and
supply the configuration to plugins.

Proposed Changes:

1.) Change the format of the XapConfig file from Xml to JSON.
2.) Use the same structure and property names of the config file for the
configuration object supplied to the createApplication method.
3.) Allow users to supply all, some or none of the configuration
properties to the createApplication.
4.) All properties supplied to createApplication override the properties
in the configuration file. 
4.) Provide some mechanism for plugin providers to extend the
configuration file with there properties.

Supplied below is a copy of the proposed configuration file.

// Start XapConfig.js

/* This is the default Xap configuration file that will be used to
specified 
 * different runtime settings of the Xap application. Xap application
provide
 * for paramenter overriding in the following way.
 *
 * The default values for an application come from this file. When an
application is loaded
 * the developer can specify a configuration object to the
Xap.createApplication method.
 * any value in that object will override these parameters (Array
parameters will NOT be merged).
 * If the developer has specified page scaning then the Xap attributes
on the HTML element
 * will then override the values supplied to the Xap.createApplication.
Each HTML element that is
 * found is treated as a seperate XAP application.
 *
 * Parameter Override workflow:
 * 1) This configuration file.
 * 2a) The config object specified to the Xap.createApplication method.
 * 2b) Any xap parameters embeded in a html element found during page
scanning.
 *
 * For more information on using the JSON format go to www.json.org.
 */
{
    /**
     * This is the default name for the application.  Users can access
this
     * application by using the Xap.applications["myApplicationName"]
     *
     * Accepted Values: can be null, undefined, or any String.
     */
	applicationName: "xapApplication",

	/**
	 * This is the default starting page for the application.  When
the application is 
	 * started it will load this page to create the applications
user interface.
       *
       * Accepted Values: can be null, undefined, or any url the is an
acceptable Xal document.
	 */
	startPage: "index.xal",

	/**
	 * This is the default context for the application. When
resources are loaded either by
	 * using the request service or as a event handler.
       *
       * Accepted Values: The root of the application as compared to the
start web page.
	 */
	context: "../../",

	/**
	 * This is the default toolkit type.
       *
       * Accepted Values: any defined toolkit.
	 */
	toolkitType: "dojo",

	/**
	 * This is the default list of debuggable classes that will be
loaded.
       *
       * Accepted Values: can be null, undefined, or any Array of class
names.
	 */
	debuggables : [
    		"xap.session.ClientSession",
    		"xap.taghandling.AbstractTagImpl",
    		"xap.bridges.basic.AbstractBlackBoxWidgetBridge",
    		"xap.bridges.dojo.DojoWidgetBridge",
    		"xap.bridges.dojo.DojoColorPaletteBridge"
    	],

	/**
	 * This is the default list of plugin classes that will be
loaded.  Place any class that needs
	 * to be loaded into during initialization.
       *
       * Accepted Values: can be null, undefined, or any Array of class
names.
	 */
      pluginClasses: [
        	"xap.mco.McoNamespaceHandler",
        	"xap.xml.xmodify.XmodifyNamespaceHandler",
        	"xap.macro.MacroNamespaceHandler",
        	"xap.xml.XalNamespaceHandler"
       ],

	/**
	 * This is the default list of plugin classes that will be
loaded.  Place any class that needs
	 * to be loaded into during initialization. Plugin classes need
to implement the "pluginLoaded"
	 * method.
       *
       * Accepted Values: can be null, undefined, or any Array of class
names.
	 */
       pluginFiles: [
        	"src/xap/taghandling/plugin.xml"
       ],

	/**
	 * This is the default id of the html element that will host the
Xap application.
	 * If the element is null or undefined then the root is assumed
to be the body.
       *
       * Accepted Values: can be null, undefined, or id of the element
that will be the 
       *                  root of the application.
	 */
       element: null,

	/**
	 * The debug value determines whether or not debugging is turned
on in the Xap client.
       *
       * Accepted Values: can be null, undefined, or true / false.
	 */
	debug: false,
	
	/**
	 * The loggingEnabled value determines whether or not logging is
turned on in the Xap client.
	 * if logging is enabled then a new window will open that has
the log produced by the Xap client
	 * during runtime.  It is not recommended to close the logging
window during execution.
       *
       * Accepted Values: can be null, undefined, or true / false.
	 */
	loggingEnabled: true,

	/**
	 * The scanPage value determines whether or not to scan the page
during application creation.
	 * Scanning the page will cause Xap to look for all HTML dom
element that include Xap specific
	 * attribute and use those attributes to initialize a Xap
application hosted in that location.
       *
       * Accepted Values: can be null, undefined, or true / false.
	 */
	scanPage: false
}

//End XapConfig.js


Bob (Buffone)

RE: Configuration

Posted by Michael Turyn <MT...@nexaweb.com>.
I don't know about anyone else, but I'm more comfortable with using XML
than with JSON because I think there may be more to Xap than JavaScript
some day; I think we gain very little from using JSON for initial
configuration (as opposed to multiply-repeated data feeds) because we
only need to do it once.