Package net.fortytwo.twitlogic.persistence

Examples of net.fortytwo.twitlogic.persistence.TweetStore


        SailFactory f = new AGRepositorySailFactory(TwitLogic.getConfiguration(), false);
        Sail sail = f.makeSail();
        sail.initialize();

        try {
            TweetStore store = new TweetStore(sail);
            store.initialize();
            try {
                TweetPersister p = new TweetPersister(store, null);

                stressTest(p, 10);
            } finally {
                store.shutDown();
            }
        } finally {
            sail.shutDown();
        }
    }
View Full Code Here


        try {
            Sail streamingSail = new UdpTransactionSail(workingSail, address, udpOutputPorts);

            try {
                TweetStore store = new TweetStore(streamingSail);
                store.doNotRefreshCoreMetadata();
                store.initialize();

                try {
                    // A connection with which to repeatedly clear the working store
                    final SailConnection c = workingSail.getConnection();

                    try {
                        // Offline persister
                        final TweetPersister p = new TweetPersister(store, null);

                        try {
                            Handler<Tweet> h = new Handler<Tweet>() {
                                public boolean isOpen() {
                                    return p.isOpen();
                                }

                                public void handle(final Tweet tweet) throws HandlerException {
                                    try {
                                        c.clear();
                                        c.commit();
                                        c.begin();
                                    } catch (SailException e) {
                                        throw new HandlerException(e);
                                    }

                                    p.handle(tweet);
                                }
                            };

                            stressTest(h, 1000);
                        } finally {
                            p.close();
                        }
                    } finally {
                        c.close();
                    }
                } finally {
                    store.shutDown();
                }
            } finally {
                streamingSail.shutDown();
            }
        } finally {
View Full Code Here

        System.out.println("For more information, please see:\n"
                + "  <URL:http://wiki.github.com/joshsh/twitlogic/configuring-and-running-twitlogic>.");
    }

    private static void runDemo() throws Exception {
        TweetStore store = new TweetStore();
        store.initialize();

        //store.dumpToFile(new File("/tmp/places-demo-dump.nt"), RDFFormat.NTRIPLES);

        try {
            CustomTwitterClient client = new CustomTwitterClient();

            store.startServer(client);

            TweetPersister persister = new TweetPersister(store, client);
            TweetDeleter d = new TweetDeleter(store);

            TweetPersistedLogger pLogger = new TweetPersistedLogger(client.getStatistics(), persister);
            TweetFilterCriterion crit = new TweetFilterCriterion(TwitLogic.getConfiguration());
            Filter<Tweet> f = new Filter<Tweet>(crit, pLogger);
            TweetReceivedLogger rLogger = new TweetReceivedLogger(client.getStatistics(), f);

            Set<User> users = TwitLogic.findFollowList(client);
            Set<String> terms = TwitLogic.findTrackTerms();

            if (0 < users.size() || 0 < terms.size()) {
                client.processFilterStream(users, terms, null, rLogger, d, 0);
            } else {
                client.processSampleStream(rLogger, d);
            }
        } finally {
            store.shutDown();
        }
    }
View Full Code Here

TOP

Related Classes of net.fortytwo.twitlogic.persistence.TweetStore

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.