Codota Logo
Guid
Code IndexAdd Codota to your IDE (free)

How to use
Guid
in
gobblin.util.guid

Best Java code snippets using gobblin.util.guid.Guid (Showing top 17 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: com.linkedin.gobblin/gobblin-metastore

 @Override
 public String getStateStoreNameFromDatasetUrn(String datasetUrn)
   throws IOException {
  if (!this.sanitizedNameToDatasetURNMap.inverse().containsKey(datasetUrn)) {
   String guid = Guid.fromStrings(datasetUrn).toString();
   this.sanitizedNameToDatasetURNMap.put(guid, datasetUrn);
  }
  return this.sanitizedNameToDatasetURNMap.inverse().get(datasetUrn);
 }
}
origin: com.linkedin.gobblin/gobblin-utility

/**
 * Generate a {@link Guid} for an array of Strings.
 * @param strings array of Strings.
 * @return a single {@link Guid} for the array.
 * @throws IOException
 */
public static Guid fromStrings(String... strings) throws IOException {
 if (strings == null || strings.length == 0) {
  throw new IOException("Attempting to compute guid for an empty array.");
 }
 return new Guid(StringUtils.join(strings).getBytes(Charsets.UTF_8));
}
origin: com.linkedin.gobblin/gobblin-utility

/**
 * @param bytes byte array.
 * @param isSha true if bytes are already a sha.
 */
private Guid(byte[] bytes, boolean isSha) {
 if (isSha) {
  this.sha = bytes;
 } else {
  this.sha = computeGuid(bytes);
 }
}
origin: com.linkedin.gobblin/gobblin-data-management

 private static String computeGuid(State state, CopyEntity file) throws IOException {
  Optional<Guid> stateGuid = CopySource.getWorkUnitGuid(state);
  if (stateGuid.isPresent()) {
   return Guid.combine(file.guid(), stateGuid.get()).toString();
  }
  throw new IOException("State does not contain a guid.");
 }
}
origin: com.linkedin.gobblin/gobblin-data-management

private static void computeAndSetWorkUnitGuid(WorkUnit workUnit)
  throws IOException {
 Guid guid = Guid.fromStrings(workUnit.contains(ConfigurationKeys.CONVERTER_CLASSES_KEY) ? workUnit
   .getProp(ConfigurationKeys.CONVERTER_CLASSES_KEY) : "");
 setWorkUnitGuid(workUnit, guid.append(deserializeCopyEntity(workUnit)));
}
origin: com.linkedin.gobblin/gobblin-data-management

@Override
public Guid guid() throws IOException {
 return Guid.fromStrings(toString());
}
origin: com.linkedin.gobblin/gobblin-data-management

/**
 * Set a unique, replicable guid for this work unit. Used for recovering partially successful work units.
 * @param state {@link State} where guid should be written.
 * @param guid A byte array guid.
 */
public static void setWorkUnitGuid(State state, Guid guid) {
 state.setProp(WORK_UNIT_GUID, guid.toString());
}
origin: com.linkedin.gobblin/gobblin-utility

/**
 * Creates a new {@link Guid} which is a unique, replicable representation of the pair (this, guids). Equivalent to
 * combine(this, guid1, guid2, ...)
 * @param guids an array of {@link Guid}.
 * @return a new {@link Guid}.
 * @throws IOException
 */
public Guid append(Guid... guids) throws IOException {
 if (guids == null || guids.length == 0) {
  return this;
 }
 return combine(ArrayUtils.add(guids, this));
}
origin: com.linkedin.gobblin/gobblin-utility

/**
 * Combine multiple {@link Guid}s into a single {@link Guid}.
 * @throws IOException
 */
public static Guid combine(Guid... guids) throws IOException {
 byte[][] byteArrays = new byte[guids.length][];
 for (int i = 0; i < guids.length; i++) {
  byteArrays[i] = guids[i].sha;
 }
 return fromByteArrays(byteArrays);
}
origin: com.linkedin.gobblin/gobblin-data-management

/**
 * Get guid in this state if available. This is the reverse operation of {@link #setWorkUnitGuid}.
 * @param state State from which guid should be extracted.
 * @return A byte array guid.
 * @throws IOException
 */
public static Optional<Guid> getWorkUnitGuid(State state)
  throws IOException {
 if (state.contains(WORK_UNIT_GUID)) {
  return Optional.of(Guid.deserialize(state.getProp(WORK_UNIT_GUID)));
 }
 return Optional.absent();
}
origin: com.linkedin.gobblin/gobblin-utility

