1 25 26 package org.objectweb.jonas.mail.factory; 27 28 import java.util.Properties ; 29 30 import javax.management.NotificationFilter ; 31 import javax.management.NotificationListener ; 32 33 import org.objectweb.jonas.management.ListenerJavaBean; 34 import org.objectweb.jonas.management.ReconfiguredProp; 35 import org.objectweb.jonas.management.j2eemanagement.J2EEResource; 36 import org.objectweb.util.monolog.api.BasicLevel; 37 38 43 public abstract class JavaMailResource extends J2EEResource { 44 45 JavaMail mailFactory = null; 46 47 55 public JavaMailResource(String objectName, boolean stateManageable, boolean statisticsProvider, boolean eventProvider, JavaMail mailFactory) { 56 super(objectName, stateManageable, statisticsProvider, eventProvider); 57 this.mailFactory = mailFactory; 58 } 59 60 64 public String getFactoryName() { 65 return mailFactory.getFactoryName(); 66 } 67 71 public String getName() { 72 return mailFactory.getName(); 73 } 74 78 public void setName(String name) { 79 mailFactory.setName(name); 80 } 81 85 public String getFactoryType() { 86 return mailFactory.getType(); 87 } 88 89 93 public Properties getAuthenticationProperties() { 94 return mailFactory.getAuthenticationProperties(); 95 } 96 97 101 public void setAuthenticationProperties(Properties props) { 102 mailFactory.setAuthenticationProperties(props); 103 notifyReconfiguration(props); 104 } 105 106 110 public Properties getSessionProperties() { 111 return mailFactory.getSessionProperties(); 112 } 113 114 118 public void setSessionProperties(Properties props) { 119 mailFactory.setSessionProperties(props); 120 notifyReconfiguration(props); 121 } 122 123 126 public void saveConfig() { 127 sendSaveNotification(getSequenceNumber(), getFactoryName()); 128 } 129 130 134 protected abstract long getSequenceNumber(); 135 136 protected void notifyReconfiguration(Properties props) { 137 ReconfiguredProp reconfiguredProp = new ReconfiguredProp("", null); 139 reconfiguredProp.setProps(props); 140 sendReconfigNotification(getSequenceNumber(), getFactoryName(), reconfiguredProp); 142 } 143 } 144 | Popular Tags |