01: /*
02: * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
03: * Reserved.
04: *
05: * This source code file is distributed by Lutris Technologies, Inc. for
06: * use only by licensed users of product(s) that include this source
07: * file. Use of this source file or the software that uses it is covered
08: * by the terms and conditions of the Lutris Enhydra Development License
09: * 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 2006-09-11 12:27:25 sinisa Exp $
18: */
19:
20: package com.lutris.airsent.business.sms;
21:
22: import java.io.IOException;
23:
24: /**
25: * Utility class used to send email.
26: *
27: * @author Joseph Shoop
28: */
29: public class SMS {
30: private String host = "localhost";
31: private String port = "9001";
32: private String id = "0";
33: private String type = "0";
34: private String password = "foo";
35:
36: /**
37: * Constructor with mail server name.
38: *
39: *
40: * @param mailserverURL
41: *
42: */
43: public SMS(String host, String port, String id, String type,
44: String password) throws IOException {
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 id, String body) throws Exception {
64: try {
65: sendSMSMessage(id, body);
66: } catch (Exception e) {
67: throw new Exception("Error opening socket" + e);
68: }
69:
70: }
71:
72: private void sendSMSMessage(String id, String body)
73: throws Exception {
74: try {
75: //Assuming we are using Noctor SMS SDK.
76: // sms.Smpp t = new Smpp("host", port);
77: // t.bind(new sms.Binding(id, type, password));
78: // sms.Address address = new sms.Address(id, sms.GSM_TON_INTERNATIONAL,
79: // sms.GSM_NPI_E164);
80: // smsMessage message = new sms.Message(address, body);
81: // t.send(message);
82:
83: } catch (Exception e) {
84: throw new Exception("Error opening socket" + e);
85: }
86:
87: }
88:
89: }
|