This is an automated email from the ASF dual-hosted git repository. dschneider pushed a commit to branch feature/GEODE-5861 in repository https://gitbox.apache.org/repos/asf/geode.git
commit 2a6171975298747e1cf2f7bc056dba6a3291b5a6 Author: Darrel Schneider <[email protected]> AuthorDate: Wed Oct 17 17:20:19 2018 -0700 removed the jndi-binding --type=HIKARI --- .../jdbc/internal/HikariJdbcDataSource.java | 102 --------------------- .../jdbc/internal/HikariJdbcDataSourceFactory.java | 23 ----- .../connectors/jdbc/internal/JdbcDataSource.java | 22 ----- .../jdbc/internal/JdbcDataSourceFactory.java | 27 ------ geode-core/build.gradle | 1 - .../internal/datasource/DataSourceFactory.java | 23 ----- .../internal/datasource/HikariJdbcDataSource.java | 100 -------------------- .../apache/geode/internal/jndi/JNDIInvoker.java | 6 -- .../cli/commands/CreateJndiBindingCommand.java | 3 +- .../geode.apache.org/schema/cache/cache-1.0.xsd | 1 - geode-core/src/test/resources/expected-pom.xml | 6 -- 11 files changed, 1 insertion(+), 313 deletions(-) diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/HikariJdbcDataSource.java b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/HikariJdbcDataSource.java deleted file mode 100644 index 7c91cea..0000000 --- a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/HikariJdbcDataSource.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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. - */ -package org.apache.geode.connectors.jdbc.internal; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.logging.Logger; - -import javax.sql.DataSource; - -import com.zaxxer.hikari.HikariDataSource; - -import org.apache.geode.connectors.jdbc.internal.configuration.ConnectorService; -import org.apache.geode.internal.datasource.ConfiguredDataSourceProperties; - -public class HikariJdbcDataSource implements DataSource, JdbcDataSource { - - private final HikariDataSource delegate; - - HikariJdbcDataSource(ConnectorService.Connection config) { - HikariDataSource ds = new HikariDataSource(); - ds.setJdbcUrl(config.getUrl()); - ds.setUsername(config.getUser()); - ds.setPassword(config.getPassword()); - ds.setDataSourceProperties(config.getConnectionProperties()); - this.delegate = ds; - } - - // TODO: set more config properties - public HikariJdbcDataSource(ConfiguredDataSourceProperties config) { - HikariDataSource ds = new HikariDataSource(); - ds.setJdbcUrl(config.getURL()); - ds.setUsername(config.getUser()); - ds.setPassword(config.getPassword()); - // ds.setDataSourceProperties(config.getConnectionProperties()); - this.delegate = ds; - } - - @Override - public Connection getConnection() throws SQLException { - return this.delegate.getConnection(); - } - - @Override - public Connection getConnection(String username, String password) throws SQLException { - return this.delegate.getConnection(username, password); - } - - @Override - public void close() { - this.delegate.close(); - } - - @Override - public <T> T unwrap(Class<T> iface) throws SQLException { - return this.delegate.unwrap(iface); - } - - @Override - public boolean isWrapperFor(Class<?> iface) throws SQLException { - return this.delegate.isWrapperFor(iface); - } - - @Override - public PrintWriter getLogWriter() throws SQLException { - return this.delegate.getLogWriter(); - } - - @Override - public void setLogWriter(PrintWriter out) throws SQLException { - this.delegate.setLogWriter(out); - } - - @Override - public void setLoginTimeout(int seconds) throws SQLException { - this.delegate.setLoginTimeout(seconds); - } - - @Override - public int getLoginTimeout() throws SQLException { - return this.delegate.getLoginTimeout(); - } - - @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - return this.delegate.getParentLogger(); - } -} diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/HikariJdbcDataSourceFactory.java b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/HikariJdbcDataSourceFactory.java deleted file mode 100644 index ad9a287..0000000 --- a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/HikariJdbcDataSourceFactory.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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. - */ -package org.apache.geode.connectors.jdbc.internal; - -import org.apache.geode.connectors.jdbc.internal.configuration.ConnectorService; - -class HikariJdbcDataSourceFactory implements JdbcDataSourceFactory { - public JdbcDataSource create(ConnectorService.Connection configuration) { - return new HikariJdbcDataSource(configuration); - } -} diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/JdbcDataSource.java b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/JdbcDataSource.java deleted file mode 100644 index 1e7f753..0000000 --- a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/JdbcDataSource.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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. - */ -package org.apache.geode.connectors.jdbc.internal; - -import java.sql.Connection; -import java.sql.SQLException; - -public interface JdbcDataSource extends AutoCloseable { - Connection getConnection() throws SQLException; -} diff --git a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/JdbcDataSourceFactory.java b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/JdbcDataSourceFactory.java deleted file mode 100644 index 1588cc8..0000000 --- a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/internal/JdbcDataSourceFactory.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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. - */ -package org.apache.geode.connectors.jdbc.internal; - -import org.apache.geode.connectors.jdbc.internal.configuration.ConnectorService; - -/** - * Given a ConnnectionConfiguration create a JdbcDataSource. - */ -interface JdbcDataSourceFactory { - /** - * Given a ConnnectionConfiguration create and return a JdbcDataSource - */ - JdbcDataSource create(ConnectorService.Connection configuration); -} diff --git a/geode-core/build.gradle b/geode-core/build.gradle index ac3d9c2..3975797 100755 --- a/geode-core/build.gradle +++ b/geode-core/build.gradle @@ -45,7 +45,6 @@ dependencies { antlr 'antlr:antlr:' + project.'antlr.version' // External - compile group: 'com.zaxxer', name: 'HikariCP', version: project.'HikariCP.version' compileOnly files("${System.getProperty('java.home')}/../lib/tools.jar") compile 'com.github.stephenc.findbugs:findbugs-annotations:' + project.'stephenc-findbugs.version' compile 'org.jgroups:jgroups:' + project.'jgroups.version' diff --git a/geode-core/src/main/java/org/apache/geode/internal/datasource/DataSourceFactory.java b/geode-core/src/main/java/org/apache/geode/internal/datasource/DataSourceFactory.java index f49717a..30d1b07 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/datasource/DataSourceFactory.java +++ b/geode-core/src/main/java/org/apache/geode/internal/datasource/DataSourceFactory.java @@ -53,29 +53,6 @@ public class DataSourceFactory { /** Creates a new instance of DataSourceFactory */ public DataSourceFactory() {} - public static DataSource getHikariDataSource(Map configMap, List<ConfigProperty> props) - throws DataSourceCreateException { - ConfiguredDataSourceProperties configs = createDataSourceProperties(configMap); - if (configs.getURL() == null) { - logger.error("DataSourceFactory::getHikariDataSource:URL String to Database is null"); - throw new DataSourceCreateException( - "DataSourceFactory::getHikariDataSource:URL String to Database is null"); - } - try { - return new HikariJdbcDataSource(configs, props); - } catch (Exception ex) { - logger.error(String.format( - "DataSourceFactory::getHikariDataSource:Exception while creating GemfireBasicDataSource.Exception String=%s", - ex.getLocalizedMessage()), - ex); - throw new DataSourceCreateException( - String.format( - "DataSourceFactory::getHikariDataSource:Exception while creating GemfireBasicDataSource.Exception String=%s", - ex.getLocalizedMessage()), - ex); - } - } - /** * This function returns the Basic datasource without any pooling. * diff --git a/geode-core/src/main/java/org/apache/geode/internal/datasource/HikariJdbcDataSource.java b/geode-core/src/main/java/org/apache/geode/internal/datasource/HikariJdbcDataSource.java deleted file mode 100644 index b5e6f37..0000000 --- a/geode-core/src/main/java/org/apache/geode/internal/datasource/HikariJdbcDataSource.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more contributor license - * agreements. See the NOTICE file distributed with this work for additional information regarding - * copyright ownership. The ASF licenses this file to You 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. - */ -package org.apache.geode.internal.datasource; - -import java.io.PrintWriter; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.SQLFeatureNotSupportedException; -import java.util.List; -import java.util.Properties; -import java.util.logging.Logger; - -import javax.sql.DataSource; - -import com.zaxxer.hikari.HikariDataSource; - -class HikariJdbcDataSource implements DataSource, AutoCloseable { - - private final HikariDataSource delegate; - - // TODO: set more config properties - HikariJdbcDataSource(ConfiguredDataSourceProperties config, List<ConfigProperty> props) { - HikariDataSource ds = new HikariDataSource(); - ds.setJdbcUrl(config.getURL()); - ds.setUsername(config.getUser()); - ds.setPassword(config.getPassword()); - ds.setDataSourceProperties(createProperties(props)); - this.delegate = ds; - } - - private Properties createProperties(List<ConfigProperty> props) { - Properties result = new Properties(); - for (ConfigProperty prop : props) { - result.setProperty(prop.getName(), prop.getValue()); - } - return result; - } - - @Override - public Connection getConnection() throws SQLException { - return this.delegate.getConnection(); - } - - @Override - public Connection getConnection(String username, String password) throws SQLException { - return this.delegate.getConnection(username, password); - } - - @Override - public void close() { - this.delegate.close(); - } - - @Override - public <T> T unwrap(Class<T> iface) throws SQLException { - return this.delegate.unwrap(iface); - } - - @Override - public boolean isWrapperFor(Class<?> iface) throws SQLException { - return this.delegate.isWrapperFor(iface); - } - - @Override - public PrintWriter getLogWriter() throws SQLException { - return this.delegate.getLogWriter(); - } - - @Override - public void setLogWriter(PrintWriter out) throws SQLException { - this.delegate.setLogWriter(out); - } - - @Override - public void setLoginTimeout(int seconds) throws SQLException { - this.delegate.setLoginTimeout(seconds); - } - - @Override - public int getLoginTimeout() throws SQLException { - return this.delegate.getLoginTimeout(); - } - - @Override - public Logger getParentLogger() throws SQLFeatureNotSupportedException { - return this.delegate.getParentLogger(); - } -} diff --git a/geode-core/src/main/java/org/apache/geode/internal/jndi/JNDIInvoker.java b/geode-core/src/main/java/org/apache/geode/internal/jndi/JNDIInvoker.java index d44f3af..8cd4074 100644 --- a/geode-core/src/main/java/org/apache/geode/internal/jndi/JNDIInvoker.java +++ b/geode-core/src/main/java/org/apache/geode/internal/jndi/JNDIInvoker.java @@ -357,12 +357,6 @@ public class JNDIInvoker { dataSourceMap.put(jndiName, ds); if (writer.fineEnabled()) writer.fine("Bound java:/" + jndiName + " to Context"); - } else if (value.equals("HikariDataSource")) { - ds = DataSourceFactory.getHikariDataSource(map, props); - ctx.rebind("java:/" + jndiName, ds); - dataSourceMap.put(jndiName, ds); - if (writer.fineEnabled()) - writer.fine("Bound java:/" + jndiName + " to Context"); } else if (value.equals("ManagedDataSource")) { ClientConnectionFactoryWrapper ds1 = DataSourceFactory.getManagedDataSource(map, props); ctx.rebind("java:/" + jndiName, ds1.getClientConnFactory()); diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommand.java index 91b1045..5d6ad65 100644 --- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommand.java +++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateJndiBindingCommand.java @@ -182,8 +182,7 @@ public class CreateJndiBindingCommand extends SingleGfshCommand { MANAGED("ManagedDataSource"), SIMPLE("SimpleDataSource"), POOLED("PooledDataSource"), - XAPOOLED("XAPooledDataSource"), - HIKARI("HikariDataSource"); + XAPOOLED("XAPooledDataSource"); private final String type; diff --git a/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd b/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd index 37e2fd7..1e0879f 100755 --- a/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd +++ b/geode-core/src/main/resources/META-INF/schemas/geode.apache.org/schema/cache/cache-1.0.xsd @@ -1437,7 +1437,6 @@ As of 6.5 disk-dirs is deprecated on region-attributes. Use disk-store-name inst <xsd:enumeration value="SimpleDataSource" /> <xsd:enumeration value="PooledDataSource" /> <xsd:enumeration value="XAPooledDataSource" /> - <xsd:enumeration value="HikariDataSource" /> </xsd:restriction> </xsd:simpleType> </xsd:attribute> diff --git a/geode-core/src/test/resources/expected-pom.xml b/geode-core/src/test/resources/expected-pom.xml index 1428d4a..0ff3525 100644 --- a/geode-core/src/test/resources/expected-pom.xml +++ b/geode-core/src/test/resources/expected-pom.xml @@ -36,12 +36,6 @@ </scm> <dependencies> <dependency> - <groupId>com.zaxxer</groupId> - <artifactId>HikariCP</artifactId> - <version>3.2.0</version> - <scope>compile</scope> - </dependency> - <dependency> <groupId>com.github.stephenc.findbugs</groupId> <artifactId>findbugs-annotations</artifactId> <version>1.3.9-1</version>
