This is an automated email from the ASF dual-hosted git repository. pinal pushed a commit to branch ATLAS-5021_u in repository https://gitbox.apache.org/repos/asf/atlas.git
commit 4673c9425eabad0ea93e0731bbf2e8277d51b469 Author: Pinal Shah <[email protected]> AuthorDate: Mon Aug 18 11:35:40 2025 +0530 ATLAS-5021: checkstyle changes --- addons/trino-extractor/pom.xml | 2 +- .../apache/atlas/trino/cli/ExtractorContext.java | 6 +++--- .../apache/atlas/trino/cli/ExtractorService.java | 17 +++++++---------- .../org/apache/atlas/trino/cli/TrinoExtractor.java | 6 +++--- .../atlas/trino/client/AtlasClientHelper.java | 15 ++++++--------- .../atlas/trino/client/TrinoClientHelper.java | 22 +++++++++++----------- .../trino/connector/AtlasEntityConnector.java | 6 +++--- .../atlas/trino/connector/ConnectorFactory.java | 6 +++--- .../atlas/trino/connector/HiveEntityConnector.java | 9 ++++----- .../trino/connector/IcebergEntityConnector.java | 9 ++++----- .../java/org/apache/atlas/trino/model/Catalog.java | 6 +++--- .../apache/atlas/trino/cli/TrinoExtractorIT.java | 1 - 12 files changed, 48 insertions(+), 57 deletions(-) diff --git a/addons/trino-extractor/pom.xml b/addons/trino-extractor/pom.xml index 70dcbcd5f..a7a66b937 100644 --- a/addons/trino-extractor/pom.xml +++ b/addons/trino-extractor/pom.xml @@ -36,7 +36,7 @@ <checkstyle.failOnViolation>true</checkstyle.failOnViolation> <checkstyle.skip>false</checkstyle.skip> </properties> - + <dependencies> <dependency> <groupId>ch.qos.logback</groupId> diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorContext.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorContext.java index 4cc14969a..23d483ae6 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorContext.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorContext.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorService.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorService.java index 554a32a21..695f6b3c1 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorService.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorService.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -21,7 +21,6 @@ import org.apache.atlas.AtlasServiceException; import org.apache.atlas.model.instance.AtlasEntity; import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo; import org.apache.atlas.model.instance.AtlasEntityHeader; -import org.apache.atlas.trino.client.AtlasClientHelper; import org.apache.atlas.trino.model.Catalog; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; @@ -41,12 +40,10 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; public class ExtractorService { + public static final int THREAD_POOL_SIZE = 5; + public static final int CATALOG_EXECUTION_TIMEOUT = 60; + public static final String TRINO_NAME_ATTRIBUTE = "name"; private static final Logger LOG = LoggerFactory.getLogger(ExtractorService.class); - - public static final int THREAD_POOL_SIZE = 5; - public static final int CATALOG_EXECUTION_TIMEOUT = 60; - public static final String TRINO_NAME_ATTRIBUTE = "name"; - private static final String TRINO_CATALOG_REGISTERED = "atlas.trino.catalogs.registered"; private static final String TRINO_CATALOG_HOOK_ENABLED_PREFIX = "atlas.trino.catalog.hook.enabled."; private static final String TRINO_CATALOG_HOOK_ENABLED_SUFFIX = ".namespace"; @@ -171,7 +168,7 @@ public class ExtractorService { } } - private void processTables(ExtractorContext context, Catalog catalog, String schemaName, AtlasEntity schemaEntity, Map<String, Map<String, Object>> trinoTables) { + private void processTables(ExtractorContext context, Catalog catalog, String schemaName, AtlasEntity schemaEntity, Map<String, Map<String, Object>> trinoTables) { for (String trinoTableName : trinoTables.keySet()) { LOG.info("Started extracting table: {}", trinoTableName); diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/TrinoExtractor.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/TrinoExtractor.java index df1bd7420..965e6bfdf 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/TrinoExtractor.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/TrinoExtractor.java @@ -104,8 +104,8 @@ public class TrinoExtractor { } else { LOG.info("Scheduling extraction for cron expression: {}", cronExpression); - JobDetail job = JobBuilder.newJob(MetadataJob.class).withIdentity("metadataJob", "group1").build(); - Trigger trigger = TriggerBuilder.newTrigger() + JobDetail job = JobBuilder.newJob(MetadataJob.class).withIdentity("metadataJob", "group1").build(); + Trigger trigger = TriggerBuilder.newTrigger() .withSchedule(CronScheduleBuilder.cronSchedule(cronExpression)).startNow() .build(); @@ -158,7 +158,7 @@ public class TrinoExtractor { Options acceptedCliOptions = prepareCommandLineOptions(); try { - CommandLine cmd = new BasicParser().parse(acceptedCliOptions, args, true); + CommandLine cmd = new BasicParser().parse(acceptedCliOptions, args, true); List<String> argsNotProcessed = cmd.getArgList(); if (argsNotProcessed != null && !argsNotProcessed.isEmpty()) { diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/client/AtlasClientHelper.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/client/AtlasClientHelper.java index 70e623847..9bc18c16c 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/client/AtlasClientHelper.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/client/AtlasClientHelper.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -48,8 +48,6 @@ import java.util.Set; import static org.apache.atlas.type.AtlasTypeUtil.ATTRIBUTE_QUALIFIED_NAME; public class AtlasClientHelper { - private static final Logger LOG = LoggerFactory.getLogger(AtlasClientHelper.class); - public static final String TRINO_INSTANCE = "trino_instance"; public static final String TRINO_CATALOG = "trino_catalog"; public static final String TRINO_SCHEMA = "trino_schema"; @@ -61,7 +59,7 @@ public class AtlasClientHelper { public static final String QUALIFIED_NAME_ATTRIBUTE = "qualifiedName"; public static final String NAME_ATTRIBUTE = "name"; public static final int DEFAULT_PAGE_LIMIT = 10000; - + private static final Logger LOG = LoggerFactory.getLogger(AtlasClientHelper.class); private static final String DEFAULT_ATLAS_URL = "http://localhost:21000/"; private static final String APPLICATION_PROPERTY_ATLAS_ENDPOINT = "atlas.rest.address"; private static final String TRINO_CATALOG_CONNECTOR_TYPE_ATTRIBUTE = "connectorType"; @@ -122,7 +120,7 @@ public class AtlasClientHelper { return entities; } - public AtlasEntityHeader getTrinoInstance(String namespace) { + public AtlasEntityHeader getTrinoInstance(String namespace) { try { return atlasClientV2.getEntityHeaderByAttribute(TRINO_INSTANCE, Collections.singletonMap(QUALIFIED_NAME_ATTRIBUTE, namespace)); } catch (AtlasServiceException e) { @@ -268,7 +266,6 @@ public class AtlasClientHelper { } } - private synchronized AtlasClientV2 getAtlasClientV2Instance(Configuration atlasConf) throws IOException { if (atlasClientV2 == null) { String[] atlasEndpoint = new String[] {DEFAULT_ATLAS_URL}; @@ -319,7 +316,7 @@ public class AtlasClientHelper { return entities; } - private AtlasEntityWithExtInfo toTableEntity(Catalog catalog, String schema, String table, Map<String, Object> tableMetadata, Map<String, Map<String, Object>> trinoColumns, AtlasEntity schemaEntity, AtlasEntityWithExtInfo tableEntityExt) { + private AtlasEntityWithExtInfo toTableEntity(Catalog catalog, String schema, String table, Map<String, Object> tableMetadata, Map<String, Map<String, Object>> trinoColumns, AtlasEntity schemaEntity, AtlasEntityWithExtInfo tableEntityExt) { if (tableEntityExt == null) { tableEntityExt = new AtlasEntityWithExtInfo(new AtlasEntity(TRINO_TABLE)); } diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/client/TrinoClientHelper.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/client/TrinoClientHelper.java index 2ef3f1499..fcb2595a8 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/client/TrinoClientHelper.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/client/TrinoClientHelper.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -45,9 +45,9 @@ public class TrinoClientHelper { Map<String, String> catalogs = new HashMap<>(); try (Connection connection = getTrinoConnection(); - Statement stmt = connection.createStatement()) { - String query = "SELECT catalog_name, connector_name FROM system.metadata.catalogs"; - ResultSet rs = stmt.executeQuery(query); + Statement stmt = connection.createStatement()) { + String query = "SELECT catalog_name, connector_name FROM system.metadata.catalogs"; + ResultSet rs = stmt.executeQuery(query); while (rs.next()) { catalogs.put(rs.getString("catalog_name"), rs.getString("connector_name")); @@ -60,10 +60,10 @@ public class TrinoClientHelper { } public List<String> getTrinoSchemas(String catalog, String schemaToImport) throws SQLException { - List<String> schemas = new ArrayList<>(); + List<String> schemas = new ArrayList<>(); try (Connection connection = getTrinoConnection(); - Statement stmt = connection.createStatement()) { + Statement stmt = connection.createStatement()) { StringBuilder query = new StringBuilder(); query.append("SELECT schema_name FROM ").append(catalog).append(".information_schema.schemata"); @@ -83,10 +83,10 @@ public class TrinoClientHelper { } public Map<String, Map<String, Object>> getTrinoTables(String catalog, String schema, String tableToImport) throws SQLException { - Map<String, Map<String, Object>> tables = new HashMap<>(); + Map<String, Map<String, Object>> tables = new HashMap<>(); try (Connection connection = getTrinoConnection(); - Statement stmt = connection.createStatement()) { + Statement stmt = connection.createStatement()) { StringBuilder query = new StringBuilder(); query.append("SELECT table_name, table_type FROM ").append(catalog).append(".information_schema.tables WHERE table_schema = '").append(schema).append("'"); @@ -114,7 +114,7 @@ public class TrinoClientHelper { Map<String, Map<String, Object>> columns = new HashMap<>(); try (Connection connection = getTrinoConnection(); - Statement stmt = connection.createStatement()) { + Statement stmt = connection.createStatement()) { StringBuilder query = new StringBuilder(); query.append("SELECT column_name, ordinal_position, column_default, is_nullable, data_type FROM ").append(catalog).append(".information_schema.columns WHERE table_schema = '").append(schema).append("' AND table_name = '").append(table).append("'"); diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/AtlasEntityConnector.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/AtlasEntityConnector.java index eec4a6736..fd6bf5974 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/AtlasEntityConnector.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/AtlasEntityConnector.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/ConnectorFactory.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/ConnectorFactory.java index f20205e29..d1d82414f 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/ConnectorFactory.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/ConnectorFactory.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/HiveEntityConnector.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/HiveEntityConnector.java index df54d05d4..7f75f6da6 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/HiveEntityConnector.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/HiveEntityConnector.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,8 +28,6 @@ import org.slf4j.LoggerFactory; import java.util.List; public class HiveEntityConnector extends AtlasEntityConnector { - private static final Logger LOG = LoggerFactory.getLogger(HiveEntityConnector.class); - public static final String HIVE_DB = "hive_db"; public static final String HIVE_TABLE = "hive_table"; public static final String HIVE_COLUMN = "hive_column"; @@ -39,6 +37,7 @@ public class HiveEntityConnector extends AtlasEntityConnector { public static final String TRINO_SCHEMA_HIVE_DB_ATTRIBUTE = "hive_db"; public static final String TRINO_TABLE_HIVE_TABLE_ATTRIBUTE = "hive_table"; public static final String TRINO_COLUMN_HIVE_COLUMN_ATTRIBUTE = "hive_column"; + private static final Logger LOG = LoggerFactory.getLogger(HiveEntityConnector.class); @Override public void connectTrinoCatalog(AtlasClientHelper atlasClient, String instanceName, String catalogName, AtlasEntity entity, AtlasEntityWithExtInfo entityWithExtInfo) { diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/IcebergEntityConnector.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/IcebergEntityConnector.java index 677c7834b..8c99f36f4 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/IcebergEntityConnector.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/connector/IcebergEntityConnector.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -28,8 +28,6 @@ import org.slf4j.LoggerFactory; import java.util.List; public class IcebergEntityConnector extends AtlasEntityConnector { - private static final Logger LOG = LoggerFactory.getLogger(IcebergEntityConnector.class); - public static final String HIVE_DB = "hive_db"; public static final String ICEBERG_TABLE = "iceberg_table"; public static final String ICEBERG_COLUMN = "iceberg_column"; @@ -39,6 +37,7 @@ public class IcebergEntityConnector extends AtlasEntityConnector { public static final String TRINO_SCHEMA_HIVE_DB_ATTRIBUTE = "hive_db"; public static final String TRINO_TABLE_ICEBERG_TABLE_ATTRIBUTE = "iceberg_table"; public static final String TRINO_COLUMN_ICEBERG_COLUMN_ATTRIBUTE = "iceberg_column"; + private static final Logger LOG = LoggerFactory.getLogger(IcebergEntityConnector.class); @Override public void connectTrinoCatalog(AtlasClientHelper atlasClient, String instanceName, String catalogName, AtlasEntity entity, AtlasEntityWithExtInfo entityWithExtInfo) { diff --git a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/model/Catalog.java b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/model/Catalog.java index 06bba2f48..cfeca6c78 100644 --- a/addons/trino-extractor/src/main/java/org/apache/atlas/trino/model/Catalog.java +++ b/addons/trino-extractor/src/main/java/org/apache/atlas/trino/model/Catalog.java @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. diff --git a/addons/trino-extractor/src/test/java/org/apache/atlas/trino/cli/TrinoExtractorIT.java b/addons/trino-extractor/src/test/java/org/apache/atlas/trino/cli/TrinoExtractorIT.java index 7e94f381b..2fa6f634f 100644 --- a/addons/trino-extractor/src/test/java/org/apache/atlas/trino/cli/TrinoExtractorIT.java +++ b/addons/trino-extractor/src/test/java/org/apache/atlas/trino/cli/TrinoExtractorIT.java @@ -38,5 +38,4 @@ public class TrinoExtractorIT { Rename catalog Rename schema Tag propagated*/ - }
