The document describes the architecture of Dog 2.3, an OSGi-based domotic gateway. It has a core layer with bundles for device management, state monitoring, scheduling, command execution, notifications and an ontology library. It also supports driver bundles and add-on bundles. The core provides REST and XML interfaces and uses an ontology to expose devices uniformly to applications.
5. System Architecture
Mobile, Web, Home Display,
User
User Multi Touch, Accessibility,
Interface
User Natural language, …
Interface
Interface
ERP, Web services, Stream
Data
processors, Datawarehouse
analysis
Device abstraction, Event
Dog abstraction, State
Bundles abstraction, Rules engine, …
Ethernet, Wi-Fi, USB
Bus-to-IP gateway
GW GW Bus-to-serial gateway
Domotic bus (wired, wireless)
Smart Domotic devices (switches,
Applianc D D D D D D D D
buttons, relays, sensors,
e meters, …)
5 Dario Bonino - Dog 2.3 6/18/2012
6. In Ontology We Trust
Devices and networks exposed by means of a
formal, unique, representation
DogOnt (Ontology)
Applications only see DogOnt-based device
descriptions
Functionalities
Notifications
Commands
States
State values
Internal representations and drivers must be
ontology-aware, at different degrees
6 Dario Bonino - Dog 2.3 6/18/2012
10. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
10 Dario Bonino - Dog 2.3 6/18/2012
11. Dog REST EndPoint
DogXMLEndPoint DogRESTEndPoint
Dog REST EndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r Provides REST access to Dog
r r er r
DogAutoStart
Based on JSON or XML messages
DogDeviceFactory
DogSimpleHouseMode
l
DogSemanticHouseModel
Under development
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
11 Dario Bonino - Dog 2.3 6/18/2012
12. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
12 Dario Bonino - Dog 2.3 6/18/2012
13. Dog XML EndPoint
DogXMLEndPoint DogRESTEndPoint
Dog XML EndPoint
DogStateMonito
DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
Provides XML-RPC access to Dog
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
Based on XML messages l
DogSemanticHouseModel
DogOntLibrary Two Way Connection
DogDeviceModel
Client to send notifications
DogConfigurator DogLogger
Server to listen application requests
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
13 Dario Bonino - Dog 2.3 6/18/2012
14. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
14 Dario Bonino - Dog 2.3 6/18/2012
15. DogStateMonitor
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
DogStateMonitor
r r r er r
DogAutoStart
DogSimpleHouseMode
Keeps a snapshot
DogDeviceFactory of the state of all devices l
DogSemanticHouseModel
Allows for state change listener registration
DogOntLibrary DogDeviceModel
Supports state querying
DogConfigurator DogLogger
Typically asynchronous
Synchronous through DogSemanticLibrar
Dog2Library a different interface (API)
DogJaxBLibrary MeasureLibrary org.rxtx
y
15 Dario Bonino - Dog 2.3 6/18/2012
16. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
16 Dario Bonino - Dog 2.3 6/18/2012
17. DogScheduler
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
DogScheduler
r r r er r
DogAutoStart
DogSimpleHouseMode
Allows to schedule
DogDeviceFactory recurring tasks involving l
DogSemanticHouseModel
Command execution (done through the
DogOntLibrary DogDeviceModel
command handling bundles)
State requests (done by reading the current
DogConfigurator DogLogger
device state in dog – not on the network)
Dog2Library DogSemanticLibrar
Notification…?(for what?) y
DogJaxBLibrary MeasureLibrary org.rxtx
17 Dario Bonino - Dog 2.3 6/18/2012
18. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
18 Dario Bonino - Dog 2.3 6/18/2012
19. DogExecutor
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
DogExecutor
r r r er r
DogAutoStart
DogSimpleHouseMode
Dispatches
DogDeviceFactory a command to relative device l
DogSemanticHouseModel
object
DogOntLibrary DogDeviceModel
Performs command validation
Supports message priority
DogConfigurator DogLogger
No
Dog2Library pre-defined priority levels
DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
Higher priority Higher Priority Value in the
corresponding DogMessage
19 Dario Bonino - Dog 2.3 6/18/2012
20. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
20 Dario Bonino - Dog 2.3 6/18/2012
21. DogDeviceManager
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
DogDeviceManager
r r r er r
DogAutoStart
DogSimpleHouseMode
Implements
DogDeviceFactorythe OSGi device manager l
DogSemanticHouseModel
(device access specification)
DogOntLibrary DogDeviceModel
Manages device/driver attachment in Dog
When device/driver are added/modified/removed
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
21 Dario Bonino - Dog 2.3 6/18/2012
22. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
22 Dario Bonino - Dog 2.3 6/18/2012
23. DogNotificationManager
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
DogNotificationManager
r r r er r
DogAutoStart
DogSimpleHouseMode
Implements
DogDeviceFactory the Event Admin Service l
Specification Version 1.2 DogSemanticHouseModel
DogOntLibrary DogDeviceModel
It is based on a event publish and subscribe
model
DogConfigurator DogLogger
Filters inner state change notifications from outer
Dog2Library (visible to applications)
ones DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
Dispatches Notification and State Change
Notifications only
23 Dario Bonino - Dog 2.3 6/18/2012
24. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
24 Dario Bonino - Dog 2.3 6/18/2012
25. DogDeviceFactory
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
DogDeviceFactory DogSemanticHouseModel
l
Creates device istances according to the runtime
DogOntLibraryDogDeviceModel
home configuration
DogConfigurator DogLogger
Either provided by the SimpleHouseModel or by the
Semantic House Model
Dog2Library
DogJaxBLibrary
DogSemanticLibrar
MeasureLibrary org.rxtx
y
25 Dario Bonino - Dog 2.3 6/18/2012
26. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
26 Dario Bonino - Dog 2.3 6/18/2012
27. DogOntLibrary
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogOntLibrary State classes
DogConfigurator State value classes
DogLogger
All possible
Programmatically
Devices (interfaces)
Dog2Library DogSemanticLibrar
DogJaxBLibrary
y generated from org.rxtx
MeasureLibrary
Functionalities DogOnt
classes
27 Dario Bonino - Dog 2.3 6/18/2012
28. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
28 Dario Bonino - Dog 2.3 6/18/2012
29. DogDeviceModel
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogDeviceModel
DogConfigurator DogLogger
All possible
DeviceDogJaxBLibrary
Dog2Library implementations
DogSemanticLibrar
MeasureLibrary org.rxtx
y
29 Dario Bonino - Dog 2.3 6/18/2012
30. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
30 Dario Bonino - Dog 2.3 6/18/2012
31. DogSemanticHouseModel
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
DogSemanticHouseModel l
DogSemanticHouseModel
Manages the home description in form of DogOnt instances
DogOntLibrary DogDeviceModel
Supports configuration requests
Supports model merging
DogConfigurator
Implements classification and basic reasoning DogLogger
Supports interoperation rules extraction
Dog2Library
Potentially provides access to DogSemanticLibrar
all properties/features defined in DogOnt
DogJaxBLibrary MeasureLibrary org.rxtx
y
Can generate XML home configuration to be used by the
SimpleHouseModel
31 Dario Bonino - Dog 2.3 6/18/2012
32. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
32 Dario Bonino - Dog 2.3 6/18/2012
33. DogSimpleHouseModel
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
DogSimpleHouseModel l
DogSemanticHouseModel
Manages the home description in XML
DogOntLibrary DogDeviceModel
Used for Dog instances running on devices with low
computational power
DogConfigurator
No model-merge capabilities DogLogger
No reasoning support
Dog2Library DogSemanticLibrar
If a SemanticHouseModel is present, this bundle automatically org.rxtx
DogJaxBLibrary
y
MeasureLibrary
shuts down
33 Dario Bonino - Dog 2.3 6/18/2012
34. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
34 Dario Bonino - Dog 2.3 6/18/2012
35. DogConfigurator
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogConfigurator DogSemanticHouseModel
Manages bundle-specific
DogOntLibrary DogDeviceModel configurations
Property files
DogConfigurator DogLogger
XML files
Additional files (ontology, images, etc.)
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
Provides configurations to all bundles implementing the
ManagedService interface
35 Dario Bonino - Dog 2.3 6/18/2012
36. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
36 Dario Bonino - Dog 2.3 6/18/2012
37. DogLogger
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogLogger DogSemanticHouseModel
DogOntLibrary DogDeviceModel
Provides logging facilities to all Core bundles
Can log on console or file
DogConfigurator DogLogger
Dog2Library apply different handlers (file, console) to
Can DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
different logging levels y
37 Dario Bonino - Dog 2.3 6/18/2012
38. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
38 Dario Bonino - Dog 2.3 6/18/2012
39. Dog2Library
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
Dog2Library DogSemanticHouseModel
DogOntLibrary DogDeviceModel
Defines all the Message Types used for inter-bundle
communication
DogConfigurator DogLogger
Defines all the bundle service interfaces
Dog2Library DogSemanticLibrar
Defines core-level notifications (not defined in DogOnt)
DogJaxBLibrary
y
MeasureLibrary org.rxtx
Provides utility classes to other bundles
39 Dario Bonino - Dog 2.3 6/18/2012
40. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
40 Dario Bonino - Dog 2.3 6/18/2012
41. DogJaxBLibrary
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogJaxBLibrary DogSemanticHouseModel
DogOntLibrary DogDeviceModel
Provides XML serialization / de-serialiazion for
Inner messages
DogConfigurator DogLogger
Outer messages
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
Configurations y
Etc.
41 Dario Bonino - Dog 2.3 6/18/2012
42. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
42 Dario Bonino - Dog 2.3 6/18/2012
43. DogSemanticLibrary
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticLibraryDogSemanticHouseModel
DogOntLibrary DogDeviceModel
Encapsulates and makes available all semantics-
related libraries
DogConfigurator DogLogger
Jena
Dog2Library DogSemanticLibrar
Pellet DogJaxBLibrary MeasureLibrary org.rxtx
y
SPARQL query facilitator
43 Dario Bonino - Dog 2.3 6/18/2012
44. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
44 Dario Bonino - Dog 2.3 6/18/2012
45. MeasureLibrary
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
MeasureLibrary DogSemanticHouseModel
DogOntLibrary DogDeviceModel
Exports the JScience library to all Dog bundles
WillDogConfigurator
define un-supported JScience unit of
DogLogger
measures
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
45 Dario Bonino - Dog 2.3 6/18/2012
46. Core
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
DogSemanticHouseModel
DogOntLibrary DogDeviceModel
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
46 Dario Bonino - Dog 2.3 6/18/2012
47. Org.rxtx
DogXMLEndPoint DogRESTEndPoint
DogStateMonito DogSchedule DogExecuto DogDeviceManag DogNotificationManage
r r r er r
DogAutoStart
DogSimpleHouseMode
DogDeviceFactory
l
Org.rxtx DogSemanticHouseModel
DogOntLibrary DogDeviceModel
Exports the serial port API library (rxtx) to all Dog
bundles
DogConfigurator DogLogger
Dog2Library DogSemanticLibrar
DogJaxBLibrary MeasureLibrary org.rxtx
y
47 Dario Bonino - Dog 2.3 6/18/2012
53. Gateway driver
Gateway Driver
Supports multi-gateway operation for a given
network technology
Handles the association betweenDriver
devices and
gateways Driver
Device Driver
Permits to install device driver bundles only if the
Gatewaycorresponding network gateway is present (in the
configuration)
Driver
53 Dario Bonino - Dog 2.3 6/18/2012
55. Device Driver
Device Driver
Implements the DogOnt device features for a
given class of devices
Driver
Translates ontology-defined commands,
Driver
functionalities and states into network level
messages Device Driver
Gateway
One device driver per each DogOnt device
Driver
class
Sometimes the same driver can serve multiple
device classes but this should be avoided
55 Dario Bonino - Dog 2.3 6/18/2012
57. Add-on
DogRulesBundl
e
DogPowerModelBun
dle
DogPowerBundl
e
57 Dario Bonino - Dog 2.3 6/18/2012
58. DogRulesBundle
DogRulesBundle
Provides a rule-engine runtime for
Defining automation scenarios
Interoperation
DogPowerModelBun
Complex device behaviors
Programmable through dedicated
dle
DogMessages
DogPowerBundl
XML-based rule definitions
e Uses notifications as triggers, states as
constraints and commands as rule
consequent
Supports time-driven triggers
58 Dario Bonino - Dog 2.3 6/18/2012
59. Add-on
DogRulesBundl
e
DogPowerModelBun
dle
DogPowerBundl
e
59 Dario Bonino - Dog 2.3 6/18/2012
60. Add-on
DogPowerModelBundle
DogRulesBundl extension of DogOnt
Handles the power
e
Plug in the main Semantic House Model
Provides power-specific query functionalities
on the model
DogPowerModelBun
dle
DogPowerBundl
e
60 Dario Bonino - Dog 2.3 6/18/2012
61. Add-on
DogRulesBundl
e
DogPowerModelBun
dle
DogPowerBundl
e
61 Dario Bonino - Dog 2.3 6/18/2012
62. Add-on
DogPowerBundle
DogRulesBundl
Exploits the DogPowerModelBundle
e
Provides power consumption estimation based on
Actual measures
Typical/Nominal values defined in the DogOnt power
extension
DogPowerModelBun
Disaggregates actual measures when needed
dle
Keeps an updated snapshot of the current home
DogPowerBundl
power consumption
e
62 Dario Bonino - Dog 2.3 6/18/2012
64. Start-up
Development
Configured in Eclipse (Helios)
Bundles are automatically started
No pre-defined start-up order
Production
Bundles are started by the DogAutoStart bundle
No pre-defined start-up order for most bundles
If both Semantic and Simple House Model are present,
the Simple House Model is shut down
64 Dario Bonino - Dog 2.3 6/18/2012
65. Start-up order?
No explicit order, except for the DogAutoStart bundle
Each bundle waits for the availability of required
services before registering to the OSGi framework
When off-line and run-time dependencies are
satisfied, bundles register their own
services, possibly enabling the registration of other
bundles
Library bundles start without waiting
No dependencies
65 Dario Bonino - Dog 2.3 6/18/2012
66. Start-up example
Bundles are installed
Bundles start their lifecycle and become resolved
Bundles with no dependencies start (active)
All library bundles
The other bundles start as soon as their
dependencies are satisfied (service being available)
When an House Model provider (either the Simple or
the Semantic House Model) becomes available
The device factory creates all devices defined in the
house model
The device manager takes care of device/driver
attachment
All devices for which a driver cannot be found become
66
idle Dario Bonino - Dog 2.3 6/18/2012
67. Start-up example
On the driver side
Network drivers start as soon as the DogConfigurator is
started (if they need configuration)
Gateway drivers start when their associated network
driver becomes active (exposing the network service)
Device drivers become active if both the network driver
and the gateway driver for their associated technologies
are active
When a device (gateway) driver becomes active
All idle devices are matched against the driver
Matching devices attach the driver and become active
Non-Matching devices remain idle
67 Dario Bonino - Dog 2.3 6/18/2012
74. The Dog Mantra
1. In DogOnt we trust
2. Never stop
auto-generation
3. Configuration
first
74 Dario Bonino - Dog 2.3 6/18/2012
75. In DogOnt we trust
Internal representations and drivers must be
ontology-aware, at different degrees
Therefore:
All device-related bundles / modules / libraries must be
compliant with the DogOnt model
Functionalities
States
Behaviors
Whenever a new device must be represented
First check the corresponding ontology
If missing, amend the ontology (by coordinating your action with the
coordinator of the ontology development “group”)
If present, conform to the device model when developing the
corresponding driver / module / library
75 Dario Bonino - Dog 2.3 6/18/2012
76. In DogOnt we trust (2)
DogOnt is not only for description!
At runtime it is used for
Answering model queries
Configuration
Interoperation rules
Provide model handling capabilities
Model update
Model merging
Model querying (see above)
Offline it is used for
Describing specific environments (related to runtime)
Ensure DogDevice / DogOnt device coherency
By means of AutoGeneration
76 Dario Bonino - Dog 2.3 6/18/2012
77. In DogOnt we trust (4)
Even when we do not use it!
Installations with reduced computational power
Simple Home
XML configuration
Auto-generation from the full ontology instantiation
Using the same process adopted for runtime configuration querying
using the Semantic House Model
I.e., it.polito.elite.domotics.ontologies.dogont.DogOnt2XMLDog
77 Dario Bonino - Dog 2.3 6/18/2012
78. In DogOnt we trust (3)
Thing
Configuration Lamp1
DogOnt Building thing
Controls
Instances
Controllable UnControllablle
Button1
Appliance
HousePlants Lamp2
s Controls
Auto
White Brown Electrica HVAC Generation
Good Good l Syste Security
s s System m
Power
Consumption Device Semantic
Representations House
Applications
Model
Eletric Power
Consumption
Configuration Power
Lamp1Pw =
18W Model
78 Dario Bonino - Dog 2.3 6/18/2012
79. Never Stop Auto-generation (2)
Ensure DogDevice / DogOnt device coherency
Autogenerate all possible components starting from the
ontology
Device category
Device model
DogCommands
DogStates
DogStateValues
> 400 Java classes in one time (< 1 min)
Advantages
Only two points of failure
The autogeneration process
The class templates used in the generation process
79 Dario Bonino - Dog 2.3 6/18/2012
80. Never Stop Auto-generation (3)
Advantages
Less burden on writing very similar classes
Less errors as writing device-related classes is error
prone
Quick generation time
Robust enough to tackle typical ontology changes
Class creation / modification / deletion
Shortcomings
Needs changes if the ontology structure changes heavily
Relation / Property changes
Especially if existing, core properties are modified
However change effect is confined to the auto-generation
process
80 Dario Bonino - Dog 2.3 6/18/2012
81. Never Stop Auto-generation (4)
Available through
Dog Utilities
i.e., it.polito.elite.domotics.ontologies.dogont.DogOnt2Dog.
In conclusion…
Never stop auto-generation,
i.e., auto-generate all the Dog modules that can be written
by only exploiting DogOnt and Code templates
81 Dario Bonino - Dog 2.3 6/18/2012
82. Configuration First
Bundle-specific information
E.g., network addresses, ports, sampling times,
configuration files, etc.
Must be exposed through the DogConfigurator service
i.e., must be accessed through the ManagedService interface
Avoid hard-coding
Never, never, never
Hardcode information in bundle code
Soft-hardcode information in the bundle archive
Avoid using configuration parameters for properties
defined in DogOnt
E.g., gateway IP address, gateway port, etc.
82 Dario Bonino - Dog 2.3 6/18/2012
83. Beware of Dog!
1. Think first!
2. Comment, comment and comment!
3. Check spelling
4. Do not hardcode, use configuration
5. Design & implement for the future
6. Do housekeeping
7. Document your choices
83 Dario Bonino - Dog 2.3 6/18/2012
84. Beware of Dog!
/**
* A class implementing the functionalities of a generic Modbus gateway, as modeled in DogOnt. It offers ways to trace the number of currently
managed
* gateways and to access the corresponding slaves and registers, this permits multiple-gateway operation in Dog. Currently no gateway-
specific functions
* are available, however in future releases functionalities offered by the real devices will be modeled and implemented here.
*
* @author xxxxxxx
*
*/
public class ModbusGatewayDriver implements Driver, ServiceTrackerCustomizer
{
// The OSGi framework context
protected BundleContext context;
// System logger
LogService logger;
// the log identifier, unique for the class
public static String logId = "[ModbusGatewayDriver]: ";
// a reference to the network driver (currently not used by this driver
// version, in the future it will be used to implement gateway-specific
// functionalities).
private ModbusNetwork network;
// the registration object needed to handle the life span of this bundle in
// the OSGi framework (it is a ServiceRegistration object for use by the
// bundle registering the service to update the service's properties or to
// unregister the service).
private ServiceRegistration regDriver;
// the set of currently connected gateways... indexed by their ids
private Map<String, ModbusGatewayDriverInstance> connectedGateways;
… 84 Dario Bonino - Dog 2.3 6/18/2012
85. Beware of Dog!
public void run()
{ Spelling errors!
// get the service pid No comments!
String serivicePid = (String) serviceRef.getProperty(Constants.SERVICE_PID);
Object managedServiceObj = configurationAdmin.context.getService(serviceRef);
if (managedServiceObj instanceof ManagedService)
{
ManagedService managedService = (ManagedService) managedServiceObj;
if (serivicePid != null && managedService != null)
{
this.configAdminLogger.log(LogService.LOG_INFO,
this.logId + String.format("%s search for configuration", serivicePid));
if (configurationAdmin.configFileList.containsKey(servicePid))
{
Properties propConfig =
configurationAdmin.getConfigurationFromPid(servicePid);
try
{
managedService.updated(propConfig);
}
catch (ConfigurationException e)
{
this.configAdminLogger.log(LogService.LOG_ERROR,
this.logId + e);
}
this.configAdminLogger.log(LogService.LOG_WARNING,
this.logId + String.format("%s configuration updated",
serivicePid));
}
} Questionable use of logging level
}
…
85 Dario Bonino - Dog 2.3 6/18/2012
86. Dog Development Guidelines
1. Check DogOnt
2. Respect OSGi specifications
1. Document yourself
2. Ask more-experienced Dog developers
3. Do not re-invent the wheel
4. If something can be done using an OSGi specification,
then the specification is the only correct choice!
3. Respect the DogArchitecture
1. Do not insert strict bundle dependencies, use services!
2. Do not duplicate functions in Dog
3. Do not mix different architectural levels
86 Dario Bonino - Dog 2.3 6/18/2012
87. Dog Development Guidelines
4. Develop a self-contained contribution
1. Clearly identify the contribution boundaries
2. Ask the development team for changes/improvements
involving other, possibly shared, Dog bundles
5. Work in team
1. Never commit not-working solutions
1. Unless you are the only one working on it and it
still is a “work-in-progress”
2. The solution does not impact on the other’s work
2. Always do complete commits
1. Check all dependencies, libraries, resources, etc.
87 Dario Bonino - Dog 2.3 6/18/2012
88. Dog Development Guidelines
5. Work in team
3. Always update before committing
1. To detect possible conflicts and get the latest updates
4. Respect the dead / wrong code policy
1. Remove dead code or not working code
2. Be aware that not working / un-complete components are
deleted after one month of grace time
3. Today we’ll delete the Effect bundles since they are in an
Error State since 3 months and 1e-mail alert!
5. Each bundle should have its own trunk (branches and
tags), on the SVN server
88 Dario Bonino - Dog 2.3 6/18/2012
89. Dog Development Guidelines
6. Be collaborative
1. Amend wrong / deprecated code in Dog as soon as you
find it
2. Ask for opinions on your design choices
3. Express your opinions on future works / versions
7. Develop for the future
1. Sound code
2. Polished code
3. Commented code
4. Document your code using Javadoc
5. Write documentation manuals when Javadoc is not
sufficient
8. Think first!
89 Dario Bonino - Dog 2.3 6/18/2012
91. License
This work is licensed under the Creative Commons “Attribution-
NonCommercial-ShareAlike Unported (CC BY-NC-SA 3,0)” License.
You are free:
to Share - to copy, distribute and transmit the work
to Remix - to adapt the work
Under the following conditions:
Attribution - You must attribute the work in the manner specified by the
author or licensor (but not in any way that suggests that they endorse you
or your use of the work).
Noncommercial - You may not use this work for commercial
purposes.
Share Alike - If you alter, transform, or build upon this work, you may
distribute the resulting work only under the same or similar license to
this one.
To view a copy of this license, visit
http://creativecommons.org/licenses/by-nc-sa/3.0/
91 Dario Bonino - Dog 2.3 6/18/2012