Class StandaloneProcessingUnitContainerProvider
- All Implemented Interfaces:
ClusterInfoAware,BeanLevelPropertiesAware
StandaloneProcessingUnitContainer provider. A standalone processing unit container is a
container that understands a processing unit archive structure (both when working with an
"exploded" directory and when working with a zip/jar archive of it). It is provided with the
location of the processing unit using StandaloneProcessingUnitContainerProvider(String).
The location itself follows Spring resource loader syntax.
When creating the container a thread is started with StandaloneContainerRunnable.
This is done since a custom class loader is created taking into account the processing unit
archive structure, and in order to allows using the standlone container within other
environments, the new class loader is only set on the newly created thread context.
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 StandaloneProcessingUnitContainer.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
ConstructorsConstructorDescriptionConstructs a new standalone container provider using the provided location as the location of the processing unit archive (either an exploded archive or a jar/zip archive). -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConfigLocation(String configLocation) Adds a config location based on a String description using SpringsPathMatchingResourcePatternResolver.voidaddConfigLocation(org.springframework.core.io.Resource resource) Creates a newStandaloneProcessingUnitContainerbased on the configured parameters.Methods inherited from class org.openspaces.pu.container.ProcessingUnitContainerProvider
getBeanLevelProperties, getClusterInfo, getConfig, setBeanLevelProperties, setClassLoader, setClusterInfo, setDeployPath, setManifestUrls, setMetricRegistrator, setSpaceName
-
Constructor Details
-
StandaloneProcessingUnitContainerProvider
Constructs a new standalone container provider using the provided location as the location of the processing unit archive (either an exploded archive or a jar/zip archive). The location syntax follows SpringResourcesyntax.- Parameters:
location- The location of the processing unit archive
-
-
Method Details
-
addConfigLocation
Adds a config location based on a String description using SpringsPathMatchingResourcePatternResolver.- Specified by:
addConfigLocationin classApplicationContextProcessingUnitContainerProvider- See Also:
-
PathMatchingResourcePatternResolver
-
addConfigLocation
- Specified by:
addConfigLocationin classApplicationContextProcessingUnitContainerProvider- Throws:
IOException
-
createContainer
Creates a new
StandaloneProcessingUnitContainerbased on the configured parameters. A standalone processing unit container is a container that understands a processing unit archive structure (both when working with an "exploded" directory and when working with a zip/jar archive of it). It is provided with the location of the processing unit usingStandaloneProcessingUnitContainerProvider(String). The location itself follows Spring resource loader syntax.If
addConfigLocation(String)is 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
StandaloneProcessingUnitContainerinstance - Throws:
CannotCreateContainerException
-