Examples of SchemaId


Examples of com.linkedin.databus2.schemas.SchemaId

          curState.switchToStartStreamEventWindow(startScn);
          success = doStartStreamEventWindow(curState);

          if (success && (eventSrcId.longValue() >= 0))
          {
            success = doCheckStartSource(curState, eventSrcId,new SchemaId(nextEvent.schemaId()));
          }
        }
        else
        {
          if (null != curState.getCurrentSource() &&
              !eventSrcId.equals(curState.getCurrentSource().getId()))
          {
            curState.switchToEndStreamSource();
            success = doEndStreamSource(curState);
          }

          if (success)
          {
            //Check if schemas of the source exist.
            //Also check if the exact schema id present in event exists in the client. This is worthwhile if there's a
            //guarantee that the entire window is written with the same schemaId, which is the case if the relay does not use a new schema
            //mid-window
            success = doCheckStartSource(curState, eventSrcId,new SchemaId(nextEvent.schemaId()));
          }

        }

        if (success)
View Full Code Here

Examples of com.linkedin.databus2.schemas.SchemaId

    // create a metadata schema set that correctly corresponds to the metadata
    VersionedSchemaSet metadataSchemaSet = new VersionedSchemaSet();
    metadataSchemaSet.add(SchemaRegistryService.DEFAULT_METADATA_SCHEMA_SOURCE,
                          metadataPart.getSchemaVersion(),              // METADATA_SCHEMA_VERSION
                          new SchemaId(metadataPart.getSchemaDigest()), // METADATA_SCHEMA_CHECKSUM
                          CORRECT_METADATA_SCHEMA,
                          true)// preserve original string

    // now create the decoder and use it to extract and decode the event's metadata
    DbusEventAvroDecoder eventDecoder = createDecoder(metadataSchemaSet);
View Full Code Here

Examples of com.linkedin.databus2.schemas.SchemaId

    // create a metadata schema set with a schema that claims to match the event's
    // metadata but doesn't actually
    VersionedSchemaSet metadataSchemaSet = new VersionedSchemaSet();
    metadataSchemaSet.add(SchemaRegistryService.DEFAULT_METADATA_SCHEMA_SOURCE,
                          metadataPart.getSchemaVersion(),              // METADATA_SCHEMA_VERSION
                          new SchemaId(metadataPart.getSchemaDigest()), // METADATA_SCHEMA_CHECKSUM
                          INCORRECT_METADATA_SCHEMA,
                          true)// preserve original string

    // now create the decoder and attempt to use it to extract and decode the event's metadata
    DbusEventAvroDecoder eventDecoder = createDecoder(metadataSchemaSet);
View Full Code Here

