Tabnine Logo
PropertyType
Code IndexAdd Tabnine to your IDE (free)

How to use
PropertyType
in
org.apache.accumulo.core.conf

Best Java code snippets using org.apache.accumulo.core.conf.PropertyType (Showing top 20 results out of 315)

origin: apache/accumulo

public String getValue(Properties properties) {
 Objects.requireNonNull(properties);
 String value = properties.getProperty(getKey());
 if (value == null || value.isEmpty()) {
  value = getDefaultValue();
 }
 Objects.requireNonNull(value);
 if (isRequired() && value.isEmpty()) {
  throw new IllegalArgumentException(getKey() + " must be set!");
 }
 if (!type.isValidFormat(value)) {
  throw new IllegalArgumentException(
    "Invalid format for type \"" + type + "\" for provided value: " + value);
 }
 return value;
}
origin: apache/accumulo

private void checkType(ClientProperty property, PropertyType type) {
 if (!property.getType().equals(type)) {
  String msg = "Configuration method intended for type " + type + " called with a "
    + property.getType() + " argument (" + property.getKey() + ")";
  throw new IllegalArgumentException(msg);
 }
}
origin: apache/accumulo

void propertyTypeDescriptions() {
 for (PropertyType type : PropertyType.values()) {
  if (type == PropertyType.PREFIX)
   continue;
  doc.println(
    "| " + sanitize(type.toString()) + " | " + sanitize(type.getFormatDescription()) + " |");
 }
}
origin: org.apache.accumulo/accumulo-core

@Override
void propertyTypeDescriptions() {
 columnNames("Property Type", "Description");
 for (PropertyType type : PropertyType.values()) {
  if (type == PropertyType.PREFIX)
   continue;
  beginRow();
  cellData("<h3 id='" + type.name() + "'>" + type + "</h3>", null);
  cellData(type.getFormatDescription(), null);
  endRow();
 }
}
origin: org.apache.accumulo/accumulo-core

@Override
void property(Property prefix, Property prop) {
 boolean isDeprecated = prefix.isDeprecated() || prop.isDeprecated();
 if (prop.getKey().startsWith(prefix.getKey())) {
  beginRow();
  cellData(prop.getKey(), isDeprecated ? "class='deprecated'" : null);
  cellData(
    "<b><a href='#" + prop.getType().name() + "'>"
      + prop.getType().toString().replaceAll(" ", "&nbsp;") + "</a></b>",
    isDeprecated ? "class='deprecated'" : null);
  cellData(isZooKeeperMutable(prop), isDeprecated ? "class='deprecated'" : null);
  cellData(
    "<pre>" + (prop.getRawDefaultValue().isEmpty() ? "&nbsp;"
      : sanitize(prop.getRawDefaultValue().replaceAll(" ", "&nbsp;"))) + "</pre>",
    isDeprecated ? "class='deprecated'" : null);
  cellData(
    (isDeprecated ? "<b><i>Deprecated.</i></b> " : "") + sanitize(prop.getDescription()),
    isDeprecated ? "class='deprecated'" : null);
  endRow();
 }
}
origin: apache/accumulo

void property(Property prop) {
 boolean depr = prop.isDeprecated();
 doc.print("| <a name=\"" + prop.getKey().replace(".", "_") + "\" class=\"prop\"></a> "
   + prop.getKey() + " | ");
 doc.print(prop.isExperimental() ? "**Experimental.** " : "");
 doc.print(
   (depr ? "**Deprecated.** " : "") + strike(sanitize(prop.getDescription()), depr) + "<br>");
 doc.print(strike("**type:** " + prop.getType().name(), depr) + ", ");
 doc.print(strike("**zk mutable:** " + isZooKeeperMutable(prop), depr) + ", ");
 String defaultValue = sanitize(prop.getRawDefaultValue()).trim();
 if (defaultValue.length() == 0) {
  defaultValue = strike("**default value:** empty", depr);
 } else if (defaultValue.contains("\n")) {
  // deal with multi-line values, skip strikethrough of value
  defaultValue = strike("**default value:** ", depr) + "\n```\n" + defaultValue + "\n```\n";
 } else {
  if (prop.getType() == PropertyType.CLASSNAME
    && defaultValue.startsWith("org.apache.accumulo")) {
   defaultValue = strike("**default value:** " + "{% jlink -f " + defaultValue + " %}", depr);
  } else {
   defaultValue = strike("**default value:** " + "`" + defaultValue + "`", depr);
  }
 }
 doc.println(defaultValue + " |");
}
origin: org.apache.accumulo/accumulo-core

