code: public Element toElement(final HadoopClusterInformation hadoopClusterInformation) {
          final Element hadoopClusterElement = getDocument().createElement("hadoop-cluster");
  
          hadoopClusterElement.setAttribute("name", hadoopClusterInformation.getName());
  
          final String description = hadoopClusterInformation.getDescription();
          if (!Strings.isNullOrEmpty(description)) {
              hadoopClusterElement.setAttribute("description", description);
          }
  
          // These inherit each other, so order is important
          if (hadoopClusterInformation instanceof DirectConnectionHadoopClusterInformation) {
              appendElement(hadoopClusterElement, "namenode-url",
                      ((DirectConnectionHadoopClusterInformation) hadoopClusterInformation).getNameNodeUri().toString());
          } else if (hadoopClusterInformation instanceof EnvironmentBasedHadoopClusterInformation) {
              appendElement(hadoopClusterElement, "environment-configured", "");
          } else if (hadoopClusterInformation instanceof DirectoryBasedHadoopClusterInformation) {
              final DirectoryBasedHadoopClusterInformation directoryBasedHadoopClusterInformation =
                      (DirectoryBasedHadoopClusterInformation) hadoopClusterInformation;
              final Element directoriesElement = getDocument().createElement("directories");
              hadoopClusterElement.appendChild(directoriesElement);
              for (final String directory : directoryBasedHadoopClusterInformation.getDirectories()) {
                  appendElement(directoriesElement, "directory", directory);
              }
          } else {
              throw new UnsupportedOperationException("Unknown Hadoop cluster configuration");
          }
  
          return hadoopClusterElement;
      }
docs: Externalizes a {@link HadoopClusterInformation} to a XML element.
  
  @param hadoopClusterInformation the hadoopClusterInformation to externalize
  @return a XML element representing the datastore.