/**
   * Constructs the {@link org.openspaces.core.GigaSpace} instance using the {@link
   * org.openspaces.core.DefaultGigaSpace} implementation. Uses the clustered flag to get a cluster
   * member directly (if set to <code>false</code>) and applies the different defaults).
   */
  public void afterPropertiesSet() {
    Assert.notNull(this.space, "space property is required");
    ISpaceProxy space = this.space;
    if (clustered == null) {
      // in case the space is a local cache space, set the clustered flag to true since we do
      // not want to get the actual member (the cluster flag was set on the local cache already)
      if (space instanceof ISpaceCache) {
        clustered = true;
        if (logger.isDebugEnabled()) {
          logger.debug(
              "Clustered flag automatically set to ["
                  + clustered
                  + "] since the space is a local cache space for bean ["
                  + beanName
                  + "]");
        }
      } else {
        clustered = SpaceUtils.isRemoteProtocol(space);
        if (logger.isDebugEnabled()) {
          logger.debug(
              "Clustered flag automatically set to ["
                  + clustered
                  + "] for bean ["
                  + beanName
                  + "]");
        }
      }
    }
    if (!clustered && space.isClustered()) {
      space = (ISpaceProxy) SpaceUtils.getClusterMemberSpace(space);
    }
    if (exTranslator == null) {
      exTranslator = new DefaultExceptionTranslator();
    }
    if (txProvider == null) {
      Object transactionalContext = null;
      if (transactionManager != null
          && transactionManager instanceof JiniPlatformTransactionManager) {
        transactionalContext =
            ((JiniPlatformTransactionManager) transactionManager).getTransactionalContext();
      }
      defaultTxProvider = new DefaultTransactionProvider(transactionalContext, transactionManager);
      txProvider = defaultTxProvider;
    }
    gigaSpace = new DefaultGigaSpace(space, txProvider, exTranslator, defaultIsolationLevel);
    gigaSpace.setDefaultReadTimeout(defaultReadTimeout);
    gigaSpace.setDefaultTakeTimeout(defaultTakeTimeout);
    gigaSpace.setDefaultWriteLease(defaultWriteLease);
    setDefaultModifiers();

    gigaSpace.setName(beanName == null ? space.getName() : beanName);
  }