use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class ElasticsearchInputDefinition method getRuntimeInfo.
@Override
public RuntimeInfo getRuntimeInfo(ExecutionEngine engine, ComponentProperties properties, ConnectorTopology connectorTopology) {
assertEngineCompatibility(engine);
assertConnectorTopologyCompatibility(connectorTopology);
try {
switch(((ElasticsearchInputProperties) properties).getDatasetProperties().getDatastoreProperties().version.getValue()) {
case V_2_4:
default:
return new JarRuntimeInfo(new URL(MAVEN_RUNTIME_URI), DependenciesReader.computeDependenciesFilePath(MAVEN_GROUP_ID, MAVEN_RUNTIME_ARTIFACT_ID), RUNTIME_2_4);
}
} catch (MalformedURLException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class SimpleFileIOInputDefinition method getRuntimeInfo.
@Override
public RuntimeInfo getRuntimeInfo(ExecutionEngine engine, ComponentProperties properties, ConnectorTopology connectorTopology) {
assertEngineCompatibility(engine);
assertConnectorTopologyCompatibility(connectorTopology);
try {
return new JarRuntimeInfo(new URL(SimpleFileIOComponentFamilyDefinition.MAVEN_DEFAULT_RUNTIME_URI), DependenciesReader.computeDependenciesFilePath(SimpleFileIOComponentFamilyDefinition.MAVEN_GROUP_ID, SimpleFileIOComponentFamilyDefinition.MAVEN_DEFAULT_RUNTIME_ARTIFACT_ID), RUNTIME);
} catch (MalformedURLException e) {
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class GoogleDriveReader method start.
@Override
public boolean start() throws IOException {
try {
drive = source.getDriveService();
utils = source.getDriveUtils();
} catch (GeneralSecurityException e) {
LOG.error(e.getMessage());
// TODO manage this correctly
result.toMap().put(GoogleDriveCopyDefinition.RETURN_ERROR_MESSAGE, e.getMessage());
throw new ComponentException(e);
}
return true;
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class GoogleDriveGetRuntime method getFile.
public void getFile(RuntimeContainer container) {
try {
String resourceId = properties.fileAccessMethod.getValue().equals(AccessMethod.Id) ? properties.file.getValue() : getDriveUtils().getFileId(properties.file.getValue());
Map<String, MimeType> mimes = GoogleDriveMimeTypes.newDefaultMimeTypesSupported();
mimes.put(MIME_TYPE_GOOGLE_DOCUMENT, properties.exportDocument.getValue());
mimes.put(MIME_TYPE_GOOGLE_DRAWING, properties.exportDrawing.getValue());
mimes.put(MIME_TYPE_GOOGLE_PRESENTATION, properties.exportPresentation.getValue());
mimes.put(MIME_TYPE_GOOGLE_SPREADSHEET, properties.exportSpreadsheet.getValue());
GoogleDriveGetParameters p = new GoogleDriveGetParameters(resourceId, mimes, properties.storeToLocal.getValue(), properties.outputFileName.getValue(), properties.setOutputExt.getValue());
//
GoogleDriveGetResult r = getDriveUtils().getResource(p);
fileId = r.getId();
} catch (IOException | GeneralSecurityException e) {
LOG.error(e.getMessage());
throw new ComponentException(e);
}
}
use of org.talend.components.api.exception.ComponentException in project components by Talend.
the class JdbcRuntimeInfo method getDriverDependencies.
/**
* Return list of JDBC driver dependencies
*
* @return list of JDBC driver dependencies
*/
private List<URL> getDriverDependencies() {
try {
List<URL> driverUrls = new ArrayList<>();
List<String> driverPaths = props.getRuntimeSetting().getDriverPaths();
if (driverPaths != null) {
for (String driver : driverPaths) {
String mavenPath = removeQuote(driver);
// so need to filter like below
if ("newLine".equals(mavenPath)) {
continue;
}
driverUrls.add(new URL(mavenPath));
}
}
return driverUrls;
} catch (MalformedURLException e) {
throw new ComponentException(CommonErrorCodes.UNEXPECTED_EXCEPTION, e);
}
}
Aggregations