01: /**
02: * $Id: ProviderServiceFactory.java,v 1.2 2005/04/19 22:24:57 mjain Exp $
03: * Copyright 2005 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.service.provider;
14:
15: import com.sun.portal.service.Service;
16:
17: import com.sun.portal.service.provider.ProviderService;
18: import com.sun.portal.service.common.ServiceConfig;
19:
20: /**
21: *
22: * @author mjain
23: */
24: public class ProviderServiceFactory {
25:
26: public static ProviderServiceFactory _instance;
27: private static String _providerServiceClass;
28:
29: public static void init() {
30: _instance = new ProviderServiceFactory();
31: ServiceConfig config = ServiceConfig.getInstance();
32: _providerServiceClass = config.getProviderServiceClassname();
33:
34: }
35:
36: public static ProviderService instantiateProviderService() {
37: try {
38: ProviderService service = (ProviderService) (Class
39: .forName(_providerServiceClass).newInstance());
40: return service;
41: } catch (Exception ex) {
42: ex.printStackTrace();
43: throw new RuntimeException(
44: "Provider Service object not created");
45: }
46:
47: }
48: }
|