View Javadoc

1   package org.wcb.autohome.implementations;
2   
3   import org.wcb.common.EmailAuthenticator;
4   
5   import java.io.Serializable;
6   
7   /***
8    * Copyright (C) 1999  Walter Bogaardt
9    *
10   * This library is free software; you can redistribute it and/or
11   * modify it under the terms of the GNU Lesser General Public
12   * License as published by the Free Software Foundation; either
13   * version 2 of the License, or (at your option) any later version.
14   *
15   * This library is distributed in the hope that it will be useful,
16   * but WITHOUT ANY WARRANTY; without even the implied warranty of
17   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18   * Lesser General Public License for more details.
19   *
20   * You should have received a copy of the GNU Lesser General Public
21   * License along with this library; if not, write to the Free Software
22   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
23   *
24   * EmailHeaderBean.java
25   *
26   * Created on February 2, 2004, 7:59 PM
27   *
28   * @author  wbogaardt
29   *
30   *  Project:   Home Automation Interface
31   *  Filename:  $Id: EmailHeaderBean.java,v 1.2 2004/02/27 01:29:52 wbogaardt Exp $
32   *  Abstract:  This allows persistence of centeralized values accross the sessions and gateways.
33   *
34   *  $Log: EmailHeaderBean.java,v $
35   *  Revision 1.2  2004/02/27 01:29:52  wbogaardt
36   *  modified classes so they conform to Checkstyle format in readability
37   *
38   *  Revision 1.1  2004/02/02 23:40:03  wbogaardt
39   *  Adding header bean which simplifies saving and geting values from config.ini file
40   *
41   * */
42  public class EmailHeaderBean implements Serializable {
43  
44      private String toAddress;
45      private String fromAddress;
46      private String smtpHost;
47      private EmailAuthenticator authenticator;
48      private String noticeFreq;
49  
50      /***
51       * This class is suppose to be a wrapper for the interfaces between
52       * the AutoHomeSession and the HAGateway and the final properties file.
53       * This class makes it easier for the different properties to be passed around.
54       * @param sTo the to address for email
55       * @param sFrom the from address for email
56       * @param sHost the smtp host address
57       */
58      public EmailHeaderBean(String sTo, String sFrom, String sHost) {
59          this.toAddress = sTo;
60          this.fromAddress = sFrom;
61          this.smtpHost = sHost;
62      }
63  
64      /***
65       * Gets the email address that notifications are sent to, and which the
66       * user has saved through configuring it.
67       * @param sTo send to address
68       */
69      public void setEmailToAddress(String sTo) {
70          this.toAddress = sTo;
71      }
72  
73      /***
74       * This sets the from address in the email so it does not
75       * always have to come from the default address of alice@localhost
76       * The user can set this to what ever address they want.
77       * @param sFrom user defined email from address
78       */
79      public void setEmailFromAddress(String sFrom) {
80          this.fromAddress = sFrom;
81      }
82  
83      /***
84       * The user can save the SMTP host to the HASConfig.ini file.
85       * @param sHost Email host address
86       */
87      public void setEmailHost(String sHost) {
88          this.smtpHost = sHost;
89      }
90  
91      /***
92       * Allows setting of email authentication since the user email account
93       * may require authentication
94       * @param auth The email authenticator object which extends the Java mail Authenticator
95       */
96      public void setEmailAuthenticator(EmailAuthenticator auth)
97      {
98          this.authenticator = auth;
99      }
100 
101     /***
102      * Allows the user to save the frequency of events as never, on event,
103      * hourly, 12 hours, daily, weekly.
104      * @param sFreq never, onevent, hourly, 12hours, daily, weekly
105      */
106     public void setEmailNoticeFreq(String sFreq) {
107         this.noticeFreq = sFreq;
108     }
109     /***
110      * Gets the email address that notifications are sent to, and which the
111      * user has saved through configuring it.
112      * @return Email send to address
113      */
114     public String getEmailToAddress() {
115         return this.toAddress;
116     }
117 
118     /***
119      * Returns the email from address from the HASConfig.ini file
120      *
121      * @return The saved from email address
122      */
123     public String getEmailFromAddress() {
124         return this.fromAddress;
125     }
126 
127     /***
128      * The user's email smtp host that is used to send email messages
129      * through.
130      * @return The saved SMTP host name
131      */
132     public String getEmailHost() {
133         return this.smtpHost;
134     }
135 
136     /***
137      * Gets the email authenticator object.
138      * @return The email requires authentication. This extends the Java mail Authenticator
139      */
140     public EmailAuthenticator getEmailAuthenticator() {
141         return this.authenticator;
142     }
143 
144     /***
145      * Email Notice frequency which is either never, on event,  hourly,
146      * 12 hours, daily, weekly.
147      *
148      * @return String of never, onevent, hourly, 12hours, daily, weekly
149      */
150     public String getEmailNoticeFreq() {
151         return this.noticeFreq;
152     }
153 
154 }