Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[caldav] add oauth #2

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2880f2b
add oauth
querdenker2k Nov 2, 2016
49fd1d5
Change default retention policy name to "autogen" (documentation have…
theoweiss Nov 5, 2016
ecb631c
[Mqttitude] Add the 1.9 binding to the OH2 distro (#4743)
smar000 Nov 5, 2016
aaeb775
Fixed some typos in jdbc log messages. (#4746)
9037568 Nov 5, 2016
ff47fc2
Update PAN08 (#4750)
cdjackson Nov 6, 2016
225f48a
fix NPE with events which not have a summary
querdenker2k Nov 6, 2016
824d75a
Fatek PLC binding (#2784)
slawekjaranowski Nov 7, 2016
522a086
Zwave database (#4755)
cdjackson Nov 8, 2016
66ff3ef
FatekPLC typo in feature name. (#4754)
slawekjaranowski Nov 9, 2016
20d3a99
ZWave SECURITY command class - merge to master (#4756)
cdjackson Nov 9, 2016
cdb0ee3
2583 UPB Binding (#3883)
cvanorman Nov 10, 2016
4ac083e
added necessary information to make jointspace binding available as a…
Lenzebo Nov 10, 2016
2adc16f
Fix ZW6302 definition (#4760)
cdjackson Nov 10, 2016
fd10956
[fatekplc] Documentation moved to wiki page (#4763)
slawekjaranowski Nov 11, 2016
1637de8
[http] Allow all item types to receive updates (#4761)
watou Nov 11, 2016
487e9ef
correction of issue #4764 (#4767)
aschor Nov 12, 2016
e0b815e
[samsungac] Allow port to be specified in cfg other than default 2878…
watou Nov 15, 2016
5e0803d
xpl binding: add Contact item type (#4776)
thefrip Nov 15, 2016
ecb13b8
Changing 'user' and 'password' to optional parameters in PaperUI (#4784)
lewie Nov 16, 2016
87dd8b9
[garadget] add config metadata (#4789)
watou Nov 17, 2016
1662679
Duplicate message check was being applied to broadly; changed logic t…
dbadia Nov 17, 2016
cc011cd
Bump jdbc postgressql 9.4 version to 1212 (#4780)
jotihojr Nov 17, 2016
797857d
Updated OH1 JDBC to allow databases with no username and password. (#…
9037568 Nov 18, 2016
b4f5a08
[GCal] updated authorization and Calendar API (#4741)
SirAd Nov 19, 2016
f1ed25a
[dynamodb] AWS SDK update to 1.11.56 (#4796)
ssalonen Nov 19, 2016
c374052
[Plugwise] Reliability improvements (#4797)
wborn Nov 20, 2016
a4e3edf
dsmr service-id org.openhab.dsmr
watou Nov 21, 2016
63e93a6
ecobee service-id org.openhab.ecobee
watou Nov 21, 2016
59c0246
garage service-id org.openhab.garadget
watou Nov 21, 2016
728c2a5
gpio service-id org.openhab.gpio
watou Nov 21, 2016
23b659c
onewire service-id org.openhab.onewire
watou Nov 21, 2016
3aadf9c
plugwise service-id org.openhab.plugwise
watou Nov 21, 2016
8641c8c
powermax service-id org.openhab.powermax
watou Nov 21, 2016
c4d00c1
added service id to binding configuration description (#4804)
kaikreuzer Nov 21, 2016
86011af
Waterkotte Ecotouch heatpump binding for OH2 (#4786)
sibbi77 Nov 22, 2016
8ea62f9
adding discovery to the harmony hub binding (#4813)
digitaldan Nov 23, 2016
8d9ae5b
Added another ID for Trane Thermostat (#4807)
identify3d-joe Nov 23, 2016
ba60275
Add UPB binding to OH2, Fixes #4811 (#4814)
watou Nov 24, 2016
4002e03
Fix IllegalArgumentException with ColorItem MapDB persistence (#4815)
wborn Nov 24, 2016
4979e27
allow newline and tab inside of dmx config (#4802)
J-N-K Nov 24, 2016
20f2e3b
adds DPT 6 / Signed 8bit (feature request #4095) and unit tests (#4805)
J-N-K Nov 24, 2016
fa829ec
rfxcom correct some message length errors detected by the rfxcom test…
ivanfmartinez Nov 25, 2016
0048a5c
moved exec binding to the legacy add-ons (#4816)
kaikreuzer Nov 26, 2016
8c00cb4
[garadget] stop command is actually stopped (#4829)
watou Nov 27, 2016
55d7c42
merge PR #4157
9037568 Nov 27, 2016
88ed367
support for new interface message firmware >= 1001 (#4201)
ivanfmartinez Nov 27, 2016
3aba708
Improved the handling of incorrect device id's instead of sillently i…
martinvw Nov 27, 2016
0d854ae
Update ZW120 (#4832)
cdjackson Nov 27, 2016
c6d9f8e
add oauth
querdenker2k Nov 2, 2016
3c9d2e4
fix NPE with events which not have a summary
querdenker2k Nov 6, 2016
f23c065
code review result
querdenker2k Nov 28, 2016
539dd70
Merge remote-tracking branch 'origin/oauth-caldav' into oauth-caldav
querdenker2k Nov 28, 2016
3915610
code review result
querdenker2k Nov 28, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ private CalDavQuery getQueryForConfig(CalDavConfig config) {
query.setFilterCategory(config.getFilterCategory());
return query;
}

private synchronized void updateItem(String itemName, CalDavConfig config, List<CalDavEvent> events) {
if (config.getType() == Type.PRESENCE) {
List<CalDavEvent> subList = getActiveEvents(events);
Expand Down Expand Up @@ -290,6 +291,10 @@ private synchronized void updateItem(String itemName, CalDavConfig config, List<
String startEnd2 = DF.print(event.getStart()) + " - " + DF.print(event.getEnd());
String name = event.getName();
command = new StringType(name + " @ " + startEnd2);
break;
case CALENDAR:
command = new StringType(event.getCalendarId());
break;
}

logger.debug("sending command {} for item {}", command, itemName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@
public class CalDavBindingProviderImpl extends AbstractGenericBindingProvider implements CalDavBindingProvider {
private static final Logger logger = LoggerFactory.getLogger(CalDavBindingProviderImpl.class);

private static final String REGEX_CALENDAR = "calendar:'?([A-Za-z-_]+(, ?[A-Za-z-_]+)*)'?";
private static final String REGEX_CALENDAR = "calendar:'?([A-Za-z0-9-_]+(, ?[A-Za-z0-9-_]+)*)'?";
private static final String REGEX_TYPE = "type:'?([A-Za-z]+)'?";
private static final String REGEX_EVENT_NR = "eventNr:'?([0-9]+)'?";
private static final String REGEX_EVENT_NR = "eventNr:'?([0-9]+)'?";
private static final String REGEX_VALUE = "value:'?([A-Za-z]+)'?";
private static final String REGEX_FILTER_NAME = "filter-name:'?([A-Za-z\\.\\*\\+\\- \\|]+)'?";
private static final String REGEX_FILTER_NAME = "filter-name:'?([\\p{L}\\.\\*\\+\\- \\|]+)'?";
private static final String REGEX_FILTER_CATEGORY = "filter-category:'?([A-Za-z-_]+(, ?[A-Za-z-_]+)*)'?";

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -93,7 +93,7 @@ public void processBindingConfiguration(String context, Item item, String bindin
calendar.add(str.trim());
}
}

String type = CalDavBindingProviderImpl.getConfigValue(bindingConfig, REGEX_TYPE);
Type typeEnum = null;
String eventNr = CalDavBindingProviderImpl.getConfigValue(bindingConfig, REGEX_EVENT_NR);
Expand All @@ -107,8 +107,8 @@ public void processBindingConfiguration(String context, Item item, String bindin
filterCategory.add(str.trim());
}
}
logger.trace("found values: calendar={}, type={}, eventNr={}, value={}, filterName={}, filterCategory={}",

logger.trace("found values: calendar={}, type={}, eventNr={}, value={}, filterName={}, filterCategory={}",
calendar, type, eventNr, value, filterName, filterCategory);

if (calendar == null || calendar.size() == 0) {
Expand Down Expand Up @@ -149,11 +149,10 @@ public void processBindingConfiguration(String context, Item item, String bindin
}

logger.debug("adding item: {}", item.getName());
this.addBindingConfig(item, new CalDavConfig(
calendar, typeEnum, NumberUtils.toInt(eventNr == null ? "0" : eventNr), valueEnum, filterName, filterCategory)
);
this.addBindingConfig(item, new CalDavConfig(calendar, typeEnum,
NumberUtils.toInt(eventNr == null ? "0" : eventNr), valueEnum, filterName, filterCategory));
}

public static String getConfigValue(String input, String regex) {
Matcher matcher = Pattern.compile(regex).matcher(input);
if (matcher.find()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
package org.openhab.binding.caldav_personal.internal;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import org.apache.commons.lang.ArrayUtils;
import org.openhab.core.binding.BindingConfig;

/**
Expand All @@ -37,7 +35,8 @@ public static enum Value {
START,
END,
TIME,
NAMEANDTIME
NAMEANDTIME,
CALENDAR
}

private final List<String> calendar;
Expand All @@ -46,9 +45,9 @@ public static enum Value {
private final Value value;
private final String filterName;
private final List<String> filterCategory = new ArrayList<String>();
public CalDavConfig(List<String> calendar, Type type, int eventNr,
Value value, String filterName, List<String> filterCategory) {

public CalDavConfig(List<String> calendar, Type type, int eventNr, Value value, String filterName,
List<String> filterCategory) {
this.calendar = calendar;
this.type = type;
this.eventNr = eventNr;
Expand Down Expand Up @@ -76,77 +75,82 @@ public Value getValue() {
public String getFilterName() {
return filterName;
}

public List<String> getFilterCategory() {
return filterCategory;
}

@Override
public String toString() {
return "CalDavPresenceConfig [calendar=" + calendar + ", type=" + type
+ ", eventNr=" + eventNr + ", value=" + value + ", filterName=" + filterName + "]";
return "CalDavPresenceConfig [calendar=" + calendar + ", type=" + type + ", eventNr=" + eventNr + ", value="
+ value + ", filterName=" + filterName + "]";
}

@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((calendar == null) ? 0 : calendar.hashCode());
result = prime * result + ((calendar == null) ? 0 : calendar.hashCode());
result = prime * result + eventNr;
result = prime * result
+ ((filterCategory == null) ? 0 : filterCategory.hashCode());
result = prime * result
+ ((filterName == null) ? 0 : filterName.hashCode());
result = prime * result + ((filterCategory == null) ? 0 : filterCategory.hashCode());
result = prime * result + ((filterName == null) ? 0 : filterName.hashCode());
result = prime * result + ((type == null) ? 0 : type.hashCode());
result = prime * result + ((value == null) ? 0 : value.hashCode());
return result;
}

@Override
public boolean equals(Object obj) {
if (this == obj)
if (this == obj) {
return true;
if (obj == null)
}
if (obj == null) {
return false;
if (getClass() != obj.getClass())
}
if (getClass() != obj.getClass()) {
return false;
}
CalDavConfig other = (CalDavConfig) obj;
if (calendar == null) {
if (other.calendar != null)
if (other.calendar != null) {
return false;
} else if (!calendar.equals(other.calendar))
}
} else if (!calendar.equals(other.calendar)) {
return false;
if (eventNr != other.eventNr)
}
if (eventNr != other.eventNr) {
return false;
}
if (filterCategory == null) {
if (other.filterCategory != null)
if (other.filterCategory != null) {
return false;
} else if (!filterCategory.equals(other.filterCategory))
}
} else if (!filterCategory.equals(other.filterCategory)) {
return false;
}
if (filterName == null) {
if (other.filterName != null)
if (other.filterName != null) {
return false;
} else if (!filterName.equals(other.filterName))
}
} else if (!filterName.equals(other.filterName)) {
return false;
if (type != other.type)
}
if (type != other.type) {
return false;
if (value != other.value)
}
if (value != other.value) {
return false;
}
return true;
}

public int getUniqueEventListKey() {
final int prime = 31;
int result = 1;
result = prime * result
+ ((calendar == null) ? 0 : calendar.hashCode());
result = prime * result
+ ((filterCategory == null) ? 0 : filterCategory.hashCode());
result = prime * result
+ ((filterName == null) ? 0 : filterName.hashCode());
result = prime * result + ((calendar == null) ? 0 : calendar.hashCode());
result = prime * result + ((filterCategory == null) ? 0 : filterCategory.hashCode());
result = prime * result + ((filterName == null) ? 0 : filterName.hashCode());
return result;
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public abstract class DmxItem implements BindingConfig, DmxStatusUpdateListener

/**
* Create new item based on the provided configuration string.
*
*
* @param itemName
* name for the item
* @param configString
Expand All @@ -85,15 +85,15 @@ public DmxItem(String itemName, String configString, DmxBindingProvider dmxBindi
name = itemName;
bindingProvider = dmxBindingProvider;

Matcher configMatcher = DMX_CONFIG_PATTERN.matcher(configString.trim());
Matcher configMatcher = DMX_CONFIG_PATTERN.matcher(configString.replaceAll("(\\s)+", ""));
if (!configMatcher.matches()) {
throw new BindingConfigParseException(
"DMX Configuration must match pattern: " + configMatcher.pattern().toString());
}

try {

Matcher cmdMatcher = DMX_CMD_PATTERN.matcher(configString.trim());
Matcher cmdMatcher = DMX_CMD_PATTERN.matcher(configString.replaceAll("(\\s)+", ""));
while (cmdMatcher.find()) {

String cmdString = cmdMatcher.group();
Expand Down Expand Up @@ -133,7 +133,7 @@ public DmxItem(String itemName, String configString, DmxBindingProvider dmxBindi

/**
* Extract channel id information from channel configuration string.
*
*
* @param channelString
* string to parse
* @throws BindingConfigParseException
Expand Down Expand Up @@ -210,7 +210,7 @@ private int parseChannelNumber(String input) throws BindingConfigParseException

/**
* Try to execute the provided openHAB command.
*
*
* @param service
* DMXservice.
* @param command
Expand All @@ -220,14 +220,14 @@ private int parseChannelNumber(String input) throws BindingConfigParseException

/**
* Check if the current item wants to be notified of state changes.
*
*
* @return true if status updates are needed.
*/
public abstract boolean isStatusListener();

/**
* Check if an openHAB command has been overridden by a DMX command.
*
*
* @param cmd
* to check
* @return true if there is a DMX command available instead.
Expand All @@ -239,7 +239,7 @@ protected final boolean isRedefinedByCustomCommand(Command cmd) {
/**
* Publish the new state to the event bus, if it was changed since the last
* known value.
*
*
* @param state
* new state.
*/
Expand Down Expand Up @@ -305,7 +305,7 @@ public long getLastUpdateTime() {

/**
* Get the channel for the specified index.
*
*
* @param index
* @return channel number
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<description>The DSMR Binding obtains data from a Dutch smart meter ("Slimme meter" in Dutch) via the P1-port.</description>
<author>Marcel Volaart</author>

<service-id>org.openhab.dsmr</service-id>

<config-description>
<parameter name="port" type="text" required="true">
<label>Serial port</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<description>Monitor and control Ecobee thermostats and their remote sensors using the cloud-based API.</description>
<author>John Cocula</author>

<service-id>org.openhab.ecobee</service-id>

<config-description>
<parameter name="appkey" type="text" required="true">
<label>API Key</label>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<binding:binding id="ecotouch"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:binding="http://eclipse.org/smarthome/schemas/binding/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/binding/v1.0.0 http://eclipse.org/smarthome/schemas/binding-1.0.0.xsd">

<name>Waterkotte EcoTouch Binding</name>
<description>This is the binding for the Waterkotte EcoTouch heatpump.</description>
<author>Sebastian Held</author>
<service-id>org.openhab.ecotouch</service-id>

<config-description>
<parameter name="refresh" type="integer">
<label>Refresh interval (ms)</label>
<description>Data refresh interval in ms.</description>
<default>60000</default>
</parameter>
<parameter name="ip" type="text">
<label>IP address</label>
<description>The IP address of the Waterkotte EcoTouch display unit.</description>
<default></default>
</parameter>
<parameter name="username" type="text">
<label>Username</label>
<description>Username of the display unit.</description>
<default>admin</default>
</parameter>
<parameter name="password" type="text">
<label>Password</label>
<description>Password of the display unit.</description>
<default>wtkadmin</default>
<context>password</context>
</parameter>
</config-description>

</binding:binding>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ source.. = src/main/java/,\
src/main/resources/
bin.includes = META-INF/,\
.,\
OSGI-INF/
OSGI-INF/,\
ESH-INF/
output.. = target/classes/
Loading