GigaSpaces XAP 10.0.1 API

org.openspaces.core.space
Class UrlSpaceFactoryBean

java.lang.Object
  extended by org.openspaces.core.space.AbstractSpaceFactoryBean
      extended by org.openspaces.core.space.UrlSpaceFactoryBean
All Implemented Interfaces:
com.gigaspaces.internal.dump.InternalDumpProcessor, EventListener, ClusterInfoAware, MemberAliveIndicator, BeanLevelMergedPropertiesAware, ServiceDetailsProvider, Aware, BeanNameAware, DisposableBean, FactoryBean, InitializingBean, ApplicationContextAware, ApplicationListener

public class UrlSpaceFactoryBean
extends AbstractSpaceFactoryBean
implements BeanLevelMergedPropertiesAware, ClusterInfoAware

A space factory bean that creates a space (IJSpace) based on a url.

The factory allows to specify url properties using urlProperties and space parameters using parameters or using properties. It also accepts a ClusterInfo using setClusterInfo(ClusterInfo) and translates it into the relevant space url properties automatically.

Most url properties are explicitly exposed using different setters. Though they can also be set using the urlProperties the explicit setters allow for more readable and simpler configuration. Some examples of explicit url properties are: setSchema(String), setFifo(boolean).

The factory uses the BeanLevelMergedPropertiesAware in order to be injected with properties that were not parameterized in advance (using ${...} notation). This will directly inject additional properties in the Space creation/finding process.

Author:
kimchy

Field Summary
 
Fields inherited from class org.openspaces.core.space.AbstractSpaceFactoryBean
logger
 
Constructor Summary
UrlSpaceFactoryBean()
          Creates a new url space factory bean.
UrlSpaceFactoryBean(String url)
          Creates a new url space factory bean based on the url provided.
UrlSpaceFactoryBean(String url, Map<String,Object> params)
          Creates a new url space factory bean based on the url and map parameters provided.
 
Method Summary
protected  IJSpace doCreateSpace()
          Creates the space.
 void setBlobStoreDataPolicy(BlobStoreDataPolicyFactoryBean blobStoreDataPolicy)
           
 void setCachePolicy(CachePolicy cachePolicy)
          Sets the cache policy that the space will use.
 void setClusterInfo(ClusterInfo clusterInfo)
          Injected thanks to this bean implementing ClusterInfoAware.
 void setCustomCachePolicy(CustomCachePolicyFactoryBean customCachePolicy)
           
 void setDistributedTransactionProcessingConfiguration(DistributedTransactionProcessingConfigurationFactoryBean distributedTransactionProcessingConfiguration)
          Sets the distributed transaction processing configuration for the Mirror component.
 void setExternalDataSource(ManagedDataSource externalDataSource)
          A data source
 void setFifo(boolean fifo)
          Indicates that all take/write operations be conducted in FIFO mode.
 void setFilterProviders(FilterProviderFactory[] filterProviders)
          Inject a list of filter provider factories providing the ability to inject actual Space filters.
 void setGatewayTargets(GatewayTargetsFactoryBean gatewayTargets)
          Sets the gateway replication targets to be used with the constructed space.
 void setLookupGroups(String lookupGroups)
          The Jini Lookup Service group to find container or space using multicast (jini protocol).
 void setLookupLocators(String lookupLocators)
          The Jini Lookup locators for the Space.
 void setLookupTimeout(Integer lookupTimeout)
          The max timeout in milliseconds to find a Container or Space using multicast (jini protocol).
 void setMergedBeanLevelProperties(Properties beanLevelProperties)
          Externally managed override properties using open spaces extended config support.
 void setMirror(boolean mirror)
          When setting this URL property to true it will allow the space to connect to the Mirror service to push its data and operations for asynchronous persistency.
 void setNoWriteLease(boolean noWriteLease)
          If true - Lease object would not return from the write/writeMultiple operations.
 void setParameters(Map<String,Object> parameters)
          Sets the parameters the IJSpace will be created with.
 void setProperties(Properties properties)
          Same as parameters just with properties for simpler configuration.
 void setReplicationFilterProvider(ReplicationFilterProviderFactory replicationFilterProvider)
          Injects a replication provider allowing to directly inject actual replication filters.
 void setSchema(String schema)
          The space instance is created using a space schema file which can be used as a template configuration file for creating a space.
 void setSecured(boolean secured)
          Sets the space as secured.
 void setSecurityConfig(SecurityConfig securityConfig)
          Sets security configuration for the Space.
 void setSpaceDataSource(SpaceDataSource spaceDataSource)
          Sets the SpaceDataSource which will be used as a data source for the space.
 void setSpaceSynchronizationEndpoint(SpaceSynchronizationEndpoint spaceSynchronizationEndpoint)
           
 void setSpaceTypes(SpaceTypeDescriptor[] typeDescriptors)
          Inject a list of space types.
 void setUrl(String url)
          Sets the url the IJSpace will be created with.
 void setUrlProperties(Properties urlProperties)
          Sets the url properties.
 void setVersioned(boolean versioned)
          When false, optimistic lock is disabled.
 
