/**
   * Extract the BinaryStore out of Modeshape (infinspan, jdbc, file, transient, etc)
   *
   * @return
   */
  @Override
  public Map<String, String> apply(final Repository input) {
    checkNotNull(input, "null cannot have a BinaryStore!");

    final Map<String, String> result = new LinkedHashMap<>();
    final BinaryStore store = getBinaryStore.apply(input);

    if (!(store instanceof InfinispanBinaryStore)) {
      return result;
    }

    final InfinispanBinaryStore ispnStore = (InfinispanBinaryStore) store;

    final List<Cache<?, ?>> caches = ispnStore.getCaches();
    final DefaultCacheManager cm = (DefaultCacheManager) caches.get(0).getCacheManager();

    if (cm == null) {
      LOGGER.debug("Could not get cluster configuration information");
      return result;
    }

    final int nodeView;

    if (cm.getTransport() != null) {
      nodeView = cm.getTransport().getViewId() + 1;
    } else {
      nodeView = UNKNOWN_NODE_VIEW;
    }

    result.put(CLUSTER_NAME, cm.getClusterName());
    result.put(
        CACHE_MODE, cm.getCache().getCacheConfiguration().clustering().cacheMode().toString());
    result.put(NODE_ADDRESS, cm.getNodeAddress());
    result.put(PHYSICAL_ADDRESS, cm.getPhysicalAddresses());
    result.put(NODE_VIEW, nodeView == UNKNOWN_NODE_VIEW ? "Unknown" : String.valueOf(nodeView));
    result.put(CLUSTER_SIZE, String.valueOf(cm.getClusterSize()));
    result.put(CLUSTER_MEMBERS, cm.getClusterMembers());
    return result;
  }