Exemplo n.º 1
0
  public Object executeCommand(List args) {
    if (!ShellEnvironment.isInteractive()) {
      throw new AquilaException(ShellError.SHELL_0007, "create");
    }

    if (args.size() == 0) {
      ShellEnvironment.println("Required argument!");
      return null;
    }

    String func = (String) args.get(0);

    if (func.equals("connection")) {
      if (connectionFunction == null) {
        connectionFunction = new CreateConnectionFunction();
      }
      return connectionFunction.execute(args);
    }
    if (func.equals("datatypemap")) {
      if (createDataTypeMapFunction == null) {
        createDataTypeMapFunction = new CreateDataTypeMapFunction();
      }
      return createDataTypeMapFunction.execute(args);
    } else {
      ShellEnvironment.println("The specified function " + func + " is not recognized.");
      return null;
    }
  }
 public Object executeFunction(CommandLine line) {
   if (!line.hasOption("name")) {
     ShellEnvironment.println("Required argument --name is missing.");
     return null;
   }
   try {
     String name = line.getOptionValue("name");
     migrateCheckConstraint(name);
   } catch (IOException | SQLException | InterruptedException ex) {
     ex.printStackTrace();
   }
   return null;
 }
 private void migrateCheckConstraint(String constrName)
     throws IOException, SQLException, InterruptedException {
   ShellEnvironment.println("Create Forgein Constraint:" + constrName);
   MigrateConstraint.createConstraintFK(constrName);
   ShellEnvironment.println("Create Forgein Constraint:" + constrName + " successfully!");
 }