001    /**
002     * Copyright (c) 2000-present 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.service.configuration.servlet;
016    
017    import com.liferay.portal.service.configuration.ServiceComponentConfiguration;
018    
019    import javax.servlet.ServletContext;
020    import java.io.InputStream;
021    
022    /**
023     * @author Miguel Pastor
024     */
025    public class ServletServiceContextComponentConfiguration
026            implements ServiceComponentConfiguration {
027    
028            public ServletServiceContextComponentConfiguration(
029                    ServletContext servletContext) {
030    
031                    _servletContext = servletContext;
032            }
033    
034            @Override
035            public InputStream getHibernateInputStream() {
036                    return _servletContext.getResourceAsStream(
037                            "/WEB-INF/classes/META-INF/portlet-hbm.xml");
038            }
039    
040            @Override
041            public InputStream getModelHintsInputStream() {
042                    return _servletContext.getResourceAsStream(
043                            "/WEB-INF/classes/META-INF/portlet-model-hints.xml");
044            }
045    
046            @Override
047            public InputStream getModelHintsExtInputStream() {
048                    return _servletContext.getResourceAsStream(
049                            "/WEB-INF/classes/META-INF/portlet-model-hints-ext.xml");
050            }
051    
052            @Override
053            public InputStream getSQLIndexesInputStream() {
054                    return _servletContext.getResourceAsStream("/WEB-INF/sql/indexes.sql");
055            }
056    
057            @Override
058            public InputStream getSQLSequencesInputStream() {
059                    return _servletContext.getResourceAsStream(
060                            "/WEB-INF/sql/sequences.sql");
061            }
062    
063            @Override
064            public InputStream getSQLTablesInputStream() {
065                    return _servletContext.getResourceAsStream("/WEB-INF/sql/tables.sql");
066            }
067    
068            private ServletContext _servletContext;
069    
070    }