This project has retired. For details please refer to its Attic page.
RegistryServlet xref
View Javadoc
1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.juddi.servlets;
17  
18  import javax.servlet.ServletConfig;
19  import javax.servlet.ServletException;
20  import javax.servlet.http.HttpServlet;
21  
22  import org.apache.commons.configuration.ConfigurationException;
23  import org.apache.commons.logging.Log;
24  import org.apache.commons.logging.LogFactory;
25  import org.apache.juddi.Registry;
26  
27  /**
28   * This servlet is ONLY used to initialize the jUDDI webapp on startup and
29   * cleanup the jUDDI webapp on shutdown.
30   * 
31   * @author Steve Viens (sviens@apache.org)
32   */
33  public class RegistryServlet extends HttpServlet {
34  	
35  	private static final long serialVersionUID = 4653310291840334765L;
36  	private static Log logger = LogFactory.getLog(RegistryServlet.class);
37  
38  	/**
39  	 * Create the shared instance of jUDDI's Registry class and call it's
40  	 * "init()" method to initialize all core components.
41  	 */
42  	@Override
43  	public void init(ServletConfig config) throws ServletException {
44  		super.init(config);
45  		try {
46  			Registry.start();
47  		} catch (ConfigurationException e) {
48  			logger.error("jUDDI registry could not be started."
49  					+ e.getMessage(), e);
50  			throw new ServletException(e.getMessage(),e);
51  		}
52  	}
53  	
54  	@Override
55  	public void destroy() {
56  		try {
57  			Registry.stop();
58  		} catch (ConfigurationException e) {
59  			logger.error("jUDDI registry could not be stopped."
60  					+ e.getMessage(), e);
61  		}
62  		super.destroy();
63  	}
64  
65  }