public static GuiMapReader getInstance ( String pageDomain , String pageClassName ) throws IOException { logger . entering ( new Object [ ] { pageDomain , pageClassName } ) ; Preconditions . checkArgument ( StringUtils . isNotBlank ( pageClassName ) , "pageClassName can not be null, empty, or whitespace" ) ; String guiDataDir = Config . getConfigProperty ( ConfigProperty . GUI_DATA_DIR ) ; String processedPageDomain = StringUtils . defaultString ( pageDomain , "" ) ; String rawDataFile = guiDataDir + "/" + processedPageDomain + "/" + pageClassName ; if ( processedPageDomain . isEmpty ( ) ) { rawDataFile = guiDataDir + "/" + pageClassName ; } String yamlFile = rawDataFile + ".yaml" ; String ymlFile = rawDataFile + ".yml" ; GuiMapReader dataProvider ; if ( getFilePath ( yamlFile ) != null ) { dataProvider = YamlReaderFactory . createInstance ( yamlFile ) ; } else if ( getFilePath ( ymlFile ) != null ) { dataProvider = YamlReaderFactory . createInstance ( ymlFile ) ; } else { // Should be a FileNotFoundException? FileNotFoundException e = new FileNotFoundException ( "Data file does not exist for " + rawDataFile + ". Supported file extensions: yaml, yml." ) ; logger . log ( Level . SEVERE , e . getMessage ( ) , e ) ; throw e ; } logger . exiting ( dataProvider ) ; return dataProvider ; }
Method to get the reader instance depending on the input parameters .