Methods inherited from class org.openspaces.core.space.AbstractSpaceFactoryBean
afterPropertiesSet, close, destroy, fireSpaceAfterBackupEvent, fireSpaceAfterPrimaryEvent, fireSpaceBeforeBackupEvent, fireSpaceBeforePrimaryEvent, getApplicationContext, getName, getObject, getObjectType, getSecurityConfig, getServicesDetails, isAlive, isMemberAliveEnabled, isRegisterForSpaceModeNotifications, isSingleton, onApplicationEvent, process, setApplicationContext, setBeanName, setCredentialsProvider, setEnableMemberAliveIndicator, setPrimaryBackupListener, setRegisterForSpaceModeNotifications, setUserDetails
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlSpaceFactoryBean

public UrlSpaceFactoryBean()
Creates a new url space factory bean. The url parameters is requires so the setUrl(String) must be called before the bean is initialized.


UrlSpaceFactoryBean

public UrlSpaceFactoryBean(String url)
Creates a new url space factory bean based on the url provided.

Parameters:
url - The url to create the IJSpace with.

UrlSpaceFactoryBean

public UrlSpaceFactoryBean(String url,
                           Map<String,Object> params)
Creates a new url space factory bean based on the url and map parameters provided.

Parameters:
url - The url to create the IJSpace with.
params - The parameters to create the IJSpace with.
Method Detail

doCreateSpace

protected IJSpace doCreateSpace()
                         throws DataAccessException
Creates the space.

Specified by:
doCreateSpace in class AbstractSpaceFactoryBean
Returns:
The IJSpace implementation used for the factory bean
Throws:
DataAccessException

setSecured

public void setSecured(boolean secured)
Sets the space as secured. Note, when passing userName and password it will automatically be secured.


setSecurityConfig

public void setSecurityConfig(SecurityConfig securityConfig)
Description copied from class: AbstractSpaceFactoryBean
Sets security configuration for the Space. If not set, no security will be used.

Overrides:
setSecurityConfig in class AbstractSpaceFactoryBean

setUrl

public void setUrl(String url)
Sets the url the IJSpace will be created with. Note this url does not take affect after the bean has been initialized.

Parameters:
url - The url to create the IJSpace with.

setParameters

public void setParameters(Map<String,Object> parameters)
Sets the parameters the IJSpace will be created with. Note this parameters does not take affect after the bean has been initialized.

Note, this should not be confused with setUrlProperties(java.util.Properties). The parameters here are the ones referred to as custom properties and allows for example to control the xpath injection to space schema.

Parameters:
parameters - The parameters to create the IJSpace with.

setProperties

public void setProperties(Properties properties)
Same as parameters just with properties for simpler configuration.


setUrlProperties

public void setUrlProperties(Properties urlProperties)
Sets the url properties. Note, most if not all url level properties can be set using explicit setters.


setSchema

public void setSchema(String schema)
The space instance is created using a space schema file which can be used as a template configuration file for creating a space. The user specifies one of the pre-configured schema names (to create a space instance from its template) or a custom one using this property.

