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.security.pacl.jndi;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    
020    import java.util.Hashtable;
021    
022    import javax.naming.spi.InitialContextFactory;
023    import javax.naming.spi.InitialContextFactoryBuilder;
024    
025    /**
026     * @author Brian Wing Shun Chan
027     */
028    public class PACLInitialContextFactoryBuilder
029            implements InitialContextFactoryBuilder {
030    
031            public InitialContextFactory createInitialContextFactory(
032                    Hashtable<?, ?> environment) {
033    
034                    if (_log.isDebugEnabled()) {
035                            _log.debug("Creating " + PACLInitialContextFactory.class.getName());
036                    }
037    
038                    return new PACLInitialContextFactory(
039                            _initialContextFactoryBuilder, environment);
040            }
041    
042            public void setInitialContextFactoryBuilder(
043                    InitialContextFactoryBuilder initialContextFactoryBuilder) {
044    
045                    _initialContextFactoryBuilder = initialContextFactoryBuilder;
046            }
047    
048            private InitialContextFactoryBuilder _initialContextFactoryBuilder;
049    
050            // This must not be static because of LPS-33404
051    
052            private Log _log = LogFactoryUtil.getLog(
053                    PACLInitialContextFactoryBuilder.class.getName());
054    
055    }