Package twitter4j

Examples of twitter4j.Status


        if (isRunning()) {
            try {
                //Maybe we can use the async api
                //First implementation. We can extend sending a mes to an specific user (for example)
                String statusmess = c.getProperty("status");
                Status status = twitter.updateStatus(statusmess);
                System.out.println("Successfully updated the status to [" + status.getText() + "].");
            } catch (TwitterException ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        }
    }
View Full Code Here


        //persist to the accessToken for future reference.
        System.out.println(twitter.verifyCredentials().getId());
        System.out.println("token : " + accessToken.getToken());
        System.out.println("tokenSecret : " + accessToken.getTokenSecret());
        //storeAccessToken(twitter.verifyCredentials().getId() , accessToken);
        Status status = twitter.updateStatus(args[0]);
        System.out.println("Successfully updated the status to [" + status.getText() + "].");
        System.exit(0);
    }
View Full Code Here

    private StatusListener listener;

    @Test
    public void testSearchTimeline() throws Exception {
        resultEndpoint.expectedMinimumMessageCount(1);
        Status status = (Status) Proxy.newProxyInstance(getClass().getClassLoader(),
                new Class[]{Status.class},
                new TwitterHandler());

        listener.onStatus(status);
        //"#cameltest tweet");
View Full Code Here

    private StatusListener listener;

    @Test
    public void testSearchTimeline() throws Exception {
        resultEndpoint.expectedMinimumMessageCount(1);
        Status status = (Status)Proxy.newProxyInstance(getClass().getClassLoader(),
                                                              new Class[] {Status.class},
                                                              new TwitterHandler());

        listener.onStatus(status);
        //"#cameltest tweet");
View Full Code Here

        }
        if (++rowCount % 1000 == 0) {
          log.info("nextRow() has returned %,d InputRows", rowCount);
        }

        Status status;
        try {
          status = queue.take();
        } catch (InterruptedException e) {
          throw new RuntimeException("InterruptedException", e);
        }

        HashtagEntity[] hts = status.getHashtagEntities();
        if (hts != null && hts.length > 0) {
          List<String> hashTags = Lists.newArrayListWithExpectedSize(hts.length);
          for (HashtagEntity ht : hts) {
            hashTags.add(ht.getText());
          }

          theMap.put("htags", Arrays.asList(hashTags.get(0)));
        }

        long retweetCount = status.getRetweetCount();
        theMap.put("retweet_count", retweetCount);
        User user = status.getUser();
        if (user != null) {
          theMap.put("follower_count", user.getFollowersCount());
          theMap.put("friends_count", user.getFriendsCount());
          theMap.put("lang", user.getLang());
          theMap.put("utc_offset", user.getUtcOffset())// resolution in seconds, -1 if not available?
          theMap.put("statuses_count", user.getStatusesCount());
        }

        return new MapBasedInputRow(status.getCreatedAt().getTime(), dimensions, theMap);
      }

      @Override
      public Runnable commit()
      {
View Full Code Here

        resultEndpoint.assertIsSatisfied();

        List<Exchange> tweets = resultEndpoint.getExchanges();
        assertNotNull(tweets);
        assertThat(tweets.size(), is(1));
        Status receivedTweet = tweets.get(0).getIn().getBody(Status.class);
        assertNotNull(receivedTweet);
        // The identifier for the published tweet should be there
        assertNotNull(receivedTweet.getId());
    }
View Full Code Here

    @Override
    public void process(Exchange exchange) throws Exception {
        // update user's status
        Object in = exchange.getIn().getBody();
        Status response;
        if (in instanceof StatusUpdate) {
            response = updateStatus((StatusUpdate) in);
        } else {
            String s = exchange.getIn().getMandatoryBody(String.class);
            response = updateStatus(s);
View Full Code Here

            exchange.getOut().setBody(response);
        }
    }

    private Status updateStatus(StatusUpdate status) throws Exception {
        Status reponse = te.getProperties().getTwitter().updateStatus(status);
        log.debug("Updated status: {}", status);
        log.debug("Status id: {}", reponse.getId());
        return reponse;
    }
View Full Code Here

        if (status.length() > 160) {
            log.warn("Message is longer than 160 characters. Message will be truncated!");
            status = status.substring(0, 160);
        }

        Status response = te.getProperties().getTwitter().updateStatus(status);
        log.debug("Updated status: {}", status);
        log.debug("Status id: {}", response.getId());
        return response;
    }
View Full Code Here

            }
            System.out.println("Got access token.");
            System.out.println("Access token: "+ accessToken.getToken());
            System.out.println("Access token secret: "+ accessToken.getTokenSecret());

            Status status = twitter.updateStatus(args[0]);
            System.out.println("Successfully updated the status to [" + status.getText() + "].");
            System.exit(0);
        } catch (TwitterException te) {
            System.out.println("Failed to get timeline: " + te.getMessage());
            System.exit( -1);
        } catch (IOException ioe) {
View Full Code Here

TOP

Related Classes of twitter4j.Status

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.