Advertisement
Guest User

FileConsumerTemplate

a guest
Nov 16th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. package camelinaction.typesafeProdCons;
  2.  
  3.  
  4. import org.apache.commons.httpclient.NameValuePair;
  5. import org.apache.commons.lang3.ArrayUtils;
  6.  
  7. class FileConsumerTemplate{
  8.  
  9. public static final String scheme = "file:";
  10.  
  11. private String adress;
  12. private NameValuePair[] params;
  13.  
  14. FileConsumerTemplate(String adress) {
  15. this.adress = adress;
  16. }
  17.  
  18. public String getAdress() {
  19. return adress;
  20. }
  21.  
  22. public void setAdress(String adress) {
  23. this.adress = adress;
  24. }
  25.  
  26. /**
  27. * <Javadoc from http://camel.apache.org/file2.html here>
  28. * @param noop
  29. * @return
  30. */
  31. public FileConsumerTemplate setNoop(boolean noop){
  32. return addParam("noop", noop + "");
  33. }
  34.  
  35. /**
  36. * <Javadoc from http://camel.apache.org/file2.html here>
  37. * @param recursive
  38. * @return
  39. */
  40. public FileConsumerTemplate setRecursive(boolean recursive){
  41. return addParam("recursive", recursive + "");
  42. }
  43.  
  44. private FileConsumerTemplate addParam(String name, String value){
  45. params = ArrayUtils.add(params, new NameValuePair(name, value));
  46. return this;
  47. }
  48.  
  49. public String get() {
  50. return new UriHelper().getUriWithParams(scheme+adress, params);
  51. }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement