KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > daemon > messageservice > message > MessageManagerFactory


1 /*
2  * MessageService: The message service daemon
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  *
19  * MessageManagerFactory.java
20  */

21
22 // the package path
23
package com.rift.coad.daemon.messageservice.message;
24
25 import com.rift.coad.daemon.messageservice.*;
26
27
28
29 /**
30  * This object is responsible for creating the requested message managers.
31  * Identified by id or Message reference.
32  *
33  * @author Brett Chaldecott
34  */

35 public class MessageManagerFactory {
36     
37     // the classes singleton information
38
private static MessageManagerFactory singleton = null;
39     
40     /**
41      * Creates a new instance of MessageManagerFactory
42      */

43     private MessageManagerFactory() {
44     }
45     
46     
47     /**
48      * This method returns the message manager factory instance.
49      *
50      * @return The reference to the message manager factory.
51      */

52     public static MessageManagerFactory getInstance() {
53         if (singleton == null) {
54             singleton = new MessageManagerFactory();
55         }
56         return singleton;
57     }
58     
59     
60     /**
61      * This method returns a message for the given id.
62      *
63      * @return The reference to the message manager.
64      * @param id The id of the message.
65      * @exception MessageServiceException
66      */

67     public MessageManager getMessageManager(String JavaDoc id) throws
68             MessageServiceException {
69         return new MessageManagerImpl(id);
70     }
71     
72     
73     /**
74      * This method returns a message for the given id.
75      *
76      * @return The reference to the message manager.
77      * @param id The id of the message.
78      * @exception MessageServiceException
79      */

80     public MessageManager getMessageManager(Message message) throws
81             MessageServiceException {
82         return new MessageManagerImpl(message);
83     }
84 }
85
Popular Tags