final DataSiftClient datasift = new DataSiftClient(config);
String csdl = "interaction.content contains \"some string\"";
//both sync and async processing are supported by calling "sync" on any FutureDate object
//synchronously validate a CSDL
Validation validation = datasift.core().validate(csdl).sync();
if (validation.hasFailed()) {
//if true an exception may have caused the request to fail, inspect the cause if available
if (validation.failureCause() != null) { //may not be an exception
validation.failureCause().printStackTrace();
}
return;
}
System.out.println(validation);
if (validation.isSuccessful()) {
//we now know it's valid so asynchronously compile the CSDL and obtain a stream
FutureData<Stream> stream = datasift.core().compile(csdl);
FutureData<Dpu> dpus = datasift.core().dpu(stream);
dpus.onData(new FutureResponse<Dpu>() {
public void apply(Dpu data) {