001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or 1any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: JavaMailResourceMBean.java 9118 2006-07-05 13:23:44Z sauthieg $
023: * --------------------------------------------------------------------------
024: */package org.objectweb.jonas.mail.factory;
025:
026: //import java
027: import java.util.Properties;
028:
029: import javax.management.MBeanException;
030: import javax.management.NotificationFilter;
031: import javax.management.NotificationListener;
032:
033: import org.apache.commons.modeler.BaseModelMBean;
034:
035: /**
036: * This interface defines all the management methods provided by the JavaMailResource objects.
037: * @author Florent Benoit
038: * @author Ludovic Bert
039: * @author Adriana Danes:
040: * - Refactor code: rename the management methods (use straightforward names, as they are to be used in a Management Console)
041: * - J2EEManagement conformance
042: * - Use jakarta-commons modeler
043: */
044: public class JavaMailResourceMBean extends BaseModelMBean {
045: /**
046: * Default constructor
047: * @throws MBeanException if super constructor fails
048: */
049: public JavaMailResourceMBean() throws MBeanException {
050: super ();
051: }
052:
053: /**
054: * Get the name of the factory.
055: * @return name of the mail factory.
056: */
057: String getFactoryName() {
058: return (String) ((JavaMailResource) this .resource)
059: .getFactoryName();
060: }
061:
062: /**
063: * Get the name of the factory.
064: * @return name of the mail factory.
065: */
066: String getName() {
067: return (String) ((JavaMailResource) this .resource).getName();
068: }
069:
070: /**
071: * Set the name of the factory.
072: * @param name name of the mail factory.
073: */
074: void setName(String name) {
075: ((JavaMailResource) this .resource).setName(name);
076: }
077:
078: /**
079: * Get the type of the factory.
080: * @return type of the mail factory.
081: */
082: String getFactoryType() {
083: return (String) ((JavaMailResource) this .resource)
084: .getFactoryType();
085: }
086:
087: /**
088: * Get the authentication properties.
089: * @return properties of the authentication.
090: */
091: Properties getAuthenticationProperties() {
092: return (Properties) ((JavaMailResource) this .resource)
093: .getAuthenticationProperties();
094: }
095:
096: /**
097: * Set the authentication properties.
098: * @param props the authentication properties.
099: */
100: void setAuthenticationProperties(Properties props) {
101: ((JavaMailResource) this .resource)
102: .setAuthenticationProperties(props);
103: }
104:
105: /**
106: * Get the session properties.
107: * @return the properties of Session.
108: */
109: Properties getSessionProperties() {
110: return (Properties) ((JavaMailResource) this .resource)
111: .getSessionProperties();
112: }
113:
114: /**
115: * Set the session properties.
116: * @param props the Session properties.
117: */
118: void setSessionProperties(Properties props) {
119: ((JavaMailResource) this .resource).setSessionProperties(props);
120: }
121:
122: /**
123: * Save updated configuration
124: */
125: void saveConfig() {
126: ((JavaMailResource) this .resource).saveConfig();
127: }
128:
129: /**
130: * Add a new listener.
131: * @param pListner Listener to notify
132: * @param pFilter Notification filter
133: * @param pHandback ??
134: * @throws java.lang.IllegalArgumentException if notification is not done
135: */
136: public void addNotificationListener(NotificationListener pListner,
137: NotificationFilter pFilter, java.lang.Object pHandback)
138: throws java.lang.IllegalArgumentException {
139: ((JavaMailResource) (this.resource)).addNotificationListener(
140: pListner, pFilter, pHandback);
141: }
142: }
|