/** * 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; }
public AbstractGraphSONMessageSerializerV1d0(final GraphSONMapper mapper) { this.mapper = mapper.createMapper(); }
public GraphSONMapper create() { registries.forEach(registry -> { final List<Pair<Class, SimpleModule>> simpleModules = registry.find(GraphSONIo.class, SimpleModule.class); simpleModules.stream().map(Pair::getValue1).forEach(this.customModules::add); }); return new GraphSONMapper(this); }
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 GraphSONReader(final Builder builder) { mapper = builder.mapper.createMapper(); batchSize = builder.batchSize; unwrapAdjacencyList = builder.unwrapAdjacencyList; version = ((GraphSONMapper)builder.mapper).getVersion(); }
registerJavaBaseTypes(graphSONTypeIdResolver);
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 GraphSONReader(final Builder builder) { mapper = builder.mapper.createMapper(); batchSize = builder.batchSize; unwrapAdjacencyList = builder.unwrapAdjacencyList; version = ((GraphSONMapper)builder.mapper).getVersion(); }
registerJavaBaseTypes(graphSONTypeIdResolver);
@Deprecated public AbstractGraphSONMessageSerializerV2d0(final GraphSONMapper mapper) { this.mapper = mapper.createMapper(); }
@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()} }); }
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 GraphSONMapper create() { registries.forEach(registry -> { final List<Pair<Class, SimpleModule>> simpleModules = registry.find(GraphSONIo.class, SimpleModule.class); simpleModules.stream().map(Pair::getValue1).forEach(this.customModules::add); }); return new GraphSONMapper(this); }
public AbstractGraphSONMessageSerializerV2d0(final GraphSONMapper.Builder mapperBuilder) { this.mapper = configureBuilder(mapperBuilder).create().createMapper(); }
/** * {@inheritDoc} */ @Override public GraphSONMapper.Builder mapper() { final GraphSONMapper.Builder builder = GraphSONMapper.build().version(version); onMapper.ifPresent(c -> c.accept(builder)); return builder; }
final ObjectMapper mapper = GraphSONMapper.build().embedTypes(false).create().createMapper();
public AbstractGraphSONMessageSerializerV2d0() { final GraphSONMapper.Builder builder = configureBuilder(initBuilder(null)); mapper = builder.create().createMapper(); }
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 AbstractGraphSONMessageSerializerV1d0() { final GraphSONMapper.Builder builder = configureBuilder(initBuilder(null)); mapper = builder.create().createMapper(); }
@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(); }