Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Activate component only after another component's state is set

Hello dear fellow OSGi devs,

I have the following simplified scenario in my Declarative Services based project:

2 Components: Network and Login
Login depends on 1..1 Network component. Network takes care of connecting and disconnecting from a given network.

I would like to make the Login component dependency on Network satisfied only when the Network is actually connected, meaning the component would only be activated after the "network.connect()" method is successfully executed.

Approaches I have tried:
 - ConfigAdmin > Setting a property "isConnected" for the Network component using the ConfigAdmin when the "connect" method is successfully executed
Result: Does not work, since changing the properties will require a reactivation of the Network component, therefore recreating the component and losing the connection.

- Events > Make login implement EventHandler and listen to Network events. When event is "connected", react accordingly. the problem here is that the component must be enabled to be able to actually receive events. and this goes against the goal of only activating the component AFTER the network is connected..

I have tried google, read the specs several times but could not yet think of any suitable implementation , any ideas of how I could solve this?

Thanks in advance for any help or pointers!

--
Best Regards

Luciana Alvite

Back to the top