protocols/src/main/java/eu/internetofus/common/protocols/DefaultProtocol.java
/**
   * Load the default protocol definition.
   *
   * @param vertx the event bus to use.
   *
   * @return the future with the task type associated to the protocol.
   */
Load the default protocol definition.
@param vertx the event bus to use.

@return the future with the task type associated to the protocol.
Load the default protocol definition . @param vertx the event bus to use . @return the future with the task type associated to the protocol .
default Future<TaskType> load(final Vertx vertx) {
    return vertx.executeBlocking(promise -> {
      try {
        final var resource = "eu/internetofus/common/protocols/DefaultProtocol_"
            + this.taskTypeId().replaceAll("\\W", "_") + ".json";
        final var input = this.getClass().getClassLoader().getResourceAsStream(resource);
        final var content = IOUtils.toString(input, Charset.defaultCharset());
        final var taskType = Model.fromString(content, TaskType.class);
        promise.complete(taskType);
      } catch (final Throwable cause) {
        promise.fail(new ValidationErrorException(this.taskTypeId(), "Cannot load the protocol.", cause));
      }
    });
  }
default Future < TaskType > load ( final Vertx vertx ) { return vertx . executeBlocking ( promise -> { try { final var resource = "eu/internetofus/common/protocols/DefaultProtocol_" + this . taskTypeId ( ) . replaceAll ( "\\W" , "_" ) + ".json" ; final var input = this . getClass ( ) . getClassLoader ( ) . getResourceAsStream ( resource ) ; final var content = IOUtils . toString ( input , Charset . defaultCharset ( ) ) ; final var taskType = Model . fromString ( content , TaskType . class ) ; promise . complete ( taskType ) ; } catch ( final Throwable cause ) { promise . fail ( new ValidationErrorException ( this . taskTypeId ( ) , "Cannot load the protocol." , cause ) ) ; } } ) ; }
Load the default protocol definition.
Load the default protocol definition .