Commit 4fb9a704ea045dc8f3211173b1e05d6e825d55d8
1 parent
523eff39
Exists in
master
Início da implementação do mecanismo completo que possibilita a
configuração de diversos bancos de dados
Showing
6 changed files
with
502 additions
and
67 deletions
Show diff stats
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/configuration/JdbcConfig.java
@@ -42,17 +42,24 @@ import java.util.Map; | @@ -42,17 +42,24 @@ import java.util.Map; | ||
42 | import br.gov.frameworkdemoiselle.annotation.Name; | 42 | import br.gov.frameworkdemoiselle.annotation.Name; |
43 | import br.gov.frameworkdemoiselle.configuration.Configuration; | 43 | import br.gov.frameworkdemoiselle.configuration.Configuration; |
44 | 44 | ||
45 | -@Configuration(prefix = "frameworkdemoiselle.jdbc.") | 45 | +@Configuration(prefix = "frameworkdemoiselle.persistence.") |
46 | public class JdbcConfig implements Serializable { | 46 | public class JdbcConfig implements Serializable { |
47 | 47 | ||
48 | private static final long serialVersionUID = 1L; | 48 | private static final long serialVersionUID = 1L; |
49 | 49 | ||
50 | + @Name("default.datasource.name") | ||
51 | + private String defaultDataDourceName; | ||
52 | + | ||
50 | @Name("jndi.name") | 53 | @Name("jndi.name") |
51 | private Map<String, String> jndiName; | 54 | private Map<String, String> jndiName; |
52 | 55 | ||
53 | @Name("driver.class") | 56 | @Name("driver.class") |
54 | private Map<String, String> driverClass; | 57 | private Map<String, String> driverClass; |
55 | 58 | ||
59 | + public String getDefaultDataDourceName() { | ||
60 | + return defaultDataDourceName; | ||
61 | + } | ||
62 | + | ||
56 | public Map<String, String> getJndiName() { | 63 | public Map<String, String> getJndiName() { |
57 | return jndiName; | 64 | return jndiName; |
58 | } | 65 | } |
@@ -60,4 +67,5 @@ public class JdbcConfig implements Serializable { | @@ -60,4 +67,5 @@ public class JdbcConfig implements Serializable { | ||
60 | public Map<String, String> getDriverClass() { | 67 | public Map<String, String> getDriverClass() { |
61 | return driverClass; | 68 | return driverClass; |
62 | } | 69 | } |
70 | + | ||
63 | } | 71 | } |
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/producer/ConnectionProducer.java
@@ -2,42 +2,119 @@ package br.gov.frameworkdemoiselle.internal.producer; | @@ -2,42 +2,119 @@ package br.gov.frameworkdemoiselle.internal.producer; | ||
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | import java.sql.Connection; | 4 | import java.sql.Connection; |
5 | +import java.util.Collections; | ||
6 | +import java.util.HashMap; | ||
7 | +import java.util.Map; | ||
8 | +import java.util.Set; | ||
5 | 9 | ||
10 | +import javax.annotation.PostConstruct; | ||
6 | import javax.annotation.PreDestroy; | 11 | import javax.annotation.PreDestroy; |
7 | import javax.enterprise.context.RequestScoped; | 12 | import javax.enterprise.context.RequestScoped; |
13 | +import javax.enterprise.inject.Default; | ||
8 | import javax.enterprise.inject.Produces; | 14 | import javax.enterprise.inject.Produces; |
9 | -import javax.sql.DataSource; | 15 | +import javax.enterprise.inject.spi.InjectionPoint; |
16 | +import javax.inject.Inject; | ||
10 | 17 | ||
11 | -import br.gov.frameworkdemoiselle.configuration.ConfigurationException; | ||
12 | -import br.gov.frameworkdemoiselle.util.Beans; | 18 | +import org.slf4j.Logger; |
19 | + | ||
20 | +import br.gov.frameworkdemoiselle.DemoiselleException; | ||
21 | +import br.gov.frameworkdemoiselle.annotation.Name; | ||
22 | +import br.gov.frameworkdemoiselle.internal.configuration.JdbcConfig; | ||
23 | +import br.gov.frameworkdemoiselle.internal.proxy.ConnectionProxy; | ||
24 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | ||
13 | 25 | ||
14 | @RequestScoped | 26 | @RequestScoped |
15 | public class ConnectionProducer implements Serializable { | 27 | public class ConnectionProducer implements Serializable { |
16 | 28 | ||
17 | private static final long serialVersionUID = 1L; | 29 | private static final long serialVersionUID = 1L; |
18 | 30 | ||
19 | - private transient Connection connection; | 31 | + @Inject |
32 | + private Logger logger; | ||
33 | + | ||
34 | + @Inject | ||
35 | + @Name("demoiselle-jdbc-bundle") | ||
36 | + private ResourceBundle bundle; | ||
37 | + | ||
38 | + private final Map<String, Connection> cache = Collections.synchronizedMap(new HashMap<String, Connection>()); | ||
39 | + | ||
40 | + @Inject | ||
41 | + private DataSourceProducer producer; | ||
42 | + | ||
43 | + @PostConstruct | ||
44 | + public void init() { | ||
45 | + for (String name : producer.getCache().keySet()) { | ||
46 | + getConnection(name); | ||
47 | + } | ||
48 | + } | ||
20 | 49 | ||
50 | + @Default | ||
21 | @Produces | 51 | @Produces |
22 | - public Connection create() { | ||
23 | - if (this.connection == null) { | ||
24 | - this.connection = init(); | 52 | + public Connection create(InjectionPoint ip, JdbcConfig config) { |
53 | + String name = getName(ip, config); | ||
54 | + return new ConnectionProxy(name); | ||
55 | + } | ||
56 | + | ||
57 | + public Connection getConnection(String name) { | ||
58 | + Connection result = null; | ||
59 | + | ||
60 | + if (cache.containsKey(name)) { | ||
61 | + result = cache.get(name); | ||
62 | + | ||
63 | + } else { | ||
64 | + try { | ||
65 | + result = producer.create(name).getConnection(); | ||
66 | + | ||
67 | + cache.put(name, result); | ||
68 | + this.logger.info(bundle.getString("connection-was-created", name)); | ||
69 | + | ||
70 | + } catch (Exception cause) { | ||
71 | + // TODO Colocar uma mensagem amigável | ||
72 | + | ||
73 | + throw new DemoiselleException("", cause); | ||
74 | + } | ||
25 | } | 75 | } |
26 | 76 | ||
27 | - return this.connection; | 77 | + return result; |
28 | } | 78 | } |
29 | 79 | ||
30 | - private Connection init() { | ||
31 | - Connection result; | 80 | + private String getName(InjectionPoint ip, JdbcConfig config) { |
81 | + String result; | ||
32 | 82 | ||
33 | - try { | ||
34 | - DataSource dataSource = Beans.getReference(DataSource.class); | ||
35 | - result = dataSource.getConnection(); | 83 | + if (ip != null && ip.getAnnotated() != null && ip.getAnnotated().isAnnotationPresent(Name.class)) { |
84 | + // TODO Quando o comando Beans.getReference é usado para simular injeção, não existe | ||
85 | + // anotação @Inject então precisamos testar se #getAnnotated() retorna nulo aqui. | ||
86 | + result = ip.getAnnotated().getAnnotation(Name.class).value(); | ||
36 | 87 | ||
37 | - } catch (Exception cause) { | ||
38 | - // TODO Colocar uma mensagem amigável | 88 | + } else { |
89 | + result = getNameFromProperties(config); | ||
39 | 90 | ||
40 | - throw new ConfigurationException("", cause); | 91 | + if (result == null) { |
92 | + result = getNameFromCache(); | ||
93 | + } | ||
94 | + } | ||
95 | + | ||
96 | + return result; | ||
97 | + } | ||
98 | + | ||
99 | + private String getNameFromProperties(JdbcConfig config) { | ||
100 | + String result = config.getDefaultDataDourceName(); | ||
101 | + | ||
102 | + if (result != null) { | ||
103 | + this.logger.debug(bundle.getString("getting-default-datasource-name-from-properties", result)); | ||
104 | + } | ||
105 | + | ||
106 | + return result; | ||
107 | + } | ||
108 | + | ||
109 | + private String getNameFromCache() { | ||
110 | + String result; | ||
111 | + Set<String> names = producer.getCache().keySet(); | ||
112 | + | ||
113 | + if (names.size() > 1) { | ||
114 | + throw new DemoiselleException(bundle.getString("more-than-one-datasource-defined", | ||
115 | + Name.class.getSimpleName())); | ||
116 | + } else { | ||
117 | + result = names.iterator().next(); | ||
41 | } | 118 | } |
42 | 119 | ||
43 | return result; | 120 | return result; |
@@ -45,22 +122,28 @@ public class ConnectionProducer implements Serializable { | @@ -45,22 +122,28 @@ public class ConnectionProducer implements Serializable { | ||
45 | 122 | ||
46 | @PreDestroy | 123 | @PreDestroy |
47 | public void close() { | 124 | public void close() { |
48 | - if (this.connection != null) { | ||
49 | - | 125 | + for (Connection connection : cache.values()) { |
50 | try { | 126 | try { |
51 | - if (this.connection.isClosed()) { | 127 | + if (connection.isClosed()) { |
52 | // TODO Logar um warning informando que a conexão já havia sido finalizada. | 128 | // TODO Logar um warning informando que a conexão já havia sido finalizada. |
53 | 129 | ||
54 | } else { | 130 | } else { |
55 | - this.connection.close(); | 131 | + connection.close(); |
56 | // TODO Logar um info informando que a conexão foi finalizada. | 132 | // TODO Logar um info informando que a conexão foi finalizada. |
57 | } | 133 | } |
58 | 134 | ||
59 | } catch (Exception cause) { | 135 | } catch (Exception cause) { |
60 | // TODO Colocar uma mensagem amigável | 136 | // TODO Colocar uma mensagem amigável |
61 | 137 | ||
62 | - throw new ConfigurationException("", cause); | 138 | + throw new DemoiselleException("", cause); |
63 | } | 139 | } |
64 | } | 140 | } |
141 | + | ||
142 | + cache.clear(); | ||
143 | + } | ||
144 | + | ||
145 | + public Map<String, Connection> getCache() { | ||
146 | + return cache; | ||
65 | } | 147 | } |
148 | + | ||
66 | } | 149 | } |
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/producer/DataSourceProducer.java
1 | package br.gov.frameworkdemoiselle.internal.producer; | 1 | package br.gov.frameworkdemoiselle.internal.producer; |
2 | 2 | ||
3 | import java.io.Serializable; | 3 | import java.io.Serializable; |
4 | +import java.util.Collections; | ||
5 | +import java.util.HashMap; | ||
6 | +import java.util.HashSet; | ||
7 | +import java.util.Map; | ||
8 | +import java.util.Set; | ||
4 | 9 | ||
10 | +import javax.annotation.PostConstruct; | ||
11 | +import javax.annotation.PreDestroy; | ||
5 | import javax.enterprise.context.ApplicationScoped; | 12 | import javax.enterprise.context.ApplicationScoped; |
6 | -import javax.enterprise.inject.Produces; | 13 | +import javax.inject.Inject; |
7 | import javax.naming.Context; | 14 | import javax.naming.Context; |
8 | import javax.naming.InitialContext; | 15 | import javax.naming.InitialContext; |
9 | import javax.sql.DataSource; | 16 | import javax.sql.DataSource; |
10 | 17 | ||
11 | -import br.gov.frameworkdemoiselle.configuration.ConfigurationException; | 18 | +import org.slf4j.Logger; |
19 | + | ||
20 | +import br.gov.frameworkdemoiselle.DemoiselleException; | ||
21 | +import br.gov.frameworkdemoiselle.annotation.Name; | ||
12 | import br.gov.frameworkdemoiselle.internal.configuration.JdbcConfig; | 22 | import br.gov.frameworkdemoiselle.internal.configuration.JdbcConfig; |
13 | import br.gov.frameworkdemoiselle.util.Beans; | 23 | import br.gov.frameworkdemoiselle.util.Beans; |
24 | +import br.gov.frameworkdemoiselle.util.ResourceBundle; | ||
14 | 25 | ||
15 | @ApplicationScoped | 26 | @ApplicationScoped |
16 | public class DataSourceProducer implements Serializable { | 27 | public class DataSourceProducer implements Serializable { |
17 | 28 | ||
18 | private static final long serialVersionUID = 1L; | 29 | private static final long serialVersionUID = 1L; |
19 | 30 | ||
20 | - private transient DataSource dataSource; | 31 | + @Inject |
32 | + private Logger logger; | ||
33 | + | ||
34 | + @Inject | ||
35 | + @Name("demoiselle-jdbc-bundle") | ||
36 | + private ResourceBundle bundle; | ||
37 | + | ||
38 | + private final Map<ClassLoader, Map<String, DataSource>> cache = Collections | ||
39 | + .synchronizedMap(new HashMap<ClassLoader, Map<String, DataSource>>()); | ||
40 | + | ||
41 | + @PostConstruct | ||
42 | + public void loadDataSources() { | ||
43 | + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); | ||
44 | + | ||
45 | + for (String dataBaseName : getDataSourceNames(contextClassLoader)) { | ||
46 | + | ||
47 | + try { | ||
48 | + create(dataBaseName); | ||
49 | + } catch (Throwable t) { | ||
50 | + throw new DemoiselleException(t); | ||
51 | + } | ||
52 | + | ||
53 | + logger.debug(bundle.getString("datasource-name-found", dataBaseName)); | ||
54 | + } | ||
55 | + } | ||
56 | + | ||
57 | + private Set<String> getDataSourceNames(ClassLoader classLoader) { | ||
58 | + Set<String> result = new HashSet<String>(); | ||
59 | + | ||
60 | + JdbcConfig config = Beans.getReference(JdbcConfig.class); | ||
61 | + | ||
62 | + if (config.getJndiName() != null) { | ||
63 | + result.addAll(config.getJndiName().keySet()); | ||
64 | + } | ||
65 | + | ||
66 | + if (config.getDriverClass() != null) { | ||
67 | + result.addAll(config.getDriverClass().keySet()); | ||
68 | + } | ||
69 | + | ||
70 | + if (result.isEmpty()) { | ||
71 | + throw new DemoiselleException(bundle.getString("datasource-name-not-found")); | ||
72 | + } | ||
73 | + | ||
74 | + return result; | ||
75 | + } | ||
76 | + | ||
77 | + public DataSource create(String dataSourceName) { | ||
78 | + DataSource factory; | ||
79 | + | ||
80 | + ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); | ||
81 | + Map<String, DataSource> localCache; | ||
82 | + | ||
83 | + if (cache.containsKey(contextClassLoader)) { | ||
84 | + localCache = cache.get(contextClassLoader); | ||
85 | + | ||
86 | + if (localCache.containsKey(dataSourceName)) { | ||
87 | + factory = localCache.get(dataSourceName); | ||
88 | + | ||
89 | + } else { | ||
90 | + factory = initDataSource(dataSourceName); | ||
91 | + | ||
92 | + localCache.put(dataSourceName, factory); | ||
93 | + cache.put(contextClassLoader, localCache); | ||
94 | + } | ||
95 | + | ||
96 | + } else { | ||
97 | + localCache = new HashMap<String, DataSource>(); | ||
98 | + factory = initDataSource(dataSourceName); | ||
21 | 99 | ||
22 | - @Produces | ||
23 | - public DataSource create() { | ||
24 | - if (this.dataSource == null) { | ||
25 | - this.dataSource = init(); | 100 | + localCache.put(dataSourceName, factory); |
101 | + cache.put(contextClassLoader, localCache); | ||
26 | } | 102 | } |
27 | 103 | ||
28 | - return this.dataSource; | 104 | + return factory; |
29 | } | 105 | } |
30 | 106 | ||
31 | - private DataSource init() { | 107 | + private DataSource initDataSource(String dataSourceName) { |
32 | DataSource result; | 108 | DataSource result; |
33 | 109 | ||
34 | try { | 110 | try { |
35 | JdbcConfig config = Beans.getReference(JdbcConfig.class); | 111 | JdbcConfig config = Beans.getReference(JdbcConfig.class); |
36 | - String jndi = config.getJndiName().get("default"); | 112 | + String jndi = config.getJndiName().get(dataSourceName); |
37 | 113 | ||
38 | // TODO Lançar exceção caso o JNDI esteja vazio ou nulo. | 114 | // TODO Lançar exceção caso o JNDI esteja vazio ou nulo. |
39 | 115 | ||
@@ -43,7 +119,28 @@ public class DataSourceProducer implements Serializable { | @@ -43,7 +119,28 @@ public class DataSourceProducer implements Serializable { | ||
43 | } catch (Exception cause) { | 119 | } catch (Exception cause) { |
44 | // TODO Colocar uma mensagem amigável | 120 | // TODO Colocar uma mensagem amigável |
45 | 121 | ||
46 | - throw new ConfigurationException("", cause); | 122 | + throw new DemoiselleException("", cause); |
123 | + } | ||
124 | + | ||
125 | + return result; | ||
126 | + } | ||
127 | + | ||
128 | + @PreDestroy | ||
129 | + public void close() { | ||
130 | + cache.clear(); | ||
131 | + } | ||
132 | + | ||
133 | + public Map<String, DataSource> getCache() { | ||
134 | + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); | ||
135 | + Map<String, DataSource> result = cache.get(classLoader); | ||
136 | + | ||
137 | + if (result == null || result.isEmpty()) { | ||
138 | + logger.debug(bundle.getString("datasource-not-found-in-cache")); | ||
139 | + | ||
140 | + for (String name : getDataSourceNames(classLoader)) { | ||
141 | + create(name); | ||
142 | + result = cache.get(classLoader); | ||
143 | + } | ||
47 | } | 144 | } |
48 | 145 | ||
49 | return result; | 146 | return result; |
impl/extension/jdbc/src/main/java/br/gov/frameworkdemoiselle/internal/proxy/ConnectionProxy.java
0 → 100644
@@ -0,0 +1,239 @@ | @@ -0,0 +1,239 @@ | ||
1 | +package br.gov.frameworkdemoiselle.internal.proxy; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.sql.Array; | ||
5 | +import java.sql.Blob; | ||
6 | +import java.sql.CallableStatement; | ||
7 | +import java.sql.Clob; | ||
8 | +import java.sql.Connection; | ||
9 | +import java.sql.DatabaseMetaData; | ||
10 | +import java.sql.NClob; | ||
11 | +import java.sql.PreparedStatement; | ||
12 | +import java.sql.SQLClientInfoException; | ||
13 | +import java.sql.SQLException; | ||
14 | +import java.sql.SQLWarning; | ||
15 | +import java.sql.SQLXML; | ||
16 | +import java.sql.Savepoint; | ||
17 | +import java.sql.Statement; | ||
18 | +import java.sql.Struct; | ||
19 | +import java.util.Map; | ||
20 | +import java.util.Properties; | ||
21 | + | ||
22 | +import br.gov.frameworkdemoiselle.internal.producer.ConnectionProducer; | ||
23 | +import br.gov.frameworkdemoiselle.util.Beans; | ||
24 | + | ||
25 | +public class ConnectionProxy implements Connection, Serializable { | ||
26 | + | ||
27 | + private static final long serialVersionUID = 1L; | ||
28 | + | ||
29 | + private final String dataSourceName; | ||
30 | + | ||
31 | + public ConnectionProxy(String dataSourceName) { | ||
32 | + this.dataSourceName = dataSourceName; | ||
33 | + } | ||
34 | + | ||
35 | + private Connection getDelegate() { | ||
36 | + ConnectionProducer emp = Beans.getReference(ConnectionProducer.class); | ||
37 | + return emp.getConnection(this.dataSourceName); | ||
38 | + } | ||
39 | + | ||
40 | + public void clearWarnings() throws SQLException { | ||
41 | + getDelegate().clearWarnings(); | ||
42 | + } | ||
43 | + | ||
44 | + public void close() throws SQLException { | ||
45 | + getDelegate().close(); | ||
46 | + } | ||
47 | + | ||
48 | + public void commit() throws SQLException { | ||
49 | + getDelegate().commit(); | ||
50 | + } | ||
51 | + | ||
52 | + public Array createArrayOf(String typeName, Object[] elements) throws SQLException { | ||
53 | + return getDelegate().createArrayOf(typeName, elements); | ||
54 | + } | ||
55 | + | ||
56 | + public Blob createBlob() throws SQLException { | ||
57 | + return getDelegate().createBlob(); | ||
58 | + } | ||
59 | + | ||
60 | + public Clob createClob() throws SQLException { | ||
61 | + return getDelegate().createClob(); | ||
62 | + } | ||
63 | + | ||
64 | + public NClob createNClob() throws SQLException { | ||
65 | + return getDelegate().createNClob(); | ||
66 | + } | ||
67 | + | ||
68 | + public SQLXML createSQLXML() throws SQLException { | ||
69 | + return getDelegate().createSQLXML(); | ||
70 | + } | ||
71 | + | ||
72 | + public Statement createStatement() throws SQLException { | ||
73 | + return getDelegate().createStatement(); | ||
74 | + } | ||
75 | + | ||
76 | + public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) | ||
77 | + throws SQLException { | ||
78 | + return getDelegate().createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); | ||
79 | + } | ||
80 | + | ||
81 | + public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { | ||
82 | + return getDelegate().createStatement(resultSetType, resultSetConcurrency); | ||
83 | + } | ||
84 | + | ||
85 | + public Struct createStruct(String typeName, Object[] attributes) throws SQLException { | ||
86 | + return getDelegate().createStruct(typeName, attributes); | ||
87 | + } | ||
88 | + | ||
89 | + public boolean getAutoCommit() throws SQLException { | ||
90 | + return getDelegate().getAutoCommit(); | ||
91 | + } | ||
92 | + | ||
93 | + public String getCatalog() throws SQLException { | ||
94 | + return getDelegate().getCatalog(); | ||
95 | + } | ||
96 | + | ||
97 | + public Properties getClientInfo() throws SQLException { | ||
98 | + return getDelegate().getClientInfo(); | ||
99 | + } | ||
100 | + | ||
101 | + public String getClientInfo(String name) throws SQLException { | ||
102 | + return getDelegate().getClientInfo(name); | ||
103 | + } | ||
104 | + | ||
105 | + public int getHoldability() throws SQLException { | ||
106 | + return getDelegate().getHoldability(); | ||
107 | + } | ||
108 | + | ||
109 | + public DatabaseMetaData getMetaData() throws SQLException { | ||
110 | + return getDelegate().getMetaData(); | ||
111 | + } | ||
112 | + | ||
113 | + public int getTransactionIsolation() throws SQLException { | ||
114 | + return getDelegate().getTransactionIsolation(); | ||
115 | + } | ||
116 | + | ||
117 | + public Map<String, Class<?>> getTypeMap() throws SQLException { | ||
118 | + return getDelegate().getTypeMap(); | ||
119 | + } | ||
120 | + | ||
121 | + public SQLWarning getWarnings() throws SQLException { | ||
122 | + return getDelegate().getWarnings(); | ||
123 | + } | ||
124 | + | ||
125 | + public boolean isClosed() throws SQLException { | ||
126 | + return getDelegate().isClosed(); | ||
127 | + } | ||
128 | + | ||
129 | + public boolean isReadOnly() throws SQLException { | ||
130 | + return getDelegate().isReadOnly(); | ||
131 | + } | ||
132 | + | ||
133 | + public boolean isValid(int timeout) throws SQLException { | ||
134 | + return getDelegate().isValid(timeout); | ||
135 | + } | ||
136 | + | ||
137 | + public boolean isWrapperFor(Class<?> iface) throws SQLException { | ||
138 | + return getDelegate().isWrapperFor(iface); | ||
139 | + } | ||
140 | + | ||
141 | + public String nativeSQL(String sql) throws SQLException { | ||
142 | + return getDelegate().nativeSQL(sql); | ||
143 | + } | ||
144 | + | ||
145 | + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, | ||
146 | + int resultSetHoldability) throws SQLException { | ||
147 | + return getDelegate().prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); | ||
148 | + } | ||
149 | + | ||
150 | + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { | ||
151 | + return getDelegate().prepareCall(sql, resultSetType, resultSetConcurrency); | ||
152 | + } | ||
153 | + | ||
154 | + public CallableStatement prepareCall(String sql) throws SQLException { | ||
155 | + return getDelegate().prepareCall(sql); | ||
156 | + } | ||
157 | + | ||
158 | + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, | ||
159 | + int resultSetHoldability) throws SQLException { | ||
160 | + return getDelegate().prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); | ||
161 | + } | ||
162 | + | ||
163 | + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) | ||
164 | + throws SQLException { | ||
165 | + return getDelegate().prepareStatement(sql, resultSetType, resultSetConcurrency); | ||
166 | + } | ||
167 | + | ||
168 | + public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { | ||
169 | + return getDelegate().prepareStatement(sql, autoGeneratedKeys); | ||
170 | + } | ||
171 | + | ||
172 | + public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { | ||
173 | + return getDelegate().prepareStatement(sql, columnIndexes); | ||
174 | + } | ||
175 | + | ||
176 | + public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { | ||
177 | + return getDelegate().prepareStatement(sql, columnNames); | ||
178 | + } | ||
179 | + | ||
180 | + public PreparedStatement prepareStatement(String sql) throws SQLException { | ||
181 | + return getDelegate().prepareStatement(sql); | ||
182 | + } | ||
183 | + | ||
184 | + public void releaseSavepoint(Savepoint savepoint) throws SQLException { | ||
185 | + getDelegate().releaseSavepoint(savepoint); | ||
186 | + } | ||
187 | + | ||
188 | + public void rollback() throws SQLException { | ||
189 | + getDelegate().rollback(); | ||
190 | + } | ||
191 | + | ||
192 | + public void rollback(Savepoint savepoint) throws SQLException { | ||
193 | + getDelegate().rollback(savepoint); | ||
194 | + } | ||
195 | + | ||
196 | + public void setAutoCommit(boolean autoCommit) throws SQLException { | ||
197 | + getDelegate().setAutoCommit(autoCommit); | ||
198 | + } | ||
199 | + | ||
200 | + public void setCatalog(String catalog) throws SQLException { | ||
201 | + getDelegate().setCatalog(catalog); | ||
202 | + } | ||
203 | + | ||
204 | + public void setClientInfo(Properties properties) throws SQLClientInfoException { | ||
205 | + getDelegate().setClientInfo(properties); | ||
206 | + } | ||
207 | + | ||
208 | + public void setClientInfo(String name, String value) throws SQLClientInfoException { | ||
209 | + getDelegate().setClientInfo(name, value); | ||
210 | + } | ||
211 | + | ||
212 | + public void setHoldability(int holdability) throws SQLException { | ||
213 | + getDelegate().setHoldability(holdability); | ||
214 | + } | ||
215 | + | ||
216 | + public void setReadOnly(boolean readOnly) throws SQLException { | ||
217 | + getDelegate().setReadOnly(readOnly); | ||
218 | + } | ||
219 | + | ||
220 | + public Savepoint setSavepoint() throws SQLException { | ||
221 | + return getDelegate().setSavepoint(); | ||
222 | + } | ||
223 | + | ||
224 | + public Savepoint setSavepoint(String name) throws SQLException { | ||
225 | + return getDelegate().setSavepoint(name); | ||
226 | + } | ||
227 | + | ||
228 | + public void setTransactionIsolation(int level) throws SQLException { | ||
229 | + getDelegate().setTransactionIsolation(level); | ||
230 | + } | ||
231 | + | ||
232 | + public void setTypeMap(Map<String, Class<?>> map) throws SQLException { | ||
233 | + getDelegate().setTypeMap(map); | ||
234 | + } | ||
235 | + | ||
236 | + public <T> T unwrap(Class<T> iface) throws SQLException { | ||
237 | + return getDelegate().unwrap(iface); | ||
238 | + } | ||
239 | +} |
impl/extension/jdbc/src/main/resources/demoiselle-jaas-bundle.properties
@@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
1 | -# Demoiselle Framework | ||
2 | -# Copyright (C) 2010 SERPRO | ||
3 | -# ---------------------------------------------------------------------------- | ||
4 | -# This file is part of Demoiselle Framework. | ||
5 | -# | ||
6 | -# Demoiselle Framework is free software; you can redistribute it and/or | ||
7 | -# modify it under the terms of the GNU Lesser General Public License version 3 | ||
8 | -# as published by the Free Software Foundation. | ||
9 | -# | ||
10 | -# This program is distributed in the hope that it will be useful, | ||
11 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | -# GNU General Public License for more details. | ||
14 | -# | ||
15 | -# You should have received a copy of the GNU Lesser General Public License version 3 | ||
16 | -# along with this program; if not, see <http://www.gnu.org/licenses/> | ||
17 | -# or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
18 | -# Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | -# ---------------------------------------------------------------------------- | ||
20 | -# Este arquivo é parte do Framework Demoiselle. | ||
21 | -# | ||
22 | -# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
23 | -# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
24 | -# do Software Livre (FSF). | ||
25 | -# | ||
26 | -# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
27 | -# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
28 | -# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
29 | -# para maiores detalhes. | ||
30 | -# | ||
31 | -# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
32 | -# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | ||
33 | -# ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
34 | -# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. |
impl/extension/jdbc/src/main/resources/demoiselle-jdbc-bundle.properties
0 → 100644
@@ -0,0 +1,42 @@ | @@ -0,0 +1,42 @@ | ||
1 | +# Demoiselle Framework | ||
2 | +# Copyright (C) 2010 SERPRO | ||
3 | +# ---------------------------------------------------------------------------- | ||
4 | +# This file is part of Demoiselle Framework. | ||
5 | +# | ||
6 | +# Demoiselle Framework is free software; you can redistribute it and/or | ||
7 | +# modify it under the terms of the GNU Lesser General Public License version 3 | ||
8 | +# as published by the Free Software Foundation. | ||
9 | +# | ||
10 | +# This program is distributed in the hope that it will be useful, | ||
11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | +# GNU General Public License for more details. | ||
14 | +# | ||
15 | +# You should have received a copy of the GNU Lesser General Public License version 3 | ||
16 | +# along with this program; if not, see <http://www.gnu.org/licenses/> | ||
17 | +# or write to the Free Software Foundation, Inc., 51 Franklin Street, | ||
18 | +# Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | +# ---------------------------------------------------------------------------- | ||
20 | +# Este arquivo é parte do Framework Demoiselle. | ||
21 | +# | ||
22 | +# O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou | ||
23 | +# modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação | ||
24 | +# do Software Livre (FSF). | ||
25 | +# | ||
26 | +# Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA | ||
27 | +# GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou | ||
28 | +# APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português | ||
29 | +# para maiores detalhes. | ||
30 | +# | ||
31 | +# Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título | ||
32 | +# "LICENCA.txt", junto com esse programa. Se não, acesse <http://www.gnu.org/licenses/> | ||
33 | +# ou escreva para a Fundação do Software Livre (FSF) Inc., | ||
34 | +# 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. | ||
35 | + | ||
36 | +more-than-one-datasource-defined=Existe mais de um banco de dados definido. Utilize @{0} no ponto de inje\u00E7\u00E3o ou defina o atributo "frameworkdemoiselle.persistence.default.datasource.name" no arquivo demoiselle.properties. | ||
37 | +getting-default-datasource-name-from-properties=Obtendo a configura\u00E7\u00E3o de banco de dados padr\u00E3o "{0}" a partir do arquivo de configura\u00E7\u00E3o demoiselle.properties. | ||
38 | +datasource-name-found=Configura\u00E7\u00E3o de banco de dados "{0}" encontrada. | ||
39 | +persistence-unit-name-found=Configura\u00E7\u00E3o do banco de dados "{0}" encontrada. | ||
40 | +datasource-not-found-in-cache=DataSource n\u00E3o encontrado para contexto atual, criando um agora. | ||
41 | +connection-was-created=Conex\u00E3o criada a partir da configura\u00E7\u00E3o "{0}". | ||
42 | +datasource-name-not-found=Nenhuma configura\u00E7\u00E3o de banco de dados foi encontrada no "demoiselle.properties" |