1 /*
2 * $Id: MSNMessageTag.java,v 1.2 2003/10/02 01:27:16 smulube Exp $
3 *
4 * ***** BEGIN LICENSE BLOCK *****
5 * ===========================================================================
6 * Copyright (c) 2003 Sam Mulube
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
9 * of this software and associated documentation files (the "Software"), to deal
10 * in the Software without restriction, including without limitation the rights
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 * copies of the Software, and to permit persons to whom the Software is
13 * furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.COPYRIGHT AND PERMISSION NOTICE
25 * ===========================================================================
26 * ***** END LICENSE BLOCK *****
27 */
28 package org.zerofun.maven.im.jelly;
29
30 import org.apache.commons.jelly.JellyTagException;
31 import org.apache.commons.jelly.MissingAttributeException;
32 import org.apache.commons.jelly.TagSupport;
33 import org.apache.commons.jelly.XMLOutput;
34 import org.zerofun.maven.im.beans.MSNMessageBean;
35
36 /***
37 * This class is the proxy which allows the Jelly script to invoke the
38 * functionality of the actual JavaBean class which provides the actual
39 * message sending functionality.
40 *
41 * @author <a href="mailto:sam@mulube.com">Sam Mulube</a>
42 * @version $Revision: 1.2 $
43 * @see org.zerofun.maven.im.beans.MSNMessageBean
44 *
45 */
46 public class MSNMessageTag extends TagSupport {
47
48 private MSNMessageBean bean = new MSNMessageBean();
49
50 /***
51 * @see org.apache.commons.jelly.Tag#doTag(org.apache.commons.jelly.XMLOutput)
52 */
53 public void doTag(XMLOutput arg0)
54 throws MissingAttributeException, JellyTagException {
55 execute();
56 }
57
58 /***
59 * Invokes the main execute method of the contained bean that performs the
60 * actual message sending functionality.
61 *
62 * @throws JellyTagException
63 */
64 private void execute() throws JellyTagException {
65 try {
66 bean.execute();
67 } catch (Exception e) {
68 String message = "Error sending MSN message.";
69 throw new JellyTagException(message, e);
70 }
71 }
72
73 /***
74 * Set by the <code>${maven.im.aim.from}</code> property.
75 * @param from the from String to set
76 * @see MSNMessageBean#setFrom(String)
77 */
78 public void setFrom(String from) {
79 bean.setFrom(from);
80 }
81
82 /***
83 * Set by the <code>${maven.im.message}</code> property.
84 * @param message the message String to set
85 * @see MSNMessageBean#setMessage(String)
86 */
87 public void setMessage(String message) {
88 bean.setMessage(message);
89 }
90
91 /***
92 * Set by the <code>${maven.im.msn.from}</code> property.
93 * @param password the password String to set
94 * @see MSNMessageBean#setPassword(String)
95 */
96 public void setPassword(String password) {
97 bean.setPassword(password);
98 }
99
100 /***
101 * Set by the <code>${maven.im.msn.to}</code> property.
102 * @param to the to String to set
103 * @see MSNMessageBean#setTo(String)
104 */
105 public void setTo(String to) {
106 bean.setTo(to);
107 }
108
109 }
110
111 /*
112 * $Log: MSNMessageTag.java,v $
113 * Revision 1.2 2003/10/02 01:27:16 smulube
114 * added better comments.
115 *
116 * Revision 1.1 2003/09/26 01:20:09 smulube
117 * tags, and library that provide basic functionality.
118 *
119 */
This page was automatically generated by Maven