Advertisement
Guest User

mm_83_0_POP3XMLReceiver.patch

a guest
Nov 3rd, 2017
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.78 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..1058953 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. @@ -81,37 +81,7 @@ public class POP3XMLReceiver
  116.      */
  117.     public void receive(String systemName)
  118.     {
  119. -       mDeleted = false;
  120. -
  121. -       XBUSSystem xbusSystem = null;
  122. -
  123. -       TAManager taManager = TAManager.getInstance();
  124. -       taManager.clearManager();
  125. -       taManager.registerResource(this);
  126. -
  127. -       try
  128. -       {
  129. -
  130. -           readConfiguration(systemName);
  131. -
  132. -           xbusSystem = new XBUSSystem(systemName);
  133. -
  134. -           Trace.info("Start processing " + xbusSystem.getCompleteName());
  135. -
  136. -           // POP3XMLReceiver will be registered by TAManager
  137. -           doReceive(xbusSystem);
  138. -       }
  139. -       catch (Exception t)
  140. -       {
  141. -           NotifyError.notifyError(this, xbusSystem, t.getMessage(), null,
  142. -                   null);
  143. -       }
  144. -       finally
  145. -       {
  146. -           // close resources and remove from the resources
  147. -           taManager.close();
  148. -           taManager.removeResource(this);
  149. -       }
  150. +       mEmailMessage.receive(this, systemName);
  151.     }
  152.  
  153.     protected boolean doReceive(XBUSSystem xbusSystem)
  154. @@ -461,7 +431,7 @@ public class POP3XMLReceiver
  155.      */
  156.     public String getOnError()
  157.     {
  158. -       return mOnError;
  159. +       return mEmailMessage.getOnError(this);
  160.     }
  161.  
  162.     /**
  163. @@ -627,7 +597,7 @@ public class POP3XMLReceiver
  164.  
  165.     protected String getAddress()
  166.     {
  167. -       return new StringBuffer(mUser).append("@").append(mHost).toString();
  168. +       return mEmailMessage.getAddress(this);
  169.     }
  170.  
  171.     /**
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement