⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 repositoryfactory.java

📁 这是linux下ssl vpn的实现程序
💻 JAVA
字号:
package com.sslexplorer.boot;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Factory class to get an instance of the configure {@link com.sslexplorer.boot.Repository}.
 * <p>
 * If the repository has already been created then the same instance will be
 * returned.
 * <p>
 * The repository implementation to use is determined by the value of
 * the <i>sslexplorer.repositoryClass</i> system property that should contain
 * the full qualified class name to use.
 * 
 * @author Lee David Painter <a href="mailto: lee@3sp.com">&lt;lee@3sp.com&gt;</a>
 * @version $Revision: 1.2 $
 * @see com.sslexplorer.boot.LocalRepository
 */
public class RepositoryFactory {
    static Repository instance;
    static Log log = LogFactory.getLog(RepositoryFactory.class);

    /**
     * Get an instance of the configured repository.
     * 
     * @return repository
     * @throws IOException if the repository could not be created for some reason
     */
    public static Repository getRepository() {
        if (instance != null)
            return instance;
        try {
            if (System.getProperty("sslexplorer.repositoryClass") != null) {
                instance = (Repository) Class.forName(System.getProperty("sslexplorer.repositoryClass")).newInstance();
            } else
                instance = new LocalRepository();
        } catch (Exception e) {
            log.error("Failed to initialize repository", e);
            return null;
        }
        return instance;
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -