Tabnine Logo
SchemaMetadata.getName
Code IndexAdd Tabnine to your IDE (free)

How to use
getName
method
in
com.hortonworks.registries.schemaregistry.SchemaMetadata

Best Java code snippets using com.hortonworks.registries.schemaregistry.SchemaMetadata.getName (Showing top 20 results out of 315)

origin: apache/nifi

schemaName = metadata.getName();
origin: hortonworks/registry

private SnapshotSerializer<Object, byte[], SchemaMetadata> getSnapshotSerializer(SchemaMetadata schemaMetadata) {
  Collection<SerDesInfo> serializers = schemaRegistryClient.getSerDes(schemaMetadata.getName());
  if (serializers.isEmpty()) {
    throw new RuntimeException("Serializer for schemaKey:" + schemaMetadata + " must exist");
  }
  SerDesInfo serdesInfo = serializers.iterator().next();
  return schemaRegistryClient.createSerializerInstance(serdesInfo);
}
origin: hortonworks/registry

private SnapshotDeserializer<byte[], Object, Integer> getSnapshotDeserializer(SchemaMetadata schemaMetadata) {
  Collection<SerDesInfo> deserializers = schemaRegistryClient.getSerDes(schemaMetadata.getName());
  if (deserializers.isEmpty()) {
    throw new RuntimeException("Serializer for schemaKey:" + schemaMetadata + " must exist");
  }
  SerDesInfo serdesInfo = deserializers.iterator().next();
  return schemaRegistryClient.createDeserializerInstance(serdesInfo);
}
origin: hortonworks/registry

public SchemaIdVersion addSchemaVersion(SchemaMetadata schemaMetadata,
                    SchemaVersion schemaVersion)
    throws IncompatibleSchemaException, InvalidSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException {
  lockSchemaMetadata(schemaMetadata.getName());
  return schemaVersionLifecycleManager.addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, schemaVersion, x -> registerSchemaMetadata(x));
}
origin: hortonworks/registry

public SchemaIdVersion addSchemaVersion(String schemaBranchName,
                    SchemaMetadata schemaMetadata,
                    SchemaVersion schemaVersion)
    throws IncompatibleSchemaException, InvalidSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException {
  lockSchemaMetadata(schemaMetadata.getName());
  return schemaVersionLifecycleManager.addSchemaVersion(schemaBranchName, schemaMetadata, schemaVersion, x -> registerSchemaMetadata(x));
}
origin: hortonworks/registry

private AggregatedSchemaMetadataInfo buildAggregatedSchemaMetadataInfo(SchemaMetadataInfo schemaMetadataInfo) throws SchemaNotFoundException, SchemaBranchNotFoundException {
  if (schemaMetadataInfo == null) {
    return null;
  }
  List<SerDesInfo> serDesInfos = getSerDesInfos(schemaMetadataInfo.getSchemaMetadata().getName());
  return new AggregatedSchemaMetadataInfo(schemaMetadataInfo.getSchemaMetadata(),
                      schemaMetadataInfo.getId(),
                      schemaMetadataInfo.getTimestamp(),
                      getAggregatedSchemaBranch(schemaMetadataInfo.getSchemaMetadata().getName()),
                      serDesInfos);
}
origin: hortonworks/registry

private SchemaVersionInfo doGetSchemaVersionInfo(SchemaIdVersion schemaIdVersion) throws SchemaNotFoundException {
  if (schemaIdVersion.getSchemaVersionId() != null) {
    LOG.info("Getting schema version from target registry for [{}]", schemaIdVersion.getSchemaVersionId());
    return getEntity(currentSchemaRegistryTargets()
                 .schemaVersionsByIdTarget
                 .path(schemaIdVersion.getSchemaVersionId().toString()),
             SchemaVersionInfo.class);
  } else if (schemaIdVersion.getSchemaMetadataId() != null) {
    SchemaMetadataInfo schemaMetadataInfo = getSchemaMetadataInfo(schemaIdVersion.getSchemaMetadataId());
    SchemaVersionKey schemaVersionKey = new SchemaVersionKey(schemaMetadataInfo.getSchemaMetadata()
                                          .getName(), schemaIdVersion.getVersion());
    LOG.info("Getting schema version from target registry for key [{}]", schemaVersionKey);
    return doGetSchemaVersionInfo(schemaVersionKey);
  }
  throw new IllegalArgumentException("Given argument not valid: " + schemaIdVersion);
}
origin: hortonworks/registry

@Override
public Long addSchemaMetadata(SchemaMetadata schemaMetadata) {
  SchemaMetadataInfo schemaMetadataInfo = schemaMetadataCache.getIfPresent(SchemaMetadataCache.Key.of(schemaMetadata
                                                        .getName()));
  if (schemaMetadataInfo == null) {
    return doRegisterSchemaMetadata(schemaMetadata, currentSchemaRegistryTargets().schemasTarget);
  }
  return schemaMetadataInfo.getId();
}
origin: hortonworks/registry

@Override
public SchemaMetadataInfo updateSchemaMetadata(String schemaName, SchemaMetadata schemaMetadata) {
  if (!schemaName.equals(schemaMetadata.getName())) {
    throw new IllegalArgumentException("schemaName must match the name in schemaMetadata");
  }
  SchemaMetadataStorable givenSchemaMetadataStorable = new SchemaMetadataStorable();
  givenSchemaMetadataStorable.setName(schemaName);
  SchemaMetadataStorable schemaMetadataStorable = storageManager.get(givenSchemaMetadataStorable.getStorableKey());
  if (schemaMetadataStorable != null) {
    schemaMetadataStorable = SchemaMetadataStorable.updateSchemaMetadata(schemaMetadataStorable, schemaMetadata);
    storageManager.update(schemaMetadataStorable);
    return schemaMetadataStorable.toSchemaMetadataInfo();
  } else {
    return null;
  }
}
origin: hortonworks/registry

private SchemaBranch addSchemaBranch(String schemaBranchName, SchemaMetadata schemaMetadata, Long versionId) throws SchemaNotFoundException, SchemaBranchAlreadyExistsException {
  SchemaBranch branch = new SchemaBranch(schemaBranchName, schemaMetadata.getName());
  return schemaRegistryClient.createSchemaBranch(versionId, branch);
}
origin: hortonworks/registry

private Long doRegisterSchemaMetadata(SchemaMetadata schemaMetadata, WebTarget schemasTarget) {
  try {
    return postEntity(schemasTarget, schemaMetadata, Long.class);
  } catch(BadRequestException ex) {
    Response response = ex.getResponse();
    CatalogResponse catalogResponse = SchemaRegistryClient.readCatalogResponse(response.readEntity(String.class));
    if(catalogResponse.getResponseCode() == CatalogResponse.ResponseMessage.ENTITY_CONFLICT.getCode()) {
      return getSchemaMetadataInfo(schemaMetadata.getName()).getId();
    } else {
      throw ex;
    }
  }
}
origin: hortonworks/registry

public Builder(SchemaMetadata schemaMetadata) {
  name = schemaMetadata.getName();
  type = schemaMetadata.getType();
  schemaGroup = schemaMetadata.getSchemaGroup();
  description = schemaMetadata.getDescription();
  compatibility = schemaMetadata.getCompatibility();
  validationLevel = schemaMetadata.getValidationLevel();
  evolve = schemaMetadata.isEvolve();
}
origin: com.hortonworks.registries/schema-registry-common

public Builder(SchemaMetadata schemaMetadata) {
  name = schemaMetadata.getName();
  type = schemaMetadata.getType();
  schemaGroup = schemaMetadata.getSchemaGroup();
  description = schemaMetadata.getDescription();
  compatibility = schemaMetadata.getCompatibility();
  validationLevel = schemaMetadata.getValidationLevel();
  evolve = schemaMetadata.isEvolve();
}
origin: hortonworks/registry

private SchemaVersionInfo retrieveSchemaVersionInfo(SchemaIdVersion key) throws SchemaNotFoundException {
  SchemaVersionInfo schemaVersionInfo = null;
  if (key.getSchemaVersionId() != null) {
    schemaVersionInfo = fetchSchemaVersionInfo(key.getSchemaVersionId());
  } else if (key.getSchemaMetadataId() != null) {
    SchemaMetadataInfo schemaMetadataInfo = schemaMetadataFetcher.getSchemaMetadataInfo(key.getSchemaMetadataId());
    Integer version = key.getVersion();
    schemaVersionInfo = fetchSchemaVersionInfo(schemaMetadataInfo.getSchemaMetadata().getName(), version);
  } else {
    throw new IllegalArgumentException("Invalid SchemaIdVersion: " + key);
  }
  return schemaVersionInfo;
}
origin: hortonworks/registry

@Test
public void getAllBranches() throws IOException, SchemaBranchNotFoundException, InvalidSchemaException, SchemaNotFoundException, IncompatibleSchemaException, SchemaBranchAlreadyExistsException {
  SchemaMetadata schemaMetadata = addSchemaMetadata(testNameRule.getMethodName(), SchemaCompatibility.NONE);
  SchemaIdVersion masterSchemaIdVersion1 = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device.avsc");
  SchemaBranch schemaBranch1 = addSchemaBranch("BRANCH1", schemaMetadata, masterSchemaIdVersion1.getSchemaVersionId());
  SchemaIdVersion masterSchemaIdVersion2 = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device-incompat.avsc");
  SchemaBranch schemaBranch2 = addSchemaBranch("BRANCH2", schemaMetadata, masterSchemaIdVersion2.getSchemaVersionId());
  Set<String> actualSchemaBranches = schemaRegistryClient.getSchemaBranches(schemaMetadata.getName()).stream().map(branch -> branch.getName()).collect(Collectors.toSet());
  Set<String> expectedSchemaBranches = new HashSet<>(Lists.newArrayList("MASTER", schemaBranch1.getName(), schemaBranch2.getName()));
  Assert.assertTrue(SetUtils.isEqualSet(actualSchemaBranches, expectedSchemaBranches));
}
origin: hortonworks/registry

@Test
public void deleteSchemaBranch() throws SchemaNotFoundException, SchemaBranchAlreadyExistsException, IOException, InvalidSchemaException, IncompatibleSchemaException, SchemaBranchNotFoundException, InvalidSchemaBranchDeletionException {
  SchemaMetadata schemaMetadata = addSchemaMetadata(testNameRule.getMethodName(), SchemaCompatibility.NONE);
  SchemaIdVersion masterSchemaIdVersion1 = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device.avsc");
  SchemaBranch schemaBranch1 = addSchemaBranch("BRANCH1", schemaMetadata, masterSchemaIdVersion1.getSchemaVersionId());
  addSchemaVersion(schemaBranch1.getName(), schemaMetadata, "/device-incompat.avsc");
  addSchemaVersion(schemaBranch1.getName(), schemaMetadata, "/device-compat.avsc");
  Assert.assertTrue(schemaRegistryClient.getSchemaBranches(schemaMetadata.getName()).size() == 2);
  schemaRegistryClient.deleteSchemaBranch(schemaBranch1.getId());
  Collection<SchemaVersionInfo> masterSchemaVersionInfos = schemaRegistryClient.getAllVersions(schemaMetadata.getName());
  Assert.assertTrue(masterSchemaVersionInfos.size() == 1);
  Assert.assertTrue(schemaRegistryClient.getSchemaBranches(schemaMetadata.getName()).size() == 1);
}
origin: hortonworks/registry

@Test
public void testSerializerOps() throws Exception {
  String fileId = uploadFile();
  SchemaMetadata schemaMetadata = createSchemaMetadata(TEST_NAME_RULE.getMethodName(), SchemaCompatibility.BOTH);
  SCHEMA_REGISTRY_CLIENT.addSchemaVersion(schemaMetadata, new SchemaVersion(AvroSchemaRegistryClientUtil.getSchema("/device.avsc"), "Initial version of the schema"));
  SerDesPair serDesPair = createSerDesInfo(fileId);
  Long serDesId = SCHEMA_REGISTRY_CLIENT.addSerDes(serDesPair);
  Assert.assertNotNull("Returned serDesId can not be null", serDesId);
  String schemaName = schemaMetadata.getName();
  SCHEMA_REGISTRY_CLIENT.mapSchemaWithSerDes(schemaName, serDesId);
  Collection<SerDesInfo> serializers = SCHEMA_REGISTRY_CLIENT.getSerDes(schemaName);
  Assert.assertTrue(serializers.stream()
                 .map(x -> x.getSerDesPair())
                 .collect(Collectors.toList())
                 .contains(serDesPair));
}
origin: hortonworks/registry

public static SchemaMetadataStorable updateSchemaMetadata(SchemaMetadataStorable schemaMetadataStorable, SchemaMetadata schemaMetadata) {
  schemaMetadataStorable.setType(schemaMetadata.getType());
  schemaMetadataStorable.setSchemaGroup(schemaMetadata.getSchemaGroup());
  schemaMetadataStorable.setName(schemaMetadata.getName());
  schemaMetadataStorable.setDescription(schemaMetadata.getDescription());
  schemaMetadataStorable.setCompatibility(schemaMetadata.getCompatibility());
  schemaMetadataStorable.setValidationLevel(schemaMetadata.getValidationLevel());
  schemaMetadataStorable.setEvolve(schemaMetadata.isEvolve());
  return schemaMetadataStorable;
}
origin: hortonworks/registry

private SchemaVersionKey addAndDeleteSchemaVersion(String schemaName) throws InvalidSchemaException, IncompatibleSchemaException, SchemaNotFoundException, IOException, SchemaBranchNotFoundException, SchemaLifecycleException {
  SchemaMetadata schemaMetadata = createSchemaMetadata(schemaName, SchemaCompatibility.BOTH);
  SchemaIdVersion schemaIdVersion = SCHEMA_REGISTRY_CLIENT.addSchemaVersion(schemaMetadata, new SchemaVersion(AvroSchemaRegistryClientUtil
                                                            .getSchema("/device.avsc"), "Initial version of the schema"));
  SchemaVersionKey schemaVersionKey = new SchemaVersionKey(schemaMetadata.getName(), schemaIdVersion.getVersion());
  SCHEMA_REGISTRY_CLIENT.deleteSchemaVersion(schemaVersionKey);
  return schemaVersionKey;
}
origin: hortonworks/registry

@Test (expected = InvalidSchemaException.class)
public void addInvalidSchemaToBranch() throws IOException, SchemaBranchNotFoundException, InvalidSchemaException, SchemaNotFoundException, IncompatibleSchemaException, SchemaBranchAlreadyExistsException {
  SchemaMetadata schemaMetadata = addSchemaMetadata(testNameRule.getMethodName(), SchemaCompatibility.BACKWARD);
  SchemaIdVersion masterSchemaIdVersion = addSchemaVersion(SchemaBranch.MASTER_BRANCH, schemaMetadata, "/device.avsc");
  SchemaBranch schemaBranch1 = addSchemaBranch("BRANCH1", schemaMetadata, masterSchemaIdVersion.getSchemaVersionId());
  String schema2 = "--- invalid schema ---";
  schemaRegistryClient.addSchemaVersion(schemaBranch1.getName(), schemaMetadata.getName(), new SchemaVersion(schema2, "second version"));
}
com.hortonworks.registries.schemaregistrySchemaMetadatagetName

Popular methods of SchemaMetadata

  • getDescription
  • getType
  • getValidationLevel
  • getCompatibility
  • getSchemaGroup
  • isEvolve
  • <init>
  • equals
  • hashCode
  • toString
  • trim
  • trim

Popular in Java

  • Reactive rest calls using spring rest template
  • getSupportFragmentManager (FragmentActivity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getContentResolver (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • BoxLayout (javax.swing)
  • JFileChooser (javax.swing)
  • Best IntelliJ plugins
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