GigaSpaces XAP 7.0 API

org.openspaces.pu.container.integrated
Class IntegratedProcessingUnitContainerProvider

java.lang.Object
  extended by org.openspaces.pu.container.integrated.IntegratedProcessingUnitContainerProvider
All Implemented Interfaces:
ClusterInfoAware, BeanLevelPropertiesAware, ClassLoaderAwareProcessingUnitContainerProvider, ProcessingUnitContainerProvider, ApplicationContextProcessingUnitContainerProvider

public class IntegratedProcessingUnitContainerProvider
extends Object
implements ApplicationContextProcessingUnitContainerProvider

An 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 interface org.openspaces.pu.container.spi.ApplicationContextProcessingUnitContainerProvider
DEFAULT_FS_PU_CONTEXT_LOCATION, DEFAULT_PU_CONTEXT_LOCATION
 
Constructor Summary
IntegratedProcessingUnitContainerProvider()
           
 
Method Summary
 void addConfigLocation(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 setBeanLevelProperties(BeanLevelProperties beanLevelProperties)
          Sets the BeanLevelProperties that will be used to configure this processing unit.
 void setClassLoader(ClassLoader classLoader)
          Sets the class loader this processing unit container will load the application context with.
 void setClusterInfo(ClusterInfo clusterInfo)
          Sets the ClusterInfo that will be used to configure this processing unit.
 void setParentContext(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)
           
 void setUserDetails(UserDetails userDetails)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntegratedProcessingUnitContainerProvider

public IntegratedProcessingUnitContainerProvider()
Method Detail

setParentContext

public void setParentContext(ApplicationContext parentContext)
Sets Spring parent ApplicationContext that will be used when constructing this processing unit application context.


setBeanLevelProperties

public void setBeanLevelProperties(BeanLevelProperties beanLevelProperties)
Sets the BeanLevelProperties that will be used to configure this processing unit. When constructing the container this provider will automatically add to the application context both BeanLevelPropertyBeanPostProcessor and BeanLevelPropertyPlaceholderConfigurer based on this bean level properties.

Specified by:
setBeanLevelProperties in interface BeanLevelPropertiesAware

setClusterInfo

public void setClusterInfo(ClusterInfo clusterInfo)
Sets the ClusterInfo that will be used to configure this processing unit. When constructing the container this provider will automatically add to the application context the ClusterInfoBeanPostProcessor in order to allow injection of cluster info into beans that implement ClusterInfoAware.

Specified by:
setClusterInfo in interface ClusterInfoAware
Parameters:
clusterInfo - The cluster information to be injected

setClassLoader

public void setClassLoader(ClassLoader classLoader)
Sets the class loader this processing unit container will load the application context with.

Specified by:
setClassLoader in interface ClassLoaderAwareProcessingUnitContainerProvider

addConfigLocation

public void addConfigLocation(Resource resource)
Adds a config location using Springs 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).

Specified by:
addConfigLocation in interface ApplicationContextProcessingUnitContainerProvider

setUserDetails

public void setUserDetails(UserDetails userDetails)

setUserDetails

public void setUserDetails(String username,
                           String password)

setSecured

public void setSecured(Boolean secured)

addConfigLocation

public void addConfigLocation(String path)
                       throws IOException
Adds a config location based on a String description using Springs PathMatchingResourcePatternResolver.

Specified by:
addConfigLocation in interface ApplicationContextProcessingUnitContainerProvider
Throws:
IOException
See Also:
PathMatchingResourcePatternResolver

createContainer

public ProcessingUnitContainer createContainer()
                                        throws CannotCreateContainerException
Creates a new 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 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 setClusterInfo(org.openspaces.core.cluster.ClusterInfo) is set will use it to inject ClusterInfo into beans that implement ClusterInfoAware.

Specified by:
createContainer in interface ProcessingUnitContainerProvider
Returns:
An IntegratedProcessingUnitContainer instance
Throws:
CannotCreateContainerException

GigaSpaces XAP 7.0 API

Copyright © GigaSpaces.