@Override
  void create(InternalCache cache)
      throws TimeoutException, CacheWriterException, GatewayException, RegionExistsException {
    cache.setDeclarativeCacheConfig(getCacheConfig());
    if (!cache.isClient()) {
      throw new IllegalStateException(
          "You must use ClientCacheFactory when the cache.xml uses client-cache.");
    }

    initializeDeclarablesMap(cache);

    if (hasFunctionService()) {
      getFunctionServiceCreation().create();
    }

    // create connection pools
    Map<String, Pool> pools = getPools();
    if (!pools.isEmpty()) {
      for (final Pool cp : pools.values()) {
        PoolFactoryImpl poolFactory = (PoolFactoryImpl) PoolManager.createFactory();
        poolFactory.init(cp);
        poolFactory.create(cp.getName());
      }
    }

    if (hasResourceManager()) {
      // moved this up to fix bug 42128
      getResourceManager().configure(cache.getResourceManager());
    }

    DiskStoreAttributesCreation pdxRegDSC = initializePdxDiskStore(cache);

    cache.initializePdxRegistry();

    for (DiskStore diskStore : listDiskStores()) {
      DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) diskStore;
      if (creation != pdxRegDSC) {
        createDiskStore(creation, cache);
      }
    }
    for (DiskStore diskStore : listDiskStores()) {
      DiskStoreAttributesCreation creation = (DiskStoreAttributesCreation) diskStore;

      // Don't let the DiskStoreAttributesCreation escape to the user
      DiskStoreFactory factory = cache.createDiskStoreFactory(creation);
      factory.create(creation.getName());
    }

    if (hasDynamicRegionFactory()) {
      DynamicRegionFactory.get().open(getDynamicRegionFactoryConfig());
    }
    if (hasCopyOnRead()) {
      cache.setCopyOnRead(getCopyOnRead());
    }

    if (getCacheTransactionManagerCreation() != null
        && getCacheTransactionManagerCreation().getListeners().length > 0
        && cache.getCacheTransactionManager() != null) {
      cache.getCacheTransactionManager()
          .initListeners(getCacheTransactionManagerCreation().getListeners());
    }

    if (getCacheTransactionManagerCreation() != null
        && cache.getCacheTransactionManager() != null
        && getCacheTransactionManagerCreation().getWriter() != null) {
      throw new IllegalStateException(
          "A TransactionWriter cannot be registered on a client");
    }

    cache.initializePdxRegistry();

    for (String id : getRegionAttributesNames()) {
      RegionAttributesCreation creation = (RegionAttributesCreation) getRegionAttributes(id);
      creation.inheritAttributes(cache, false);

      // Don't let the RegionAttributesCreation escape to the user
      AttributesFactory factory = new AttributesFactory(creation);
      RegionAttributes attrs = factory.createRegionAttributes();

      cache.setRegionAttributes(id, attrs);
    }

    for (final Region<?, ?> region : roots.values()) {
      RegionCreation regionCreation = (RegionCreation) region;
      regionCreation.createRoot(cache);
    }

    cache.readyDynamicRegionFactory();
    runInitializer(cache);
  }
Fills in the contents of a {@link Cache} based on this creation object's state.
geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/ClientCacheCreation.java