bug TDI-22580 fixed : Hbase connection wizard: No db type and version option

git-svn-id: http://talendforge.org/svn/tos/trunk@93127 f6f1c999-d317-4740-80b0-e6d1abc6f99e
This commit is contained in:
ycbai
2012-11-01 07:49:23 +00:00
parent 0804619f5b
commit a8f36215fe
8 changed files with 947 additions and 570 deletions

View File

@@ -27,26 +27,33 @@ public class ConnParameterKeys {
/**
* The key is used for Hive Mode to store its value.
*/
public static final String CONN_PARA_KEY_HIVE_MODE = "CONN_PARA_KEY_HIVE_MODE";
public static final String CONN_PARA_KEY_HIVE_MODE = "CONN_PARA_KEY_HIVE_MODE"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_HIVE_DISTRIBUTION = "CONN_PARA_KEY_HIVE_DISTRIBUTION";
public static final String CONN_PARA_KEY_HIVE_DISTRIBUTION = "CONN_PARA_KEY_HIVE_DISTRIBUTION"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_HIVE_VERSION = "CONN_PARA_KEY_HIVE_VERSION";
public static final String CONN_PARA_KEY_HIVE_VERSION = "CONN_PARA_KEY_HIVE_VERSION"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_CHARACTER_ENCODING = "CONN_PARA_KEY_CHARACTER_ENCODING"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_NAME_NODE_URL = "CONN_PARA_KEY_NAME_NODE_URL"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_JOB_TRACKER_URL = "CONN_PARA_KEY_JOB_TRACKER_URL"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_METASTORE_CONN_URL = "CONN_PARA_KEY_METASTORE_CONN_URL"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_METASTORE_CONN_USERNAME = "CONN_PARA_KEY_METASTORE_CONN_USERNAME"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_METASTORE_CONN_PASSWORD = "CONN_PARA_KEY_METASTORE_CONN_PASSWORD"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR = "CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_METASTORE_CONN_DRIVER_NAME = "CONN_PARA_KEY_METASTORE_CONN_DRIVER_NAME"; //$NON-NLS-1$
/**
* keys used for Hadoop settings.
*/
public static final String CONN_PARA_KEY_HBASE_DISTRIBUTION = "CONN_PARA_KEY_HBASE_DISTRIBUTION"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_HBASE_VERSION = "CONN_PARA_KEY_HBASE_VERSION"; //$NON-NLS-1$
public static final String CONN_PARA_KEY_CHARACTER_ENCODING = "CONN_PARA_KEY_CHARACTER_ENCODING";
public static final String CONN_PARA_KEY_NAME_NODE_URL = "CONN_PARA_KEY_NAME_NODE_URL";
public static final String CONN_PARA_KEY_JOB_TRACKER_URL = "CONN_PARA_KEY_JOB_TRACKER_URL";
public static final String CONN_PARA_KEY_METASTORE_CONN_URL = "CONN_PARA_KEY_METASTORE_CONN_URL";
public static final String CONN_PARA_KEY_METASTORE_CONN_USERNAME = "CONN_PARA_KEY_METASTORE_CONN_USERNAME";
public static final String CONN_PARA_KEY_METASTORE_CONN_PASSWORD = "CONN_PARA_KEY_METASTORE_CONN_PASSWORD";
public static final String CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR = "CONN_PARA_KEY_METASTORE_CONN_DRIVER_JAR";
public static final String CONN_PARA_KEY_METASTORE_CONN_DRIVER_NAME = "CONN_PARA_KEY_METASTORE_CONN_DRIVER_NAME";
}

View File

