private void readCommands ( ) { try { final Enumeration < URL > urls = Thread . currentThread ( ) . getContextClassLoader ( ) . getResources ( XmlCommands . FILEPATH ) ; while ( urls . hasMoreElements ( ) ) { URL url = urls . nextElement ( ) ; InputStream in = url . openStream ( ) ; for ( Command command : XmlCommands . fromXml ( in ) ) { commands . put ( command . getCommand ( ) , command ) ; } } } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
Find all commands available on classpath .