mneethiraj commented on code in PR #428: URL: https://github.com/apache/atlas/pull/428#discussion_r2296741338
########## addons/trino-extractor/src/main/conf/atlas-application.properties: ########## @@ -0,0 +1,32 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +######## Atlas connection ############ +atlas.rest.address=http://localhost:21000/ + +######## Trino connection ############ +atlas.trino.jdbc.address=jdbc:trino://<host>:<port>/ Review Comment: Consider using a different configuration file, like `atlas-trino-extractor.properties`. This will require minor enhancement in existing `ApplicationProperties.java`, to look for property file name via JVM argument; I suggest tracking `ApplicationProperties.java` updates in a separate PR/JIRA. ``` String propertyFilename = System.getProperty("atlas.properties", "application.properties"); set(get(propertyFilename)); ``` ########## addons/trino-extractor/src/main/conf/atlas-log4j.xml: ########## @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8" ?> Review Comment: Consider using a different log configuration filename, like `atlas-trino-log4j.xml`, and have this name sent via JVM command-line argument `-Dlog4j.configuration=atlas-trino-log4j.xml`. BTW, we switched to using logback. Any reason to continue using log4j? ########## addons/trino-extractor/src/main/java/org/apache/atlas/trino/cli/ExtractorContext.java: ########## @@ -0,0 +1,106 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.atlas.trino.cli; + +import org.apache.atlas.ApplicationProperties; +import org.apache.atlas.AtlasException; +import org.apache.atlas.trino.client.AtlasClientHelper; +import org.apache.atlas.trino.client.TrinoClientHelper; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.configuration.Configuration; + +import java.io.IOException; + +public class ExtractorContext { + static final String TRINO_NAMESPACE_CONF = "atlas.trino.namespace"; + static final String DEFAULT_TRINO_NAMESPACE = "cm"; + static final String OPTION_CATALOG_SHORT = "c"; + static final String OPTION_CATALOG_LONG = "catalog"; + static final String OPTION_SCHEMA_SHORT = "s"; + static final String OPTION_SCHEMA_LONG = "schema"; + static final String OPTION_TABLE_SHORT = "t"; + static final String OPTION_TABLE_LONG = "table"; + static final String OPTION_CRON_EXPRESSION_SHORT = "cx"; + static final String OPTION_CRON_EXPRESSION_LONG = "cronExpression"; + static final String OPTION_HELP_SHORT = "h"; + static final String OPTION_HELP_LONG = "help"; + + private final Configuration atlasConf; + private final String namespace; + private final String catalog; + private final String schema; + private final String table; + private final AtlasClientHelper atlasClientHelper; + private final TrinoClientHelper trinoClientHelper; + private final String cronExpression; + + public ExtractorContext(CommandLine cmd) throws AtlasException, IOException { + this.atlasConf = getAtlasProperties(); + this.atlasClientHelper = createAtlasClientHelper(); + this.trinoClientHelper = createTrinoClientHelper(); + this.namespace = atlasConf.getString(TRINO_NAMESPACE_CONF, DEFAULT_TRINO_NAMESPACE); + this.catalog = cmd.getOptionValue(OPTION_CATALOG_SHORT); Review Comment: I think it should be possible to set all configurations (catalog, schema, table, cronExpression) in atlas-trino-extractor-properties file. It should be possible to overrider them via command-line arguments. ``` atlas.trino.extractor.catalog= atlas.trino.extractor.schema= atlas.trino.extractor.table= atlas.trino.extractor.schedule= ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@atlas.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org