Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.ValueType


    }

    @Test
    public void testUpdateToAnExistingNameFails() throws Exception {
        QName name1 = new QName(namespace, "testUpdateToAnExistingNameFails1");
        ValueType valueType = typeManager.getValueType("STRING");
        FieldType fieldType = typeManager.newFieldType(valueType , name1, Scope.VERSIONED);
        fieldType = typeManager.createFieldType(fieldType);

        QName name2 = new QName(namespace, "testUpdateToAnExistingNameFails2");
        ValueType valueType2 = typeManager.getValueType("STRING");
        FieldType fieldType2 = typeManager.newFieldType(valueType2 , name2, Scope.VERSIONED);
        fieldType2 = typeManager.createFieldType(fieldType2);

        fieldType.setName(name2);
        try {
View Full Code Here


        valueTypeFactories.put(valueTypeName, valueTypeFactory);
    }

    @Override
    public ValueType getValueType(String valueTypeSpec) throws RepositoryException, InterruptedException {
        ValueType valueType;

        int indexOfParams = valueTypeSpec.indexOf("<");
        if (indexOfParams == -1) {
            ValueTypeFactory valueTypeFactory = valueTypeFactories.get(valueTypeSpec);
            if (valueTypeFactory == null) {
View Full Code Here

    private FieldType extractFieldType(SchemaId id, Result result) throws RepositoryException, InterruptedException {
        NavigableMap<byte[], byte[]> nonVersionableColumnFamily = result.getFamilyMap(TypeCf.DATA.bytes);
        QName name;
        name = decodeName(nonVersionableColumnFamily.get(TypeColumn.FIELDTYPE_NAME.bytes));
        ValueType valueType = decodeValueType(nonVersionableColumnFamily.get(TypeColumn.FIELDTYPE_VALUETYPE.bytes));
        Scope scope = Scope.valueOf(Bytes.toString(nonVersionableColumnFamily.get(TypeColumn.FIELDTYPE_SCOPE.bytes)));
        return new FieldTypeImpl(id, valueType, name, scope);
    }
View Full Code Here

        control.reset();
    }

    @Test
    public void testClone() {
        ValueType valueType = control.createMock(ValueType.class);
        control.replay();
        FieldType fieldType = new FieldTypeImpl(new SchemaIdImpl(UUID.randomUUID()), valueType, new QName("DS9", "name"), Scope.VERSIONED);
        assertEquals(fieldType, fieldType.clone());
        assertEquals(fieldType, fieldType.clone());
        control.verify();
View Full Code Here

        }
    }

    @Test
    public void testInvalidReadRequests() throws Exception {
        ValueType stringType = typeManager.getValueType("STRING");
        ValueType blobType = typeManager.getValueType("BLOB");

        FieldType nonBlobField = typeManager.newFieldType(stringType, new QName(namespace, "NonBlobField"),
                Scope.VERSIONED);
        nonBlobField = typeManager.createFieldType(nonBlobField);
View Full Code Here

    private void readBlobs(Record readRecord) throws IOException, RepositoryException, InterruptedException {
        Map<QName, Object> readFields = readRecord.getFields();
        for (Entry<QName, Object> entry : readFields.entrySet()) {
            QName fieldName = entry.getKey();
            FieldType fieldType = testActionContext.fieldTypes.get(fieldName).getFieldType();
            ValueType valueType = fieldType.getValueType();
            if (valueType.getDeepestValueType() instanceof BlobValueType) {
                readBlobs(readRecord, fieldName, entry.getValue(), valueType);
            }
        }
    }
View Full Code Here

                if (oldFieldType != null) {
                    boolean updated = false;

                    // Check non-mutable fields are equal
                    ValueType oldValueType = oldFieldType.getValueType();
                    ValueType newValueType = newFieldType.getValueType();
                    if (!oldValueType.equals(newValueType)) {
                        return ImportResult.conflict("value type", oldValueType, newValueType);
                    }

                    Scope oldScope = oldFieldType.getScope();
View Full Code Here

        // Calculate the name, then add the value
        Map<String, Object> nameContext = new HashMap<String, Object>();
        nameContext.put("namespace", fieldType.getName().getNamespace());
        nameContext.put("name", fieldType.getName().getName());

        ValueType valueType = fieldType.getValueType();
        nameContext.put("type", formatValueTypeName(valueType));
        nameContext.put("baseType", valueType.getBaseName().toLowerCase());

        // If there's no nested value type, revert to the current value type. This is practical for dynamic
        // fields that match on types like "*,LIST<+>".
        ValueType nestedValueType = valueType.getNestedValueType() != null ? valueType.getNestedValueType() : valueType;
        nameContext.put("nestedType", formatValueTypeName(nestedValueType));
        nameContext.put("nestedBaseType", nestedValueType.getBaseName().toLowerCase());

        nameContext.put("deepestNestedBaseType", valueType.getDeepestValueType().getBaseName().toLowerCase());

        boolean isList = valueType.getBaseName().equals("LIST");
        nameContext.put("multiValue", isList);
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.api.ValueType

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.