- public void handleEvent(Event event) {
- if(EventConstants.TOPIC_CREATED.equals(event.getTopic())) {
- LOG.info("Blueprint container for bundle {} was successfully created",
- event.getProperty(EventConstants.BUNDLE));
- } else if(EventConstants.TOPIC_FAILURE.equals(event.getTopic())) {
- // If the container timed out waiting for dependencies, we'll destroy it and start it again. This
- // is indicated via a non-null DEPENDENCIES property containing the missing dependencies. The
- // default timeout is 5 min and ideally we would set this to infinite but the timeout can only
- // be set at the bundle level in the manifest - there's no way to set it globally.
- if(event.getProperty(EventConstants.DEPENDENCIES) != null) {
- Bundle bundle = (Bundle) event.getProperty(EventConstants.BUNDLE);
-
- List<Object> paths = findBlueprintPaths(bundle);
- if(!paths.isEmpty()) {
- LOG.warn("Blueprint container for bundle {} timed out waiting for dependencies - restarting it",
- event.getProperty(EventConstants.BUNDLE));
-
- restartService.restartContainer(bundle, paths);
- }
+ public void blueprintEvent(final BlueprintEvent event) {
+ if (event.getType() == BlueprintEvent.CREATED) {
+ LOG.info("Blueprint container for bundle {} was successfully created", event.getBundle());
+ return;
+ }
+
+ // If the container timed out waiting for dependencies, we'll destroy it and start it again. This
+ // is indicated via a non-null DEPENDENCIES property containing the missing dependencies. The
+ // default timeout is 5 min and ideally we would set this to infinite but the timeout can only
+ // be set at the bundle level in the manifest - there's no way to set it globally.
+ if (event.getType() == BlueprintEvent.FAILURE && event.getDependencies() != null) {
+ Bundle bundle = event.getBundle();
+
+ List<Object> paths = findBlueprintPaths(bundle);
+ if (!paths.isEmpty()) {
+ LOG.warn("Blueprint container for bundle {} timed out waiting for dependencies - restarting it",
+ bundle);
+
+ restartService.restartContainer(bundle, paths);