Package org.openhab.model.item.binding

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


  public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException {
    String target = bindingConfig;
   
    String[] configParts = target.split("#");
    if (configParts.length != 2) {
      throw new BindingConfigParseException("WoL configuration must contain two parts (ip and macaddress separated by a '#'");
    }
   
    WolBindingConfig wolBindingConfig = new WolBindingConfig();
    wolBindingConfig.address = getInetAdress(configParts[0]);
    wolBindingConfig.macBytes = getMacBytes(configParts[1]);
View Full Code Here

 
  private static InetAddress getInetAdress(String ipStr) throws BindingConfigParseException {
     try {
      return InetAddress.getByName(ipStr);
    } catch (UnknownHostException e) {
      throw new BindingConfigParseException("couldn't parse ipaddress [" + ipStr + "]");
    }   
  }
View Full Code Here

     
        byte[] bytes = new byte[6];
        String[] hex = macStr.split("(\\:|\\-)");
       
        if (hex.length != 6) {
            throw new BindingConfigParseException("Invalid MAC address [macStr=" + macStr + "]");
        }
       
      int hexIndex = 0;
     
        try {
            for (hexIndex = 0; hexIndex < 6; hexIndex++) {
                bytes[hexIndex] = (byte) Integer.parseInt(hex[hexIndex], 16);
            }
        }
        catch (NumberFormatException e) {
            throw new BindingConfigParseException("Invalid hex digit in MAC address [digit=" + hex[hexIndex]);
        }
       
        return bytes;
    }
View Full Code Here

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

   
    DigitalSTROMBindingConfig configItem = new DigitalSTROMBindingConfig();
    configItem.init(item, bindingConfig);
   
    if (!configItem.isValid()) {
      throw new BindingConfigParseException("itemType mismatch ... wrong item:"+item.getName()+" for digitalstrom hardware");
    }
    return configItem;
  }
View Full Code Here

        DigitalSTROMBindingConfigEnum configKey = null;
        String keyStr= pairs[0].trim();
        String valueStr = pairs[1].trim();
        configKey = parseKey(keyStr);
        if(configKey==null)
          throw new BindingConfigParseException("ERROR in item: "+item.getName()+" configuration: key is NULL");
        if(valueStr.equals(""))
          throw new BindingConfigParseException("ERROR in item: "+item.getName()+" configuration: value is NULL");
        else
          parseValue(configKey, valueStr);
      }
      else {
        throw new BindingConfigParseException("ERROR in item: "+item.getName()+" configuration: you have used the symbol ':' more than one time ");
      }
    }
  }
View Full Code Here

    DigitalSTROMBindingConfigEnum configKey=null;
    try {
      configKey = DigitalSTROMBindingConfigEnum.valueOf(keyStr);
    } catch (Exception e) {
      logger.error("UNKNOWN key in item configuration: "+keyStr);
      throw new BindingConfigParseException("ERROR in item: "+item.getName()+" UNKNOWN configuration: "+keyStr);
    }
    return configKey;
  }
View Full Code Here

   */
  @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

    OpenEnergyMonitorBindingConfig config = new OpenEnergyMonitorBindingConfig();

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

    if (configParts.length > 2) {
      throw new BindingConfigParseException(
          "Open Energy Monitor binding must contain 1-2 parts separated by ':'");
    }

    config.variable = configParts[0].trim();
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.