private void setHCatalogRepositoryValue( HCatalogConnection connection, INode node, IElementParameter param) { if (EHCatalogRepositoryToComponent.DISTRIBUTION .getRepositoryValue() .equals(param.getRepositoryValue())) { String value = ComponentToRepositoryProperty.getParameterValue(connection, node, param); if (value != null) { connection.setDistribution(value); } } else if (EHCatalogRepositoryToComponent.HCAT_VERSION .getRepositoryValue() .equals(param.getRepositoryValue())) { String value = ComponentToRepositoryProperty.getParameterValue(connection, node, param); if (value != null) { connection.setHcatVersion(value); } } else if (EHCatalogRepositoryToComponent.TEMPLETON_HOST .getRepositoryValue() .equals(param.getRepositoryValue())) { String value = ComponentToRepositoryProperty.getParameterValue(connection, node, param); if (value != null) { connection.setHostName(value); } } else if (EHCatalogRepositoryToComponent.TEMPLETON_PORT .getRepositoryValue() .equals(param.getRepositoryValue())) { String value = ComponentToRepositoryProperty.getParameterValue(connection, node, param); if (value != null) { connection.setPort(value); } } else if (EHCatalogRepositoryToComponent.DATABASE_NAME .getRepositoryValue() .equals(param.getRepositoryValue())) { String value = ComponentToRepositoryProperty.getParameterValue(connection, node, param); if (value != null) { connection.setDatabase(value); } } else if (EHCatalogRepositoryToComponent.USERNAME .getRepositoryValue() .equals(param.getRepositoryValue())) { String value = ComponentToRepositoryProperty.getParameterValue(connection, node, param); if (value != null) { connection.setUserName(value); } } }
private Object getHCatalogRepositoryValue( HCatalogConnection connection, String value, IMetadataTable table, String targetComponent) { HadoopClusterConnection hcConnection = HCRepositoryUtil.getRelativeHadoopClusterConnection(connection); if (hcConnection == null) { return null; } if (EHCatalogRepositoryToComponent.DISTRIBUTION.getRepositoryValue().equals(value)) { return hcConnection.getDistribution(); } else if (EHCatalogRepositoryToComponent.HCAT_VERSION.getRepositoryValue().equals(value)) { return hcConnection.getDfVersion(); } else if (EHCatalogRepositoryToComponent.TEMPLETON_HOST.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getHostName())); } else if (EHCatalogRepositoryToComponent.TEMPLETON_PORT.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getPort())); } else if (EHCatalogRepositoryToComponent.USE_KRB.getRepositoryValue().equals(value)) { return hcConnection.isEnableKerberos(); } else if (EHCatalogRepositoryToComponent.KRB_PRINC.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getKrbPrincipal())); } else if (EHCatalogRepositoryToComponent.KRB_REALM.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getKrbRealm())); } else if (EHCatalogRepositoryToComponent.NAMENODE_PRINCIPAL .getRepositoryValue() .equals(value)) { return getRepositoryValueOfStringType( hcConnection, StringUtils.trimToNull(hcConnection.getPrincipal())); } else if (EHCatalogRepositoryToComponent.USE_KEYTAB.getRepositoryValue().equals(value)) { return hcConnection.isUseKeytab(); } else if (EHCatalogRepositoryToComponent.KEYTAB_PRINCIPAL.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( hcConnection, StringUtils.trimToNull(hcConnection.getKeytabPrincipal())); } else if (EHCatalogRepositoryToComponent.KEYTAB_PATH.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( hcConnection, StringUtils.trimToNull(hcConnection.getKeytab())); } else if (EHCatalogRepositoryToComponent.DATABASE_NAME.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getDatabase())); } else if (EHCatalogRepositoryToComponent.USERNAME.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getUserName())); } else if (EHCatalogRepositoryToComponent.ROWSEPARATOR.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getRowSeparator())); } else if (EHCatalogRepositoryToComponent.FIELDSEPARATOR.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getFieldSeparator())); } else if (EHCatalogRepositoryToComponent.LOCAL.getRepositoryValue().equals(value)) { return false; } else if (EHCatalogRepositoryToComponent.MAPREDUCE.getRepositoryValue().equals(value)) { return true; } else if (EHCatalogRepositoryToComponent.PIG_VERSION.getRepositoryValue().equals(value)) { return hcConnection.getDfVersion(); } else if (EHCatalogRepositoryToComponent.MAPRED_JOB_TRACKER.getRepositoryValue().equals(value) || EHCatalogRepositoryToComponent.MAPRED_RESOURCE_MANAGER.getRepositoryValue().equals(value) || EHCatalogRepositoryToComponent.RESOURCE_MANAGER.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( hcConnection, StringUtils.trimToNull(hcConnection.getJobTrackerURI())); } else if (EHCatalogRepositoryToComponent.FS_DEFAULT_NAME.getRepositoryValue().equals(value)) { return getRepositoryValueOfStringType( hcConnection, StringUtils.trimToNull(hcConnection.getNameNodeURI())); } else if (EHCatalogRepositoryToComponent.JOBTRACKER_PRINCIPAL .getRepositoryValue() .equals(value)) { return getRepositoryValueOfStringType( connection, StringUtils.trimToNull(connection.getKrbPrincipal())); } else if (EHCatalogRepositoryToComponent.LOAD.getRepositoryValue().equals(value)) { return HCATALOG_LOAD; } else if (EHCatalogRepositoryToComponent.STORE.getRepositoryValue().equals(value)) { return HCATALOG_STORE; } else if (EHCatalogRepositoryToComponent.HADOOP_CUSTOM_JARS .getRepositoryValue() .equals(value)) { if (targetComponent != null && targetComponent.startsWith("tPig")) { return hcConnection.getParameters().get(ECustomVersionGroup.PIG_HCATALOG.getName()); } return HCVersionUtil.getCompCustomJarsParamFromRep(hcConnection, ECustomVersionGroup.COMMON); } else if (EHCatalogRepositoryToComponent.HADOOP_ADVANCED_PROPERTIES .getRepositoryValue() .equals(value)) { return HadoopRepositoryUtil.getHadoopPropertiesFullList( connection, connection.getHadoopProperties(), true); } return null; }