Interface IgniteSpringHelper
-
public interface IgniteSpringHelperSpring helper which can parse Spring configuration files, interface was introduced to avoid mandatory runtime dependency on Spring framework.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TloadBean(InputStream stream, String beanName)Loads bean instance by name.<T> TloadBean(URL url, String beanName)Loads bean instance by name.<T> TloadBeanFromAppContext(Object appContext, String beanName)Loads bean instance by name from application context.IgniteBiTuple<Map<Class<?>,Collection>,? extends GridSpringResourceContext>loadBeans(URL cfgUrl, Class<?>... beanClasses)Loads bean instances that match the given types from given configuration file.GridTuple3<Map<String,?>,Map<Class<?>,Collection>,? extends GridSpringResourceContext>loadBeans(URL cfgUrl, Collection<String> beanNames, Class<?>... beanClasses)Loads bean instances that match the given types or names from given configuration file.<T> IgniteBiTuple<Collection<T>,? extends GridSpringResourceContext>loadConfigurations(InputStream cfgStream, Class<T> cls, boolean expEnabled, String... excludedProps)Loads all configurations with given type specified within given configuration input stream.<T> IgniteBiTuple<Collection<T>,? extends GridSpringResourceContext>loadConfigurations(InputStream cfgStream, Class<T> cls, String... excludedProps)Loads all configurations with given type specified within given configuration input stream.IgniteBiTuple<Collection<IgniteConfiguration>,? extends GridSpringResourceContext>loadConfigurations(InputStream cfgStream, String... excludedProps)Loads all grid configurations specified within given configuration input stream.<T> IgniteBiTuple<Collection<T>,? extends GridSpringResourceContext>loadConfigurations(URL cfgUrl, Class<T> cls, String... excludedProps)Loads all configurations with given type specified within given configuration file.IgniteBiTuple<Collection<IgniteConfiguration>,? extends GridSpringResourceContext>loadConfigurations(URL cfgUrl, String... excludedProps)Loads all grid configurations specified within given configuration file.StringuserVersion(ClassLoader ldr, IgniteLogger log)Gets user version for given class loader by checkingMETA-INF/ignite.xmlfile foruserVersionattribute.
-
-
-
Method Detail
-
loadConfigurations
IgniteBiTuple<Collection<IgniteConfiguration>,? extends GridSpringResourceContext> loadConfigurations(URL cfgUrl, String... excludedProps) throws IgniteCheckedException
Loads all grid configurations specified within given configuration file.Usually Spring XML configuration file will contain only one Grid definition. Note that Grid configuration bean(s) is retrieved form configuration file by type, so the name of the Grid configuration bean is ignored.
- Parameters:
cfgUrl- Configuration file path or URL. This cannot benull.excludedProps- Properties to exclude.- Returns:
- Tuple containing all loaded configurations and Spring context used to load them.
- Throws:
IgniteCheckedException- If grid could not be started or configuration read. This exception will be thrown also if grid with given name has already been started or Spring XML configuration file is invalid.
-
loadConfigurations
IgniteBiTuple<Collection<IgniteConfiguration>,? extends GridSpringResourceContext> loadConfigurations(InputStream cfgStream, String... excludedProps) throws IgniteCheckedException
Loads all grid configurations specified within given configuration input stream.Usually Spring XML configuration input stream will contain only one Grid definition. Note that Grid configuration bean(s) is retrieved form configuration input stream by type, so the name of the Grid configuration bean is ignored.
- Parameters:
cfgStream- Configuration input stream. This cannot benull.excludedProps- Properties to exclude.- Returns:
- Tuple containing all loaded configurations and Spring context used to load them.
- Throws:
IgniteCheckedException- If grid could not be started or configuration read. This exception will be thrown also if grid with given name has already been started or Spring XML configuration file is invalid.
-
loadConfigurations
<T> IgniteBiTuple<Collection<T>,? extends GridSpringResourceContext> loadConfigurations(URL cfgUrl, Class<T> cls, String... excludedProps) throws IgniteCheckedException
Loads all configurations with given type specified within given configuration file.- Parameters:
cfgUrl- Configuration file path or URL. This cannot benull.cls- Required type of configuration.excludedProps- Properties to exclude.- Returns:
- Tuple containing all loaded configurations and Spring context used to load them.
- Throws:
IgniteCheckedException- If configuration could not be read.
-
loadConfigurations
<T> IgniteBiTuple<Collection<T>,? extends GridSpringResourceContext> loadConfigurations(InputStream cfgStream, Class<T> cls, String... excludedProps) throws IgniteCheckedException
Loads all configurations with given type specified within given configuration input stream.- Parameters:
cfgStream- Configuration input stream. This cannot benull.cls- Required type of configuration.excludedProps- Properties to exclude.- Returns:
- Tuple containing all loaded configurations and Spring context used to load them.
- Throws:
IgniteCheckedException- If configuration could not be read.
-
loadConfigurations
<T> IgniteBiTuple<Collection<T>,? extends GridSpringResourceContext> loadConfigurations(InputStream cfgStream, Class<T> cls, boolean expEnabled, String... excludedProps) throws IgniteCheckedException
Loads all configurations with given type specified within given configuration input stream.- Parameters:
cfgStream- Configuration input stream. This cannot benull.cls- Required type of configuration.expEnabled- Whether Spring bean expressions enabled.excludedProps- Properties to exclude.- Returns:
- Tuple containing all loaded configurations and Spring context used to load them.
- Throws:
IgniteCheckedException- If configuration could not be read.
-
loadBeans
IgniteBiTuple<Map<Class<?>,Collection>,? extends GridSpringResourceContext> loadBeans(URL cfgUrl, Class<?>... beanClasses) throws IgniteCheckedException
Loads bean instances that match the given types from given configuration file.- Parameters:
cfgUrl- Configuration file path or URL. This cannot benull.beanClasses- Beans classes.- Returns:
- Tuple containing all loaded beans and Spring context used to load them.
- Throws:
IgniteCheckedException- If failed to load configuration.
-
loadBeans
GridTuple3<Map<String,?>,Map<Class<?>,Collection>,? extends GridSpringResourceContext> loadBeans(URL cfgUrl, Collection<String> beanNames, Class<?>... beanClasses) throws IgniteCheckedException
Loads bean instances that match the given types or names from given configuration file.- Parameters:
cfgUrl- Configuration file path or URL. This cannot benull.beanClasses- Beans classes.- Returns:
- Tuple containing all loaded beans and Spring context used to load them.
- Throws:
IgniteCheckedException- If failed to load configuration.
-
loadBean
<T> T loadBean(URL url, String beanName) throws IgniteCheckedException
Loads bean instance by name.- Parameters:
url- Spring XML file URL.beanName- Bean name.- Returns:
- Bean instance.
- Throws:
IgniteCheckedException- In case of error.
-
loadBean
<T> T loadBean(InputStream stream, String beanName) throws IgniteCheckedException
Loads bean instance by name.- Parameters:
stream- Input stream containing Spring XML configuration.beanName- Bean name.- Returns:
- Bean instance.
- Throws:
IgniteCheckedException- In case of error.
-
loadBeanFromAppContext
<T> T loadBeanFromAppContext(Object appContext, String beanName) throws IgniteCheckedException
Loads bean instance by name from application context.- Parameters:
appContext- Sprint application context.beanName- Bean name.- Returns:
- Bean instance.
- Throws:
IgniteCheckedException- In case of error.
-
userVersion
String userVersion(ClassLoader ldr, IgniteLogger log)
Gets user version for given class loader by checkingMETA-INF/ignite.xmlfile foruserVersionattribute. Ifignite.xmlfile is not found, or user version is not specified there, then default version (empty string) is returned.- Parameters:
ldr- Class loader.log- Logger.- Returns:
- User version for given class loader or empty string if no version was explicitly specified.
-
-