@Override
void property(Property prefix, Property prop) {
 boolean depr = prefix.isDeprecated() || prop.isDeprecated();
 if (prop.getKey().startsWith(prefix.getKey())) {
  doc.println("===== " + prop.getKey());
  doc.println(strike((depr ? "_Deprecated._ " : "") + sanitize(prop.getDescription()), depr));
  doc.println();
  doc.println(strike("_Type:_ " + prop.getType().name(), depr) + " +");
  doc.println(strike("_Zookeeper Mutable:_ " + isZooKeeperMutable(prop), depr) + " +");
  String defaultValue = sanitize(prop.getRawDefaultValue()).trim();
  if (defaultValue.length() == 0) {
   // need a placeholder or the asciidoc line break won't work
   defaultValue = strike("_Default Value:_ _empty_", depr);
  } else if (defaultValue.contains("\n")) {
   // deal with multi-line values, skip strikethrough of value
   defaultValue = strike("_Default Value:_ ", depr) + "\n----\n" + defaultValue + "\n----\n";
  } else {
   defaultValue = strike("_Default Value:_ " + "`" + defaultValue + "`", depr);
  }
  doc.println(defaultValue);
  doc.println();
 }
}
origin: apache/accumulo

public static boolean isPropertyValid(String property, String value) {
 Property p = Property.getPropertyByKey(property);
 return (p == null || p.getType().isValidFormat(value))
   && Property.isValidTablePropertyKey(property);
}
origin: org.apache.accumulo/accumulo-core

@Override
void propertyTypeDescriptions() {
 for (PropertyType type : PropertyType.values()) {
  if (type == PropertyType.PREFIX)
   continue;
  doc.println("==== " + sanitize(type.toString()));
  doc.println(sanitize(type.getFormatDescription()));
  doc.println();
 }
}
origin: apache/accumulo

private static void checkType(Property property, PropertyType type) {
 if (!property.getType().equals(type)) {
  String msg = "Configuration method intended for type " + type + " called with a "
    + property.getType() + " argument (" + property.getKey() + ")";
  IllegalArgumentException err = new IllegalArgumentException(msg);
  log.error(msg, err);
  throw err;
 }
}
origin: apache/accumulo

@Override
public String get(Property property) {
 String value = config.get(property.getKey());
 if (value == null || !property.getType().isValidFormat(value)) {
  if (value != null) {
   log.error("Using default value for {} due to improperly formatted {}: {}",
     property.getKey(), property.getType(), value);
  }
  value = parent.get(property);
 }
 return value;
}
origin: org.apache.accumulo/accumulo-core

private void checkType(Property property, PropertyType type) {
 if (!property.getType().equals(type)) {
  String msg = "Configuration method intended for type " + type + " called with a "
    + property.getType() + " argument (" + property.getKey() + ")";
  IllegalArgumentException err = new IllegalArgumentException(msg);
  log.error(msg, err);
  throw err;
 }
}
origin: apache/accumulo

public static boolean isPropertyValid(String property, String value) {
 Property p = Property.getPropertyByKey(property);
 return (p == null || p.getType().isValidFormat(value))
   && Property.isValidTablePropertyKey(property);
}
origin: org.apache.accumulo/accumulo-core

private void checkType(ClientProperty property, PropertyType type) {
 if (!property.getType().equals(type)) {
  String msg = "Configuration method intended for type " + type + " called with a "
    + property.getType() + " argument (" + property.getKey() + ")";
  throw new IllegalArgumentException(msg);
 }
}
origin: apache/accumulo

/**
 * Helper for transforming Accumulo configuration properties into something that can be stored
 * safely inside the Hadoop Job configuration.
 *
 * @param implementingClass
 *          the class whose name will be used as a prefix for the property configuration key
 * @param conf
 *          the Hadoop configuration object to configure
 * @param property
 *          the supported Accumulo property
 * @param value
 *          the value of the property to set
 * @since 1.6.0
 */
