Package org.lilyproject.repository.impl.id

Examples of org.lilyproject.repository.impl.id.SchemaIdImpl


        assertEquals(typeManager.getFieldTypeById(fieldType.getId()), typeManager.getFieldTypeByName(name));
    }

    @Test
    public void testCreateIgnoresGivenId() throws Exception {
        SchemaId id = new SchemaIdImpl(UUID.randomUUID());
        ValueType valueType = typeManager.getValueType("STRING");
        FieldType fieldType = typeManager.newFieldType(id, valueType , new QName(namespace, "aName"), Scope.VERSIONED_MUTABLE);
        fieldType = typeManager.createFieldType(fieldType);
        assertFalse(fieldType.getId().equals(id));
    }
View Full Code Here


        assertEquals(typeManager.getValueType("LIST<STRING>"), fieldType.getValueType());

        try {
            typeManager
                    .fieldTypeBuilder()
                    .id(new SchemaIdImpl(UUID.randomUUID()))
                    .name(NS, "field3")
                    .update();
            fail("expected exception");
        } catch (FieldTypeNotFoundException e) {
            // expected
View Full Code Here

        Record record = new RecordImpl();
        dataInput.readByte(); // Ignore, there is currently only one encoding : 1
        int length = dataInput.readVInt();
        byte[] recordTypeId = dataInput.readBytes(length);
        Long recordTypeVersion = dataInput.readLong();
        RecordType recordType = typeManager.getRecordTypeById(new SchemaIdImpl(recordTypeId), recordTypeVersion);
        record.setRecordType(recordType.getName(), recordTypeVersion);

        Map<SchemaId, QName> idToQNameMapping = new HashMap<SchemaId, QName>();
        List<FieldType> fieldTypes = getSortedFieldTypes(recordType);
        for (FieldType fieldType : fieldTypes) {
View Full Code Here

        for (Map.Entry<byte[], NavigableMap<Long, byte[]>> column : cf.entrySet()) {
            byte[] columnKey = column.getKey();

            if (columnKey[0] == RecordColumn.DATA_PREFIX) {
                SchemaId fieldId = new SchemaIdImpl(Arrays.copyOfRange(columnKey, 1, columnKey.length));

                for (Map.Entry<Long, byte[]> version : column.getValue().entrySet()) {
                    long versionNr = version.getKey();
                    byte[] value = version.getValue();
View Full Code Here

            this.typeManager = typeManager;
        }

        @Override
        public RecordTypeInfo decode(byte[] bytes) {
            SchemaId id = new SchemaIdImpl(bytes);
            QName name;
            try {
                name = typeManager.getRecordTypeById(id, null).getName();
            } catch (Exception e) {
                name = new QName("", "Failure retrieving record type name");
View Full Code Here

            NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> allVersionsMap = result.getMap();
            NavigableMap<byte[], NavigableMap<Long, byte[]>> fieldTypeEntriesVersionsMap = allVersionsMap
                    .get(TypeCf.FIELDTYPE_ENTRY.bytes);
            if (fieldTypeEntriesVersionsMap != null) {
                for (Entry<byte[], NavigableMap<Long, byte[]>> entry : fieldTypeEntriesVersionsMap.entrySet()) {
                    SchemaId fieldTypeId = new SchemaIdImpl(entry.getKey());
                    Entry<Long, byte[]> ceilingEntry = entry.getValue().ceilingEntry(version);
                    if (ceilingEntry != null) {
                        FieldTypeEntry fieldTypeEntry = decodeFieldTypeEntry(ceilingEntry.getValue(), fieldTypeId);
                        if (fieldTypeEntry != null) {
                            recordType.addFieldTypeEntry(fieldTypeEntry);
                        }
                    }
                }
            }
        } else {
            NavigableMap<byte[], byte[]> versionableMap = result.getFamilyMap(TypeCf.FIELDTYPE_ENTRY.bytes);
            if (versionableMap != null) {
                for (Entry<byte[], byte[]> entry : versionableMap.entrySet()) {
                    SchemaId fieldTypeId = new SchemaIdImpl(entry.getKey());
                    FieldTypeEntry fieldTypeEntry = decodeFieldTypeEntry(entry.getValue(), fieldTypeId);
                    if (fieldTypeEntry != null) {
                        recordType.addFieldTypeEntry(fieldTypeEntry);
                    }
                }
View Full Code Here

        if (version != null) {
            NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> allVersionsMap = result.getMap();
            NavigableMap<byte[], NavigableMap<Long, byte[]>> supertypeVersionsMap = allVersionsMap.get(TypeCf.SUPERTYPE.bytes);
            if (supertypeVersionsMap != null) {
                for (Entry<byte[], NavigableMap<Long, byte[]>> entry : supertypeVersionsMap.entrySet()) {
                    SchemaId supertypeId = new SchemaIdImpl(entry.getKey());
                    Entry<Long, byte[]> ceilingEntry = entry.getValue().ceilingEntry(version);
                    if (ceilingEntry != null) {
                        if (!isDeletedField(ceilingEntry.getValue())) {
                            recordType.addSupertype(supertypeId, Bytes.toLong(ceilingEntry.getValue()));
                        }
                    }
                }
            }
        } else {
            NavigableMap<byte[], byte[]> supertypeMap = result.getFamilyMap(TypeCf.SUPERTYPE.bytes);
            if (supertypeMap != null) {
                for (Entry<byte[], byte[]> entry : supertypeMap.entrySet()) {
                    if (!isDeletedField(entry.getValue())) {
                        recordType.addSupertype(new SchemaIdImpl(entry.getKey()), Bytes.toLong(entry.getValue()));
                    }
                }
            }
        }
    }
View Full Code Here

            scanner = getTypeTable().getScanner(scan);
        } catch (IOException e) {
            throw new TypeException("Exception occurred while retrieving field types without cache ", e);
        }
        for (Result result : scanner) {
            fieldTypes.add(extractFieldType(new SchemaIdImpl(result.getRow()), result));
        }
        Closer.close(scanner);

        return fieldTypes;
    }
View Full Code Here

            scanner = getTypeTable().getScanner(scan);
        } catch (IOException e) {
            throw new TypeException("Exception occurred while retrieving record types without cache ", e);
        }
        for (Result result : scanner) {
            recordTypes.addAll(extractRecordType(new SchemaIdImpl(result.getRow()), null, result));
        }
        Closer.close(scanner);

        return recordTypes;
    }
View Full Code Here

        Closer.close(scanner);

        // Now extract the record and field types from the results
        for (Result scanResult : results) {
            if (scanResult.getValue(TypeCf.DATA.bytes, TypeColumn.FIELDTYPE_NAME.bytes) != null) {
                fieldTypes.add(extractFieldType(new SchemaIdImpl(scanResult.getRow()), scanResult));
            } else if (scanResult.getValue(TypeCf.DATA.bytes, TypeColumn.RECORDTYPE_NAME.bytes) != null) {
                recordTypes.addAll(extractRecordType(new SchemaIdImpl(scanResult.getRow()), null, scanResult));
            }
        }
        return new Pair<List<FieldType>, List<RecordType>>(fieldTypes, recordTypes);
    }
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.impl.id.SchemaIdImpl

Copyright © 2018 www.massapicom. 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.