congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ProtocolVersion
Code IndexAdd Tabnine to your IDE (free)

How to use
ProtocolVersion
in
com.moz.fiji.schema.util

Best Java code snippets using com.moz.fiji.schema.util.ProtocolVersion (Showing top 20 results out of 315)

origin: com.moz.fiji.schema/fiji-schema-cassandra

/** {@inheritDoc} */
@Override
public boolean isSecurityEnabled() throws IOException {
 return mSystemTable.getSecurityVersion().compareTo(Versions.MIN_SECURITY_VERSION) >= 0;
}
origin: com.moz.fiji.schema/fiji-schema

/**
 * Computes the effective ProtocolVersion from a layout version string.
 *
 * <p> Normalizes fiji-1.0 into layout-1.0.0 </p>
 *
 * @param version Layout version string.
 * @return the effective layout ProtocolVersion.
 */
private static ProtocolVersion computeLayoutVersion(String version) {
 final ProtocolVersion pversion = ProtocolVersion.parse(version);
 if (Objects.equal(pversion, Versions.LAYOUT_FIJI_1_0_0_DEPRECATED)) {
  // Deprecated "fiji-1.0" is compatible with "layout-1.0.0"
  return Versions.LAYOUT_1_0_0;
 } else {
  return pversion;
 }
}
origin: com.moz.fiji.schema/fiji-schema

return clientVersion.getProtocolName().equals(clusterVersion.getProtocolName())
  && clientVersion.getMajorVersion() >= clusterVersion.getMajorVersion();
origin: com.moz.fiji.schema/fiji-schema

/** {@inheritDoc} */
@Override
public boolean equals(Object other) {
 if (null == other) {
  return false;
 } else if (this == other) {
  return true;
 } else if (!(other instanceof ProtocolVersion)) {
  return false;
 }
 ProtocolVersion otherVer = (ProtocolVersion) other;
 if (!checkEquality(mProtocol, otherVer.mProtocol)) {
  return false;
 }
 return getMajorVersion() == otherVer.getMajorVersion()
   && getMinorVersion() == otherVer.getMinorVersion()
   && getRevision() == otherVer.getRevision();
}
origin: com.moz.fiji.schema/fiji-schema

/** {@inheritDoc} */
@Override
public int compareTo(ProtocolVersion other) {
 if (null == mProtocol && null != other.mProtocol) {
  // null protocol sorts ahead of any alphabetic protocol.
  return -1;
 } else if (mProtocol != null) {
  if (null == other.mProtocol) {
   return 1; // they sort as 'less than' us since their protocol name is null.
  }
  int protoCmp = mProtocol.compareTo(other.mProtocol);
  if (0 != protoCmp) {
   return protoCmp;
  }
 }
 int majCmp = Integer.valueOf(getMajorVersion()).compareTo(other.getMajorVersion());
 if (0 != majCmp) {
  return majCmp;
 }
 int minCmp = Integer.valueOf(getMinorVersion()).compareTo(other.getMinorVersion());
 if (0 != minCmp) {
  return minCmp;
 }
 int revCmp = Integer.valueOf(getRevision()).compareTo(other.getRevision());
 return revCmp;
}
origin: com.moz.fiji.schema/fiji-schema

final ProtocolVersion layoutVersion = ProtocolVersion.parse(layout.getVersion());
final ProtocolVersion systemVersion = getSystemTable().getDataVersion();
if ((layoutVersion.compareTo(Versions.LAYOUT_VALIDATION_VERSION) >= 0)
  && (systemVersion.compareTo(Versions.MIN_SYS_VER_FOR_LAYOUT_VALIDATION) < 0)) {
 throw new InvalidLayoutException(
   String.format("Layout version: %s not supported by system version: %s",
origin: com.moz.fiji.mapreduce.lib/fiji-mapreduce-lib

final ProtocolVersion importVersion = ProtocolVersion.parse(mDesc.getVersion());
if (!IMPORT_PROTOCOL_NAME.equals(importVersion.getProtocolName())) {
 throw new InvalidTableImportDescriptorException(
   String.format("Invalid version protocol: '%s'. Expected: '%s'.",
   importVersion.getProtocolName(),
   IMPORT_PROTOCOL_NAME));
if (MAX_IMPORT_VER.compareTo(importVersion) < 0) {
 throw new InvalidTableImportDescriptorException("The maximum import version we support is "
   + MAX_IMPORT_VER + "; this import requires " + importVersion);
} else if (MIN_IMPORT_VER.compareTo(importVersion) > 0) {
 throw new InvalidTableImportDescriptorException("The minimum import version we support is "
   + MIN_IMPORT_VER + "; this import requires " + importVersion);
origin: com.moz.fiji.schema/fiji-schema

if (!Objects.equal(LAYOUT_PROTOCOL_NAME, mLayoutVersion.getProtocolName())) {
 final String exceptionMessage;
 if (Objects.equal(
   Versions.LAYOUT_FIJI_1_0_0_DEPRECATED.getProtocolName(),
   mLayoutVersion.getProtocolName())) {
      + " but received version '%s'. You should specify a layout version protocol"
      + " as '%s-x.y', not '%s-x.y'.",
      Versions.LAYOUT_FIJI_1_0_0_DEPRECATED.getProtocolName(),
      Versions.LAYOUT_FIJI_1_0_0_DEPRECATED,
      mLayoutVersion,
      LAYOUT_PROTOCOL_NAME,
      Versions.LAYOUT_FIJI_1_0_0_DEPRECATED.getProtocolName());
 } else {
  exceptionMessage = String.format("Invalid version protocol: '%s'. Expected '%s'.",
    mLayoutVersion.getProtocolName(),
    LAYOUT_PROTOCOL_NAME);
if (Versions.MAX_LAYOUT_VERSION.compareTo(mLayoutVersion) < 0) {
 throw new InvalidLayoutException("The maximum layout version we support is "
   + Versions.MAX_LAYOUT_VERSION + "; this layout requires " + mLayoutVersion);
} else if (Versions.MIN_LAYOUT_VERSION.compareTo(mLayoutVersion) > 0) {
 throw new InvalidLayoutException("The minimum layout version we support is "
   + Versions.MIN_LAYOUT_VERSION + "; this layout requires " + mLayoutVersion);
if (Versions.BLOCK_SIZE_LAYOUT_VERSION.compareTo(mLayoutVersion) > 0) {
 if (mDesc.getMaxFilesize() != null) {
    + Versions.BLOCK_SIZE_LAYOUT_VERSION.toString());
origin: com.moz.fiji.schema/fiji-schema

Preconditions.checkArgument(nonFlagArgs.isEmpty(),
  "Incorrect number of arguments for \"get-version\".");
String version = mTable.getDataVersion().toString();
getPrintStream().println("Fiji data version = " + version);
return SUCCESS;
Preconditions.checkArgument(nonFlagArgs.size() == 1,
  "Incorrect number of arguments for \"put-version <version>\".");
ProtocolVersion version = ProtocolVersion.parse(nonFlagArgs.get(0));
if (isInteractive()) {
 if (yesNoPrompt("Changing the version information of a system table may cause "
origin: com.moz.fiji.schema/fiji-schema

/** {@inheritDoc} */
@Override
public synchronized void setDataVersion(ProtocolVersion version) throws IOException {
 final State state = mState.get();
 Preconditions.checkState(state == State.OPEN,
   "Cannot set data version in SystemTable instance in state %s.", state);
 putValue(KEY_DATA_VERSION, Bytes.toBytes(version.toString()));
}
origin: com.moz.fiji.schema/fiji-schema

LOG.debug("Metadata backup data version: " + backup.getLayoutVersion());
LOG.debug("Current data version: " + curDataVersion);
if (!curDataVersion.equals(ProtocolVersion.parse(backup.getLayoutVersion()))) {
 throw new IOException(String.format(
  "Cannot restore: backup layout version '%s' does not match Fiji instance version '%s'.",
origin: com.moz.fiji.schema/fiji-schema

return new ProtocolVersion(verString, proto, major, minor, rev);
origin: com.moz.fiji.schema/fiji-schema-cassandra

final ProtocolVersion layoutVersion = ProtocolVersion.parse(layout.getVersion());
final ProtocolVersion systemVersion = getSystemTable().getDataVersion();
if ((layoutVersion.compareTo(Versions.LAYOUT_VALIDATION_VERSION) >= 0)
  && (systemVersion.compareTo(Versions.MIN_SYS_VER_FOR_LAYOUT_VALIDATION) < 0)) {
 throw new InvalidLayoutException(
   String.format("Layout version: %s not supported by system version: %s",
origin: com.moz.fiji.schema/fiji-schema-cassandra

/** {@inheritDoc} */
@Override
public synchronized void setDataVersion(ProtocolVersion version) throws IOException {
 final State state = mState.get();
 Preconditions.checkState(state == State.OPEN,
   "Cannot set data version in SystemTable instance in state %s.", state);
 putValue(KEY_DATA_VERSION, Bytes.toBytes(version.toString()));
}
origin: com.moz.fiji.schema/fiji-schema

final ProtocolVersion layoutVersion = ProtocolVersion.parse(tableLayoutDesc.getVersion());
if (Versions.LAYOUT_VALIDATION_VERSION.compareTo(layoutVersion) > 0) {
 throw new InvalidLayoutException("Schema validation is available from "
   + Versions.LAYOUT_VALIDATION_VERSION + " and up; this layout is " + layoutVersion);
origin: com.moz.fiji.schema/fiji-schema

/** {@inheritDoc} */
@Override
public boolean isSecurityEnabled() throws IOException {
 return mSystemTable.getSecurityVersion().compareTo(Versions.MIN_SECURITY_VERSION) >= 0;
}
origin: com.moz.fiji.schema/fiji-schema

/** {@inheritDoc} */
@Override
public synchronized ProtocolVersion getSecurityVersion() throws IOException {
 final State state = mState.get();
 Preconditions.checkState(state == State.OPEN,
   "Cannot get security version from SystemTable instance in state %s.", state);
 byte[] result = getValue(SECURITY_PROTOCOL_VERSION);
 return result == null
   ? Versions.UNINSTALLED_SECURITY_VERSION
   : ProtocolVersion.parse(Bytes.toString(result));
}
origin: com.moz.fiji.schema/fiji-schema

/** {@inheritDoc} */
@Override
public synchronized void setSecurityVersion(ProtocolVersion version) throws IOException {
 Preconditions.checkNotNull(version);
 final State state = mState.get();
 Preconditions.checkState(state == State.OPEN,
   "Cannot set security version in SystemTable instance in state %s.", state);
 Fiji.Factory.open(mURI).getSecurityManager().checkCurrentGrantAccess();
 putValue(SECURITY_PROTOCOL_VERSION, Bytes.toBytes(version.toString()));
}
origin: com.moz.fiji.schema/fiji-schema

final ProtocolVersion layoutVersion = ProtocolVersion.parse(layout.getDesc().getVersion());
if (layoutVersion.compareTo(Versions.LAYOUT_VALIDATION_VERSION) < 0) {
origin: com.moz.fiji.schema/fiji-schema

/** {@inheritDoc} */
@Override
public void deleteTable(String tableName) throws IOException {
 final State state = mState.get();
 Preconditions.checkState(state == State.OPEN,
   "Cannot delete table in Fiji instance %s in state %s.", this, state);
 if (mSystemVersion.compareTo(Versions.SYSTEM_2_0) < 0) {
  deleteTableSystem_1_0(tableName);
 } else if (mSystemVersion.compareTo(Versions.SYSTEM_2_0) == 0) {
  deleteTableSystem_2_0(tableName);
 } else {
  throw new InternalFijiError(String.format("Unknown System version %s.", mSystemVersion));
 }
}
com.moz.fiji.schema.utilProtocolVersion

Javadoc

Parses version information for a file format or wire protocol and provides comparison / reporting functions.

This class facilitates the parsing of strings of the form "protocol-x.y.z", where protocol is a string representing some namespace or qualifier (i.e., a file format name, like "fiji" in the string "fiji-1.1" representing a table layout JSON file), and x, y and z are integers. protocol, y and z are optional.

You can parse a string into a ProtocolVersion using the static #parsemethod. Its javadoc specifies further what strings constitute valid ProtocolVersions.

Version numbers are compared numerically starting at the major version number and moving to the right; each field is treated as a separate integer, not a decimal value. If minor or revision numbers are omitted, they are treated as zero.

The #compareTo(ProtocolVersion) function treats identical version numbers with different protocol names as different; foo-1.0 and bar-1.0 are not the same version number. ProtocolVersion instances will be sorted first by protocol name (alphabetically), then by version number.

The #compareTo(ProtocolVersion), #hashCode(), and #equals(Object) methods will regard versions omitting trailing .0's as equal. For example, foo-1, foo-1.0, and foo-1.0.0 are all equal. The #toString() method will return the exact string that was parsed; so equal objects may have unequal toString() representations. Use #toCanonicalString() to get the same string representation out of each.

ProtocolVersion instances are immutable.

Most used methods

  • compareTo
  • parse
    Static factory method that creates new ProtocolVersion instances.This method parses its argument as
  • getProtocolName
    Returns the protocol name associated with this version string. If the entire version string is dataf
  • toString
    Returns the string representation of this ProtocolVersion that was initially parsed to create this P
  • <init>
    Primary constructor. Hidden; use #parse. Initializes the main fields. These are boxed values to allo
  • checkEquality
    Returns true if both are null, or both are non-null and thing1.equals(thing2).
  • equals
  • getMajorVersion
    Returns the major version (first digit) in this version. If the entire version string is datafmt-1.2
  • getMinorVersion
    Returns the minor version (second digit) in this version. If the entire version string is datafmt-1.
  • getRevision
    Returns the revision version (third digit) in this version. If the entire version string is datafmt-
  • toCanonicalString
    Returns a string representation of this ProtocolVersion that includes any optional trailing version
  • toCanonicalString

Popular in Java

  • Creating JSON documents from java classes using gson
  • getContentResolver (Context)
  • getExternalFilesDir (Context)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • FileInputStream (java.io)
    An input stream that reads bytes from a file. File file = ...finally if (in != null) in.clos
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top 12 Jupyter Notebook extensions
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