public class IntegratedProcessingUnitContainerProvider extends ApplicationContextProcessingUnitContainerProvider
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[])
.
DEFAULT_FS_PU_CONTEXT_LOCATION, DEFAULT_PU_CONTEXT_LOCATION
CONTAINER_CLASS_PROP, CONTEXT_PROPERTY_DEPLOY_PATH, SPACE_NAME_PROPERTY_KEY
Constructor and Description |
---|
IntegratedProcessingUnitContainerProvider() |
Modifier and Type | Method and Description |
---|---|
void |
addConfigLocation(org.springframework.core.io.Resource resource)
Adds a config location using Springs
Resource
abstraction. |
void |
addConfigLocation(String path)
Adds a config location based on a String description using Springs
PathMatchingResourcePatternResolver . |
ProcessingUnitContainer |
createContainer()
Creates a new
IntegratedProcessingUnitContainer based on the configured parameters. |
void |
setClassLoader(ClassLoader classLoader)
Sets the class loader this processing unit container will load the application context with.
|
void |
setCredentials(String username,
String password) |
void |
setCredentialsProvider(CredentialsProvider credentialsProvider) |
void |
setParentContext(org.springframework.context.ApplicationContext parentContext)
Sets Spring parent
ApplicationContext that will be used
when constructing this processing unit application context. |
void |
setSecured(Boolean secured) |
void |
setUserDetails(String username,
String password)
Deprecated.
|
void |
setUserDetails(UserDetails userDetails)
Deprecated.
|
getBeanLevelProperties, getClusterInfo, getConfig, setBeanLevelProperties, setClusterInfo, setDeployPath, setManifestUrls, setMetricRegistrator, setSpaceName
public IntegratedProcessingUnitContainerProvider()
public void setParentContext(org.springframework.context.ApplicationContext parentContext)
ApplicationContext
that will be used
when constructing this processing unit application context.public void setClassLoader(ClassLoader classLoader)
setClassLoader
in class ProcessingUnitContainerProvider
public void addConfigLocation(org.springframework.core.io.Resource resource)
Resource
abstraction. 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
).
addConfigLocation
in class ApplicationContextProcessingUnitContainerProvider
@Deprecated public void setUserDetails(UserDetails userDetails)
@Deprecated public void setUserDetails(String username, String password)
public void setCredentialsProvider(CredentialsProvider credentialsProvider)
public void setSecured(Boolean secured)
public void addConfigLocation(String path) throws IOException
PathMatchingResourcePatternResolver
.addConfigLocation
in class ApplicationContextProcessingUnitContainerProvider
IOException
PathMatchingResourcePatternResolver
public ProcessingUnitContainer createContainer() throws CannotCreateContainerException
IntegratedProcessingUnitContainer
based on the configured parameters.
If addConfigLocation(org.springframework.core.io.Resource)
or addConfigLocation(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 be
classpath*:/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 adding BeanLevelPropertyBeanPostProcessor
and BeanLevelPropertyPlaceholderConfigurer
to the application
context.
If ProcessingUnitContainerProvider.setClusterInfo(org.openspaces.core.cluster.ClusterInfo)
is set will use it to
inject ClusterInfo
into beans that implement ClusterInfoAware
.
createContainer
in class ProcessingUnitContainerProvider
IntegratedProcessingUnitContainer
instance or an CompoundProcessingUnitContainer
in case of a clustered processing unit without a specific
instance Id.CannotCreateContainerException
Copyright © GigaSpaces.