public static ApplicationTemplateDescriptor load ( File f ) throws IOException { // Read the file's content String fileContent = Utils . readFileContent ( f ) ; Logger logger = Logger . getLogger ( ApplicationTemplateDescriptor . class . getName ( ) ) ; Properties properties = Utils . readPropertiesQuietly ( fileContent , logger ) ; if ( properties . get ( "fail.read" ) != null ) throw new IOException ( "This is for test purpose..." ) ; ApplicationTemplateDescriptor result = load ( properties ) ; // Resolve line numbers then int lineNumber = 1 ; for ( String line : fileContent . split ( "\n" ) ) { for ( String property : ALL_PROPERTIES ) { if ( line . trim ( ) . matches ( "(" + LEGACY_PREFIX + ")?" + property + "\\s*[:=].*" ) ) { result . propertyToLine . put ( property , lineNumber ) ; break ; } } lineNumber ++ ; } return result ; }
Loads an application template s descriptor .