Search in sources :

Example 1 with SimpleFileIODatastoreProperties

use of org.talend.components.simplefileio.SimpleFileIODatastoreProperties in project components by Talend.

the class SimpleFileIODatasetRuntime method getReadWriteUgiDoAs.

/**
 * Helper method for any runtime to get the appropriate {@link UgiDoAs} for executing.
 *
 * @param datasetProperties dataset properties, containing credentials for the cluster.
 * @param accessType the type of access to the dataset that the user will be performing.
 * @return An object that can be used to execute actions with the correct credentials.
 */
public static UgiDoAs getReadWriteUgiDoAs(SimpleFileIODatasetProperties datasetProperties, UgiExceptionHandler.AccessType accessType) {
    String path = datasetProperties.path.getValue();
    SimpleFileIODatastoreProperties datastoreProperties = datasetProperties.getDatastoreProperties();
    if (datastoreProperties.useKerberos.getValue()) {
        UgiDoAs doAs = UgiDoAs.ofKerberos(datastoreProperties.kerberosPrincipal.getValue(), datastoreProperties.kerberosKeytab.getValue());
        return new UgiExceptionHandler(doAs, accessType, datastoreProperties.kerberosPrincipal.getValue(), path);
    } else if (datastoreProperties.userName.getValue() != null && !datastoreProperties.userName.getValue().isEmpty()) {
        UgiDoAs doAs = UgiDoAs.ofSimple(datastoreProperties.userName.getValue());
        return new UgiExceptionHandler(doAs, accessType, datastoreProperties.userName.getValue(), path);
    } else {
        return new UgiExceptionHandler(UgiDoAs.ofNone(), accessType, null, path);
    }
}
Also used : SimpleFileIODatastoreProperties(org.talend.components.simplefileio.SimpleFileIODatastoreProperties) UgiDoAs(org.talend.components.simplefileio.runtime.ugi.UgiDoAs) UgiExceptionHandler(org.talend.components.simplefileio.runtime.ugi.UgiExceptionHandler)

Example 2 with SimpleFileIODatastoreProperties

use of org.talend.components.simplefileio.SimpleFileIODatastoreProperties in project components by Talend.

the class SandboxedSimpleFileIODatasetRuntimeTest method createDatasetProperties.

/**
 * @return the properties for this dataset, fully initialized with the default values.
 */
public static SimpleFileIODatasetProperties createDatasetProperties() {
    // Configure the dataset.
    SimpleFileIODatastoreProperties datastoreProps = new SimpleFileIODatastoreProperties(null);
    datastoreProps.init();
    SimpleFileIODatasetProperties datasetProps = new SimpleFileIODatasetProperties(null);
    datasetProps.init();
    datasetProps.setDatastoreProperties(datastoreProps);
    return datasetProps;
}
Also used : SimpleFileIODatastoreProperties(org.talend.components.simplefileio.SimpleFileIODatastoreProperties) SimpleFileIODatasetProperties(org.talend.components.simplefileio.SimpleFileIODatasetProperties)

Example 3 with SimpleFileIODatastoreProperties

use of org.talend.components.simplefileio.SimpleFileIODatastoreProperties in project components by Talend.

the class SimpleFileIODatasetRuntimeTest method createDatasetProperties.

/**
 * @return the properties for this dataset, fully initialized with the default values.
 */
public static SimpleFileIODatasetProperties createDatasetProperties() {
    // Configure the dataset.
    SimpleFileIODatastoreProperties datastoreProps = new SimpleFileIODatastoreProperties(null);
    datastoreProps.init();
    SimpleFileIODatasetProperties datasetProps = new SimpleFileIODatasetProperties(null);
    datasetProps.init();
    datasetProps.setDatastoreProperties(datastoreProps);
    return datasetProps;
}
Also used : SimpleFileIODatastoreProperties(org.talend.components.simplefileio.SimpleFileIODatastoreProperties) SimpleFileIODatasetProperties(org.talend.components.simplefileio.SimpleFileIODatasetProperties)

Example 4 with SimpleFileIODatastoreProperties

use of org.talend.components.simplefileio.SimpleFileIODatastoreProperties in project components by Talend.

the class SimpleFileIOOutputPropertiesTest method setup.

@Before
public void setup() {
    properties = new SimpleFileIOOutputProperties("test");
    SimpleFileIODatastoreProperties datastoreProperties = new SimpleFileIODatastoreProperties("test");
    datastoreProperties.init();
    SimpleFileIODatasetProperties datasetProperties = new SimpleFileIODatasetProperties("test");
    datasetProperties.init();
    datasetProperties.setDatastoreProperties(datastoreProperties);
    properties.setDatasetProperties(datasetProperties);
    properties.init();
}
Also used : SimpleFileIODatastoreProperties(org.talend.components.simplefileio.SimpleFileIODatastoreProperties) SimpleFileIODatasetProperties(org.talend.components.simplefileio.SimpleFileIODatasetProperties) Before(org.junit.Before)

Example 5 with SimpleFileIODatastoreProperties

use of org.talend.components.simplefileio.SimpleFileIODatastoreProperties in project components by Talend.

the class SimpleFileIODatastoreRuntimeTest method createDatastoreProperties.

/**
 * @return the properties for this datastore, fully initialized with the default values.
 */
public static SimpleFileIODatastoreProperties createDatastoreProperties() {
    // Configure the datastore.
    SimpleFileIODatastoreProperties datastoreProps = new SimpleFileIODatastoreProperties(null);
    datastoreProps.init();
    return datastoreProps;
}
Also used : SimpleFileIODatastoreProperties(org.talend.components.simplefileio.SimpleFileIODatastoreProperties)

Aggregations

SimpleFileIODatastoreProperties (org.talend.components.simplefileio.SimpleFileIODatastoreProperties)5 SimpleFileIODatasetProperties (org.talend.components.simplefileio.SimpleFileIODatasetProperties)3 Before (org.junit.Before)1 UgiDoAs (org.talend.components.simplefileio.runtime.ugi.UgiDoAs)1 UgiExceptionHandler (org.talend.components.simplefileio.runtime.ugi.UgiExceptionHandler)1