Tabnine Logo
ProtoSchemaBuilder
Code IndexAdd Tabnine to your IDE (free)

How to use
ProtoSchemaBuilder
in
org.infinispan.protostream.annotations

Best Java code snippets using org.infinispan.protostream.annotations.ProtoSchemaBuilder (Showing top 8 results out of 315)

origin: org.uberfire/uberfire-metadata-backend-infinispan

private void addProtobufClass(SerializationContext serializationContext,
               String protoName,
               Class<?> clazz) {
  try {
    ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
    protoSchemaBuilder.fileName(protoName);
    protoSchemaBuilder.addClass(clazz);
    String schemaString = protoSchemaBuilder.build(serializationContext);
    this.getProtobufCache().put(protoName,
                  schemaString);
  } catch (IOException e) {
    throw new InfinispanException("Can't add protobuf class <" + protoName + "> to cache",
                   e);
  }
}
origin: org.infinispan.protostream/protostream

public static void main(String[] args) throws Exception {
 CommandLine cmd = parseCommandLine(args);
 if (cmd == null) {
   return;
 String fileName = file == null ? DEFAULT_GENERATED_SCHEMA_NAME : file.getName();
 ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder()
    .fileName(fileName)
    .packageName(packageName);
   protoSchemaBuilder.addClass(Class.forName(className));
 String schemaFile = protoSchemaBuilder.build(ctx);
origin: kiegroup/appformer

private void addProtobufClass(SerializationContext serializationContext,
               String protoName,
               Class<?> clazz) {
  try {
    ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
    protoSchemaBuilder.fileName(protoName);
    protoSchemaBuilder.addClass(clazz);
    String schemaString = protoSchemaBuilder.build(serializationContext);
    this.getProtobufCache().put(protoName,
                  schemaString);
  } catch (IOException e) {
    throw new InfinispanException("Can't add protobuf class <" + protoName + "> to cache",
                   e);
  }
}
origin: org.infinispan.server/infinispan-server-testsuite

@Before
public void before() throws IOException {
  ConfigurationBuilder clientBuilder = new ConfigurationBuilder();
  clientBuilder.addServer()
      .host(server.getHotrodEndpoint().getInetAddress().getHostName())
      .port(server.getHotrodEndpoint().getPort())
      .marshaller(new ProtoStreamMarshaller());
  remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
  SerializationContext serializationContext = ProtoStreamMarshaller.getSerializationContext(remoteCacheManager);
  ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
  String protoSchema = protoSchemaBuilder.fileName("transaction.proto")
      .addClass(Transaction.class)
      .build(serializationContext);
  RemoteCache<String, String> metadataCache = remoteCacheManager.getCache(ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME);
  metadataCache.put("transaction.proto", protoSchema);
}
origin: org.infinispan/infinispan-compatibility-mode-it

@Override
protected RemoteCacheManager createRemoteCacheManager() throws IOException {
 RemoteCacheManager remoteCacheManager = new RemoteCacheManager(new org.infinispan.client.hotrod.configuration.ConfigurationBuilder()
    .addServer().host("localhost").port(hotRodServer.getPort())
    .marshaller(new ProtoStreamMarshaller())
    .build());
 //initialize client-side serialization context
 SerializationContext serializationContext = ProtoStreamMarshaller.getSerializationContext(remoteCacheManager);
 ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
 String protoFile = protoSchemaBuilder.fileName("crypto.proto")
    .addClass(CryptoCurrency.class)
    .build(serializationContext);
 //initialize server-side serialization context via rest endpoint
 String metadataCacheEndpoint = String.format("http://localhost:%s/rest/%s", restServer.getPort(), PROTOBUF_METADATA_CACHE_NAME);
 EntityEnclosingMethod put = new PutMethod(metadataCacheEndpoint + "/crypto.proto");
 put.setRequestEntity(new StringRequestEntity(protoFile, "text/plain", "UTF-8"));
 restClient.executeMethod(put);
 assertEquals(put.getStatusCode(), HttpStatus.SC_OK);
 return remoteCacheManager;
}
origin: org.infinispan/infinispan-compatibility-mode-it

@Override
protected RemoteCacheManager createRemoteCacheManager() throws IOException {
 RemoteCacheManager remoteCacheManager = new RemoteCacheManager(new org.infinispan.client.hotrod.configuration.ConfigurationBuilder()
    .addServer().host("localhost").port(hotRodServer.getPort())
    .marshaller(new ProtoStreamMarshaller())
    .build());
 //initialize client-side serialization context
 SerializationContext serializationContext = ProtoStreamMarshaller.getSerializationContext(remoteCacheManager);
 ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
 String protoFile = protoSchemaBuilder.fileName("crypto.proto")
    .addClass(CryptoCurrency.class)
    .build(serializationContext);
 //initialize server-side serialization context
 RemoteCache<String, String> metadataCache = remoteCacheManager.getCache(PROTOBUF_METADATA_CACHE_NAME);
 metadataCache.put("crypto.proto", protoFile);
 return remoteCacheManager;
}
origin: org.infinispan.server/infinispan-server-testsuite

@Before
public void setUp() throws Exception {
 rcmFactory = new RemoteCacheManagerFactory();
 ConfigurationBuilder clientBuilder = new ConfigurationBuilder();
 clientBuilder.addServer()
    .host(server.getHotrodEndpoint().getInetAddress().getHostName())
    .port(server.getHotrodEndpoint().getPort())
    .marshaller(new ProtoStreamMarshaller());
 remoteCacheManager = rcmFactory.createManager(clientBuilder);
 remoteCache = remoteCacheManager.getCache(cacheName);
 //initialize client-side serialization context
 SerializationContext serializationContext = ProtoStreamMarshaller.getSerializationContext(remoteCacheManager);
 ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
 String protoFile = protoSchemaBuilder.fileName("test.proto")
    .addClass(AnnotatedUser.class)
    .build(serializationContext);
 //initialize server-side serialization context
 RemoteCache<String, String> metadataCache = remoteCacheManager.getCache(ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME);
 metadataCache.put("test.proto", protoFile);
 assertFalse(metadataCache.containsKey(ProtobufMetadataManagerConstants.ERRORS_KEY_SUFFIX));
}
origin: org.infinispan.server/infinispan-server-testsuite

ctx.registerMarshaller(new TransactionMarshaller());
ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
String testSchemaFile = protoSchemaBuilder.fileName("test.proto")
   .addClass(Note.class)
   .build(ctx);
org.infinispan.protostream.annotationsProtoSchemaBuilder

Javadoc

Generates a Protocol Buffers schema definition file based on a set of @Proto* annotated classes.

See ProtoMessage, ProtoField, ProtoEnum, ProtoEnumValue, ProtoDoc and ProtoUnknownFieldSet.

Most used methods

  • <init>
  • addClass
    Add a @ProtoXyz annotated class to be analyzed. Proto schema and marshaller will be generated for it
  • build
    Builds the Protocol Buffers schema file defining the types and generates marshaller implementations
  • fileName
    Set the name of the Protobuf schema file to generate. This is mandatory. The resulting file will be
  • packageName
    Set the name of the Protobuf package to generate. This is optional.
  • parseCommandLine

Popular in Java

  • Parsing JSON documents to java classes using gson
  • runOnUiThread (Activity)
  • compareTo (BigDecimal)
  • setRequestProperty (URLConnection)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now