org.jboss.virtual.spi.cache.VFSCacheFactory Maven / Gradle / Ivy
/*
* JBoss, Home of Professional Open Source
* Copyright 2006, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.virtual.spi.cache;
import java.lang.reflect.Constructor;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import org.jboss.logging.Logger;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.spi.cache.helpers.NoopVFSCache;
/**
* Simple vfs cache factory.
*
* @author Ales Justin
* @author [email protected]
* @version $Revision: 80615 $
*/
public class VFSCacheFactory
{
private static final Object lock = new Object();
private static Logger log = Logger.getLogger(VFSCacheFactory.class);
private static VFSCache instance;
private VFSCacheFactory()
{
}
/**
* Get VFS cache instance.
*
* @return the vfs cache instance
*/
public static VFSCache getInstance()
{
return getInstance(null, null);
}
/**
*
* Get VFS cache instance.
*
* @param defaultCacheImpl - the possibly null name of the VFSCache
* implementation to use. If null, the {@linkplain VFSUtils.VFS_CACHE_KEY}
* system property will be used.
*
* @return the vfs cache instance
*/
public static VFSCache getInstance(String defaultCacheImpl)
{
return getInstance(defaultCacheImpl, null);
}
/**
*
* Get VFS cache instance.
*
* @param defaultCacheImpl - the possibly null name of the VFSCache
* implementation to use. If null, the {@linkplain VFSUtils.VFS_CACHE_KEY}
* system property will be used.
* @param properties the possible vfs cache impl properties
*
* @return the vfs cache instance
*/
public static VFSCache getInstance(String defaultCacheImpl, Map