001    /**
002     * Copyright (c) 2000-2010 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.kernel.util;
016    
017    import javax.mail.Session;
018    
019    import javax.sql.DataSource;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     * @author Michael Young
024     */
025    public class InfrastructureUtil {
026    
027            public static DataSource getDataSource() {
028                    return _dataSource;
029            }
030    
031            public static Object getDynamicDataSourceTargetSource() {
032                    return _dynamicDataSourceTargetSource;
033            }
034    
035            public static Session getMailSession() {
036                    return _mailSession;
037            }
038    
039            public static Object getShardDataSourceTargetSource() {
040                    return _shardDataSourceTargetSource;
041            }
042    
043            public static Object getShardSessionFactoryTargetSource() {
044                    return _shardSessionFactoryTargetSource;
045            }
046    
047            public static Object getTransactionManager() {
048                    return _transactionManager;
049            }
050    
051            public void setDataSource(DataSource dataSource) {
052                    _dataSource = dataSource;
053            }
054    
055            public void setDynamicDataSourceTargetSource(
056                    Object dynamicDataSourceTargetSource) {
057    
058                    _dynamicDataSourceTargetSource = dynamicDataSourceTargetSource;
059            }
060    
061            public void setMailSession(Session mailSession) {
062                    _mailSession = mailSession;
063            }
064    
065            public void setShardDataSourceTargetSource(
066                    Object shardDataSourceTargetSource) {
067    
068                    _shardDataSourceTargetSource = shardDataSourceTargetSource;
069            }
070    
071            public void setShardSessionFactoryTargetSource(
072                    Object shardSessionFactoryTargetSource) {
073    
074                    _shardSessionFactoryTargetSource = shardSessionFactoryTargetSource;
075            }
076    
077            public void setTransactionManager(Object transactionManager) {
078                    _transactionManager = transactionManager;
079            }
080    
081            private static DataSource _dataSource;
082            private static Object _dynamicDataSourceTargetSource;
083            private static Session _mailSession;
084            private static Object _shardDataSourceTargetSource;
085            private static Object _shardSessionFactoryTargetSource;
086            private static Object _transactionManager;
087    
088    }