Package org.infinispan.protostream

Examples of org.infinispan.protostream.FileDescriptorSource$ProgressCallback


      char[] data = fileDescriptorSource.getFileDescriptors().get(name);
      return data != null ? String.valueOf(data) : null;
   }

   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);
   }
View Full Code Here


      metadataManager.ensureInit();
      return metadataManager.serCtx;
   }

   private FileDescriptorSource getFileDescriptorSource() {
      FileDescriptorSource fileDescriptorSource = clusterRegistry.get(REGISTRY_SCOPE, REGISTRY_KEY);
      if (fileDescriptorSource == null) {
         fileDescriptorSource = new FileDescriptorSource();
      }
      return fileDescriptorSource;
   }
View Full Code Here

   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

      }
   }

   @Override
   public void registerProtofiles(String... classpathResource) throws IOException, DescriptorParserException {
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFiles(classpathResource);
      this.registerProtoFiles(fileDescriptorSource);
   }
View Full Code Here

            "   required b.A ma = 1;\n" +
            "}";

      final Map<String, DescriptorParserException> failed = new HashMap<>();
      final Set<String> successful = new HashSet<>();
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource()
            .addProtoFile("file1.proto", file1)
            .addProtoFile("file2.proto", file2)
            .withProgressCallback(new FileDescriptorSource.ProgressCallback() {
               @Override
               public void handleError(String fileName, DescriptorParserException exception) {
View Full Code Here

   @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

              " import test.proto;\n" +
                      " message M2 {\n" +
                      "    required string a = 1;\n" +
                      "}";

      FileDescriptorSource source = new FileDescriptorSource();
      source.addProtoFile("test.proto", file1);
      source.addProtoFile("test2.proto", file2);

      parseAndResolve(source);
   }
View Full Code Here

      String file1 = "package test1;\n";

      String file2 = "import \"file1.proto\";\n" +
            "import \"file1.proto\";\n";

      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("file1.proto", file1);
      fileDescriptorSource.addProtoFile("file2.proto", file2);

      parseAndResolve(fileDescriptorSource);
   }
View Full Code Here

   }

   @Test
   public void testTransform() throws Exception {

      FileDescriptorSource fileDescriptorSource = FileDescriptorSource.fromResources(
              "org/infinispan/protostream/test/message.proto",
              "org/infinispan/protostream/lib/base.proto",
              "org/infinispan/protostream/lib/base2.proto");

      Map<String, FileDescriptor> files = parseAndResolve(fileDescriptorSource);
View Full Code Here

            "}\n\n" +
            "message M1 {\n" +
            "  required string a = 1;\n" +
            "}\n";

      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFile("test_proto_path/file1.proto", file1);

      parseAndResolve(fileDescriptorSource);
   }
View Full Code Here

TOP

Related Classes of org.infinispan.protostream.FileDescriptorSource$ProgressCallback

Copyright © 2018 www.massapicom. 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.