001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.bi.reporting;
016    
017    import java.io.InputStream;
018    import java.io.Serializable;
019    
020    import java.util.Date;
021    
022    /**
023     * @author Michael C. Han
024     */
025    public class ContextClassloaderReportDesignRetriever
026            implements ReportDesignRetriever, Serializable {
027    
028            public ContextClassloaderReportDesignRetriever(String reportName) {
029                    _reportName = reportName;
030            }
031    
032            public InputStream getInputStream() {
033                    Thread currentThread = Thread.currentThread();
034    
035                    ClassLoader contextClassLoader = currentThread.getContextClassLoader();
036    
037                    return contextClassLoader.getResourceAsStream(_reportName);
038            }
039    
040            public Date getModifiedDate() {
041                    return new Date();
042            }
043    
044            public String getReportName() {
045                    return _reportName;
046            }
047    
048            private String _reportName;
049    
050    }