Skip to content

Commit

Permalink
[FSTORE-920][APPEND] remove unsued AWS/GCP imports and add JDBC DTO v…
Browse files Browse the repository at this point in the history
…alidation (#1770)

(cherry picked from commit c0a5d7c)
  • Loading branch information
dhananjay-mk committed May 7, 2024
1 parent 4e82d05 commit da939b3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,37 @@
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;
import io.hops.hopsworks.common.util.ProjectUtils;
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;
import javax.ejb.EJB;
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;
Expand All @@ -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;
Expand Down Expand Up @@ -130,6 +110,7 @@ public ConnectionCheckerDTO checkConnection(Users user, Project project, Feature
break;
case JDBC:
FeaturestoreJdbcConnectorDTO dto = (FeaturestoreJdbcConnectorDTO) storageConnectorDto;
featurestoreJdbcConnectorController.validationDTO(dto);
List<OptionDTO> optionsList = dto.getArguments();
if (!optionsList.isEmpty()) {
// append arguments as query parameters to connection string
Expand Down Expand Up @@ -171,7 +152,7 @@ public ConnectionCheckerDTO checkConnection(Users user, Project project, Feature
}
}

private static String getQueryParamsUrl(List<OptionDTO> optionsList, String connectionString) {
private String getQueryParamsUrl(List<OptionDTO> optionsList, String connectionString) {
StringJoiner sj;
if (connectionString.contains("?")) {
sj = new StringJoiner("&", "&", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ private FeaturestoreJdbcConnector createOrUpdateJdbcConnector(Users user, Featur
* @return List<OptionDTO>
* @throws FeaturestoreException
*/
private List<OptionDTO> validationDTO(FeaturestoreJdbcConnectorDTO featurestoreJdbcConnectorDTO)
public List<OptionDTO> validationDTO(FeaturestoreJdbcConnectorDTO featurestoreJdbcConnectorDTO)
throws FeaturestoreException {
verifyJdbcConnectorConnectionString(featurestoreJdbcConnectorDTO.getConnectionString());
List<OptionDTO> arguments = featurestoreJdbcConnectorDTO.getArguments();
Expand Down

0 comments on commit da939b3

Please sign in to comment.