KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > communication > sms > impl > SmsServiceImpl


1 /***************************************************************************
2  * Copyright 2001-2003 The eXo Platform SARL All rights reserved. *
3  * Please look at license.txt in info directory for more license detail. *
4  **************************************************************************/

5 package org.exoplatform.services.communication.sms.impl;
6
7 import org.exoplatform.services.communication.sms.SmsService;
8 import org.exoplatform.services.communication.sms.common.*;
9 import org.exoplatform.services.communication.sms.model.*;
10 import org.exoplatform.services.communication.sms.provider.*;
11 import org.exoplatform.services.communication.sms.provider.SenderImpl;
12 import org.exoplatform.services.communication.sms.provider.prodat.ProdatProviderImpl;
13
14 /**
15  *
16  * @author: Ove Ranheim
17  * @email: oranheim@users.sourceforge.net
18  */

19 public class SmsServiceImpl implements SmsService {
20
21     public SmsServiceImpl() {
22     }
23
24     /*
25      * @see org.exoplatform.services.communication.sms.SmsService#createProdatProvider(java.lang.String,
26      * java.lang.String)
27      */

28     public Provider createProdatProvider(String JavaDoc username, String JavaDoc password) {
29         Provider provider = new ProdatProviderImpl();
30         provider.getOperator().setUsername(username);
31         provider.getOperator().setPassword(password);
32         return provider;
33     }
34
35     /*
36      * @see org.exoplatform.services.communication.sms.SmsService#createMessages()
37      */

38     public Messages createMessages() {
39         return new MessagesImpl();
40     }
41
42     /*
43      * @see org.exoplatform.services.communication.sms.SmsService#createMessaage()
44      */

45     public Message createMessage() {
46         return new MessageImpl();
47     }
48
49     /*
50      * @see org.exoplatform.services.communication.sms.SmsService#createRecipient()
51      */

52     public Recipient createRecipient(String JavaDoc to) {
53         return new RecipientImpl(to);
54     }
55
56     /*
57      * @see org.exoplatform.services.communication.sms.SmsService#getSender()
58      */

59     public Sender createSender(Provider provider) {
60         Sender sender = new SenderImpl(provider);
61         return sender;
62     }
63
64     /*
65      * @see org.exoplatform.services.communication.sms.SmsService#sendSms(org.exoplatform.services.communication.sms.provider.Provider,
66      * org.exoplatform.services.communication.sms.model.Messages)
67      */

68     public boolean sendSms(Provider provider, Messages messages) throws CommunicationError, RequestException, ResponseException, ConvertException {
69         Sender sender = new SenderImpl(provider);
70         sender.prepare(messages);
71         sender.send();
72         return messages.hasErrorOccured();
73     }
74
75 }
Popular Tags