Package org.apache.sqoop.validation

Examples of org.apache.sqoop.validation.Validation


*/
public class FrameworkValidator extends Validator {

  @Override
  public Validation validateConnection(Object connectionConfiguration) {
    Validation validation = new Validation(ConnectionConfiguration.class);
    // No validation on connection object
    return validation;
  }
View Full Code Here


        return super.validateJob(type, jobConfiguration);
    }
  }

  private Validation validateExportJob(Object jobConfiguration) {
    Validation validation = new Validation(ExportJobConfiguration.class);
    ExportJobConfiguration configuration = (ExportJobConfiguration)jobConfiguration;

    validateInputForm(validation, configuration.input);
    validateThrottingForm(validation, configuration.throttling);
View Full Code Here

    return validation;
  }

  private Validation validateImportJob(Object jobConfiguration) {
    Validation validation = new Validation(ImportJobConfiguration.class);
    ImportJobConfiguration configuration = (ImportJobConfiguration)jobConfiguration;

    validateOutputForm(validation, configuration.output);
    validateThrottingForm(validation, configuration.throttling);
View Full Code Here

        // Transform form structures to objects for validations
        Object newConfigurationObject = ClassUtils.instantiate(connector.getConnectionConfigurationClass());
        FormUtils.fromForms(newConnection.getConnectorPart().getForms(), newConfigurationObject);

        Validation validation = validator.validateConnection(newConfigurationObject);
        if (validation.getStatus().canProceed()) {
          updateConnection(newConnection, tx);
        } else {
          logInvalidModelObject("connection", newConnection, validation);
          upgradeSuccessful = false;
        }
      }
      for (MJob job : jobs) {
        // Make a new copy of the forms from the connector,
        // else the values will get set in the forms in the connector for
        // each connection.
        List<MForm> forms = newConnector.getJobForms(job.getType()).clone(false).getForms();
        MJobForms newJobForms = new MJobForms(job.getType(), forms);
        upgrader.upgrade(job.getConnectorPart(), newJobForms);
        MJob newJob = new MJob(connectorID, job.getConnectionId(),
          job.getType(), newJobForms, job.getFrameworkPart());
        newJob.setPersistenceId(job.getPersistenceId());

        // Transform form structures to objects for validations
        Object newConfigurationObject = ClassUtils.instantiate(connector.getJobConfigurationClass(job.getType()));
        FormUtils.fromForms(newJob.getConnectorPart().getForms(), newConfigurationObject);

        Validation validation = validator.validateJob(newJob.getType(), newConfigurationObject);
        if (validation.getStatus().canProceed()) {
          updateJob(newJob, tx);
        } else {
          logInvalidModelObject("job", newJob, validation);
          upgradeSuccessful = false;
        }
View Full Code Here

        // Transform form structures to objects for validations
        Object newConfigurationObject = ClassUtils.instantiate(FrameworkManager.getInstance().getConnectionConfigurationClass());
        FormUtils.fromForms(newConnection.getFrameworkPart().getForms(), newConfigurationObject);

        Validation validation = validator.validateConnection(newConfigurationObject);
        if (validation.getStatus().canProceed()) {
          updateConnection(newConnection, tx);
        } else {
          logInvalidModelObject("connection", newConnection, validation);
          upgradeSuccessful = false;
        }
      }
      for (MJob job : jobs) {
        // Make a new copy of the forms from the framework,
        // else the values will get set in the forms in the connector for
        // each connection.
        List<MForm> forms = framework.getJobForms(job.getType()).clone(false).getForms();
        MJobForms newJobForms = new MJobForms(job.getType(), forms);
        upgrader.upgrade(job.getFrameworkPart(), newJobForms);
        MJob newJob = new MJob(job.getConnectorId(), job.getConnectionId(),
          job.getType(), job.getConnectorPart(), newJobForms);
        newJob.setPersistenceId(job.getPersistenceId());

        // Transform form structures to objects for validations
        Object newConfigurationObject = ClassUtils.instantiate(FrameworkManager.getInstance().getJobConfigurationClass(job.getType()));
        FormUtils.fromForms(newJob.getFrameworkPart().getForms(), newConfigurationObject);

        Validation validation = validator.validateJob(newJob.getType(), newConfigurationObject);
        if (validation.getStatus().canProceed()) {
          updateJob(newJob, tx);
        } else {
          logInvalidModelObject("job", newJob, validation);
          upgradeSuccessful = false;
        }
View Full Code Here

      connection.getConnectorPart().getForms(), connectorConfig);
    FormUtils.fromForms(
      connection.getFrameworkPart().getForms(), frameworkConfig);

    // Validate both parts
    Validation connectorValidation =
      connectorValidator.validateConnection(connectorConfig);
    Validation frameworkValidation =
      frameworkValidator.validateConnection(frameworkConfig);

    Status finalStatus = Status.getWorstStatus(connectorValidation.getStatus(),
      frameworkValidation.getStatus());

    // Return back validations in all cases
    ValidationBean outputBean =
      new ValidationBean(connectorValidation, frameworkValidation);
