/** * Indicates whether the {@link BeanManagerProvider} has been initialized. Usually it's not necessary to call this * method in application code. It's useful e.g. for other frameworks to check if DeltaSpike and the CDI container in * general have been started. * * @return true if the BeanManagerProvider is ready to be used */ public static boolean isActive() { return bmpSingleton != null && bmpSingleton.bmInfos.containsKey(ClassUtils.getClassLoader(null)); }
/** * This uses the correct ThreadContextClassLoader if deployed in an Container. * @return the ResourceBundle for the current Locale */ public static ResourceBundle getResourceBundle(String bundleName, Locale locale) { return ResourceBundle.getBundle(bundleName, locale, ClassUtils.getClassLoader(null)); } }
/** * This uses the correct ThreadContextClassLoader if deployed in an Container. * @return the ResourceBundle for the current Locale */ public static ResourceBundle getResourceBundle(String bundleName, Locale locale) { return ResourceBundle.getBundle(bundleName, locale, ClassUtils.getClassLoader(null)); } }
/** * Clear all ConfigSources for the current ClassLoader */ public static synchronized void freeConfigSources() { configSources.remove(ClassUtils.getClassLoader(null)); }
/** * This uses the correct ThreadContextClassLoader if deployed in an Container. * @return the ResourceBundle for the current Locale */ public static ResourceBundle getResourceBundle(String bundleName, Locale locale) { return ResourceBundle.getBundle(bundleName, locale, ClassUtils.getClassLoader(null)); } }
/** * Indicates whether the {@link BeanManagerProvider} has been initialized. Usually it's not necessary to call this * method in application code. It's useful e.g. for other frameworks to check if DeltaSpike and the CDI container in * general have been started. * * @return true if the BeanManagerProvider is ready to be used */ public static boolean isActive() { return bmpSingleton != null && bmpSingleton.bmInfos.containsKey(ClassUtils.getClassLoader(null)); }
private <T> T createMessageBundleProxy(Class<T> type, MessageBundleInvocationHandler handler) { return type.cast(Proxy.newProxyInstance(ClassUtils.getClassLoader(null), new Class<?>[]{type}, handler)); } }
private <T> T createMessageBundleProxy(Class<T> type, MessageBundleInvocationHandler handler) { return type.cast(Proxy.newProxyInstance(ClassUtils.getClassLoader(null), new Class<?>[]{type, Serializable.class}, handler)); }
public static Enumeration<URL> resolvePropertyFiles(String propertyFileName) throws IOException { ClassLoader cl = ClassUtils.getClassLoader(null); Enumeration<URL> propertyFileUrls = cl.getResources(propertyFileName); //fallback - see DELTASPIKE-98 if (!propertyFileUrls.hasMoreElements()) { cl = PropertyFileUtils.class.getClassLoader(); propertyFileUrls = cl.getResources(propertyFileName); } return propertyFileUrls; }
public static Config getConfig() { ClassLoader cl = ClassUtils.getClassLoader(null); return getConfig(cl); }
private T getMessage(FacesMessage.Severity severity) { return type.cast(Proxy.newProxyInstance(ClassUtils.getClassLoader(null), new Class<?>[]{type}, new JsfMessageBundleInvocationHandler(severity, clientId, invocationHandler))); }
/** * Clear all ConfigSources for the current ClassLoader. * This will also clean up all ConfigFilters. */ public static synchronized void freeConfigSources() { if (configProvider != null) { ClassLoader cl = ClassUtils.getClassLoader(null); configProvider.releaseConfig(cl); } }
private T getMessage(FacesMessage.Severity severity) { return type.cast(Proxy.newProxyInstance(ClassUtils.getClassLoader(null), new Class<?>[]{type}, new JsfMessageBundleInvocationHandler(severity, clientId, invocationHandler))); }
/** * Clear all ConfigSources for the current ClassLoader. * This will also clean up all ConfigFilters. */ public static synchronized void freeConfigSources() { if (configProvider != null) { ClassLoader cl = ClassUtils.getClassLoader(null); configProvider.releaseConfig(cl); } }
@Override public Config getConfig() { ClassLoader cl = ClassUtils.getClassLoader(null); return getConfig(cl); }
/** * @return the List of configured @{link ClassDeactivator}s for the current context ClassLoader. */ private static List<ClassDeactivator> getClassDeactivators() { ClassLoader classLoader = ClassUtils.getClassLoader(null); List<ClassDeactivator> classDeactivators = classDeactivatorMap.get(classLoader); if (classDeactivators == null) { return initConfiguredClassDeactivators(classLoader); } return classDeactivators; }
public static Config getConfig() { ClassLoader cl = ClassUtils.getClassLoader(null); return getConfig(cl); }
/** * @return whether a BeanManagerInfo for a parent classloader is available and has the booted flag set. */ private boolean isParentBeanManagerBooted() { ClassLoader classLoader = ClassUtils.getClassLoader(null); BeanManagerInfo parentBmi = getParentBeanManagerInfo(classLoader); return parentBmi != null && parentBmi.booted; }
/** * This method triggers freeing of the ConfigSources. */ @SuppressWarnings("UnusedDeclaration") public void freeConfigSources(@Observes BeforeShutdown bs) { String appName = ConfigResolver.getPropertyValue(ConfigResolver.DELTASPIKE_APP_NAME_CONFIG); unRegisterConfigMBean(appName); ConfigResolver.freeConfigSources(); detectedParentPropertyFileConfigs.remove(ClassUtils.getClassLoader(null)); }
@Test public void testGetConfigFilter() { // make sure no ConfigFilter is left over from previous tests ConfigResolver.getConfigProvider().releaseConfig(ClassUtils.getClassLoader(null)); List<ConfigFilter> configFilters = ConfigResolver.getConfigFilters(); Assert.assertNotNull(configFilters); Assert.assertEquals(1, configFilters.size()); Assert.assertEquals(SecretTestConfigFilter.class, configFilters.get(0).getClass()); }