use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class NetSuiteDatasetRuntimeImpl method getSchema.
@Override
public Schema getSchema(String typeName) {
try {
final RecordTypeInfo recordTypeInfo = metaDataSource.getRecordType(typeName);
final TypeDesc typeDesc = metaDataSource.getTypeInfo(typeName);
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, recordTypeInfo, fieldDescList);
return schema;
} catch (NetSuiteException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class NetSuiteDatasetRuntimeImpl method getSearchableTypes.
@Override
public List<NamedThing> getSearchableTypes() {
try {
List<NamedThing> searchableTypes = new ArrayList<>(metaDataSource.getSearchableTypes());
// Sort by display name in alphabetical order
Collections.sort(searchableTypes, new Comparator<NamedThing>() {
@Override
public int compare(NamedThing o1, NamedThing o2) {
return o1.getDisplayName().compareTo(o2.getDisplayName());
}
});
return searchableTypes;
} catch (NetSuiteException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class MarkLogicDatastoreRuntime method doHealthChecks.
@Override
public Iterable<ValidationResult> doHealthChecks(RuntimeContainer container) {
TMarkLogicConnectionStandalone standalone = new TMarkLogicConnectionStandalone();
ValidationResult validationResult;
try {
standalone.initialize(container, properties);
standalone.connect(container);
validationResult = ValidationResult.OK;
} catch (ComponentException ce) {
validationResult = new ValidationResult(ce);
}
return Collections.singletonList(validationResult);
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class AbstractComponentTest method assertComponentIsRegistered.
protected void assertComponentIsRegistered(String componentName) {
try {
ComponentDefinition componentDefinition = getComponentService().getComponentDefinition(componentName);
assertNotNull(componentDefinition);
} catch (ComponentException ce) {
if (ce.getCode() == ComponentsApiErrorCode.WRONG_COMPONENT_NAME) {
fail("Could not find component [], please check the registered component familly is in package org.talend.components");
} else {
throw ce;
}
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class ServiceSpiFactory method readAllComponentDependencies.
/**
* this will gather all components dependencies jar urls.
*/
private static URL[] readAllComponentDependencies(URL[] componentUrls) {
// assuming at least 3 deps
Set<URL> dependenciesUrl = new HashSet<>(componentUrls.length * 3);
for (URL compURL : componentUrls) {
try {
List<URL> componentDepsURLs = DependenciesReader.extractDependencies(compURL);
// resolve all url, this means they can be downloaded from a remote maven repo too.
LOG.info("resolving dependencies for [" + compURL + "]");
try {
for (URL depsURL : componentDepsURLs) {
depsURL.openConnection();
}
} catch (IOException e) {
LOG.error("Error when resolving dependencies for [" + compURL + "]:" + e);
}
dependenciesUrl.addAll(componentDepsURLs);
} catch (ComponentException ce) {
LOG.error("Failed to load component from URL[" + compURL + "] because :" + ce.getMessage());
}
}
return dependenciesUrl.toArray(new URL[dependenciesUrl.size()]);
}
Aggregations