Class IntegratedProcessingUnitContainerProvider
- All Implemented Interfaces:
ClusterInfoAware,BeanLevelPropertiesAware
IntegratedProcessingUnitContainer provider. An
integrated processing unit container can be used to run a processing unit within an existing
environment. An example of what this existing environment will provide is the classpath that the
processing unit will run with. Examples for using the integrated processing unit container can be
integration tests or running the processing unit from within an IDE.
At its core the integrated processing unit container is built around Spring ApplicationContext configured based on a set of config locations.
The provider allows for programmatic configuration of different processing unit aspects. It
allows to configure where the processing unit Spring context xml descriptors are located (by
default it uses classpath*:/META-INF/spring/pu.xml). It also allows to set BeanLevelProperties and ClusterInfo
that will be injected to beans configured within the processing unit.
For a runnable "main" processing unit container please see IntegratedProcessingUnitContainer.main(String[]).
- Author:
- kimchy
-
Field Summary
Fields inherited from class org.openspaces.pu.container.spi.ApplicationContextProcessingUnitContainerProvider
DEFAULT_FS_PU_CONTEXT_LOCATION, DEFAULT_PU_CONTEXT_LOCATIONFields inherited from class org.openspaces.pu.container.ProcessingUnitContainerProvider
CONTAINER_CLASS_PROP, CONTEXT_PROPERTY_DEPLOY_PATH, SPACE_NAME_PROPERTY_KEY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfigLocation(String path) Adds a config location based on a String description using SpringsPathMatchingResourcePatternResolver.voidaddConfigLocation(org.springframework.core.io.Resource resource) Adds a config location using SpringsResourceabstraction.Creates a newIntegratedProcessingUnitContainerbased on the configured parameters.voidsetClassLoader(ClassLoader classLoader) Sets the class loader this processing unit container will load the application context with.voidsetCredentials(String username, String password) voidsetCredentialsProvider(CredentialsProvider credentialsProvider) voidsetParentContext(org.springframework.context.ApplicationContext parentContext) Sets Spring parentApplicationContextthat will be used when constructing this processing unit application context.voidsetSecured(Boolean secured) voidsetUserDetails(UserDetails userDetails) Deprecated.voidsetUserDetails(String username, String password) Deprecated.Methods inherited from class org.openspaces.pu.container.ProcessingUnitContainerProvider
getBeanLevelProperties, getClusterInfo, getConfig, setBeanLevelProperties, setClusterInfo, setDeployPath, setManifestUrls, setMetricRegistrator, setSpaceName
-
Constructor Details
-
IntegratedProcessingUnitContainerProvider
public IntegratedProcessingUnitContainerProvider()
-
-
Method Details
-
setParentContext
public void setParentContext(org.springframework.context.ApplicationContext parentContext) Sets Spring parentApplicationContextthat will be used when constructing this processing unit application context. -
setClassLoader
Sets the class loader this processing unit container will load the application context with.- Overrides:
setClassLoaderin classProcessingUnitContainerProvider
-
addConfigLocation
public void addConfigLocation(org.springframework.core.io.Resource resource) Adds a config location using SpringsResourceabstraction. This config location represents a Spring xml context.Note, once a config location is added that default location used when no config location is defined won't be used (the default location is
classpath*:/META-INF/spring/pu.xml).- Specified by:
addConfigLocationin classApplicationContextProcessingUnitContainerProvider
-
setUserDetails
Deprecated. -
setUserDetails
Deprecated. -
setCredentials
-
setCredentialsProvider
-
setSecured
-
addConfigLocation
Adds a config location based on a String description using SpringsPathMatchingResourcePatternResolver.- Specified by:
addConfigLocationin classApplicationContextProcessingUnitContainerProvider- Throws:
IOException- See Also:
-
PathMatchingResourcePatternResolver
-
createContainer
Creates a newIntegratedProcessingUnitContainerbased on the configured parameters.If
addConfigLocation(org.springframework.core.io.Resource)oraddConfigLocation(String)were used, the Spring xml context will be read based on the provided locations. If no config location was provided the default config location will beclasspath*:/META-INF/spring/pu.xml.If
ProcessingUnitContainerProvider.setBeanLevelProperties(org.openspaces.core.properties.BeanLevelProperties)is set will use the configured bean level properties in order to configure the application context and specific beans within it based on properties. This is done by addingBeanLevelPropertyBeanPostProcessorandBeanLevelPropertyPlaceholderConfigurerto the application context.If
ProcessingUnitContainerProvider.setClusterInfo(org.openspaces.core.cluster.ClusterInfo)is set will use it to injectClusterInfointo beans that implementClusterInfoAware.- Specified by:
createContainerin classProcessingUnitContainerProvider- Returns:
- An
IntegratedProcessingUnitContainerinstance or anCompoundProcessingUnitContainerin case of a clustered processing unit without a specific instance Id. - Throws:
CannotCreateContainerException
-