KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > lutris > airsent > business > HomeManagerImpl


1 /*
2  * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
3  * Reserved.
4  *
5  * This source code file is distributed by Lutris Technologies, Inc. for
6  * use only by licensed users of product(s) that include this source
7  * file. Use of this source file or the software that uses it is covered
8  * by the terms and conditions of the Lutris Enhydra Development License
9  * 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: HomeManagerImpl.java,v 1.1 2004/08/16 09:33:11 slobodan Exp $
18  */

19
20 package com.lutris.airsent.business;
21
22 import com.lutris.airsent.business.messenger.*;
23 import com.lutris.airsent.business.delivery.*;
24 import com.lutris.airsent.business.customer.*;
25 import com.lutris.airsent.business.address.*;
26 import com.lutris.airsent.business.email.*;
27 import com.lutris.airsent.business.sms.*;
28 import com.lutris.airsent.spec.delivery.DeliveryManager;
29 import com.lutris.airsent.spec.messenger.MessengerManager;
30 import com.lutris.airsent.spec.sms.SMSManager;
31 import com.lutris.airsent.spec.customer.CustomerManager;
32 import com.lutris.airsent.spec.email.EmailManager;
33 import com.lutris.airsent.business.address.AddressManager;
34 import com.lutris.airsent.spec.AirSentException;
35 import com.lutris.airsent.spec.HomeManager;
36 import com.lutris.util.Config;
37
38 /**
39  *
40  */

41 public class HomeManagerImpl implements HomeManager {
42
43     private static HomeManagerImpl instance = null;
44     private CustomerManagerImpl customerManager = null;
45     private DeliveryManagerImpl deliveryManager = null;
46     private MessengerManagerImpl messengerManager = null;
47     private AddressManager addressManager = null;
48     private EmailManagerImpl emailManager = null;
49     private SMSManagerImpl smsManager = null;
50     
51     /**
52      *Creates an instance of HomeManager
53      *
54      */

55     public static HomeManagerImpl getInstance()
56         throws AirSentBusinessException {
57
58         if (instance == null) {
59             throw new AirSentBusinessException("HomeManager: not initialized.");
60        
61         }
62         return instance;
63     }
64     
65     public HomeManager getInst()
66         throws AirSentBusinessException {
67
68         if (instance == null) {
69             throw new AirSentBusinessException("HomeManager: not initialized.");
70         }
71         return instance;
72     }
73     
74     public HomeManagerImpl(){}
75
76     /**
77      *Creates an instance of HomeManager with Config
78      *
79      *
80      */

81     private HomeManagerImpl(Config config)
82         throws AirSentBusinessException {
83
84     try {
85         deliveryManager = new DeliveryManagerImpl();
86         customerManager = new CustomerManagerImpl();
87         messengerManager = new MessengerManagerImpl();
88         addressManager = new AddressManager();
89         emailManager = new EmailManagerImpl(config);
90         smsManager = new SMSManagerImpl(config);
91     } catch (Exception JavaDoc e) {
92         throw new AirSentBusinessException("Exception creating factories", e);
93     }
94     }
95
96
97     /**
98      *Initializes HomeManager with Config
99      *@param Config config
100      *
101      */

102     public synchronized void initialize(Config config)
103             throws AirSentBusinessException {
104        
105         if (instance != null) {
106             throw new AirSentBusinessException("HomeManager: already initialized.");
107         }
108         instance = new HomeManagerImpl(config);
109     }
110
111     
112     
113     /**
114      *Gets the DeliveryManager
115      *
116      *@return the delivery Manager
117      */

118     public DeliveryManager getDeliveryManager() {
119         return deliveryManager;
120     }
121
122     /**
123      *Gets the CustomerManager
124      *
125      *@return the customer Manager
126      */

127     public CustomerManager getCustomerManager() {
128         return customerManager;
129     }
130
131     /**
132      * Returns the MessengerManager
133      * @return MessengerManager
134      */

135     public MessengerManager getMessengerManager() {
136     return messengerManager;
137     }
138
139     /**
140      * Returns the AddressManager
141      * @return AddressManager
142      */

143     public AddressManager getAddressManager() {
144     return addressManager;
145     }
146
147     /**
148      * Returns the EmailManager
149      * @return EmailManager
150      */

151     public EmailManager getEmailManager() {
152     return emailManager;
153     }
154
155      /**
156      * Returns the EmailManager
157      * @return EmailManager
158      */

159     public SMSManager getSMSManager() {
160     return smsManager;
161     }
162
163 }
164
165
166
167
168
169
170
171
Popular Tags