@@ -0,0 +1,112 @@
// ============================================================================
//
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.database.hbase.conn.version;
import java.util.ArrayList;
import java.util.List;
/**
* DOC ycbai class global comment. Detailled comment
*/
public enum EHBaseDistribution4Versions {
HDP_1_0(EHBaseDistributions.HORTONWORKS, "Hortonworks Data Platform V1", "HDP_1_0"),
APACHE_1_0_0(EHBaseDistributions.APACHE, "Apache 1.0.0", "APACHE_1_0_0"),
APACHE_0_20_204(EHBaseDistributions.APACHE, "Apache 0.20.203", "APACHE_0_20_203"),
CLOUDERA_CDH4(EHBaseDistributions.CLOUDERA, "Cloudera CDH4", "Cloudera_CDH4"),
MAPR(EHBaseDistributions.MAPR, "MapR 2.0.0", "MAPR2");
private EHBaseDistributions distribution;
private String versionDisplayName;
private String versionValue;
EHBaseDistribution4Versions(EHBaseDistributions distribution, String versionDisplayName, String versionValue) {
this.distribution = distribution;
this.versionDisplayName = versionDisplayName;
this.versionValue = versionValue;
}
public static List<EHBaseDistribution4Versions> indexOfByDistribution(String distribution) {
List<EHBaseDistribution4Versions> distribution4Versions = new ArrayList<EHBaseDistribution4Versions>();
if (distribution != null) {
for (EHBaseDistribution4Versions d4v : EHBaseDistribution4Versions.values()) {
if (d4v.getDistribution().getName().equals(distribution)
|| d4v.getDistribution().getDisplayName().equals(distribution)) {
distribution4Versions.add(d4v);
}
}
}
return distribution4Versions;
}
public static EHBaseDistribution4Versions indexOfByVersionDisplay(String displayName) {
return indexOf(displayName, true);
}
public static EHBaseDistribution4Versions indexOfByVersion(String value) {
return indexOf(value, false);
}
private static EHBaseDistribution4Versions indexOf(String name, boolean display) {
if (name != null) {
for (EHBaseDistribution4Versions version : EHBaseDistribution4Versions.values()) {
if (display) {
if (name.equalsIgnoreCase(version.getVersionDisplayName())) {
return version;
}
} else {
if (name.equalsIgnoreCase(version.getVersionValue())) {
return version;
}
}
}
}
return null;
}
public static List<String> getHadoopDistributionVersions(String distribution) {
return getHadoopDistributionVersions(distribution, true);
}
public static List<String> getHadoopDistributionVersions(String distribution, boolean display) {
List<String> result = new ArrayList<String>();
List<EHBaseDistribution4Versions> d4vList = EHBaseDistribution4Versions.indexOfByDistribution(distribution);
for (EHBaseDistribution4Versions d4v : d4vList) {
if (display) {
result.add(d4v.getVersionDisplayName());
} else {
result.add(d4v.getVersionValue());
}
}
return result;
}
public EHBaseDistributions getDistribution() {
return this.distribution;
}
public String getVersionDisplayName() {
return this.versionDisplayName;
}
public String getVersionValue() {
return this.versionValue;
}
}

View File

@@ -0,0 +1,84 @@
// ============================================================================
//
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
//
// This source code is available under agreement available at
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
//
// You should have received a copy of the agreement
// along with this program; if not, write to Talend SA
// 9 rue Pages 92150 Suresnes, France
//
// ============================================================================
package org.talend.core.database.hbase.conn.version;
import java.util.ArrayList;
import java.util.List;
/**
* DOC ycbai class global comment. Detailled comment
*/
public enum EHBaseDistributions {
HORTONWORKS("HortonWorks"),
CLOUDERA("Cloudera"),
MAPR("MapR"),
APACHE("Apache");
private String displayName;
EHBaseDistributions(String displayName) {
this.displayName = displayName;
}
public String getName() {
return name();
}
public String getDisplayName() {
return this.displayName;
}
public static List<String> getAllDistributionDisplayNames() {
return getAllDistributionNames(true);
}
public static List<String> getAllDistributionNames(boolean display) {
List<String> names = new ArrayList<String>();
EHBaseDistributions[] values = values();
for (EHBaseDistributions distribution : values) {
if (display) {
names.add(distribution.getDisplayName());
} else {
names.add(distribution.getName());
}
}
return names;
}
public static EHBaseDistributions getDistributionByDisplayName(String name) {
return getDistributionByName(name, true);
}
public static EHBaseDistributions getDistributionByName(String name, boolean display) {
if (name != null) {
for (EHBaseDistributions distribution : values()) {
if (display) {
if (name.equalsIgnoreCase(distribution.getDisplayName())) {
return distribution;
}
} else {
if (name.equalsIgnoreCase(distribution.getName())) {
return distribution;
}
}
}
}
return null;
}
}

View File

@@ -26,7 +26,6 @@ import org.eclipse.emf.common.util.EList;
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
import org.talend.commons.ui.utils.PathUtils;
import org.talend.core.GlobalServiceRegister;
import org.talend.core.database.EDatabase4DriverClassName;
import org.talend.core.database.EDatabaseTypeName;
import org.talend.core.database.conn.ConnParameterKeys;
import org.talend.core.database.conn.template.EDatabaseConnTemplate;
@@ -1096,6 +1095,15 @@ public class RepositoryToComponentProperty {
if (value.equals("CONNECTION_MODE")) {
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HIVE_MODE);
}
if (value.equals("HBASE_DISTRIBUTION")) {
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_DISTRIBUTION);
}
if (value.equals("HBASE_VERSION")) {
return connection.getParameters().get(ConnParameterKeys.CONN_PARA_KEY_HBASE_VERSION);
}
return null;
}

View File

@@ -340,7 +340,6 @@ public final class RepositoryComponentManager {
List<IComponent> exceptedComponents = new ArrayList<IComponent>();
for (IComponent component : components) {
//
for (RepositoryComponentDndFilterSetting dndFilter : getDndFilterSettings()) {
IRepositoryComponentDndFilter filter = dndFilter.getFilter();
if (filter == null) {