Examples of addProtoFile()


Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

   public static final String QUERY_PROTO_RES = "/org/infinispan/query/remote/client/query.proto";
   public static final String MESSAGE_PROTO_RES = "/org/infinispan/protostream/message-wrapping.proto";

   public static void registerMarshallers(SerializationContext ctx) throws IOException, DescriptorParserException {
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("query.proto", MarshallerRegistration.class.getResourceAsStream(QUERY_PROTO_RES));
      fileDescriptorSource.addProtoFile("message-wrapping.proto", MarshallerRegistration.class.getResourceAsStream(MESSAGE_PROTO_RES));
      ctx.registerProtoFiles(fileDescriptorSource);
      ctx.registerMarshaller(new QueryRequestMarshaller());
      ctx.registerMarshaller(new QueryResponseMarshaller());
   }
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

   public static final String MESSAGE_PROTO_RES = "/org/infinispan/protostream/message-wrapping.proto";

   public static void registerMarshallers(SerializationContext ctx) throws IOException, DescriptorParserException {
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("query.proto", MarshallerRegistration.class.getResourceAsStream(QUERY_PROTO_RES));
      fileDescriptorSource.addProtoFile("message-wrapping.proto", MarshallerRegistration.class.getResourceAsStream(MESSAGE_PROTO_RES));
      ctx.registerProtoFiles(fileDescriptorSource);
      ctx.registerMarshaller(new QueryRequestMarshaller());
      ctx.registerMarshaller(new QueryResponseMarshaller());
   }
}
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

         }
         if (shouldIntercept(key)) {
            if (!((String) key).endsWith(PROTO_KEY_SUFFIX)) {
               throw new CacheException("The key must end with \".proto\" : " + key);
            }
            source.addProtoFile((String) key, (String) value);
         }
      }

      // lock .errors key
      VisitableCommand cmd = commandsFactory.buildLockControlCommand(ERRORS_KEY_SUFFIX, null, null);
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

      for (int i = 0; i < size; i++) {
         String name = input.readUTF();
         int length = UnsignedNumeric.readUnsignedInt(input);
         byte[] compressed = (byte[]) input.readObject();
         char[] contents = decompress(compressed, length);
         fileDescriptorSource.addProtoFile(name, String.valueOf(contents));
      }
      return fileDescriptorSource;
   }

   public byte[] compress(char[] input) throws IOException {
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

           throws Exception {
      if (names.length != contents.length)
         throw new MBeanException(new IllegalArgumentException("invalid parameter sizes"));
      FileDescriptorSource fileDescriptorSource = getFileDescriptorSource();
      for (int i = 0; i < names.length; i++) {
         fileDescriptorSource.addProtoFile(names[i], contents[i]);
      }
      clusterRegistry.put(REGISTRY_SCOPE, REGISTRY_KEY, fileDescriptorSource);
   }

   @ManagedOperation(description = "Registers a Protobuf definition file", displayName = "Register Protofile")
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

   @ManagedOperation(description = "Registers a Protobuf definition file", displayName = "Register Protofile")
   public void registerProtofile(@Parameter(name = "fileName", description = "the name of the .proto file") String name,
                                 @Parameter(name = "contents", description = "contents of the file") String contents) throws Exception {
      FileDescriptorSource fileDescriptorSource = getFileDescriptorSource();
      fileDescriptorSource.addProtoFile(name, contents);

      clusterRegistry.put(REGISTRY_SCOPE, REGISTRY_KEY, fileDescriptorSource);
   }

   @ManagedOperation(description = "Display a protobuf definition file", displayName = "Register Protofile")
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

   public void registerProtofiles(String... classPathResources) throws Exception {
      FileDescriptorSource fileDescriptorSource = getFileDescriptorSource();
      for (String classPathResource : classPathResources) {
         String fileName = Paths.get(classPathResource).getFileName().toString();
         fileDescriptorSource.addProtoFile(fileName, Util.getResourceAsStream(classPathResource, getClass().getClassLoader()));
      }
      clusterRegistry.put(REGISTRY_SCOPE, REGISTRY_KEY, fileDescriptorSource);
   }

   public static SerializationContext getSerializationContext(EmbeddedCacheManager cacheManager) {
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

   public static final String QUERY_PROTO_RES = "/org/infinispan/query/remote/client/query.proto";
   public static final String MESSAGE_PROTO_RES = "/org/infinispan/protostream/message-wrapping.proto";

   public static void registerMarshallers(SerializationContext ctx) throws IOException, DescriptorParserException {
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("query.proto",MarshallerRegistration.class.getResourceAsStream(QUERY_PROTO_RES));
      fileDescriptorSource.addProtoFile("message-wrapping.proto",MarshallerRegistration.class.getResourceAsStream(MESSAGE_PROTO_RES));
      ctx.registerProtoFiles(fileDescriptorSource);
      ctx.registerMarshaller(new QueryRequestMarshaller());
      ctx.registerMarshaller(new QueryResponseMarshaller());
   }
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

   public static final String MESSAGE_PROTO_RES = "/org/infinispan/protostream/message-wrapping.proto";

   public static void registerMarshallers(SerializationContext ctx) throws IOException, DescriptorParserException {
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("query.proto",MarshallerRegistration.class.getResourceAsStream(QUERY_PROTO_RES));
      fileDescriptorSource.addProtoFile("message-wrapping.proto",MarshallerRegistration.class.getResourceAsStream(MESSAGE_PROTO_RES));
      ctx.registerProtoFiles(fileDescriptorSource);
      ctx.registerMarshaller(new QueryRequestMarshaller());
      ctx.registerMarshaller(new QueryResponseMarshaller());
   }
}
View Full Code Here

Examples of org.infinispan.protostream.FileDescriptorSource.addProtoFile()

   @Test
   public void testInputFromFile() throws Exception {
      String f1 = "org/infinispan/protostream/lib/base.proto";
      String f2 = "org/infinispan/protostream/lib/base2.proto";
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile(f1, asFile(f1));
      fileDescriptorSource.addProtoFile(f2, asFile(f2));
      Map<String, FileDescriptor> parseResult = parseAndResolve(fileDescriptorSource);
      assertThat(parseResult).isNotEmpty();
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.