KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > rift > coad > lib > thirdparty > axis > AxisManager


1 /*
2  * CoadunationLib: The coaduntion implementation library.
3  * Copyright (C) 2006 Rift IT Contracting
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
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 /**
37  * This object is responsible for controlling access to the axis server or
38  * engine instance.
39  *
40  * @author Brett Chaldecott
41  */

42 public class AxisManager {
43     
44     // the static member variables
45
private static AxisManager singleton = null;
46     
47     // private member variables
48
private AxisServer server = null;
49     
50     
51     /**
52      * Creates a new instance of AxisManager
53      *
54      * @exception AxisException
55      */

56     private AxisManager() throws AxisException {
57         try {
58             EngineConfiguration config =
59                     EngineConfigurationFactoryFinder.newFactory().
60                     getServerEngineConfig();
61             server = new AxisServer(config);
62         } catch (Exception JavaDoc ex) {
63             throw new AxisException("Failed to instanciate the Axis Manager: "
64                     + ex.getMessage(),ex);
65         }
66     }
67     
68     
69     /**
70      * This method is responsible for instanciating a new
71      */

72     public static void init() throws AxisException {
73         if (singleton == null) {
74             singleton = new AxisManager();
75         }
76     }
77     
78     /**
79      * This method returns a reference to the axis manager instance.
80      *
81      * @return A reference to the axis manager instance.
82      * @exception AxisException
83      */

84     public static AxisManager getInstance() throws AxisException {
85         if (singleton == null) {
86             throw new AxisException(
87                     "The Axis engine has not been initialized.");
88         }
89         return singleton;
90     }
91     
92     
93     /**
94      * The getter for the server member variable.
95      *
96      * @return The instance of the axis server.
97      */

98     public AxisServer getServer() {
99         return server;
100     }
101 }
102
Popular Tags