congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
ObjectUtils.isClassPresent
Code IndexAdd Tabnine to your IDE (free)

How to use
isClassPresent
method
in
org.elasticsearch.hadoop.util.ObjectUtils

Best Java code snippets using org.elasticsearch.hadoop.util.ObjectUtils.isClassPresent (Showing top 4 results out of 315)

origin: elastic/elasticsearch-hadoop

static void checkSparkLibraryCompatibility(boolean throwOnIncompatible) {
  // check whether the correct es-hadoop is used with the correct Spark version
  boolean isSpark13Level = ObjectUtils.isClassPresent("org.apache.spark.sql.DataFrame", SparkConf.class.getClassLoader());
  boolean isSpark20Level = ObjectUtils.isClassPresent("org.apache.spark.sql.streaming.StreamingQuery", SparkConf.class.getClassLoader());
  CompatibilityLevel compatibilityLevel = ObjectUtils.instantiate("org.elasticsearch.spark.sql.SparkSQLCompatibilityLevel", CompatUtils.class.getClassLoader());
  boolean isEshForSpark20 = "20".equals(compatibilityLevel.versionId());
  String esSupportedSparkVersion = compatibilityLevel.versionDescription();
  String errorMessage = null;
  if (!(isSpark13Level || isSpark20Level)) {
    String sparkVersion = getSparkVersionOr("1.0-1.2");
    errorMessage = String.format("Incorrect classpath detected; Elasticsearch Spark compiled for Spark %s but used with unsupported Spark version %s",
        esSupportedSparkVersion, sparkVersion);
  } else if (isSpark20Level != isEshForSpark20) { // XOR can be applied as well but != increases readability
    String sparkVersion = getSparkVersionOr(isSpark13Level ? "1.3-1.6" : "2.0+");
    errorMessage = String.format("Incorrect classpath detected; Elasticsearch Spark compiled for Spark %s but used with Spark %s",
        esSupportedSparkVersion, sparkVersion);
  }
  if (errorMessage != null) {
    if (throwOnIncompatible) {
      throw new EsHadoopIllegalStateException(errorMessage);
    } else {
      LogFactory.getLog("org.elasticsearch.spark.rdd.EsSpark").warn(errorMessage);
    }
  }
}
origin: elastic/elasticsearch-hadoop

static void checkSparkLibraryCompatibility(boolean throwOnIncompatible) {
  // check whether the correct es-hadoop is used with the correct Spark version
  boolean isSpark13Level = ObjectUtils.isClassPresent("org.apache.spark.sql.DataFrame", SparkConf.class.getClassLoader());
  boolean isSpark20Level = ObjectUtils.isClassPresent("org.apache.spark.sql.streaming.StreamingQuery", SparkConf.class.getClassLoader());
  CompatibilityLevel compatibilityLevel = ObjectUtils.instantiate("org.elasticsearch.spark.sql.SparkSQLCompatibilityLevel", CompatUtils.class.getClassLoader());
  boolean isEshForSpark20 = "20".equals(compatibilityLevel.versionId());
  String esSupportedSparkVersion = compatibilityLevel.versionDescription();
  String errorMessage = null;
  if (!(isSpark13Level || isSpark20Level)) {
    String sparkVersion = getSparkVersionOr("1.0-1.2");
    errorMessage = String.format("Incorrect classpath detected; Elasticsearch Spark compiled for Spark %s but used with unsupported Spark version %s",
        esSupportedSparkVersion, sparkVersion);
  } else if (isSpark20Level != isEshForSpark20) { // XOR can be applied as well but != increases readability
    String sparkVersion = getSparkVersionOr(isSpark13Level ? "1.3-1.6" : "2.0+");
    errorMessage = String.format("Incorrect classpath detected; Elasticsearch Spark compiled for Spark %s but used with Spark %s",
        esSupportedSparkVersion, sparkVersion);
  }
  if (errorMessage != null) {
    if (throwOnIncompatible) {
      throw new EsHadoopIllegalStateException(errorMessage);
    } else {
      LogFactory.getLog("org.elasticsearch.spark.rdd.EsSpark").warn(errorMessage);
    }
  }
}
origin: org.elasticsearch/elasticsearch-hadoop

