001: /*
002: * Copyright (c) 1999-2001 Lutris Technologies, Inc. All Rights
003: * Reserved.
004: *
005: * This source code file is distributed by Lutris Technologies, Inc. for
006: * use only by licensed users of product(s) that include this source
007: * file. Use of this source file or the software that uses it is covered
008: * by the terms and conditions of the Lutris Enhydra Development License
009: * Agreement included with this product.
010: *
011: * This Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
012: * ANY KIND, either express or implied. See the License for the specific terms
013: * governing rights and limitations under the License.
014: *
015: * Contributor(s):
016: *
017: * $Id: HomeManagerImpl.java,v 1.1 2006-09-11 12:27:24 sinisa Exp $
018: */
019:
020: package com.lutris.airsent.business;
021:
022: import com.lutris.airsent.business.messenger.*;
023: import com.lutris.airsent.business.delivery.*;
024: import com.lutris.airsent.business.customer.*;
025: import com.lutris.airsent.business.address.*;
026: import com.lutris.airsent.business.email.*;
027: import com.lutris.airsent.business.sms.*;
028: import com.lutris.airsent.spec.delivery.DeliveryManager;
029: import com.lutris.airsent.spec.messenger.MessengerManager;
030: import com.lutris.airsent.spec.sms.SMSManager;
031: import com.lutris.airsent.spec.customer.CustomerManager;
032: import com.lutris.airsent.spec.email.EmailManager;
033: import com.lutris.airsent.business.address.AddressManager;
034: import com.lutris.airsent.spec.AirSentException;
035: import com.lutris.airsent.spec.HomeManager;
036: import com.lutris.util.Config;
037:
038: /**
039: *
040: */
041: public class HomeManagerImpl implements HomeManager {
042:
043: private static HomeManagerImpl instance = null;
044: private CustomerManagerImpl customerManager = null;
045: private DeliveryManagerImpl deliveryManager = null;
046: private MessengerManagerImpl messengerManager = null;
047: private AddressManager addressManager = null;
048: private EmailManagerImpl emailManager = null;
049: private SMSManagerImpl smsManager = null;
050:
051: /**
052: *Creates an instance of HomeManager
053: *
054: */
055: public static HomeManagerImpl getInstance()
056: throws AirSentBusinessException {
057:
058: if (instance == null) {
059: throw new AirSentBusinessException(
060: "HomeManager: not initialized.");
061:
062: }
063: return instance;
064: }
065:
066: public HomeManager getInst() throws AirSentBusinessException {
067:
068: if (instance == null) {
069: throw new AirSentBusinessException(
070: "HomeManager: not initialized.");
071: }
072: return instance;
073: }
074:
075: public HomeManagerImpl() {
076: }
077:
078: /**
079: *Creates an instance of HomeManager with Config
080: *
081: *
082: */
083: private HomeManagerImpl(Config config)
084: throws AirSentBusinessException {
085:
086: try {
087: deliveryManager = new DeliveryManagerImpl();
088: customerManager = new CustomerManagerImpl();
089: messengerManager = new MessengerManagerImpl();
090: addressManager = new AddressManager();
091: emailManager = new EmailManagerImpl(config);
092: smsManager = new SMSManagerImpl(config);
093: } catch (Exception e) {
094: throw new AirSentBusinessException(
095: "Exception creating factories", e);
096: }
097: }
098:
099: /**
100: *Initializes HomeManager with Config
101: *@param Config config
102: *
103: */
104: public synchronized void initialize(Config config)
105: throws AirSentBusinessException {
106:
107: if (instance != null) {
108: throw new AirSentBusinessException(
109: "HomeManager: already initialized.");
110: }
111: instance = new HomeManagerImpl(config);
112: }
113:
114: /**
115: *Gets the DeliveryManager
116: *
117: *@return the delivery Manager
118: */
119: public DeliveryManager getDeliveryManager() {
120: return deliveryManager;
121: }
122:
123: /**
124: *Gets the CustomerManager
125: *
126: *@return the customer Manager
127: */
128: public CustomerManager getCustomerManager() {
129: return customerManager;
130: }
131:
132: /**
133: * Returns the MessengerManager
134: * @return MessengerManager
135: */
136: public MessengerManager getMessengerManager() {
137: return messengerManager;
138: }
139:
140: /**
141: * Returns the AddressManager
142: * @return AddressManager
143: */
144: public AddressManager getAddressManager() {
145: return addressManager;
146: }
147:
148: /**
149: * Returns the EmailManager
150: * @return EmailManager
151: */
152: public EmailManager getEmailManager() {
153: return emailManager;
154: }
155:
156: /**
157: * Returns the EmailManager
158: * @return EmailManager
159: */
160: public SMSManager getSMSManager() {
161: return smsManager;
162: }
163:
164: }
|