Advertisement
Guest User

mm_83_0_POP3XMLReceiver.patch

a guest
Oct 20th, 2017
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.41 KB | None | 0 0
  1. diff --git a/src/main/java/net/sf/xbus/technical/mail/Email.java b/src/main/java/net/sf/xbus/technical/mail/Email.java
  2. index 39ecc2d..6e019cf 100644
  3. --- a/src/main/java/net/sf/xbus/technical/mail/Email.java
  4. +++ b/src/main/java/net/sf/xbus/technical/mail/Email.java
  5. @@ -8,7 +8,11 @@ import java.util.Vector;
  6.  import javax.mail.internet.InternetAddress;
  7.  
  8.  import net.sf.xbus.base.core.Constants;
  9. +import net.sf.xbus.base.core.TAManager;
  10.  import net.sf.xbus.base.core.XException;
  11. +import net.sf.xbus.base.core.trace.Trace;
  12. +import net.sf.xbus.base.notifyerror.NotifyError;
  13. +import net.sf.xbus.base.xbussystem.XBUSSystem;
  14.  import net.sf.xbus.base.xml.XMLHelper;
  15.  
  16.  import org.w3c.dom.Document;
  17. @@ -283,4 +287,64 @@ public class Email
  18.         return ((mContent != null) && (mContent.toUpperCase().indexOf("/HTML") != -1));
  19.     }
  20.  
  21. +   protected String getAddress(POP3XMLReceiver pop3xmlReceiver)
  22. +   {
  23. +       return new StringBuffer(pop3xmlReceiver.mUser).append("@").append(pop3xmlReceiver.mHost).toString();
  24. +   }
  25. +
  26. +   /**
  27. +    * Returns the onError.
  28. +    *
  29. +    * @param pop3xmlReceiver TODO
  30. +    * @return String
  31. +    */
  32. +   public String getOnError(POP3XMLReceiver pop3xmlReceiver)
  33. +   {
  34. +       return pop3xmlReceiver.mOnError;
  35. +   }
  36. +
  37. +   /**
  38. +    * This method will open the Transaction manager for this ressource adb use
  39. +    * the {@link #doReceive(XBUSSystem)}method to process the reading
  40. +    *
  41. +    * @param pop3xmlReceiver TODO
  42. +    * @param systemName name of the interface definition
  43. +    * @see net.sf.xbus.base.xbussystem.XBUSSystem#getSystems(String, String)
  44. +    * @exception XException if something goes wrong
  45. +    */
  46. +   public void receive(POP3XMLReceiver pop3xmlReceiver, String systemName)
  47. +   {
  48. +       pop3xmlReceiver.mDeleted = false;
  49. +  
  50. +       XBUSSystem xbusSystem = null;
  51. +  
  52. +       TAManager taManager = TAManager.getInstance();
  53. +       taManager.clearManager();
  54. +       taManager.registerResource(pop3xmlReceiver);
  55. +  
  56. +       try
  57. +       {
  58. +  
  59. +           pop3xmlReceiver.readConfiguration(systemName);
  60. +  
  61. +           xbusSystem = new XBUSSystem(systemName);
  62. +  
  63. +           Trace.info("Start processing " + xbusSystem.getCompleteName());
  64. +  
  65. +           // POP3XMLReceiver will be registered by TAManager
  66. +           pop3xmlReceiver.doReceive(xbusSystem);
  67. +       }
  68. +       catch (Exception t)
  69. +       {
  70. +           NotifyError.notifyError(pop3xmlReceiver, xbusSystem, t.getMessage(), null,
  71. +                   null);
  72. +       }
  73. +       finally
  74. +       {
  75. +           // close resources and remove from the resources
  76. +           taManager.close();
  77. +           taManager.removeResource(pop3xmlReceiver);
  78. +       }
  79. +   }
  80. +
  81.  }
  82. diff --git a/src/main/java/net/sf/xbus/technical/mail/POP3XMLReceiver.java b/src/main/java/net/sf/xbus/technical/mail/POP3XMLReceiver.java
  83. index a6b1fbf..c8447b4 100644
  84. --- a/src/main/java/net/sf/xbus/technical/mail/POP3XMLReceiver.java
  85. +++ b/src/main/java/net/sf/xbus/technical/mail/POP3XMLReceiver.java
  86. @@ -50,8 +50,8 @@ public class POP3XMLReceiver
  87.             ReceiverSingleInterface
  88.  {
  89.  
  90. -   private String mHost = null;
  91. -   private String mUser = null;
  92. +   String mHost = null;
  93. +   String mUser = null;
  94.     private String mPassword = null;
  95.  
  96.     private Store mStore = null;
  97. @@ -60,7 +60,7 @@ public class POP3XMLReceiver
  98.     protected Message mMessage = null;
  99.     private Email mEmailMessage = null;
  100.  
  101. -   private boolean mDeleted = false;
  102. +   boolean mDeleted = false;
  103.     private String mReturncode = null;
  104.  
  105.     /**
  106. @@ -69,7 +69,7 @@ public class POP3XMLReceiver
  107.      */
  108.     private String mResolution = null;
  109.  
  110. -   private String mOnError = null;
  111. +   String mOnError = null;
  112.  
  113.     /**
  114.      * This method will open the Transaction manager for this ressource adb use
  115. @@ -78,40 +78,11 @@ public class POP3XMLReceiver
  116.      * @see net.sf.xbus.base.xbussystem.XBUSSystem#getSystems(String, String)
  117.      * @param systemName name of the interface definition
  118.      * @exception XException if something goes wrong
  119. +    * @deprecated Use {@link net.sf.xbus.technical.mail.Email#receive(net.sf.xbus.technical.mail.POP3XMLReceiver,String)} instead
  120.      */
  121.     public void receive(String systemName)
  122.     {
  123. -       mDeleted = false;
  124. -
  125. -       XBUSSystem xbusSystem = null;
  126. -
  127. -       TAManager taManager = TAManager.getInstance();
  128. -       taManager.clearManager();
  129. -       taManager.registerResource(this);
  130. -
  131. -       try
  132. -       {
  133. -
  134. -           readConfiguration(systemName);
  135. -
  136. -           xbusSystem = new XBUSSystem(systemName);
  137. -
  138. -           Trace.info("Start processing " + xbusSystem.getCompleteName());
  139. -
  140. -           // POP3XMLReceiver will be registered by TAManager
  141. -           doReceive(xbusSystem);
  142. -       }
  143. -       catch (Exception t)
  144. -       {
  145. -           NotifyError.notifyError(this, xbusSystem, t.getMessage(), null,
  146. -                   null);
  147. -       }
  148. -       finally
  149. -       {
  150. -           // close resources and remove from the resources
  151. -           taManager.close();
  152. -           taManager.removeResource(this);
  153. -       }
  154. +       mEmailMessage.receive(this, systemName);
  155.     }
  156.  
  157.     protected boolean doReceive(XBUSSystem xbusSystem)
  158. @@ -458,10 +429,11 @@ public class POP3XMLReceiver
  159.      * Returns the onError.
  160.      *
  161.      * @return String
  162. +    * @deprecated Use {@link net.sf.xbus.technical.mail.Email#getOnError(net.sf.xbus.technical.mail.POP3XMLReceiver)} instead
  163.      */
  164.     public String getOnError()
  165.     {
  166. -       return mOnError;
  167. +       return mEmailMessage.getOnError(this);
  168.     }
  169.  
  170.     /**
  171. @@ -625,9 +597,12 @@ public class POP3XMLReceiver
  172.         }
  173.     }
  174.  
  175. +   /**
  176. +    * @deprecated Use {@link net.sf.xbus.technical.mail.Email#getAddress(net.sf.xbus.technical.mail.POP3XMLReceiver)} instead
  177. +    */
  178.     protected String getAddress()
  179.     {
  180. -       return new StringBuffer(mUser).append("@").append(mHost).toString();
  181. +       return mEmailMessage.getAddress(this);
  182.     }
  183.  
  184.     /**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement