Skip to content
Browse files

Remove NotifyListeners handler and unused classes.

  • Loading branch information...
1 parent 3349663 commit 69cb6f646a7f0ae624e6630b0f3d80a2339776c5 @lsolova lsolova committed
View
110 src/main/java/org/masukomi/aspirin/core/SimpleMailWatcherImpl.java
@@ -1,110 +0,0 @@
-/*
- * Created on May 6, 2004
- *
- *
- */
-package org.masukomi.aspirin.core;
-
-import javax.mail.MessagingException;
-import javax.mail.internet.MimeMessage;
-
-import org.apache.commons.logging.Log;
-import org.masukomi.aspirin.core.listener.AspirinListener;
-/**
- * @author masukomi
- *
- * This class is provided mainly as an example. It will notify you when *a* message succeeds
- * or fails but doesn't take the recipients into account and it doesn't care *what* message has
- * succeeded or failed. It is extremely simplistic and should not be used as a guage of what a
- * sophisticated MailWatcher is capable of.
- * @deprecated
- */
-public class SimpleMailWatcherImpl implements AspirinListener {
- static private Log log = AspirinInternal.getConfiguration().getLog();
- boolean hasSucceeded = false;
- boolean hasFailed = false;
- MimeMessage message;
- /** a collection of import org.apache.mailet.MailAddress objects relating to the e-mail */
-// Collection recipients;
- String lastRecipient;
- /**
- *
- */
- public SimpleMailWatcherImpl() {
- super();
- // TODO Auto-generated constructor stub
- }
- public SimpleMailWatcherImpl(MimeMessage message) {
- super();
- this.message = message;
- // TODO Auto-generated constructor stub
- }
-
- /**
- * Warning: this method may take a long time to return while a message is sending.
- * @return true if the delivery succeeds
- *
- */
- public boolean blockingSuccessCheck(){
- while(hasFailed == false && hasSucceeded == false){
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e1) {
- // TODO Auto-generated catch block
- log.error(e1);
- }
- }
- return hasSucceeded;
- }
-
- public void resetTestValues(){
- hasSucceeded=false;
- hasFailed=false;
- }
- /**
- * @return Returns the message.
- */
- public MimeMessage getMessage() {
- return message;
- }
-// /**
-// * @return Returns the recipients.
-// */
-// public Collection getRecipients() {
-// return recipients;
-// }
- /* (non-Javadoc)
- * @see org.masukomi.aspirin.core.MailWatcher#deliverySuccess(javax.mail.internet.MimeMessage, org.apache.mailet.MailAddress)
- */
- public void deliverySuccess(MimeMessage message, String recipient) {
- if (this.message == null){
- hasSucceeded = true;
- lastRecipient = recipient;
-// que.removeWatcher(this);
- } else if (this.message == message) {
- hasSucceeded = true;
- lastRecipient = recipient;
-// que.removeWatcher(this);
- }
-
- }
- /* (non-Javadoc)
- * @see org.masukomi.aspirin.core.MailWatcher#deliveryFailure(javax.mail.internet.MimeMessage, org.apache.mailet.MailAddress)
- */
- public void deliveryFailure(MimeMessage message, String recipient, MessagingException mex) {
- if (this.message == null){
- hasFailed = true;
- lastRecipient = recipient;
-// que.removeWatcher(this);
- } else if (this.message == message) {
- hasFailed = true;
- lastRecipient = recipient;
-// que.removeWatcher(this);
- }
- }
- @Override
- public void deliveryFinished(MimeMessage message) {
- // TODO Auto-generated method stub
-
- }
-}
View
6 src/main/java/org/masukomi/aspirin/core/delivery/DeliveryManager.java
@@ -15,7 +15,6 @@
import org.masukomi.aspirin.core.config.ConfigurationChangeListener;
import org.masukomi.aspirin.core.config.ConfigurationMBean;
import org.masukomi.aspirin.core.dns.ResolveHost;
-import org.masukomi.aspirin.core.listener.NotifyListeners;
import org.masukomi.aspirin.core.store.mail.MailStore;
import org.masukomi.aspirin.core.store.queue.DeliveryState;
import org.masukomi.aspirin.core.store.queue.QueueInfo;
@@ -66,7 +65,6 @@ public DeliveryManager() {
// TODO create by configuration
deliveryHandlers.put(SendMessage.class.getCanonicalName(), new SendMessage());
deliveryHandlers.put(ResolveHost.class.getCanonicalName(), new ResolveHost());
- deliveryHandlers.put(NotifyListeners.class.getCanonicalName(), new NotifyListeners());
AspirinInternal.getConfiguration().addListener(this);
}
@@ -188,6 +186,10 @@ public void release(QueueInfo qi) {
AspirinInternal.getLogger().trace("DeliveryManager.release(): Release item '{}'.",qi.getMailid());
}
+ public boolean isCompleted(QueueInfo qi) {
+ return queueStore.isCompleted(qi.getMailid());
+ }
+
@Override
public void configChanged(String parameterName) {
synchronized (mailingLock) {
View
18 src/main/java/org/masukomi/aspirin/core/listener/NotifyListeners.java
@@ -1,18 +0,0 @@
-package org.masukomi.aspirin.core.listener;
-
-import org.masukomi.aspirin.core.AspirinInternal;
-import org.masukomi.aspirin.core.delivery.DeliveryContext;
-import org.masukomi.aspirin.core.delivery.DeliveryException;
-import org.masukomi.aspirin.core.delivery.DeliveryHandler;
-
-public class NotifyListeners implements DeliveryHandler {
-
- @Override
- public void handle(DeliveryContext dCtx) throws DeliveryException {
- ListenerManager listenerM = AspirinInternal.getListenerManager();
- if( listenerM == null )
- return;
- listenerM.notifyListeners(dCtx.getQueueInfo());
- }
-
-}

0 comments on commit 69cb6f6

Please sign in to comment.
Something went wrong with that request. Please try again.