private void doFindNetwork ( final Message < JsonObject > message ) { final String name = message . body ( ) . getString ( "network" ) ; if ( name == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No network name specified." ) ) ; } else { context . execute ( new Action < NetworkContext > ( ) { @ Override public NetworkContext perform ( ) { String scontext = data . < String , String > getMap ( String . format ( "%s.%s" , cluster , name ) ) . get ( String . format ( "%s.%s" , cluster , name ) ) ; if ( scontext != null ) { return Contexts . < NetworkContext > deserialize ( new JsonObject ( scontext ) ) ; } return null ; } } , new Handler < AsyncResult < NetworkContext > > ( ) { @ Override public void handle ( AsyncResult < NetworkContext > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; } else if ( result . result ( ) == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "Not a valid network." ) ) ; } else { message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) . putObject ( "result" , Contexts . serialize ( result . result ( ) ) ) ) ; } } } ) ; } }
Loads a network configuration .