KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > exoplatform > services > communication > sms > encoder > prodat > ProdatResolverImpl


1 /**
2  * Copyright 2001-2004 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.encoder.prodat;
6
7 import org.exoplatform.services.communication.sms.encoder.*;
8
9 /**
10  * @author Ove Ranheim (oranheim@yahoo.no)
11  * @since Jun 18, 2004 6:12:25 PM
12  */

13 public class ProdatResolverImpl implements Resolver {
14
15     private static ProdatResolverImpl _me;
16
17     /*
18      * @see org.exoplatform.services.communication.sms.encoder.Resolver#getFormatter(org.exoplatform.services.communication.sms.encoder.MessageFormat)
19      */

20     public Formatter getFormatter(MessageFormat format) {
21         Formatter formatter = null;
22         if (format.equals(MessageFormat.PLAIN_TEXT))
23             formatter = TextFormatter.getInstance();
24         else if (format.equals(MessageFormat.RINGTONE))
25             formatter = RingtoneFormatter.getInstance();
26         else if (format.equals(MessageFormat.OPERATOR_LOGO))
27             formatter = OperatorLogoFormatter.getInstance();
28         else if (format.equals(MessageFormat.CALLER_GROUP_GRAPHIC))
29             formatter = CallerGroupGraphicFormatter.getInstance();
30         else if (format.equals(MessageFormat.PICTURE))
31             formatter = PictureFormatter.getInstance();
32         else if (format.equals(MessageFormat.VCARD))
33             formatter = VCardFormatter.getInstance();
34         else if (format.equals(MessageFormat.VCALENDAR))
35             formatter = VCalendarFormatter.getInstance();
36         else if (format.equals(MessageFormat.RAW_BINARY_UDH))
37             formatter = RawBinaryUDHFormatter.getInstance();
38         else if (format.equals(MessageFormat.UNICODE_TEXT)) formatter = UnicodeFormatter.getInstance();
39         return formatter;
40     }
41
42     /*
43      * @see org.exoplatform.services.communication.sms.encoder.Resolver#getOperationCode(org.exoplatform.services.communication.sms.encoder.MessageFormat)
44      */

45     public Object JavaDoc getOperationCode(MessageFormat format) {
46         Object JavaDoc opcode = null;
47         if (format.equals(MessageFormat.PLAIN_TEXT))
48             opcode = new Integer JavaDoc(1);
49         else if (format.equals(MessageFormat.RINGTONE))
50             opcode = new Integer JavaDoc(2);
51         else if (format.equals(MessageFormat.OPERATOR_LOGO))
52             opcode = new Integer JavaDoc(3);
53         else if (format.equals(MessageFormat.CALLER_GROUP_GRAPHIC))
54             opcode = new Integer JavaDoc(4);
55         else if (format.equals(MessageFormat.PICTURE))
56             opcode = new Integer JavaDoc(5);
57         else if (format.equals(MessageFormat.VCARD))
58             opcode = new Integer JavaDoc(6);
59         else if (format.equals(MessageFormat.VCALENDAR))
60             opcode = new Integer JavaDoc(7);
61         else if (format.equals(MessageFormat.RAW_BINARY_UDH))
62             opcode = new Integer JavaDoc(8);
63         else if (format.equals(MessageFormat.UNICODE_TEXT)) opcode = new Integer JavaDoc(9);
64         return opcode;
65     }
66
67     public static ProdatResolverImpl getInstance() {
68         if (_me == null) _me = new ProdatResolverImpl();
69         return _me;
70     }
71
72 }
Popular Tags