Package com.thinkaurelius.faunus.formats.rexster.util

Examples of com.thinkaurelius.faunus.formats.rexster.util.VertexToFaunusBinary


        final JSONObject requestObject = context.getRequestObject();
        final long start = RequestObjectHelper.getStartOffset(requestObject);
        final long end = RequestObjectHelper.getEndOffset(requestObject);

        final ElementIdHandler elementIdHandler = this.getElementIdHandler(context.getRexsterApplicationGraph());
        final VertexToFaunusBinary vertexToFaunusBinary = new VertexToFaunusBinary(elementIdHandler);

        // help with uniquely identifying incoming requests in logs.
        final UUID requestIdentifier = UUID.randomUUID();
        final String verticesInSplit = end == Long.MAX_VALUE ? "END" : String.valueOf(end - start);
        logger.debug(String.format("Request [%s] split between [%s] and [%s].", requestIdentifier, start, end));

        return new ExtensionResponse(Response.ok(new StreamingOutput() {
            @Override
            public void write(OutputStream out) throws IOException {
                long counter = 0;
                long vertexCount = 0;

                final DataOutputStream dos = new DataOutputStream(out);

                final Iterable<Vertex> vertices = graph.getVertices();
                for (Vertex vertex : vertices) {
                    if (counter >= start && counter < end) {
                        vertexToFaunusBinary.writeVertex(vertex, dos);

                        if (logger.isDebugEnabled() && counter % WRITE_STATUS_EVERY == 0) {
                            logger.debug(String.format("Request [%s] at [%s] on the way to [%s].",
                                    requestIdentifier, vertexCount, verticesInSplit));
                        }
View Full Code Here

TOP

Related Classes of com.thinkaurelius.faunus.formats.rexster.util.VertexToFaunusBinary

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.