Package org.openhab.model.item.binding

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


      throws BindingConfigParseException {
    switch (config.getDeviceType()) {
    case PAIR_MODE:
    case LISTEN_MODE:
      if (!(item instanceof SwitchItem))
        throw new BindingConfigParseException(
            "Invalid item type. PairMode/ListenMode can only be a switch");
      else if (config.getFeature() == MaxCulFeature.RESET
          && !(item instanceof SwitchItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'reset' can only be a Switch");
      break;
    case PUSH_BUTTON:
    case SHUTTER_CONTACT:
      if (config.getFeature() == MaxCulFeature.BATTERY
          && !(item instanceof SwitchItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'battery' can only be a Switch");
      else if (config.getFeature() == MaxCulFeature.SWITCH
          && !(item instanceof SwitchItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'switch' can only be a Switch");
      else if (config.getFeature() == MaxCulFeature.RESET
          && !(item instanceof SwitchItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'reset' can only be a Switch");
      break;
    case RADIATOR_THERMOSTAT:
    case RADIATOR_THERMOSTAT_PLUS:
    case WALL_THERMOSTAT:
      if (config.getFeature() == MaxCulFeature.TEMPERATURE
          && !(item instanceof NumberItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'temperature' can only be a Number");
      else if (config.getFeature() == MaxCulFeature.VALVE_POS
          && !(item instanceof NumberItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'valvepos' can only be a Number");
      else if (config.getFeature() == MaxCulFeature.THERMOSTAT
          && !((item instanceof NumberItem) || (item instanceof SwitchItem)))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'thermostat' can only be a Number or a Switch");
      else if (config.getFeature() == MaxCulFeature.BATTERY
          && !(item instanceof SwitchItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'battery' can only be a Switch");
      else if (config.getFeature() == MaxCulFeature.MODE
          && !(item instanceof NumberItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'mode' can only be a Number");
      else if (config.getFeature() == MaxCulFeature.RESET
          && !(item instanceof SwitchItem))
        throw new BindingConfigParseException(
            "Invalid item type. Feature 'reset' can only be a Switch");
      break;
    default:
      throw new BindingConfigParseException(
          "Invalid config device type. Wasn't expecting "
              + config.getDeviceType());
    }
  }
View Full Code Here


        configLine = removeLastBrakets(configLine);
        String[] entries = configLine.trim().split("[,]");
        for (String entry : entries) {
            String[] entryParts = entry.trim().split("[=]");
            if (entryParts.length != 2) {
                throw new BindingConfigParseException("Each entry must have a key and a value");
            }
            String key = entryParts[0];
            String value = entryParts[1];
            value = removeFirstQuotes(value);
            value = removeLastQuotes(value);
View Full Code Here

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

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

  /**
   * @{inheritDoc
   */
  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 Number- and StringItems are allowed - please check your *.items configuration");
View Full Code Here

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

      String pollingIntervalString = null;

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

      if (configParts.length != 3) {
        throw new BindingConfigParseException(
            "RME binding must contain three parts separated by ':'");
      }

      config.serialPort = configParts[0].trim()
      valueSelectorString = configParts[1].trim();
      pollingIntervalString = configParts[2].trim();

      try {

        OceanicValueSelector.validateBinding(valueSelectorString,
            item);

        config.valueSelector = valueSelectorString;
        config.pollingInterval = Integer.parseInt(pollingIntervalString);

        addBindingConfig(item, config);


      } catch (IllegalArgumentException e1) {
        throw new BindingConfigParseException(
            "Invalid value selector '" + valueSelectorString + "'!");

      } catch (InvalidClassException e1) {
        throw new BindingConfigParseException(
            "Invalid item type for value selector '"
                + valueSelectorString + "'!");
      }
    } else {
      logger.warn("bindingConfig is NULL (item=" + item
View Full Code Here

    if (bindingConfig.startsWith("<")) {

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

      if (configParts.length != 2) {
        throw new BindingConfigParseException(
            "RFXCOM binding must contain two parts separated by ':'");
      }

      config.id = configParts[0].trim().replace("<", "");
      config.inBinding = true;
     
      valueSelectorString = configParts[1].trim();
     
    } else if (bindingConfig.startsWith(">")) {
      String[] configParts = bindingConfig.trim().split(":");

      config.id = configParts[0].trim().replace(">", "");
      config.inBinding = false;
     
      String[] types = configParts[1].trim().split("\\.");

      if (types.length != 2) {
        throw new BindingConfigParseException(
            "RFXCOM out binding second field should contain 2 parts separated by '.'");
      }

      try {
        config.packetType = RFXComMessageFactory.convertPacketType(types[0]
            .trim());
      } catch (IllegalArgumentException e) {
        throw new BindingConfigParseException("Invalid packet type '"
            + types[0] + "'!");
      }

      try {
        config.subType = RFXComMessageFactory.getMessageInterface(
            config.packetType).convertSubType(types[1].trim());

      } catch (Exception e) {
        throw new BindingConfigParseException("Invalid sub type '"
            + types[1] + "' in type '" + config.packetType + "'!");
      }

      valueSelectorString = configParts[2].trim();

    } else {
      throw new BindingConfigParseException(
          "RFXCOM binding should start < or > character!");
    }
   
    try {

      RFXComValueSelector.validateBinding(valueSelectorString,
          item.getClass());

      config.valueSelector = RFXComValueSelector
          .getValueSelector(valueSelectorString);

    } catch (IllegalArgumentException e1) {
      throw new BindingConfigParseException(
          "Invalid value selector '" + valueSelectorString + "'!");

    } catch (InvalidClassException e1) {
      throw new BindingConfigParseException(
          "Invalid item type for value selector '"
              + valueSelectorString + "'!");

    }
View Full Code Here

   */
  @Override
  public void validateItemType(Item item, String bindingConfig)
      throws BindingConfigParseException {
    if (!(item instanceof SwitchItem || item instanceof DimmerItem || item instanceof ColorItem)) {
      throw new BindingConfigParseException("Item '" + item.getName()
          + "' is of type '" + item.getClass().getSimpleName()
          + "', which is not supported by the DMX Binding.");
    }
  }
View Full Code Here

    } else if (item instanceof DimmerItem) {
      itemBinding = new DmxDimmerItem(item.getName(), config, this);
    } else if (item instanceof SwitchItem) {
      itemBinding = new DmxSwitchItem(item.getName(), config, this);
    } else {
      throw new BindingConfigParseException("Unsupported item type "
          + item.getClass().getSimpleName());
    }

    if (itemBinding.isStatusListener()) {
View Full Code Here

TOP

Related Classes of org.openhab.model.item.binding.BindingConfigParseException

Copyright © 2018 www.massapicom. 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.