use of com.google.cloud.bigquery.datatransfer.v1.DataSource in project atlasmap by atlasmap.
the class JavaJavaDateTimeMappingTest method addDataSource.
private void addDataSource(AtlasMapping mapping, String uri, DataSourceType type) {
DataSource ds = new DataSource();
ds.setUri(uri);
ds.setDataSourceType(type);
mapping.getDataSource().add(ds);
}
use of com.google.cloud.bigquery.datatransfer.v1.DataSource in project atlasmap by atlasmap.
the class JavaJavaFlatMappingTest method generateDataSource.
protected DataSource generateDataSource(String uri, DataSourceType type) {
DataSource ds = new DataSource();
ds.setUri(uri);
ds.setDataSourceType(type);
return ds;
}
use of com.google.cloud.bigquery.datatransfer.v1.DataSource in project atlasmap by atlasmap.
the class JsonJavaFlatMappingTest method generateDataSource.
protected DataSource generateDataSource(String uri, DataSourceType type) {
DataSource ds = new DataSource();
ds.setUri(uri);
ds.setDataSourceType(type);
return ds;
}
use of com.google.cloud.bigquery.datatransfer.v1.DataSource in project syndesis-qe by syndesisio.
the class AtlasMapperGenerator method getAtlasMappingStep.
/**
* This method is used to generate the "AtlasMapping" - the atlasMapping contains list of specifications of
* dataSources and a list of specifications of dataMappings. Both these a must have for a complete and working
* AtlasMapping.
*
* @return step with the mapping defined
*/
public Step getAtlasMappingStep() {
processPrecedingSteps();
processFollowingStep();
AtlasMapping atlasMapping = new AtlasMapping();
atlasMapping.setMappings(new Mappings());
for (DataSource s : processSources()) {
atlasMapping.getDataSource().add(s);
}
atlasMapping.setName("REST." + UUID.randomUUID().toString().replaceAll("-", ""));
atlasMapping.setLookupTables(new LookupTables());
atlasMapping.setProperties(new Properties());
atlasMapping.getDataSource().add(processTarget());
atlasMapping.getMappings().getMapping().addAll(generateBaseMappings());
ObjectMapper mapper = new ObjectMapper();
mapper.enable(SerializationFeature.WRAP_ROOT_VALUE);
String mapperString = null;
try {
mapperString = mapper.writeValueAsString(atlasMapping);
log.debug(mapperString);
} catch (JsonProcessingException e) {
log.error("Unable to write mapper json as string", e);
}
return new Step.Builder().stepKind(StepKind.mapper).name(mapping.getStep().getName()).configuredProperties(TestUtils.map("atlasmapping", mapperString)).action(getMapperStepAction(followingStep.getStep().getAction().get().getInputDataShape().get())).id(UUID.randomUUID().toString()).build();
}
use of com.google.cloud.bigquery.datatransfer.v1.DataSource in project syndesis-qe by syndesisio.
the class AtlasMapperGenerator method createDataSource.
/**
* Used to generate data source elements for atlasMapping. There are three types of them: Java, Json, XML.
*
* @param dataShape datashape of the processed step
* @param step step definition
* @param dataSourceType datasource type
* @return datasource
*/
private DataSource createDataSource(DataShape dataShape, StepDefinition step, DataSourceType dataSourceType) {
DataShapeKinds dataShapeKind = dataShape.getKind();
DataSource source = null;
if (dataShapeKind.toString().contains("json")) {
source = new JsonDataSource();
source.setUri("atlas:" + "json:" + step.getStep().getId().get());
} else if (dataShapeKind.toString().contains("java")) {
source = new DataSource();
source.setUri("atlas:" + "java:" + step.getStep().getId().get() + "?className=" + dataShape.getType());
} else if (dataShapeKind.toString().contains("xml")) {
source = new XmlDataSource();
source.setUri("atlas:xml:" + step.getStep().getId().get());
XmlNamespaces xmlNamespaces = new XmlNamespaces();
// Init the array, so that we don't have the null value
xmlNamespaces.getXmlNamespace();
((XmlDataSource) source).setXmlNamespaces(xmlNamespaces);
} else {
fail("Unknown datashape kind " + dataShapeKind.toString());
}
source.setId(step.getStep().getId().get());
source.setDataSourceType(dataSourceType);
return source;
}
Aggregations