code: public Element toElement(JdbcDatastore datastore) {
          final Element ds = getDocument().createElement("jdbc-datastore");
          ds.setAttribute("name", datastore.getName());
          if (!StringUtils.isNullOrEmpty(datastore.getDescription())) {
              ds.setAttribute("description", datastore.getDescription());
          }
  
          String jndiUrl = datastore.getDatasourceJndiUrl();
          if (Strings.isNullOrEmpty(jndiUrl)) {
              appendElement(ds, "url", datastore.getJdbcUrl());
              appendElement(ds, "driver", datastore.getDriverClass());
              appendElement(ds, "username", datastore.getUsername());
              appendElement(ds, "password", datastore.getPassword());
              appendElement(ds, "multiple-connections", datastore.isMultipleConnections() + "");
          } else {
              appendElement(ds, "datasource-jndi-url", jndiUrl);
          }
  
          final TableType[] tableTypes = datastore.getTableTypes();
          if (tableTypes != null && tableTypes.length != 0 && !Arrays.equals(TableType.DEFAULT_TABLE_TYPES, tableTypes)) {
              final Element tableTypesElement = getDocument().createElement("table-types");
              ds.appendChild(tableTypesElement);
  
              for (final TableType tableType : tableTypes) {
                  appendElement(tableTypesElement, "table-type", tableType.name());
              }
          }
  
          final String catalogName = datastore.getCatalogName();
          if (!Strings.isNullOrEmpty(catalogName)) {
              appendElement(ds, "catalog-name", catalogName);
          }
  
          return ds;
      }
docs: Externalizes a {@link JdbcDatastore} to a XML element.
  
  @param datastore
  @param doc
  @return