docs: protected MutableCachedNode initializeVersionStorage( NodeKey versionableNodeKey,
                                                            NodeKey versionHistoryKey,
                                                            NodeKey versionKey,
                                                            Name primaryTypeName,
                                                            Set<Name> mixinTypeNames,
                                                            Path versionHistoryPath,
                                                            NodeKey originalVersionKey,
                                                            DateTime now ) {
          assert versionHistoryPath != null;
          assert versionHistoryPath.size() == 6;
  
          CachedNode node = versionStorageNode();
          MutableCachedNode mutable = null;
  
          // Find the parent of the version history node by walking the path and creating any missing intermediate folders ...
          Path parentPathInStorage = versionHistoryPath.getParent().subpath(2);
          Property primaryType = null;
          for (Segment segment : parentPathInStorage) {
              ChildReferences childRefs = node.getChildReferences(system);
              ChildReference ref = childRefs.getChild(segment);
              if (ref != null) {
                  // Look up the child node ...
                  node = system.getNode(ref);
              } else {
                  // Create the intermediate node ...
                  MutableCachedNode mutableNode = system.mutable(node.getKey());
                  NodeKey key = systemKey().withRandomId();
                  if (primaryType == null) {
                      primaryType = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, ModeShapeLexicon.VERSION_HISTORY_FOLDER);
                  }
                  mutable = mutableNode.createChild(system, key, segment.getName(), primaryType);
                  node = mutable;
              }
          }
  
          // See if the version history exists ...
          MutableCachedNode historyParent = mutable != null ? mutable : system.mutable(node.getKey());
  
          // Now create the version history node itself ...
          List<Property> historyProps = new ArrayList<Property>();
          historyProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION_HISTORY));
          historyProps.add(propertyFactory.create(JcrLexicon.VERSIONABLE_UUID, versionableNodeKey.getIdentifier()));
          historyProps.add(propertyFactory.create(JcrLexicon.UUID, versionHistoryKey.getIdentifier()));
          if (originalVersionKey != null) {
              // the tck expects this to be a reference, so that getNode works on it
              Reference copiedFrom = weakReferenceFactory.create(originalVersionKey, true);
              historyProps.add(propertyFactory.create(JcrLexicon.COPIED_FROM, copiedFrom));
          }
          Name historyName = versionHistoryPath.getLastSegment().getName();
          MutableCachedNode history = historyParent.createChild(system, versionHistoryKey, historyName, historyProps);
  
          // Now create the 'nt:versionLabels' child node ...
          Property labelProp = propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION_LABELS);
          MutableCachedNode labels = history.createChild(system, null, JcrLexicon.VERSION_LABELS, labelProp);
          assert labels != null;
  
          // And create the 'nt:rootVersion' child node ...
          NodeKey rootVersionKey = versionKey != null ? versionKey : systemKey().withRandomId();
          List<Property> rootProps = new ArrayList<Property>();
          rootProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.VERSION));
          rootProps.add(propertyFactory.create(JcrLexicon.CREATED, now));
          rootProps.add(propertyFactory.create(JcrLexicon.UUID, rootVersionKey.getIdentifier()));
          MutableCachedNode rootVersion = history.createChild(system, rootVersionKey, JcrLexicon.ROOT_VERSION, rootProps);
  
          // And create the 'nt:rootVersion/nt:frozenNode' child node ...
          NodeKey frozenNodeKey = rootVersion.getKey().withRandomId();
  
          List<Property> frozenProps = new ArrayList<Property>();
          frozenProps.add(propertyFactory.create(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FROZEN_NODE));
          frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_UUID, versionableNodeKey.getIdentifier()));
          frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_PRIMARY_TYPE, primaryTypeName));
          frozenProps.add(propertyFactory.create(JcrLexicon.UUID, frozenNodeKey));
          if (mixinTypeNames != null && !mixinTypeNames.isEmpty()) {
              frozenProps.add(propertyFactory.create(JcrLexicon.FROZEN_MIXIN_TYPES, mixinTypeNames));
          }
          MutableCachedNode frozenNode = rootVersion.createChild(system, frozenNodeKey, JcrLexicon.FROZEN_NODE, frozenProps);
          assert frozenNode != null;
  
          return history;
      }