use of com.bazaarvoice.jolt.Defaultr in project camel by apache.
the class JoltEndpoint method getTransform.
private synchronized Transform getTransform() throws Exception {
if (transform == null) {
if (log.isDebugEnabled()) {
String path = getResourceUri();
log.debug("Jolt content read from resource {} with resourceUri: {} for endpoint {}", new Object[] { getResourceUri(), path, getEndpointUri() });
}
// Sortr does not require a spec
if (this.transformDsl == JoltTransformType.Sortr) {
this.transform = new Sortr();
} else {
// getResourceAsInputStream also considers the content cache
Object spec = JsonUtils.jsonToObject(getResourceAsInputStream());
switch(this.transformDsl) {
case Shiftr:
this.transform = new Shiftr(spec);
break;
case Defaultr:
this.transform = new Defaultr(spec);
break;
case Removr:
this.transform = new Removr(spec);
break;
case Chainr:
default:
this.transform = Chainr.fromSpec(spec);
break;
}
}
}
return transform;
}
use of com.bazaarvoice.jolt.Defaultr in project nifi by apache.
the class TestTransformFactory method testGetDefaultTransform.
@Test
public void testGetDefaultTransform() throws Exception {
final String defaultrSpec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/defaultrSpec.json")));
JoltTransform transform = TransformFactory.getTransform(getClass().getClassLoader(), "jolt-transform-default", JsonUtils.jsonToObject(defaultrSpec));
assertTrue(transform instanceof Defaultr);
}