private static <T> void setAccumuloProperty(Class<?> implementingClass, Configuration conf,
  Property property, T value) {
 if (isSupportedAccumuloProperty(property)) {
  String val = String.valueOf(value);
  if (property.getType().isValidFormat(val))
   conf.set(
     enumToConfKey(implementingClass, Opts.ACCUMULO_PROPERTIES) + "." + property.getKey(),
     val);
  else
   throw new IllegalArgumentException(
     "Value is not appropriate for property type '" + property.getType() + "'");
 } else
  throw new IllegalArgumentException("Unsupported configuration property " + property.getKey());
}
origin: apache/accumulo

public static boolean setSystemProperty(ServerContext context, String property, String value)
  throws KeeperException, InterruptedException {
 if (!Property.isValidZooPropertyKey(property)) {
  IllegalArgumentException iae = new IllegalArgumentException(
    "Zookeeper property is not mutable: " + property);
  log.debug("Attempted to set zookeeper property.  It is not mutable", iae);
  throw iae;
 }
 // Find the property taking prefix into account
 Property foundProp = null;
 for (Property prop : Property.values()) {
  if (prop.getType() == PropertyType.PREFIX && property.startsWith(prop.getKey())
    || prop.getKey().equals(property)) {
   foundProp = prop;
   break;
  }
 }
 if ((foundProp == null || (foundProp.getType() != PropertyType.PREFIX
   && !foundProp.getType().isValidFormat(value)))) {
  IllegalArgumentException iae = new IllegalArgumentException(
    "Ignoring property " + property + " it is either null or in an invalid format");
  log.debug("Attempted to set zookeeper property.  Value is either null or invalid", iae);
  throw iae;
 }
 // create the zk node for this property and set it's data to the specified value
 String zPath = context.getZooKeeperRoot() + Constants.ZCONFIG + "/" + property;
 return context.getZooReaderWriter().putPersistentData(zPath, value.getBytes(UTF_8),
   NodeExistsPolicy.OVERWRITE);
}
origin: apache/accumulo

private String _get(Property property) {
 String key = property.getKey();
 String value = null;
 if (Property.isValidZooPropertyKey(key)) {
  value = getRaw(key);
 }
 if (value == null || !property.getType().isValidFormat(value)) {
  if (value != null)
   log.error("Using parent value for {} due to improperly formatted {}: {}", key,
     property.getType(), value);
  value = parent.get(property);
 }
 return value;
}
origin: apache/accumulo

/**
 * Gets a property. If the property is not in ZooKeeper or is present but an invalid format for
 * the property type, the parent configuration is consulted (if provided).
 *
 * @param property
 *          property to get
 * @param path
 *          ZooKeeper path where properties lie
 * @param parent
 *          parent configuration (optional)
 * @return property value, or null if not found
 */
String get(Property property, String path, AccumuloConfiguration parent) {
 String key = property.getKey();
 String value = get(path + "/" + key);
 if (value == null || !property.getType().isValidFormat(value)) {
  if (value != null) {
   log.error("Using default value for {} due to improperly formatted {}: {}", key,
     property.getType(), value);
  }
  if (parent != null) {
   value = parent.get(property);
  }
 }
 return value;
}
origin: apache/accumulo

else if (prop.getType() == PropertyType.PREFIX)
 fatal(PREFIX + "incomplete property key (" + key + ")");
else if (!prop.getType().isValidFormat(value))
 fatal(PREFIX + "improperly formatted value for key (" + key + ", type=" + prop.getType()
   + ") : " + value);
origin: org.apache.accumulo/accumulo-server-base

public static boolean isPropertyValid(String property, String value) {
 Property p = Property.getPropertyByKey(property);
 if ((p != null && !p.getType().isValidFormat(value))
   || !Property.isValidTablePropertyKey(property))
  return false;
 return true;
}
org.apache.accumulo.core.confPropertyType

Javadoc

Types of Property values. Each type has a short name, a description, and a regex which valid values match. All of these fields are optional.

Most used methods

  • isValidFormat
    Checks if the given value is valid for this type.
  • equals
  • getFormatDescription
    Gets the description of this type.
  • name
  • toString
  • values

Popular in Java

  • Parsing JSON documents to java classes using gson
  • addToBackStack (FragmentTransaction)
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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