// same code as above!
 @Override
 public void checkAllHardwareStopped() throws HardwareException {
   Module mainModule = (Module) lookup.getComponentByName("main");
   if (mainModule == null) {
     throw new IllegalArgumentException("no component named main!");
     // TODO log ? or error
   }
   final MutableReference<HardwareException> excList = new MutableReference<>();
   mainModule.proceduralWalk(
       configurable -> {
         if (configurable instanceof HardwareController) {
           try {
             ((HardwareController) configurable).checkStopped();
           } catch (HardwareException e) {
             excList.reference =
                 new HardwareException(
                     configurable.toString() + "not stopped ", e, excList.reference);
           }
         }
       },
       null);
   /* */
   if (excList.reference != null) {
     throw excList.reference;
   }
 }
  /**
   * invoke a <TT>checkHardware</TT> on all <TT>HardwareController</TT> (except when return diag
   * modifies the path of invocation)
   *
   * @throws HardwareException a list of HardwareException
   */
  @Override
  public void checkHardware() throws HardwareException {
    Module mainModule = (Module) lookup.getComponentByName("main");
    if (mainModule == null) {
      throw new IllegalArgumentException("no component named main!");
      // TODO log ? or error
    }
    final MutableReference<HardwareException> excList = new MutableReference<>();
    mainModule.treeWalk(
        configurable -> {
          if (configurable instanceof HardwareController) {
            try {
              return ((HardwareController) configurable).checkHardware();
            } catch (HardwareException e) {
              excList.reference =
                  new HardwareException(
                      configurable.toString() + " fails check", e, excList.reference);
              // todo: not correct: what if not fatal and we still want to return Handler-children
              if (e.isFatal()) {
                return TreeWalkerDiag.STOP;
              }
            }
          }
          return TreeWalkerDiag.GO;
        },
        null);
    /*

    */
    if (excList.reference != null) {
      throw excList.reference;
    }
  }
 /** forwards a HALT signal to all components (that are signalHandlers) */
 @org.lsst.ccs.command.annotations.Command(description = "halt", type = SIGNAL)
 @Override
 public void abort() {
   super.abort();
   Module mainModule = (Module) lookup.getComponentByName("main");
   if (mainModule == null) {
     throw new IllegalArgumentException("no component named main!");
     // TODO log ? or error
   }
   mainModule.percolateSignal(new Signal(SignalLevel.HALT));
 }
 /** forwards a STOP signal to all components (that are signalHandlers) */
 @org.lsst.ccs.command.annotations.Command(
     description = "stops with expected max delay",
     type = ACTION)
 @Override
 public void stop(long expectedMaxDelay) throws HardwareException {
   super.stop(expectedMaxDelay);
   Module mainModule = (Module) lookup.getComponentByName("main");
   if (mainModule == null) {
     throw new IllegalArgumentException("no component named main!");
     // TODO log ? or error
   }
   mainModule.percolateSignal(new Signal(SignalLevel.STOP, expectedMaxDelay));
 }
  /**
   * utility method to find a Component out of a Command destination
   *
   * @param commandDestination
   * @return
   */
  protected Configurable getCommandDestination(String commandDestination) {
    Configurable configurable = null;
    String configurableName = "main";

    if (commandDestination.contains("/")) {
      configurableName = commandDestination.substring(commandDestination.indexOf("/") + 1);
    }
    configurable = (Configurable) lookup.getComponentByName(configurableName);
    if (configurable == null) {
      throw new IllegalArgumentException(
          " no such configurable " + configurableName + " for command destination");
    }
    return configurable;
  }