📄 repositoryfactory.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"><lee@3sp.com></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 + -