I create iPOJO instances from factory configurations using Configuration
Admin and File Install. When the iPOJO instance becomes valid I do my
initialisation (which normally starts a Camel route) and when the iPOJO
instance becomes invalid I terminate my processing (which means that I
normally stop a Camel route).
@Validate
public void start() {
// Start the route
}
@Invalidate
public void stop() {
// Stop the route
}
To make it possible to control my iPOJO instances I use a controller
property as follows:
@Controller
@Property(name = "enable", mandatory = true)
private boolean mValid;
This allows me to enable/disable my service via configuration. However, I
have noticed that if an exception is thrown in the start() method above,
then the iPOJO becomes invalid and there is no way for me to make it valid
by changing any configuration property. It seems like I have to delete the
configuration and create a new one. Have I understood this correctly?
I would like a convenient way to either make my iPOJO instance valid again
or a way to dispose of the old instance and create a new one. How can I
accomplish this? It would be convenient if I could flag my iPOJO class with
an annotation like "deleteOnException" or something like that.
/Bengt