Package org.apache.sqoop.common

Examples of org.apache.sqoop.common.SqoopException


    Repository repository = RepositoryManager.getInstance().getRepository();
    MSubmission submission = repository.findSubmissionLastForJob(jobId);

    if (submission == null || !submission.getStatus().isRunning()) {
      throw new SqoopException(FrameworkError.FRAMEWORK_0003,
        "Job with id " + jobId + " is not running");
    }

    String externalId = submission.getExternalId();
    submissionEngine.stop(externalId);
View Full Code Here


    String newSubmissionEngineClassName = newContext
      .getString(FrameworkConstants.SYSCFG_SUBMISSION_ENGINE);
    if (newSubmissionEngineClassName == null
      || newSubmissionEngineClassName.trim().length() == 0) {
      throw new SqoopException(FrameworkError.FRAMEWORK_0001,
        newSubmissionEngineClassName);
    }

    String oldSubmissionEngineClassName = oldContext
      .getString(FrameworkConstants.SYSCFG_SUBMISSION_ENGINE);
    if (!newSubmissionEngineClassName.equals(oldSubmissionEngineClassName)) {
      LOG.warn("Submission engine cannot be replaced at the runtime. " +
        "You might need to restart the server.");
    }

    String newExecutionEngineClassName = newContext
      .getString(FrameworkConstants.SYSCFG_EXECUTION_ENGINE);
    if (newExecutionEngineClassName == null
      || newExecutionEngineClassName.trim().length() == 0) {
      throw new SqoopException(FrameworkError.FRAMEWORK_0007,
        newExecutionEngineClassName);
    }

    String oldExecutionEngineClassName = oldContext
      .getString(FrameworkConstants.SYSCFG_EXECUTION_ENGINE);
View Full Code Here

    String repoProviderClassName = context.getString(
        RepoConfigurationConstants.SYSCFG_REPO_PROVIDER);

    if (repoProviderClassName == null
        || repoProviderClassName.trim().length() == 0) {
      throw new SqoopException(RepositoryError.REPO_0001,
          RepoConfigurationConstants.SYSCFG_REPO_PROVIDER);
    }

    if (LOG.isTraceEnabled()) {
      LOG.trace("Repository provider: " + repoProviderClassName);
    }

    Class<?> repoProviderClass =
        ClassUtils.loadClass(repoProviderClassName);

    if (repoProviderClass == null) {
      throw new SqoopException(RepositoryError.REPO_0001,
          repoProviderClassName);
    }

    try {
      provider = (RepositoryProvider) repoProviderClass.newInstance();
    } catch (Exception ex) {
      throw new SqoopException(RepositoryError.REPO_0001,
          repoProviderClassName, ex);
    }

    provider.initialize(context);

    if(!context.getBoolean(RepoConfigurationConstants
      .SYSCFG_REPO_SCHEMA_IMMUTABLE, false)) {
      LOG.info("Creating or upgrading on disk structures if necessary");
      provider.getRepository().createOrUpdateInternals();
    }

    if(!provider.getRepository().haveSuitableInternals()) {
      throw new SqoopException(RepositoryError.REPO_0002);
    }

    SqoopConfiguration.getInstance().getProvider().registerListener(new CoreConfigurationListener(this));

    LOG.info("Repository initialized: OK");
