///**
// * 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.
// */
//
//package org.apache.atlas.mysql.bridge;
//
//import com.google.common.annotations.VisibleForTesting;
//import com.google.common.hash.Hashing;
//import com.sun.jersey.api.client.ClientResponse;
//import jline.internal.Log;
//import org.apache.atlas.ApplicationProperties;
//import org.apache.atlas.AtlasClientV2;
//import org.apache.atlas.AtlasServiceException;
//import org.apache.atlas.hook.AtlasHookException;
//import org.apache.atlas.model.instance.*;
//import org.apache.atlas.mysql.model.MysqlDataTypes;
//import org.apache.atlas.utils.AuthenticationUtil;
//import org.apache.atlas.model.instance.AtlasEntity.AtlasEntityWithExtInfo;
//import org.apache.atlas.model.instance.AtlasEntity.AtlasEntitiesWithExtInfo;
//import org.apache.commons.cli.ParseException;
//import org.apache.commons.collections.CollectionUtils;
//
//import org.apache.commons.cli.BasicParser;
//import org.apache.commons.cli.CommandLine;
//import org.apache.commons.cli.Options;
//import org.apache.commons.collections.MapUtils;
//import org.apache.commons.configuration.Configuration;
//import org.apache.commons.lang.StringUtils;
//import org.apache.hadoop.security.UserGroupInformation;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import java.io.BufferedReader;
//import java.io.File;
//import java.io.FileReader;
//import java.io.IOException;
//import java.text.SimpleDateFormat;
//import java.util.*;
//
//import static org.apache.atlas.mysql.hook.events.BaseMysqlEvent.*;
//
///**
// * A Bridge Utility that imports metadata from the Hive Meta Store
// * and registers them in Atlas.
// */
//
//public class MysqlMetaStoreBridgeBak {
// private static final Logger LOG = LoggerFactory.getLogger(MysqlMetaStoreBridgeBak.class);
//
// public static final String CONF_PREFIX = "atlas.hook.mysql.";
// public static final String HIVE_CLUSTER_NAME = "atlas.cluster.name";
// public static final String HDFS_PATH_CONVERT_TO_LOWER_CASE = CONF_PREFIX + "hdfs_path.convert_to_lowercase";
// public static final String DEFAULT_CLUSTER_NAME = "mysql";
// public static final String ATLAS_ENDPOINT = "atlas.rest.address";
// public static final String HDFS_PATH = "hdfs_path";
//
// private static final int EXIT_CODE_SUCCESS = 0;
// private static final int EXIT_CODE_FAILED = 1;
// private static final String DEFAULT_ATLAS_URL = "http://localhost:21000/";
//
// private String clusterName;
// private final AtlasClientV2 atlasClientV2;
// private final boolean convertHdfsPathToLowerCase;
//
//
// public static void main(String[] args) {
// int exitCode = EXIT_CODE_FAILED;
// AtlasClientV2 atlasClientV2 = null;
// BufferedReader br = null;
//
// try {
//
// Options options = new Options();
// options.addOption("d", "database", true, "Database name");
// options.addOption("t", "table", true, "Table name");
// options.addOption("c", "databaseconfFile", true, "Table name");
// options.addOption("f", "filename", true, "Filename");
// options.addOption("failOnError", false, "failOnError");
//
// CommandLine cmd = new BasicParser().parse(options, args);
// boolean failOnError = cmd.hasOption("failOnError");
// String databaseToImport = cmd.getOptionValue("d");
// String dbConfFile = cmd.getOptionValue("c");
// String tableToImport = cmd.getOptionValue("t");
// String fileToImport = cmd.getOptionValue("f");
// Configuration atlasConf = ApplicationProperties.get();
// String[] atlasEndpoint = atlasConf.getStringArray(ATLAS_ENDPOINT);
//
// if (atlasEndpoint == null || atlasEndpoint.length == 0) {
// atlasEndpoint = new String[] { DEFAULT_ATLAS_URL };
// }
//
// Log.info(atlasConf);
//
// if (!AuthenticationUtil.isKerberosAuthenticationEnabled()) {
//
// String[] basicAuthUsernamePassword = new String[]{"admin", "admin"} ;//AuthenticationUtil.getBasicAuthenticationInput();
// atlasClientV2 = new AtlasClientV2(atlasEndpoint, basicAuthUsernamePassword);
// } else {
//
// UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
// atlasClientV2 = new AtlasClientV2(ugi, ugi.getShortUserName(), atlasEndpoint);
// }
//
// MysqlMetaStoreBridge mysqlMetaStoreBridge = new MysqlMetaStoreBridge(atlasConf, atlasClientV2);
//
// HashMap<String,HashMap<String,String>> datasource = new HashMap<>();
// HashMap<String,String> entyMap = new HashMap<>();
//
// fileToImport = dbConfFile;
// if (StringUtils.isNotEmpty(fileToImport)) {
// File f = new File(fileToImport);
// System.out.println("klida: " + f.getAbsolutePath());
// if (!f.exists() || !f.canRead()) {
// LOG.error("Failed to read the mysql conf file : " + fileToImport);
// return;
// }
// }
//
// br = new BufferedReader(new FileReader(new File(fileToImport)));
// String line = null;
//
// while((line = br.readLine()) != null) {
// if(line.startsWith("#") || line.isEmpty() || line.toUpperCase().contains("_SQOOP_")){
// continue;
// }
// //System.out.println(line);
// datasource = pareConfline(line ,datasource);
// }
//
// mysqlMetaStoreBridge.importMysqlMetadata(datasource);
//
// exitCode = EXIT_CODE_SUCCESS;
//
// } catch(ParseException e) {
// LOG.error("Failed to parse arguments. Error: ", e.getMessage());
// printUsage();
// } catch(Exception e) {
// LOG.error("Import failed", e);
// } finally {
// if( br !=null) {
// try {
// br.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// if( atlasClientV2 !=null) {
// atlasClientV2.close();
// }
// }
// System.exit(exitCode);
//
// }
//
// private void importMysqlMetadata(HashMap<String, HashMap<String, String>> datasourceMap) throws Exception {
//
// clusterName = "mysql";
// for (Map.Entry<String, HashMap<String,String>> entry : datasourceMap.entrySet()) {
// System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
// AtlasEntityWithExtInfo dbEntity = null;
//
// try {
// dbEntity = importDSandDb("rdbms", entry.getValue().get("DB"), entry.getValue().get("DSNAME"),
// entry.getValue().get("IP"), entry.getValue().get("PORT"), entry.getValue().get("USER"),
//
没有合适的资源?快使用搜索试试~ 我知道了~
资源详情
资源评论
资源推荐
收起资源包目录
mysql-bridge.zip (24个子文件)
mysql-bridge
.DS_Store 6KB
src
.DS_Store 6KB
patches
001-hive_column_add_position.json 0B
test
resources
users-credentials.properties 207B
atlas-application.properties 4KB
atlas-log4j.xml 5KB
main
.DS_Store 6KB
resources
log4.xml 2KB
atlas-application.properties 11KB
atlas-application.properties_test 11KB
java
org
apache
atlas
mysql
model
Column.java 3KB
MysqlDataTypes.java 1KB
ExclueType.java 1KB
Tables.java 3KB
DbType.java 3KB
util
EntityProcess.java 7KB
MailUtils.java 8KB
hook
events
BaseMysqlEvent.java 10KB
bridge
MysqlMetaStoreBridgeBak.java 41KB
MysqlMetaStoreBridge.java 33KB
JdbcConnnect.java 7KB
bin
import-mysql.sh 4KB
pom.xml 25KB
mysql-bridge.iml 50KB
共 24 条
- 1
htmljsp
- 粉丝: 40
- 资源: 28
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Image_1713714819368.png
- 数据可视化 matplotlib 实例.docx
- Python 使用 Matplotlib 绘制甘特图的实践.docx
- matplotlib 中的 cmap 参数介绍.docx
- 基于matlab的毕业设计基于Matlab使用LQR实现车辆轨迹跟踪源码.zip
- 基于Matplotlib 的高互动性可视化系统设计与实现
- matplotlib 数据可视化报告.docx
- 传统网页UI设计在移动应用开发中的应用研究.pdf
- 基于pytorch实现BERT+BiLSTM+CRF实现中文命名实体识别源码.zip
- 校园帮项目,毕业设计/课程设计/javaWeb/SSM
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0