Package com.datasift.client.core

Examples of com.datasift.client.core.Stream


     * to list the hash for the compiled CSDL
     */
    public FutureData<Stream> compile(String csdl) {
        FutureData<Stream> future = new FutureData<Stream>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(COMPILE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new Stream(), config)))
                .form("csdl", csdl);
        applyConfig(request).execute();
        return future;
    }
View Full Code Here


     * to list the hash for the compiled CSDL
     */
    public FutureData<Stream> compile(String csdl) {
        FutureData<Stream> future = new FutureData<Stream>();
        URI uri = newParams().forURL(config.newAPIEndpointURI(COMPILE));
        POST request = config.http().POST(uri, new PageReader(newRequestCallback(future, new Stream(), config)))
                .form("csdl", csdl);
        performRequest(future, request);
        return future;
    }
View Full Code Here

//        assertEquals(dpu, actualDpu, 0.00000001);
    }

    @Test
    public void testIfUserCanCompile() {
        Stream stream = datasift.compile(csdl).sync();
        assertTrue(stream.isSuccessful());

//        DateTime actualDate = stream.getCreatedAt();
//        float actualDpu = stream.getDpu();
//
//        assertEquals(createdAt.getMillis(), actualDate.getMillis());
//        assertEquals(dpu, actualDpu, 0.00000001);

        assertEquals(hash, stream.hash());
    }
View Full Code Here

    }

    @Test
    public void testIfUserCanCalculateDpuCost() {

        Stream stream = Stream.fromString("13e9347e7da32f19fcdb08e297019d2e");
        Dpu dpu = datasift.dpu(stream).sync();

        assertTrue(dpu.isSuccessful());

        assertEquals(dpu.getDpu(), this.dpu, 0.00000001);
View Full Code Here

    }

    public static void main(String... args) throws InterruptedException {
        DataSiftConfig config = new DataSiftConfig("zcourts", "acbf4788f875db9fdf6bbd2131b10752");
        final DataSiftClient datasift = new DataSiftClient(config);
        Stream stream = Stream.fromString("13e9347e7da32f19fcdb08e297019d2e");

        PreparedHistoricsQuery historic = datasift.historics().prepare(stream.hash(), DateTime.now().minusHours(5),
                DateTime.now().minusHours(4), "Historics pull test").sync();

        PushSubscription historicsSubscription = datasift.push()
                .createPull(PullJsonType.JSON_NEW_LINE, historic, "pull test " + DateTime.now()).sync();
View Full Code Here

        //or all at once
        source.setParams(true, true, true);
        ManagedSource managedSource = datasift.managedSource().create("My managed source", source).sync();
        if (managedSource.isSuccessful()) {
            //and now we can do filtering on this page e.g.
            Stream stream = datasift
                    .compile(String.format("interaction.content contains \"news\" AND source.id == \"%s\"",
                            managedSource.getId())).sync();

            System.out.println(managedSource);
        }
View Full Code Here

public class PreviewApi {
    private PreviewApi() throws InterruptedException {
        DataSiftConfig config = new DataSiftConfig("username", "api-key");

        final DataSiftClient datasift = new DataSiftClient(config);
        Stream stream = Stream.fromString("13e9347e7da32f19fcdb08e297019d2e");
        DateTime fiveHrsAgo = DateTime.now().minusHours(5);
        HistoricsPreview preview = datasift.preview().create(fiveHrsAgo, stream,
                new String[]{ "interaction.author.link,targetVol,hour;interaction.type,freqDist,10" }).sync();
        //can also later get the preview data
        datasift.preview().get(preview);
View Full Code Here

        //what's left of your rate limit quota
        result.rateLimitRemaining();

        Usage usage = datasift.usage().sync();

        Stream stream = Stream.fromString("13e9347e7da32f19fcdb08e297019d2e");
        Dpu dpu = datasift.dpu(stream).sync();

        Balance balance = datasift.balance().sync();
        //synchronously validate a CSDL
        Validation validation = datasift.validate(csdl).sync();
View Full Code Here

    }

    public static void main(String... args) throws InterruptedException {
        DataSiftConfig config = new DataSiftConfig("zcourts", "a9641ee0770d05ff3d83225c9fafe4bb");
        final DataSiftClient datasift = new DataSiftClient(config);
        Stream result = datasift.compile("interaction.content contains \"music\" ").sync();
        //handle exceptions that can't necessarily be linked to a specific stream
        datasift.liveStream().onError(new ErrorHandler());

        //handle delete message
        datasift.liveStream().onStreamEvent(new ExampleStreamEventHandler());
View Full Code Here

    public static void main(String... args) throws InterruptedException {
        DateTime.now();
        new Date();
        DataSiftConfig config = new DataSiftConfig("zcourts", "acbf4788f875db9fdf6bbd2131b10752");
        final DataSiftClient datasift = new DataSiftClient(config);
        Stream stream = Stream.fromString("13e9347e7da32f19fcdb08e297019d2e");

        PushSubscription streamSubscription = datasift.push()
                .createPull(PullJsonType.JSON_NEW_LINE, stream, "pull test").sync();

        PulledInteractions streamSubscriptions = datasift.push().pull(streamSubscription).sync();
View Full Code Here

TOP

Related Classes of com.datasift.client.core.Stream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.