Middleware for automatic dynamic reconfiguration of context-driven services