public static void registerMarshallers(SerializationContext ctx) throws IOException, DescriptorParserException { ctx.registerProtoFiles(FileDescriptorSource.fromResources(PROTOBUF_RES)); ctx.registerMarshaller(new UserMarshaller()); ctx.registerMarshaller(new GenderMarshaller()); ctx.registerMarshaller(new AddressMarshaller()); ctx.registerMarshaller(new AccountMarshaller()); ctx.registerMarshaller(new LimitsMarshaller()); ctx.registerMarshaller(new TransactionMarshaller()); } }
public static void registerSequenceMarshaller(SequenceTableDefinition std, OgmProtoStreamMarshaller marshaller) { SequenceIdMarshaller idM = new SequenceIdMarshaller( std ); marshaller.getSerializationContext().registerMarshaller( idM ); } }
public static void registerEntityMarshaller(MainOgmCoDec delegate, OgmProtoStreamMarshaller marshaller) throws DescriptorParserException { IdMessageMarshaller idM = new IdMessageMarshaller( delegate ); PayloadMessageMarshaller valueM = new PayloadMessageMarshaller( delegate ); marshaller.getSerializationContext().registerMarshaller( idM ); marshaller.getSerializationContext().registerMarshaller( valueM ); }
/** * Registers proto files and marshallers. * * @param ctx the serialization context * @throws org.infinispan.protostream.DescriptorParserException if a proto definition file fails to parse correctly * @throws IOException if proto file registration fails */ public static void registerMarshallers(SerializationContext ctx) throws IOException { FileDescriptorSource fileDescriptorSource = new FileDescriptorSource(); fileDescriptorSource.addProtoFile(QUERY_PROTO_RES, MarshallerRegistration.class.getResourceAsStream(QUERY_PROTO_RES)); fileDescriptorSource.addProtoFile(MESSAGE_PROTO_RES, MarshallerRegistration.class.getResourceAsStream(MESSAGE_PROTO_RES)); ctx.registerProtoFiles(fileDescriptorSource); ctx.registerMarshaller(new QueryRequest.NamedParameter.Marshaller()); ctx.registerMarshaller(new QueryRequest.Marshaller()); ctx.registerMarshaller(new QueryResponse.Marshaller()); ctx.registerMarshaller(new FilterResult.Marshaller()); ctx.registerMarshaller(new ContinuousQueryResult.ResultType.Marshaller()); ctx.registerMarshaller(new ContinuousQueryResult.Marshaller()); } }
private void generateMarshallers() throws Exception { MarshallerCodeGenerator marshallerCodeGenerator = new MarshallerCodeGenerator(packageName, getClassPool()); for (Class<?> c : metadataByClass.keySet()) { ProtoTypeMetadata ptm = metadataByClass.get(c); if (ptm instanceof ProtoMessageTypeMetadata) { RawProtobufMarshaller<?> marshaller = marshallerCodeGenerator.generateMessageMarshaller((ProtoMessageTypeMetadata) ptm); ptm.setMarshaller(marshaller); serializationContext.registerMarshaller(marshaller); } else if (ptm instanceof ProtoEnumTypeMetadata) { EnumMarshaller<?> marshaller = marshallerCodeGenerator.generateEnumMarshaller((ProtoEnumTypeMetadata) ptm); ptm.setMarshaller(marshaller); serializationContext.registerMarshaller(marshaller); } } }
@Override public void init(SerializationContext serializationContext) throws IOException { serializationContext.registerProtoFiles(FileDescriptorSource.fromResources(ServerCtxInitializer.class.getClassLoader(), "/sample_bank_account/bank.proto")); serializationContext.registerMarshaller(new UserMarshaller()); serializationContext.registerMarshaller(new GenderMarshaller()); } }
public CustomProtoStreamMarshaller() throws IOException { SerializationContext serCtx = getSerializationContext(); serCtx.registerProtoFiles(FileDescriptorSource.fromResources(CustomProtoStreamMarshaller.class.getClassLoader(), "/sample_bank_account/bank.proto")); serCtx.registerMarshaller(new UserMarshaller()); serCtx.registerMarshaller(new GenderMarshaller()); } }
for (String marshaller : marshallers) { BaseMarshaller<?> bm = (BaseMarshaller) Class.forName(marshaller).newInstance(); ctx.registerMarshaller(bm);
public InfinispanSessionLegacyConverter (String cacheName) throws Exception { //legacy serialization _legacyManager = new RemoteCacheManager(); _legacyCache = _legacyManager.getCache(cacheName); //new protobuf based String host = System.getProperty("host", "127.0.0.1"); _verbose = Boolean.getBoolean("verbose"); Properties properties = new Properties(); ConfigurationBuilder clientBuilder = new ConfigurationBuilder(); clientBuilder.withProperties(properties).addServer().host(host).marshaller(new ProtoStreamMarshaller()); _protoManager = new RemoteCacheManager(clientBuilder.build()); FileDescriptorSource fds = new FileDescriptorSource(); fds.addProtoFiles("/session.proto"); SerializationContext serCtx = ProtoStreamMarshaller.getSerializationContext(_protoManager); serCtx.registerProtoFiles(fds); serCtx.registerMarshaller(new SessionDataMarshaller()); _protoCache = _protoManager.getCache(cacheName); }
SerializationContext ctx = ProtoStreamMarshaller.getSerializationContext(manager); ctx.registerProtoFiles(fds); ctx.registerMarshaller(new UserMarshaller()); ctx.registerMarshaller(new GenderMarshaller()); ctx.registerMarshaller(new AddressMarshaller()); ctx.registerMarshaller(new AccountMarshaller()); ctx.registerMarshaller(new LimitsMarshaller()); ctx.registerMarshaller(new TransactionMarshaller());
serCtx.registerProtoFiles(fromString("uuid.proto", "message unique_id { required string uuid=1; }")); serCtx.registerMarshaller(new UUIDMarshaller());
serCtx.registerProtoFiles(fromString("uuid.proto", "message unique_id { required string uuid=1; }")); serCtx.registerMarshaller(new UUIDMarshaller());