Examples of com.linkedin.databus2.schemas.SchemaId

    // create a metadata schema set, just because we like to
    VersionedSchemaSet metadataSchemaSet = new VersionedSchemaSet();
    metadataSchemaSet.add(SchemaRegistryService.DEFAULT_METADATA_SCHEMA_SOURCE,
                          METADATA_SCHEMA_VERSION,
                          new SchemaId(METADATA_SCHEMA_CHECKSUM),
                          CORRECT_METADATA_SCHEMA,
                          true)// preserve original string

    // now create the decoder and attempt to use it to extract and decode the event's metadata
    DbusEventAvroDecoder eventDecoder = createDecoder(metadataSchemaSet);
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

        Map.Entry<Long, byte[]> idCeilingEntry = null;
        NavigableMap<Long, byte[]> recordTypeIdMap = allColumnsAllVersionsMap.get(recordTypeIdColumnName);
        if (recordTypeIdMap != null) {
            idCeilingEntry = recordTypeIdMap.ceilingEntry(version);
        }
        SchemaId recordTypeId;
        if (idCeilingEntry == null) {
            return null; // No record type was found
        }
        recordTypeId = new SchemaIdImpl(idCeilingEntry.getValue());
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

        String valueTypeString = getString(node, "valueType");
        ValueType valueType = typeManager.getValueType(ValueTypeNSConverter.fromJson(valueTypeString, namespaces));
        FieldType fieldType = typeManager.newFieldType(valueType, name, scope);

        String idString = getString(node, "id", null);
        SchemaId id = null;
        if (idString != null) {
            id = new SchemaIdImpl(idString);
        }
        fieldType.setId(id);
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

     * Update the cache to contain the new recordType
     */
    public void update(RecordType recordType) {
        // Clone the RecordType to avoid changes to it while it is in the cache
        RecordType rtToCache = recordType.clone();
        SchemaId id = rtToCache.getId();
        String bucketId = AbstractSchemaCache.encodeHex(id.getBytes());
        // First increment the number of buckets that are being updated
        incCount();
        // Get a lock on the bucket to be updated
        synchronized (getBucketMonitor(bucketId)) {
            Map<SchemaId, Map<Long, RecordType>> bucket = buckets.get(bucketId);
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

        byte[] json = event.toJsonBytes();
        event = new RecordEvent(json, idGenerator);

        assertNull(event.getIndexRecordFilterData());

        SchemaId oldRtId = idGenerator.getSchemaId(UUID.randomUUID());
        SchemaId newRtId = idGenerator.getSchemaId(UUID.randomUUID());

        RecordEvent.IndexRecordFilterData idxSel = new RecordEvent.IndexRecordFilterData();
        event.setIndexRecordFilterData(idxSel);
        idxSel.setOldRecordType(oldRtId);
        idxSel.setNewRecordType(newRtId);

        json = event.toJsonBytes();
        event = new RecordEvent(json, idGenerator);

        assertNotNull(event.getIndexRecordFilterData());
        assertEquals(oldRtId, event.getIndexRecordFilterData().getOldRecordType());
        assertEquals(newRtId, event.getIndexRecordFilterData().getNewRecordType());
        assertNull(event.getIndexRecordFilterData().getFieldChanges());

        SchemaId field1Id = idGenerator.getSchemaId(UUID.randomUUID());
        SchemaId field2Id = idGenerator.getSchemaId(UUID.randomUUID());
        SchemaId field3Id = idGenerator.getSchemaId(UUID.randomUUID());
        SchemaId field4Id = idGenerator.getSchemaId(UUID.randomUUID());

        event = new RecordEvent();
        idxSel = new RecordEvent.IndexRecordFilterData();
        event.setIndexRecordFilterData(idxSel);
        idxSel.addChangedField(field1Id, null, null);
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

    }

    @Test
    public void testIndexRecordFilterData_JsonRoundtrip() {
        IndexRecordFilterData recordFilterData = new IndexRecordFilterData();
        SchemaId newTypeSchemaId = new SchemaIdImpl("newtype".getBytes());
        SchemaId oldTypeSchemaId = new SchemaIdImpl("oldtype".getBytes());
        SchemaId changedFieldId = new SchemaIdImpl("changedfield".getBytes());
        byte[] oldFieldValue = new byte[] { 1 };
        byte[] newFieldValue = new byte[] { 2 };

        recordFilterData.setNewRecordExists(true);
        recordFilterData.setOldRecordExists(true);
View Full Code Here

Examples of org.lilyproject.repository.api.SchemaId

                    recordType.addFieldTypeEntry(new SchemaIdImpl(fieldIdString), mandatory);
                } else if (fieldName != null) {
                    QName fieldQName = QNameConverter.fromJson(fieldName, namespaces);

                    try {
                        SchemaId fieldId = typeManager.getFieldTypeByName(fieldQName).getId();
                        recordType.addFieldTypeEntry(fieldId, mandatory);
                    } catch (RepositoryException e) {
                        throw new JsonFormatException("Record type " + name + ": error looking up field type with name: " +
                                fieldQName, e);
                    }
                } else {
                    throw new JsonFormatException("Record type " + name + ": field entry should specify an id or name");
                }
            }
        }

        if (node.get("supertypes") != null && node.get("mixins") != null) {
            throw new JsonFormatException("Only one of 'supertypes' or 'mixins' can be specified " +
                    "(they are synonyms, and mixins is deprecated).");
        }

        if (node.get("supertypes") != null) {
            ArrayNode supertypes = getArray(node, "supertypes", null);
            for (int i = 0; i < supertypes.size(); i++) {
                JsonNode supertype = supertypes.get(i);

                String rtIdString = getString(supertype, "id", null);
                String rtName = getString(supertype, "name", null);
                Long rtVersion = getLong(supertype, "version", null);

                if (rtIdString != null) {
                    recordType.addSupertype(new SchemaIdImpl(rtIdString), rtVersion);
                } else if (rtName != null) {
                    QName rtQName = QNameConverter.fromJson(rtName, namespaces);

                    try {
                        SchemaId rtId = typeManager.getRecordTypeByName(rtQName, null).getId();
                        recordType.addSupertype(rtId, rtVersion);
                    } catch (RepositoryException e) {
                        throw new JsonFormatException("Record type " + name +
                                ": error looking up supertype record type with name: " + rtQName, e);
                    }
                } else {
                    throw new JsonFormatException("Record type " + name + ": supertype should specify an id or name");
                }
            }
        } else if (node.get("mixins") != null) {
            // This was deprecated in 2.2, and can be removed in 2.4
            LogFactory.getLog("lily.deprecation").warn("The use of 'mixins' is deprecated, please use supertypes instead");
            ArrayNode mixins = getArray(node, "mixins", null);
            for (int i = 0; i < mixins.size(); i++) {
                JsonNode mixin = mixins.get(i);

                String rtIdString = getString(mixin, "id", null);
                String rtName = getString(mixin, "name", null);
                Long rtVersion = getLong(mixin, "version", null);

                if (rtIdString != null) {
                    recordType.addMixin(new SchemaIdImpl(rtIdString), rtVersion);
                } else if (rtName != null) {
                    QName rtQName = QNameConverter.fromJson(rtName, namespaces);

                    try {
                        SchemaId rtId = typeManager.getRecordTypeByName(rtQName, null).getId();
                        recordType.addMixin(rtId, rtVersion);
                    } catch (RepositoryException e) {
                        throw new JsonFormatException("Record type " + name + ": error looking up mixin record type with name: " +
                                rtQName, e);
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.