use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class HadoopClusterConfigurationReader method initConfigurator.
private void initConfigurator() {
initBuilder();
try {
builder = builder.withUrl(new URL(properties.url.getValue()));
if (properties.basicAuth.useAuth.getValue()) {
this.builder = this.builder.withUsernamePassword(properties.basicAuth.userId.getValue(), properties.basicAuth.password.getValue());
}
if (properties.ssl.useSsl.getValue()) {
String filePath = properties.ssl.trustStorePath.getValue();
String type = properties.ssl.trustStoreType.getValue().toString();
String pwd = properties.ssl.trustStorePassword.getValue();
this.builder = this.builder.withTrustManagers(getTrustManagers(filePath, type, pwd));
}
configurator = this.builder.build();
} catch (Exception e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class HadoopClusterConfigurationInputDefinition method getRuntimeInfo.
@Override
public RuntimeInfo getRuntimeInfo(ExecutionEngine engine, ComponentProperties properties, ConnectorTopology connectorTopology) {
assertEngineCompatibility(engine);
assertConnectorTopologyCompatibility(connectorTopology);
try {
HadoopClusterConfigurationInputProperties inputProperties = (HadoopClusterConfigurationInputProperties) properties;
switch(inputProperties.clusterManagerType.getValue()) {
case AMBARI:
return new JarRuntimeInfo(new URL(HadoopClusterFamilyDefinition.MAVEN_RUNTIME_URI), DependenciesReader.computeDependenciesFilePath(HadoopClusterFamilyDefinition.MAVEN_GROUP_ID, HadoopClusterFamilyDefinition.MAVEN_RUNTIME_ARTIFACT_ID), RUNTIME_AMBARI);
case CLOUDERA_MANAGER:
return new JarRuntimeInfo(new URL(HadoopClusterFamilyDefinition.MAVEN_RUNTIME_URI), DependenciesReader.computeDependenciesFilePath(HadoopClusterFamilyDefinition.MAVEN_GROUP_ID, HadoopClusterFamilyDefinition.MAVEN_RUNTIME_ARTIFACT_ID), RUNTIME_CM);
default:
throw new ComponentException(new RuntimeException("Do not support"));
}
} catch (MalformedURLException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class HadoopAmbariClusterService method getConfFileContent.
@Override
public String getConfFileContent(String confFileName) {
Configuration conf = confs.get(confFileName);
if (conf == null) {
return null;
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
try {
conf.writeXml(baos);
} catch (IOException e) {
throw new ComponentException(e);
}
try {
return baos.toString("UTF-8");
} catch (UnsupportedEncodingException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class JDBCTableSelectionModule method beforeTablename.
public ValidationResult beforeTablename() throws IOException {
JdbcRuntimeInfo jdbcRuntimeInfo = new JdbcRuntimeInfo(connection, "org.talend.components.jdbc.runtime.JDBCSource");
try (SandboxedInstance sandboxI = RuntimeUtil.createRuntimeClass(jdbcRuntimeInfo, connection.getClass().getClassLoader())) {
SourceOrSink ss = (SourceOrSink) sandboxI.getInstance();
ss.initialize(null, (ComponentProperties) connection);
List<NamedThing> tablenames = ss.getSchemaNames(null);
tablename.setPossibleNamedThingValues(tablenames);
} catch (ComponentException ex) {
return ex.getValidationResult();
}
return ValidationResult.OK;
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class NetSuiteDatasetRuntimeImpl method getSchemaForRecordRef.
public Schema getSchemaForRecordRef(String typeName) {
try {
// Get info for target record type
final RecordTypeInfo referencedRecordTypeInfo = metaDataSource.getRecordType(typeName);
final RefType refType = referencedRecordTypeInfo.getRefType();
// Get type info for record ref
final TypeDesc typeDesc = metaDataSource.getTypeInfo(refType.getTypeName());
List<FieldDesc> fieldDescList = new ArrayList<>(typeDesc.getFields());
// Sort in alphabetical order
Collections.sort(fieldDescList, FieldDescComparator.INSTANCE);
Schema schema = inferSchemaForType(typeDesc.getTypeName(), fieldDescList);
augmentSchemaWithCustomMetaData(metaDataSource, schema, referencedRecordTypeInfo, null);
return schema;
} catch (NetSuiteException e) {
throw new ComponentException(e);
}
}
Aggregations