Package voldemort.serialization.json

Examples of voldemort.serialization.json.JsonReader


            File tempDir = TestUtils.createTempDir(workingDir);

            cluster = ServerTestUtils.getLocalCluster(1);
            nodeId = 0;

            JsonStoreBuilder builder = new JsonStoreBuilder(new JsonReader(r),
                                                            cluster,
                                                            storeDef,
                                                            new ConsistentRoutingStrategy(cluster,
                                                                                          1),
                                                            output,
View Full Code Here


                        Schema keySchema = Schema.parse(keySerializerDef.getCurrentSchemaInfo());
                        JsonDecoder decoder = new JsonDecoder(keySchema, keyString);
                        GenericDatumReader<Object> datumReader = new GenericDatumReader<Object>(keySchema);
                        keyObject = datumReader.read(null, decoder);
                    } else if(keySerializerName.equals(DefaultSerializerFactory.JSON_SERIALIZER_TYPE_NAME)) {
                        JsonReader jsonReader = new JsonReader(new StringReader(keyString));
                        keyObject = jsonReader.read();
                    } else {
                        keyObject = keyString;
                    }

                    key = new ByteArray(keySerializer.toBytes(keyObject));
View Full Code Here

                                 String argStr,
                                 MutableInt parsePos) {
        Object obj = null;
        try {
            // TODO everything is read as json string now..
            JsonReader jsonReader = new JsonReader(new StringReader(argStr));
            obj = jsonReader.read();
            // mark how much of the original string, we blew through to
            // extract the avrostring.
            parsePos.setValue(jsonReader.getCurrentLineOffset() - 1);

            if(StoreDefinitionUtils.isAvroSchema(serializerDef.getName())) {
                // TODO Need to check all the avro siblings work
                // For avro, we hack and extract avro key/value as a string,
                // before we do the actual parsing with the schema
View Full Code Here

            } else if(line.toLowerCase().startsWith("get")) {
                processGet(line.substring("get".length()));
            } else if(line.toLowerCase().startsWith("delete")) {
                processDelete(line.substring("delete".length()));
            } else if(line.startsWith("preflist")) {
                JsonReader jsonReader = new JsonReader(new StringReader(line.substring("preflist".length())));
                Object key = tightenNumericTypes(jsonReader.read());
                printNodeList(client.getResponsibleNodes(key), factory.getFailureDetector());
            } else if(line.toLowerCase().startsWith("fetchkeys")) {
                String[] args = line.substring("fetchkeys".length() + 1).split("\\s+");
                int remoteNodeId = Integer.valueOf(args[0]);
                String storeName = args[1];
View Full Code Here

    public static void main(String[] args) throws Exception {
        if(args.length != 1)
            Utils.croak("USAGE: java ReadJson filename");
        long start = System.currentTimeMillis();
        BufferedReader reader = new BufferedReader(new FileReader(args[0]), 1000000);
        JsonReader jReader = new JsonReader(reader);
        int count;
        for(count = 0; jReader.hasMore(); count++) {
            jReader.read();
            if(count % 1000000 == 0)
                System.out.println(count);
        }
        System.out.println((System.currentTimeMillis() - start) / (double) count + " ms/object");
    }
View Full Code Here

        BufferedWriter writer = new BufferedWriter(new FileWriter(dataFile));
        for(Map.Entry<String, String> entry: data.entrySet())
            writer.write("\"" + entry.getKey() + "\"\t\"" + entry.getValue() + "\"\n");
        writer.close();
        BufferedReader reader = new BufferedReader(new FileReader(dataFile));
        return new JsonReader(reader);
    }
View Full Code Here

                                                           SerializerDefinition valueSerDef,
                                                           ReadOnlyStorageFormat type)
            throws Exception {
        // create some test data
        Map<String, String> data = createTestData(testSize);
        JsonReader reader = makeTestDataReader(data, baseDir);

        // set up definitions for cluster and store
        List<Node> nodes = new ArrayList<Node>();
        for(int i = 0; i < numNodes; i++) {
            nodes.add(new Node(i,
View Full Code Here

        this.properties.putAll(prop);
    }

    public ReadOnlyStorageMetadata(String json) {
        this();
        JsonReader reader = new JsonReader(new StringReader(json));
        properties.putAll(reader.readObject());
    }
View Full Code Here

    }

    public ReadOnlyStorageMetadata(File metadataFile) throws IOException {
        this();
        BufferedReader reader = new BufferedReader(new FileReader(metadataFile.getAbsolutePath()));
        JsonReader jsonReader = new JsonReader(reader);
        properties.putAll(jsonReader.readObject());
    }
View Full Code Here

        this.initialCluster = initialCluster;
    }

    public static RebalanceTaskInfo create(String line) {
        try {
            JsonReader reader = new JsonReader(new StringReader(line));
            Map<String, ?> map = reader.readObject();
            return create(map);
        } catch (Exception e) {
            throw new VoldemortException("Failed to create partition info from string: " + line, e);
        }
    }
View Full Code Here

TOP

Related Classes of voldemort.serialization.json.JsonReader

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.