Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/main/java/net/sf/xbus/technical/mail/Clazz1572373.java b/src/main/java/net/sf/xbus/technical/mail/Clazz1572373.java
- new file mode 100644
- index 0000000..dbe7c28
- --- /dev/null
- +++ b/src/main/java/net/sf/xbus/technical/mail/Clazz1572373.java
- @@ -0,0 +1,44 @@
- +package net.sf.xbus.technical.mail;
- +
- +public class Clazz1572373 {
- +
- + private String mHost = null;
- + private String mUser = null;
- + private String mPassword = null;
- +
- + public Clazz1572373(String mHost2, String mUser2, String mPassword2) {
- + this.mHost = mHost2;
- + this.mUser = mUser2;
- + this.mPassword = mPassword2;
- + }
- +
- + public String getmHost() {
- + return mHost;
- + }
- +
- + public void setmHost(String mHost) {
- + this.mHost = mHost;
- + }
- +
- + public String getmUser() {
- + return mUser;
- + }
- +
- + public void setmUser(String mUser) {
- + this.mUser = mUser;
- + }
- +
- + public String getmPassword() {
- + return mPassword;
- + }
- +
- + public void setmPassword(String mPassword) {
- + this.mPassword = mPassword;
- + }
- +
- + public String getAddress() {
- + return new StringBuffer(mUser).append("@").append(mHost).toString();
- + }
- +
- +
- +}
- diff --git a/src/main/java/net/sf/xbus/technical/mail/Clazz8549921.java b/src/main/java/net/sf/xbus/technical/mail/Clazz8549921.java
- new file mode 100644
- index 0000000..03acf2c
- --- /dev/null
- +++ b/src/main/java/net/sf/xbus/technical/mail/Clazz8549921.java
- @@ -0,0 +1,95 @@
- +package net.sf.xbus.technical.mail;
- +
- +import java.util.List;
- +import java.util.Vector;
- +
- +import net.sf.xbus.base.core.Constants;
- +import net.sf.xbus.base.core.XException;
- +import net.sf.xbus.base.core.config.Configuration;
- +
- +public class Clazz8549921 {
- +
- +
- +
- + private Clazz8549921 () {}
- +
- + public static Clazz8549921 getInstance() {
- + return new Clazz8549921();
- + }
- +
- + public Clazz1572373 getMailAccount(String system) throws XException {
- + Configuration config = Configuration.getInstance();
- +
- + String mHost = config.getValue(Constants.CHAPTER_SYSTEM, system, "Host");
- + String mUser = config.getValue(Constants.CHAPTER_SYSTEM, system, "User");
- + String mPassword = config.getValue(Constants.CHAPTER_SYSTEM, system,
- + "Password");
- + return new Clazz1572373(mHost, mUser, mPassword);
- +
- + }
- +
- + /**
- + * Reads final resolution (resolved action with the email after that it was
- + * read) for the for the given system name from the standard configuration
- + * and checks its conformity with the allowed ones:
- + * <p>
- + * <dl>
- + * <dd><code>Preserve</code> -email is remained without
- + * modifications
- + * <dd><code>Delete</code> - email is deleted
- + * </dl>
- + *
- + * @param system Sytem name which resoltion must be read.
- + * @return exist resolution (Preserve, Rename or Delete) as String
- + * @exception XException if resolution is falsh or any errors occurs
- + */
- +
- + public String getResolution(String system) throws XException
- + {
- + Configuration config = Configuration.getInstance();
- + String resolution = config.getValue(Constants.CHAPTER_SYSTEM, system,
- + Constants.KEY_RECEIVE_RESOL);
- + if (!resolution.equals(Constants.READ_PRESERVE)
- + && !resolution.equals(Constants.READ_DELETE))
- + {
- + List params = new Vector();
- + params.add(resolution);
- + throw new XException(Constants.LOCATION_INTERN,
- + Constants.LAYER_TECHNICAL,
- + Constants.PACKAGE_TECHNICAL_MAIL, "1", params);
- + }
- + return resolution;
- + }
- +
- + /**
- + * Reads the action which should happen with the email after an error for
- + * the for the given system name from the standard configuration and checks
- + * its conformity with the allowed ones:
- + * <p>
- + * <dl>
- + * <dd><code>Preserve</code> -email is remained without
- + * modifications
- + * <dd><code>Delete</code> - email is deleted
- + * </dl>
- + *
- + * @param system Sytem name which resoltion must be read.
- + * @return exist resolution (Preserve, Rename or Delete) as String
- + * @exception XException if resolution is falsh or any errors occurs
- + */
- + public String getOnError(String system) throws XException
- + {
- + Configuration config = Configuration.getInstance();
- + String onError = config.getValue(Constants.CHAPTER_SYSTEM, system,
- + "OnError");
- + if (!onError.equals(Constants.READ_PRESERVE)
- + && !onError.equals(Constants.READ_DELETE))
- + {
- + List params = new Vector();
- + params.add(onError);
- + throw new XException(Constants.LOCATION_INTERN,
- + Constants.LAYER_TECHNICAL,
- + Constants.PACKAGE_TECHNICAL_MAIL, "2", params);
- + }
- + return onError;
- + }
- +}
- diff --git a/src/main/java/net/sf/xbus/technical/mail/Clazz1950677.java b/src/main/java/net/sf/xbus/technical/mail/Clazz1950677.java
- new file mode 100644
- index 0000000..6bb04e5
- --- /dev/null
- +++ b/src/main/java/net/sf/xbus/technical/mail/Clazz1950677.java
- @@ -0,0 +1,82 @@
- +package net.sf.xbus.technical.mail;
- +
- +import java.util.Properties;
- +
- +import javax.mail.Folder;
- +import javax.mail.MessagingException;
- +import javax.mail.NoSuchProviderException;
- +import javax.mail.Session;
- +
- +import net.sf.xbus.base.core.Constants;
- +import net.sf.xbus.base.core.XException;
- +
- +public class Clazz1950677 {
- +
- + /**
- + * This method will open the connection with the POP3 server
- + */
- + public static void open(POP3XMLReceiver p) throws XException
- + {
- + try
- + {
- + if (p.getmSession() == null)
- + {
- + p.setmSession(Session.getInstance(new Properties()));
- + }
- +
- + if (p.getmStore() == null)
- + {
- + p.setmStore(p.getmSession().getStore("pop3"));
- + p.getmStore().connect(p.getMailAccount().getmHost(),
- + p.getMailAccount().getmUser(),
- + p.getMailAccount().getmPassword());
- + }
- +
- + if (p.getmFolder() == null)
- + {
- + p.setmFolder(p.getmStore().getFolder("INBOX"));
- + p.getmFolder().open(Folder.READ_WRITE);
- + }
- + }
- + catch (NoSuchProviderException e)
- + {
- + p.setmSession(null);
- + p.setmStore(null);
- + p.setmFolder(null);
- + throw new XException(Constants.LOCATION_EXTERN,
- + Constants.LAYER_TECHNICAL,
- + Constants.PACKAGE_TECHNICAL_MAIL, "0", e);
- + }
- + catch (MessagingException e)
- + {
- + p.setmSession(null);
- + p.setmStore(null);
- + p.setmFolder(null);
- + throw new XException(Constants.LOCATION_EXTERN,
- + Constants.LAYER_TECHNICAL,
- + Constants.PACKAGE_TECHNICAL_MAIL, "0", e);
- + }
- + }
- +
- +
- + public static void close (POP3XMLReceiver p) throws XException {
- + p.closeFolder();
- +
- + try
- + {
- + if (p.getmStore() != null)
- + {
- + p.getmStore().close();
- + p.setmStore(null);
- + p.setmSession(null);
- + }
- + }
- + catch (MessagingException e)
- + {
- + throw new XException(Constants.LOCATION_EXTERN,
- + Constants.LAYER_TECHNICAL,
- + Constants.PACKAGE_TECHNICAL_MAIL, "0", e);
- + }
- +
- + }
- +}
- diff --git a/src/main/java/net/sf/xbus/technical/mail/POP3XMLReceiver.java b/src/main/java/net/sf/xbus/technical/mail/POP3XMLReceiver.java
- index a6b1fbf..b61e285 100644
- --- a/src/main/java/net/sf/xbus/technical/mail/POP3XMLReceiver.java
- +++ b/src/main/java/net/sf/xbus/technical/mail/POP3XMLReceiver.java
- @@ -50,9 +50,7 @@ public class POP3XMLReceiver
- ReceiverSingleInterface
- {
- - private String mHost = null;
- - private String mUser = null;
- - private String mPassword = null;
- + private Clazz1572373 clazz1572373 = null;
- private Store mStore = null;
- protected Folder mFolder = null;
- @@ -391,43 +389,7 @@ public class POP3XMLReceiver
- */
- public void open() throws XException
- {
- - try
- - {
- - if (mSession == null)
- - {
- - mSession = Session.getInstance(new Properties());
- - }
- -
- - if (mStore == null)
- - {
- - mStore = mSession.getStore("pop3");
- - mStore.connect(mHost, mUser, mPassword);
- - }
- -
- - if (mFolder == null)
- - {
- - mFolder = mStore.getFolder("INBOX");
- - mFolder.open(Folder.READ_WRITE);
- - }
- - }
- - catch (NoSuchProviderException e)
- - {
- - mSession = null;
- - mStore = null;
- - mFolder = null;
- - throw new XException(Constants.LOCATION_EXTERN,
- - Constants.LAYER_TECHNICAL,
- - Constants.PACKAGE_TECHNICAL_MAIL, "0", e);
- - }
- - catch (MessagingException e)
- - {
- - mSession = null;
- - mStore = null;
- - mFolder = null;
- - throw new XException(Constants.LOCATION_EXTERN,
- - Constants.LAYER_TECHNICAL,
- - Constants.PACKAGE_TECHNICAL_MAIL, "0", e);
- - }
- + Clazz1950677.open(this);
- }
- /**
- @@ -435,33 +397,7 @@ public class POP3XMLReceiver
- */
- public void close() throws XException
- {
- - closeFolder();
- -
- - try
- - {
- - if (mStore != null)
- - {
- - mStore.close();
- - mStore = null;
- - mSession = null;
- - }
- - }
- - catch (MessagingException e)
- - {
- - throw new XException(Constants.LOCATION_EXTERN,
- - Constants.LAYER_TECHNICAL,
- - Constants.PACKAGE_TECHNICAL_MAIL, "0", e);
- - }
- - }
- -
- - /**
- - * Returns the onError.
- - *
- - * @return String
- - */
- - public String getOnError()
- - {
- - return mOnError;
- + Clazz1950677.close(this);
- }
- /**
- @@ -520,80 +456,16 @@ public class POP3XMLReceiver
- */
- protected void readConfiguration(String system) throws XException
- {
- - Configuration config = Configuration.getInstance();
- - mResolution = getResolution(system);
- - mOnError = getOnError(system);
- -
- - mHost = config.getValue(Constants.CHAPTER_SYSTEM, system, "Host");
- - mUser = config.getValue(Constants.CHAPTER_SYSTEM, system, "User");
- - mPassword = config.getValue(Constants.CHAPTER_SYSTEM, system,
- - "Password");
- + Clazz8549921 c = Clazz8549921.getInstance();
- +
- + mResolution = c.getResolution(system);
- + mOnError = c.getOnError(system);
- + clazz1572373 = c.getMailAccount(system);
- }
- - /**
- - * Reads final resolution (resolved action with the email after that it was
- - * read) for the for the given system name from the standard configuration
- - * and checks its conformity with the allowed ones:
- - * <p>
- - * <dl>
- - * <dd><code>Preserve</code> -email is remained without
- - * modifications
- - * <dd><code>Delete</code> - email is deleted
- - * </dl>
- - *
- - * @param system Sytem name which resoltion must be read.
- - * @return exist resolution (Preserve, Rename or Delete) as String
- - * @exception XException if resolution is falsh or any errors occurs
- - */
- - private String getResolution(String system) throws XException
- - {
- - Configuration config = Configuration.getInstance();
- - String resolution = config.getValue(Constants.CHAPTER_SYSTEM, system,
- - Constants.KEY_RECEIVE_RESOL);
- - if (!resolution.equals(Constants.READ_PRESERVE)
- - && !resolution.equals(Constants.READ_DELETE))
- - {
- - List params = new Vector();
- - params.add(mResolution);
- - throw new XException(Constants.LOCATION_INTERN,
- - Constants.LAYER_TECHNICAL,
- - Constants.PACKAGE_TECHNICAL_MAIL, "1", params);
- - }
- - return resolution;
- - }
- -
- - /**
- - * Reads the action which should happen with the email after an error for
- - * the for the given system name from the standard configuration and checks
- - * its conformity with the allowed ones:
- - * <p>
- - * <dl>
- - * <dd><code>Preserve</code> -email is remained without
- - * modifications
- - * <dd><code>Delete</code> - email is deleted
- - * </dl>
- - *
- - * @param system Sytem name which resoltion must be read.
- - * @return exist resolution (Preserve, Rename or Delete) as String
- - * @exception XException if resolution is falsh or any errors occurs
- - */
- - private String getOnError(String system) throws XException
- - {
- - Configuration config = Configuration.getInstance();
- - String onError = config.getValue(Constants.CHAPTER_SYSTEM, system,
- - "OnError");
- - if (!onError.equals(Constants.READ_PRESERVE)
- - && !onError.equals(Constants.READ_DELETE))
- - {
- - List params = new Vector();
- - params.add(onError);
- - throw new XException(Constants.LOCATION_INTERN,
- - Constants.LAYER_TECHNICAL,
- - Constants.PACKAGE_TECHNICAL_MAIL, "2", params);
- - }
- - return onError;
- - }
- +
- +
- /**
- * @throws XException
- */
- @@ -627,7 +499,7 @@ public class POP3XMLReceiver
- protected String getAddress()
- {
- - return new StringBuffer(mUser).append("@").append(mHost).toString();
- + return clazz1572373.getAddress();
- }
- /**
- @@ -637,4 +509,36 @@ public class POP3XMLReceiver
- {
- return mReturncode;
- }
- +
- + public Session getmSession() {
- + return mSession;
- + }
- +
- + public void setmSession(Session mSession) {
- + this.mSession = mSession;
- + }
- +
- + public Store getmStore() {
- + return mStore;
- + }
- +
- + public Folder getmFolder() {
- + return mFolder;
- + }
- +
- + public void setmStore(Store mStore) {
- + this.mStore = mStore;
- + }
- +
- + public void setmFolder(Folder mFolder) {
- + this.mFolder = mFolder;
- + }
- +
- + public Clazz1572373 getMailAccount() {
- + return clazz1572373;
- + }
- +
- + public void setMailAccount(Clazz1572373 clazz1572373) {
- + this.clazz1572373 = clazz1572373;
- + }
- }
Add Comment
Please, Sign In to add comment