static void checkSparkLibraryCompatibility(boolean throwOnIncompatible) {
  // check whether the correct es-hadoop is used with the correct Spark version
  boolean isSpark13Level = ObjectUtils.isClassPresent("org.apache.spark.sql.DataFrame", SparkConf.class.getClassLoader());
  boolean isSpark20Level = ObjectUtils.isClassPresent("org.apache.spark.sql.streaming.StreamingQuery", SparkConf.class.getClassLoader());
  CompatibilityLevel compatibilityLevel = ObjectUtils.instantiate("org.elasticsearch.spark.sql.SparkSQLCompatibilityLevel", CompatUtils.class.getClassLoader());
  boolean isEshForSpark20 = "20".equals(compatibilityLevel.versionId());
  String esSupportedSparkVersion = compatibilityLevel.versionDescription();
  String errorMessage = null;
  if (!(isSpark13Level || isSpark20Level)) {
    String sparkVersion = getSparkVersionOr("1.0-1.2");
    errorMessage = String.format("Incorrect classpath detected; Elasticsearch Spark compiled for Spark %s but used with unsupported Spark version %s",
        esSupportedSparkVersion, sparkVersion);
  } else if (isSpark20Level != isEshForSpark20) { // XOR can be applied as well but != increases readability
    String sparkVersion = getSparkVersionOr(isSpark13Level ? "1.3-1.6" : "2.0+");
    errorMessage = String.format("Incorrect classpath detected; Elasticsearch Spark compiled for Spark %s but used with Spark %s",
        esSupportedSparkVersion, sparkVersion);
  }
  if (errorMessage != null) {
    if (throwOnIncompatible) {
      throw new EsHadoopIllegalStateException(errorMessage);
    } else {
      LogFactory.getLog("org.elasticsearch.spark.rdd.EsSpark").warn(errorMessage);
    }
  }
}
origin: org.elasticsearch/elasticsearch-spark-13

static void checkSparkLibraryCompatibility(boolean throwOnIncompatible) {
  // check whether the correct es-hadoop is used with the correct Spark version
  boolean isSpark13Level = ObjectUtils.isClassPresent("org.apache.spark.sql.DataFrame", SparkConf.class.getClassLoader());
  boolean isSpark20Level = ObjectUtils.isClassPresent("org.apache.spark.sql.streaming.StreamingQuery", SparkConf.class.getClassLoader());
  CompatibilityLevel compatibilityLevel = ObjectUtils.instantiate("org.elasticsearch.spark.sql.SparkSQLCompatibilityLevel", CompatUtils.class.getClassLoader());
  boolean isEshForSpark20 = "20".equals(compatibilityLevel.versionId());
  String esSupportedSparkVersion = compatibilityLevel.versionDescription();
  String errorMessage = null;
  if (!(isSpark13Level || isSpark20Level)) {
    String sparkVersion = getSparkVersionOr("1.0-1.2");
    errorMessage = String.format("Incorrect classpath detected; Elasticsearch Spark compiled for Spark %s but used with unsupported Spark version %s",
        esSupportedSparkVersion, sparkVersion);
  } else if (isSpark20Level != isEshForSpark20) { // XOR can be applied as well but != increases readability
    String sparkVersion = getSparkVersionOr(isSpark13Level ? "1.3-1.6" : "2.0+");
    errorMessage = String.format("Incorrect classpath detected; Elasticsearch Spark compiled for Spark %s but used with Spark %s",
        esSupportedSparkVersion, sparkVersion);
  }
  if (errorMessage != null) {
    if (throwOnIncompatible) {
      throw new EsHadoopIllegalStateException(errorMessage);
    } else {
      LogFactory.getLog("org.elasticsearch.spark.rdd.EsSpark").warn(errorMessage);
    }
  }
}
org.elasticsearch.hadoop.utilObjectUtilsisClassPresent

Popular methods of ObjectUtils

  • instantiate
  • isEmpty
  • toObjectArray

Popular in Java

  • Reactive rest calls using spring rest template
  • notifyDataSetChanged (ArrayAdapter)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Path (java.nio.file)
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • BoxLayout (javax.swing)
  • Top 25 Plugins for Webstorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now