01: /*
02: * CoadunationLib: The coaduntion implementation library.
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18: *
19: * AxisManager.java
20: *
21: * This object is responsible for controlling access to the axis server or
22: * engine instance.
23: */
24:
25: // package path
26: package com.rift.coad.lib.thirdparty.axis;
27:
28: // axis includes
29: import org.apache.axis.AxisEngine;
30: import org.apache.axis.server.AxisServer;
31: import org.apache.axis.management.ServiceAdmin;
32: import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
33: import org.apache.axis.EngineConfiguration;
34:
35: /**
36: * This object is responsible for controlling access to the axis server or
37: * engine instance.
38: *
39: * @author Brett Chaldecott
40: */
41: public class AxisManager {
42:
43: // the static member variables
44: private static AxisManager singleton = null;
45:
46: // private member variables
47: private AxisServer server = null;
48:
49: /**
50: * Creates a new instance of AxisManager
51: *
52: * @exception AxisException
53: */
54: private AxisManager() throws AxisException {
55: try {
56: EngineConfiguration config = EngineConfigurationFactoryFinder
57: .newFactory().getServerEngineConfig();
58: server = new AxisServer(config);
59: } catch (Exception ex) {
60: throw new AxisException(
61: "Failed to instanciate the Axis Manager: "
62: + ex.getMessage(), ex);
63: }
64: }
65:
66: /**
67: * This method is responsible for instanciating a new
68: */
69: public static void init() throws AxisException {
70: if (singleton == null) {
71: singleton = new AxisManager();
72: }
73: }
74:
75: /**
76: * This method returns a reference to the axis manager instance.
77: *
78: * @return A reference to the axis manager instance.
79: * @exception AxisException
80: */
81: public static AxisManager getInstance() throws AxisException {
82: if (singleton == null) {
83: throw new AxisException(
84: "The Axis engine has not been initialized.");
85: }
86: return singleton;
87: }
88:
89: /**
90: * The getter for the server member variable.
91: *
92: * @return The instance of the axis server.
93: */
94: public AxisServer getServer() {
95: return server;
96: }
97: }
|