commonlib/src/main/java/com/streamsets/pipeline/lib/util/ProtobufTypeUtil.java
public static void getAllFileDescriptors(
      DescriptorProtos.FileDescriptorSet set,
      Map<String, Set<Descriptors.FileDescriptor>> dependenciesMap,
      Map<String, Descriptors.FileDescriptor> fileDescriptorMap
  ) throws StageException {
    List<DescriptorProtos.FileDescriptorProto> fileList = set.getFileList();
    try {
      for (DescriptorProtos.FileDescriptorProto fdp : fileList) {
        if (!fileDescriptorMap.containsKey(fdp.getName())) {
          Set<Descriptors.FileDescriptor> dependencies = dependenciesMap.get(fdp.getName());
          if (dependencies == null) {
            dependencies = new LinkedHashSet<>();
            dependenciesMap.put(fdp.getName(), dependencies);
            dependencies.addAll(getDependencies(dependenciesMap, fileDescriptorMap, fdp, set));
          }
          Descriptors.FileDescriptor fileDescriptor = Descriptors.FileDescriptor.buildFrom(
              fdp,
              dependencies.toArray(new Descriptors.FileDescriptor[dependencies.size()])
          );
          fileDescriptorMap.put(fdp.getName(), fileDescriptor);
        }
      }
    } catch (Descriptors.DescriptorValidationException e) {
      throw new StageException(Errors.PROTOBUF_07, e.getDescription(), e);
    }
  }
public static void getAllFileDescriptors(
      DescriptorProtos.FileDescriptorSet set,
      Map<String, Set<Descriptors.FileDescriptor>> dependenciesMap,
      Map<String, Descriptors.FileDescriptor> fileDescriptorMap
  ) throws StageException {
    List<DescriptorProtos.FileDescriptorProto> fileList = set.getFileList();
    try {
      for (DescriptorProtos.FileDescriptorProto fdp : fileList) {
        if (!fileDescriptorMap.containsKey(fdp.getName())) {
          Set<Descriptors.FileDescriptor> dependencies = dependenciesMap.get(fdp.getName());
          if (dependencies == null) {
            dependencies = new LinkedHashSet<>();
            dependenciesMap.put(fdp.getName(), dependencies);
            dependencies.addAll(getDependencies(dependenciesMap, fileDescriptorMap, fdp, set));
          }
          Descriptors.FileDescriptor fileDescriptor = Descriptors.FileDescriptor.buildFrom(
              fdp,
              dependencies.toArray(new Descriptors.FileDescriptor[dependencies.size()])
          );
          fileDescriptorMap.put(fdp.getName(), fileDescriptor);
        }
      }
    } catch (Descriptors.DescriptorValidationException e) {
      throw new StageException(Errors.PROTOBUF_07, e.getDescription(), e);
    }
  }
public static void getAllFileDescriptors ( DescriptorProtos . FileDescriptorSet set , Map < String , Set < Descriptors . FileDescriptor > > dependenciesMap , Map < String , Descriptors . FileDescriptor > fileDescriptorMap ) throws StageException { List < DescriptorProtos . FileDescriptorProto > fileList = set . getFileList ( ) ; try { for ( DescriptorProtos . FileDescriptorProto fdp : fileList ) { if ( ! fileDescriptorMap . containsKey ( fdp . getName ( ) ) ) { Set < Descriptors . FileDescriptor > dependencies = dependenciesMap . get ( fdp . getName ( ) ) ; if ( dependencies == null ) { dependencies = new LinkedHashSet <> ( ) ; dependenciesMap . put ( fdp . getName ( ) , dependencies ) ; dependencies . addAll ( getDependencies ( dependenciesMap , fileDescriptorMap , fdp , set ) ) ; } Descriptors . FileDescriptor fileDescriptor = Descriptors . FileDescriptor . buildFrom ( fdp , dependencies . toArray ( new Descriptors . FileDescriptor [ dependencies . size ( ) ] ) ) ; fileDescriptorMap . put ( fdp . getName ( ) , fileDescriptor ) ; } } } catch ( Descriptors . DescriptorValidationException e ) { throw new StageException ( Errors . PROTOBUF_07 , e . getDescription ( ) , e ) ; } }
Loads a Protobuf file descriptor set into an ubermap of file descriptors.

@param set               FileDescriptorSet
@param dependenciesMap   FileDescriptor dependency map
@param fileDescriptorMap The populated map of FileDescriptors
@throws StageException
Loads a Protobuf file descriptor set into an ubermap of file descriptors .