1 package com.sslexplorer.boot; 2 3 import org.apache.commons.logging.Log; 4 import org.apache.commons.logging.LogFactory; 5 6 19 public class RepositoryFactory { 20 static Repository instance; 21 static Log log = LogFactory.getLog(RepositoryFactory.class); 22 23 28 public static Repository getRepository() { 29 if (instance != null) 30 return instance; 31 try { 32 if (System.getProperty("sslexplorer.repositoryClass") != null) { 33 instance = (Repository) Class.forName(System.getProperty("sslexplorer.repositoryClass")).newInstance(); 34 } else 35 instance = new LocalRepository(); 36 } catch (Exception e) { 37 log.error("Failed to initialize repository", e); 38 return null; 39 } 40 return instance; 41 } 42 } 43 | Popular Tags |