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 jm...@apache.org on 2007/02/13 02:12:27 UTC

svn commit: r506811 - /incubator/xap/trunk/codebase/src/xap/data/DataFramework.js

Author: jmargaris
Date: Mon Feb 12 18:12:26 2007
New Revision: 506811

URL: http://svn.apache.org/viewvc?view=rev&rev=506811
Log:
fixed bad merge

Modified:
    incubator/xap/trunk/codebase/src/xap/data/DataFramework.js

Modified: incubator/xap/trunk/codebase/src/xap/data/DataFramework.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/DataFramework.js?view=diff&rev=506811&r1=506810&r2=506811
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/data/DataFramework.js (original)
+++ incubator/xap/trunk/codebase/src/xap/data/DataFramework.js Mon Feb 12 18:12:26 2007
@@ -19,24 +19,22 @@
  
 Xap.provide("xap.data.DataFramework");
 
-
-Xap.require("xap.session.ClientEvent");
-Xap.require("xap.session.ClientSession"); 
-Xap.require("xap.mco.ContainerLifeCycleObject");
-Xap.require("xap.session.DeclarativeArgumentParser"); 
 Xap.require("xap.data.controller.Binding") ;
 Xap.require("xap.session.Container") ;
-Xap.require("xap.data.controller.BindingType") ; 
+Xap.require("xap.data.controller.BindingType") ;
 Xap.require("xap.resolver.ResolutionInfo");
+Xap.require("xap.data.controller.IteratorContainerImpl");
+
 
 /**
- * Thisclass encapsulates all the data primitives available for a client session.
+ * This class encapsulates all the data primitives available for a client session.
  * It may be used to lookup bindings, formatters, data source, and validators.
  *  
  * @author dgennaco
+ * @author jmargaris
  */
 
-Xap.setupClassAsSubclassOf("xap.data.DataFramework", "xap.mco.ContainerLifeCycleObject");
+
 /**
  * @constructor
  * @param sess{ClientSession}
@@ -46,100 +44,107 @@
 	this._session = sess;
 	this._dataSourceContainer =  new xap.session.Container(sess);
 	this._bindingContainer = new xap.session.Container(sess);
-// TODO: use the appropriate containers---just
-// placeholders here to avoid follow-on errors.									
+								
 	this._formatterContainer = new xap.session.Container(sess);
 	this._iteratorContainer = new xap.data.controller.IteratorContainerImpl(sess);
 		
-		//add the dataSourceContainer to the container of containers
-		//to support doing something like dataSource://myDataSource.do()
+	//add the dataSourceContainer to the container of containers
+	//to support doing something like dataSource://myDataSource.do()
 	this._session.addContainer("dataSource", this._dataSourceContainer);
 	this._session.addContainer("formatter", this._formatterContainer);
 	this._session.addContainer("binding", this._bindingContainer);
 };
-/*	private static final String */
-xap.data.DataFramework.MCO_ID = "DataService";
-/*	private ClientSession */
-xap.data.DataFramework.prototype._session = null;
-/*private BindingContainerImpl */
-xap.data.DataFramework.prototype._bindingContainer = null;
-
-
-/*private BindingResolver */
-xap.data.DataFramework.prototype._bindingResolver = null;
-/*private IteratorContainerImpl */
-xap.data.DataFramework.prototype._iteratorContainer = null;
-/**
-	 * this.get the data service associated with the session.
-	 * 
-	 * @param sess{ClientSession} The session.
-	 * 
-	 * @return The data service.
-	 */
-/*public DataServiceImpl*/
+
+
+/**
+ * this.get the data service associated with the session.
+ * 
+ * @param sess{ClientSession} The session.
+ * 
+ * @return The data service.
+ */
 xap.data.DataFramework.getDataService = function (sess) {
 	/*DataFramework*/
-	var dataService = /*(DataFramework)*/
-		sess.getSystemContainer().get(xap.data.DataFramework.MCO_ID);
+	var dataService = sess.getSystemContainer().get('DataService');
 	if (!dataService) {
 		dataService = new xap.data.DataFramework(sess);
-		sess.getSystemContainer().put(xap.data.DataFramework.MCO_ID, dataService);
-		/*McoArgumentParser*/
+		sess.getSystemContainer().put('DataService', dataService);
 		
-		// TODO: Get the parser...
+		/*McoArgumentParser*/
 		mcoParser = sess.getSystemContainer().get("McoArgumentParser");
 			
-			// add shortcuts to the binding methods.
+		// add shortcuts to the binding methods.
 		// ...so we can do the following:
-		mcoParser.addFunctionShortcut("*", xap.data.DataFramework.MCO_ID + ".relativeBind");
-		mcoParser.addFunctionShortcut("bind", xap.data.DataFramework.MCO_ID + ".bind");
+		mcoParser.addFunctionShortcut("*", 'DataService.relativeBind');
+		mcoParser.addFunctionShortcut("bind", 'DataService.bind');
 	}
 	return dataService;
 };
