cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: rev 56954 - cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron
Date Mon, 08 Nov 2004 17:44:43 GMT
Author: unico
Date: Mon Nov  8 09:44:43 2004
New Revision: 56954

Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/DataSourceComponentConnectionProvider.java
Log:
use selector to lookup datasources in order to work with default way of declaring excalibur
datasources

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/DataSourceComponentConnectionProvider.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/DataSourceComponentConnectionProvider.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/cron/java/org/apache/cocoon/components/cron/DataSourceComponentConnectionProvider.java
Mon Nov  8 09:44:43 2004
@@ -22,6 +22,7 @@
 import org.apache.avalon.framework.configuration.ConfigurationException;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
 import org.quartz.utils.ConnectionProvider;
 
 /**
@@ -31,12 +32,14 @@
 public class DataSourceComponentConnectionProvider implements ConnectionProvider {
 
     private ServiceManager m_manager;
+    private ServiceSelector m_datasources;
     private DataSourceComponent m_ds;
 
     public DataSourceComponentConnectionProvider(String dsName, ServiceManager manager) throws
ConfigurationException {
         m_manager = manager;
         try {
-            m_ds = (DataSourceComponent) m_manager.lookup(DataSourceComponent.ROLE + "/"
+ dsName);            
+             m_datasources = (ServiceSelector) m_manager.lookup(DataSourceComponent.ROLE
+ "Selector");
+             m_ds = (DataSourceComponent) m_datasources.select(dsName);
         }
         catch (ServiceException e) {
             throw new ConfigurationException("No datasource available by that name: " + dsName);
@@ -55,9 +58,13 @@
      */
     public void shutdown() throws SQLException {
         if (m_ds != null) {
-            m_manager.release(m_ds);
+            m_datasources.release(m_ds);
+        }
+        if (m_datasources != null) {
+            m_manager.release(m_datasources);
         }
         m_ds = null;
+        m_datasources = null;
         m_manager = null;
     }
 

Mime
View raw message