Examples of BindingConfigParseException


Examples of org.openhab.model.item.binding.BindingConfigParseException

  private void parseAndAddBindingConfig(Item item, String bindingConfig) throws BindingConfigParseException {
    ProtocolBindingConfig newConfig = new ProtocolBindingConfig();
    Matcher matcher = BASE_CONFIG_PATTERN.matcher(bindingConfig);

    if (!matcher.matches()) {
      throw new BindingConfigParseException("bindingConfig '" + bindingConfig + "' doesn't contain a valid binding configuration");
    }
    matcher.reset();

    while (matcher.find()) {
      String bindingConfigPart = matcher.group(1);
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

      Matcher actionMatcher = ACTION_CONFIG_PATTERN.matcher(bindingConfig);
      Matcher statusMatcher = STATUS_CONFIG_PATTERN.matcher(bindingConfig);


      if ((!actionMatcher.matches() && !statusMatcher.matches())) {
        throw new BindingConfigParseException(getBindingType()+
            " binding configuration must consist of four [config="+statusMatcher+"] or five parts [config="
            + actionMatcher + "]");
      } else {
        if(actionMatcher.matches()) {
          direction = actionMatcher.group(1);
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

    Command command = TypeParser.parseCommand(
        item.getAcceptedCommandTypes(), commandAsString);

    if (command == null) {
      throw new BindingConfigParseException("couldn't create Command from '" + commandAsString + "' ");
    }

    return command;
  }
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

  @Override
  public void validateItemType(Item item, String bindingConfig)
      throws BindingConfigParseException {

    if (!(item instanceof SwitchItem || item instanceof DimmerItem)) {
      throw new BindingConfigParseException(
          "Item '"
              + item.getName()
              + "' is of type '"
              + item.getClass().getSimpleName()
              + "', only SwitchItems, DimmerItems and ColorItems are allowed - please check your *.items configuration");
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

  private int parseStepSizeConfigString(String configString)
      throws BindingConfigParseException {
    try {
      return Integer.parseInt(configString);
    } catch (Exception e) {
      throw new BindingConfigParseException(
          "Error parsing step size.");
    }
  }
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

  private int parseDeviceNumberConfigString(String configString)
      throws BindingConfigParseException {
    try {
      return Integer.parseInt(configString);
    } catch (Exception e) {
      throw new BindingConfigParseException(
          "Error parsing device number.");
    }
  }
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

   * @{inheritDoc}
   */
  @Override
  public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
    if (!(item instanceof SwitchItem)) {
      throw new BindingConfigParseException("item '" + item.getName()
          + "' is of type '" + item.getClass().getSimpleName()
          + "', only SwitchItems are allowed - please check your *.items configuration");
    }
  }
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

   * @{inheritDoc
   */
  @Override
  public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException {
    if (!(item instanceof NumberItem || item instanceof StringItem)) {
      throw new BindingConfigParseException(
          "item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName()
          + "', only NumberItem and StringItem are allowed - please check your *.items configuration");
    }
  }
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

    SysteminfoBindingConfig config = new SysteminfoBindingConfig();

    String[] configParts = bindingConfig.trim().split(":");

    if (configParts.length < 2 && configParts.length > 3) {
      throw new BindingConfigParseException("Systeminf binding must contain 2-3 parts separated by ':'");
    }

    String commandType = configParts[0].trim();
   
    try {
      config.commandType = SysteminfoCommandType.getCommandType(commandType)
    } catch (IllegalArgumentException e) {
      throw new BindingConfigParseException("'" + commandType + "' is not a valid command type" );
    }
   
    try {
      config.refreshInterval = Integer.valueOf(configParts[1]);
    } catch (NumberFormatException e) {
      throw new BindingConfigParseException("'" + configParts[1] + "' is not a valid refresh interval" );
    }

    if (configParts.length > 2) {
      config.target = configParts[2].trim();
    }
View Full Code Here

Examples of org.openhab.model.item.binding.BindingConfigParseException

    config.itemType = item.getClass();
   
    Matcher matcher = BASE_CONFIG_PATTERN.matcher(bindingConfig);
   
    if (!matcher.matches()) {
      throw new BindingConfigParseException("bindingConfig '" + bindingConfig + "' doesn't contain a valid binding configuration");
    }
    matcher.reset();
       
    while (matcher.find()) {
      String direction = matcher.group(1);
      String bindingConfigPart = matcher.group(2);
     
      if (direction.equals("<")) {
        config = parseInBindingConfig(item, bindingConfigPart, config);
      }
      else if (direction.equals(">")) {
        // for future use
      }
      else {
        throw new BindingConfigParseException("Unknown command given! Configuration must start with '<' or '>' ");
      }
    }
   
    return config;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.