01: /* Copyright 2003 The JA-SIG Collaborative. All rights reserved.
02: * See license distributed with this file and
03: * available online at http://www.uportal.org/license.html
04: */
05:
06: package org.jasig.portal.services.dom;
07:
08: /**
09: * This service is meant to run at system initialization that will provide
10: * any DOM initialization. For example, with resin, you can configure which
11: * compiler to use. It will use the DOMInitServicaFactory to retrieve the
12: * actual implementation of the init service.
13: *
14: * @author Nick Bolton, nbolton@unicon.net
15: * @version $Revision: 34784 $
16: */
17: public final class DOMInitService {
18:
19: private static final DOMInitService m_instance = new DOMInitService();
20: private static boolean bInitialized = false;
21:
22: protected DOMInitService() {
23: initialize();
24: }
25:
26: public final static DOMInitService instance() {
27: return m_instance;
28: }
29:
30: /**
31: * Executes the actual dom init service.
32: */
33: private final static void initialize() {
34: // don't bother if we are already initialized
35: if (bInitialized) {
36: return;
37: }
38:
39: try {
40: IDOMInitService service = DOMInitServiceFactory
41: .getService();
42: if (service != null) {
43: service.initialize();
44: }
45: bInitialized = true;
46: } catch (Exception e) {
47: System.err.println("Problem executing DOM initialization");
48: e.printStackTrace();
49: } catch (Error er) {
50: System.err.println("Problem executing DOM initialization");
51: er.printStackTrace();
52: }
53: }
54: }
|