mil.dod.th.ose.jaxb.proto.converter/src/mil/dod/th/ose/jaxbprotoconverter/ProtoFileParser.java
public Map<String, String> parseProtoFilesForTypes(final String folderPath) 
            throws IOException
    {
        final Map<String, String> avaiableTypesForImport = new HashMap<String, String>();
        final File folder = new File(folderPath);
        final File[] arrayOfFiles = folder.listFiles();
        
        if (arrayOfFiles == null)
        {
            System.out.println("No files found in the specified folder path: " + folderPath);
            return avaiableTypesForImport;
        }
        

        for (File file : arrayOfFiles)
        {
            if (file.isFile())
            {
                final String fileName = file.getName();

                if (fileName.endsWith("proto"))
                {
                    try (FileReader fr = new FileReader(file); 
                            BufferedReader br = new BufferedReader(fr))
                    {
                        String line;
                    
                        while ((line = br.readLine()) != null)
                        {   
                            //Check if line defines a message.
                            final Pattern messagePattern = Pattern.compile("message[\\s]+([a-zA-Z]+).*$");
                            Matcher matcher = messagePattern.matcher(line);
                            if (matcher.lookingAt())
                            {
                                avaiableTypesForImport.put(matcher.group(1), fileName);
                            }
                            
                            //Check if a line defines an enumeration.
                            final Pattern enumPattern = Pattern.compile("enum[\\s]+([a-zA-Z]+).*$");
                            matcher = enumPattern.matcher(line);
                            if (matcher.lookingAt())
                            {
                                avaiableTypesForImport.put(matcher.group(1), fileName);
                            }
                        }
                    }
                }
            }
        }
        return avaiableTypesForImport;
    }
/**
     * This method retrieves all the available types for import from the protocol buffer files within the specified 
     * folder.
     * 
     * @param folderPath
     *          String representation of folder path.
     * @return
     *          A {@link Map} containing the names of all available types as the keys and the Protocol file the 
     *          messages are located in as the values.  
     * @throws IOException
     *          If a protocol buffer file cannot be found or read from properly.
     */
This method retrieves all the available types for import from the protocol buffer files within the specified
folder.

@param folderPath
String representation of folder path.
@return
A  Map containing the names of all available types as the keys and the Protocol file the
messages are located in as the values.
@throws IOException
If a protocol buffer file cannot be found or read from properly.
This method retrieves all the available types for import from the protocol buffer files within the specified folder . @param folderPath String representation of folder path . @return A Map containing the names of all available types as the keys and the Protocol file the messages are located in as the values . @throws IOException If a protocol buffer file cannot be found or read from properly .
public Map<String, String> parseProtoFilesForTypes(final String folderPath) 
            throws IOException
    {
        final Map<String, String> avaiableTypesForImport = new HashMap<String, String>();
        final File folder = new File(folderPath);
        final File[] arrayOfFiles = folder.listFiles();
        if (arrayOfFiles == null)
        {
            System.out.println("No files found in the specified folder path: " + folderPath);
            return avaiableTypesForImport;
        }
        for (File file : arrayOfFiles)
        {
            if (file.isFile())
            {
                final String fileName = file.getName();
                if (fileName.endsWith("proto"))
                {
                    try (FileReader fr = new FileReader(file); 
                            BufferedReader br = new BufferedReader(fr))
                    {
                        String line;
                        while ((line = br.readLine()) != null)
                        {   
                            final Pattern messagePattern = Pattern.compile("message[\\s]+([a-zA-Z]+).*$");
                            Matcher matcher = messagePattern.matcher(line);
                            if (matcher.lookingAt())
                            {
                                avaiableTypesForImport.put(matcher.group(1), fileName);
                            }
                            final Pattern enumPattern = Pattern.compile("enum[\\s]+([a-zA-Z]+).*$");
                            matcher = enumPattern.matcher(line);
                            if (matcher.lookingAt())
                            {
                                avaiableTypesForImport.put(matcher.group(1), fileName);
                            }
                        }
                    }
                }
            }
        }
        return avaiableTypesForImport;
    }
public Map < String , String > parseProtoFilesForTypes ( final String folderPath ) throws IOException { final Map < String , String > avaiableTypesForImport = new HashMap < String , String > ( ) ; final File folder = new File ( folderPath ) ; final File [ ] arrayOfFiles = folder . listFiles ( ) ; if ( arrayOfFiles == null ) { System . out . println ( "No files found in the specified folder path: " + folderPath ) ; return avaiableTypesForImport ; } for ( File file : arrayOfFiles ) { if ( file . isFile ( ) ) { final String fileName = file . getName ( ) ; if ( fileName . endsWith ( "proto" ) ) { try ( FileReader fr = new FileReader ( file ) ; BufferedReader br = new BufferedReader ( fr ) ) { String line ; while ( ( line = br . readLine ( ) ) != null ) { final Pattern messagePattern = Pattern . compile ( "message[\\s]+([a-zA-Z]+).*$" ) ; Matcher matcher = messagePattern . matcher ( line ) ; if ( matcher . lookingAt ( ) ) { avaiableTypesForImport . put ( matcher . group ( 1 ) , fileName ) ; } final Pattern enumPattern = Pattern . compile ( "enum[\\s]+([a-zA-Z]+).*$" ) ; matcher = enumPattern . matcher ( line ) ; if ( matcher . lookingAt ( ) ) { avaiableTypesForImport . put ( matcher . group ( 1 ) , fileName ) ; } } } } } } return avaiableTypesForImport ; }
This method retrieves all the available types for import from the protocol buffer files within the specified
 folder.
This method retrieves all the available types for import from the protocol buffer files within the specified folder .
//Check if line defines a message. //Check if a line defines an enumeration.