Search in sources :

Example 1 with Removr

use of com.bazaarvoice.jolt.Removr 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;
}
Also used : Defaultr(com.bazaarvoice.jolt.Defaultr) Sortr(com.bazaarvoice.jolt.Sortr) Shiftr(com.bazaarvoice.jolt.Shiftr) Removr(com.bazaarvoice.jolt.Removr)

Example 2 with Removr

use of com.bazaarvoice.jolt.Removr in project nifi by apache.

the class TestTransformFactory method testGetRemoveTransform.

@Test
public void testGetRemoveTransform() throws Exception {
    final String removrSpec = new String(Files.readAllBytes(Paths.get("src/test/resources/TestTransformFactory/removrSpec.json")));
    JoltTransform transform = TransformFactory.getTransform(getClass().getClassLoader(), "jolt-transform-remove", JsonUtils.jsonToObject(removrSpec));
    assertTrue(transform instanceof Removr);
}
Also used : JoltTransform(com.bazaarvoice.jolt.JoltTransform) Removr(com.bazaarvoice.jolt.Removr) Test(org.junit.Test)

Aggregations

Removr (com.bazaarvoice.jolt.Removr)2 Defaultr (com.bazaarvoice.jolt.Defaultr)1 JoltTransform (com.bazaarvoice.jolt.JoltTransform)1 Shiftr (com.bazaarvoice.jolt.Shiftr)1 Sortr (com.bazaarvoice.jolt.Sortr)1 Test (org.junit.Test)1