Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.BlobNotFoundException


        return registry.get(decodedKey.getV1());
    }

    private Pair<String, byte[]> decodeKey(Blob blob) throws BlobNotFoundException, BlobException {
        if (blob.getValue() == null) {
            throw new BlobNotFoundException(blob, "Blob has no reference to a blob in the blobstore", null);
        }
        Pair<String, byte[]> decodedKey;
        try {
            decodedKey = decode(blob.getValue());
        } catch (Exception e) {
View Full Code Here


    private Blob getBlobFromRecord(Record record, QName fieldName, FieldType fieldType, int... indexes)
            throws BlobNotFoundException {
        Object value = record.getField(fieldName);
        ValueType valueType = fieldType.getValueType();
        if (!valueType.getDeepestValueType().getBaseName().equals("BLOB")) {
            throw new BlobNotFoundException("Blob could not be retrieved from '" + record.getId() + "', '" +
                    fieldName + "' at index: " + Ints.join("/", indexes));
        }

        if (indexes == null) {
            indexes = new int[0];
        }

        for (int i = 0; i < indexes.length; i++) {
            int index = indexes[i];
            try {
                if (valueType.getBaseName().equals("LIST")) {
                    value = ((List<Object>) value).get(index);
                    valueType = valueType.getNestedValueType();
                    continue;
                }
                if (valueType.getBaseName().equals("PATH")) {
                    value = ((HierarchyPath)value).getElements()[index];
                    valueType = valueType.getNestedValueType();
                    continue;
                }
                throw new BlobNotFoundException("Invalid index to retrieve Blob from '" + record.getId() +
                        "', '" + fieldName + "' : " + Ints.join("/", Arrays.copyOf(indexes, i + 1)));
            } catch (IndexOutOfBoundsException e) {
                throw new BlobNotFoundException("Invalid index to retrieve Blob from '" + record.getId() +
                        "', '" + fieldName + "' : " + Ints.join("/", Arrays.copyOf(indexes, i + 1)), e);
            }
        }
        if (!valueType.getBaseName().equals("BLOB")) {
            throw new BlobNotFoundException("Blob could not be retrieved from '" + record.getId() +
                    "', '" + fieldName + "' at index: " + Ints.join("/", indexes));
        }
        return (Blob)value;
    }
View Full Code Here

TOP

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

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.