-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathCdfPluginPropertyLocator.java
More file actions
90 lines (84 loc) · 4.06 KB
/
CdfPluginPropertyLocator.java
File metadata and controls
90 lines (84 loc) · 4.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package io.cdap.plugin.utils;
import org.sparkproject.guava.collect.ImmutableMap;
import java.util.Map;
import javax.annotation.Nullable;
/**
* Plugin property data-cy attributes of elements which will be used to locate element by xpath.
*/
public enum CdfPluginPropertyLocator {
PROJECT_ID("project"),
DATASET_PROJECT_ID("datasetProject"),
DATASET("dataset"),
TABLE("table"),
FORMAT("format"),
PATH("path"),
SAMPLE_SIZE("sampleSize"),
DELIMITER("delimiter"),
SKIP_HEADER("skipHeader"),
SUFFIX("suffix"),
CMEK_KEY("cmekKey"),
SERVICE_ACCOUNT_TYPE("serviceAccountType"),
SERVICE_ACCOUNT_PATH("serviceFilePath"),
SERVICE_ACCOUNT_JSON("serviceAccountJSON"),
TRUNCATE_TABLE("truncateTable"),
UPDATE_TABLE_SCHEMA("allowSchemaRelaxation"),
PUBSUB_TOPIC("topic"),
PUBSUB_MAXIMUM_BATCH_COUNT("messageCountBatchSize"),
PUBSUB_MAXIMUM_BATCH_SIZE("requestThresholdKB"),
PUBSUB_PUBLISH_DELAY_THRESHOLD("publishDelayThresholdMillis"),
PUBSUB_RETRY_TIMEOUT("retryTimeoutSeconds"),
PUBSUB_ERROR_THRESHOLD("errorThreshold"),
OUTPUT_SCHEMA_MACRO_INPUT("Output Schema-macro-input"),
GCS_DELETE_OBJECTS_TO_DELETE("paths"),
GCS_CREATE_OBJECTS_TO_CREATE("paths"),
GCS_CREATE_FAIL_IF_OBJECT_EXISTS("failIfExists"),
GCS_MOVE_SOURCE_PATH("sourcePath"),
GCS_MOVE_DESTINATION_PATH("destPath"),
PARTITION_START_DATE("partitionFrom"),
PARTITION_END_DATE("partitionTo"),
FILTER("filter");
public String pluginProperty;
CdfPluginPropertyLocator(String property) {
this.pluginProperty = property;
}
private static final Map<String, CdfPluginPropertyLocator> CDF_PLUGIN_PROPERTY_MAPPING;
static {
CDF_PLUGIN_PROPERTY_MAPPING = new ImmutableMap.Builder<String, CdfPluginPropertyLocator>()
.put("projectId", CdfPluginPropertyLocator.PROJECT_ID)
.put("datasetProjectId", CdfPluginPropertyLocator.DATASET_PROJECT_ID)
.put("dataset", CdfPluginPropertyLocator.DATASET)
.put("table", CdfPluginPropertyLocator.TABLE)
.put("format", CdfPluginPropertyLocator.FORMAT)
.put("path", CdfPluginPropertyLocator.PATH)
.put("sampleSize", CdfPluginPropertyLocator.SAMPLE_SIZE)
.put("delimiter", CdfPluginPropertyLocator.DELIMITER)
.put("skipHeader", CdfPluginPropertyLocator.SKIP_HEADER)
.put("pathSuffix", CdfPluginPropertyLocator.SUFFIX)
.put("encryptionKeyName", CdfPluginPropertyLocator.CMEK_KEY)
.put("serviceAccountType", CdfPluginPropertyLocator.SERVICE_ACCOUNT_TYPE)
.put("serviceAccountFilePath", CdfPluginPropertyLocator.SERVICE_ACCOUNT_PATH)
.put("serviceAccountJSON", CdfPluginPropertyLocator.SERVICE_ACCOUNT_JSON)
.put("truncateTable", CdfPluginPropertyLocator.TRUNCATE_TABLE)
.put("updateTableSchema", CdfPluginPropertyLocator.UPDATE_TABLE_SCHEMA)
.put("topic", CdfPluginPropertyLocator.PUBSUB_TOPIC)
.put("maximumBatchCount", CdfPluginPropertyLocator.PUBSUB_MAXIMUM_BATCH_COUNT)
.put("maximumBatchSize", CdfPluginPropertyLocator.PUBSUB_MAXIMUM_BATCH_SIZE)
.put("publishDelayThreshold", CdfPluginPropertyLocator.PUBSUB_PUBLISH_DELAY_THRESHOLD)
.put("retryTimeout", CdfPluginPropertyLocator.PUBSUB_RETRY_TIMEOUT)
.put("errorThreshold", CdfPluginPropertyLocator.PUBSUB_ERROR_THRESHOLD)
.put("outputSchema", CdfPluginPropertyLocator.OUTPUT_SCHEMA_MACRO_INPUT)
.put("objectsToDelete", CdfPluginPropertyLocator.GCS_DELETE_OBJECTS_TO_DELETE)
.put("objectsToCreate", CdfPluginPropertyLocator.GCS_CREATE_OBJECTS_TO_CREATE)
.put("createFailIfObjectExists", CdfPluginPropertyLocator.GCS_CREATE_FAIL_IF_OBJECT_EXISTS)
.put("gcsMoveSourcePath", CdfPluginPropertyLocator.GCS_MOVE_SOURCE_PATH)
.put("gcsMoveDestinationPath", CdfPluginPropertyLocator.GCS_MOVE_DESTINATION_PATH)
.put("filter", CdfPluginPropertyLocator.FILTER)
.put("partitionFrom", CdfPluginPropertyLocator.PARTITION_START_DATE)
.put("partitionTo", CdfPluginPropertyLocator.PARTITION_END_DATE)
.build();
}
@Nullable
public static CdfPluginPropertyLocator fromPropertyString(String property) {
return CDF_PLUGIN_PROPERTY_MAPPING.get(property);
}
}