View Full Code Here

    FormUtils.fromForms(job.getConnectorPart().getForms(), connectorConfig);
    FormUtils.fromForms(job.getFrameworkPart().getForms(), frameworkConfig);

    // Validate both parts
    Validation connectorValidation =
      connectorValidator.validateJob(job.getType(), connectorConfig);
    Validation frameworkValidation =
      frameworkValidator.validateJob(job.getType(), frameworkConfig);

    Status finalStatus = Status.getWorstStatus(connectorValidation.getStatus(),
      frameworkValidation.getStatus());

    // Return back validations in all cases
    ValidationBean outputBean =
      new ValidationBean(connectorValidation, frameworkValidation);
View Full Code Here

  public List<MSubmission> getSubmissionsForJob(long jid) {
    return requests.readHistory(jid).getSubmissions();
  }

  private Status applyValidations(ValidationBean bean, MConnection connection) {
    Validation connector = bean.getConnectorValidation();
    Validation framework = bean.getFrameworkValidation();

    FormUtils.applyValidation(connection.getConnectorPart().getForms(), connector);
    FormUtils.applyValidation(connection.getFrameworkPart().getForms(), framework);

    Long id = bean.getId();
    if(id != null) {
      connection.setPersistenceId(id);
    }

    return Status.getWorstStatus(connector.getStatus(), framework.getStatus());
  }
View Full Code Here

    return Status.getWorstStatus(connector.getStatus(), framework.getStatus());
  }

  private Status applyValidations(ValidationBean bean, MJob job) {
    Validation connector = bean.getConnectorValidation();
    Validation framework = bean.getFrameworkValidation();

    FormUtils.applyValidation(job.getConnectorPart().getForms(), connector);
    FormUtils.applyValidation(job.getFrameworkPart().getForms(), framework);

    Long id = bean.getId();
    if(id != null) {
      job.setPersistenceId(id);
    }

    return Status.getWorstStatus(connector.getStatus(), framework.getStatus());
  }
View Full Code Here

    //specifying clear stage table flag without specifying name of
    // the stage table
    jobConf.table.tableName = schemalessTableName;
    jobConf.table.clearStageTable = false;
    GenericJdbcValidator validator = new GenericJdbcValidator();
    Validation validation = validator.validateJob(MJob.Type.EXPORT, jobConf);
    assertEquals("User should not specify clear stage table flag without " +
      "specifying name of the stage table",
      Status.UNACCEPTABLE,
      validation.getStatus());
    assertTrue(validation.getMessages().containsKey(
      new Validation.FormInput("table")));

    jobConf.table.clearStageTable = true;
    validation = validator.validateJob(MJob.Type.EXPORT, jobConf);
    assertEquals("User should not specify clear stage table flag without " +
      "specifying name of the stage table",
      Status.UNACCEPTABLE,
      validation.getStatus());
    assertTrue(validation.getMessages().containsKey(
      new Validation.FormInput("table")));
  }
View Full Code Here

TOP

Related Classes of org.apache.sqoop.validation.Validation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.