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 mt...@apache.org on 2006/09/18 19:52:15 UTC
svn commit: r447525 [1/2] - in /incubator/xap/trunk/src/xap/data: ./ bridge/
datasource/
Author: mturyn
Date: Mon Sep 18 12:52:14 2006
New Revision: 447525
URL: http://svn.apache.org/viewvc?view=rev&rev=447525
Log:
Loading-but-flawed bridges and sources---still aren't getting the object resolution into the ObjectDataSourceBridge, but far enough along that I want to make sure these aren't lost.
Added:
incubator/xap/trunk/src/xap/data/DataFramework.js
incubator/xap/trunk/src/xap/data/DataServiceFactory.js (with props)
incubator/xap/trunk/src/xap/data/DataServiceImpl.js (with props)
incubator/xap/trunk/src/xap/data/bridge/DataFrameworkBridge.js (with props)
incubator/xap/trunk/src/xap/data/bridge/DataSourceBridge.js
incubator/xap/trunk/src/xap/data/bridge/ObjectDataSourceBridge.js (with props)
incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js (with props)
incubator/xap/trunk/src/xap/data/datasource/DataSourceContainerImpl.js (with props)
incubator/xap/trunk/src/xap/data/datasource/DataSourceImpl.js (with props)
Added: incubator/xap/trunk/src/xap/data/DataFramework.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/DataFramework.js?view=auto&rev=447525
==============================================================================
--- incubator/xap/trunk/src/xap/data/DataFramework.js (added)
+++ incubator/xap/trunk/src/xap/data/DataFramework.js Mon Sep 18 12:52:14 2006
@@ -0,0 +1,273 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+Xap.require("xap.session.ClientEvent");
+Xap.require("xap.session.ClientSession");
+//Xap.require("xap.mco.AbstractMco") ;
+Xap.require("xap.mco.ContainerLifeCycleObject");
+//Xap.require("xap.mco.McoArgumentParser");
+//Xap.require("xap.resolver.ResolutionInfo") ;
+// Xap.require("xap.plugin.data.controller.Binding") ;
+// Xap.require("xap.plugin.data.controller.BindingContainer") ;
+// Xap.require("xap.plugin.data.controller.BindingContainerImpl") ;
+// Xap.require("xap.plugin.data.controller.BindingResolver") ;
+// Xap.require("xap.plugin.data.controller.BindingType") ;
+// Xap.require("xap.plugin.data.controller.DataControllerException") ;
+// Xap.require("xap.plugin.data.controller.IteratorContainer") ;
+// Xap.require("xap.plugin.data.controller.IteratorContainerImpl") ;
+// Xap.require("xap.plugin.data.datasource.DataAccessException") ;
+// Xap.require("xap.plugin.data.datasource.DataSourceContainer") ;
+// Xap.require("xap.plugin.data.datasource.DataSourceContainerImpl") ;
+// Xap.require("xap.plugin.data.datasource.MalformedQueryException") ;
+// Xap.require("xap.plugin.data.datasource.UnsupportedBindingTypeException") ;
+// Xap.require("xap.plugin.data.formatter.FormatterContainer") ;
+// Xap.require("xap.plugin.data.formatter.FormatterContainerImpl") ;
+// Xap.require("xap.util.EscapeSyntaxException") ;
+/**
+ * This class encapsulates all the data primitives available for a client session.
+ * It may be used to lookup bindings, formatters, data sources, and validators.
+ *
+ * @author dgennaco
+ */
+Xap.provide("xap.data.DataFramework");
+Xap.setupClassAsSubclassOf("xap.data.DataFramework", "xap.mco.ContainerLifeCycleObject");
+/**
+ * @constructor
+ * @param sess{ClientSession}
+ *
+**/
+xap.data.DataFramework = function(sess) {
+alert("created data framework") ;
+ this._session = sess;
+ //this._bindingContainer = new BindingContainerImpl(sess);
+ //this._formatterContainer = new FormatterContainerImpl(sess);
+ this._dataSourceContainer = new xap.data.datasource.DataSourceContainerImpl(sess);
+ //this._iteratorContainer = new IteratorContainerImpl(sess);
+
+ //add the dataSourceContainer to the container of containers
+ //to support doing something like dataSource://myDataSource.do()
+ this._session.addContainer("dataSource", _dataSourceContainer);
+ this._session.addContainer("formatter", _formatterContainer);
+ this._session.addContainer("binding", _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 DataService*/
+xap.data.DataFramework.getDataService = function (sess) {
+ /*DataFramework*/
+ var dataService = /*(DataFramework)*/
+ sess.getSystemContainer().get(xap.data.DataFramework.MCO_ID);
+ if (dataService == null) {
+ dataService = new DataFramework(sess);
+ sess.getSystemContainer().put(xap.data.DataFramework.MCO_ID, dataService);
+ /*McoArgumentParser*/
+ mcoParser = sess.getSystemContainer().get("McoArgumentParser");
+
+ // add shortcuts to the binding methods.
+ mcoParser.addFunctionShortcut("*", xap.data.DataFramework.MCO_ID + ".relativeBind");
+ mcoParser.addFunctionShortcut("bind", xap.data.DataFramework.MCO_ID + ".bind");
+ }
+ return dataService;
+};
+/**
+ * Returns the binding resolver for the data service. INTERNAL
+ * USE ONLY!
+ *
+ * @return the binding resolver.
+ */
+/*public BindingResolver*/
+xap.data.DataFramework.prototype.getBindingResolver = function () {
+ return _bindingResolver;
+};
+/**
+ * Set the binding resolver for the data service. INTERNAL
+ * USE ONLY!
+ *
+ * @param b{BindingResolver} the binding resolver
+ */
+/*public void*/
+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*/
+xap.data.DataFramework.prototype.getBindingContainer = function () {
+ return _bindingContainer;
+};
+
+
+
+/**
+ * Get the iterator container, INTERNAL USE ONLY!
+ *
+ * @return the iterator container
+ */
+/*public IteratorContainer*/
+xap.data.DataFramework.prototype.getIteratorContainer = function () {
+ return _iteratorContainer;
+};
+
+
+
+
+/**
+ * @public
+ * @param bindString{String}---optional
+ * @param select{String} A selection string.
+ * @return {Object}
+ * @throws DataAccessException, MalformedQueryException,UnsupportedBindingTypeException,DataControllerException
+ */
+xap.data.DataFramework.prototype.relativeBind = function (bindString, select) {
+ var bindString = null ;
+ var select = null ;
+ if (arguments.length == 2){
+ bindString = arguments[0] ;
+ select = arguments[1] ;
+ } else if (arguments.length == 1){
+ select = arguments[0] ;
+ }
+ /* Binding */
+ var binding = new Binding(this._bindingResolver.getContextStack(), select, bindString, this._session, BindingType.ONE_TIME, null);
+ return bind(binding);
+};
+
+
+// Original overloaded method for single-argument case:
+//
+// * @public
+// * @return {Object}
+// * @param select{String} A selection string.
+// */
+//xap.data.DataFramework.prototype.relativeBind = function (select) {
+// return this.relativeBind(null, select);
+//};
+
+
+/*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 FormatterContainerImpl */
+xap.data.DataFramework.prototype._formatterContainer = null;
+/*private DataSourceContainerImpl */
+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 = 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;
+};
+
+
+/**
+ * Bind using the specified bind string, this string is
+ * a semicolon delimited list of name value pairs where the
+ * name and value are separated by equals.
+ *
+ * @param bindString the bind string
+ *
+ * @return the value retrieved from the binding.
+ *
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @throws UnsupportedBindingTypeException
+ * @throws EscapeSyntaxException
+ * @throws DataControllerException
+ *
+ * @public
+ * @return {Object}
+ * @param binding{Binding}, or
+ *
+ * @param bindString{String}
+ **/
+// Implementor of DataService interface: xap.data.DataFramework.prototype.bind = function (bindingOrString) {
+xap.data.DataFramework.prototype.bind = function (bindingOrString) {
+ // Need to handle string or binding cases...subclass?
+ //TODO: all of this
+};
+
+
+
Added: incubator/xap/trunk/src/xap/data/DataServiceFactory.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/DataServiceFactory.js?view=auto&rev=447525
==============================================================================
--- incubator/xap/trunk/src/xap/data/DataServiceFactory.js (added)
+++ incubator/xap/trunk/src/xap/data/DataServiceFactory.js Mon Sep 18 12:52:14 2006
@@ -0,0 +1,105 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+Xap.provide("xap.data.DataServiceFactory") ;
+
+Xap.require("xap.session.ClientSession") ;
+//import java.lang.reflect.InvocationTargetException;
+//import java.lang.reflect.Method;
+
+/**
+ * The data service factory is responsible for retrieving the DataService for a specified
+ * session.
+ *
+ * @author dgennaco
+ */
+xap.data.DataServiceFactory = function(){
+}
+
+Xap.setupClassAsSubclassOf("xap.data.DataServiceFactory","Object") ;
+
+/* private static String*/
+xap.data.DataServiceFactory.DATA_SERVICE_FACTORY_CLASS = "xap.data.DataFramework";
+
+/* private static String*/
+xap.data.DataServiceFactory.DATA_SERVICE_FACTORY_RETRIEVAL_METHOD = "getDataService";
+
+/* private static Method*/
+xap.data.DataServiceFactory.DATA_SERVICE_RETRIEVAL_METHOD = null;
+
+/* private static Class[]*/
+xap.data.DataServiceFactory.DATA_SERVICE_RETRIEVAL_METHOD_TYPES = ["xap.session.ClientSession"];
+
+ /**
+ * Factory - hide constructor!
+ */
+/* private DataServiceFactory() {
+ // Nothing to see here, move along.
+ }
+ */
+
+ /**
+ * Get the data service associated with the session.
+ *
+ * @param sess{ClientSession} The client session
+ * @return a DataService object
+ */
+xap.data.DataServiceFactory.getDataService = function(sess) {
+/* Exception*/
+ var e = null;
+
+ // I don't want to have to prepend "xap.data.DataServiceFactory"
+ // in front of all those static constant references:
+ with (xap.data.DataServiceFactory){
+
+ try {
+ if (DATA_SERVICE_RETRIEVAL_METHOD == null) {
+ DATA_SERVICE_RETRIEVAL_METHOD
+// TODO: Restore AbstractFactory-ness:
+// = (DATA_SERVICE_FACTORY_CLASS).getMethod.call(
+// DATA_SERVICE_FACTORY_RETRIEVAL_METHOD,
+// DATA_SERVICE_RETRIEVAL_METHOD_TYPES
+// );
+ = xap.data.DataFramework.getDataService ;
+ }
+ //return DATA_SERVICE_RETRIEVAL_METHOD.invoke(null,sess);
+ // "this" for a static method?
+ // return DATA_SERVICE_RETRIEVAL_METHOD.call(null,sess) ;
+ return xap.data.DataFramework.getDataService(sess) ;
+ } catch (anException){
+
+
+ }
+ /*
+ (NoSuchMethodException noMethod) {
+ e = noMethod;
+ } catch (ClassNotFoundException noClass) {
+ e = noClass;
+ } catch (IllegalAccessException accessE) {
+ e = accessE;
+ } catch (InvocationTargetException invokeE) {
+ e = invokeE;
+ }
+ */
+
+// TODO: Handle better
+// sess.handleException(DataService.DATA_FRAMEWORK_EXCEPTION_TYPE,
+// new DataServiceException(DataServiceException.DATA_SERVICE_FACTORY_LOAD_FAILURE, e));
+
+ return null;
+ }
+}
Propchange: incubator/xap/trunk/src/xap/data/DataServiceFactory.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/xap/data/DataServiceImpl.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/DataServiceImpl.js?view=auto&rev=447525
==============================================================================
--- incubator/xap/trunk/src/xap/data/DataServiceImpl.js (added)
+++ incubator/xap/trunk/src/xap/data/DataServiceImpl.js Mon Sep 18 12:52:14 2006
@@ -0,0 +1,159 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+//Xap.require("xap.ExceptionContext;")
+//Xap.require("xap.data.controller.Binding;")
+//Xap.require("xap.data.controller.DataControllerException;")
+//Xap.require("xap.data.datasource.DataAccessException;")
+//Xap.require("xap.data.datasource.DataSourceContainer;")
+//Xap.require("xap.data.datasource.MalformedQueryException;")
+//Xap.require("xap.data.datasource.UnsupportedBindingTypeException;")
+//Xap.require("xap.data.formatter.FormatterContainer;")
+//Xap.require("xap.util.EscapeSyntaxException;")
+/**
+ * The data service is used to gain programatic access to the stored
+ * formatter and data source definitions.
+ *
+ * @author dgennaco
+ */
+xap.data.DataServiceImpl = function () {
+ // Anything?
+};
+
+//public interface
+Xap.setupClassAsSubclassOf("xap.data.DataServiceImpl", "Object");
+
+
+xap.data.DataServiceImpl.prototype._dataSourceContainer = null;
+xap.data.DataServiceImpl.prototype._formatterContainer = null;
+/**
+ * The exception type used for all data framework exception
+ * reporting.
+
+ Fake it for now:
+
+ *public static final int
+ */
+xap.data.DataServiceImpl.DATA_FRAMEWORK_EXCEPTION_TYPE = 10000;
+//ExceptionContext.MAX_RANGE + 100;
+/**
+ * Get the formatter container.
+ *
+ * @return The container of formatters, never <code>null</code>.
+ *
+ * @public
+ * @return {FormatterContainer}
+ **/
+xap.data.DataServiceImpl.prototype.getFormatterContainer = function () {
+ return this._formatterContainer;
+};
+xap.data.DataServiceImpl.prototype.setFormatterContainer = function (aContainer) {
+ this._formatterContainer = aContainer;
+};
+/**
+ * Get the data source container.
+ *
+ * @return The data source container, never <code>null</code>.
+ *
+ * @public
+ * @return {DataSourceContainer}
+ **/
+xap.data.DataServiceImpl.prototype.getDataSourceContainer = function () {
+ return this._dataSourceContainer;
+};
+xap.data.DataServiceImpl.prototype.setDataSourceContainer = function (aContainer) {
+ this._dataSourceContainer = aContainer;
+};
+
+
+/**
+ * Bind using the specified bind string, this string is
+ * a semicolon delimited list of name value pairs where the
+ * name and value are separated by equals.
+ *
+ * @param bindString the bind string
+ *
+ * @return the value retrieved from the binding.
+ *
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @throws UnsupportedBindingTypeException
+ * @throws EscapeSyntaxException
+ * @throws DataControllerException
+ *
+ * @public
+ * @return {Object}
+ * @param binding{Binding}, or
+ *
+ * @param bindString{String}
+ **/
+xap.data.DataServiceImpl.prototype.bind = function (bindingOrString) {
+ // Need to handle string or binding cases...subclass?
+ //TODO: all of this
+};
+/**
+ * Bind using the specified select string. This bind will
+ * be performed relative to the closest ancestor iterator tag,
+ * by making a query to the data source associated with that
+ * iterator and supplying the context for the current iteration.
+ *
+ * @param select The select string.
+ *
+ * @return the value retrieved from the binding.
+ *
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @throws UnsupportedBindingTypeException
+ * @throws DataControllerException
+ *
+ * @public
+ * @return {Object}
+ *
+ * @param select{String}
+ **/
+//xap.data.DataServiceImpl.prototype.relativeBind = function( select ){
+// // TODO: all of this
+//}
+/**
+ * Bind using the specified select string. This bind will be
+ * performed against the specified data source or in the context
+ * of the specified named iterator.
+ *
+ * @param context The name of an ancestor iterator or the id of
+ * a data source.
+ *
+ * @param select The select string.
+ *
+ * @return the value retrieved from the binding.
+ *
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @throws UnsupportedBindingTypeException
+ * @throws DataControllerException
+ *
+ * @public
+ * @return {Object} the value retrieved from the binding
+ *
+ * @param context{}
+ * @param select{String}
+ **/
+xap.data.DataServiceImpl.prototype.relativeBind = function () {
+ // TODO: use "arguments" to set up "context, select" or "select"
+ // argument sets
+};
+
Propchange: incubator/xap/trunk/src/xap/data/DataServiceImpl.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/xap/data/bridge/DataFrameworkBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/bridge/DataFrameworkBridge.js?view=auto&rev=447525
==============================================================================
--- incubator/xap/trunk/src/xap/data/bridge/DataFrameworkBridge.js (added)
+++ incubator/xap/trunk/src/xap/data/bridge/DataFrameworkBridge.js Mon Sep 18 12:52:14 2006
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+Xap.provide("xap.data.bridge.DataFrameworkBridge");
+Xap.require("xap.taghandling.AbstractTagImpl");
+Xap.require("xap.data.DataServiceImpl");
+Xap.require("xap.data.DataServiceFactory") ;
+//Xap.require("xap.data.datasource.DataSourceContainer") ;
+//Xap.require("xap.data.formatter.FormatterContainer") ;
+Xap.require("xap.util.LogFactory");
+Xap.require("xap.util.LogFactory");
+/**
+ * The base class for all data framework tags, provides convenience methods
+ * for common data operations.
+ *
+ * @author JMargaris
+ */
+xap.data.bridge.DataFrameworkBridge = function() {
+//alert("DataFrameworkBridge start") ;
+ xap.taghandling.AbstractTagImpl.call(this);
+//alert("DataFrameworkBridge stop") ;
+};
+Xap.setupClassAsSubclassOf("xap.data.bridge.DataFrameworkBridge", "xap.taghandling.AbstractTagImpl");
+
+
+//-----------------------------------------------------------------------
+// Public Methods.
+//-----------------------------------------------------------------------
+/*public DataService*/
+xap.data.bridge.DataFrameworkBridge.prototype.getDataService = function () {
+ return DataServiceFactory.getDataService(this.getSession());
+};
+/*Public DataSourceContainer*/
+xap.data.bridge.DataFrameworkBridge.prototype.getDataSourceContainer = function () {
+ return this.getDataService().getDataSourceContainer();
+};
+/*public FormatterContainer*/
+xap.data.bridge.DataFrameworkBridge.prototype.getFormatterContainer = function () {
+ return this.getDataService().getFormatterContainer();
+};
+/*public void*/
+xap.data.bridge.DataFrameworkBridge.prototype.init = function () {
+ this.getLog().debug(/*this.getClass().getName()*/"xap.data.bridge.DataFrameworkBridge" + " got element: " + this.getElement());
+};
+
+//-----------------------------------------------------------------------
+// Protected Methods.
+//-----------------------------------------------------------------------
+/*protected Log*/
+xap.data.bridge.DataFrameworkBridge.prototype.getLog = function () {
+ return xap.util.LogFactory.getLog("DataFrameworkBridge");
+};
+
Propchange: incubator/xap/trunk/src/xap/data/bridge/DataFrameworkBridge.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/xap/data/bridge/DataSourceBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/bridge/DataSourceBridge.js?view=auto&rev=447525
==============================================================================
--- incubator/xap/trunk/src/xap/data/bridge/DataSourceBridge.js (added)
+++ incubator/xap/trunk/src/xap/data/bridge/DataSourceBridge.js Mon Sep 18 12:52:14 2006
@@ -0,0 +1,196 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+Xap.provide("xap.data.bridge.DataSourceBridge");
+// Superclass:
+Xap.provide("xap.data.bridge.DataFrameworkBridge");
+
+Xap.require("xap.session.ClientEvent");
+//Xap.require("xap.client.tags.AttributeConversionException") ;
+//Xap.require("xap.data.DataServiceImpl") ;
+//Xap.require("xap.data.InitializationException") ;
+//Xap.require("xap.data.datasource.AsynchronousDataSource") ;
+//Xap.require("xap.data.datasource.AsynchronousDataSourceListener") ;
+//Xap.require("xap.data.datasource.ChangeAwareDataSource") ;
+//Xap.require("xap.data.datasource.DataChangeListener") ;
+//Xap.require("xap.data.datasource.DataSource") ;
+Xap.require("xap.util.LogFactory");
+//Xap.require("xap.util.ResourceDictionary") ;
+Xap.require("xap.util.UidProvider");
+/**
+ * The generic data source bridge, it uses the <code>class</code>
+ * attribute to look up an implementation of
+ * <code>xap.data.DataSource</code>.
+ * initializes the data source and registers the data source in the
+ * data source container with the specified <code>id</code> attribute.
+ * <br><br>
+ * As of 4.5/jRex1.1 this implements <code>DataChangeListener</code>
+ * and <code>AsynchronousDataSourceListener</code> in order to implement
+ * data notification events via XML.
+ *
+ *
+ * @author dgennaco
+ */
+xap.data.bridge.DataSourceBridge = function () {
+ //alert("DataSourceBridge start") ;
+ xap.data.bridge.DataFrameworkBridge.call(this) ;
+ //alert("DataSourceBridge stop") ;
+};
+Xap.setupClassAsSubclassOf("xap.data.bridge.DataSourceBridge", "xap.data.bridge.DataFrameworkBridge");
+xap.data.bridge.DataSourceBridge.SOURCE_ATTRIBUTE = "source";
+xap.data.bridge.DataSourceBridge.NULL_SOURCE_MSGID = "nullSourceObject";
+xap.data.bridge.DataSourceBridge.ID_IS_NOT_SPECIFIED_MSGID = "idNotSpecified";
+
+//-----------------------------------------------------------------------
+// Instance Variables.
+//-----------------------------------------------------------------------
+/* private */
+xap.data.bridge.DataSourceBridge.prototype._dataSource = null;
+
+//-----------------------------------------------------------------------
+// Public Methods.
+//-----------------------------------------------------------------------
+/**
+ * @public
+ * @return {DataSource}
+**/
+xap.data.bridge.DataSourceBridge.prototype.getDataSource = function () {
+ return this._dataSource;
+};
+/**
+ * Implementation of the DataChangeListener interface,
+ * fires the "onDataChanged" XML event.
+ * @param source{DataSourceImpl}
+ */
+xap.data.bridge.DataSourceBridge.prototype.onDataChanged = function (source) {
+ this.fireEvent("onDataChanged", null);
+};
+/**
+ * Implementation of the AsynchronousDataSourceListener interface,
+ * fires the "onDataRequestFailed" XML event.
+ *
+ * @param source{DataSource}
+ * @param failureCause{Exception}
+ * @since 4.5/jRex1.1
+ */
+/*public void*/
+xap.data.bridge.DataSourceBridge.prototype.onDataRequestFailed = function (source, failureCause) {
+ /*ClientEvent*/
+ var e = new xap.session.ClientEvent(this.getElement());
+
+ //TODO document this
+ e.setFailureCause(failureCause);
+ this.fireEvent("onDataRequestFailed", e);
+};
+/**
+ * Implementation of the AsynchronousDataSourceListener interface,
+ * fires the "onDataRequestCompleted" XML event.
+ * @param source{DataSource}
+ * @since 4.5/jRex1.1
+ */
+/*public void*/
+xap.data.bridge.DataSourceBridge.prototype.onDataRequestCompleted = function (source) {
+ this.fireEvent("onDataRequestCompleted", null);
+};
+/**
+ * Returns a log appropriate for DataSource bridges.
+ * @protected
+ * @return {Log}
+ */
+xap.data.bridge.DataSourceBridge.prototype.getLog = function () {
+ return xap.util.LogFactory.getLog("xap.data.bridge.DataSourceBridge");
+};
+
+//-----------------------------------------------------------------------
+// Protected Methods.
+//-----------------------------------------------------------------------
+/**
+ * Calls initialize() on the data source
+ * and adds the data source to the dataSourceContainer if the initialize
+ * call was successfull.
+ * @throws InitializationException
+ */
+/*protected void*/
+xap.data.bridge.DataSourceBridge.prototype.initializeDataSource = function () {
+ // XmlDataTokens.ID
+ var id = this.getElement().getAttribute("id");
+ /*
+ if ( id.startsWith( xap.util.UidProvider.XAP_ID_PREFIX )) {
+ this.getLog().info( ResourceDictionary.getMessage(
+ ID_IS_NOT_SPECIFIED_MSGID,
+ xap.data.bridge.DataSourceBridge,
+ [this._dataSource.getClass().getName(),
+ this.getElement().toXml( true )
+ ]
+ )
+ );
+ }
+*/
+ this._dataSource.initialize(id, this.getSession(), this.getElement());
+ this.getDataSourceContainer().addDataSource(id, this._dataSource);
+};
+/**
+ * Creates the data source. The default implementation looks at the
+ * "class" attribute of the element and returns an instance of
+ * that class. Subclasses should override this method
+ * to return their own dataSource implementations.
+ */
+xap.data.bridge.DataSourceBridge.prototype.createDataSource = function () {
+ /*String*/
+ /*XmlDataTokens.CLASS*/
+ var className = this.getElement().getAttribute("class");
+ /*DataSource*/
+ var dataSource = null;
+ try {
+ dataSource = new xap.data.datasource.DataSourceImpl();
+ // DataAttributeConverter.toClassInstance(
+ // className, DataSource.class)
+ }
+ catch (e) {
+ /*AttributeConversionException*/
+ // reportInvalidXmlException(XmlDataTokens.CLASS,
+ // className,getElement(),e);
+ throw new xap.util.Exception(e);
+ }
+ return dataSource;
+};
+/**
+ * Calls super.init(), sets the data source to be the one
+ * returned by createDataSource(), then calls initializeDataSource()
+ */
+/*public void*/
+xap.data.bridge.DataSourceBridge.prototype.init = function () {
+ xap.data.bridge.DataFrameworkBridge.prototype.init.call(this);
+ this._dataSource = this.createDataSource();
+ if (this._dataSource == null) {
+ return;
+ }
+ if (this._dataSource instanceof AsynchronousDataSource) {
+ this._dataSource.addAsynchronousDataSourceListener(this);
+ }
+ if (this._dataSource instanceof ChangeAwareDataSource) {
+ this._dataSource.addDataChangeListener(this);
+ }
+ try {
+ this.initializeDataSource();
+ }
+ catch (e) {
+ // This should be an InitializationException instance
+ // "null" temporarily[?] replaces DataService.DATA_FRAMEWORK_EXCEPTION_TYPE
+ this.getSession().handleException(null, e);
+ }
+};
+
Added: incubator/xap/trunk/src/xap/data/bridge/ObjectDataSourceBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/bridge/ObjectDataSourceBridge.js?view=auto&rev=447525
==============================================================================
--- incubator/xap/trunk/src/xap/data/bridge/ObjectDataSourceBridge.js (added)
+++ incubator/xap/trunk/src/xap/data/bridge/ObjectDataSourceBridge.js Mon Sep 18 12:52:14 2006
@@ -0,0 +1,207 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+//import java.net.MalformedURLException;
+
+Xap.provide("xap.data.bridge.ObjectDataSourceBridge") ;
+
+// /Xap.require("xap.session.EventHandler") ;
+// /Xap.require("xap.mco.McoInvocationException") ;
+//Xap.require("xap.tags.AttributeConversionException") ;
+//Xap.require("xap.plugin.data.InitializationException") ;
+// /Xap.require("xap.data.datasource.DataSource") ;
+// /Xap.require("xap.data.datasource.ObjectDataSource") ;
+//Xap.require("xap.util.EscapeSyntaxException") ;
+// /Xap.require("xap.util.ResourceDictionary") ;
+Xap.require("xap.xml.dom.XapElement") ;
+Xap.require("xap.data.bridge.DataSourceBridge") ;
+
+/**
+ * ObjectDataSourceBridge is a bridge class for the objectDataSource tag.
+ *
+ * @version $Revision: 1.12 $
+ * @author ikaplansky
+ */
+xap.data.bridge.ObjectDataSourceBridge = function () {
+ alert("ObjectDataSourceBridge() start") ;
+ xap.data.bridge.DataSourceBridge.call(this) ;
+ alert("ObjectDataSourceBridge() end") ;
+};
+
+Xap.setupClassAsSubclassOf("xap.data.bridge.ObjectDataSourceBridge","xap.data.bridge.DataSourceBridge") ;
+
+//-----------------------------------------------------------------------
+// Constants.
+//-----------------------------------------------------------------------
+
+// private static final String
+xap.data.bridge.ObjectDataSourceBridge.REFRESH_ON_PROPERTY_CHANGE_ATTRIBUTE = "refreshOnPropertyChange";
+
+// {0} refreshOnPropertyChange attribute value
+// {1} datasource element
+// private static final String
+xap.data.bridge.ObjectDataSourceBridge.INVALID_REFRESH_ON_PROPERTY_CHANGE_MSGID = "invalidRefreshOnPropertyChange";
+
+//-----------------------------------------------------------------------
+// Protected Methods.
+//-----------------------------------------------------------------------
+
+//protected DataSource
+xap.data.bridge.ObjectDataSourceBridge.prototype.createDataSource = function() {
+ /*String*/
+ var className =this.getElement().getAttribute( /*XmlDataTokens.CLASS*/"class" );
+ /*DataSource*/
+ var dataSource = null;
+ try {
+ if ( className != null &&
+ className.trim().length() !=0 ) {
+ dataSource = /*(DataSource)*/
+ DataAttributeConverter.toClassInstance( className, ObjectDataSource );
+ } {
+ dataSource = new ObjectDataSource();
+ }
+ } catch (e) { //AttributeConversionException
+// this.reportInvalidXmlException( XmlDataTokens.CLASS, className,
+// this.getElement(), e );
+ // TODO: Restore better exception handling
+ throw new xap.util.XapException(e) ;
+ }
+ return dataSource;
+}
+
+/*protected void*/
+/**
+ * @throws InitializationException
+**/
+xap.data.bridge.ObjectDataSourceBridge.prototype.initializeDataSource = function(){
+ // add the DataSource to the container
+ this.superclass.initializeDataSource();
+ this.processConfigurationElement(this.getElement() );
+ }
+
+ //-----------------------------------------------------------------------
+ // Private Methods.
+ //-----------------------------------------------------------------------
+
+/**
+ * @private
+ * @param dataSourceElement{XapElement}
+ * @throws InitializationException
+**/
+xap.data.bridge.ObjectDataSourceBridge.prototype.processConfigurationElement = function( dataSourceElement ){
+ try {
+ /*ObjectDataSource*/
+ var dataSource = /*(ObjectDataSource)*/ this.getDataSource();
+ /*String*/
+ var sourcePath = this.dataSourceElement.getAttribute(
+ SOURCE_ATTRIBUTE );
+ setRefreshOnPropertyChange( dataSource );
+ setSource ( dataSource, sourcePath );
+ } catch (e){
+ // TODO: Decide what sort of exception
+ throw new xap.util.Exception(e) ;
+ }
+
+ // catch ( MalformedURLException e ) {
+ // throw new InitializationException(
+ // InitializationException.MALFORMED_URL_EXCEPTION_MSGID,
+ // ObjectDataSource.class.getName(),
+ // e );
+ //} catch ( McoException e ) {
+ // throw new InitializationException(
+ // InitializationException.DATA_ACCESS_EXCEPTION_MSGID,
+ // ObjectDataSource.class.getName(),
+ // e );
+ //} catch ( EscapeSyntaxException e ) {
+ // throw new InitializationException(
+ // InitializationException.DATA_ACCESS_EXCEPTION_MSGID,
+ // ObjectDataSource.class.getName(),
+ // e );
+ //}
+ }
+
+/**
+ * @private
+ * @param dataSource{ObjectDataSource}
+**/
+xap.data.bridge.ObjectDataSourceBridge.prototype.setRefreshOnPropertyChange = function( dataSource ) {
+ /*String*/
+ var refreshOnPropertyChange = this.getElement().getAttribute(
+ REFRESH_ON_PROPERTY_CHANGE_ATTRIBUTE );
+ if ( refreshOnPropertyChange != null ) {
+ refreshOnPropertyChange = refreshOnPropertyChange.trim().
+ toLowerCase();
+ if( refreshOnPropertyChange.equals( "true" )) {
+ this.dataSource.setRefreshOnPropertyChange( true );
+ } else if ( refreshOnPropertyChange.equals( "false" )) {
+ this.dataSource.setRefreshOnPropertyChange( false );
+ } else {
+ this.getLog().error(
+
+ ResourceDictionary.getMessage(
+ INVALID_REFRESH_ON_PROPERTY_CHANGE_MSGID,
+ xap.data.datasource.ObjectDataSourceBridge,
+ [
+ this.refreshOnPropertyChange,
+ this.getElement().toXml( true )
+ ]
+ )
+ );
+ }
+ }
+}
+
+/*private void*/
+/**
+ * @param dataSource{ObjectDataSource}
+ * @param sourcePath{String}
+ * @throws MalformedURLException, McoException, EscapeSyntaxException
+**/
+xap.data.bridge.ObjectDataSourceBridge.prototype.setSource = function( dataSource, sourcePath ) {
+ /*EventHandler*/
+ this.eventHandler = this.getSession().getEventHandler();
+ if ( this.sourcePath != null && sourcePath.trim().length() != 0 ) {
+ /*String*/
+ var objectUrl = eventHandler.qualifyObjectUrl( sourcePath );
+ if ( objectUrl == null ) {
+ // sourceUrl is an HTTP URL
+ this.sourcePath = createQualifiedUrlAsString( sourcePath );
+ this.dataSource.loadObjectFromUrl( sourcePath );
+ } else {
+ this.sourcePath = objectUrl;
+ /*Object*/
+ var source = eventHandler.resolveMcoArgument( sourcePath,
+ this.getElement(),
+ null );
+ if ( source == null ) {
+ throw new IllegalArgumentException (
+ ResourceDictionary.getMessage(
+ NULL_SOURCE_MSGID,
+ xap.data.bridge.DataSourceBridge,
+ this.sourcePath ));
+ }
+ this.dataSource.setSource( source );
+ }
+ /*Object */
+ var lock = this.getElement().getOwnerDocument().
+ thisgetDomSynchronizationObject();
+ //synchronized( lock ) {
+ this.getElement().setAttribute( SOURCE_ATTRIBUTE, sourcePath );
+ //}
+ }
+}
+
Propchange: incubator/xap/trunk/src/xap/data/bridge/ObjectDataSourceBridge.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js?view=auto&rev=447525
==============================================================================
--- incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js (added)
+++ incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js Mon Sep 18 12:52:14 2006
@@ -0,0 +1,881 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+//import java.util.Vector;
+
+Xap.require("xap.client.ClientSession;")
+Xap.require("xap.client.mco.Container;")
+Xap.require("xap.client.mco.ContainerLifecycleObject;")
+Xap.require("xap.client.netservice.HttpResponse;")
+Xap.require("xap.client.netservice.NetServiceException;")
+Xap.require("xap.client.netservice.NetServiceListener;")
+Xap.require("xap.client.netservice.RequestService;")
+Xap.require("xap.plugin.data.InitializationException;")
+Xap.require("xap.plugin.data.controller.BindingType;")
+Xap.require("xap.plugin.data.controller.Context;")
+Xap.require("xap.util.Log;")
+Xap.require("xap.util.LogFactory;")
+Xap.require("xap.util.ResourceDictionary;")
+Xap.require("xap.xml.Element;")
+
+/**
+* An ease-of-use base class for DataSource implementations.
+*
+* <p/>
+*
+* This class persists bound queries (i.e. queries whose binding type !=
+* BindingType.ONE_WAY) so that they can be later requeried when the data
+* changes.
+*
+* <p/>
+*
+* This base class can also keep track of any queries that need to be postponed
+* and executed later if the data is being retrieved at the time of the original
+* query. It is up to the subclasses to take advantage of this functionality.
+* If subclasses add postponed queries, it is their responsibility to execute or
+* clean them up later (the queries are automatically cleaned up after the
+* execution).
+*
+* <br><br>
+* As of 4.5/jRex1.1 this implements NetServiceListener in order
+* to work well with the DataRequest plugin.
+*
+* @see #addPostponedQuery(String, Context, RetrievalListener)
+* @see #executePostponedQueries()
+* @see #clearPostponedQueries()
+*
+* @version $Revision: 1.23 $
+* @author Igor Kaplansky
+* @abstract
+*/
+xap.data.datsource.AbstractDataSource = function(){}
+
+
+//-----------------------------------------------------------------------
+// Constants
+//-----------------------------------------------------------------------
+
+/**
+ * Loading source from server URL: {0}, DataSource class: {1}
+ * <br/>
+ * Args:
+ * <ul>
+ * <li>{0} - the source URL.</li>
+ * <li>{1} - the DataSource class name.</li>
+ * </ul>
+ */
+/*private static final String*/
+xap.data.datasource.AbstractDataSource.LOADING_SOURCE_FROM_SERVER_MSGID =
+ "loadSourceFromServer";
+
+/**
+ * Refresh got called on the datasource: {0}.
+ * <br/>
+ * Args:
+ * <ul>
+ * <li>{0} - the class name of the datasource. </li>
+ * </ul>
+ */
+/*private static final String*/
+xap.data.datasource.AbstractDataSource.REFRESH_MSGID = "refresh";
+
+/**
+ * Setting null as the source object is not allowed for datasource {0}
+ * <br/>
+ * Args:
+ * <ul>
+ * <li>{0} - the DataSource class name.</li>
+ * </ul>
+ */
+/*protected static final String*/
+xap.data.datasource.AbstractDataSource.NULL_SOURCE_MSGID = "nullSource";
+
+
+//-----------------------------------------------------------------------
+// Instance Variables.
+//-----------------------------------------------------------------------
+/**
+ * @private Element
+ **/
+xap.data.datasource.AbstractDataSource.prototype._dataSourceElement = null;
+/**
+ * @private ClientSession
+ **/
+xap.data.datasource.AbstractDataSource.prototype._clientSession = null;
+/**
+ * @private String
+ **/
+xap.data.datasource.AbstractDataSource.prototype._id = null;
+/**
+ * @private Object
+ **/
+xap.data.datasource.AbstractDataSource.prototype._source = null;
+// vector of QueryRecords for all bound queries (binding type != ONE_TIME)
+/**
+ * @private Vector
+ **/
+xap.data.datasource.AbstractDataSource.prototype._boundQueries = null;
+// vector of QueryRecords for all postponed queries.
+/**
+ * @private Vector
+ **/
+xap.data.datasource.AbstractDataSource.prototype._postponedQueries = null;
+/**
+ * @
+ private Vector
+**/
+xap.data.datasource.AbstractDataSource.prototype._dataChangeListeners = new xap.util.Vector();
+/**
+ * @
+ private Vector
+**/
+xap.data.datasource.AbstractDataSource.prototype._asynchronouseDataSourceListeners = new xap.util.Vector();
+
+//-----------------------------------------------------------------------
+// DataSource Interface.
+//-----------------------------------------------------------------------
+
+/**
+ * @see DataSource#initialize(String, ClientSession, Element)
+ * <p/>
+ * Subclasses have to call <code>super.initialize(String,ClientSession,
+ * Element)</code> if they override this method.
+ */
+/**
+ * @public
+ * @param id{String}
+ * @param session{ClientSession}
+ * @param dataSourceElement{XapElement}
+ * @return {void}
+ * @throws InitializationException
+ **/
+xap.data.datasource.AbstractDataSource.prototype.initialize
+ = function( id, session,dataSourceElement ){
+ this._id = id;
+ this._clientSession = session;
+ this._dataSourceElement = dataSourceElement;
+ this._boundQueries = new Vector();
+ this._postponedQueries = new Vector();
+ }
+
+/**
+ * @see DataSource#destroy()
+ * <p/>
+ * Subclasses have to call <code>super.destroy()</code> if they override
+ * this method.
+ */
+/**
+ * @public
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.destroy = function() {
+ /**/
+ var _boundQueries = new Vector();
+ /**/
+ var _postponedQueries = new Vector();
+}
+
+/**
+ * @see DataSource#getId()
+ */
+/**
+ * @public
+ * @return {String}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getId = function() {
+ return this._id;
+}
+
+/**
+ * @see DataSource#isSupported(BindingType)
+ */
+/**
+ * @public
+ * @param type{BindingType }
+ * @return {boolean}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.isSupported = function( type ) {
+ return type == BindingType.ONE_TIME ||
+ type == BindingType.ONE_WAY;
+}
+
+/**
+ * @see DataSource#getData(String, DataRetrievalListener)
+ */
+/**
+ * @public
+ * @param query{String}
+ * @param listener{DataRetrievalListener}
+ * @throws DataAccessException, MalformedQueryException,UnsupportedBindingTypeException
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getData = function(query, listener ){
+ handleGenericQuery( query, null, listener );
+}
+
+/**
+ * @see DataSource#getDataSet(String, DataSetRetrievalListener)
+ * @public
+ * @param query{String}
+ * @param listener{DataRetrievalListener}
+ * @throws DataAccessException, MalformedQueryException,UnsupportedBindingTypeException
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getDataSet = function( query, listener ){
+ handleGenericQuery( query, null, listener );
+}
+
+/**
+ * @see DataSource#getData(String, DataRetrievalListener, Context)
+ */
+/**
+ * @public
+ * @param query{String}
+ * @param listener{DataRetrievalListener}
+ * @param c
+ * @throws DataAccessException, MalformedQueryException,UnsupportedBindingTypeException
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getData = function( query, listener, context ) {
+ handleGenericQuery( query, context, listener );
+}
+
+/**
+ * @see DataSource#getDataSet(String, DataSetRetrievalListener, Context)
+ * @public
+ * @return {void}
+ * @param query{String}
+ * @param listener{DataRetrievalListener}
+ * @param context{Context }
+ * @throws DataAccessException, MalformedQueryException, UnsupportedBindingTypeException
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getData = function( query, listener, context ){
+ handleGenericQuery( query, context, listener );
+}
+
+/**
+ * @see DataSource#removeListener(String, RetrievalListener, Context)
+ */
+/**
+ * @public
+ * @return {void}
+ * @param query{String}
+ * @param listener{RetrievalListener}
+ * @param context{Context }
+ **/
+xap.data.datasource.AbstractDataSource.prototype.removeListener = function( query, listener, context ){
+ for( var i=0; i < this._boundQueries.size(); i++ ) {
+ /*QueryRecord*/
+ var record = this._boundQueries.elementAt( i );
+ if( record.getQuery().equals( query ) &&
+ record.getListener() == listener &&
+ record.getContext()== context ) {
+ this._boundQueries.removeElementAt( i-- );
+ }
+ }
+ for( var i=0; i < this._postponedQueries.size(); i++ ) {
+ /*QueryRecord*/
+ var record = this._postponedQueries.elementAt( i );
+ if( record.getQuery().equals( query ) &&
+ record.getListener() == listener &&
+ record.getContext() == context ) {
+ this._postponedQueries.removeElementAt( i-- );
+ }
+ }
+}
+
+/**
+ * @see DataSource#removeListener(String, RetrievalListener)
+ * @public
+ * @return {void}
+ * @param query{String}
+ * @param listener{RetrievalListener}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.removeListener = function( query, listener){
+ for( var i=0; i < this._boundQueries.size(); i++ ) {
+ /*QueryRecord*/
+ var record = this._boundQueries.elementAt( i );
+ if( record.getQuery().equals( query ) &&
+ record.getListener() == listener ) {
+ this._boundQueries.removeElementAt( i-- );
+ }
+ }
+ for( var i=0; i < this._postponedQueries.size(); i++ ) {
+ /*QueryRecord*/
+ var record = this._postponedQueries.elementAt( i );
+ if( record.getQuery().equals( query ) &&
+ record.getListener() == listener ) {
+ this._postponedQueries.removeElementAt( i-- );
+ }
+ }
+}
+
+/**
+ * @see DataSource#removeListener(RetrievalListener)
+ * @public
+ * @param listener{RetrievalListener}
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.removeListener = function( listener ){
+ for( var i=0; i < this._boundQueries.size(); i++ ) {
+ /*QueryRecord*/
+ var record = this._boundQueries.elementAt( i );
+ if(record.getListener() == listener ) {
+ this._boundQueries.removeElementAt( i-- );
+ }
+ }
+ for( var i=0; i < _postponedQueries.size(); i++ ) {
+ /*QueryRecord*/
+ var record = this._postponedQueries.elementAt( i );
+ if(record.getListener() == listener ) {
+ this._postponedQueries.removeElementAt( i-- );
+ }
+ }
+}
+
+/**
+ * @param l{DataChangeListener}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.addDataChangeListener = function(l){
+ if (!this._dataChangeListeners.contains(l)){
+ this._dataChangeListeners.addElement(l);
+ }
+}
+
+/**
+ * @public
+ * @param l{DataChangeListener}
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.removeDataChangeListener = function(l){
+ this._dataChangeListeners.removeElement(l);
+}
+
+/**
+ * @protected
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.fireDataChanged = function(){
+ for(var i = 0; i<_dataChangeListeners.size(); i++){
+ (this._dataChangeListeners.elementAt(i)).onDataChanged(this);
+ }
+}
+
+/**
+ * @public
+ * @param l{AsynchronousDataSourceListener}
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.addAsynchronousDataSourceListener = function(l){
+ if (!_asynchronouseDataSourceListeners.contains(l)){
+ this._asynchronouseDataSourceListeners.addElement(l);
+ }
+
+}
+
+/**
+ * @public
+ * @return {void}
+ * @param l{AsynchronousDataSourceListener}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.removeAsynchronousDataSourceListener = function(l){
+ this._asynchronouseDataSourceListeners.removeElement(l);
+}
+
+/**
+ * @protected
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.fireOnDataRetrieveSucess = function(){
+ /*for (int*/
+ for(var i = 0; i<_asynchronouseDataSourceListeners.size(); i++){
+ (this._asynchronouseDataSourceListeners.
+ elementAt(i)).onDataRequestCompleted(this);
+ }
+}
+
+/**
+ * @protected
+ * @param failureCause{Exception}
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.fireOnDataRetrieveFailure = function(failureCause){
+ /*for (int*/
+ for(var i = 0; i<_asynchronouseDataSourceListeners.size(); i++){
+ (this._asynchronouseDataSourceListeners.
+ elementAt(i)).onDataRequestFailed(this, failureCause);
+ }
+}
+
+//-----------------------------------------------------------------------
+// ContainerLifecycleObject Interface.
+//-----------------------------------------------------------------------
+/**
+ * @see ContainerLifecycleObject#addedToContainer(
+ * com.nexaweb.client.mco.Container, java.lang.String )
+ */
+/**
+ * @public
+ * @return {void}
+ **/
+/**
+ * @param container{Container}
+ * @param name{String}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.addedToContainer = function( container, name ) {
+ //NOOP
+}
+
+/**
+ * @see ContainerLifecycleObject#removedFromContainer(
+ * com.nexaweb.client.mco.Container, java.lang.String )
+ */
+/**
+ * @public
+ * @return {void}
+ **/
+/**
+ * @param container{Container}
+ * @param name{String}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.removedFromContainer = function( container, name ) {
+ destroy();
+}
+
+//-----------------------------------------------------------------------
+// Public Methods.
+//-----------------------------------------------------------------------
+
+/**
+ * Requeries all bound queries notifying cached RetrievalListeners
+ * with the new data.
+ *
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ */
+/**
+ * @public
+ * @return {synchronized}
+ * @throws DataAccessException, MalformedQueryException
+ **/
+xap.data.datasource.AbstractDataSource.prototype.refresh = function() {
+
+ if ( getLog().isDebug() ) {
+ getLog().debug( ResourceDictionary.getMessage(
+ xap.data.datasource.AbstractDataSource.REFRESH_MSGID,
+ xap.data.datasource.AbstractDataSource,
+ this.getClass().getName()));
+ }
+ fireDataChanged();
+ requeryAll();
+}
+
+//----------------------------------------------------------------------
+// Protected Abstract Methods.
+//-----------------------------------------------------------------------
+
+/**
+ * Subclasses are responsible for implementing this method. The query
+ * details are obviously subclass specific. It is also up to the subclass
+ * whether to execute the query asynchronously or not.
+ *
+ * @param query The query to execute
+ * @param context The context for executing the query
+ * @param listener The listener to notify with the results of the query
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @protected
+ * @param query{String}
+ * @param context{Context}
+ * @param listener{DataRetrievalListener}
+ * @throws DataAccessException, MalformedQueryException;
+ **/
+xap.data.datasource.AbstractDataSource.prototype.handleDataQuery
+ = function( query, context, listener ){}
+
+
+/**
+ * Subclasses are responsible for implementing this method. The query
+ * details are obviously subclass specific. It is also up to the subclass
+ * whether to execute the query asynchronously or not.
+ *
+ * @param query The query to execute
+ * @param context The context for executing the query
+ * @param listener The listener to notify with the results of the query
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @protected
+ * @param query{String}
+ * @param context{Context}
+ * @param listener{DataSetRetrievalListener }
+ * @throws DataAccessException, MalformedQueryException
+ **/
+xap.data.datasource.AbstractDataSource.prototype.handleDataSetQuery = function( query, context, listener ){
+
+}
+
+
+
+/**
+ * Calls requestCompleted on the NetServiceListener returned by
+ * <code>getSourceLoadRequestListener</code>. This is for
+ * compatibility with the DataRequest plugin.
+ *
+ * @since 4.5/jRex1.1
+ * @public
+ * @return {void}
+ * @param a{String},
+ * @param response{HttpResponse}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.requestCompleted = function( a, response){
+ this.getSourceLoadRequestListener().requestCompleted(a, response);
+}
+
+/**
+ * Calls requestFailed on the NetServiceListener returned by
+ * <code>getSourceLoadRequestListener</code>. This is for
+ * compatibility with the DataRequest plugin.
+ *
+ * @since 4.5/jRex1.1
+ * @public
+ * @param a{String}
+ * @param e{NetServiceException}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.requestFailed = function( a, e ){
+ this.getSourceLoadRequestListener().requestFailed(a, e);
+}
+/**
+ * Returns a NetServiceListener used to retrieve the source object from the
+ * server asynchronously. Subclasses should implement NetServiceListener
+ * interface with their specific behaviour. For example, DocumentDataSource's
+ * listener parses the response from the server into a Document while the
+ * ObjectDataSource's listener deserializes the received bytes into an Object.
+ *
+ * @return NetServiceListener that knows how to convert the server's response
+ * into a datasource specific source object.
+ */
+/**
+ * @protected
+ * @return {NetServiceListener}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getSourceLoadRequestListener = function(){
+}
+
+//----------------------------------------------------------------------
+// Protected Methods.
+//----------------------------------------------------------------------
+
+/**
+ * @return the ClientSession this DataSource is associated with
+ */
+/**
+ * @protected
+ * @return {ClientSession}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getClientSession = function() {
+ return this._clientSession;
+}
+
+/**
+ * @return the DataSource declaration element
+ */
+/**
+ * @protected
+ * @return {Element}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getDataSourceElement = function() {
+ return this._dataSourceElement;
+}
+
+/**
+ * @return the source object of the DataSource
+ */
+/**
+ * @protected
+ * @return {Object}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getSource = function() {
+ return this._source;
+}
+
+/**
+ * Asynchronously loads the source object using NetService
+ *
+ * @param sourceUrl The url to the resource that is expected to return the
+ * source object for this DataSource
+ */
+/**
+ * @protected
+ * @param sourceUri{String}
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.loadSourceFromServer = function(sourceUrl ) {
+ if ( this.getLog().isDebug() ) {
+ this.getLog().debug( ResourceDictionary.getMessage(
+ LOADING_SOURCE_FROM_SERVER_MSGID,
+ xap.data.datasource.AbstractDataSource,
+ [sourceUrl, this.getClass().getName()]));
+ }
+ /*ClientSession*/
+ var session = getClientSession();
+ /*RequestService*/
+ var netService = session.getRequestService();
+ /*NetServiceListener*/
+ var listener = getSourceLoadRequestListener();
+ netService.retrieveAsynchronously( sourceUrl, listener );
+}
+
+/**
+ * Sets the source object for this DataSource
+ *
+ * @param sourceObject The new source object
+ * @protected
+ * @param sourceObject{Object}
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.setSource = function( sourceObject ) {
+ this._source = sourceObject;
+}
+
+/**
+ * Adds a postponed query to this DataSource. This method can be used to
+ * cache queries for later execution (for example if the source object is
+ * loaded asynchronously, postponed queries can be executed when the object
+ * finishes loading). Subclasses are responsible for clearing the posponed
+ * query queue after the queries are executed.
+ *
+ * @param query
+ * @param context
+ * @param listener
+ */
+/**
+ * @protected
+ * @return {void}
+ * @param query{String}
+ * @param context{Context}
+ * @param listener{RetrievalListener }
+ **/
+xap.data.datasource.AbstractDataSource.prototype.addPostponedQuery = function( query, context, listener ) {
+ /*QueryRecord*/
+ var queryRecord = new QueryRecord( query, context, listener );
+ this._postponedQueries.addElement( queryRecord );
+}
+
+/**
+ * Executes all posponed queries in order they came in.
+ * At the end of this method the postponed query vector is cleared
+ * regardless of queries' execution result.
+ */
+/**
+ * @protected
+ * @synchronized
+ **/
+xap.data.datasource.AbstractDataSource.prototype.executePostponedQueries = function() {
+ try {
+ for( var i=0; i < this._postponedQueries.size(); i++ ) {
+ /*QueryRecord*/
+ var rec = this._postponedQueries.elementAt( i );
+ try {
+ handleQuery( rec.getQuery(), rec.getContext(), rec.getListener() );
+ } catch (/* DataAccessException */e ) {
+ // getLog().exception( e );
+ //} catch ( /*MalformedQueryException */e ) {
+ getLog().exception( e );
+ }
+ }
+ } finally {
+ this._postponedQueries.removeAllElements();
+ }
+}
+
+/**
+ * Clears the posponed query vector.
+ */
+/**
+ * @protected
+ * @return {void}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.clearPostponedQueries = function() {
+ this._postponedQueries.removeAllElements();
+}
+
+/**
+ * @return vector of postponed queries whose execution has been postponed
+ * for some reason (i.e. the source object was not available).
+ */
+/**
+ * @protected
+ * @return {Vector}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getPostponedQueries = function() {
+ return this._postponedQueries;
+}
+
+/**
+ * @return vector of all bound queries (bound type != ONE_TIME)
+ */
+/**
+ * @protected
+ * @return {Vector}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getBoundQueries = function() {
+ return this._boundQueries;
+}
+
+/**
+ * Returns true if the url represents an absolute or relative HTTP URL
+ * or classpath entry.
+ * @param url
+ * @return boolean
+ */
+/**
+ * @protected
+ * @param url{String}
+ * @return {boolean}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.isHttpUrl = function( url ) {
+ return url.startsWith( "http://" ) ||
+ url.startsWith( "https://" ) || url.startsWith("classpath://") ||
+ url.indexOf( "://" ) == -1;
+}
+
+/**
+ * Extract the container name from the objectUrl.
+ *
+ * @param sourceUrl
+ * @return container name
+ * @throws DataAccessException
+ */
+/**
+ * @protected
+ * @sourceUrl{String}
+ * @return {String}
+ * @throws DataAccessException
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getContainerName = function( sourceUrl ) {
+ /*int*/
+ var i = sourceUrl.indexOf( "://" );
+ if ( i == -1 ) {
+ throw new DataAccessException(
+ DataAccessException.INVALID_SOURCE_URL_MSGID,
+ sourceUrl );
+ }
+ /*String*/
+ var containerName = sourceUrl.substring( 0, i );
+ return containerName;
+}
+
+/**
+ * @return the static Log instance
+ */
+/**
+ * @protected
+ * @return {Log}
+ **/
+xap.data.datasource.AbstractDataSource.prototype.getLog = function() {
+ return LogFactory.getLog( "DataSource" );
+}
+
+//-----------------------------------------------------------------------
+// Private Methods.
+//-----------------------------------------------------------------------
+
+/**
+ * This method persists queries whose binding type != ONE_TIME).
+ * It then delegates the call to a subclass whose responsibility is to
+ * process the query in a way it sees fit (i.e. the query could be
+ * executed synchronously or asynchronously).
+ *
+ * @param context The context for executing the query
+ * @param query The query to execute
+ * @param listener The listener to notify after the query finishes
+ *
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @throws UnsupportedBindingTypeException
+ */
+/**
+ * @private
+ * @return {void}
+ * @param query{String}
+ * @param context{Context}
+ * @param listener{RetrievalListener }
+ * @throws DataAccessException, MalformedQueryException,UnsupportedBindingTypeException
+ **/
+xap.data.datasource.AbstractDataSource.prototype.handleGenericQuery = function( query, context, listener ) {
+ if( ! isSupported( listener.getBindingType() )) {
+ throw new UnsupportedBindingTypeException( listener.getBindingType(),
+ getClass());
+ }
+ // take care of caching queries for later executions when the data
+ // changes
+ if ( listener != null &&
+ listener.getBindingType() != BindingType.ONE_TIME ) {
+ /*QueryRecord*/
+ var queryRecord = new QueryRecord( query, context, listener );
+ this._boundQueries.addElement( queryRecord );
+ }
+ handleQuery( query, context, listener );
+}
+
+/**
+ * A helper method for calling appropriate handleX methods
+ *
+ * @param query
+ * @param queryContext
+ * @param listener
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ */
+/**
+ * @private
+ * @return {void}
+ * @throws DataAccessException, MalformedQueryException
+ * @param query{String}
+ * @param queryContext{Context}
+ * @param listener{RetrievalListener }
+ **/
+xap.data.datasource.AbstractDataSource.prototype.handleQuery = function( query, queryContext, listener ) {
+ if ( listener instanceof DataRetrievalListener ) {
+ this.handleDataQuery( query, queryContext,
+ /*(DataRetrievalListener)*/ listener );
+ } else if ( listener instanceof DataSetRetrievalListener ) {
+ this.handleDataSetQuery( query, queryContext,
+ /*(DataSetRetrievalListener)*/ listener );
+ }
+}
+
+/**
+ * Requeries all bound queries (binding type != BindingType.ONE_TIME)
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @private
+ * @return {void}
+ * @throws DataAccessException, MalformedQueryException
+ **/
+xap.data.datasource.AbstractDataSource.prototype.requeryAll = function() {
+ for( var i=0; i < this._boundQueries.size(); i++ ) {
+ /*QueryRecord*/
+ var rec = this._boundQueries.elementAt( i );
+ this.handleQuery( rec.getQuery(), rec.getContext(), rec.getListener() );
+ }
+}
+
+
+
+
Propchange: incubator/xap/trunk/src/xap/data/datasource/AbstractDataSource.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/xap/trunk/src/xap/data/datasource/DataSourceContainerImpl.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/datasource/DataSourceContainerImpl.js?view=auto&rev=447525
==============================================================================
--- incubator/xap/trunk/src/xap/data/datasource/DataSourceContainerImpl.js (added)
+++ incubator/xap/trunk/src/xap/data/datasource/DataSourceContainerImpl.js Mon Sep 18 12:52:14 2006
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2006 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+Xap.provide("xap.data.datasource.DataSourceContainerImpl") ;
+
+Xap.require("xap.session.Container") ;
+
+/**
+ * DataSourceContainer implementation.
+ * @author dgennaco
+ */
+
+xap.data.datasource.DataSourceContainerImpl = function(){
+ xap.session.Container.call(this) ;
+}
+
+Xap.setupClassAsSubclassOf("xap.data.datasource.DataSourceContainerImpl","xap.session.Container") ;
+
+
+/**
+ * @param sess{ClientSession}
+**/
+xap.data.datasource.DataSourceContainerImpl = function(sess) {
+ xap.session.Container.call(this,sess);
+}
+
+/* (non-Javadoc)
+ * @see xap.data.datasource.DataSourceContainer#getNames()
+ *
+ * @public
+ * @return {String[]}
+**/
+xap.data.datasource.DataSourceContainerImpl.prototype.getIds = function() {
+ return xap.session.Container.getNames.call(this);
+}
+
+/* (non-Javadoc)
+ * @see xap.data.datasource.DataSourceContainer#hasDataSource(xap.data.datasource.DataSource)
+ *
+ * @public
+ * @return {boolean}
+ *
+ * @param dataSource{DataSource}
+**/
+xap.data.datasource.DataSourceContainerImpl.prototype.hasDataSource = function( dataSource ) {
+ return xap.session.Container.containsValue.call(this,dataSource);
+ }
+
+ /* (non-Javadoc)
+ * @see xap.data.datasource.DataSourceContainer#addDataSource(java.lang.String, xap.data.datasource.DataSource)
+ *
+ * @public
+ * @return {void}
+ *
+ * @param name{String}
+ * @param dataSource{DataSource}
+**/
+xap.data.datasource.DataSourceContainerImpl.prototype.addDataSource = function( name, dataSource ) {
+ xap.session.Container.put.apply(this,arguments);
+}
+
+ /* (non-Javadoc)
+ * @see xap.data.datasource.DataSourceContainer#getName(xap.data.datasource.DataSource)
+ *
+ * @public
+ * @return {String}
+ *
+ * @param dataSource{DataSource}
+**/
+xap.data.datasource.DataSourceContainerImpl.prototype.getId = function( dataSource ) {
+ return xap.session.Container.getName.call(this,dataSource);
+ }
+
+ /* (non-Javadoc)
+ * @see xap.data.datasource.DataSourceContainer#getDataSource(java.lang.String)
+ *
+ * @public
+ * @return {DataSource}
+ *
+ * @param name{String}
+**/
+xap.data.datasource.DataSourceContainerImpl.prototype.getDataSource = function( name ) {
+ return xap.session.Container.get.call(this,name);
+ }
+
+ /* (non-Javadoc)
+ * @see xap.data.datasource.DataSourceContainer#removeDataSource(xap.data.datasource.DataSource)
+ *
+ * @public
+ * @return {boolean}
+ *
+ * @param dataSource{DataSource}
+**/
+xap.data.datasource.DataSourceContainerImpl.prototype.removeDataSource = function( dataSource ) {
+ return xap.session.Container.removeValue.call(dataSource);
+ }
+
+ /* (non-Javadoc)
+ * @see xap.data.datasource.DataSourceContainer#removeDataSource(java.lang.String)
+ *
+ * @public
+ * @return {DataSource}
+ *
+ * @param name{String}
+**/
+xap.data.datasource.DataSourceContainerImpl.prototype.removeDataSource = function( name ) {
+ return xap.session.Container.remove.call(this,name);
+ }
+
+/* (non-Javadoc)
+ * @see xap.data.datasource.DataSourceContainer#getDataSources()
+ *
+ * @public
+ * @return {DataSource[]}
+ */
+xap.data.datasource.DataSourceContainerImpl.prototype.getDataSources = function() {
+/*Object []*/
+var objects = getObjects();
+ /*DataSource []*/
+ var retArray = new DataSource[objects.length];
+ for (var i = 0; i < retArray.length; i++) {
+ retArray[i] = objects[i];
+ }
+ return retArray;
+}
+
Propchange: incubator/xap/trunk/src/xap/data/datasource/DataSourceContainerImpl.js
------------------------------------------------------------------------------
svn:eol-style = native