Package org.apache.sqoop.json

Examples of org.apache.sqoop.json.JobBean


    io.out.println(MessageFormat.format(getResource().getString(Constants
        .RES_UPDATE_UPDATING_JOB), jobId));

    ConsoleReader reader = new ConsoleReader();

    JobBean jobBean = readJob(jobId);

    // TODO(jarcec): Check that we have expected data
    MJob job = jobBean.getJobs().get(0);
    ResourceBundle frameworkBundle
      = jobBean.getFrameworkBundle();
    ResourceBundle connectorBundle
      = jobBean.getConnectorBundle(job.getConnectorId());

    Status status = Status.FINE;

    io.out.println(getResource().getString(Constants.RES_PROMPT_UPDATE_JOB_METADATA));
View Full Code Here


    MessageFormat.format(getResource().getString(Constants.RES_CLONE_CLONING_JOB),
        jobId);

    ConsoleReader reader = new ConsoleReader();

    JobBean jobBean = readJob(jobId);

    // TODO(jarcec): Check that we have expected data
    MJob job = jobBean.getJobs().get(0);
    ResourceBundle frameworkBundle
      = jobBean.getFrameworkBundle();
    ResourceBundle connectorBundle
      = jobBean.getConnectorBundle(job.getConnectorId());

    Status status = Status.FINE;

    // Remove persistent id as we're making a clone
    job.setPersistenceId(MPersistableEntity.PERSISTANCE_ID_DEFAULT);
View Full Code Here

    return null;
  }

  private void showJob(String jid) {
    JobBean jobBean = readJob(jid);

    List<MJob> jobs = jobBean.getJobs();
    String s = MessageFormat.format(getResource().getString(Constants.RES_SHOW_PROMPT_JOBS_TO_SHOW), jobs.size());
    io.out.println(s);

    for (MJob job : jobs) {
      s = MessageFormat.format(getResource().getString
          (Constants.RES_SHOW_PROMPT_JOB_INFO), job.getPersistenceId(),
          job.getName());
      io.out.println(s);

      long connectorId = job.getConnectorId();

      // Display connector part
      displayForms(io,
                   job.getConnectorPart().getForms(),
                   jobBean.getConnectorBundle(connectorId));
      displayForms(io,
                   job.getFrameworkPart().getForms(),
                   jobBean.getFrameworkBundle());
    }
  }
View Full Code Here

  private JsonBean createUpdateJob(RequestContext ctx, boolean update) {
//    Check that given ID equals with sent ID, otherwise report an error UPDATE
//    String sxid = ctx.getLastURLElement();
//    long xid = Long.valueOf(sxid);

    JobBean bean = new JobBean();

    try {
      JSONObject json =
        (JSONObject) JSONValue.parse(ctx.getRequest().getReader());
      bean.restore(json);
    } catch (IOException e) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Can't read request content", e);
    }

    // Get job object
    List<MJob> jobs = bean.getJobs();

    if(jobs.size() != 1) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Expected one job metadata but got " + jobs.size());
    }
View Full Code Here

    return outputBean;
  }

  private JsonBean getJobs(RequestContext ctx) {
    String sjid = ctx.getLastURLElement();
    JobBean bean;

    Locale locale = ctx.getAcceptLanguageHeader();
    Repository repository = RepositoryManager.getInstance().getRepository();

    if (sjid.equals("all")) {

      List<MJob> jobs = repository.findJobs();
      bean = new JobBean(jobs);

      // Add associated resources into the bean
      for( MJob job : jobs) {
        long connectorId = job.getConnectorId();
        if(!bean.hasConnectorBundle(connectorId)) {
          bean.addConnectorBundle(connectorId,
            ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
        }
      }
    } else {
      long jid = Long.valueOf(sjid);

      MJob job = repository.findJob(jid);
      long connectorId = job.getConnectorId();

      bean = new JobBean(job);

      bean.addConnectorBundle(connectorId,
        ConnectorManager.getInstance().getResourceBundle(connectorId, locale));
    }

    // Sent framework resource bundle in all cases
    bean.setFrameworkBundle(FrameworkManager.getInstance().getBundle(locale));

    return bean;
  }
View Full Code Here

    } else {
      response = super.get(serverUrl + RESOURCE + xid);
    }
    JSONObject jsonObject = (JSONObject) JSONValue.parse(response);

    JobBean jobBean = new JobBean();
    jobBean.restore(jsonObject);

    return jobBean;
  }
View Full Code Here

    return jobBean;
  }

  public ValidationBean create(String serverUrl, MJob job) {

    JobBean jobBean = new JobBean(job);

    // Extract all form inputs including sensitive inputs
    JSONObject jobJson = jobBean.extract(false);

    String response = super.post(serverUrl + RESOURCE,
      jobJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
View Full Code Here

    return validationBean;
  }

  public ValidationBean update(String serverUrl, MJob job) {

    JobBean jobBean = new JobBean(job);

    // Extract all form inputs including sensitive inputs
    JSONObject jobJson = jobBean.extract(false);

    String response = super.put(serverUrl + RESOURCE + job.getPersistenceId(),
                                jobJson.toJSONString());

    ValidationBean validationBean = new ValidationBean();
View Full Code Here

TOP

Related Classes of org.apache.sqoop.json.JobBean

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.