daily pastebin goal
32%
SHARE
TWEET

Untitled

a guest Mar 17th, 2018 70 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package org.jboss.soa.esb.actions;
  2.  
  3. import org.jboss.soa.esb.helpers.ConfigTree;
  4. import org.jboss.soa.esb.message.Message;
  5.  
  6. import twitter4j.Twitter;
  7.  
  8. public class TwitterAdapter extends AbstractActionPipelineProcessor {
  9.    
  10.     private String userName;
  11.     private String password;
  12.    
  13.     public TwitterAdapter(ConfigTree configTree) {
  14.         userName = configTree.getAttribute("user-name");
  15.         password = configTree.getAttribute("password");
  16.     }
  17.  
  18.     public Message process(Message message) throws ActionProcessingException {
  19.         Twitter twitter = null;
  20.         String status = null;
  21.         try {
  22.             status = (String) message.getBody().get();
  23.             twitter = new Twitter(userName, password);
  24.             twitter.updateStatus(status);
  25.         } catch (Exception ex) {
  26.             throw new ActionProcessingException(ex);
  27.         }
  28.         return message;
  29.     }
  30.  
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand