001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.module.framework;
016    
017    import javax.servlet.ServletConfig;
018    import javax.servlet.http.HttpServlet;
019    import javax.servlet.http.HttpServletRequest;
020    import javax.servlet.http.HttpServletResponse;
021    
022    /**
023     * @author Miguel Pastor
024     * @author Raymond Aug??
025     * @see    ModuleFrameworkClassLoader
026     */
027    public class ModuleFrameworkServletAdapter extends HttpServlet {
028    
029            public HttpServlet addingService(Object serviceReference) {
030                    return (HttpServlet)_moduleFrameworkAdapterHelper.execute(
031                            "addingService", serviceReference);
032            }
033    
034            @Override
035            public void destroy() {
036                    _moduleFrameworkAdapterHelper.execute("destroy");
037            }
038    
039            @Override
040            public void init(ServletConfig servletConfig) {
041                    _moduleFrameworkAdapterHelper.exec(
042                            "init", new Class[] {ServletConfig.class}, servletConfig);
043            }
044    
045            public void modifiedService(
046                    Object serviceReference, HttpServlet httpService) {
047    
048                    _moduleFrameworkAdapterHelper.execute(
049                            "modifiedService", serviceReference, httpService);
050            }
051    
052            public void removedService(
053                    Object serviceReference, HttpServlet httpService) {
054    
055                    _moduleFrameworkAdapterHelper.execute(
056                            "removedService", serviceReference, httpService);
057            }
058    
059            @Override
060            protected void service(
061                    HttpServletRequest request, HttpServletResponse response) {
062    
063                    _moduleFrameworkAdapterHelper.exec(
064                            "service",
065                            new Class[] {HttpServletRequest.class, HttpServletResponse.class},
066                            request, response);
067            }
068    
069            private static ModuleFrameworkAdapterHelper _moduleFrameworkAdapterHelper =
070                    new ModuleFrameworkAdapterHelper(
071                            "com.liferay.osgi.bootstrap.ModuleFrameworkServlet");
072    
073    }