/** * Method description * * * @param type * @param def * @param <T> * * @return */ public static <T> T getService(Class<T> type, T def) { T result = getService(type); if (result == null) { result = def; } return result; }
/** * Constructs ... * */ public RepositoryClientFactory() { this.providers = ServiceUtil.getServices(RepositoryClientFactoryProvider.class); }
/** * Method description * * * @param type * @param def * @param <T> * * @return */ public static <T> T getService(Class<T> type, T def) { T result = getService(type); if (result == null) { result = def; } return result; }
/** * Returns the singleton instance of the ScmEventBus * * * @return singleton instance */ public static ScmEventBus getInstance() { if (instance == null) { synchronized (ScmEventBus.class) { if (instance == null) { instance = ServiceUtil.getService(ScmEventBus.class); if (instance == null) { throw new IllegalStateException( "could not find a event bus implementation"); } else { logger.info("use {} as event bus implementation", instance.getClass().getName()); } } } } return instance; }
/** * Returns the singleton instance of the ScmEventBus * * * @return singleton instance */ public static ScmEventBus getInstance() { if (instance == null) { synchronized (ScmEventBus.class) { if (instance == null) { instance = ServiceUtil.getService(ScmEventBus.class); if (instance == null) { throw new IllegalStateException( "could not find a event bus implementation"); } else { logger.info("use {} as event bus implementation", instance.getClass().getName()); } } } } return instance; }
/** * Constructs ... * */ private CipherUtil() { keyGenerator = ServiceUtil.getService(KeyGenerator.class); if (keyGenerator == null) { keyGenerator = new UUIDKeyGenerator(); } cipherHandler = ServiceUtil.getService(CipherHandler.class); if (cipherHandler == null) { cipherHandler = new DefaultCipherHandler(SCMContext.getContext(), keyGenerator); } }
/** * Constructs ... * */ private CipherUtil() { keyGenerator = ServiceUtil.getService(KeyGenerator.class); if (keyGenerator == null) { keyGenerator = new UUIDKeyGenerator(); } cipherHandler = ServiceUtil.getService(CipherHandler.class); if (cipherHandler == null) { cipherHandler = new DefaultCipherHandler(SCMContext.getContext(), keyGenerator); } }
/** * Returns the singleton instance of {@link SCMContextProvider} * * * @return singleton instance of {@link SCMContextProvider} */ public static SCMContextProvider getContext() { if (provider == null) { synchronized (SCMContext.class) { if (provider == null) { provider = ServiceUtil.getService(SCMContextProvider.class); if (provider == null) { provider = new BasicContextProvider(); } provider.init(); } } } return provider; } }
/** * Returns the singleton instance of {@link SCMContextProvider} * * * @return singleton instance of {@link SCMContextProvider} */ public static SCMContextProvider getContext() { if (provider == null) { synchronized (SCMContext.class) { if (provider == null) { provider = ServiceUtil.getService(SCMContextProvider.class); if (provider == null) { provider = new BasicContextProvider(); } provider.init(); } } } return provider; } }