1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package com.isenshi.util.extlib;
17
18 import java.sql.Connection;
19 import java.sql.SQLException;
20 import java.util.Hashtable;
21
22 import javax.sql.DataSource;
23
24 import org.apache.slide.common.NamespaceAccessToken;
25 import org.apache.slide.common.ServiceInitializationFailedException;
26 import org.apache.slide.common.ServiceParameterErrorException;
27 import org.apache.slide.common.ServiceParameterMissingException;
28 import org.apache.slide.store.impl.rdbms.JDBCStore;
29 import org.seasar.framework.container.S2Container;
30 import org.seasar.framework.container.factory.SingletonS2ContainerFactory;
31 import org.seasar.tuigwaa.util.TgwResource;
32
33
34 public class S2Store extends JDBCStore {
35
36 public synchronized void initialize(NamespaceAccessToken token) throws ServiceInitializationFailedException {
37 super.alreadyInitialized = true;
38 }
39
40 public void setParameters(Hashtable parameters) throws ServiceParameterErrorException, ServiceParameterMissingException {
41 String driver = TgwResource.getProperty("database.driver");
42 String adapter = TgwResource.getProperty("slide." + driver);
43 parameters.put("adapter", adapter);
44 super.setParameters(parameters);
45 }
46
47 protected Connection getNewConnection() throws SQLException {
48 S2Container container = SingletonS2ContainerFactory.getContainer();
49 DataSource dataSource = (DataSource)container.getComponent("basedb.dataSource");
50 return dataSource.getConnection();
51 }
52 }