View Full Code Here

    MapContext oldContext = SqoopConfiguration.getInstance().getOldContext();

    String newProviderClassName = newContext.getString(RepoConfigurationConstants.SYSCFG_REPO_PROVIDER);
    if (newProviderClassName == null
        || newProviderClassName.trim().length() == 0) {
      throw new SqoopException(RepositoryError.REPO_0001,
          RepoConfigurationConstants.SYSCFG_REPO_PROVIDER);
    }

    String oldProviderClassName = oldContext.getString(RepoConfigurationConstants.SYSCFG_REPO_PROVIDER);
    if (!newProviderClassName.equals(oldProviderClassName)) {
View Full Code Here

  @Override
  public JsonBean handleEvent(RequestContext ctx) {
    String[] urlElements = ctx.getUrlElements();
    if (urlElements.length < 2) {
      throw new SqoopException(ServerError.SERVER_0003,
        "Invalid URL, too few arguments for this servlet.");
    }

    // Let's check
    int length = urlElements.length;
    String action = urlElements[length - 2];

    if(action.equals("action")) {
      return handleActionEvent(ctx, urlElements[length - 1]);
    }

    if(action.equals("notification")) {
      return handleNotification(ctx, urlElements[length - 1]);
    }

    if(action.equals("history")) {
      return handleHistoryEvent(ctx, urlElements[length - 1]);
    }

    throw new SqoopException(ServerError.SERVER_0003,
      "Do not know what to do.");
  }
View Full Code Here

  private void help(String name) {
    Command command = shell.getRegistry().find(name);
    if (command == null) {
      String msg = MessageFormat.format(resource.getString(Constants
          .RES_UNRECOGNIZED_CMD), name);
      throw new SqoopException(ShellError.SHELL_0001, msg);
    }
    printlnResource(Constants.RES_HELP_CMD_USAGE, command.getName(), command.getUsage());
    println();
    println(command.getHelp());
    println();
View Full Code Here

        subContext = new PrefixContext(conf, "");
        configConnection = ConfigurationUtils.getConfigFrameworkConnection(conf);
        configJob = ConfigurationUtils.getConfigFrameworkJob(conf);
        break;
      default:
        throw new SqoopException(MapreduceExecutionError.MAPRED_EXEC_0023);
    }

    SqoopSplit split = context.getCurrentKey();
    ExtractorContext extractorContext = new ExtractorContext(subContext, new MapDataWriter(context), schema);

    try {
      LOG.info("Starting progress service");
      progressService.scheduleAtFixedRate(new ProgressRunnable(context), 0, 2, TimeUnit.MINUTES);

      LOG.info("Running extractor class " + extractorName);
      extractor.extract(extractorContext, configConnection, configJob, split.getPartition());
      LOG.info("Extractor has finished");
      context.getCounter(SqoopCounters.ROWS_READ)
              .increment(extractor.getRowsRead());
    } catch (Exception e) {
      throw new SqoopException(MapreduceExecutionError.MAPRED_EXEC_0017, e);
    } finally {
      LOG.info("Stopping progress service");
      progressService.shutdown();
      if(!progressService.awaitTermination(5, TimeUnit.SECONDS)) {
        LOG.info("Stopping progress service with shutdownNow");
View Full Code Here

      int numFiles = p.getNumberOfFiles();
      for (int i = 0; i < numFiles; i++) {
        extractFile(p.getFile(i), p.getOffset(i), p.getLength(i));
      }
    } catch (IOException e) {
      throw new SqoopException(MapreduceExecutionError.MAPRED_EXEC_0017, e);
    }
  }
View Full Code Here

    String jdbcHandlerClassName = repoContext.getHandlerClassName();

    Class<?> handlerClass = ClassUtils.loadClass(jdbcHandlerClassName);

    if (handlerClass == null) {
      throw new SqoopException(RepositoryError.JDBCREPO_0001,
          jdbcHandlerClassName);
    }

    try {
      handler = (JdbcRepositoryHandler) handlerClass.newInstance();
    } catch (Exception ex) {
      throw new SqoopException(RepositoryError.JDBCREPO_0001,
          jdbcHandlerClassName, ex);
    }

    String connectUrl = repoContext.getConnectionUrl();
    if (connectUrl == null || connectUrl.trim().length() == 0) {
      throw new SqoopException(RepositoryError.JDBCREPO_0002);
    }

    String jdbcDriverClassName = repoContext.getDriverClass();
    if (jdbcDriverClassName == null || jdbcDriverClassName.trim().length() == 0)
    {
      throw new SqoopException(RepositoryError.JDBCREPO_0003);
    }

    // Initialize a datasource
    Class<?> driverClass = ClassUtils.loadClass(jdbcDriverClassName);

    if (driverClass == null) {
      throw new SqoopException(RepositoryError.JDBCREPO_0003,
          jdbcDriverClassName);
    }

    try {
      driver = (Driver) driverClass.newInstance();
    } catch (Exception ex) {
      throw new SqoopException(RepositoryError.JDBCREPO_0003,
          jdbcDriverClassName, ex);
    }

    Properties jdbcProps = repoContext.getConnectionProperties();
View Full Code Here

      data.setContent(content, type);
      try {
        context.write(data, NullWritable.get());
      } catch (Exception e) {
        throw new SqoopException(MapreduceExecutionError.MAPRED_EXEC_0013, e);
      }
    }
View Full Code Here

TOP

Related Classes of org.apache.sqoop.common.SqoopException

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.