KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > airsent > business > sms > SMS


1 /*
2  * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
3  * Reserved.
4  *
5  * This source code file is distributed by Lutris Technologies, Inc. for
6  * use only by licensed users of product(s) that include this source
7  * file. Use of this source file or the software that uses it is covered
8  * by the terms and conditions of the Lutris Enhydra Development License
9  * Agreement included with this product.
10  *
11  * This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
12  * ANY KIND, either express or implied. See the License for the specific terms
13  * governing rights and limitations under the License.
14  *
15  * Contributor(s):
16  *
17  * $Id: SMS.java,v 1.1 2004/08/16 09:33:11 slobodan Exp $
18  */

19
20 package com.lutris.airsent.business.sms;
21 import java.io.IOException JavaDoc;
22
23 /**
24  * Utility class used to send email.
25  *
26  * @author Joseph Shoop
27  */

28 public class SMS{
29     private String JavaDoc host = "localhost";
30     private String JavaDoc port = "9001";
31     private String JavaDoc id = "0";
32     private String JavaDoc type = "0";
33     private String JavaDoc password = "foo";
34  
35
36     /**
37      * Constructor with mail server name.
38      *
39      *
40      * @param mailserverURL
41      *
42      */

43     public SMS(String JavaDoc host, String JavaDoc port, String JavaDoc id,
44            String JavaDoc type, String JavaDoc password) throws IOException JavaDoc {
45     this.host = host;
46     this.port = port;
47     this.id = id;
48     this.type = type;
49     this.password = password;
50     
51     }
52
53     /**
54      * Sends mail.
55      *
56      *
57      * @param id
58      * @param body
59      *
60      * @throws Exception
61      *
62      */

63     public void sendMessage(String JavaDoc id, String JavaDoc body) throws Exception JavaDoc {
64     try {
65         sendSMSMessage(id, body);
66     } catch (Exception JavaDoc e) {
67         throw new Exception JavaDoc("Error opening socket" + e);
68     }
69     
70     }
71     
72     private void sendSMSMessage(String JavaDoc id, String JavaDoc body) throws Exception JavaDoc {
73     try {
74         //Assuming we are using Noctor SMS SDK.
75
// sms.Smpp t = new Smpp("host", port);
76
// t.bind(new sms.Binding(id, type, password));
77
// sms.Address address = new sms.Address(id, sms.GSM_TON_INTERNATIONAL,
78
// sms.GSM_NPI_E164);
79
// smsMessage message = new sms.Message(address, body);
80
// t.send(message);
81

82     } catch (Exception JavaDoc e) {
83         throw new Exception JavaDoc("Error opening socket" + e);
84     }
85     
86     }
87
88 }
89
90
91
92
93
Popular Tags