/** * Create a new Builder from a given {@link GraphSONMapper}. * * @return a new builder, with properties taken from the original mapper already applied. */ public static Builder build(final GraphSONMapper mapper) { Builder builder = build(); builder.customModules = mapper.customModules; builder.version = mapper.version; builder.loadCustomModules = mapper.loadCustomSerializers; builder.normalize = mapper.normalize; builder.typeInfo = mapper.typeInfo; return builder; }
@Parameterized.Parameters(name = "{0}") public static Iterable<Object[]> data() { final GraphSONMapper v1mapper = GraphSONMapper.build().version(GraphSONVersion.V1_0).typeInfo(TypeInfo.PARTIAL_TYPES).addRegistry(JanusGraphIoRegistryV1d0.getInstance()).create(); final GraphSONMapper v2mapper = GraphSONMapper.build().version(GraphSONVersion.V2_0).typeInfo(TypeInfo.PARTIAL_TYPES).addRegistry(JanusGraphIoRegistry.getInstance()).create(); final GraphSONMapper v3mapper = GraphSONMapper.build().version(GraphSONVersion.V3_0).typeInfo(TypeInfo.PARTIAL_TYPES).addRegistry(JanusGraphIoRegistry.getInstance()).create(); return Arrays.asList(new Object[][]{ {"graphson-v1-embedded", (Function<Graph, GraphReader>) g -> GraphSONReader.build().mapper(v1mapper).create(), (Function<Graph, GraphWriter>) g -> GraphSONWriter.build().mapper(v1mapper).create()}, {"graphson-v2-embedded", (Function<Graph, GraphReader>) g -> GraphSONReader.build().mapper(v2mapper).create(), (Function<Graph, GraphWriter>) g -> GraphSONWriter.build().mapper(v2mapper).create()}, {"graphson-v3", (Function<Graph, GraphReader>) g -> GraphSONReader.build().mapper(v3mapper).create(), (Function<Graph, GraphWriter>) g -> GraphSONWriter.build().mapper(v3mapper).create()}, {"gryo", (Function<Graph, GraphReader>) g -> g.io(IoCore.gryo()).reader().mapper(g.io(IoCore.gryo()).mapper().create()).create(), (Function<Graph, GraphWriter>) g -> g.io(IoCore.gryo()).writer().mapper(g.io(IoCore.gryo()).mapper().create()).create()} }); }
/** * {@inheritDoc} */ @Override public GraphSONMapper.Builder mapper() { final GraphSONMapper.Builder builder = GraphSONMapper.build().version(version); onMapper.ifPresent(c -> c.accept(builder)); return builder; }
private GraphSONMapper.Builder initBuilder(final GraphSONMapper.Builder builder) { final GraphSONMapper.Builder b = null == builder ? GraphSONMapper.build() : builder; return b.addCustomModule(new AbstractGraphSONMessageSerializerV1d0.GremlinServerModule()) .version(GraphSONVersion.V1_0); }
public LegacyGraphSONReader create() { final GraphSONMapper.Builder builder = GraphSONMapper.build(); customModules.forEach(builder::addCustomModule); final GraphSONMapper mapper = builder.typeInfo(embedTypes ? TypeInfo.PARTIAL_TYPES : TypeInfo.NO_TYPES) .loadCustomModules(loadCustomModules).create(); return new LegacyGraphSONReader(mapper.createMapper(), batchSize); } }
private GraphSONMapper.Builder initBuilder(final GraphSONMapper.Builder builder) { final GraphSONMapper.Builder b = null == builder ? GraphSONMapper.build() : builder; return b.addCustomModule(GraphSONXModuleV2d0.build().create(false)) .version(GraphSONVersion.V2_0); }
@Override public void initialize(final InputSplit genericSplit, final TaskAttemptContext context) throws IOException { this.lineRecordReader.initialize(genericSplit, context); this.hasEdges = context.getConfiguration().getBoolean(Constants.GREMLIN_HADOOP_GRAPH_READER_HAS_EDGES, true); this.graphsonReader = GraphSONReader.build().mapper( GraphSONMapper.build(). version(GraphSONVersion.valueOf(context.getConfiguration().get(Constants.GREMLIN_HADOOP_GRAPHSON_VERSION, "V3_0"))). typeInfo(TypeInfo.PARTIAL_TYPES). addRegistries(IoRegistryHelper.createRegistries(ConfUtil.makeApacheConfiguration(context.getConfiguration()))).create()).create(); }
else if (objectOrClass instanceof String) { if (objectOrClass.equals(IO.graphson)) { final GraphSONMapper.Builder builder = GraphSONMapper.build(); detectRegistries().forEach(builder::addRegistry); return GraphSONReader.build().mapper(builder.create()).create();
else if (objectOrClass instanceof String) { if (objectOrClass.equals(IO.graphson)) { final GraphSONMapper.Builder builder = GraphSONMapper.build(); detectRegistries().forEach(builder::addRegistry); return GraphSONWriter.build().mapper(builder.create()).create();
public GraphSONRecordWriter(final DataOutputStream outputStream, final Configuration configuration) { this.outputStream = outputStream; this.hasEdges = configuration.getBoolean(Constants.GREMLIN_HADOOP_GRAPH_WRITER_HAS_EDGES, true); this.graphsonWriter = GraphSONWriter.build().mapper( GraphSONMapper.build(). version(GraphSONVersion.valueOf(configuration.get(Constants.GREMLIN_HADOOP_GRAPHSON_VERSION, "V3_0"))). typeInfo(TypeInfo.PARTIAL_TYPES). addRegistries(IoRegistryHelper.createRegistries(ConfUtil.makeApacheConfiguration(configuration))).create()).create(); }
/** * Create a new Builder from a given {@link GraphSONMapper}. * * @return a new builder, with properties taken from the original mapper already applied. */ public static Builder build(final GraphSONMapper mapper) { Builder builder = build(); builder.customModules = mapper.customModules; builder.version = mapper.version; builder.loadCustomModules = mapper.loadCustomSerializers; builder.normalize = mapper.normalize; builder.typeInfo = mapper.typeInfo; return builder; }
/** * {@inheritDoc} */ @Override public GraphSONMapper.Builder mapper() { final GraphSONMapper.Builder builder = GraphSONMapper.build().version(version); onMapper.ifPresent(c -> c.accept(builder)); return builder; }
public Titan1GraphDatabase() { //update registry GraphSONMapper.build().addRegistry(TitanIoRegistry.INSTANCE).create(); }
private GraphSONMapper.Builder initBuilder(final GraphSONMapper.Builder builder) { final GraphSONMapper.Builder b = null == builder ? GraphSONMapper.build() : builder; return b.addCustomModule(new AbstractGraphSONMessageSerializerV1d0.GremlinServerModule()) .version(GraphSONVersion.V1_0); }
public AtlasJanusGraphDatabase() { //update registry GraphSONMapper.build().addRegistry(JanusGraphIoRegistry.getInstance()).create(); }
public LegacyGraphSONReader create() { final GraphSONMapper.Builder builder = GraphSONMapper.build(); customModules.forEach(builder::addCustomModule); final GraphSONMapper mapper = builder.typeInfo(embedTypes ? TypeInfo.PARTIAL_TYPES : TypeInfo.NO_TYPES) .loadCustomModules(loadCustomModules).create(); return new LegacyGraphSONReader(mapper.createMapper(), batchSize); } }
@Override public void initialize(final InputSplit genericSplit, final TaskAttemptContext context) throws IOException { this.lineRecordReader.initialize(genericSplit, context); this.hasEdges = context.getConfiguration().getBoolean(Constants.GREMLIN_HADOOP_GRAPH_READER_HAS_EDGES, true); this.graphsonReader = GraphSONReader.build().mapper( GraphSONMapper.build(). version(GraphSONVersion.valueOf(context.getConfiguration().get(Constants.GREMLIN_HADOOP_GRAPHSON_VERSION, "V3_0"))). typeInfo(TypeInfo.PARTIAL_TYPES). addRegistries(IoRegistryHelper.createRegistries(ConfUtil.makeApacheConfiguration(context.getConfiguration()))).create()).create(); }
private GraphSONMapper.Builder initBuilder(final GraphSONMapper.Builder builder) { final GraphSONMapper.Builder b = null == builder ? GraphSONMapper.build() : builder; return b.addCustomModule(GraphSONXModuleV2d0.build().create(false)) .version(GraphSONVersion.V2_0); }
public AtlasGraphSONReader create() { setDefaults(); if(bulkLoadGraph == null) { bulkLoadGraph = graph; } final GraphSONMapper.Builder builder = GraphSONMapper.build(); final GraphSONMapper mapper = builder.typeInfo(TypeInfo.NO_TYPES).create(); return new AtlasGraphSONReader(mapper.createMapper(), relationshipCache, graph, bulkLoadGraph, numWorkers, batchSize, suppliedStartIndex); }
public GraphSONRecordWriter(final DataOutputStream outputStream, final Configuration configuration) { this.outputStream = outputStream; this.hasEdges = configuration.getBoolean(Constants.GREMLIN_HADOOP_GRAPH_WRITER_HAS_EDGES, true); this.graphsonWriter = GraphSONWriter.build().mapper( GraphSONMapper.build(). version(GraphSONVersion.valueOf(configuration.get(Constants.GREMLIN_HADOOP_GRAPHSON_VERSION, "V3_0"))). typeInfo(TypeInfo.PARTIAL_TYPES). addRegistries(IoRegistryHelper.createRegistries(ConfUtil.makeApacheConfiguration(configuration))).create()).create(); }