Example #1
0
  /**
   * Lookups customBlock by executable class. If block does not exist in cache - creates instance
   * and init. it.
   *
   * @param entity
   * @return
   * @throws FlowInitializationException
   */
  CustomBlock lookupBlock(CustomNode entity) throws FlowInitializationException {

    long start = System.currentTimeMillis();

    if (entity.getExecutableClass() == null) {
      throw new FlowInitializationException(
          "ExecutableClass not defined for CustomNode " + entity.getName());
    }

    CustomBlock block = null;

    if (customBlockInitStrategy == null) {
      block = defaultInitStrategy.loadCustomBlock(entity.getExecutableClass());

    } else {
      block = customBlockInitStrategy.loadCustomBlock(entity.getExecutableClass());
    }

    block.init();

    Logger.debug(
        this,
        "CustomBlock {} loaded and initialized in {} ms",
        entity.getExecutableClass(),
        System.currentTimeMillis() - start);

    return block;
  }
Example #2
0
 Class<? extends CustomBlock> getCustomBlockClass(CustomNode entity)
     throws FlowInitializationException {
   return defaultInitStrategy.getCustomBlockClass(entity.getExecutableClass());
 }