If a component should be activated an instance is constructed and that
object is activated.
Let's split the construction and activation logic also if constructor
injection is used.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
* Make sure to always send the correct 'item' member in SSE events.
If a change to item A causes visibility changes to item B, we previously
sent an SSE event for B including the new visibility for B, but included
item and state of A. This leads to client confusion, as it'll update its
internal state for the widget belonging to B with the item state of A.
Make sure to always send the item for B and to omit state in that case.
Closes#690
Signed-off-by: Danny Baumann <dannybaumann@web.de>
* Travis CI: check POM convention
We could use Travis CI to execute some checks in front of the normal
build.
This change adds a check if the POM files follow our POM conventions.
If something fails, it show which files violates the convention and the
command that should be executed to fix the situation.
For example if the base POM file breaks the convention:
At least one POM file breaks the convention, please use sortpom to fix the POM file(s).
modified: pom.xml
You should run the following command in the root directory of your working copy:
mvn com.github.ekryd.sortpom:sortpom-maven-plugin:sort -Dsort.keepBlankLines=true -Dsort.createBackupFile=false -Dsort.predefinedSortOrder=recommended_2008_06
* add sortpom plugin to verify phase
* do not use dependency reduced pom (use scope)
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
The current rule registry implementation provides a configuration for
the "rule reinitialization delay". That configuration is not used by the
rule registry itself but used by the rule engine implementation.
This required the rule engine implementation to contain a special code
path that checks if the injected rule registry is an instance of that
special implementation to access that configuration parameter.
As the configuration is not used by the registry itself, it does not
make sense that it is a configuration of that component.
If the rule engine (at least this special implementation) would like to
use a configurable parameter, it should be part of that specific
component implementation.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
After the bump of Paho from 1.2.0 to 1.2.1 the library enables the https
hostname verification.
This breaks compatibility with current consumers.
Connections cannot be established anymore.
We disable the https hostname verification to keep the old behaviour.
We should add an API so the hostname verification can be enabled if
desired.
This also makes the version 1.2.1 the lower version limit as we need to
use the API to disable the verification internally.
Related to: https://github.com/openhab/openhab-core/issues/815
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
The antlr generator has been downloaded by a specific download maven
plugin at build time.
Instead of calling the plugin goals it would be much simpler to add the
downloaded file to the repository (I assume it has been not possible on
the Eclipse repository before).
Another benefit would be the IDE integration as the IDE does not need to
know if the plugin needs to be executed or not...
The provided antlr generator has been taken from:
http://download.itemis.com/antlr-generator-3.2.0-patch.jar
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
We should not remove entries (so keys) from the map while we are using
the key set (a view) of that map (see JavaDoc: otherwise "results of the
iteration undefined").
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
There is a recommended ordering for all Maven POM files.
See: https://maven.apache.org/developers/conventions/code.html
The POM files has been "fixed" by using the "sortpom-maven-plugin".
The blank lines has been kept to keep the element separation for
readability.
The plugin also fixes indentation etc.
Have a look at: https://github.com/Ekryd/sortpom/wiki
The profile has been set to "recommended_2008_06" that states:
The POM Code Convention that was chosen by Maven developers in 2008
Command that has been executed:
mvn \
com.github.ekryd.sortpom:sortpom-maven-plugin:sort \
-Dsort.keepBlankLines=true \
-Dsort.predefinedSortOrder=recommended_2008_06
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
The singleton instance of "Diagnostician" is used without
synchronization.
The singleton "Diasnostician" instance is using the singleton
"EValidator.Registry" instance (without synchronization).
In very rare high load situations there has been CME detected.
My first "solution" has been to synchronize the access of
Diagnostician's instance method by using
```java
synchronized (Diagnostician.INSTANCE) {
...
```
But after realize that EMF is using internally other singletons I tried
to find any information about EMF and thread safety.
I found this one: https://javahacks.net/2016/07/13/emf-thread-safety/
EMF models are not thread-safe by default and writing multithreaded
applications is not that simple.
The more complex our application became, the more often we got
concurrent modification exceptions and had problems with filtering and
sorting operations.
So, I assume instead of adding synchronizations to our code that is
using EMF (IIRC this has been already done on the ESH hosted code base
long time ago) we should try to execute EMF code in a safe manner.
This implementation adds a "SafeEMF" OSGi service that should be used to
execute EMF code to ensure none code of EMF (or at least the ones that
calls has been migrated to the SafeEMF usage) is accessed by separate
threads at the same time.
Related to: https://github.com/openhab/openhab-core/issues/772
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
The member variable "compositeFactory" that holds the
"CompositeModuleHandlerFactory" instance is set in the activation method
by calling the constructor of of "CompositeModuleHandlerFactory".
This reference is destroyed and unset in the deactivate method.
There exists DS managed multiple optional references to
"ModuleHandlerFactory".
The "add" logic does not touch the "compositeFactory" variable.
The "remove" logic checks if the given service reference is a
"CompositeModuleHandlerFactory" and unsets the "compositeFactory" member
variable.
If e.g. a module handler factory is injected that also implements the
CompositeModuleHandlerFactory the CompositeModuleHandlerFactory created
by the activate method is still be used. If that specific module handler
factory is removed again, the variable "compositeFactory" is unset and
there is NO CompositeModuleHandlerFactory present anymore.
There are two options:
* The instance created in the activate method should be used as long as
no other one is injected.
* The instance created in the activate method should be used all the
time.
The whole code base does not contain another specific implementation for
CompositeModuleHandlerFactory, so there is no (at least in openHAB Core)
change that a CompositeModuleHandlerFactory is injected.
So instead of adding a non deterministic usage of "some" composite
module handler factory (which will require a fix of the "set module
handler factory method" and some others), let's drop the buggy code in
the "remove module handler factory" and use the manually created
composite module handler factory all the time.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
There workaround for a servlet implementation lower then 3 can be removed.
After we migrated from ESH to openHAB Core we could set servlet >= 3 as a requirement.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
We should disable the compression regardless if servlet 3 is used or
not. It does not matter which servlet version is used, the client should
receive the messages as soon as possible without compression or
buffering.
You can identify the lost SSE feature as soon as you enable the usage of
Jetty's GzipHandler.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
Currently, the scripts are loaded based on the lexicographical order of
the absolute paths of the scripts. This makes it difficult to control
the load order. This change bases the load order solely on the filename,
as was originally used before
https://github.com/eclipse/smarthome/pull/3855, and preserves the
ability to use scripts with the same filename.
Signed-off-by: Scott Rushworth <openhab@5iver.com>
This fixes the following warnings on Jenkins builds:
[WARNING] Failed to getClass for org.apache.maven.plugins.source.SourceJarMojo
See also: https://issues.jenkins-ci.org/browse/JENKINS-27372
Signed-off-by: Wouter Born <github@maindrain.net>
Added ScriptModuleTypeProvider, which dynamically adds available script
languages to the ParameterOptions used in Paper UI when configuring a
ScriptAction or ScriptCondition.
Signed-off-by: Scott Rushworth <openhab@5iver.com>
* channel groups should not require static channels
* Added unit tests
Also-by: Christoph Weitkamp <github@christophweitkamp.de>
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Since Java 9 (JDK-8164428) the maximum resolution from the underlying clock is used.
Instead of just milliseconds the resolution can now even be tenth of microseconds.
According to the Type JavaDocs toFullString() should return the full string representation of the type to be consumed by 'valueOf(String)'.
With the changes in this PR toFullString() may return higher resolution date time strings on newer Java versions and valueOf(value) is able to parse these.
Code depending on a certain resolution returned by toFullString() should use the format(pattern) method instead so the resolution will not change.
Fixes#667
Signed-off-by: Wouter Born <github@maindrain.net>
Improve javadoc by explaining the different defined context values.
I have added "rule", "channel", "channeltype" and "cronexpression" as those are used within the automation module.
The i18n service uses "location" as context value and expects a map to be rendered.
Signed-off-by: davidgraeff <david.graeff@web.de>
A cron trigger module is actually not that "Generic" and a useful trigger type for a lot of rules.
Therefore I suggest to remove the visibility "HIDDEN" with this PR.
I have also added a context "cronexpression" to the TEXT configuration value, so that UI's can offer a cron expression
selection widget.
(we currently have: 'time','item','script','channel','dayOfWeek','rule')
Signed-off-by: davidgraeff <david.graeff@web.de>
Remove inconsistent visibility "PUBLIC". This value is not documented (there is only HIDDEN and VISIBLE) and this is the only module type that uses PUBLIC instead of just not setting this value at all.
Signed-off-by: davidgraeff <david.graeff@web.de>
The change with unit classes parent (#617) causes it to report missing imports of tec.uom.se when using static import. Before the change this was not a problem because the parent class was SmartHomeUnits. This change adds a new parent class for all units.
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
The classes ImperialUnits and SIUnits both extended SmartHomeUnits. But the classes are used a singletons.
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
* handle different possible service PID types
The property value "service.pid" can use different types:
* String
* String[]
* Collection of String
Only "String" has been supported.
https://github.com/openhab/openhab-core/pull/557 adds support for
String[]
https://github.com/openhab/openhab-core/pull/559 removes the support for
String[] again and adds support for the Collection type List only.
This commit ensures that String arrays and every collection type is
supported, regardless which (valid) type is used by the OSGi framework
implementation.
Fixes: https://github.com/eclipse/smarthome/issues/6710
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
This addresses https://github.com/eclipse/smarthome/issues/5099 by adding a command description with command options along with the state description.
Command options will give a hint to UIs about the specific commands a channel provides. Command options could be rendered as a drop down and also represent the current state or rendered as push buttons to simply send a command to the ThingHandler.
The infrstructure basically copies the StateDescription infrastructure with CommandDescriptionProviders and an `DynamicCommandDescriptionProvider` interface for bindings to hook in and provide dynamic command options.
Signed-off-by: Henning Treu <henning.treu@googlemail.com>
The ready marker logic is created to hide the real usage. The ready
marker uses an "identifier" that is not specific or limited to bundles.
Currently the bundle symbolic name is used as bundle identifier.
That "convention" needs to be known at several different places.
There should be one method that created an identifier for a bundle and
"no one" needs to care about the implementation details.
Another point is that the bundle symbolic name that has been used is
optional. It may be null e.g. for bundles that has been installed by the
synthetic bundle installer mechanism etc.
The runtime assigns a bundle ID to an installed bundle that remains the
same for the bundle (see JavaDoc). The bundle ID is present all the
time.
The implementation of the "get identifier for bundle" has been choosen
to use the BSN -- if available -- (as before) but fallback to a custom
one using also the bundle ID (to be unique).
So we can provide always a non null identifier for a bundle.
It should be easily to change the identifier creation now if there is
every any need for.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
If a bundle misses a BSN the bundle cannot be installed.
We should provide a method to uninstall the bundle that has been created
by the synthetic installer itself.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
For better differentiation between different USB devices `UsbSerialDiscoveryService` is extended to add `usb_vendor_id` and `usb_product_id` properties to every thing which represents USB device.
Also-by: YordanDZhelev <zhelev.yordan@gmail.com>
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* tests: run pure JUnit tests (bugfix), add MapDB tests (migrated to JUnit)
* remove project specific JDT settings
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
The `MapDbStorageService` calls the constructor with a `null`
classloader if there has been no one supplied.
Signed-off-by: Markus Rathgeb <maggu2810@gmail.com>
* updated license headers
* added NOTICE files
* moved about.html to NOTICE files
* changed main project license
* updated build.properties
* added files to check to prevent error about missing about.html
* removed license info on p2 feature
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* Added semantic labels to tags Floors, Rooms and objects
* Added a Cellar as a Floor
* Added support for more languages which where already available as translation
* Integrated the webpack build inside Maven
* Only allow minor updates in the package.json to make sure new version will not easily break the build, if semver fails again
* Remove dist folder because it should be generated through the build
* Switched from 'hidden-xs-up' to 'd-none' as proposed in bootstrap migration guide
* Switched from 'scope' to 'slot-scope' as suggested by vue 2.5 migration
* Added some additional parents in the vue schema because they were needed
* Removed osgi import from manifest
* Switched to a computed setup and the build in fieldMultiselect
* Switched to a 'computed' setup
* Remove the package fieldMultiselect and switch to the build-in
* Applied changes from review.
* Formatted JS files
* Re-introduced (customized) fieldMultiselect and minor fixes
* Re-introduce custom multiselect because this is the one that offers the icons
* Add the floor name to the label of room-based object selector
* Make sure that generating tags can be switched off
* Switched from floor-count to choosing custom floors
* Add no-save and corrected some js warnings
Signed-off-by: Martin van Wingerden <martin@martinvw.nl>
* temporarily remove ui.start bundle from distro again
* correctly unregister services again
* also unset the handlerRef field
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* Introduced new ui.start bundle, which brings custom lifecycle status HTTP pages as well as an 404 error page.
Signed-off-by: Kai Kreuzer <kai@openhab.org>
Applies the POM Code Covention as used in OH2/ESH projects.
See also: https://maven.apache.org/developers/conventions/code.html
The executed command is:
mvn \
com.github.ekryd.sortpom:sortpom-maven-plugin:sort \
-Dsort.keepBlankLines=true \
-Dsort.predefinedSortOrder=recommended_2008_06
Signed-off-by: Wouter Born <eclipse@maindrain.net>
The constructors of DecimalType in ESH use BigDecimal.valueOf instead of new BigDecimal. Using valueOf is better because the new constuctors causes undesired rounding. For example the value 0.32 becomes: 0.320000000000000006661338147750939242541790008544921875. With valueOf this doesn't happen.
This change will make it work the same as the ESH DecimalType
Closes#371
Signed-off-by: Hilbrand Bouwkamp <hilbrand@h72.nl>
* New translations dashboard.properties (Czech)
* New translations en-UK.json (Czech)
* New translations dashboard.properties (Hungarian)
* New translations en-UK.json (Hungarian)
* New translations dashboard.properties (Hebrew)
* New translations dashboard.properties (Hebrew)
* New translations en-UK.json (Hebrew)
* New translations en-UK.json (Hebrew)
* New translations dashboard.properties (Hebrew)
* New translations en-UK.json (Hebrew)
* New translations dashboard.properties (Hebrew)
* New translations dashboard.properties (Russian)
* New translations dashboard.properties (Polish)
* New translations dashboard.properties (Tagalog)
* New translations dashboard.properties (Turkish)
* New translations dashboard.properties (Czech)
* New translations dashboard.properties (Hungarian)
* New translations dashboard.properties (Hebrew)
* New translations dashboard.properties (Dutch)
* New translations dashboard.properties (French)
* New translations dashboard.properties (German)
* replace ESH p2 update site dependency by plain Maven dependencies
* added special dependencies for core bundles
* added dependencies to feature projects as well
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This specifically makes the QuantityType backward compatible and makes it treated as a simple DecimalType in any 1.x add-ons, such as specifically the persistence services.
Signed-off-by: Kai Kreuzer <kai@openhab.org>
- using an ESH release build (0.10.0.b1)
- added ESH release p2 repos for release builds
- removed targetplatform, which afaics isn't used at all anymore
Signed-off-by: Kai Kreuzer <kai@openhab.org>
- wait for config update when online status has changed
- removed static methods and logger
- proper handling of "minimal" feature
- introduced a sync job that checks if everything is installed as expected (which serves as a retry mechanism in case of failed downloads)
fixes https://github.com/openhab/openhab-distro/issues/602
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* Updates some overlooked Classic UI icons to the new logo
* Updates the Home Builder favicon to the new logo
Signed-off-by: Wouter Born <eclipse@maindrain.net>
openHAB Home Builder - home structure generator
Also-by: Thomas Dietrich <thomas.dietrich@tu-ilmenau.de> (github: ThomDietrich)
Also-by: Demyan Rogozhin <dmitriy.rogozhin@gmail.com> (github: demyanrogozhin)
Signed-off-by: Kuba Wolanin <hi@kubawolanin.com> (github: kubawolanin)
* Use new icon in REST docs (Fixes#232)
* Use updated favicon in Paper UI
* Update logo in dashboard tiles
Signed-off-by: Wouter Born <eclipse@maindrain.net>
- upgraded to Java 8
- reduced calls to listInstalledFeatures, which is very expensive
- properly do the calculation of current/target/diff list of addons, when the config changes
- don't log errors when uninstallation fails as this can happen if it is a dependent feature that must not be uninstalled
Signed-off-by: Kai Kreuzer <kai@openhab.org>
- included ESH-INF to binary
- simplified getLocalizedText method as it was now only called with a null locale
Signed-off-by: Kai Kreuzer <kai@openhab.org>
The ESH PR 4291 introduced a change in the ChartProvider API.
This commit changes the compat1x ChartProviderDelegate to work with these changes.
Signed-off-by: Holger Reichert <mail@h0lger.de>
This should avoid potential circular dependencies at startup as the dashboard tile does not depend on HttpService anymore.
Signed-off-by: Kai Kreuzer <kai@openhab.org>
There is now a line with an absolute Url using the primary IPv4 interface about where openHAB is accessible (both for http & https).
Signed-off-by: Kai Kreuzer <kai@openhab.org>
- replaced minimal package by skip button
- added background images for packages
- added spinner in case of empty Dashboard
Signed-off-by: Kai Kreuzer <kai@openhab.org>
* adapted FeatureInstaller to adapt addons info in ConfigAdmin, so that this info is stored in a file
* removed experimental features
* removed package selection from UI as it is meant to be only set once
* introduced new packages: minimal, simple and expert
* introduced a setup page on the dashboard, if no package is set (and thus openHAB is uninitialized)
* added auto-refresh of dashboard to have new entries appear automatically
Signed-off-by: Kai Kreuzer <kai@openhab.org>
This allows group items who are not exactly the same base item to be included in logic operations, for example a dimmer can now be included in a group switch item.