protected String loadOnlyConfig ( final Class < T > cl ) { try { /* Load up the config */ ConfigurationStore cs = getStore ( ) ; List < String > configNames = cs . getConfigs ( ) ; if ( configNames . isEmpty ( ) ) { error ( "No configuration on path " + cs . getLocation ( ) ) ; return "No configuration on path " + cs . getLocation ( ) ; } if ( configNames . size ( ) != 1 ) { error ( "1 and only 1 configuration allowed" ) ; return "1 and only 1 configuration allowed" ; } String configName = configNames . iterator ( ) . next ( ) ; cfg = getConfigInfo ( cs , configName , cl ) ; if ( cfg == null ) { error ( "Unable to read configuration" ) ; return "Unable to read configuration" ; } setConfigName ( configName ) ; return null ; } catch ( Throwable t ) { error ( "Failed to load configuration: " + t . getLocalizedMessage ( ) ) ; error ( t ) ; return "failed" ; } }
Load the configuration if we only expect one and we don t care or know what it s called .