diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/connectionChecker/ConnectionChecker.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/connectionChecker/ConnectionChecker.java index d391636c28..5704b03d07 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/connectionChecker/ConnectionChecker.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/connectionChecker/ConnectionChecker.java @@ -19,22 +19,16 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; import com.logicalclocks.servicediscoverclient.exceptions.ServiceDiscoveryException; -import io.hops.hopsworks.common.cloud.TemporaryCredentialsHelper; import io.hops.hopsworks.common.featurestore.OptionDTO; import io.hops.hopsworks.common.featurestore.storageconnectors.FeaturestoreStorageConnectorDTO; -import io.hops.hopsworks.common.featurestore.storageconnectors.bigquery.FeaturestoreBigqueryConnectorController; -import io.hops.hopsworks.common.featurestore.storageconnectors.gcs.FeatureStoreGcsConnectorController; import io.hops.hopsworks.common.featurestore.storageconnectors.jdbc.FeaturestoreJdbcConnectorController; import io.hops.hopsworks.common.featurestore.storageconnectors.jdbc.FeaturestoreJdbcConnectorDTO; -import io.hops.hopsworks.common.featurestore.storageconnectors.redshift.FeaturestoreRedshiftConnectorController; -import io.hops.hopsworks.common.featurestore.storageconnectors.s3.FeaturestoreS3ConnectorController; import io.hops.hopsworks.common.featurestore.storageconnectors.snowflake.FeaturestoreSnowflakeConnectorController; import io.hops.hopsworks.common.featurestore.storageconnectors.snowflake.FeaturestoreSnowflakeConnectorDTO; import io.hops.hopsworks.common.hdfs.DistributedFileSystemOps; import io.hops.hopsworks.common.hdfs.DistributedFsService; import io.hops.hopsworks.common.hdfs.HdfsUsersController; import io.hops.hopsworks.common.proxies.client.HttpClient; - import io.hops.hopsworks.common.util.OSProcessExecutor; import io.hops.hopsworks.common.util.ProcessDescriptor; import io.hops.hopsworks.common.util.ProcessResult; @@ -42,13 +36,11 @@ import io.hops.hopsworks.common.util.Settings; import io.hops.hopsworks.exceptions.FeaturestoreException; import io.hops.hopsworks.persistence.entity.featurestore.Featurestore; - import io.hops.hopsworks.persistence.entity.project.Project; import io.hops.hopsworks.persistence.entity.user.Users; import io.hops.hopsworks.restutils.RESTCodes; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.file.PathUtils; - import org.opensearch.common.Strings; import javax.annotation.PostConstruct; @@ -56,10 +48,8 @@ import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; - import java.io.File; import java.io.IOException; - import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -84,16 +74,6 @@ public class ConnectionChecker { @EJB private HttpClient httpClient; @EJB - private FeaturestoreRedshiftConnectorController featurestoreRedshiftConnectorController; - @EJB - private FeaturestoreS3ConnectorController featurestoreS3ConnectorController; - @EJB - private FeaturestoreBigqueryConnectorController featurestoreBigqueryConnectorController; - @EJB - private FeatureStoreGcsConnectorController featureStoreGcsConnectorController; - @EJB - private TemporaryCredentialsHelper temporaryCredentialsHelper; - @EJB private DistributedFsService dfs; @EJB private HdfsUsersController hdfsUsersController; @@ -130,6 +110,7 @@ public ConnectionCheckerDTO checkConnection(Users user, Project project, Feature break; case JDBC: FeaturestoreJdbcConnectorDTO dto = (FeaturestoreJdbcConnectorDTO) storageConnectorDto; + featurestoreJdbcConnectorController.validationDTO(dto); List optionsList = dto.getArguments(); if (!optionsList.isEmpty()) { // append arguments as query parameters to connection string @@ -171,7 +152,7 @@ public ConnectionCheckerDTO checkConnection(Users user, Project project, Feature } } - private static String getQueryParamsUrl(List optionsList, String connectionString) { + private String getQueryParamsUrl(List optionsList, String connectionString) { StringJoiner sj; if (connectionString.contains("?")) { sj = new StringJoiner("&", "&", ""); diff --git a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/jdbc/FeaturestoreJdbcConnectorController.java b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/jdbc/FeaturestoreJdbcConnectorController.java index 397f727f34..fd3f2e08e0 100644 --- a/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/jdbc/FeaturestoreJdbcConnectorController.java +++ b/hopsworks-common/src/main/java/io/hops/hopsworks/common/featurestore/storageconnectors/jdbc/FeaturestoreJdbcConnectorController.java @@ -258,7 +258,7 @@ private FeaturestoreJdbcConnector createOrUpdateJdbcConnector(Users user, Featur * @return List * @throws FeaturestoreException */ - private List validationDTO(FeaturestoreJdbcConnectorDTO featurestoreJdbcConnectorDTO) + public List validationDTO(FeaturestoreJdbcConnectorDTO featurestoreJdbcConnectorDTO) throws FeaturestoreException { verifyJdbcConnectorConnectionString(featurestoreJdbcConnectorDTO.getConnectionString()); List arguments = featurestoreJdbcConnectorDTO.getArguments();