If a schema name is not defined, a default schema name called default will be used.


setFifo

public void setFifo(boolean fifo)
Indicates that all take/write operations be conducted in FIFO mode. Default is the Space default (false).


setLookupGroups

public void setLookupGroups(String lookupGroups)
The Jini Lookup Service group to find container or space using multicast (jini protocol). Groups are comma separated list.


setLookupLocators

public void setLookupLocators(String lookupLocators)
The Jini Lookup locators for the Space. In the form of: host1:port1,host2:port2.


setLookupTimeout

public void setLookupTimeout(Integer lookupTimeout)
The max timeout in milliseconds to find a Container or Space using multicast (jini protocol). Defaults to 6000 (i.e. 6 seconds).


setVersioned

public void setVersioned(boolean versioned)
When false, optimistic lock is disabled. Default to the Space default value.


setNoWriteLease

public void setNoWriteLease(boolean noWriteLease)
If true - Lease object would not return from the write/writeMultiple operations. Defaults to the Space default value (false).


setMirror

public void setMirror(boolean mirror)
When setting this URL property to true it will allow the space to connect to the Mirror service to push its data and operations for asynchronous persistency. Defaults to the Space default (which defaults to false).


setFilterProviders

public void setFilterProviders(FilterProviderFactory[] filterProviders)
Inject a list of filter provider factories providing the ability to inject actual Space filters.


setReplicationFilterProvider

public void setReplicationFilterProvider(ReplicationFilterProviderFactory replicationFilterProvider)
Injects a replication provider allowing to directly inject actual replication filters.


setExternalDataSource

public void setExternalDataSource(ManagedDataSource externalDataSource)
A data source


setSpaceDataSource

public void setSpaceDataSource(SpaceDataSource spaceDataSource)
Sets the SpaceDataSource which will be used as a data source for the space.

Parameters:
spaceDataSource - The SpaceDataSource instance.

setSpaceSynchronizationEndpoint

public void setSpaceSynchronizationEndpoint(SpaceSynchronizationEndpoint spaceSynchronizationEndpoint)
Parameters:
spaceSynchronizationEndpoint -

setSpaceTypes

public void setSpaceTypes(SpaceTypeDescriptor[] typeDescriptors)
Inject a list of space types.


setCachePolicy

public void setCachePolicy(CachePolicy cachePolicy)
Sets the cache policy that the space will use. If not set, will default to the one configured in the space schema.

See Also:
AllInCachePolicy, LruCachePolicy, CustomCachePolicy, BlobStoreDataCachePolicy

setMergedBeanLevelProperties

public void setMergedBeanLevelProperties(Properties beanLevelProperties)
Externally managed override properties using open spaces extended config support. Should not be set directly but allowed for different Spring context container to set it.

Specified by:
setMergedBeanLevelProperties in interface BeanLevelMergedPropertiesAware

setClusterInfo

public void setClusterInfo(ClusterInfo clusterInfo)
Injected thanks to this bean implementing ClusterInfoAware. If set will use the cluster information in order to configure the url based on it.

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

setGatewayTargets

public void setGatewayTargets(GatewayTargetsFactoryBean gatewayTargets)
Sets the gateway replication targets to be used with the constructed space.

Parameters:
gatewayTargets - The gateway targets.

setDistributedTransactionProcessingConfiguration

public void setDistributedTransactionProcessingConfiguration(DistributedTransactionProcessingConfigurationFactoryBean distributedTransactionProcessingConfiguration)
Sets the distributed transaction processing configuration for the Mirror component.

Parameters:
distributedTransactionProcessingConfiguration - The distributed transaction processing configuration to set.

setCustomCachePolicy

public void setCustomCachePolicy(CustomCachePolicyFactoryBean customCachePolicy)

setBlobStoreDataPolicy

public void setBlobStoreDataPolicy(BlobStoreDataPolicyFactoryBean blobStoreDataPolicy)

GigaSpaces XAP 10.0.1 API

Copyright © GigaSpaces.