public static ClassLoader getClassLoader(IMetadataConnection metadataConnection) { ClassLoader loader = null; if (metadataConnection != null) { String clusterId = (String) metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CLUSTER_ID); String distribution = (String) metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HBASE_DISTRIBUTION); if (EHBaseDistributions.CUSTOM.getName().equals(distribution)) { return getCustomClassLoader(metadataConnection); } String version = (String) metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HBASE_VERSION); if (StringUtils.isNotEmpty(distribution) && StringUtils.isNotEmpty(version)) { boolean useKrb = Boolean.valueOf( (String) metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_USE_KRB)); loader = HadoopClassLoaderFactory2.getHBaseClassLoader(clusterId, distribution, version, useKrb); } } if (loader == null) { loader = HBaseClassLoaderFactory.class.getClassLoader(); } return loader; }
private static ClassLoader getCustomClassLoader(IMetadataConnection metadataConnection) { String hcId = metadataConnection.getId(); String index = "HadoopCustomVersion:HBase:" + hcId; // $NON-NLS-1$ return HadoopClassLoaderFactory2.getHadoopCustomClassLoader( index, metadataConnection.getParameter(ConnParameterKeys.CONN_PARA_KEY_HADOOP_CUSTOM_JARS)); }