Author: mrdon Date: Tue Mar 1 17:26:14 2005 New Revision: 155852 URL: http://svn.apache.org/viewcvs?view=rev&rev=155852 Log: Removing data sources support - hope I got everything
Removed: struts/core/trunk/doc/faqs/database.xml struts/core/trunk/src/share/org/apache/struts/config/DataSourceConfig.java Modified: struts/core/trunk/conf/share/struts-config_1_3.dtd struts/core/trunk/doc/faqs/index.xml struts/core/trunk/doc/userGuide/building_controller.xml struts/core/trunk/doc/userGuide/configuration.xml struts/core/trunk/doc/userGuide/index.xml struts/core/trunk/doc/userGuide/installation.xml struts/core/trunk/src/share/org/apache/struts/Globals.java struts/core/trunk/src/share/org/apache/struts/action/Action.java struts/core/trunk/src/share/org/apache/struts/action/ActionResources.properties struts/core/trunk/src/share/org/apache/struts/action/ActionResources_ja.properties struts/core/trunk/src/share/org/apache/struts/action/ActionServlet.java struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContext.java struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java struts/core/trunk/src/share/org/apache/struts/config/ConfigHelperInterface.java struts/core/trunk/src/share/org/apache/struts/config/ConfigRuleSet.java struts/core/trunk/src/share/org/apache/struts/config/ModuleConfig.java struts/core/trunk/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java struts/core/trunk/src/share/org/apache/struts/plugins/ModuleConfigVerifier.java struts/core/trunk/src/test/org/apache/struts/config/TestModuleConfig.java struts/core/trunk/src/test/org/apache/struts/config/struts-config-1.1.xml struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping-1.1.xml struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping.xml struts/core/trunk/src/test/org/apache/struts/config/struts-config.xml Modified: struts/core/trunk/conf/share/struts-config_1_3.dtd URL: http://svn.apache.org/viewcvs/struts/core/trunk/conf/share/struts-config_1_3.dtd?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/conf/share/struts-config_1_3.dtd (original) +++ struts/core/trunk/conf/share/struts-config_1_3.dtd Tue Mar 1 17:26:14 2005 @@ -82,53 +82,9 @@ hierarchy, and contains nested elements for all of the other configuration settings. --> -<!ELEMENT struts-config (display-name?, description?, data-sources?, form-beans?, global-exceptions?, global-forwards?, action-mappings?, controller?, message-resources*, plug-in*)> +<!ELEMENT struts-config (display-name?, description?, form-beans?, global-exceptions?, global-forwards?, action-mappings?, controller?, message-resources*, plug-in*)> <!ATTLIST struts-config id ID #IMPLIED> - -<!-- The "data-sources" element describes a set of DataSource objects [JDBC 2.0 - Standard Extension]. The individual DataSource objects are configured through - nested <data-source> elements. ---> -<!ELEMENT data-sources (data-source*)> -<!ATTLIST data-sources id ID #IMPLIED> - - -<!-- The "data-source" element describes a DataSource object [JDBC 2.0 Standard - Extension] that will be instantiated, configured, and made available as a - servlet context attribute (or "application-scope bean"). Any object can be - specified so long as it implements [javax.sql.DataSource] and can be - configured entirely from JavaBean properties. The following attributes - are required: - - className The configuration bean for this DataSource object. If - specified, the object must be a subclass of the default - configuration bean. - ["org.apache.struts.config.DataSourceConfig"] - - key Servlet context attribute key under which this data source - will be stored. Default is the value specified by string - constant defined by Globals.DATA_SOURCE_KEY. The application - module prefix (if any) is appended to the key - (${key}$prefix}). - [org.apache.struts.Globals.DATA_SOURCE_KEY] - - NOTE: The application module prefix includes the leading - slash, so the default datasource for a module named "foo" is - stored under "org.apache.struts.action.DATA_SOURCE/foo". - - type Fully qualified Java class name for this data source object. - The class must implement DataSource [javax.sql.DataSource], - and the object must be configurable entirely from JavaBean - properties. ---> -<!ELEMENT data-source (set-property*)> -<!ATTLIST data-source id ID #IMPLIED> -<!ATTLIST data-source className %ClassName; #IMPLIED> -<!ATTLIST data-source key %AttributeName; #IMPLIED> -<!ATTLIST data-source type %ClassName; #REQUIRED> - - <!-- The "form-beans" element describes the set of form bean descriptors for this module. The following attributes are defined: @@ -679,7 +635,7 @@ the surrounding element is instantiated, the accessor for the indicated property is called and passed the indicated value. The "set-property" element is especially useful when a custom subclass is used with - <data-source>, <forward>, <action>, or <plug-in> elements. The subclass + <forward>, <action>, or <plug-in> elements. The subclass can be passed whatever other properties may be required to configure the object without changing how the struts-config is parsed. Modified: struts/core/trunk/doc/faqs/index.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/doc/faqs/index.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/doc/faqs/index.xml (original) +++ struts/core/trunk/doc/faqs/index.xml Tue Mar 1 17:26:14 2005 @@ -45,10 +45,6 @@ </li> <li> - <a href="database.html">Accessing a Database</a> - </li> - - <li> <a href="indexedprops.html">Indexed Properties, Mapped Properties, and Indexed Tags</a> </li> Modified: struts/core/trunk/doc/userGuide/building_controller.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/doc/userGuide/building_controller.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/doc/userGuide/building_controller.xml (original) +++ struts/core/trunk/doc/userGuide/building_controller.xml Tue Mar 1 17:26:14 2005 @@ -1350,8 +1350,8 @@ controller in the request -- and you want to! The controller puts the application configuration in the request, which makes available all of your module-specific configuration data - (including which message resources you are using, request-processor, - datasources, and so forth). + (including which message resources you are using, request-processor, + and so forth). </p> <p> Modified: struts/core/trunk/doc/userGuide/configuration.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/doc/userGuide/configuration.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/doc/userGuide/configuration.xml (original) +++ struts/core/trunk/doc/userGuide/configuration.xml Tue Mar 1 17:26:14 2005 @@ -50,10 +50,6 @@ <plug-in> </li> - <li> - <data-sources> - </li> - </ul> </section> @@ -318,77 +314,6 @@ value="/WEB-INF/tiles-defs.xml"/> </plug-in> ]]></code></pre> - -</section> - -<section name="5.2.4 Data Source Configuration" href="data-source_config"> - - <p> - Besides the objects related to defining ActionMappings, the Struts - configuration may contain elements that create other useful objects. - </p> - - <p> - The <code><data-sources></code> section can be used to specify - a collection of DataSources [javax.sql.DataSource] for the use of your - application. - Typically, a DataSource represents a connection pool to a database - or other persistent store. - As a convenience, the Struts DataSource manager can be used to - instantiate whatever standard pool your application may need. - Of course, if your persistence layer provides for its own connections, - then you do not need to specify a <code>data-sources</code> element. - </p> - - <p> - Since DataSource implementations vary in what properties need to be - set, unlike other Struts configuration elements, the - <code><data-source></code> element does not pre-define a slate of - properties. - Instead, the generic <code><set-property></code> feature is used to set - whatever properties your implementation may require. - Typically, these settings would include: - </p> - - <ul> - - <li> - A driver class name - </li> - - <li> - A url to access the driver - </li> - - <li> - A description - </li> - - </ul> - - <p> - And other sundry properties. - </p> - -<pre><code><![CDATA[ -<data-source type="org.apache.commons.dbcp.BasicDataSource"> -<!-- ... set-property elements ... --> -</data-source> -]]></code></pre> - - <p> - Since Struts 1.2.0, the GenericDataSource has been removed, and it is - recommended that you use the Commons BasicDataSource or other DataSource - implementations instead. In practice, if you need to use the DataSource - manager, you should use whatever DataSource implementation works best - with your container or database. - </p> - - <p> - For examples of specifying a <code><data-sources></code> element and using the - DataSource with an Action, see the - <a href="../faqs/database.html">Accessing a Database HowTo</a>. - </p> </section> Modified: struts/core/trunk/doc/userGuide/index.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/doc/userGuide/index.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/doc/userGuide/index.xml (original) +++ struts/core/trunk/doc/userGuide/index.xml Tue Mar 1 17:26:14 2005 @@ -110,7 +110,6 @@ <li><a href="configuration.html#controller_config">5.2.1 Controller Configuration</a></li> <li><a href="configuration.html#resources_config">5.2.2 Message Resources Configuration</a></li> <li><a href="configuration.html#plugin_config">5.2.3 PlugIn Configuration</a></li> - <li><a href="configuration.html#data-source_config">5.2.4 Data Source Configuration</a></li> </ul> </li> <li><a href="configuration.html#dd_config_modules">5.3 Configuring your application for modules</a> Modified: struts/core/trunk/doc/userGuide/installation.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/doc/userGuide/installation.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/doc/userGuide/installation.xml (original) +++ struts/core/trunk/doc/userGuide/installation.xml Tue Mar 1 17:26:14 2005 @@ -73,11 +73,6 @@ <a href="http://jakarta.apache.org/builds/jakarta-servletapi">here</a>. </li> - <li><strong>JDBC 2.0 Optional Package Classes</strong> - Struts supports - an optional implementation of <code>javax.sql.DataSource</code>, so it - requires the API classes to be compiled. They can be downloaded from - <a href="http://java.sun.com/products/jdbc/download.html">http://java.sun.com/products/jdbc/download.html</a>.</li> - <li> <strong>Other Packages</strong> - Struts utilizes several packages from other open source projects, especially the <a href="http://jakarta.apache.org/commons/">Jakarta Modified: struts/core/trunk/src/share/org/apache/struts/Globals.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/Globals.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/Globals.java (original) +++ struts/core/trunk/src/share/org/apache/struts/Globals.java Tue Mar 1 17:26:14 2005 @@ -73,17 +73,6 @@ public static final String MODULE_PREFIXES_KEY = "org.apache.struts.globals.MODULE_PREFIXES"; - - /** - * The context attributes key under which our <strong>default</strong> - * configured data source (which must implement - * <code>javax.sql.DataSource</code>) is stored, - * if one is configured for this module. - */ - public static final String DATA_SOURCE_KEY = - "org.apache.struts.action.DATA_SOURCE"; - - /** * The request attributes key under which your action should store an * <code>org.apache.struts.action.ActionErrors</code> object, if you Modified: struts/core/trunk/src/share/org/apache/struts/action/Action.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/Action.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/action/Action.java (original) +++ struts/core/trunk/src/share/org/apache/struts/action/Action.java Tue Mar 1 17:26:14 2005 @@ -26,7 +26,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import javax.sql.DataSource; import org.apache.struts.Globals; import org.apache.struts.config.ModuleConfig; @@ -287,42 +286,6 @@ */ protected String generateToken(HttpServletRequest request) { return token.generateToken(request); - } - - - /** - * <p>Return the default data source for the current module.</p> - * - * @param request The servlet request we are processing - * - * @since Struts 1.1 - */ - protected DataSource getDataSource(HttpServletRequest request) { - - return (getDataSource(request, Globals.DATA_SOURCE_KEY)); - - } - - - - /** - * <p>Return the specified data source for the current module.</p> - * - * @param request The servlet request we are processing - * @param key The key specified in the - * <code><message-resources></code> element for the - * requested bundle - * - * @since Struts 1.1 - */ - protected DataSource getDataSource(HttpServletRequest request, String key) { - - // Identify the current module - ServletContext context = getServlet().getServletContext(); - ModuleConfig moduleConfig = - ModuleUtils.getInstance().getModuleConfig(request, context); - - return (DataSource) context.getAttribute(key + moduleConfig.getPrefix()); } Modified: struts/core/trunk/src/share/org/apache/struts/action/ActionResources.properties URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/ActionResources.properties?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/action/ActionResources.properties (original) +++ struts/core/trunk/src/share/org/apache/struts/action/ActionResources.properties Tue Mar 1 17:26:14 2005 @@ -10,12 +10,8 @@ configParse=Parsing error processing resource path {0} configVerifying=Verifying ModuleConfig for this module configWebXml=The /WEB-INF/web.xml was not found. -dataSource.destroy=Finalizing application data source {0} -dataSource.init=Initializing application data source {0} -destroyDataSource=Exception destroying application data source {0} finalizing=Finalizing this controller servlet formBean=Error creating form bean of class {0} -initDataSource=Exception initializing application data source {0} initProcessor=Exception initializing RequestProcessor mappingType=Must specify one of "forward", "include" or "type" for path {0} notAuthorized=User is not authorized to access action {0} Modified: struts/core/trunk/src/share/org/apache/struts/action/ActionResources_ja.properties URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/ActionResources_ja.properties?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/action/ActionResources_ja.properties (original) +++ struts/core/trunk/src/share/org/apache/struts/action/ActionResources_ja.properties Tue Mar 1 17:26:14 2005 @@ -9,12 +9,8 @@ configMissing=\u30d1\u30b9 {0} \u306b\u5bfe\u3059\u308b\u30de\u30c3\u30d4\u30f3\u30b0\u8a2d\u5b9a\u304c\u3042\u308a\u307e\u305b\u3093 configParse=\u30d1\u30b9 {0} \u306b\u5bfe\u3059\u308b\u30ea\u30bd\u30fc\u30b9\u8aad\u307f\u8fbc\u307f\u30a8\u30e9\u30fc configVerifying=\u3053\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u306B\u5BFE\u3059\u308BModuleConfig\u306E\u691C\u8A3C -dataSource.destroy=\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9 {0} \u306e\u7d42\u4e86\u51e6\u7406 -dataSource.init=\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9 {0} \u306e\u521d\u671f\u5316 -destroyDataSource=\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9 {0} \u7834\u68c4\u306e\u4f8b\u5916 finalizing=\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30b5\u30fc\u30d6\u30ec\u30c3\u30c8\u306e\u7d42\u4e86\u51e6\u7406 formBean=\u30d5\u30a9\u30fc\u30e0Bean {0} \u306e\u751f\u6210\u30a8\u30e9\u30fc -initDataSource=\u30c7\u30fc\u30bf\u30bd\u30fc\u30b9 {0} \u306e\u521d\u671f\u5316\u4f8b\u5916 initProcessor=RequestProcessor\u521D\u671F\u5316\u4F8B\u5916 mappingType=\u30d1\u30b9 {0} \u306e\u5c5e\u6027\u306b "forward", "include","type" \u306e\u3046\u3061\u306e\u4e00\u3064\u3092\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059 notAuthorized=\u3053\u306e\u30e6\u30fc\u30b6\u306f\u30a2\u30af\u30b7\u30e7\u30f3 {0} \u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306e\u8a8d\u8a3c\u304c\u884c\u308f\u308c\u3066\u3044\u307e\u305b\u3093 Modified: struts/core/trunk/src/share/org/apache/struts/action/ActionServlet.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/action/ActionServlet.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/action/ActionServlet.java (original) +++ struts/core/trunk/src/share/org/apache/struts/action/ActionServlet.java Tue Mar 1 17:26:14 2005 @@ -35,7 +35,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import javax.sql.DataSource; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.ConvertUtils; @@ -60,7 +59,6 @@ import org.apache.commons.logging.LogFactory; import org.apache.struts.Globals; import org.apache.struts.config.ConfigRuleSet; -import org.apache.struts.config.DataSourceConfig; import org.apache.struts.config.FormBeanConfig; import org.apache.struts.config.MessageResourcesConfig; import org.apache.struts.config.ModuleConfig; @@ -212,14 +210,6 @@ /** - * <p>The JDBC data sources that has been configured for this module, - * if any, keyed by the servlet context attribute under which they are - * stored.</p> - */ - protected FastHashMap dataSources = new FastHashMap(); - - - /** * <p>The resources object for our internal resources.</p> */ protected MessageResources internal = null; @@ -350,7 +340,6 @@ // Initialize modules as needed ModuleConfig moduleConfig = initModuleConfig("", config); initModuleMessageResources(moduleConfig); - initModuleDataSources(moduleConfig); initModulePlugIns(moduleConfig); moduleConfig.freeze(); @@ -364,7 +353,6 @@ moduleConfig = initModuleConfig (prefix, getServletConfig().getInitParameter(name)); initModuleMessageResources(moduleConfig); - initModuleDataSources(moduleConfig); initModulePlugIns(moduleConfig); moduleConfig.freeze(); } @@ -785,58 +773,6 @@ String msg = internal.getMessage("configParse", path); log.error(msg, e); throw new UnavailableException(msg); - } - - - /** - * <p>Initialize the data sources for the specified module.</p> - * - * @param config ModuleConfig information for this module - * - * @exception ServletException if initialization cannot be performed - * @since Struts 1.1 - */ - protected void initModuleDataSources(ModuleConfig config) throws ServletException { - - // :FIXME: Document UnavailableException? - - if (log.isDebugEnabled()) { - log.debug("Initializing module path '" + config.getPrefix() + - "' data sources"); - } - - ServletContextWriter scw = - new ServletContextWriter(getServletContext()); - DataSourceConfig dscs[] = config.findDataSourceConfigs(); - if (dscs == null) { - dscs = new DataSourceConfig[0]; - } - - dataSources.setFast(false); - for (int i = 0; i < dscs.length; i++) { - if (log.isDebugEnabled()) { - log.debug("Initializing module path '" + config.getPrefix() + - "' data source '" + dscs[i].getKey() + "'"); - } - DataSource ds = null; - try { - ds = (DataSource) - RequestUtils.applicationInstance(dscs[i].getType()); - BeanUtils.populate(ds, dscs[i].getProperties()); - ds.setLogWriter(scw); - - } catch (Exception e) { - log.error(internal.getMessage("dataSource.init", dscs[i].getKey()), e); - throw new UnavailableException - (internal.getMessage("dataSource.init", dscs[i].getKey())); - } - getServletContext().setAttribute - (dscs[i].getKey() + config.getPrefix(), ds); - dataSources.put(dscs[i].getKey(), ds); - } - - dataSources.setFast(true); - } Modified: struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContext.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContext.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContext.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContext.java Tue Mar 1 17:26:14 2005 @@ -20,8 +20,6 @@ import java.util.Locale; import java.util.Map; -import javax.sql.DataSource; - import org.apache.commons.chain.Context; import org.apache.struts.action.ActionMessages; import org.apache.struts.util.MessageResources; @@ -449,32 +447,4 @@ * to select the server's default Locale */ void setLocale(Locale locale); - - // ------------------------------- - // DataSource Processing - // ------------------------------- - - - - /** - * <p>Return the default data source for the current module.</p> - * - * @param request The servlet request we are processing - * - */ - DataSource getDataSource(); - - - - /** - * <p>Return the specified data source for the current module.</p> - * - * @param request The servlet request we are processing - * @param key The key specified in the - * <code><message-resources></code> element for the - * requested bundle - * - */ - DataSource getDataSource(String key); - -} \ No newline at end of file +} Modified: struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java (original) +++ struts/core/trunk/src/share/org/apache/struts/chain/contexts/ActionContextBase.java Tue Mar 1 17:26:14 2005 @@ -20,8 +20,6 @@ import java.util.Locale; import java.util.Map; -import javax.sql.DataSource; - import org.apache.commons.chain.Context; import org.apache.struts.action.ActionMessages; import org.apache.struts.util.MessageResources; @@ -60,8 +58,6 @@ public static final String EXCEPTION_KEY = Constants.EXCEPTION_KEY; - public static final String DEFAULT_DATA_SOURCE_KEY = "dataSource"; - public static final String ERROR_ACTION_MESSAGES_KEY = "errors"; public static final String MESSAGE_ACTION_MESSAGES_KEY = "messages"; @@ -339,16 +335,4 @@ return (Locale) this.get(LOCALE_KEY); } - // ------------------------------- - // DataSource Processing - // ------------------------------- - - public DataSource getDataSource() { - return (DataSource) this.get(DEFAULT_DATA_SOURCE_KEY); - } - - public DataSource getDataSource(String key) { - return (DataSource) this.get(key); - } - -} \ No newline at end of file +} Modified: struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java (original) +++ struts/core/trunk/src/share/org/apache/struts/config/ConfigHelper.java Tue Mar 1 17:26:14 2005 @@ -22,7 +22,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import javax.sql.DataSource; import org.apache.struts.Globals; import org.apache.struts.action.ActionForm; @@ -170,20 +169,6 @@ // ------------------------------------------------ Application Context - - /** - * The <strong>default</strong> - * configured data source (which must implement - * <code>javax.sql.DataSource</code>), - * if one is configured for this application. - */ - public DataSource getDataSource() { - - if (this.application == null) - return null; - return (DataSource) this.application.getAttribute(Globals.DATA_SOURCE_KEY); - - } public ActionMessages getActionMessages() { Modified: struts/core/trunk/src/share/org/apache/struts/config/ConfigHelperInterface.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ConfigHelperInterface.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/config/ConfigHelperInterface.java (original) +++ struts/core/trunk/src/share/org/apache/struts/config/ConfigHelperInterface.java Tue Mar 1 17:26:14 2005 @@ -20,8 +20,6 @@ package org.apache.struts.config; -import javax.sql.DataSource; - import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionFormBean; import org.apache.struts.action.ActionForward; @@ -61,8 +59,6 @@ // ------------------------------------------------ Application Context - - public DataSource getDataSource(); /** * The <code>org.apache.struts.action.ActionFormBeans</code> collection Modified: struts/core/trunk/src/share/org/apache/struts/config/ConfigRuleSet.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ConfigRuleSet.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/config/ConfigRuleSet.java (original) +++ struts/core/trunk/src/share/org/apache/struts/config/ConfigRuleSet.java Tue Mar 1 17:26:14 2005 @@ -56,21 +56,6 @@ */ public void addRuleInstances(Digester digester) { - digester.addObjectCreate - ("struts-config/data-sources/data-source", - "org.apache.struts.config.DataSourceConfig", - "className"); - digester.addSetProperties - ("struts-config/data-sources/data-source"); - digester.addSetNext - ("struts-config/data-sources/data-source", - "addDataSourceConfig", - "org.apache.struts.config.DataSourceConfig"); - - digester.addRule - ("struts-config/data-sources/data-source/set-property", - new AddDataSourcePropertyRule()); - digester.addRule ("struts-config/action-mappings", new SetActionMappingClassRule()); @@ -228,27 +213,6 @@ ("struts-config/plug-in/set-property", new PlugInSetPropertyRule()); - } - -} - - -/** - * Class that calls <code>addProperty()</code> for the top object - * on the stack, which must be a - * <code>org.apache.struts.config.DataSourceConfig</code>. - */ - -final class AddDataSourcePropertyRule extends Rule { - - public AddDataSourcePropertyRule() { - super(); - } - - public void begin(String namespace, String name, Attributes attributes) throws Exception { - DataSourceConfig dsc = (DataSourceConfig) digester.peek(); - dsc.addProperty(attributes.getValue("property"), - attributes.getValue("value")); } } Modified: struts/core/trunk/src/share/org/apache/struts/config/ModuleConfig.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/ModuleConfig.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/config/ModuleConfig.java (original) +++ struts/core/trunk/src/share/org/apache/struts/config/ModuleConfig.java Tue Mar 1 17:26:14 2005 @@ -105,17 +105,6 @@ void addActionConfig(ActionConfig config); /** - * Add a new <code>DataSourceConfig</code> instance to the set associated - * with this module. - * - * @param config The new configuration instance to be added - * - * @exception java.lang.IllegalStateException if this module configuration - * has been frozen - */ - void addDataSourceConfig(DataSourceConfig config); - - /** * Add a new <code>ExceptionConfig</code> instance to the set associated * with this module. * @@ -195,20 +184,6 @@ ActionConfig[] findActionConfigs(); /** - * Return the data source configuration for the specified key, if any; - * otherwise return <code>null</code>. - * - * @param key Key of the data source configuration to return - */ - DataSourceConfig findDataSourceConfig(String key); - - /** - * Return the data source configurations for this module. If there - * are none, a zero-length array is returned. - */ - DataSourceConfig[] findDataSourceConfigs(); - - /** * Return the exception configuration for the specified type, if any; * otherwise return <code>null</code>. * @@ -296,16 +271,6 @@ * has been frozen */ void removeExceptionConfig(ExceptionConfig config); - - /** - * Remove the specified data source configuration instance. - * - * @param config DataSourceConfig instance to be removed - * - * @exception java.lang.IllegalStateException if this module configuration - * has been frozen - */ - void removeDataSourceConfig(DataSourceConfig config); /** * Remove the specified form bean configuration instance. Modified: struts/core/trunk/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java (original) +++ struts/core/trunk/src/share/org/apache/struts/config/impl/ModuleConfigImpl.java Tue Mar 1 17:26:14 2005 @@ -26,7 +26,6 @@ import org.apache.struts.config.ActionConfig; import org.apache.struts.config.ActionConfigMatcher; import org.apache.struts.config.ControllerConfig; -import org.apache.struts.config.DataSourceConfig; import org.apache.struts.config.ExceptionConfig; import org.apache.struts.config.FormBeanConfig; import org.apache.struts.config.ForwardConfig; @@ -64,7 +63,6 @@ this.actionForwardClass = "org.apache.struts.action.ActionForward"; this.configured = false; this.controllerConfig = null; - this.dataSources = new HashMap(); this.exceptions = new HashMap(); this.formBeans = new HashMap(); this.forwards = new HashMap(); @@ -185,24 +183,6 @@ } /** - * Add a new <code>DataSourceConfig</code> instance to the set associated - * with this module. - * - * @param config The new configuration instance to be added - * - * @exception java.lang.IllegalStateException if this module configuration - * has been frozen - */ - public void addDataSourceConfig(DataSourceConfig config) { - - if (configured) { - throw new IllegalStateException("Configuration is frozen"); - } - dataSources.put(config.getKey(), config); - - } - - /** * Add a new <code>ExceptionConfig</code> instance to the set associated * with this module. * @@ -339,29 +319,6 @@ } /** - * Return the data source configuration for the specified key, if any; - * otherwise return <code>null</code>. - * - * @param key Key of the data source configuration to return - */ - public DataSourceConfig findDataSourceConfig(String key) { - - return ((DataSourceConfig) dataSources.get(key)); - - } - - /** - * Return the data source configurations for this module. If there - * are none, a zero-length array is returned. - */ - public DataSourceConfig[] findDataSourceConfigs() { - - DataSourceConfig results[] = new DataSourceConfig[dataSources.size()]; - return ((DataSourceConfig[]) dataSources.values().toArray(results)); - - } - - /** * Return the exception configuration for the specified type, if any; * otherwise return <code>null</code>. * @@ -483,11 +440,6 @@ getControllerConfig().freeze(); - DataSourceConfig[] dsconfigs = findDataSourceConfigs(); - for (int i = 0; i < dsconfigs.length; i++) { - dsconfigs[i].freeze(); - } - ExceptionConfig[] econfigs = findExceptionConfigs(); for (int i = 0; i < econfigs.length; i++) { econfigs[i].freeze(); @@ -551,23 +503,6 @@ } /** - * Remove the specified data source configuration instance. - * - * @param config DataSourceConfig instance to be removed - * - * @exception IllegalStateException if this module configuration - * has been frozen - */ - public void removeDataSourceConfig(DataSourceConfig config) { - - if (configured) { - throw new IllegalStateException("Configuration is frozen"); - } - dataSources.remove(config.getKey()); - - } - - /** * Remove the specified form bean configuration instance. * * @param config FormBeanConfig instance to be removed @@ -633,12 +568,6 @@ * listed in the order in which they are added. */ protected List actionConfigList = null; - - /** - * The set of JDBC data source configurations for this - * module, if any, keyed by the <code>key</code> property. - */ - protected HashMap dataSources = null; /** * The set of exception handling configurations for this Modified: struts/core/trunk/src/share/org/apache/struts/plugins/ModuleConfigVerifier.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/share/org/apache/struts/plugins/ModuleConfigVerifier.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/share/org/apache/struts/plugins/ModuleConfigVerifier.java (original) +++ struts/core/trunk/src/share/org/apache/struts/plugins/ModuleConfigVerifier.java Tue Mar 1 17:26:14 2005 @@ -132,9 +132,6 @@ if (!verifyControllerConfig()) { ok = false; } - if (!verifyDataSourceConfigs()) { - ok = false; - } if (!verifyExceptionConfigs()) { ok = false; } Modified: struts/core/trunk/src/test/org/apache/struts/config/TestModuleConfig.java URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/test/org/apache/struts/config/TestModuleConfig.java?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/test/org/apache/struts/config/TestModuleConfig.java (original) +++ struts/core/trunk/src/test/org/apache/struts/config/TestModuleConfig.java Tue Mar 1 17:26:14 2005 @@ -152,18 +152,6 @@ parseConfig(publicId,entityURL, strutsConfig); // Perform assertion tests on the parsed information - - DataSourceConfig dsc = - config.findDataSourceConfig(Globals.DATA_SOURCE_KEY); - assertNotNull("Found our data source configuration", dsc); - assertEquals("Data source driverClass", - "org.postgresql.Driver", - (String) dsc.getProperties().get("driverClass")); - - assertEquals("Data source description", - "Example Data Source Configuration", - (String) dsc.getProperties().get("description")); - FormBeanConfig fbcs[] = config.findFormBeanConfigs(); assertNotNull("Found our form bean configurations", fbcs); assertEquals("Found three form bean configurations", Modified: struts/core/trunk/src/test/org/apache/struts/config/struts-config-1.1.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/test/org/apache/struts/config/struts-config-1.1.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/test/org/apache/struts/config/struts-config-1.1.xml (original) +++ struts/core/trunk/src/test/org/apache/struts/config/struts-config-1.1.xml Tue Mar 1 17:26:14 2005 @@ -19,28 +19,6 @@ <struts-config> - <!-- ========== Data Source Configuration =============================== --> - <data-sources> - <data-source type="org.apache.commons.dbcp.BasicDataSource"> - <set-property property="autoCommit" - value="false"/> - <set-property property="description" - value="Example Data Source Configuration"/> - <set-property property="driverClass" - value="org.postgresql.Driver"/> - <set-property property="maxCount" - value="4"/> - <set-property property="minCount" - value="2"/> - <set-property property="password" - value="mypassword"/> - <set-property property="url" - value="jdbc:postgresql://localhost/mydatabase"/> - <set-property property="user" - value="myusername"/> - </data-source> - </data-sources> - <!-- ========== Form Bean Definitions =================================== --> <form-beans> Modified: struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping-1.1.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping-1.1.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping-1.1.xml (original) +++ struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping-1.1.xml Tue Mar 1 17:26:14 2005 @@ -19,28 +19,6 @@ <struts-config> - <!-- ========== Data Source Configuration =============================== --> - <data-sources> - <data-source> - <set-property property="autoCommit" - value="false"/> - <set-property property="description" - value="Example Data Source Configuration"/> - <set-property property="driverClass" - value="org.postgresql.Driver"/> - <set-property property="maxCount" - value="4"/> - <set-property property="minCount" - value="2"/> - <set-property property="password" - value="mypassword"/> - <set-property property="url" - value="jdbc:postgresql://localhost/mydatabase"/> - <set-property property="user" - value="myusername"/> - </data-source> - </data-sources> - <!-- ========== Form Bean Definitions =================================== --> <form-beans> Modified: struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping.xml (original) +++ struts/core/trunk/src/test/org/apache/struts/config/struts-config-custom-mapping.xml Tue Mar 1 17:26:14 2005 @@ -18,29 +18,6 @@ <struts-config> - - <!-- ========== Data Source Configuration =============================== --> - <data-sources> - <data-source type="org.apache.commons.dbcp.BasicDataSource" > - <set-property property="autoCommit" - value="false"/> - <set-property property="description" - value="Example Data Source Configuration"/> - <set-property property="driverClass" - value="org.postgresql.Driver"/> - <set-property property="maxCount" - value="4"/> - <set-property property="minCount" - value="2"/> - <set-property property="password" - value="mypassword"/> - <set-property property="url" - value="jdbc:postgresql://localhost/mydatabase"/> - <set-property property="user" - value="myusername"/> - </data-source> - </data-sources> - <!-- ========== Form Bean Definitions =================================== --> <form-beans> Modified: struts/core/trunk/src/test/org/apache/struts/config/struts-config.xml URL: http://svn.apache.org/viewcvs/struts/core/trunk/src/test/org/apache/struts/config/struts-config.xml?view=diff&r1=155851&r2=155852 ============================================================================== --- struts/core/trunk/src/test/org/apache/struts/config/struts-config.xml (original) +++ struts/core/trunk/src/test/org/apache/struts/config/struts-config.xml Tue Mar 1 17:26:14 2005 @@ -18,29 +18,7 @@ <struts-config> - - <!-- ========== Data Source Configuration =============================== --> - <data-sources> - <data-source type="org.apache.commons.dbcp.BasicDataSource"> - <set-property property="autoCommit" - value="false"/> - <set-property property="description" - value="Example Data Source Configuration"/> - <set-property property="driverClass" - value="org.postgresql.Driver"/> - <set-property property="maxCount" - value="4"/> - <set-property property="minCount" - value="2"/> - <set-property property="password" - value="mypassword"/> - <set-property property="url" - value="jdbc:postgresql://localhost/mydatabase"/> - <set-property property="user" - value="myusername"/> - </data-source> - </data-sources> - + <!-- ========== Form Bean Definitions =================================== --> <form-beans> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]