Package org.lilyproject.tools.import_.cli.JsonImport

Examples of org.lilyproject.tools.import_.cli.JsonImport.ImportSettings


        // whole of the file, but use the tree API to load individual items (field types, records, ...).
        // This way things should still work fast and within little memory if anyone would use this to
        // load large amounts of records.

        try {
            namespaces = new NamespacesImpl();

            JsonParser jp = JsonFormat.JSON_FACTORY_NON_STD.createJsonParser(is);

            JsonToken current;
            current = jp.nextToken();
View Full Code Here


        assertEquals(new Integer(55), record1.getField(new QName("import2", "f2")));
    }

    private byte[] scanToBytes(RecordScan scan) throws RepositoryException, InterruptedException, IOException {
        return JsonFormat.serializeAsBytes(
                writer.toJson(scan, new WriteOptions(), new NamespacesImpl(false), repository));
    }
View Full Code Here

                writer.toJson(scan, new WriteOptions(), new NamespacesImpl(false), repository));
    }

    private RecordScan scanFromBytes(byte[] data) throws IOException, RepositoryException, JsonFormatException,
            InterruptedException {
        return reader.fromJson(JsonFormat.deserializeNonStd(data), new NamespacesImpl(false), repository);
    }
View Full Code Here

    }

    @Before
    public void setup() {
        writer = new RecordScanWriter();
        reader = new RecordScanReader();
    }
View Full Code Here

        Closer.close(repoSetup);
    }

    @Before
    public void setup() {
        writer = new RecordScanWriter();
        reader = new RecordScanReader();
    }
View Full Code Here

    }

    public void readNamespaces(ObjectNode node) throws JsonFormatException {
        // We don't expect the namespaces to be modified since we're reading rather than writing, still wrap it
        // to make sure they are really not modified.
        this.namespaces = new UnmodifiableNamespaces(NamespacesConverter.fromJson(node));
    }
View Full Code Here

        if (filter.getField() != null && filter.getFieldValue() != null) {
            node.put("field", QNameConverter.toJson(filter.getField(), namespaces));

            ValueType valueType = repository.getTypeManager().getFieldTypeByName(filter.getField()).getValueType();
            JsonNode valueAsJson = RecordWriter.INSTANCE.valueToJson(filter.getFieldValue(), valueType,
                    new WriteOptions(), namespaces, repository);

            node.put("fieldValue", valueAsJson);
            node.putObject("value");
        }
View Full Code Here

        }
        return integers;
    }

    public static WriteOptions getWriteOptions(UriInfo uriInfo) {
        WriteOptions options = new WriteOptions();

        String includeSchema = uriInfo.getQueryParameters().getFirst("schema");
        if (includeSchema != null) {
            options.setIncludeSchema(includeSchema.equalsIgnoreCase("true"));
        }

        String useNamespacePrefixes = uriInfo.getQueryParameters().getFirst("nsprefixes");
        if (useNamespacePrefixes != null) {
            options.setUseNamespacePrefixes(useNamespacePrefixes.equalsIgnoreCase("true"));
        }

        return options;
    }
View Full Code Here

            job.getConfiguration().set(REPOSITORY_TABLES, Joiner.on(',').join(repositoryTables));
        }

        if (scan != null) {
            try {
                JsonNode node = RecordScanWriter.INSTANCE.toJson(scan, new WriteOptions(), repository);
                String scanData = JsonFormat.serializeAsString(node);
                job.getConfiguration().set(AbstractLilyScanInputFormat.SCAN, scanData);
            } catch (Exception e) {
                ExceptionUtil.handleInterrupt(e);
                throw new RuntimeException(e);
View Full Code Here

        assertEquals(new Integer(55), record1.getField(new QName("import2", "f2")));
    }

    private byte[] scanToBytes(RecordScan scan) throws RepositoryException, InterruptedException, IOException {
        return JsonFormat.serializeAsBytes(
                writer.toJson(scan, new WriteOptions(), new NamespacesImpl(false), repository));
    }
View Full Code Here

TOP

Related Classes of org.lilyproject.tools.import_.cli.JsonImport.ImportSettings

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.