protected Collection < Realm > parseDefinedRealms ( Config config ) { List < Realm > realms = new ArrayList <> ( ) ; // Parse the Realms if ( config . hasPath ( "realms" ) ) { log . trace ( "Parsing Realm definitions" ) ; for ( Config realmConfig : config . getConfigList ( "realms" ) ) { // define the realm name and type String realmType = Strings . emptyToNull ( realmConfig . getString ( "type" ) ) ; Preconditions . checkNotNull ( realmType , "Realm 'type' is null!" ) ; if ( ClassUtil . doesClassExist ( realmType ) ) { Class < ? extends Realm > realmClass = ClassUtil . getClass ( realmType ) ; if ( RequireUtil . allowClass ( settings , realmClass ) ) { try { Realm realm = injector . getInstance ( realmClass ) ; realm . setup ( realmConfig ) ; realms . add ( realm ) ; log . debug ( "Created '{}' named '{}'" , realmType , realm . getRealmName ( ) ) ; } catch ( Exception e ) { log . error ( "Failed to create '{}' realm" , realmType , e ) ; } } } else { throw new FathomException ( "Unknown realm type '{}'!" , realmType ) ; } } } return Collections . unmodifiableList ( realms ) ; }
Parse the Realms from the Config object .