01: /*
02: * MessageService: The message service daemon
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
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: * This object is responsible for creating the requested message managers.
29: * Identified by id or Message reference.
30: *
31: * @author Brett Chaldecott
32: */
33: public class MessageManagerFactory {
34:
35: // the classes singleton information
36: private static MessageManagerFactory singleton = null;
37:
38: /**
39: * Creates a new instance of MessageManagerFactory
40: */
41: private MessageManagerFactory() {
42: }
43:
44: /**
45: * This method returns the message manager factory instance.
46: *
47: * @return The reference to the message manager factory.
48: */
49: public static MessageManagerFactory getInstance() {
50: if (singleton == null) {
51: singleton = new MessageManagerFactory();
52: }
53: return singleton;
54: }
55:
56: /**
57: * This method returns a message for the given id.
58: *
59: * @return The reference to the message manager.
60: * @param id The id of the message.
61: * @exception MessageServiceException
62: */
63: public MessageManager getMessageManager(String id)
64: throws MessageServiceException {
65: return new MessageManagerImpl(id);
66: }
67:
68: /**
69: * This method returns a message for the given id.
70: *
71: * @return The reference to the message manager.
72: * @param id The id of the message.
73: * @exception MessageServiceException
74: */
75: public MessageManager getMessageManager(Message message)
76: throws MessageServiceException {
77: return new MessageManagerImpl(message);
78: }
79: }
|