diff --git a/README.md b/README.md
new file mode 100644
index 000000000..567ec01c4
--- /dev/null
+++ b/README.md
@@ -0,0 +1,44 @@
+# Teradata Connector- Mule 4
+
+Anypoint Connector for Teradata (Teradata Connector) establishes communication between your Mule app and a Teradata Vantage database, enabling you to connect with your Teradata Vantage instance to load data and run SQL queries in Teradata Vantage tables.
+
+# Before You Begin
+
+To use this connector, you must be familiar with:
+
+- Teradata Vantage SQL
+
+- Anypoint Connectors
+
+- Mule runtime engine (Mule)
+
+- Elements and global elements in a Mule flow
+
+- Anypoint Studio (Studio)
+
+Before creating an app, you must have:
+
+- Credentials to access the Teradata Vantage target resource
+
+- Anypoint Studio version 7.5 or later
+
+
+# Common Use Cases for the Connector
+
+Teradata Connector enables you to:
+
+- Perform predefined queries, dynamically constructed queries, and template queries that are self-sufficient and customizable.
+
+- Use a source listener operation to read from a database in the data source section of a flow.
+
+- Execute other operations to read and write to a database anywhere in the process section.
+
+- Run a single bulk update to perform multiple SQL requests.
+
+- Make Data Definition Language (DDL) requests.
+
+- Execute stored procedures and SQL scripts.
+
+# Next Step
+
+After you complete the prerequisites, you are ready to create an app and configure the connector using Anypoint Studio.
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 5509f0383..25e98f309 100644
--- a/pom.xml
+++ b/pom.xml
@@ -14,7 +14,7 @@
com.teradata.mulesoftteradata-connectormule-extension
- 0.0.4
+ 0.0.5Teradata ConnectorAn extension that provides functionality for connecting any Mule project to Teradata Vantage
@@ -35,10 +35,6 @@
1.0.42.9.3
- 10.14.2.0
- 8.0.29
- 7.0.0.jre8
- 21.6.0.0.10.40.11.5.3
@@ -50,7 +46,6 @@
2.3.111.1.2
- falsefalse${java.io.tmpdir}/effective-settings.xml
@@ -167,30 +162,6 @@
-
- org.apache.derby
- derby
- ${derbyVersion}
- test
-
-
- mysql
- mysql-connector-java
- ${mySqlVersion}
- provided
-
-
- com.microsoft.sqlserver
- mssql-jdbc
- ${mssqlVersion}
- test
-
-
- com.oracle.database.jdbc
- ojdbc8
- ${oracle.driver.version}
- provided
- com.teradataterajdbc4
@@ -233,15 +204,7 @@
org.apache.maven.pluginsmaven-surefire-plugin
- ${skipTests}-Dmaven.settings.local=${settingsFile}
-
- ${oracle.db.port}
- ${oracle.db.mtls.port}
- ${oracle.db.mtls.port2}
- ${mysql.db.port}
- ${mssql.db.port}
-
@@ -273,571 +236,6 @@
-
-
-
-
- oracle
- true
-
-
- oracle
-
-
-
- io.fabric8
- docker-maven-plugin
- ${docker.maven.plugin.version}
-
-
-
- oracle-db-mtls
- oracle-db-mtls
-
- ${project.basedir}/src/test/resources/docker/oracle-mtls
-
-
-
-
- /client/oracle/store/
- ${project.basedir}/target/docker/oracle-db-mtls/
-
-
-
-
- %n-%i-%t
-
- oracle
-
-
- oracle.db.port:1521
- oracle.db.mtls.port:1522
- oracle.db.mtls.port2:5500
-
-
- true
-
-
-
-
-
-
-
- true
-
-
-
- org.slf4j
- slf4j-api
- 1.7.36
-
-
- org.slf4j
- jcl-over-slf4j
- 1.7.36
-
-
-
-
- start
- generate-test-resources
-
- build
- start
-
-
- true
- true
-
-
-
- copy
- test-compile
-
- copy
-
-
-
- stop
- post-integration-test
-
- stop
- remove
-
-
-
-
-
- com.mulesoft.munit
- munit-extensions-maven-plugin
- ${munit.extensions.maven.plugin.version}
-
- false
-
- ${oracle.db.port}
- ${oracle.db.mtls.port}
- ${oracle.db.mtls.port2}
-
- oracle/.*oracle-test-case.xml
-
-
- EE
- 4.1.1
- false
-
-
-
-
- com.oracle.database.jdbc
- ojdbc8
-
-
-
-
- -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${session.executionRootDirectory}/target/jacoco.exec
-
-
-
-
-
- integration-test
-
- test
-
-
-
-
-
-
- com.mulesoft.munit
- munit-runner
- ${munit.version}
- mule-plugin
-
-
- com.mulesoft.munit
- munit-tools
- ${munit.version}
- mule-plugin
-
-
- com.mulesoft.munit
- mtf-tools
- ${mtf-tools.version}
- mule-plugin
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- ${skipTests}
- -Dmaven.settings.local=${settingsFile}
-
- ${oracle.db.port}
- ${oracle.db.mtls.port}
- ${oracle.db.mtls.port2}
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 3.3.0
-
- false
- true
- true
- ${project.build.directory}/it
-
- */pom.xml
-
-
- ${settingsFile}
- ${oracle.db.port}
- ${oracle}
-
-
- clean
- generate-sources
- test
-
-
-
-
- tita-tests
- integration-test
-
- run
-
- false
-
-
-
-
-
-
-
-
-
-
- mysql
- true
-
-
- mysql
-
-
-
- io.fabric8
- docker-maven-plugin
- ${docker.maven.plugin.version}
-
-
-
- mysql:latest
- mysql-container
-
- %n-%i-%t
-
- password
- xe
-
-
- mysql.db.port:3306
-
-
-
- nofile
- 10240
- 10240
-
-
-
- true
-
-
- mysqld: ready for connections.
-
-
-
-
-
- true
-
-
-
- org.slf4j
- slf4j-api
- 1.7.36
-
-
- org.slf4j
- jcl-over-slf4j
- 1.7.36
-
-
-
-
- start
- test-compile
-
- build
- start
-
-
- true
- true
-
-
-
- stop
- post-integration-test
-
- stop
-
-
-
-
-
- com.mulesoft.munit
- munit-extensions-maven-plugin
- ${munit.extensions.maven.plugin.version}
-
- false
-
- ${mysql.db.port}
- ${mssql.db.port}
-
- mysql/.*-test-case.xml
-
-
- EE
- 4.1.1
- false
-
-
-
-
- mysql
- mysql-connector-java
-
-
-
-
- -javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco.version}/org.jacoco.agent-${jacoco.version}-runtime.jar=destfile=${session.executionRootDirectory}/target/jacoco.exec
-
-
-
-
-
- integration-test
-
- test
-
-
-
-
-
-
- com.mulesoft.munit
- munit-runner
- ${munit.version}
- mule-plugin
-
-
- com.mulesoft.munit
- munit-tools
- ${munit.version}
- mule-plugin
-
-
- com.mulesoft.munit
- mtf-tools
- ${mtf-tools.version}
- mule-plugin
-
-
-
-
- org.apache.maven.plugins
- maven-invoker-plugin
- 3.3.0
-
- false
- true
- true
- ${project.build.directory}/it
- ${skipTita}
-
- */pom.xml
-
-
- ${settingsFile}
- ${mysql.db.port}
- ${mysql}
-
-
- clean
- generate-sources
- test
-
-
-
-
- tita-tests
- integration-test
-
- run
-
- false
-
-
-
-
-
-
-
-
-
-
- mysql-old-version
- true
-
-
- mysql-old-version
-
-
-
- io.fabric8
- docker-maven-plugin
- ${docker.maven.plugin.version}
-
-
-
- mysql:latest
- mysql-old-version-container
-
- %n-%i-%t
-
- password
- xe
-
-
- mysql.db.port:3306
-
-
-
- nofile
- 10240
- 10240
-
-
-
- true
-
-
- mysqld: ready for connections.
-
-
-
-
-
- true
-
-
-
- org.slf4j
- slf4j-api
- 1.7.36
-
-
- org.slf4j
- jcl-over-slf4j
- 1.7.36
-
-
-
-
- start
- test-compile
-
- build
- start
-
-
- true
- true
-
-
-
- stop
- post-integration-test
-
- stop
-
-
-
-
-
-
-
-
- mysql
- mysql-connector-java
- 5.1.49
- test
-
-
-
-
-
-
-
- mssql
- true
-
-
- mssql
-
-
-
- io.fabric8
- docker-maven-plugin
- ${docker.maven.plugin.version}
-
-
-
- mcr.microsoft.com/mssql/server:2019-latest
- mssql-container
-
- %n-%i-%t
-
- yourStrong(!)Password
- Y
-
-
- mssql.db.port:1433
-
-
-
- nofile
- 10240
- 10240
-
-
-
- true
-
-
- Service Broker manager has started.
-
-
-
-
-
- true
-
-
-
- org.slf4j
- slf4j-api
- 1.7.36
-
-
- org.slf4j
- jcl-over-slf4j
- 1.7.36
-
-
-
-
- start
- test-compile
-
- build
- start
-
-
- true
- true
-
-
-
- stop
- post-integration-test
-
- stop
-
-
-
-
-
-
-
-
-
http://www.mulesoft.org/display/MULE/Download
diff --git a/src/it/tita/src/test/resources/insert-oracle-sys-xmltype-app.xml b/src/it/tita/src/test/resources/insert-oracle-sys-xmltype-app.xml
index e8d624095..e8f098bb7 100644
--- a/src/it/tita/src/test/resources/insert-oracle-sys-xmltype-app.xml
+++ b/src/it/tita/src/test/resources/insert-oracle-sys-xmltype-app.xml
@@ -1,11 +1,11 @@
@@ -17,37 +17,37 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
+
+
INSERT INTO XMLTEST (ID, PUBDATA) VALUES (1, :description)
-
-
+
+
#[
{'description' : vars.xmlVar}
]
-
-
+
+
\ No newline at end of file
diff --git a/src/it/tita/src/test/resources/stored-procedure-mysql-timeout-app.xml b/src/it/tita/src/test/resources/stored-procedure-mysql-timeout-app.xml
index 27f3245eb..5fdb9c7bc 100644
--- a/src/it/tita/src/test/resources/stored-procedure-mysql-timeout-app.xml
+++ b/src/it/tita/src/test/resources/stored-procedure-mysql-timeout-app.xml
@@ -1,11 +1,11 @@
@@ -17,21 +17,21 @@
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
+
+
+
@@ -40,22 +40,22 @@
-
-
+
-
-
+
+
-
-
-
+
+
-
-
+
+
@@ -65,8 +65,8 @@
-
-
+
-
-
+
+
@@ -85,13 +85,13 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/src/it/tita/src/test/resources/stored-procedure-oracle-lob-foreach-app.xml b/src/it/tita/src/test/resources/stored-procedure-oracle-lob-foreach-app.xml
index a47f9a734..2e131f6ab 100644
--- a/src/it/tita/src/test/resources/stored-procedure-oracle-lob-foreach-app.xml
+++ b/src/it/tita/src/test/resources/stored-procedure-oracle-lob-foreach-app.xml
@@ -1,11 +1,11 @@
@@ -17,19 +17,19 @@
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
@@ -38,15 +38,15 @@
-
-
-
+
+
+
-
-
-
+
+
+
@@ -56,17 +56,17 @@
-
-
-
+
+
+
-
-
+
-
-
-
+
+
+
-
-
-
+
+
-
-
+
+
diff --git a/src/main/java/org/mule/extension/db/internal/DbConnector.java b/src/main/java/org/mule/extension/db/internal/DbConnector.java
index 47478b035..c8930725a 100644
--- a/src/main/java/org/mule/extension/db/internal/DbConnector.java
+++ b/src/main/java/org/mule/extension/db/internal/DbConnector.java
@@ -15,12 +15,6 @@
import org.mule.extension.db.api.param.BulkQueryDefinition;
import org.mule.extension.db.api.param.QueryDefinition;
import org.mule.extension.db.api.param.StoredProcedureCall;
-import org.mule.extension.db.internal.domain.connection.datasource.DbDataSourceReferenceConnectionProvider;
-import org.mule.extension.db.internal.domain.connection.derby.DerbyConnectionProvider;
-import org.mule.extension.db.internal.domain.connection.generic.DbGenericConnectionProvider;
-import org.mule.extension.db.internal.domain.connection.mysql.MySqlConnectionProvider;
-import org.mule.extension.db.internal.domain.connection.oracle.OracleDbConnectionProvider;
-import org.mule.extension.db.internal.domain.connection.sqlserver.SqlServerConnectionProvider;
import org.mule.extension.db.internal.domain.connection.teradata.TeradataConnectionProvider;
import org.mule.extension.db.internal.operation.DbBulkOperations;
import org.mule.extension.db.internal.operation.DbDdlOperations;
@@ -44,8 +38,8 @@
@Extension(name = "Teradata")
@Operations({DbBulkOperations.class, DbDdlOperations.class, DbDmlOperations.class})
@Sources(RowListener.class)
-@ConnectionProviders({DbGenericConnectionProvider.class, TeradataConnectionProvider.class})
-@Xml(prefix = "db")
+@ConnectionProviders({TeradataConnectionProvider.class})
+@Xml(prefix = "teradata")
@ErrorTypes(DbError.class)
@ExpressionFunctions(DbFunctions.class)
@OnException(DbExceptionHandler.class)
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/ConnectionUtils.java b/src/main/java/org/mule/extension/db/internal/domain/connection/ConnectionUtils.java
index be63b95d8..edc1f7d25 100644
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/ConnectionUtils.java
+++ b/src/main/java/org/mule/extension/db/internal/domain/connection/ConnectionUtils.java
@@ -11,18 +11,5 @@
public class ConnectionUtils {
- /** Oracle.
- */
- public static final String ORACLE = "Oracle";
-
- /** Tells whether a connection is an Oracle connection.
- *
- * @param connection the connection to check
- * @return true if it's an Oracle connection
- */
- public static boolean isOracle(Connection connection) throws SQLException {
- return connection.getMetaData().getDatabaseProductName().equals(ORACLE);
- }
-
private ConnectionUtils() {}
}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/datasource/DbDataSourceConnectionSettings.java b/src/main/java/org/mule/extension/db/internal/domain/connection/datasource/DbDataSourceConnectionSettings.java
deleted file mode 100644
index 0954e824a..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/datasource/DbDataSourceConnectionSettings.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.datasource;
-
-import static org.mule.runtime.api.meta.ExpressionSupport.NOT_SUPPORTED;
-
-import org.mule.runtime.extension.api.annotation.Expression;
-import org.mule.runtime.extension.api.annotation.param.Parameter;
-
-import javax.sql.DataSource;
-import javax.sql.XADataSource;
-
-/**
- * Groups DataSource related parameters
- *
- * @since 1.0
- * @deprecated since 1.10.1. Replace with equivalent on mule-db-client. To be removed in the next major (2.0).
- */
-@Deprecated
-public final class DbDataSourceConnectionSettings
- implements org.mule.db.commons.internal.domain.connection.datasource.DataSourceConnectionSettings {
-
- /**
- * Reference to a JDBC {@link DataSource} object. This object is typically created using Spring.
- * When using XA transactions, an {@link XADataSource} object must be provided.
- */
- @Parameter
- @Expression(NOT_SUPPORTED)
- private DataSource dataSourceRef;
-
- public DataSource getDataSourceRef() {
- return dataSourceRef;
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/datasource/DbDataSourceReferenceConnectionProvider.java b/src/main/java/org/mule/extension/db/internal/domain/connection/datasource/DbDataSourceReferenceConnectionProvider.java
deleted file mode 100644
index f7ba7c26c..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/datasource/DbDataSourceReferenceConnectionProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.datasource;
-
-import static org.mule.extension.db.internal.domain.connection.ConnectionUtils.isOracle;
-import static org.mule.runtime.api.meta.ExternalLibraryType.JAR;
-import static org.mule.db.commons.internal.domain.connection.DbConnectionProvider.DRIVER_FILE_NAME_PATTERN;
-
-import javax.sql.DataSource;
-
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.connection.datasource.DataSourceReferenceConnectionProvider;
-import org.mule.db.commons.internal.domain.type.ResolvedDbType;
-import org.mule.extension.db.internal.domain.connection.oracle.OracleDbConnection;
-import org.mule.runtime.api.connection.ConnectionProvider;
-import org.mule.runtime.extension.api.annotation.Alias;
-import org.mule.runtime.extension.api.annotation.ExternalLib;
-import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
-
-import java.sql.Connection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * {@link ConnectionProvider} implementation which creates DB connections from a referenced {@link
- * DataSource}
- *
- * @since 1.0
- */
-@DisplayName("Data Source Reference Connection")
-@Alias("data-source")
-@ExternalLib(name = "JDBC Driver", description = "A JDBC driver which supports connecting to the Database",
- nameRegexpMatcher = DRIVER_FILE_NAME_PATTERN, type = JAR, optional = true)
-public class DbDataSourceReferenceConnectionProvider extends DataSourceReferenceConnectionProvider {
-
- private final Map> resolvedDbTypesCache = new ConcurrentHashMap<>();
-
- @Override
- protected DbConnection createDbConnection(Connection connection) throws Exception {
- if (isOracle(connection)) {
- return new OracleDbConnection(connection, super.resolveCustomTypes(), resolvedDbTypesCache);
- } else {
- return super.createDbConnection(connection);
- }
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnection.java b/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnection.java
deleted file mode 100644
index c7a65dfcb..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnection.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.derby;
-
-import org.mule.db.commons.internal.domain.connection.DefaultDbConnection;
-import org.mule.db.commons.internal.domain.type.DbType;
-
-import java.sql.Connection;
-import java.util.List;
-
-/**
- * {@link DefaultDbConnection} implementation for Derby databases
- *
- * @since 1.3.4
- */
-public class DerbyConnection extends DefaultDbConnection {
-
- DerbyConnection(Connection connection, List dbTypes) {
- super(connection, dbTypes);
- }
-
- // We are disabling content streaming for Derby because of a incompatibility between the connector logic and the
- // driver. When the connector is iterating a ResultSet and hits the end of this one, the Derby driver automatically
- // closes all the created streams.
- @Override
- public boolean supportsContentStreaming() {
- return false;
- }
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnectionParameters.java b/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnectionParameters.java
deleted file mode 100644
index 459e1f059..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnectionParameters.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.derby;
-
-import static org.mule.runtime.extension.api.annotation.param.display.Placement.ADVANCED_TAB;
-import org.mule.extension.db.internal.domain.connection.BaseDbConnectionParameters;
-
-import org.mule.runtime.extension.api.annotation.param.Optional;
-import org.mule.runtime.extension.api.annotation.param.Parameter;
-import org.mule.runtime.extension.api.annotation.param.display.Placement;
-import org.mule.runtime.extension.api.annotation.values.OfValues;
-import org.mule.extension.db.internal.domain.connection.DataSourceConfig;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * {@link DataSourceConfig} implementation for Derby databases.
- *
- * @since 1.0
- */
-public final class DerbyConnectionParameters extends BaseDbConnectionParameters implements DataSourceConfig {
-
- private static final String JDBC_URL_PREFIX = "jdbc:derby";
- static final String DERBY_DRIVER_CLASS = "org.apache.derby.jdbc.EmbeddedDriver";
-
- /**
- * Name of the database
- */
- @Parameter
- @Optional
- @Placement(order = 1)
- private String database;
-
- /**
- * Specifies where Derby should look for the database. The available options are:
- * 'directory', 'memory', 'classpath' and 'jar'.
- */
- @Parameter
- @Optional(defaultValue = "directory")
- @Placement(order = 2)
- @OfValues(DerbySubsubProtocolValueProvider.class)
- private String subsubProtocol;
-
- /**
- * Indicates if the database should be created if it does not exist.
- */
- @Parameter
- @Optional(defaultValue = "false")
- @Placement(order = 3)
- private boolean create;
-
- /**
- * Specifies a list of custom key-value connectionProperties for the config.
- */
- @Parameter
- @Optional
- @Placement(tab = ADVANCED_TAB)
- private Map connectionProperties = new HashMap<>();
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getUrl() {
- StringBuilder buf = new StringBuilder();
- buf.append(JDBC_URL_PREFIX);
-
- if (subsubProtocol != null) {
- buf.append(":");
- buf.append(subsubProtocol);
- }
- if (database != null) {
- buf.append(":");
- buf.append(database);
- }
-
- if (create) {
- buf.append(";create=true");
- }
-
- if (connectionProperties != null) {
- connectionProperties.entrySet().forEach(entry -> {
- buf.append(";");
- buf.append(entry.getKey());
- buf.append("=");
- buf.append(entry.getValue());
- });
- }
-
- return buf.toString();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getDriverClassName() {
- return DERBY_DRIVER_CLASS;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getPassword() {
- return null;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getUser() {
- return null;
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnectionProvider.java b/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnectionProvider.java
deleted file mode 100644
index d3d99caa9..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbyConnectionProvider.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.derby;
-
-
-import static java.util.Optional.empty;
-import static java.util.Optional.ofNullable;
-
-import static org.mule.extension.db.internal.util.MigrationUtils.mapDataSourceConfig;
-import static org.mule.db.commons.api.exception.connection.DbError.CANNOT_REACH;
-import static org.mule.db.commons.internal.domain.connection.DbConnectionProvider.DRIVER_FILE_NAME_PATTERN;
-import static org.mule.extension.db.internal.domain.connection.derby.DerbyConnectionParameters.DERBY_DRIVER_CLASS;
-import static org.mule.extension.db.internal.domain.connection.derby.DerbyConnectionProvider.DERBY_GAV;
-import static org.mule.runtime.api.meta.ExternalLibraryType.JAR;
-import static org.mule.runtime.extension.api.annotation.param.ParameterGroup.CONNECTION;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Arrays;
-
-import org.mule.db.commons.api.exception.connection.DbError;
-import org.mule.db.commons.internal.domain.connection.DataSourceConfig;
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.connection.DbConnectionProvider;
-import org.mule.runtime.extension.api.annotation.Alias;
-import org.mule.runtime.extension.api.annotation.ExternalLib;
-import org.mule.runtime.extension.api.annotation.param.ParameterGroup;
-import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
-
-/**
- * Creates connections to a Derby database
- *
- * @since 1.0
- */
-@DisplayName("Derby Connection")
-@Alias("derby")
-@ExternalLib(name = "Derby JDBC Driver", description = "A JDBC driver which supports connecting to a Derby Database",
- nameRegexpMatcher = DRIVER_FILE_NAME_PATTERN, requiredClassName = DERBY_DRIVER_CLASS, type = JAR, coordinates = DERBY_GAV)
-public class DerbyConnectionProvider extends DbConnectionProvider {
-
- private static final String FAILED_TO_START_DATABASE = "Failed to start database";
- private static final String NOT_FOUND = "not found";
- static final String DERBY_GAV = "org.apache.derby:derby:10.13.1.1";
-
-
- @ParameterGroup(name = CONNECTION)
- private DerbyConnectionParameters derbyParameters;
-
-
- @Override
- public java.util.Optional getDataSource() {
- return empty();
- }
-
- @Override
- public java.util.Optional getDataSourceConfig() {
- return ofNullable(mapDataSourceConfig(derbyParameters));
- }
-
- @Override
- protected DbConnection createDbConnection(Connection connection) throws Exception {
- return new DerbyConnection(connection, resolveCustomTypes());
- }
-
- @Override
- public java.util.Optional getDbVendorErrorType(SQLException e) {
- if (Arrays.stream(new String[] {FAILED_TO_START_DATABASE, NOT_FOUND}).anyMatch(e.getMessage()::contains)) {
- return java.util.Optional.of(CANNOT_REACH);
- }
-
- return empty();
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbySubsubProtocolValueProvider.java b/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbySubsubProtocolValueProvider.java
deleted file mode 100644
index 850a5fea7..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/derby/DerbySubsubProtocolValueProvider.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.derby;
-
-import static org.mule.runtime.extension.api.values.ValueBuilder.getValuesFor;
-
-import org.mule.runtime.api.value.Value;
-import org.mule.runtime.extension.api.values.ValueProvider;
-import org.mule.runtime.extension.api.values.ValueResolvingException;
-
-import java.util.Set;
-
-/**
- * A static {@link ValueProvider} implementation for Derby Connection provider which hints the available
- * Subsub Protocols.
- *
- * @since 1.1.0
- */
-public class DerbySubsubProtocolValueProvider implements ValueProvider {
-
- private static final Set subsubProtocols = getValuesFor("directory", "memory", "classpath", "jar");
-
- @Override
- public Set resolve() throws ValueResolvingException {
- return subsubProtocols;
- }
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/generic/DbGenericConnectionProvider.java b/src/main/java/org/mule/extension/db/internal/domain/connection/generic/DbGenericConnectionProvider.java
deleted file mode 100644
index 58ab7d79d..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/generic/DbGenericConnectionProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.generic;
-
-import static org.mule.extension.db.internal.domain.connection.ConnectionUtils.isOracle;
-import static org.mule.runtime.api.meta.ExternalLibraryType.JAR;
-import static org.mule.db.commons.internal.domain.connection.DbConnectionProvider.DRIVER_FILE_NAME_PATTERN;
-
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.connection.generic.GenericConnectionProvider;
-import org.mule.db.commons.internal.domain.type.ResolvedDbType;
-import org.mule.extension.db.internal.domain.connection.oracle.OracleDbConnection;
-import org.mule.runtime.extension.api.annotation.Alias;
-import org.mule.runtime.extension.api.annotation.ExternalLib;
-
-import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
-import org.mule.runtime.api.connection.ConnectionProvider;
-
-import java.sql.Connection;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-/**
- * {@link ConnectionProvider} that creates connections for any kind of database using a JDBC URL
- * and the required JDBC Driver Class
- */
-@DisplayName("Generic Connection")
-@Alias("generic")
-@ExternalLib(name = "JDBC Driver", description = "A JDBC driver which supports connecting to the Database",
- nameRegexpMatcher = DRIVER_FILE_NAME_PATTERN, type = JAR)
-public class DbGenericConnectionProvider extends GenericConnectionProvider {
-
- private final Map> resolvedDbTypesCache = new ConcurrentHashMap<>();
-
- @Override
- protected DbConnection createDbConnection(Connection connection) throws Exception {
- if (isOracle(connection)) {
- return new OracleDbConnection(connection, resolveCustomTypes(), resolvedDbTypesCache);
- } else {
- return super.createDbConnection(connection);
- }
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/generic/GenericConnectionParameters.java b/src/main/java/org/mule/extension/db/internal/domain/connection/generic/GenericConnectionParameters.java
deleted file mode 100644
index 6aca20d88..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/generic/GenericConnectionParameters.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.generic;
-
-import org.mule.extension.db.internal.domain.connection.DataSourceConfig;
-import org.mule.db.commons.internal.domain.connection.generic.GenericConnectionProvider;
-import org.mule.extension.db.internal.domain.connection.BaseDbConnectionParameters;
-import org.mule.runtime.extension.api.annotation.param.Optional;
-import org.mule.runtime.extension.api.annotation.param.Parameter;
-import org.mule.runtime.extension.api.annotation.param.display.ClassValue;
-import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
-import org.mule.runtime.extension.api.annotation.param.display.Password;
-import org.mule.runtime.extension.api.annotation.param.display.Placement;
-
-/**
- * {@link DataSourceConfig}'s parameters for the {@link GenericConnectionProvider}
- *
- * @since 1.0
- * @deprecated since 1.9.4. Replace with equivalent on mule-db-client. To be removed in the next major (2.0).
- */
-@Deprecated
-public class GenericConnectionParameters extends BaseDbConnectionParameters implements DataSourceConfig {
-
- /**
- * JDBC URL to use to connect to the database.
- */
- @Parameter
- @Placement(order = 1)
- @DisplayName("URL")
- private String url;
-
- /**
- * Fully-qualified name of the database driver class.
- */
- @Parameter
- @Placement(order = 2)
- @ClassValue(extendsOrImplements = "java.sql.Driver")
- private String driverClassName;
-
- /**
- * Database username
- */
- @Parameter
- @Placement(order = 3)
- @Optional
- private String user;
-
- /**
- * Database password
- */
- @Parameter
- @Placement(order = 4)
- @Password
- @Optional
- private String password;
-
- @Override
- public String getUrl() {
- return url;
- }
-
- @Override
- public String getDriverClassName() {
- return driverClassName;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public String getUser() {
- return user;
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlConnectionParameters.java b/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlConnectionParameters.java
deleted file mode 100644
index 3812d9f53..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlConnectionParameters.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.mysql;
-
-import org.mule.extension.db.api.logger.MuleMySqlLogger;
-import org.mule.extension.db.internal.domain.connection.BaseDbConnectionParameters;
-import org.mule.extension.db.internal.domain.connection.DataSourceConfig;
-import org.mule.extension.db.internal.domain.logger.MuleMySqlLoggerEnhancerFactory;
-import org.mule.runtime.extension.api.annotation.param.Optional;
-import org.mule.runtime.extension.api.annotation.param.Parameter;
-import org.mule.runtime.extension.api.annotation.param.display.Password;
-import org.mule.runtime.extension.api.annotation.param.display.Placement;
-import org.slf4j.Logger;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import static java.lang.String.format;
-import static org.mule.extension.db.internal.domain.logger.MuleMySqlLoggerEnhancerFactory.MYSQL_DRIVER_CLASS;
-import static org.mule.extension.db.internal.domain.logger.MuleMySqlLoggerEnhancerFactory.NEW_MYSQL_DRIVER_CLASS;
-import static org.mule.runtime.extension.api.annotation.param.display.Placement.ADVANCED_TAB;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * {@link DataSourceConfig} implementation for MySQL databases.
- *
- * @since 1.0
- */
-public final class MySqlConnectionParameters extends BaseDbConnectionParameters implements DataSourceConfig {
-
- private static final String MY_SQL_PREFIX = "jdbc:mysql://";
- private static final String LOGGER_PROPERTY = "logger";
- private static final Logger LOGGER = getLogger(MySqlConnectionParameters.class);
-
- /**
- * Configures the host of the database.
- */
- @Parameter
- @Placement(order = 1)
- private String host;
-
- /**
- * Configures the port of the database.
- */
- @Parameter
- @Placement(order = 2)
- private Integer port;
-
- /**
- * The user to use for authentication against the database.
- */
- @Parameter
- @Optional
- @Placement(order = 3)
- private String user;
-
- /**
- * The password to use for authentication against the database.
- */
- @Parameter
- @Optional
- @Placement(order = 4)
- @Password
- private String password;
-
- /**
- * The name of the database.
- */
- @Parameter
- @Optional
- @Placement(order = 5)
- private String database;
-
- /**
- * Specifies a list of custom key-value connectionProperties for the config.
- */
- @Parameter
- @Optional
- @Placement(tab = ADVANCED_TAB)
- private Map connectionProperties = new HashMap<>();
-
- public MySqlConnectionParameters() {
- addMuleLoggerProperty(connectionProperties);
- }
-
- @Override
- public String getUrl() {
- return MySqlDbUtils.getEffectiveUrl(MY_SQL_PREFIX, host, port, database, connectionProperties);
- }
-
- @Override
- public String getDriverClassName() {
- try {
- Class.forName(NEW_MYSQL_DRIVER_CLASS);
- return NEW_MYSQL_DRIVER_CLASS;
- } catch (ClassNotFoundException e) {
- return MYSQL_DRIVER_CLASS;
- }
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public String getUser() {
- return user;
- }
-
- public Map getConnectionProperties() {
- return connectionProperties;
- }
-
- private void addMuleLoggerProperty(Map connectionProperties) {
- if (connectionProperties != null) {
- try {
- MuleMySqlLogger muleMySqlLogger = new MuleMySqlLogger("MySql");
- MuleMySqlLogger enhancedLogger =
- new MuleMySqlLoggerEnhancerFactory(Thread.currentThread().getContextClassLoader(), muleMySqlLogger).create();
-
- connectionProperties.putIfAbsent(LOGGER_PROPERTY, enhancedLogger.getClass().getName());
- } catch (Throwable e) {
- LOGGER.warn(format("Unable to attach Mule Logger to MySql Driver. Cause: %s", e.getMessage()));
- if (LOGGER.isDebugEnabled()) {
- LOGGER.debug("Unable to attach Mule Logger to MySql Driver", e);
- }
- }
- }
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlConnectionProvider.java b/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlConnectionProvider.java
deleted file mode 100644
index cb200ec05..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlConnectionProvider.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.mysql;
-
-import static java.util.Optional.*;
-import static org.mule.db.commons.api.exception.connection.DbError.CANNOT_REACH;
-import static org.mule.db.commons.api.exception.connection.DbError.INVALID_CREDENTIALS;
-import static org.mule.db.commons.api.exception.connection.DbError.INVALID_DATABASE;
-import static org.mule.db.commons.internal.domain.connection.DbConnectionProvider.DRIVER_FILE_NAME_PATTERN;
-import static org.mule.extension.db.internal.domain.connection.mysql.MySqlConnectionProvider.MYSQL_GAV;
-import static org.mule.extension.db.internal.domain.logger.MuleMySqlLoggerEnhancerFactory.MYSQL_DRIVER_CLASS;
-import static org.mule.extension.db.internal.util.MigrationUtils.mapDataSourceConfig;
-import static org.mule.runtime.api.meta.ExternalLibraryType.JAR;
-import static org.mule.runtime.extension.api.annotation.param.ParameterGroup.CONNECTION;
-
-import java.sql.SQLException;
-import javax.sql.DataSource;
-
-import org.mule.db.commons.api.exception.connection.DbError;
-import org.mule.db.commons.internal.domain.connection.DataSourceConfig;
-import org.mule.db.commons.internal.domain.connection.DbConnectionProvider;
-import org.mule.runtime.extension.api.annotation.Alias;
-import org.mule.runtime.extension.api.annotation.ExternalLib;
-import org.mule.runtime.extension.api.annotation.param.ParameterGroup;
-import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
-
-/**
- * Creates connections to a MySQL database.
- *
- * @since 1.0
- */
-@DisplayName("MySQL Connection")
-@Alias("my-sql")
-@ExternalLib(name = "MySQL JDBC Driver", description = "A JDBC driver which supports connecting to the MySQL Database",
- nameRegexpMatcher = DRIVER_FILE_NAME_PATTERN, requiredClassName = MYSQL_DRIVER_CLASS, type = JAR,
- coordinates = MYSQL_GAV)
-public class MySqlConnectionProvider extends DbConnectionProvider {
-
- private static final String ACCESS_DENIED = "Access denied";
- private static final String UNKNOWN_DATABASE = "Unknown database";
- private static final String COMMUNICATIONS_LINK_FAILURE = "Communications link failure";
- static final String MYSQL_GAV = "mysql:mysql-connector-java:5.1.48";
-
-
- @ParameterGroup(name = CONNECTION)
- private MySqlConnectionParameters mySqlParameters;
-
- @Override
- public java.util.Optional getDataSource() {
- return empty();
- }
-
- @Override
- public java.util.Optional getDataSourceConfig() {
- return ofNullable(mapDataSourceConfig(mySqlParameters));
- }
-
- @Override
- public java.util.Optional getDbVendorErrorType(SQLException e) {
- String message = e.getMessage();
- if (message.contains(ACCESS_DENIED)) {
- return of(INVALID_CREDENTIALS);
- } else if (message.contains(UNKNOWN_DATABASE)) {
- return of(INVALID_DATABASE);
- } else if (message.contains(COMMUNICATIONS_LINK_FAILURE)) {
- return of(CANNOT_REACH);
- }
- return empty();
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlDbUtils.java b/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlDbUtils.java
deleted file mode 100644
index 1052f4488..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/mysql/MySqlDbUtils.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.mysql;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Map;
-
-/**
- * Utility class for MySQL Connection
- *
- * @since 1.0
- */
-final class MySqlDbUtils {
-
- static String getEffectiveUrl(String urlPrefix, String host, Integer port, String database,
- Map connectionProperties) {
- String url = buildUrlFromAttributes(urlPrefix, host, port, database);
- return addProperties(url, connectionProperties);
- }
-
- static String getEffectiveUrl(String url, Map connectionProperties) {
- return addProperties(url, connectionProperties);
- }
-
- private static String buildUrlFromAttributes(String urlPrefix, String host, Integer port, String database) {
- String url;
- StringBuilder buf = new StringBuilder(128);
- buf.append(urlPrefix);
- buf.append(host);
- if (port != null && port > 0) {
- buf.append(":");
- buf.append(port);
- }
- buf.append("/");
- if (database != null) {
- buf.append(database);
- }
- url = buf.toString();
- return url;
- }
-
- private static String addProperties(String url, Map connectionProperties) {
- if (connectionProperties != null && !connectionProperties.isEmpty()) {
- final StringBuilder effectiveUrl = new StringBuilder(url);
- final String queryParams = buildQueryParams(connectionProperties);
-
- if (getUri(url).getQuery() == null) {
- effectiveUrl.append("?");
- } else {
- effectiveUrl.append("&");
- }
- effectiveUrl.append(queryParams);
-
- return effectiveUrl.toString();
- }
-
- return url;
- }
-
- private static String buildQueryParams(Map connectionProperties) {
- StringBuilder params = new StringBuilder(128);
- if (connectionProperties != null) {
- for (Map.Entry entry : connectionProperties.entrySet()) {
- if (params.length() > 0) {
- params.append('&');
- }
-
- params.append(entry.getKey())
- .append('=')
- .append(entry.getValue());
- }
- }
-
- return params.toString();
- }
-
- private static URI getUri(String url) {
- try {
- return new URI(url.substring(5));
- } catch (URISyntaxException e) {
- throw new IllegalArgumentException("Unable to parse database config URL", e);
- }
- }
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleConnectionParameters.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleConnectionParameters.java
deleted file mode 100644
index c5bb31d00..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleConnectionParameters.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle;
-
-import static java.util.Optional.ofNullable;
-import static org.mule.runtime.api.meta.ExpressionSupport.NOT_SUPPORTED;
-import static org.mule.runtime.extension.api.annotation.param.display.Placement.SECURITY_TAB;
-import static org.mule.runtime.extension.api.error.MuleErrors.CONNECTIVITY;
-
-import org.mule.extension.db.internal.domain.connection.BaseDbConnectionParameters;
-import org.mule.extension.db.internal.domain.connection.DataSourceConfig;
-import org.mule.extension.db.internal.domain.connection.oracle.util.OracleTNSEntryURLBuilder;
-import org.mule.runtime.api.connection.ConnectionException;
-import org.mule.runtime.api.tls.TlsContextFactory;
-import org.mule.runtime.extension.api.annotation.Expression;
-import org.mule.runtime.extension.api.annotation.param.Optional;
-import org.mule.runtime.extension.api.annotation.param.Parameter;
-import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
-import org.mule.runtime.extension.api.annotation.param.display.Password;
-import org.mule.runtime.extension.api.annotation.param.display.Placement;
-import org.mule.runtime.extension.api.annotation.param.display.Summary;
-import org.mule.runtime.extension.api.exception.ModuleException;
-
-/**
- *
- * {@link DataSourceConfig} implementation for Oracle databases.
- *
- * @since 1.0
- */
-public class OracleConnectionParameters extends BaseDbConnectionParameters implements DataSourceConfig {
-
- static final String DRIVER_CLASS_NAME = "oracle.jdbc.driver.OracleDriver";
- private static final String JDBC_URL_PREFIX = "jdbc:oracle:thin:@";
-
- /**
- * Configures the host of the database.
- */
- @Parameter
- @Placement(order = 1)
- private String host;
-
- /**
- * Configures the port of the database.
- */
- @Parameter
- @Optional(defaultValue = "1521")
- @Placement(order = 2)
- private Integer port;
-
- /**
- * The user to use for authentication against the database.
- */
- @Parameter
- @Optional
- @Placement(order = 3)
- private String user;
-
- /**
- * The password to use for authentication against the database.
- */
- @Parameter
- @Optional
- @Placement(order = 4)
- @Password
- private String password;
-
- /**
- * The name of the database instance.
- */
- @Parameter
- @Optional
- @Placement(order = 5)
- private String instance;
-
- /**
- * The name of the database service name.
- */
- @Parameter
- @Optional
- @Placement(order = 6)
- private String serviceName;
-
- /**
- * A factory for TLS contexts. A TLS context is configured with a key store and a trust store. Allows to create TLS secured
- * connections.
- */
- @Parameter
- @Optional
- @Expression(NOT_SUPPORTED)
- @Placement(tab = SECURITY_TAB)
- @DisplayName("TLS Context")
- @Summary("The TLS factory used to create TLS secured connections")
- private TlsContextFactory tlsContextFactory;
-
- @Override
- public String getUrl() {
- checkInstanceAndServiceName();
-
- return tlsContextFactory != null ? (JDBC_URL_PREFIX + generateSecureUrl()) : generateBasicUrl();
- }
-
- @Override
- public String getDriverClassName() {
- return DRIVER_CLASS_NAME;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public String getUser() {
- return user;
- }
-
- @Override
- public java.util.Optional getTlsContextFactory() {
- return ofNullable(tlsContextFactory);
- }
-
- private String generateBasicUrl() {
- StringBuilder buf = new StringBuilder(JDBC_URL_PREFIX);
-
- buf.append(host);
- buf.append(":");
- buf.append(port);
-
- if (instance != null) {
- buf.append(":");
- buf.append(instance);
- }
- if (serviceName != null) {
- buf.append("/");
- buf.append(serviceName);
- }
-
- return buf.toString();
- }
-
- private String generateSecureUrl() {
- return new OracleTNSEntryURLBuilder()
- .withProtocol("TCPS")
- .withHost(host)
- .withPort(port)
- .withInstanceName(instance)
- .withServiceName(serviceName)
- .build();
- }
-
- private void checkInstanceAndServiceName() {
- if (instance != null && serviceName != null) {
- String errorMessage = "Instance (SID) : [" + instance + "] and Service Name : [" + serviceName
- + "] were provided at the same time, please configure only one";
-
- throw new ModuleException(errorMessage, CONNECTIVITY, new ConnectionException(errorMessage));
- }
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleConnectionUtils.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleConnectionUtils.java
deleted file mode 100644
index d1d3af7f2..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleConnectionUtils.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-
-package org.mule.extension.db.internal.domain.connection.oracle;
-
-import static java.util.Optional.of;
-import static java.util.Optional.empty;
-
-import java.util.Optional;
-
-/**
- * Utils for the oracle db connection
- *
- * @since 1.5.2
- */
-public class OracleConnectionUtils {
-
- private OracleConnectionUtils() {}
-
- public static Optional getOwnerFrom(String typeName) {
- return typeName.contains(".") ? of(typeName.substring(0, typeName.indexOf('.'))) : empty();
- }
-
- public static String getTypeSimpleName(String typeName) {
- if (!typeName.contains(".")) {
- return typeName;
- } else {
- return typeName.substring(typeName.indexOf('.') + 1);
- }
- }
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleDbConnection.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleDbConnection.java
deleted file mode 100644
index 1df96f0e6..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleDbConnection.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-
-package org.mule.extension.db.internal.domain.connection.oracle;
-
-import static java.util.Optional.empty;
-import static java.util.Optional.ofNullable;
-import static org.apache.commons.lang3.StringUtils.isBlank;
-import static org.mule.extension.db.internal.domain.connection.oracle.OracleConnectionUtils.getOwnerFrom;
-import static org.mule.extension.db.internal.domain.connection.oracle.OracleConnectionUtils.getTypeSimpleName;
-
-import oracle.jdbc.OracleConnection;
-import oracle.jdbc.OracleTypes;
-import org.mule.db.commons.internal.domain.connection.DefaultDbConnection;
-import org.mule.db.commons.internal.domain.connection.type.resolver.ArrayTypeResolver;
-import org.mule.db.commons.internal.domain.connection.type.resolver.StructAndArrayTypeResolver;
-import org.mule.db.commons.internal.domain.type.ArrayResolvedDbType;
-import org.mule.db.commons.internal.domain.type.DbType;
-import org.mule.db.commons.internal.domain.type.ResolvedDbType;
-import org.mule.extension.db.internal.domain.connection.oracle.types.OracleOlderXMLType;
-import org.mule.extension.db.internal.domain.connection.oracle.types.OracleOpaqueXMLType;
-import org.mule.extension.db.internal.domain.connection.oracle.types.OracleSQLXMLType;
-import org.mule.extension.db.internal.domain.connection.oracle.types.OracleSYSXMLType;
-import org.mule.extension.db.internal.domain.connection.oracle.types.OracleXMLType;
-
-import java.sql.Array;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Types;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * {@link DefaultDbConnection} implementation for Oracle databases
- *
- * @since 1.0
- */
-public class OracleDbConnection extends DefaultDbConnection {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(OracleDbConnection.class);
-
- public static final String TABLE_TYPE_NAME = "TABLE";
-
- private static final int CURSOR_TYPE_ID = OracleTypes.CURSOR;
- private static final String CURSOR_TYPE_NAME = "CURSOR";
-
- public static final String ATTR_TYPE_NAME_PARAM = "ATTR_TYPE_NAME";
-
- private static final String ATTR_NO_PARAM = "ATTR_NO";
-
- public static final String QUERY_TYPE_ATTRS =
- "SELECT ATTR_NO, ATTR_TYPE_NAME FROM ALL_TYPE_ATTRS WHERE TYPE_NAME = ? AND ATTR_TYPE_NAME IN ('CLOB', 'BLOB')";
-
- private static final String QUERY_OWNER_CONDITION = " AND OWNER = ?";
-
- private static final int PROCEDURE_SCHEM_COLUMN_INDEX = 2;
- private static final int PROCEDURE_NAME = 3;
- private static final int PARAM_NAME_COLUMN_INDEX = 4;
-
- private final Map> resolvedDbTypesCache;
-
-
- public OracleDbConnection(Connection jdbcConnection, List customDataTypes,
- Map> resolvedDbTypesCache) {
- super(jdbcConnection, customDataTypes);
- this.resolvedDbTypesCache = resolvedDbTypesCache;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List getVendorDataTypes() {
- List dbTypes = new ArrayList<>();
- dbTypes.add(new ResolvedDbType(CURSOR_TYPE_ID, CURSOR_TYPE_NAME));
- dbTypes.add(new OracleOpaqueXMLType());
- dbTypes.add(new OracleSQLXMLType());
- dbTypes.add(new OracleXMLType());
- dbTypes.add(new OracleOlderXMLType());
- dbTypes.add(new OracleSYSXMLType());
-
- return dbTypes;
- }
-
- @Override
- public Optional getProcedureColumnType(String procedureName, String columnName, String owner) throws SQLException {
- try (PreparedStatement statement = getJdbcConnection().prepareStatement("SELECT TYPE_NAME FROM SYS.ALL_ARGUMENTS \n" +
- "WHERE OWNER= ? \n" +
- "AND OBJECT_NAME= ?\n" +
- "AND ARGUMENT_NAME = ?\n" +
- "ORDER BY SEQUENCE")) {
-
- statement.setString(1, owner);
- statement.setString(2, procedureName);
- statement.setString(3, columnName);
-
- ResultSet resultSet = statement.executeQuery();
-
- Optional columnType = empty();
-
- if (resultSet.next()) {
- columnType = ofNullable(resultSet.getString(1));
- }
- return columnType;
- }
- }
-
- @Override
- public Set getTables() throws SQLException {
- try (Statement statement = getJdbcConnection().createStatement()) {
- statement.execute("SELECT table_name FROM user_tables");
- ResultSet resultSet = statement.getResultSet();
-
- Set tables = new HashSet<>();
- while (resultSet.next()) {
- tables.add(resultSet.getString(1));
- }
-
- return tables;
- }
- }
-
- @Override
- public Array createArray(String typeName, Object[] values) throws SQLException {
- // Not using isWrapperFor() because this is expected to always succeed,
- // since we already know that the Database is Oracle.
- OracleConnection oracleConnection = getJdbcConnection().unwrap(OracleConnection.class);
-
- if (oracleConnection == null) {
- throw new RuntimeException("Can't reach Oracle extensions. Connection class was: "
- + getJdbcConnection().getClass().getName());
- }
-
- resolveLobs(typeName, values, new ArrayTypeResolver(this));
-
- values = Arrays.stream(values).map(e -> {
- if (e instanceof Collection) {
- return ((Collection>) e).toArray();
- } else {
- return e;
- }
- }).toArray();
-
- return oracleConnection.createARRAY(typeName, values);
- }
-
- @Override
- protected void resolveLobs(String typeName, Object[] attributes, StructAndArrayTypeResolver typeResolver) throws SQLException {
- Map dataTypes = getLobFieldsDataTypeInfo(typeResolver.resolveType(typeName));
-
- for (Map.Entry entry : dataTypes.entrySet()) {
- int index = entry.getKey();
- ResolvedDbType dataType = entry.getValue();
- // In Oracle we do not have the data type for structs or arrays, as the
- // the driver does not provide the getAttributes functionality
- // in their DatabaseMetaData.
- // It has to be taken into account that the data type depends on JDBC, so the
- // driver is the unit responsible for the mapping and we do not have that information
- // in the DB catalog. We resolve the lobs depending on the name only.
- typeResolver.resolveLobs(attributes, index - 1, dataType.getName());
- }
- }
-
- @Override
- protected Map getLobFieldsDataTypeInfo(String typeName) throws SQLException {
-
- if (this.resolvedDbTypesCache.containsKey(typeName)) {
- if (logger.isDebugEnabled()) {
- logger.debug("Returning chached LobFieldsDataTypeInfo");
- }
- return resolvedDbTypesCache.get(typeName);
- }
- if (logger.isDebugEnabled()) {
- logger.debug("Obtaining LobFieldsDataTypeInfo");
- }
- synchronized (resolvedDbTypesCache) {
- if (this.resolvedDbTypesCache.containsKey(typeName)) {
- return resolvedDbTypesCache.get(typeName);
- }
-
- Map dataTypes = new HashMap<>();
-
- Optional owner = getOwnerFrom(typeName);
- String type = getTypeSimpleName(typeName);
-
- String query = QUERY_TYPE_ATTRS + (owner.isPresent() ? QUERY_OWNER_CONDITION : "");
-
- try (PreparedStatement ps = this.prepareStatement(query)) {
- ps.setString(1, type);
- if (owner.isPresent()) {
- ps.setString(2, owner.get());
- }
-
- try (ResultSet resultSet = ps.executeQuery()) {
- while (resultSet.next()) {
- ResolvedDbType resolvedDbType = new ResolvedDbType(UNKNOWN_DATA_TYPE, resultSet.getString(ATTR_TYPE_NAME_PARAM));
- dataTypes.put(resultSet.getInt(ATTR_NO_PARAM), resolvedDbType);
- }
- }
- }
- resolvedDbTypesCache.put(typeName, dataTypes);
- return dataTypes;
- }
- }
-
- @Override
- public ResultSet getProcedureColumns(String storedProcedureName, String storedProcedureOwner, String storedProcedureParentOwner,
- String catalogName)
- throws SQLException {
- /*
- * Since Oracle does not have multiples catalog but it has packages, the recommended way to get a procedure description
- * of a procedure within a package is to use the argument named catalog of DatabaseMetaData#getProcedureColumns to
- * specify the package name.
- *
- * Under certain circumstances calling DatabaseMetaData#getProcedureColumns not specifying schema, package, and
- * catalog might take too long to resolve. For this reason we try to call this method avoiding any null value.
- *
- * When the owner is defined but the parent owner it is not, we cannot know whether a stored procedure owner is a
- * schema or a package. In this case we try first considering the owner as the package and using the schema from the
- * connection. If that fails to find the procedure, we considered the owner as the schema.
- *
- * If we cannot find the stored procedure under the specified schema and/or package we try specifying only the stored
- * procedure name.
- */
- DatabaseMetaData dbMetaData = getJdbcConnection().getMetaData();
-
- String connectionSchema;
- try {
- connectionSchema = getJdbcConnection().getSchema();
- } catch (Throwable t) {
- LOGGER
- .warn("You are using a not supported jdbc driver version. Consider to upgrade to a new version to guarantee a better performance.");
- connectionSchema = null;
- }
-
- ResultSet procedureColumns;
- if (!isBlank(storedProcedureParentOwner) && !isBlank(storedProcedureOwner)) {
- procedureColumns =
- dbMetaData.getProcedureColumns(storedProcedureParentOwner, storedProcedureOwner, storedProcedureName, "%");
- } else if (!isBlank(storedProcedureOwner)) {
- procedureColumns = dbMetaData.getProcedureColumns(storedProcedureOwner, connectionSchema, storedProcedureName, "%");
- if (!procedureColumns.isBeforeFirst()) {
- procedureColumns.close();
- procedureColumns = dbMetaData.getProcedureColumns(catalogName == null ? "" : catalogName, storedProcedureOwner,
- storedProcedureName, "%");
- }
- } else {
- procedureColumns = dbMetaData.getProcedureColumns(catalogName, connectionSchema, storedProcedureName, "%");
- }
-
- if (!procedureColumns.isBeforeFirst()) {
- LOGGER
- .debug("Failed to get procedure types with schema {}, package {} and procedure {}. Removing all catalog and schema filters.",
- storedProcedureOwner, storedProcedureParentOwner, storedProcedureName);
- procedureColumns = dbMetaData.getProcedureColumns(null, null, storedProcedureName, "%");
- }
-
- return procedureColumns;
- }
-
- @Override
- public Optional getDbTypeByVendor(String typeName, ResultSet procedureColumns) throws SQLException {
- if (TABLE_TYPE_NAME.equals(typeName)) {
- String procedureName = procedureColumns.getString(PROCEDURE_NAME);
- String argumentName = procedureColumns.getString(PARAM_NAME_COLUMN_INDEX);
- String owner = procedureColumns.getString(PROCEDURE_SCHEM_COLUMN_INDEX);
-
- Optional columnType = getProcedureColumnType(procedureName, argumentName, owner);
- return columnType.map(type -> new ArrayResolvedDbType(Types.ARRAY, type));
- }
-
- return empty();
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleDbConnectionProvider.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleDbConnectionProvider.java
deleted file mode 100644
index 19da3e39f..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/OracleDbConnectionProvider.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-
-package org.mule.extension.db.internal.domain.connection.oracle;
-
-import static java.util.Optional.empty;
-import static java.util.Optional.of;
-import static java.util.Optional.ofNullable;
-
-import static org.mule.db.commons.api.exception.connection.DbError.CANNOT_REACH;
-import static org.mule.db.commons.api.exception.connection.DbError.INVALID_CREDENTIALS;
-import static org.mule.db.commons.api.exception.connection.DbError.INVALID_DATABASE;
-import static org.mule.db.commons.internal.domain.connection.DbConnectionProvider.DRIVER_FILE_NAME_PATTERN;
-import static org.mule.extension.db.internal.domain.connection.oracle.OracleConnectionParameters.DRIVER_CLASS_NAME;
-import static org.mule.runtime.api.meta.ExternalLibraryType.JAR;
-import static org.mule.runtime.core.api.lifecycle.LifecycleUtils.initialiseIfNeeded;
-import static org.mule.runtime.extension.api.annotation.param.ParameterGroup.CONNECTION;
-import static org.mule.extension.db.internal.util.MigrationUtils.mapDataSourceConfig;
-
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Objects;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.Map;
-
-import org.mule.db.commons.api.exception.connection.DbError;
-import org.mule.db.commons.internal.domain.connection.DataSourceConfig;
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.connection.DbConnectionProvider;
-import org.mule.db.commons.internal.domain.type.ResolvedDbType;
-import org.mule.runtime.api.lifecycle.InitialisationException;
-import org.mule.runtime.extension.api.annotation.Alias;
-import org.mule.runtime.extension.api.annotation.ExternalLib;
-import org.mule.runtime.extension.api.annotation.param.ParameterGroup;
-import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
-
-/**
- * Creates connections to a Oracle database
- *
- * @since 1.0
- */
-@DisplayName("Oracle Connection")
-@Alias("oracle")
-@ExternalLib(name = "Oracle JDBC Driver", description = "A JDBC driver which supports connecting to an Oracle Database",
- nameRegexpMatcher = DRIVER_FILE_NAME_PATTERN, requiredClassName = DRIVER_CLASS_NAME, type = JAR)
-public class OracleDbConnectionProvider extends DbConnectionProvider {
-
- private static final String INVALID_CREDENTIALS_ORACLE_CODE = "ORA-01017";
- private static final String UNKNOWN_SID_ORACLE_CODE = "ORA-12505";
- private static final String IO_ERROR = "IO Error: The Network Adapter could not establish the connection";
-
- @ParameterGroup(name = CONNECTION)
- private OracleConnectionParameters oracleConnectionParameters;
-
- Map> resolvedDbTypesCache = new ConcurrentHashMap<>();
-
- @Override
- public void initialise() throws InitialisationException {
- super.initialise();
-
- initialiseIfNeeded(oracleConnectionParameters.getTlsContextFactory());
- }
-
- @Override
- public java.util.Optional getDataSource() {
- return empty();
- }
-
- @Override
- public java.util.Optional getDataSourceConfig() {
- return ofNullable(mapDataSourceConfig(oracleConnectionParameters));
- }
-
- @Override
- protected DbConnection createDbConnection(Connection connection) throws Exception {
- return new OracleDbConnection(connection, super.resolveCustomTypes(), resolvedDbTypesCache);
- }
-
- @Override
- public java.util.Optional getDbVendorErrorType(SQLException e) {
- String message = e.getMessage();
- if (message.contains(INVALID_CREDENTIALS_ORACLE_CODE)) {
- return of(INVALID_CREDENTIALS);
- } else if (message.contains(UNKNOWN_SID_ORACLE_CODE)) {
- return of(INVALID_DATABASE);
- } else if (message.contains(IO_ERROR)) {
- return of(CANNOT_REACH);
- }
- return empty();
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
-
- if (!super.equals(o)) {
- return false;
- }
-
- if (!(o instanceof OracleDbConnectionProvider)) {
- return false;
- }
-
- OracleDbConnectionProvider that = (OracleDbConnectionProvider) o;
-
- return Objects.equals(this.oracleConnectionParameters, that.oracleConnectionParameters) &&
- Objects.equals(this.resolvedDbTypesCache, that.resolvedDbTypesCache);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), oracleConnectionParameters, resolvedDbTypesCache);
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleOlderXMLType.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleOlderXMLType.java
deleted file mode 100644
index 547c943a5..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleOlderXMLType.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle.types;
-
-import oracle.jdbc.OracleTypes;
-
-public class OracleOlderXMLType extends OracleXmlTypeHandler {
-
- private static final int OPAQUE_TYPE_ID = OracleTypes.OPAQUE;
- private static final String XML_TYPE_NAME = "XMLTYPE";
-
- public OracleOlderXMLType() {
- super(OPAQUE_TYPE_ID, XML_TYPE_NAME);
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleOpaqueXMLType.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleOpaqueXMLType.java
deleted file mode 100644
index 42924680d..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleOpaqueXMLType.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle.types;
-
-import oracle.jdbc.OracleTypes;
-
-public class OracleOpaqueXMLType extends OracleXmlTypeHandler {
-
- private static final int OPAQUEXML_TYPE_ID = OracleTypes.SQLXML;
- private static final String OPAQUEXML_TYPE_NAME = "OPAQUE/XMLTYPE";
-
- public OracleOpaqueXMLType() {
- super(OPAQUEXML_TYPE_ID, OPAQUEXML_TYPE_NAME);
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleSQLXMLType.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleSQLXMLType.java
deleted file mode 100644
index 7c6d4ea39..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleSQLXMLType.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle.types;
-
-import oracle.jdbc.OracleTypes;
-
-public class OracleSQLXMLType extends OracleXmlTypeHandler {
-
- private static final int SQLXML_TYPE_ID = OracleTypes.SQLXML;
- private static final String SQLXML_TYPE_NAME = "SQLXML";
-
- public OracleSQLXMLType() {
- super(SQLXML_TYPE_ID, SQLXML_TYPE_NAME);
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleSYSXMLType.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleSYSXMLType.java
deleted file mode 100644
index d5ef81f28..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleSYSXMLType.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle.types;
-
-import oracle.jdbc.OracleTypes;
-
-public class OracleSYSXMLType extends OracleXmlTypeHandler {
-
- private static final int SYS_XML_TYPE_ID = OracleTypes.SQLXML;
- private static final String SYS_XML_TYPE_NAME = "SYS.XMLTYPE";
-
- public OracleSYSXMLType() {
- super(SYS_XML_TYPE_ID, SYS_XML_TYPE_NAME);
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleXMLType.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleXMLType.java
deleted file mode 100644
index 5ed428e6d..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleXMLType.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle.types;
-
-import oracle.jdbc.OracleTypes;
-
-public class OracleXMLType extends OracleXmlTypeHandler {
-
- private static final int XMLTYPE_TYPE_ID = OracleTypes.SQLXML;
- private static final String XMLTYPE_TYPE_NAME = "XMLTYPE";
-
- public OracleXMLType() {
- super(XMLTYPE_TYPE_ID, XMLTYPE_TYPE_NAME);
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleXmlTypeHandler.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleXmlTypeHandler.java
deleted file mode 100644
index a4a7a8a9f..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/types/OracleXmlTypeHandler.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle.types;
-
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.type.AbstractStructuredDbType;
-
-import java.io.InputStream;
-import java.lang.reflect.Constructor;
-import java.sql.CallableStatement;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-/**
- * Defines a structured data type handler for the {@link #ORACLE_XMLTYPE_CLASS} class, multiple name/id pairs will
- * extend this class to cover all possible scenarios
- */
-public class OracleXmlTypeHandler extends AbstractStructuredDbType {
-
- private static final String XML_TYPE_INTERNAL_NAME = "SYS.XMLTYPE";
- public static final String ORACLE_XMLTYPE_CLASS = "oracle.xdb.XMLType";
-
- public OracleXmlTypeHandler(int id, String name) {
- super(id, name);
- }
-
- @Override
- public Object getParameterValue(CallableStatement statement, int index) throws SQLException {
- return statement.getSQLXML(index);
- }
-
- @Override
- public void setParameterValue(PreparedStatement statement, int index, Object value, DbConnection connection)
- throws SQLException {
- try {
- if (value instanceof String) {
- statement.setObject(index, createXmlType(statement.getConnection(), (String) value), this.getId());
- return;
- }
- if (value instanceof InputStream) {
- statement.setObject(index, createXmlType(statement.getConnection(), (InputStream) value), this.getId());
- return;
- }
- } catch (Exception e) {
- throw new SQLException(e);
- }
- super.setParameterValue(statement, index, value, connection);
- }
-
- /**
- * Creates an {@link #ORACLE_XMLTYPE_CLASS} object from the received XML string
- *
- * @param connection An active database connection, required by the {@link #ORACLE_XMLTYPE_CLASS} constructor
- * @param xml A String object containing the XML content
- * @return an new {@link #ORACLE_XMLTYPE_CLASS} with the XML passed
- * @throws Exception if there is a problem while creating the {@link #ORACLE_XMLTYPE_CLASS} object
- * ({@link #ORACLE_XMLTYPE_CLASS} class is not found in the classpath, connection is closed, etc)
- */
- public static Object createXmlType(Connection connection, String xml) throws Exception {
- return createXmlType(connection, xml, String.class);
- }
-
- /**
- * Creates an {@link #ORACLE_XMLTYPE_CLASS} object from the received XML InputStream
- *
- * @param connection An active database connection, required by the {@link #ORACLE_XMLTYPE_CLASS} constructor
- * @param xml A Stream object containing the XML content
- * @return an new {@link #ORACLE_XMLTYPE_CLASS} with the XML passed
- * @throws Exception if there is a problem while creating the {@link #ORACLE_XMLTYPE_CLASS} object
- * ({@link #ORACLE_XMLTYPE_CLASS} class is not found in the classpath, connection is closed, etc)
- */
- public static Object createXmlType(Connection connection, InputStream xml) throws Exception {
- return createXmlType(connection, xml, InputStream.class);
- }
-
- private static Object createXmlType(Connection connection, T xmlContent, Class tClass) throws Exception {
- Class> xmlTypeClass = getXmlTypeClass();
- Constructor> xmlTypeConstructor = xmlTypeClass.getConstructor(Connection.class, tClass);
-
- return xmlTypeConstructor.newInstance(connection, xmlContent);
- }
-
- /**
- * Looks for the {@link #ORACLE_XMLTYPE_CLASS} class in the classpath and returns a reference to it
- *
- * @return the {@link #ORACLE_XMLTYPE_CLASS} class object
- * @throws ClassNotFoundException if there required class in not in the classpath
- */
- public static Class> getXmlTypeClass() throws ClassNotFoundException {
- return org.apache.commons.lang3.ClassUtils.getClass(ORACLE_XMLTYPE_CLASS);
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/util/OracleCredentialsMaskUtils.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/util/OracleCredentialsMaskUtils.java
deleted file mode 100644
index 35677c7f5..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/util/OracleCredentialsMaskUtils.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle.util;
-
-import org.mule.db.commons.internal.util.CredentialsMaskUtils;
-import java.util.regex.Pattern;
-
-import static java.util.regex.Pattern.compile;
-
-public class OracleCredentialsMaskUtils extends CredentialsMaskUtils {
-
- public static final Pattern ORACLE_USER = compile("jdbc:oracle:.*:(.*)/.*@");
- public static final Pattern ORACLE_PASSWORD = compile("jdbc:oracle:.*:.*/(.*)@");
-
- public static String maskUrlUserAndPasswordForOracle(String input) {
- String oracleInputMasked = CredentialsMaskUtils.maskUrlUserAndPassword(input);
- oracleInputMasked =
- CredentialsMaskUtils.maskUrlPattern(oracleInputMasked, ORACLE_PASSWORD, PASSWORD_MASK, PASSWORD_URL_PREFIX);
- oracleInputMasked = CredentialsMaskUtils.maskUrlPattern(oracleInputMasked, ORACLE_USER, USER_MASK, PASSWORD_URL_PREFIX);
- return oracleInputMasked;
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/util/OracleTNSEntryURLBuilder.java b/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/util/OracleTNSEntryURLBuilder.java
deleted file mode 100644
index cd7459b41..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/oracle/util/OracleTNSEntryURLBuilder.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.oracle.util;
-
-import static java.util.Objects.requireNonNull;
-
-/**
- *
- * Builder class to facilitate the creation of Oracle's URLs that use TNS Entries
- *
- * @since 1.11.0
- */
-public final class OracleTNSEntryURLBuilder {
-
- private String protocol;
- private String host;
- private Integer port;
- private String instanceName;
- private String serviceName;
-
- public OracleTNSEntryURLBuilder() {}
-
- public OracleTNSEntryURLBuilder withProtocol(String protocol) {
- this.protocol = protocol;
- return this;
- }
-
- public OracleTNSEntryURLBuilder withHost(String host) {
- this.host = host;
- return this;
- }
-
- public OracleTNSEntryURLBuilder withPort(Integer port) {
- this.port = port;
- return this;
- }
-
- public OracleTNSEntryURLBuilder withInstanceName(String instanceName) {
- this.instanceName = instanceName;
- return this;
- }
-
- public OracleTNSEntryURLBuilder withServiceName(String serviceName) {
- this.serviceName = serviceName;
- return this;
- }
-
- public String build() {
- requireNonNull(protocol, "Protocol can't be null");
- requireNonNull(host, "Host can't be null");
- requireNonNull(port, "Port can't be null");
-
- StringBuilder buf = new StringBuilder();
-
- buf.append("(DESCRIPTION=");
-
- buf.append("(ADDRESS=");
- buf.append("(PROTOCOL=").append(protocol).append(")");
- buf.append("(PORT=").append(port).append(")");
- buf.append("(HOST=").append(host).append(")");
- buf.append(")");
-
- buf.append("(CONNECT_DATA=");
- if (instanceName != null) {
- buf.append("(INSTANCE_NAME=").append(instanceName).append(")");
- }
- if (serviceName != null) {
- buf.append("(SERVICE_NAME=").append(serviceName).append(")");
- }
- buf.append(")");
-
- return buf.append(")").toString();
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnection.java b/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnection.java
deleted file mode 100644
index ce4efd546..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnection.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.sqlserver;
-
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.connection.DefaultDbConnection;
-import org.mule.extension.db.internal.domain.connection.sqlserver.types.SqlServerBinaryDbType;
-import org.mule.extension.db.internal.domain.connection.sqlserver.types.SqlServerVarBinaryDbType;
-import org.mule.db.commons.internal.domain.type.DbType;
-
-import java.sql.Connection;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * {@link DbConnection} implementation for SQL Server which configures out of the box custom
- *
- * @since 1.1.0
- */
-public class SqlServerConnection extends DefaultDbConnection {
-
- SqlServerConnection(Connection jdbcConnection, List customDataTypes) {
- super(jdbcConnection, customDataTypes);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public List getCustomDataTypes() {
- List dbTypes = new ArrayList<>();
- dbTypes.add(new SqlServerVarBinaryDbType());
- dbTypes.add(new SqlServerBinaryDbType());
-
- return dbTypes;
- }
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnectionParameters.java b/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnectionParameters.java
deleted file mode 100644
index dd1e5b5bb..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnectionParameters.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.sqlserver;
-
-import static org.mule.extension.db.internal.domain.connection.sqlserver.SqlServerConnectionProvider.DRIVER_CLASS_NAME;
-import static org.mule.runtime.extension.api.annotation.param.display.Placement.ADVANCED_TAB;
-
-import org.mule.extension.db.internal.domain.connection.BaseDbConnectionParameters;
-import org.mule.extension.db.internal.domain.connection.DataSourceConfig;
-import org.mule.runtime.extension.api.annotation.param.NullSafe;
-import org.mule.runtime.extension.api.annotation.param.Optional;
-import org.mule.runtime.extension.api.annotation.param.Parameter;
-import org.mule.runtime.extension.api.annotation.param.display.Password;
-import org.mule.runtime.extension.api.annotation.param.display.Placement;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Connection parameters for SQL Server.
- *
- * @since 1.1.0
- */
-public class SqlServerConnectionParameters extends BaseDbConnectionParameters implements DataSourceConfig {
-
- private static final String SUB_PROTOCOL = "jdbc:sqlserver://";
-
- /**
- * Configures the host of the database.
- */
- @Parameter
- @Placement(order = 1)
- private String host;
-
- /**
- * Configures the name of the SQL server instance where the database is.
- */
- @Parameter
- @Optional
- @Placement(order = 2)
- private String instanceName;
-
- /**
- * Configures the port of the database.
- */
- @Parameter
- @Optional
- @Placement(order = 3)
- private Integer port;
-
- /**
- * The user to use for authentication against the database.
- */
- @Parameter
- @Optional
- @Placement(order = 4)
- private String user;
-
- /**
- * The password to use for authentication against the database.
- */
- @Parameter
- @Optional
- @Placement(order = 5)
- @Password
- private String password;
-
- /**
- * Name of the default database to work with.
- */
- @Parameter
- @Optional
- @Placement(order = 6)
- private String databaseName;
-
- /**
- * Specifies a list of custom key-value connectionProperties for the config.
- */
- @Parameter
- @Optional
- @Placement(tab = ADVANCED_TAB)
- @NullSafe
- private Map connectionProperties = new HashMap<>();
-
- @Override
- public String getUrl() {
- return SUB_PROTOCOL + host + getInstanceNameUrlPart() + getPortUrlPart() + getProperties();
- }
-
- private String getInstanceNameUrlPart() {
- if (instanceName != null) {
- return "\\" + instanceName;
- }
- return "";
- }
-
- private String getPortUrlPart() {
- if (port != null) {
- return ":" + port;
- }
- return "";
- }
-
- private String getProperties() {
- StringBuilder stringBuilder = new StringBuilder();
-
- if (databaseName != null) {
- stringBuilder.append(";databaseName=");
- stringBuilder.append(databaseName);
- }
-
- connectionProperties.forEach((key, value) -> {
- stringBuilder.append(";");
- stringBuilder.append(key);
- stringBuilder.append("=");
- stringBuilder.append(value);
- });
-
- return stringBuilder.toString();
- }
-
- @Override
- public String getDriverClassName() {
- return DRIVER_CLASS_NAME;
- }
-
- @Override
- public String getPassword() {
- return password;
- }
-
- @Override
- public String getUser() {
- return user;
- }
-
- public static String getSubProtocol() {
- return SUB_PROTOCOL;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getInstanceName() {
- return instanceName;
- }
-
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
-
- public Integer getPort() {
- return port;
- }
-
- public void setPort(Integer port) {
- this.port = port;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public String getDatabaseName() {
- return databaseName;
- }
-
- public void setDatabaseName(String databaseName) {
- this.databaseName = databaseName;
- }
-
- public Map getConnectionProperties() {
- return connectionProperties;
- }
-
- public void setConnectionProperties(Map connectionProperties) {
- this.connectionProperties = connectionProperties;
- }
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnectionProvider.java b/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnectionProvider.java
deleted file mode 100644
index 53eb4bc64..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/SqlServerConnectionProvider.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.sqlserver;
-
-
-import static java.util.Optional.empty;
-import static java.util.Optional.of;
-import static java.util.Optional.ofNullable;
-
-import static org.mule.extension.db.internal.util.MigrationUtils.mapDataSourceConfig;
-import static org.mule.db.commons.api.exception.connection.DbError.CANNOT_REACH;
-import static org.mule.db.commons.api.exception.connection.DbError.INVALID_CREDENTIALS;
-import static org.mule.db.commons.api.exception.connection.DbError.INVALID_DATABASE;
-import static org.mule.db.commons.internal.domain.connection.DbConnectionProvider.DRIVER_FILE_NAME_PATTERN;
-import static org.mule.extension.db.internal.domain.connection.sqlserver.SqlServerConnectionProvider.DRIVER_CLASS_NAME;
-import static org.mule.extension.db.internal.domain.connection.sqlserver.SqlServerConnectionProvider.MSSQL_GAV;
-import static org.mule.runtime.api.meta.ExternalLibraryType.JAR;
-import static org.mule.runtime.extension.api.annotation.param.ParameterGroup.CONNECTION;
-import javax.sql.DataSource;
-import java.sql.Connection;
-import java.sql.SQLException;
-import org.mule.db.commons.api.exception.connection.DbError;
-import org.mule.db.commons.internal.domain.connection.DataSourceConfig;
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.connection.DbConnectionProvider;
-import org.mule.runtime.extension.api.annotation.Alias;
-import org.mule.runtime.extension.api.annotation.ExternalLib;
-import org.mule.runtime.extension.api.annotation.param.ParameterGroup;
-import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
-
-/**
- * {@link DbConnectionProvider} implementation for Microsoft SQL Server Databases
- *
- * @since 1.1.0
- */
-@DisplayName("Microsoft SQL Server Connection")
-@Alias("mssql")
-@ExternalLib(name = "Microsoft SQL Server Driver",
- description = "A JDBC driver which supports connecting to an Microsoft SQL Server Database",
- requiredClassName = DRIVER_CLASS_NAME, type = JAR, coordinates = MSSQL_GAV,
- nameRegexpMatcher = DRIVER_FILE_NAME_PATTERN)
-public class SqlServerConnectionProvider extends DbConnectionProvider {
-
- static final String DRIVER_CLASS_NAME = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
- static final String MSSQL_GAV = "com.microsoft.sqlserver:mssql-jdbc:6.2.2.jre8";
-
-
-
- @ParameterGroup(name = CONNECTION)
- private SqlServerConnectionParameters connectionParameters;
-
-
- @Override
- protected DbConnection createDbConnection(Connection connection) throws Exception {
- return new SqlServerConnection(connection, super.resolveCustomTypes());
- }
-
- @Override
- public java.util.Optional getDataSource() {
- return empty();
- }
-
- @Override
- public java.util.Optional getDataSourceConfig() {
- return ofNullable(mapDataSourceConfig(connectionParameters));
- }
-
- @Override
- protected java.util.Optional getDbVendorErrorType(SQLException e) {
- String message = e.getMessage();
- if (message.contains("Login failed for user")) {
- return of(INVALID_CREDENTIALS);
- } else if (message.contains("Cannot open database")) {
- return of(INVALID_DATABASE);
- } else if (message.contains("invalidHost")) {
- return of(CANNOT_REACH);
- }
- return empty();
- }
-
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/types/SqlServerBinaryDbType.java b/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/types/SqlServerBinaryDbType.java
deleted file mode 100644
index 22bd4393a..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/types/SqlServerBinaryDbType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.sqlserver.types;
-
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.type.AbstractStructuredDbType;
-import org.mule.db.commons.internal.domain.type.DbType;
-
-import java.sql.CallableStatement;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-/**
- * {@link DbType} implementation of BINARY for SQL Server.
- *
- * SQL Server requires String values that are
- *
- * @since 1.1.0
- */
-public class SqlServerBinaryDbType extends AbstractStructuredDbType {
-
- public SqlServerBinaryDbType() {
- super(-2, "binary");
- }
-
- @Override
- public Object getParameterValue(CallableStatement statement, int index) throws SQLException {
- return super.getParameterValue(statement, index);
- }
-
- @Override
- public void setParameterValue(PreparedStatement statement, int index, Object value, DbConnection connection)
- throws SQLException {
- if (value instanceof String) {
- value = ((String) value).getBytes();
- }
- super.setParameterValue(statement, index, value, connection);
- }
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/types/SqlServerVarBinaryDbType.java b/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/types/SqlServerVarBinaryDbType.java
deleted file mode 100644
index 47bd5550c..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/sqlserver/types/SqlServerVarBinaryDbType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.connection.sqlserver.types;
-
-import org.mule.db.commons.internal.domain.connection.DbConnection;
-import org.mule.db.commons.internal.domain.type.AbstractStructuredDbType;
-import org.mule.db.commons.internal.domain.type.DbType;
-
-import java.sql.CallableStatement;
-import java.sql.PreparedStatement;
-import java.sql.SQLException;
-
-/**
- * {@link DbType} implementation of VARBINARY for SQL Server.
- *
- * SQL Server requires String values that are
- *
- * @since 1.1.0
- */
-public class SqlServerVarBinaryDbType extends AbstractStructuredDbType {
-
- public SqlServerVarBinaryDbType() {
- super(-3, "varbinary");
- }
-
- @Override
- public Object getParameterValue(CallableStatement statement, int index) throws SQLException {
- return super.getParameterValue(statement, index);
- }
-
- @Override
- public void setParameterValue(PreparedStatement statement, int index, Object value, DbConnection connection)
- throws SQLException {
- if (value instanceof String) {
- value = ((String) value).getBytes();
- }
- super.setParameterValue(statement, index, value, connection);
- }
-}
diff --git a/src/main/java/org/mule/extension/db/internal/domain/connection/teradata/TeradataConnectionProvider.java b/src/main/java/org/mule/extension/db/internal/domain/connection/teradata/TeradataConnectionProvider.java
index a0a4d2a1c..38619f755 100644
--- a/src/main/java/org/mule/extension/db/internal/domain/connection/teradata/TeradataConnectionProvider.java
+++ b/src/main/java/org/mule/extension/db/internal/domain/connection/teradata/TeradataConnectionProvider.java
@@ -10,7 +10,6 @@
import org.mule.db.commons.internal.domain.connection.DbConnection;
import org.mule.db.commons.internal.domain.connection.DbConnectionProvider;
import org.mule.db.commons.internal.domain.type.ResolvedDbType;
-import org.mule.extension.db.internal.domain.connection.mysql.MySqlConnectionParameters;
import org.mule.runtime.api.connection.ConnectionProvider;
import org.mule.runtime.extension.api.annotation.Alias;
import org.mule.runtime.extension.api.annotation.ExternalLib;
@@ -18,14 +17,12 @@
import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
import javax.sql.DataSource;
-import java.sql.Connection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import static java.util.Optional.empty;
import static java.util.Optional.ofNullable;
import static org.mule.extension.db.internal.util.MigrationUtils.mapDataSourceConfig;
-import static org.mule.runtime.api.meta.ExternalLibraryType.JAR;
import static org.mule.runtime.extension.api.annotation.param.ParameterGroup.CONNECTION;
/**
diff --git a/src/main/java/org/mule/extension/db/internal/domain/logger/MuleMySqlLoggerEnhancerFactory.java b/src/main/java/org/mule/extension/db/internal/domain/logger/MuleMySqlLoggerEnhancerFactory.java
deleted file mode 100644
index 2f2ce3686..000000000
--- a/src/main/java/org/mule/extension/db/internal/domain/logger/MuleMySqlLoggerEnhancerFactory.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com
- * The software in this package is published under the terms of the CPAL v1.0
- * license, a copy of which has been included with this distribution in the
- * LICENSE.txt file.
- */
-package org.mule.extension.db.internal.domain.logger;
-
-import net.sf.cglib.proxy.Enhancer;
-import net.sf.cglib.proxy.MethodInterceptor;
-import org.mule.extension.db.api.logger.MuleMySqlLogger;
-
-/**
- * Factory class that creates instances of {@link MuleMySqlLogger} wrapped by CGLIB's {@link Enhancer} implementing the
- * available Log interface (either com.mysql.cj.log.Log or com.mysql.jdbc.log.Log) at runtime and delegating the method
- * call to the passed instance.
- */
-public class MuleMySqlLoggerEnhancerFactory {
-
- public static final String MYSQL_DRIVER_CLASS = "com.mysql.jdbc.Driver";
- public static final String NEW_MYSQL_DRIVER_CLASS = "com.mysql.cj.jdbc.Driver";
- private ClassLoader classLoader;
- private MuleMySqlLogger delegatedLogger;
-
- public MuleMySqlLoggerEnhancerFactory(ClassLoader classLoader, MuleMySqlLogger delegatedLogger) {
- this.classLoader = classLoader;
- this.delegatedLogger = delegatedLogger;
- }
-
- public MuleMySqlLogger create() {
- Enhancer enhancer = new Enhancer();
-
- enhancer.setSuperclass(delegatedLogger.getClass());
- enhancer.setClassLoader(classLoader);
- enhancer.setInterfaces(new Class[] {getAvailableMySqlLogInterface()});
- enhancer
- .setCallback((MethodInterceptor) (obj, method, args, methodProxy) -> methodProxy.invoke(delegatedLogger, args));
-
- return (MuleMySqlLogger) enhancer.create(new Class[] {String.class}, new Object[] {"MySql"});
- }
-
- private Class> getAvailableMySqlLogInterface() {
- try {
- return classLoader.loadClass("com.mysql.cj.log.Log");
- } catch (ClassNotFoundException e) {
- try {
- return classLoader.loadClass("com.mysql.jdbc.log.Log");
- } catch (ClassNotFoundException ex) {
- throw new IllegalArgumentException("Neither class, com.mysql.cj.log.Log or com.mysql.jdbc.log.Log, were found. " +
- "An unsupported driver was provided.", ex);
- }
- }
- }
-
-}
diff --git a/src/test/java/org/mule/extension/db/CredentialsMaskUtilTestCase.java b/src/test/java/org/mule/extension/db/CredentialsMaskUtilTestCase.java
index b6c05ea4c..9f52f25a5 100644
--- a/src/test/java/org/mule/extension/db/CredentialsMaskUtilTestCase.java
+++ b/src/test/java/org/mule/extension/db/CredentialsMaskUtilTestCase.java
@@ -10,30 +10,19 @@
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mule.db.commons.internal.util.CredentialsMaskUtils.maskUrlUserAndPassword;
-import static org.mule.extension.db.internal.domain.connection.oracle.util.OracleCredentialsMaskUtils.maskUrlUserAndPasswordForOracle;
import org.junit.Test;
public class CredentialsMaskUtilTestCase {
private static final String URL_TEST =
- "jdbc:sqlserver://1.1.1.1:1443;databaseName=STAGING;user=mulesoftuser;password=mulesoftpass;";
+ "jdbc:teradata://1.1.1.1:1443;databaseName=STAGING;user=mulesoftuser;password=mulesoftpass;";
private static final String EXPECTED_URL_TEST_MASKED =
- "jdbc:sqlserver://1.1.1.1:1443;databaseName=STAGING;user=<>;password=<>;";
+ "jdbc:teradata://1.1.1.1:1443;databaseName=STAGING;user=<>;password=<>;";
@Test
public void whenUrlWithUserAndPasswordMaskUserPassword() {
String maskedUrl = maskUrlUserAndPassword(URL_TEST);
assertThat(maskedUrl, equalTo(EXPECTED_URL_TEST_MASKED));
}
-
- @Test
- public void maskOracleUserAndPasswordUrl() {
- String originalUrl = "jdbc:oracle:thin:secretUser/secretP@ssword@somehost.com:1521/sid";
- String expectedUrl = "jdbc:oracle:thin:<>/<>@somehost.com:1521/sid";
- String scapedUrl = maskUrlUserAndPasswordForOracle(originalUrl);
-
- assertThat(scapedUrl, is(expectedUrl));
- }
-
}
diff --git a/src/test/java/org/mule/extension/db/integration/DbArtifactClassLoaderRunnerConfig.java b/src/test/java/org/mule/extension/db/integration/DbArtifactClassLoaderRunnerConfig.java
index bbc8866d7..0d91c50e1 100644
--- a/src/test/java/org/mule/extension/db/integration/DbArtifactClassLoaderRunnerConfig.java
+++ b/src/test/java/org/mule/extension/db/integration/DbArtifactClassLoaderRunnerConfig.java
@@ -15,8 +15,7 @@
* @since 1.0
*/
@ArtifactClassLoaderRunnerConfig(
- applicationSharedRuntimeLibs = {"org.apache.derby:derby", "mysql:mysql-connector-java", "com.microsoft.sqlserver:mssql-jdbc",
- "com.oracle.database.jdbc:ojdbc8", "org.mule.connectors:mule-db-client", "com.experlog:xapool", "com.mchange:c3p0",
+ applicationSharedRuntimeLibs = {"org.mule.connectors:mule-db-client", "com.experlog:xapool", "com.mchange:c3p0",
"com.mchange:mchange-commons-java", "com.github.ben-manes.caffeine:caffeine", "org.apache.commons:commons-lang3",
"commons-collections:commons-collections", "commons-io:commons-io", "com.teradata:terajdbc4"})
public interface DbArtifactClassLoaderRunnerConfig {
diff --git a/src/test/java/org/mule/extension/db/integration/TestDbConfig.java b/src/test/java/org/mule/extension/db/integration/TestDbConfig.java
index bdeeda019..9713f6cc6 100644
--- a/src/test/java/org/mule/extension/db/integration/TestDbConfig.java
+++ b/src/test/java/org/mule/extension/db/integration/TestDbConfig.java
@@ -18,118 +18,20 @@
public class TestDbConfig {
static {
- USE_MYSQL = getValueFor("mysql");
- USE_MYSQL_OLD_DRIVER = getValueFor("mysql-old-version");
- USE_MSSQL_SERVER = getValueFor("mssql");
- USE_DERBY = getValueFor("derby");
- USE_ORACLE = getValueFor("oracle");
USE_TERADATA = getValueFor("teradata");
}
- private static boolean USE_DERBY;
-
- /**
- * Developer Note:
- * To run the MySQL tests you need to follow the following steps:
- *
- *
Set this USE_MYSQL flag to true
- *
Download a docker MySQL image: docker pull mysql
- *
Start the container docker run -p 3306:3306 --name some-mysql -e MYSQL_ROOT_PASSWORD=mysql -d mysql:latest
- *
- *
- * Alternately, you can enable the system property mysql.
- */
- private static boolean USE_MYSQL;
- private static boolean USE_MYSQL_OLD_DRIVER;
-
- /**
- * Developer Note:
- * To run the oracle tests you need to follow the following steps:
- *
- *
Set this USE_ORACLE flag to true
- *
Download a docker Oracle image: docker pull store/oracle/database-enterprise:12.2.0.1
- *
Start the container:docker run -d -it --name oracle-db -p 1521:1521 store/oracle/database-enterprise:12.2.0.1
- *
Install in your maven repository an oracle-jdbc-driver using the mvn install:install-file command
- *
Add the installed driver dependency to this project so the test can find it in the classpath
- *
Add the driver as a shared dependency on {@link DbArtifactClassLoaderRunnerConfig}
- *
- *
- * Alternately, you can enable the system property oracle, and follow just the steps five and six above.
- */
- private static boolean USE_ORACLE;
-
- /**
- * Developer Note:
- * To run the MsSQL tests you need to follow the following steps:
- *
- *
Set this USE_MSSQL_SERVER flag to true
- *
Download a docker MsSQL image: docker pull microsoft/mssql-server-linux
- *
Start the container: docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 -d microsoft/mssql-server-linux
- *
- *
- * Alternately, you can enable the system property mssql.
- */
- private static boolean USE_MSSQL_SERVER;
-
private static boolean USE_TERADATA;
public static List