+
 /**
-	 * Returns the binding resolver for the data service. INTERNAL
-	 * USE ONLY!
-	 * 
-	 * @return the binding resolver.
-	 */
-/*public BindingResolver*/
+ * Returns the binding resolver for the data service.
+ * 
+ * @return {xap.data.controller.BindingResolver} The binding resolver.
+ */
 xap.data.DataFramework.prototype.getBindingResolver = function () {
 	return this._bindingResolver;
 };
+
 /**
-	 * Set the binding resolver for the data service. INTERNAL
-	 * USE ONLY!
-	 * 
-	 * @param b{BindingResolver} the binding resolver
-	 */
-/*public void*/
+ * Set the binding resolver for the data service.
+ * 
+ * @param {xap.data.controller.BindingResolver} b The binding resolver
+ */
 xap.data.DataFramework.prototype.setBindingResolver = function (b) {
 	this._bindingResolver = b;
 };
+
 /**
-	 * Get the iterator container, INTERNAL USE ONLY!
-	 * FUTURE expose this, and make a binding interface
-	 *  
-	 * @return the iterator container
-	 */
-/*public BindingContainer*/
+ * Returns the binding container for the data service.
+ * 
+ * @return {xap.session.Container} The binding container.
+ */
 xap.data.DataFramework.prototype.getBindingContainer = function () {
 	return this._bindingContainer;
 };
 
-
-
 /**
-	 * Get the iterator container, INTERNAL USE ONLY!
-	 * 
-	 * @return the iterator container
-	 */
-/*public IteratorContainer*/
+ * Returns the binding container for the data service.
+ * 
+ * @return {xap.data.controller.IteratorContainerImpl} The iterator container.
+ */
 xap.data.DataFramework.prototype.getIteratorContainer = function () {
 	return this._iteratorContainer;
 };
 
 
+/**
+ * Returns the formatter container for the data service.
+ * 
+ * @return {xap.session.Container} The formatter container.
+ */
+xap.data.DataFramework.prototype.getFormatterContainer = function () {
+	return this._formatterContainer;
+};
+
+/**
+ * Returns the data source container for the data service.
+ * 
+ * @return {xap.session.Container} The data source container.
+ */
+xap.data.DataFramework.prototype.getDataSourceContainer = function () {
+	return this._dataSourceContainer;
+};
+
+
+xap.data.DataFramework.prototype.removedFromContainer = function () {
+	this._bindingContainer.destroy();
+	this._formatterContainer.destroy();
+	this._dataSourceContainer.destroy();
+	this._iteratorContainer.destroy();
+};
+
+
 
 
 /**
@@ -168,72 +173,12 @@
 								bindString,
 								this._session, 
 								xap.data.controller.BindingType.ONE_TIME, 
-								null
-									);
+								null);
 	return this.bindBinding(binding);
 };
 
-/*public void*/
-xap.data.DataFramework.prototype.unload = function () {
-	this._bindingContainer.destroy();
-	this._formatterContainer.destroy();
-	this_dataSourceContainer.destroy();
-	this._iteratorContainer.destroy();
-	xap.mco.ContainerLifeCycleObject.unload.call(this);
-};
-
-
-// Implementors of DataService
 
 
-/*private container */
-xap.data.DataFramework.prototype._formatterContainer = null;
-/*private container */
-xap.data.DataFramework.prototype._dataSourceContainer = null;
-
-/**
- * The exception type used for all data framework exception
- * reporting. 
-	 
- Fake it for now:
-	 
- *public static final int
- */
-// Implementor of DataService interface: xap.data.DataFramework.DATA_FRAMEWORK_EXCEPTION_TYPE = 10000;
-xap.data.DataFramework.DATA_FRAMEWORK_EXCEPTION_TYPE = "Data framework exception." ; //10000;
-//ExceptionContext.MAX_RANGE + 100;
-/**
- * Get the formatter container.
- * 
- * @return The container of formatters, never <code>null</code>.
- *
- * @public
- * @return {FormatterContainer}
- **/
-// Implementor of DataService interface: xap.data.DataFramework.prototype.getFormatterContainer = function () {
-xap.data.DataFramework.prototype.getFormatterContainer = function () {
-	return this._formatterContainer;
-};
-// Implementor of DataService interface: xap.data.DataFramework.prototype.setFormatterContainer = function (aContainer) {
-xap.data.DataFramework.prototype.setFormatterContainer = function (aContainer) {
-	this._formatterContainer = aContainer;
-};
-/**
- * Get the data source container.
- * 
- * @return The data source container, never <code>null</code>.
- *
- * @public
- * @return {DataSourceContainer}
- **/
-// Implementor of DataService interface: xap.data.DataFramework.prototype.getDataSourceContainer = function () {
-xap.data.DataFramework.prototype.getDataSourceContainer = function () {
-	return this._dataSourceContainer;
-};
-// Implementor of DataService interface: xap.data.DataFramework.prototype.setDataSourceContainer = function (aContainer) {
-xap.data.DataFramework.prototype.setDataSourceContainer = function (aContainer) {
-	this._dataSourceContainer = aContainer;
-};
 
 xap.data.DataFramework.prototype.bind = function( stringOrBinding){
 	if ( typeof stringOrBinding == "string"){