Search in sources :

Example 61 with ComponentException

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);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ComponentException(org.talend.components.api.exception.ComponentException) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo) URL(java.net.URL)

Example 62 with ComponentException

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);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ComponentException(org.talend.components.api.exception.ComponentException) JarRuntimeInfo(org.talend.components.api.component.runtime.JarRuntimeInfo) URL(java.net.URL)

Example 63 with ComponentException

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;
}
Also used : GeneralSecurityException(java.security.GeneralSecurityException) ComponentException(org.talend.components.api.exception.ComponentException)

Example 64 with ComponentException

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);
    }
}
Also used : GoogleDriveGetResult(org.talend.components.google.drive.runtime.utils.GoogleDriveGetResult) GoogleDriveGetParameters(org.talend.components.google.drive.runtime.utils.GoogleDriveGetParameters) GeneralSecurityException(java.security.GeneralSecurityException) ComponentException(org.talend.components.api.exception.ComponentException) IOException(java.io.IOException) MimeType(org.talend.components.google.drive.GoogleDriveMimeTypes.MimeType)

Example 65 with ComponentException

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);
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) ArrayList(java.util.ArrayList) ComponentException(org.talend.components.api.exception.ComponentException) URL(java.net.URL)

Aggregations

ComponentException (org.talend.components.api.exception.ComponentException)101 URL (java.net.URL)32 MalformedURLException (java.net.MalformedURLException)30 JarRuntimeInfo (org.talend.components.api.component.runtime.JarRuntimeInfo)27 IOException (java.io.IOException)18 ArrayList (java.util.ArrayList)17 InvalidKeyException (java.security.InvalidKeyException)14 Schema (org.apache.avro.Schema)14 URISyntaxException (java.net.URISyntaxException)12 StorageException (com.microsoft.azure.storage.StorageException)11 NamedThing (org.talend.daikon.NamedThing)11 ValidationResult (org.talend.daikon.properties.ValidationResult)10 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)10 IndexedRecord (org.apache.avro.generic.IndexedRecord)8 Test (org.junit.Test)8 SimpleNamedThing (org.talend.daikon.SimpleNamedThing)8 NetSuiteException (org.talend.components.netsuite.client.NetSuiteException)6 GeneralSecurityException (java.security.GeneralSecurityException)5 JDBCSource (org.talend.components.jdbc.runtime.JDBCSource)5 TJDBCInputDefinition (org.talend.components.jdbc.tjdbcinput.TJDBCInputDefinition)5