/**
 * Creates a new {@link Guid} which is a unique, replicable representation of the pair (this, objs).
 * @param objs an array of {@link HasGuid}.
 * @return a new {@link Guid}.
 * @throws IOException
 */
public Guid append(HasGuid... objs) throws IOException {
 if (objs == null || objs.length == 0) {
  return this;
 }
 return fromHasGuid(ArrayUtils.add(objs, new SimpleHasGuid(this)));
}
origin: com.linkedin.gobblin/gobblin-data-management

/**
 * Generates a replicable guid to uniquely identify the origin of this {@link CopyableFile}.
 * @return a guid uniquely identifying the origin file.
 */
@Override
public Guid guid() throws IOException {
 StringBuilder uniqueString = new StringBuilder();
 uniqueString.append(getFileStatus().getModificationTime());
 uniqueString.append(getFileStatus().getLen());
 uniqueString.append(getFileStatus().getPath());
 return Guid.fromStrings(uniqueString.toString());
}
origin: com.linkedin.gobblin/gobblin-utility

/**
 * Creates a new {@link Guid} which is a unique, replicable representation of the pair (this, byteArrays).
 * @param byteArrays an array of byte arrays.
 * @return a new {@link Guid}.
 * @throws IOException
 */
public Guid append(byte[]... byteArrays) throws IOException {
 if (byteArrays == null || byteArrays.length == 0) {
  return this;
 }
 return fromByteArrays(ArrayUtils.add(byteArrays, this.sha));
}
origin: com.linkedin.gobblin/gobblin-metastore

 throws IOException {
for (String datasetUrn : datasetUrns) {
 String key = Guid.fromStrings(datasetUrn).toString();
 if (!this.sanitizedNameToDatasetURNMap.containsKey(key)) {
  this.sanitizedNameToDatasetURNMap.put(key, datasetUrn);
origin: com.linkedin.gobblin/gobblin-utility

/**
 * Generate a {@link Guid} for an array of byte arrays.
 * @param byteArrays array of byte arrays.
 * @return a single {@link Guid} for the array.
 * @throws IOException
 */
public static Guid fromByteArrays(byte[]... byteArrays) throws IOException {
 if (byteArrays == null || byteArrays.length == 0) {
  throw new IOException("Attempting to compute guid for an empty array.");
 }
 if (byteArrays.length == 1) {
  return new Guid(byteArrays[0]);
 }
 byte[] tmp = new byte[0];
 for (byte[] arr : byteArrays) {
  tmp = ArrayUtils.addAll(tmp, arr);
 }
 return new Guid(tmp);
}
origin: com.linkedin.gobblin/gobblin-utility

/**
 * Generate a {@link Guid} for an array of {@link HasGuid}.
 * @param objs array of {@link HasGuid}.
 * @return a single {@link Guid} for the array.
 * @throws IOException
 */
public static Guid fromHasGuid(HasGuid... objs) throws IOException {
 byte[][] byteArrays = new byte[objs.length][];
 for (int i = 0; i < objs.length; i++) {
  byteArrays[i] = objs[i].guid().sha;
 }
 return fromByteArrays(byteArrays);
}
origin: com.linkedin.gobblin/gobblin-utility

/**
 * Reverse of {@link #toString}. Deserializes a {@link Guid} from a previously serialized one.
 * @param str Serialized {@link Guid}.
 * @return deserialized {@link Guid}.
 * @throws IOException
 */
public static Guid deserialize(String str) throws IOException {
 if (str.length() != 2 * GUID_LENGTH) {
  throw new IOException("String is not an encoded guid.");
 }
 try {
  return new Guid(Hex.decodeHex(str.toCharArray()), true);
 } catch (DecoderException de) {
  throw new IOException(de);
 }
}
gobblin.util.guidGuid

Javadoc

Class wrapping a byte array representing a guid. A Guid is intended to uniquely identify objects in a replicable way.

Most used methods

  • combine
    Combine multiple Guids into a single Guid.
  • fromStrings
    Generate a Guid for an array of Strings.
  • toString
    Serializes the guid into a hex string. The original Guid can be recovered using #deserialize.
  • <init>
  • append
    Creates a new Guid which is a unique, replicable representation of the pair (this, byteArrays).
  • computeGuid
  • deserialize
    Reverse of #toString. Deserializes a Guid from a previously serialized one.
  • fromByteArrays
    Generate a Guid for an array of byte arrays.
  • fromHasGuid
    Generate a Guid for an array of HasGuid.

Popular in Java

  • Making http requests using okhttp
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • JTextField (javax.swing)
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now