01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * See the License for the specific language governing rights and
10: * limitations under the License.
11: *
12: * The Initial Developer of the Original Code is Simulacra Media Ltd.
13: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14: *
15: * All Rights Reserved.
16: *
17: * Contributor(s):
18: */
19:
20: package org.openharmonise.dav.server.apm;
21:
22: import org.openharmonise.rm.config.*;
23:
24: /**
25: * Factory class which can return the singleton instance of the APM.
26: * The APM implementation to return is taken from the configuration
27: * property 'WEBDAV_APM'.
28: *
29: *
30: * @author Michael Bell
31: * @version $Revision: 1.1 $
32: *
33: */
34: public class APMFactory {
35:
36: private static final String PNAME_WEBDAV_APM = "WEBDAV_APM";
37: private static AuxillaryProcessManager m_apm = null;
38:
39: /**
40: *
41: */
42: private APMFactory() {
43: super ();
44: }
45:
46: /**
47: * Returns singleton instance of APM
48: *
49: * @return
50: * @throws APMException
51: */
52: static public AuxillaryProcessManager getAPM() throws APMException {
53:
54: try {
55: if (m_apm == null) {
56:
57: String sAuxillaryClass = ConfigSettings
58: .getProperty(PNAME_WEBDAV_APM);
59:
60: if (sAuxillaryClass != null
61: && sAuxillaryClass.length() > 0) {
62: Class classAuxillary = Class
63: .forName(sAuxillaryClass);
64: m_apm = (AuxillaryProcessManager) classAuxillary
65: .newInstance();
66: }
67: }
68: } catch (ConfigException e) {
69: throw new APMException(e);
70: } catch (ClassNotFoundException e) {
71: throw new APMException(e);
72: } catch (InstantiationException e) {
73: throw new APMException(e);
74: } catch (IllegalAccessException e) {
75: throw new APMException(e);
76: }
77:
78: return m_apm;
79: }
80:
81: }
|