View Javadoc
1 /* 2 * $Id: JabberMessageTag.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.JabberMessageBean; 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.JabberMessageBean 44 * 45 */ 46 public class JabberMessageTag extends TagSupport { 47 48 private JabberMessageBean bean = new JabberMessageBean(); 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 protected void execute() throws JellyTagException { 65 try { 66 bean.execute(); 67 } catch (Exception e) { 68 String message = "Jabber message sending failed"; 69 throw new JellyTagException(message, e); 70 } 71 } 72 73 /*** 74 * Set by the <code>${maven.im.jabber.from}</code> property. 75 * @param from the from String to set 76 * @see JabberMessageBean#setFrom(String) 77 */ 78 public void setFrom(String from) { 79 bean.setFrom(from); 80 } 81 82 /*** 83 * Set by the <code>${maven.im.jabber.host}</code> property. 84 * @param host the host String to set 85 * @see JabberMessageBean#setHost(String) 86 */ 87 public void setHost(String host) { 88 bean.setHost(host); 89 } 90 91 /*** 92 * Set by the <code>${maven.im.message}</code> property. 93 * @param message the message String to set 94 * @see JabberMessageBean#setMessage(String) 95 */ 96 public void setMessage(String message) { 97 bean.setMessage(message); 98 } 99 100 /*** 101 * Set by the <code>${maven.im.jabber.password}</code> property. 102 * @param password the password String to set 103 * @see JabberMessageBean#setPassword(String) 104 */ 105 public void setPassword(String password) { 106 bean.setPassword(password); 107 } 108 109 /*** 110 * Set by the <code>${maven.im.jabber.port}</code> property. 111 * @param port the port number int to set 112 * @see JabberMessageBean#setPort(int) 113 */ 114 public void setPort(int port) { 115 bean.setPort(port); 116 } 117 118 /*** 119 * Set by the <code>${maven.im.jabber.secure}</code> property. 120 * @param secure the secure boolean value to set 121 * @see JabberMessageBean#setSecure(boolean) 122 */ 123 public void setSecure(boolean secure) { 124 bean.setSecure(secure); 125 } 126 127 /*** 128 * Set by the <code>${maven.im.jabber.secure.port}</code> property. 129 * @param securePort the secure port number int to set 130 * @see JabberMessageBean#setSecurePort(int) 131 */ 132 public void setSecurePort(int securePort) { 133 bean.setSecurePort(securePort); 134 } 135 136 /*** 137 * Set by the <code>${maven.im.jabber.to}</code> property. 138 * @param to the to String to set 139 * @see JabberMessageBean#setTo(String) 140 */ 141 public void setTo(String to) { 142 bean.setTo(to); 143 } 144 145 } 146 147 /* 148 * $Log: JabberMessageTag.java,v $ 149 * Revision 1.2 2003/10/02 01:27:16 smulube 150 * added better comments. 151 * 152 * Revision 1.1 2003/09/26 01:20:09 smulube 153 * tags, and library that provide basic functionality. 154 * 155 */

This page was automatically generated by Maven