Class GigaSpaceConfigurer

java.lang.Object
org.openspaces.core.GigaSpaceConfigurer

public class GigaSpaceConfigurer extends Object
A simple programmatic configurer for GigaSpace instance wrapping the GigaSpaceFactoryBean.

Usage example:

 SpaceConfigurer spaceConfigurer = new EmbeddedSpaceConfigurer("mySpace");
 GigaSpace gigaSpace = new GigaSpaceConfigurer(spaceConfigurer).create();
 ...
 spaceConfigurer.close();
 
Author:
kimchy
  • Field Details

    • PREFIX_ISOLATION

      public static final String PREFIX_ISOLATION
      Prefix for the isolation constants defined in TransactionDefinition
      See Also:
  • Constructor Details

    • GigaSpaceConfigurer

      public GigaSpaceConfigurer(IJSpace space)
      Constructs a new configurer based on the Space.
    • GigaSpaceConfigurer

      public GigaSpaceConfigurer(SpaceConfigurer configurer)
      Constructs a new configurer based on the Space.
    • GigaSpaceConfigurer

      protected GigaSpaceConfigurer()
      For internal usage only
      See Also:
  • Method Details

    • space

      protected void space(IJSpace space)
      For internal usage only
      See Also:
    • getSpace

      public IJSpace getSpace()
    • name

      public GigaSpaceConfigurer name(String name)
      Sets the name of the GigaSpace instance which will be created. If not specified, the space name will be used.
      Parameters:
      name - Name of the GigaSpace instance.
    • getName

      public String getName()
    • txProvider

      public GigaSpaceConfigurer txProvider(TransactionProvider txProvider)
      Sets the transaction provider that will be used by the created GigaSpace. This is an optional parameter and defaults to DefaultTransactionProvider.
      Parameters:
      txProvider - The transaction provider to use
    • getTxProvider

      public TransactionProvider getTxProvider()
    • exTranslator

      public GigaSpaceConfigurer exTranslator(ExceptionTranslator exTranslator)
      Sets the exception translator that will be used by the created GigaSpace. This is an optional parameter and defaults to DefaultExceptionTranslator.
      Parameters:
      exTranslator - The exception translator to use
    • getExTranslator

      public ExceptionTranslator getExTranslator()
    • clustered

      public GigaSpaceConfigurer clustered(boolean clustered)
      Sets the cluster flag controlling if this GigaSpace will work with a clustered view of the space or directly with a cluster member. By default if this flag is not set it will be set automatically by this factory. It will be set to false if the space is an embedded one AND the space is not a local cache proxy. It will be set to true otherwise (i.e. the space is not an embedded space OR the space is a local cache proxy).
      Parameters:
      clustered - If the GigaSpace is going to work with a clustered view of the space or directly with a cluster member
    • getClustered

      public Boolean getClustered()
    • defaultReadTimeout

      public GigaSpaceConfigurer defaultReadTimeout(long defaultReadTimeout)
      Sets the default read timeout for GigaSpace.read(Object) and GigaSpace.readIfExists(Object) operations. Default to 0.
    • getDefaultReadTimeout

      public long getDefaultReadTimeout()
    • defaultTakeTimeout

      public GigaSpaceConfigurer defaultTakeTimeout(long defaultTakeTimeout)
      Sets the default take timeout for GigaSpace.take(Object) and GigaSpace.takeIfExists(Object) operations. Default to 0.
    • getDefaultTakeTimeout

      public long getDefaultTakeTimeout()
    • defaultWriteLease

      public GigaSpaceConfigurer defaultWriteLease(long defaultWriteLease)
      Sets the default write lease for GigaSpace.write(Object) operation. Default to Lease.FOREVER.
    • getDefaultWriteLease

      public long getDefaultWriteLease()
    • defaultIsolationLevel

      public GigaSpaceConfigurer defaultIsolationLevel(int defaultIsolationLevel)
      Set the default isolation level. Must be one of the isolation constants in the TransactionDefinition interface. Default is ISOLATION_DEFAULT.
      Throws:
      IllegalArgumentException - if the supplied value is not one of the ISOLATION_ constants
      See Also:
      • TransactionDefinition.ISOLATION_DEFAULT
    • getDefaultIsolationLevel

      public int getDefaultIsolationLevel()
    • defaultIsolationLevel

      public GigaSpaceConfigurer defaultIsolationLevel(String name)
      Set the default isolation level. Must be one of the isolation constants in the TransactionDefinition interface. Default is ISOLATION_DEFAULT.
      Throws:
      IllegalArgumentException - if the supplied value is not one of the ISOLATION_ constants
      See Also:
      • TransactionDefinition.ISOLATION_DEFAULT
    • defaultWriteModifiers

      public GigaSpaceConfigurer defaultWriteModifiers(WriteModifiers defaultWriteModifiers)
      Set the default WriteModifiers to be used for write operations on the GigaSpace instance. Defaults to WriteModifiers.UPDATE_OR_WRITE
      Parameters:
      defaultWriteModifiers - The default write modifiers.
      See Also:
    • getDefaultWriteModifiers

      public WriteModifiers getDefaultWriteModifiers()
    • defaultReadModifiers

      public GigaSpaceConfigurer defaultReadModifiers(ReadModifiers defaultReadModifiers)
      Set the default ReadModifiers to be used for read operations on the GigaSpace instance. Defaults to ReadModifiers.READ_COMMITTED
      Parameters:
      defaultReadModifiers - The default read modifiers.
      See Also:
    • getDefaultReadModifiers

      public ReadModifiers getDefaultReadModifiers()
    • defaultTakeModifiers

      public GigaSpaceConfigurer defaultTakeModifiers(TakeModifiers defaultTakeModifiers)
      Set the default TakeModifiers to be used for take operations on the GigaSpace instance. Defaults to TakeModifiers.NONE
      Parameters:
      defaultTakeModifiers - The default take modifiers.
      See Also:
    • getDefaultTakeModifiers

      public TakeModifiers getDefaultTakeModifiers()
    • defaultCountModifiers

      public GigaSpaceConfigurer defaultCountModifiers(CountModifiers defaultCountModifiers)
      Set the default CountModifiers to be used for count operations on the GigaSpace instance. Defaults to CountModifiers.NONE
      Parameters:
      defaultCountModifiers - The default count modifiers.
      See Also:
    • getDefaultCountModifiers

      public CountModifiers getDefaultCountModifiers()
    • defaultClearModifiers

      public GigaSpaceConfigurer defaultClearModifiers(ClearModifiers defaultClearModifiers)
      Set the default ClearModifiers to be used for clear operations on the GigaSpace instance. Defaults to ClearModifiers.NONE
      Parameters:
      defaultClearModifiers - The default clear modifiers.
      See Also:
    • getDefaultClearModifiers

      public ClearModifiers getDefaultClearModifiers()
    • defaultChangeModifiers

      public GigaSpaceConfigurer defaultChangeModifiers(ChangeModifiers defaultChangeModifiers)
      Set the default ChangeModifiers to be used for change operations on the GigaSpace instance. Defaults to ChangeModifiers.NONE
      Parameters:
      defaultChangeModifiers - The default change modifiers.
      See Also:
    • getDefaultChangeModifiers

      public ChangeModifiers getDefaultChangeModifiers()
    • transactionManager

      public GigaSpaceConfigurer transactionManager(org.springframework.transaction.PlatformTransactionManager transactionManager)
      Set the transaction manager to enable transactional operations. Can be null if transactional support is not required or the default space is used as a transactional context.
    • getTransactionManager

      public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
    • create

      public GigaSpace create()
      Creates a new GigaSpace instance if non already created.
    • close

      protected void close() throws Exception
      Throws:
      Exception
    • getGigaSpaceIfInitialized

      protected GigaSpace getGigaSpaceIfInitialized()
    • gigaSpace

      public GigaSpace gigaSpace()
      Creates a new GigaSpace instance if non already created.
      See Also:
    • initialize

      protected DefaultGigaSpace initialize()