/** * {@inheritDoc} */ @Override public GryoMapper.Builder mapper() { final GryoMapper.Builder builder = GryoMapper.build().version(version); onMapper.ifPresent(c -> c.accept(builder)); return builder; }
/** * Creates an instance with a standard {@link GryoMapper} instance. Note that this instance * will be overridden by {@link #configure} is called. */ public GryoLiteMessageSerializerV1d0() { super(overrideWithLite(GryoMapper.build()).create()); }
/** * Creates an instance with a standard {@link GryoMapper} instance. */ public GryoMessageSerializerV3d0() { super(GryoMapper.build().version(GryoVersion.V3_0).create()); }
/** * Creates an instance with a standard {@link GryoMapper} instance. */ public GryoMessageSerializerV1d0() { super(GryoMapper.build().version(GryoVersion.V1_0).create()); }
@Override public final void configure(final Map<String, Object> config, final Map<String, Graph> graphs) { final GryoMapper.Builder builder = GryoMapper.build().version(GryoVersion.V3_0); addIoRegistries(config, builder); addClassResolverSupplier(config, builder); addCustomClasses(config, builder); this.serializeToString = Boolean.parseBoolean(config.getOrDefault(TOKEN_SERIALIZE_RESULT_TO_STRING, "false").toString()); this.bufferSize = Integer.parseInt(config.getOrDefault(TOKEN_BUFFER_SIZE, "4096").toString()); this.gryoMapper = configureBuilder(builder, config, graphs).create(); }
@Override public final void configure(final Map<String, Object> config, final Map<String, Graph> graphs) { final GryoMapper.Builder builder = GryoMapper.build().version(GryoVersion.V1_0); addIoRegistries(config, builder); addClassResolverSupplier(config, builder); addCustomClasses(config, builder); this.serializeToString = Boolean.parseBoolean(config.getOrDefault(TOKEN_SERIALIZE_RESULT_TO_STRING, "false").toString()); this.bufferSize = Integer.parseInt(config.getOrDefault(TOKEN_BUFFER_SIZE, "4096").toString()); this.gryoMapper = configureBuilder(builder, config, graphs).create(); }
/** * Create the {@code GryoPool} from this builder. * * @return the new pool */ public GryoPool create() { final GryoMapper.Builder mapper = GryoMapper.build().version(version); final GryoPool gryoPool = new GryoPool(); if (null != this.ioRegistries) this.ioRegistries.forEach(mapper::addRegistry); if (null != this.gryoMapperConsumer) this.gryoMapperConsumer.accept(mapper); gryoPool.createPool(this.poolSize, this.type, mapper.create()); return gryoPool; } }
return GraphSONReader.build().mapper(builder.create()).create(); } else if (objectOrClass.equals(IO.gryo)){ final GryoMapper.Builder builder = GryoMapper.build(); detectRegistries().forEach(builder::addRegistry); return GryoReader.build().mapper(builder.create()).create();
return GraphSONWriter.build().mapper(builder.create()).create(); } else if (objectOrClass.equals(IO.gryo)){ final GryoMapper.Builder builder = GryoMapper.build(); detectRegistries().forEach(builder::addRegistry); return GryoWriter.build().mapper(builder.create()).create();
public GryoRecordWriter(final DataOutputStream outputStream, final Configuration configuration) { this.outputStream = outputStream; this.hasEdges = configuration.getBoolean(Constants.GREMLIN_HADOOP_GRAPH_WRITER_HAS_EDGES, true); this.gryoWriter = GryoWriter.build().mapper( GryoMapper.build().addRegistries(IoRegistryHelper.createRegistries(ConfUtil.makeApacheConfiguration(configuration))).create()).create(); }
@Override public void initialize(final InputSplit genericSplit, final TaskAttemptContext context) throws IOException { final FileSplit split = (FileSplit) genericSplit; final Configuration configuration = context.getConfiguration(); if (configuration.get(Constants.GREMLIN_HADOOP_GRAPH_FILTER, null) != null) this.graphFilter = VertexProgramHelper.deserialize(ConfUtil.makeApacheConfiguration(configuration), Constants.GREMLIN_HADOOP_GRAPH_FILTER); this.gryoReader = GryoReader.build().mapper( GryoMapper.build().addRegistries(IoRegistryHelper.createRegistries(ConfUtil.makeApacheConfiguration(configuration))).create()).create(); long start = split.getStart(); final Path file = split.getPath(); if (null != new CompressionCodecFactory(configuration).getCodec(file)) { throw new IllegalStateException("Compression is not supported for the (binary) Gryo format"); } // open the file and seek to the start of the split this.inputStream = file.getFileSystem(configuration).open(split.getPath()); this.splitLength = split.getLength(); if (this.splitLength > 0) this.splitLength -= (seekToHeader(this.inputStream, start) - start); }
for (TypeRegistration<?> tr : GryoMapper.build().version(GryoVersion.V1_0).create().getTypeRegistrations()) {
/** * {@inheritDoc} */ @Override public GryoMapper.Builder mapper() { final GryoMapper.Builder builder = GryoMapper.build().version(version); onMapper.ifPresent(c -> c.accept(builder)); return builder; }
/** * Creates an instance with a standard {@link GryoMapper} instance. Note that this instance * will be overridden by {@link #configure} is called. */ public GryoLiteMessageSerializerV1d0() { super(overrideWithLite(GryoMapper.build()).create()); }
/** * Creates an instance with a standard {@link GryoMapper} instance. */ public GryoMessageSerializerV1d0() { super(GryoMapper.build().version(GryoVersion.V1_0).create()); }
/** * Creates an instance with a standard {@link GryoMapper} instance. */ public GryoMessageSerializerV3d0() { super(GryoMapper.build().version(GryoVersion.V3_0).create()); }
/** * Create the {@code GryoPool} from this builder. * * @return the new pool */ public GryoPool create() { final GryoMapper.Builder mapper = GryoMapper.build().version(version); final GryoPool gryoPool = new GryoPool(); if (null != this.ioRegistries) this.ioRegistries.forEach(mapper::addRegistry); if (null != this.gryoMapperConsumer) this.gryoMapperConsumer.accept(mapper); gryoPool.createPool(this.poolSize, this.type, mapper.create()); return gryoPool; } }
@Override public final void configure(final Map<String, Object> config, final Map<String, Graph> graphs) { final GryoMapper.Builder builder = GryoMapper.build().version(GryoVersion.V3_0); addIoRegistries(config, builder); addClassResolverSupplier(config, builder); addCustomClasses(config, builder); this.serializeToString = Boolean.parseBoolean(config.getOrDefault(TOKEN_SERIALIZE_RESULT_TO_STRING, "false").toString()); this.bufferSize = Integer.parseInt(config.getOrDefault(TOKEN_BUFFER_SIZE, "4096").toString()); this.gryoMapper = configureBuilder(builder, config, graphs).create(); }
@Override public final void configure(final Map<String, Object> config, final Map<String, Graph> graphs) { final GryoMapper.Builder builder = GryoMapper.build().version(GryoVersion.V1_0); addIoRegistries(config, builder); addClassResolverSupplier(config, builder); addCustomClasses(config, builder); this.serializeToString = Boolean.parseBoolean(config.getOrDefault(TOKEN_SERIALIZE_RESULT_TO_STRING, "false").toString()); this.bufferSize = Integer.parseInt(config.getOrDefault(TOKEN_BUFFER_SIZE, "4096").toString()); this.gryoMapper = configureBuilder(builder, config, graphs).create(); }
public GryoRecordWriter(final DataOutputStream outputStream, final Configuration configuration) { this.outputStream = outputStream; this.hasEdges = configuration.getBoolean(Constants.GREMLIN_HADOOP_GRAPH_WRITER_HAS_EDGES, true); this.gryoWriter = GryoWriter.build().mapper( GryoMapper.build().addRegistries(IoRegistryHelper.createRegistries(ConfUtil.makeApacheConfiguration(configuration))).create()).create(); }