Guest User

Untitled

a guest
Mar 17th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment