Search in sources :

Example 1 with GoogleDriveProvideRuntime

use of org.talend.components.google.drive.GoogleDriveProvideRuntime in project components by Talend.

the class GoogleDriveConnectionProperties method validateTestConnection.

public ValidationResult validateTestConnection() throws Exception {
    try (SandboxedInstance sandboxedInstance = getSandboxedInstance(SOURCE_OR_SINK_CLASS, true)) {
        GoogleDriveProvideRuntime sos = (GoogleDriveProvideRuntime) sandboxedInstance.getInstance();
        sos.initialize(null, this);
        try {
            ValidationResultMutable vr = new ValidationResultMutable(sos.validateConnection(this));
            if (Result.OK.equals(vr.getStatus())) {
                getForm(FORM_WIZARD).setAllowFinish(true);
            } else {
                getForm(FORM_WIZARD).setAllowFinish(false);
            }
            return vr;
        } catch (Exception e) {
            LOG.error("[validateTestConnection] {}.", e.getMessage());
            return new ValidationResultMutable(Result.ERROR, e.getMessage());
        }
    }
}
Also used : GoogleDriveComponentDefinition.getSandboxedInstance(org.talend.components.google.drive.GoogleDriveComponentDefinition.getSandboxedInstance) SandboxedInstance(org.talend.daikon.sandbox.SandboxedInstance) GoogleDriveProvideRuntime(org.talend.components.google.drive.GoogleDriveProvideRuntime) ValidationResultMutable(org.talend.daikon.properties.ValidationResultMutable)

Aggregations

GoogleDriveComponentDefinition.getSandboxedInstance (org.talend.components.google.drive.GoogleDriveComponentDefinition.getSandboxedInstance)1 GoogleDriveProvideRuntime (org.talend.components.google.drive.GoogleDriveProvideRuntime)1 ValidationResultMutable (org.talend.daikon.properties.ValidationResultMutable)1 SandboxedInstance (org.talend.daikon.sandbox.SandboxedInstance)1