Package voldemort.serialization.json

Examples of voldemort.serialization.json.JsonTypeSerializer


    public Serializer<?> findKeyType(String keyType) throws Exception {
        if(keyType.compareTo(STRING_KEY_TYPE) == 0) {
            return new StringSerializer();
        } else if(keyType.compareTo(JSONINT_KEY_TYPE) == 0) {
            return new JsonTypeSerializer("\"int32\"");
        } else if(keyType.compareTo(JSONSTRING_KEY_TYPE) == 0) {
            return new JsonTypeSerializer("\"string\"");
        } else if(keyType.compareTo(IDENTITY_KEY_TYPE) == 0) {
            return new IdentitySerializer();
        }
        throw new Exception("Can't determine for keyType = " + keyType);
    }
View Full Code Here


            if(serializerDef.hasVersion()) {
                Map<Integer, JsonTypeDefinition> versions = new HashMap<Integer, JsonTypeDefinition>();
                for(Map.Entry<Integer, String> entry: serializerDef.getAllSchemaInfoVersions()
                                                                   .entrySet())
                    versions.put(entry.getKey(), JsonTypeDefinition.fromJson(entry.getValue()));
                return new JsonTypeSerializer(versions);
            } else {
                return new JsonTypeSerializer(JsonTypeDefinition.fromJson(serializerDef.getCurrentSchemaInfo()));
            }
        } else if(name.equals(PROTO_BUF_TYPE_NAME)) {
            return new ProtoBufSerializer<Message>(serializerDef.getCurrentSchemaInfo());
        } else if(name.equals(THRIFT_TYPE_NAME)) {
            return new ThriftSerializer<TBase<?, ?>>(serializerDef.getCurrentSchemaInfo());
View Full Code Here

            {
                throw new Exception(String.format("Cannot have a 0 length schema. keySchema[%s], valueSchema[%s]", keySchema, valueSchema));
            }

            return new JsonObjectRecordReader(
                    new JsonTypeSerializer(keySchema.toString()),
                    new JsonTypeSerializer(valueSchema.toString()),
                    baseInputFormat.createRecordReader(split, context)
            );
        }
        catch (Exception e)
        {
View Full Code Here

                        context,
                        meta
                );
        /* end cheddar's stealing of jay's code */

        final JsonTypeSerializer keySerializer = new JsonTypeSerializer(keySchema);
        final JsonTypeSerializer valueSerializer = new JsonTypeSerializer(valueSchema);


        return new RecordWriter<Object, Object>() {

            public void write(Object key, Object value)
                    throws IOException {

                out.append(
                        new BytesWritable(keySerializer.toBytes(key)),
                        new BytesWritable(valueSerializer.toBytes(value))
                );
                context.progress();
            }

            public void close(TaskAttemptContext context) throws IOException {
View Full Code Here

TOP

Related Classes of voldemort.serialization.json.JsonTypeSerializer

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.