use of io.syndesis.common.model.DataShapeKinds 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