private void doDeployModule(final Message<JsonObject> message) {
    String moduleName = message.body().getString("module");
    if (moduleName == null) {
      message.reply(new JsonObject().putString("status", "error").putString("message", "No module name specified."));
      return;
    }

    JsonObject config = message.body().getObject("config");
    if (config == null) {
      config = new JsonObject();
    }
    int instances = message.body().getInteger("instances", 1);
    platform.deployModule(moduleName, config, instances, new Handler<AsyncResult<String>>() {
      @Override
      public void handle(AsyncResult<String> result) {
        if (result.failed()) {
          message.reply(new JsonObject().putString("status", "error").putString("message", result.cause().getMessage()));
        } else {
          final String deploymentID = result.result();
          context.execute(new Action<String>() {
            @Override
            public String perform() {
              deployments.put(node, message.body().copy().putString("id", deploymentID).encode());
              return deploymentID;
            }
          }, new Handler<AsyncResult<String>>() {
            @Override
            public void handle(AsyncResult<String> result) {
              message.reply(new JsonObject().putString("status", "ok").putString("id", deploymentID));
            }
          });
        }
      }
    });
  }
private void doDeployModule ( final Message < JsonObject > message ) { String moduleName = message . body ( ) . getString ( "module" ) ; if ( moduleName == null ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , "No module name specified." ) ) ; return ; } JsonObject config = message . body ( ) . getObject ( "config" ) ; if ( config == null ) { config = new JsonObject ( ) ; } int instances = message . body ( ) . getInteger ( "instances" , 1 ) ; platform . deployModule ( moduleName , config , instances , new Handler < AsyncResult < String > > ( ) { @ Override public void handle ( AsyncResult < String > result ) { if ( result . failed ( ) ) { message . reply ( new JsonObject ( ) . putString ( "status" , "error" ) . putString ( "message" , result . cause ( ) . getMessage ( ) ) ) ; } else { final String deploymentID = result . result ( ) ; context . execute ( new Action < String > ( ) { @ Override public String perform ( ) { deployments . put ( node , message . body ( ) . copy ( ) . putString ( "id" , deploymentID ) . encode ( ) ) ; return deploymentID ; } } , new Handler < AsyncResult < String > > ( ) { @ Override public void handle ( AsyncResult < String > result ) { message . reply ( new JsonObject ( ) . putString ( "status" , "ok" ) . putString ( "id" , deploymentID ) ) ; } } ) ; } } } ) ; }
Deploys a module