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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 */16package org.apache.juddi.servlets;
1718import javax.servlet.ServletConfig;
19import javax.servlet.ServletException;
20import javax.servlet.http.HttpServlet;
2122import org.apache.commons.configuration.ConfigurationException;
23import org.apache.commons.logging.Log;
24import org.apache.commons.logging.LogFactory;
25import org.apache.juddi.Registry;
2627/**28 * This servlet is ONLY used to initialize the jUDDI webapp on startup and29 * cleanup the jUDDI webapp on shutdown.30 * 31 * @author Steve Viens (sviens@apache.org)32 */33publicclassRegistryServletextends HttpServlet {
3435privatestaticfinallong serialVersionUID = 4653310291840334765L;
36privatestatic Log logger = LogFactory.getLog(RegistryServlet.class);
3738/**39 * Create the shared instance of jUDDI's Registry class and call it's40 * "init()" method to initialize all core components.41 */42 @Override
43publicvoid init(ServletConfig config) throws ServletException {
44super.init(config);
45try {
46 Registry.start();
47 } catch (ConfigurationException e) {
48 logger.error("jUDDI registry could not be started."49 + e.getMessage(), e);
50thrownew ServletException(e.getMessage(),e);
51 }
52 }
5354 @Override
55publicvoid destroy() {
56try {
57 Registry.stop();
58 } catch (ConfigurationException e) {
59 logger.error("jUDDI registry could not be stopped."60 + e.getMessage(), e);
61 }
62super.destroy();
63 }
6465 }