package org.basex.examples.create;

import org.basex.build.Parser;
import org.basex.core.Context;
import org.basex.core.cmd.CreateDB;
import org.basex.core.cmd.DropDB;
import org.basex.core.cmd.Open;
import org.basex.core.cmd.XQuery;

/**
 * This example demonstrates a simple filesystem parser.
 *
 * @author BaseX Team 2005-11, BSD License
 * @author Christian Gruen
 */
public final class SimpleFSExample {
  /** Private constructor. */
  private SimpleFSExample() { }

  /**
   * Main test method.
   * @param args command-line arguments
   * @throws Exception exception
   */
  public static void main(final String[] args) throws Exception {

    System.out.println("=== CreateLST ===");

    // create database context
    final Context ctx = new Context();

    System.out.println("\n* Import a directory.");

    // input path and name of database
    final String path = ".";
    final String name = "fsexample";

    final Parser parser = new SimpleFSParser(path);
    final CreateDB create = new CreateDB(name, path);
    create.setParser(parser);
    create.execute(ctx);

    System.out.println("\n* Number of created elements:");

    new Open(name).execute(ctx);
    new XQuery(".").execute(ctx, System.out);

    System.out.println("\n\n* Drop database.");

    new DropDB(name).execute(ctx);
    ctx.close();
  }
}

@@ -127,18 +127,16 @@
 d.Create
-DB
 ;%0D%0Aimpor
@@ -1012,100 +1012,32 @@
     
-final CreateDB create = new CreateDB(name, path);%0D%0A    create.setParser(parser);%0D%0A    create
+new Create(parser, name)
 .exe

REPLACE example added