Package org.infinispan.protostream

Examples of org.infinispan.protostream.FileDescriptorSource


   }

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


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

   @ManagedOperation(description = "Display a protobuf definition file", displayName = "Register Protofile")
   public String displayProtofile(@Parameter(name = "fileName", description = "the name of the .proto file") String name) {
      FileDescriptorSource fileDescriptorSource = clusterRegistry.get(REGISTRY_SCOPE, REGISTRY_KEY);
      if (fileDescriptorSource == null) return null;
      char[] data = fileDescriptorSource.getFileDescriptors().get(name);
      return data != null ? String.valueOf(data) : null;
   }
View Full Code Here

      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();
         String contents = Util.read(this.getClass().getResourceAsStream(classPathResource));
         fileDescriptorSource.addProtoFile(fileName, contents);
      }
      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

      }
   }

   @Override
   public void registerProtoFiles(String... classpathResource) throws IOException, DescriptorParserException {
      FileDescriptorSource fileDescriptorSource = new FileDescriptorSource();
      fileDescriptorSource.addProtoFiles(classpathResource);
      registerProtoFiles(fileDescriptorSource);
   }
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

TOP

Related Classes of org.infinispan.protostream.FileDescriptorSource

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.